summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2024-02-27 10:35:46 +0100
committerWerner Koch <wk@gnupg.org>2024-02-27 10:36:22 +0100
commit962058f704867082d6d00f6467a79c78e41169ca (patch)
tree4cdb21422cdd037add8db508644ac39483cc8264
parentagent: Allow GET_PASSPHRASE in restricted mode. (diff)
downloadgnupg2-962058f704867082d6d00f6467a79c78e41169ca.tar.xz
gnupg2-962058f704867082d6d00f6467a79c78e41169ca.zip
Allow tilde expansion for the foo-program options.
* agent/gpg-agent.c (parse_rereadable_options): Use make_filename_try for opt.pinentry_program. Change definition accordingly. * g10/gpg.c (main): Use make_filename for agent_program, dirmngr_program, and keyboxd_program. Change definition accordingly. * sm/gpgsm.c (main): Ditto. * tools/gpg-card.c (parse_arguments): Ditto. * tools/gpg-connect-agent.c (main): Ditto. * tools/gpg-wks-client.c (parse_arguments): Likewise. Do it also for option --output. (process_confirmation_request): Print a note for a successful sent. -- GnuPG-bug-id: 7017
-rw-r--r--agent/agent.h4
-rw-r--r--agent/gpg-agent.c6
-rw-r--r--g10/gpg.c15
-rw-r--r--g10/options.h6
-rw-r--r--sm/gpgsm.c16
-rw-r--r--sm/gpgsm.h6
-rw-r--r--tools/gpg-card.c12
-rw-r--r--tools/gpg-card.h6
-rw-r--r--tools/gpg-connect-agent.c18
-rw-r--r--tools/gpg-wks-client.c8
-rw-r--r--tools/gpg-wks.h6
11 files changed, 70 insertions, 33 deletions
diff --git a/agent/agent.h b/agent/agent.h
index f0b2a334e..06bc1e046 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -86,8 +86,8 @@ struct
/* Enable pinentry debugging (--debug 1024 should also be used). */
int debug_pinentry;
- /* Filename of the program to start as pinentry. */
- const char *pinentry_program;
+ /* Filename of the program to start as pinentry (malloced). */
+ char *pinentry_program;
/* Filename of the program to handle daemon tasks. */
const char *daemon_program[DAEMON_MAX_TYPE];
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index a5448ac38..5305098d2 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -864,6 +864,7 @@ parse_rereadable_options (gpgrt_argparse_t *pargs, int reread)
opt.debug = 0;
opt.no_grab = 1;
opt.debug_pinentry = 0;
+ xfree (opt.pinentry_program);
opt.pinentry_program = NULL;
opt.pinentry_touch_file = NULL;
xfree (opt.pinentry_invisible_char);
@@ -924,7 +925,10 @@ parse_rereadable_options (gpgrt_argparse_t *pargs, int reread)
case oNoGrab: opt.no_grab |= 1; break;
case oGrab: opt.no_grab |= 2; break;
- case oPinentryProgram: opt.pinentry_program = pargs->r.ret_str; break;
+ case oPinentryProgram:
+ xfree (opt.pinentry_program);
+ opt.pinentry_program = make_filename_try (pargs->r.ret_str, NULL);
+ break;
case oPinentryTouchFile: opt.pinentry_touch_file = pargs->r.ret_str; break;
case oPinentryInvisibleChar:
xfree (opt.pinentry_invisible_char);
diff --git a/g10/gpg.c b/g10/gpg.c
index 1d0b9d09e..80cb2f38b 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3592,9 +3592,18 @@ main (int argc, char **argv)
case oPersonalCompressPreferences:
pers_compress_list=pargs.r.ret_str;
break;
- case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
- case oKeyboxdProgram: opt.keyboxd_program = pargs.r.ret_str; break;
- case oDirmngrProgram: opt.dirmngr_program = pargs.r.ret_str; break;
+ case oAgentProgram:
+ xfree (opt.agent_program);
+ opt.agent_program = make_filename (pargs.r.ret_str, NULL);
+ break;
+ case oKeyboxdProgram:
+ xfree (opt.keyboxd_program);
+ opt.keyboxd_program = make_filename (pargs.r.ret_str, NULL);
+ break;
+ case oDirmngrProgram:
+ xfree (opt.dirmngr_program);
+ opt.dirmngr_program = make_filename (pargs.r.ret_str, NULL);
+ break;
case oDisableDirmngr: opt.disable_dirmngr = 1; break;
case oWeakDigest:
additional_weak_digest(pargs.r.ret_str);
diff --git a/g10/options.h b/g10/options.h
index 1e1110334..07516aab1 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -126,9 +126,9 @@ struct
int marginals_needed;
int completes_needed;
int max_cert_depth;
- const char *agent_program;
- const char *keyboxd_program;
- const char *dirmngr_program;
+ char *agent_program;
+ char *keyboxd_program;
+ char *dirmngr_program;
int disable_dirmngr;
const char *def_new_key_algo;
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index b3d48abce..3948372e4 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -1335,8 +1335,19 @@ main ( int argc, char **argv)
case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
case oChUid: break; /* Command line only (see above). */
- case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
- case oKeyboxdProgram: opt.keyboxd_program = pargs.r.ret_str; break;
+
+ case oAgentProgram:
+ xfree (opt.agent_program);
+ opt.agent_program = make_filename (pargs.r.ret_str, NULL);
+ break;
+ case oKeyboxdProgram:
+ xfree (opt.keyboxd_program);
+ opt.keyboxd_program = make_filename (pargs.r.ret_str, NULL);
+ break;
+ case oDirmngrProgram:
+ xfree (opt.dirmngr_program);
+ opt.dirmngr_program = make_filename (pargs.r.ret_str, NULL);
+ break;
case oDisplay:
set_opt_session_env ("DISPLAY", pargs.r.ret_str);
@@ -1354,7 +1365,6 @@ main ( int argc, char **argv)
case oLCctype: opt.lc_ctype = xstrdup (pargs.r.ret_str); break;
case oLCmessages: opt.lc_messages = xstrdup (pargs.r.ret_str); break;
- case oDirmngrProgram: opt.dirmngr_program = pargs.r.ret_str; break;
case oDisableDirmngr: opt.disable_dirmngr = 1; break;
case oPreferSystemDirmngr: /* Obsolete */; break;
case oProtectToolProgram:
diff --git a/sm/gpgsm.h b/sm/gpgsm.h
index 684251fda..faa03a9f4 100644
--- a/sm/gpgsm.h
+++ b/sm/gpgsm.h
@@ -60,16 +60,16 @@ struct
int use_keyboxd; /* Use the external keyboxd as storage backend. */
const char *config_filename; /* Name of the used config file. */
- const char *agent_program;
+ char *agent_program;
- const char *keyboxd_program;
+ char *keyboxd_program;
session_env_t session_env;
char *lc_ctype;
char *lc_messages;
int autostart;
- const char *dirmngr_program;
+ char *dirmngr_program;
int disable_dirmngr; /* Do not do any dirmngr calls. */
const char *protect_tool_program;
char *outfile; /* name of output file */
diff --git a/tools/gpg-card.c b/tools/gpg-card.c
index b34b42698..22b95d0d7 100644
--- a/tools/gpg-card.c
+++ b/tools/gpg-card.c
@@ -220,9 +220,15 @@ parse_arguments (gpgrt_argparse_t *pargs, gpgrt_opt_t *popts)
}
break;
- case oGpgProgram: opt.gpg_program = pargs->r.ret_str; break;
- case oGpgsmProgram: opt.gpgsm_program = pargs->r.ret_str; break;
- case oAgentProgram: opt.agent_program = pargs->r.ret_str; break;
+ case oGpgProgram:
+ opt.gpg_program = make_filename (pargs->r.ret_str, NULL);
+ break;
+ case oGpgsmProgram:
+ opt.gpgsm_program = make_filename (pargs->r.ret_str, NULL);
+ break;
+ case oAgentProgram:
+ opt.agent_program = make_filename (pargs->r.ret_str, NULL);
+ break;
case oStatusFD:
gnupg_set_status_fd (translate_sys2libc_fd_int (pargs->r.ret_int, 1));
diff --git a/tools/gpg-card.h b/tools/gpg-card.h
index 5b49ef31e..8d7975ba9 100644
--- a/tools/gpg-card.h
+++ b/tools/gpg-card.h
@@ -34,9 +34,9 @@ struct
unsigned int debug;
int quiet;
int with_colons;
- const char *gpg_program;
- const char *gpgsm_program;
- const char *agent_program;
+ char *gpg_program;
+ char *gpgsm_program;
+ char *agent_program;
int autostart;
int no_key_lookup; /* Assume --no-key-lookup for "list". */
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index eb897287c..cf4e64e2b 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -126,9 +126,9 @@ struct
int quiet; /* Be extra quiet. */
int autostart; /* Start the server if not running. */
const char *homedir; /* Configuration directory name */
- const char *agent_program; /* Value of --agent-program. */
- const char *dirmngr_program; /* Value of --dirmngr-program. */
- const char *keyboxd_program; /* Value of --keyboxd-program. */
+ char *agent_program; /* Value of --agent-program. */
+ char *dirmngr_program; /* Value of --dirmngr-program. */
+ char *keyboxd_program; /* Value of --keyboxd-program. */
int hex; /* Print data lines in hex format. */
int decode; /* Decode received data lines. */
int use_dirmngr; /* Use the dirmngr and not gpg-agent. */
@@ -1224,9 +1224,15 @@ main (int argc, char **argv)
case oVerbose: opt.verbose++; break;
case oNoVerbose: opt.verbose = 0; break;
case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
- case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
- case oDirmngrProgram: opt.dirmngr_program = pargs.r.ret_str; break;
- case oKeyboxdProgram: opt.keyboxd_program = pargs.r.ret_str; break;
+ case oAgentProgram:
+ opt.agent_program = make_filename (pargs.r.ret_str, NULL);
+ break;
+ case oDirmngrProgram:
+ opt.dirmngr_program = make_filename (pargs.r.ret_str, NULL);
+ break;
+ case oKeyboxdProgram:
+ opt.keyboxd_program = make_filename (pargs.r.ret_str, NULL);
+ break;
case oNoAutostart: opt.autostart = 0; break;
case oNoHistory: opt.no_history = 1; break;
case oHex: opt.hex = 1; break;
diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c
index edb31f38b..d3d1b522a 100644
--- a/tools/gpg-wks-client.c
+++ b/tools/gpg-wks-client.c
@@ -240,16 +240,16 @@ parse_arguments (gpgrt_argparse_t *pargs, gpgrt_opt_t *popts)
break;
case oGpgProgram:
- opt.gpg_program = pargs->r.ret_str;
+ opt.gpg_program = make_filename (pargs->r.ret_str, NULL);
break;
case oDirectory:
- opt.directory = pargs->r.ret_str;
+ opt.directory = make_filename (pargs->r.ret_str, NULL);
break;
case oSend:
opt.use_sendmail = 1;
break;
case oOutput:
- opt.output = pargs->r.ret_str;
+ opt.output = make_filename (pargs->r.ret_str, NULL);
break;
case oFakeSubmissionAddr:
fake_submission_addr = pargs->r.ret_str;
@@ -1787,6 +1787,8 @@ process_confirmation_request (estream_t msg, const char *mainfpr)
log_info ("no encryption key found - sending response in the clear\n");
err = send_confirmation_response (sender, address, nonce, 0, NULL);
}
+ if (!err)
+ log_info ("response sent to '%s' for '%s'\n", sender, address);
leave:
nvc_release (nvc);
diff --git a/tools/gpg-wks.h b/tools/gpg-wks.h
index 93039c1e8..4a33c5bec 100644
--- a/tools/gpg-wks.h
+++ b/tools/gpg-wks.h
@@ -40,9 +40,9 @@ struct
int with_colons;
int no_autostart;
int add_revocs;
- const char *output;
- const char *gpg_program;
- const char *directory;
+ char *output;
+ char *gpg_program;
+ char *directory;
const char *default_from;
strlist_t extra_headers;
} opt;