aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-01-20 16:49:10 +0000
committerWerner Koch <[email protected]>2002-01-20 16:49:10 +0000
commit6aae6603af7b3d93bcf6b74b72d7475ecf3eec20 (patch)
tree2c0dbfa60cfce26c2cb5fb71ad0ac57e41a0b8ce
parent* gpg-agent.c (main): Disable core dumps. (diff)
downloadgnupg-6aae6603af7b3d93bcf6b74b72d7475ecf3eec20.tar.gz
gnupg-6aae6603af7b3d93bcf6b74b72d7475ecf3eec20.zip
* command.c (cmd_get_passphrase): Remove the plus signs.
* query.c (start_pinentry): Send no-grab option to pinentry * gpg-agent.c (main): Move variable grab as no_grab to agent.h.
-rw-r--r--agent/ChangeLog7
-rw-r--r--agent/agent.h1
-rw-r--r--agent/command.c21
-rw-r--r--agent/gpg-agent.c4
-rw-r--r--agent/query.c11
5 files changed, 35 insertions, 9 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 536aed833..89aaa5401 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-20 Werner Koch <[email protected]>
+
+ * command.c (cmd_get_passphrase): Remove the plus signs.
+
+ * query.c (start_pinentry): Send no-grab option to pinentry
+ * gpg-agent.c (main): Move variable grab as no_grab to agent.h.
+
2002-01-19 Werner Koch <[email protected]>
* gpg-agent.c (main): Disable core dumps.
diff --git a/agent/agent.h b/agent/agent.h
index ca70150c8..6db2f4b9c 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -36,6 +36,7 @@ struct {
int batch; /* batch mode */
const char *homedir; /* configuration directory name */
const char *pinentry_program;
+ int no_grab; /* don't let the pinentry grab the keyboard */
} opt;
diff --git a/agent/command.c b/agent/command.c
index dae6c34e6..37276991c 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -266,6 +266,16 @@ cmd_genkey (ASSUAN_CONTEXT ctx, char *line)
}
+static void
+plus_to_blank (char *s)
+{
+ for (; *s; s++)
+ {
+ if (*s == '+')
+ *s = ' ';
+ }
+}
+
/* GET_PASSPHRASE <cache_id> [<error_message> <prompt> <description>]
This function is usually used to ask for a passphrase to be used
@@ -340,6 +350,17 @@ cmd_get_passphrase (ASSUAN_CONTEXT ctx, char *line)
}
else
{
+ /* Note, that we only need to repalce the + characters and
+ should leave the other escaping in place becuase the escaped
+ sting is send verbatim to the pinentry which does the
+ unescaping (but not the + replacing) */
+ if (errtext)
+ plus_to_blank (errtext);
+ if (prompt)
+ plus_to_blank (prompt);
+ if (desc)
+ plus_to_blank (desc);
+
rc = agent_get_passphrase (&response, desc, prompt, errtext);
if (!rc)
{
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 1c3efee0b..0707e127e 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -229,7 +229,6 @@ main (int argc, char **argv )
int nogreeting = 0;
int pipe_server = 0;
int nodetach = 0;
- int grab = 0;
int csh_style = 0;
char *logfile = NULL;
int debug_wait = 0;
@@ -269,7 +268,6 @@ main (int argc, char **argv )
opt.homedir = "~/.gnupg-test";
#endif
}
- grab = 1;
/* check whether we have a config file on the commandline */
orig_argc = argc;
@@ -363,7 +361,7 @@ main (int argc, char **argv )
case oNoOptions: break; /* no-options */
case oHomedir: opt.homedir = pargs.r.ret_str; break;
case oNoDetach: nodetach = 1; break;
- case oNoGrab: grab = 0; break;
+ case oNoGrab: opt.no_grab = 1; break;
case oLogFile: logfile = pargs.r.ret_str; break;
case oCsh: csh_style = 1; break;
case oSh: csh_style = 0; break;
diff --git a/agent/query.c b/agent/query.c
index 45fcbfd8e..fcee18c2a 100644
--- a/agent/query.c
+++ b/agent/query.c
@@ -95,12 +95,11 @@ start_pinentry (void)
log_debug ("connection to PIN entry established\n");
- if (DBG_COMMAND)
- {
- log_debug ("waiting for debugger [hit RETURN when ready] .....\n");
- getchar ();
- log_debug ("... okay\n");
- }
+ rc = assuan_transact (entry_ctx,
+ opt.no_grab? "OPTION no-grab":"OPTION grab",
+ NULL, NULL, NULL, NULL);
+ if (rc)
+ return map_assuan_err (rc);
return 0;
}