summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2024-03-12 16:00:55 +0100
committerWerner Koch <wk@gnupg.org>2024-03-12 16:00:55 +0100
commit4485930f9fd9ff02ca5c8472cf6aed3fdb1280cf (patch)
tree683140a4a33b0f3accf5b1f2455274d251581970 /tools
parentgpg: Fix a possible segv due to an uninitialized gcrypt context. (diff)
parentPost release updates (diff)
downloadgnupg2-4485930f9fd9ff02ca5c8472cf6aed3fdb1280cf.tar.xz
gnupg2-4485930f9fd9ff02ca5c8472cf6aed3fdb1280cf.zip
Merge branch 'STABLE-BRANCH-2-4'
-- Resolved conflicts: NEWS common/exechelp-w32.c configure.ac
Diffstat (limited to 'tools')
-rw-r--r--tools/gpg-card.c14
-rw-r--r--tools/gpg-card.h6
-rw-r--r--tools/gpg-connect-agent.c18
-rw-r--r--tools/gpg-wks-client.c52
-rw-r--r--tools/gpg-wks-server.c2
-rw-r--r--tools/gpg-wks.h7
-rw-r--r--tools/watchgnupg.c2
-rw-r--r--tools/wks-util.c3
8 files changed, 67 insertions, 37 deletions
diff --git a/tools/gpg-card.c b/tools/gpg-card.c
index 056cdca66..8c9a26090 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));
@@ -402,7 +408,7 @@ nullnone (const char *s)
* success returns 0 and stores the number of bytes read at R_BUFLEN
* and the address of a newly allocated buffer at R_BUFFER. A
* complementary nul byte is always appended to the data but not
- * counted; this allows to pass NULL for R-BUFFER and consider the
+ * counted; this allows one to pass NULL for R-BUFFER and consider the
* returned data as a string. */
static gpg_error_t
get_data_from_file (const char *fname, char **r_buffer, size_t *r_buflen)
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 5323313e2..577b12575 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. */
@@ -1269,9 +1269,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 fa0278ae0..ef11a4e3e 100644
--- a/tools/gpg-wks-client.c
+++ b/tools/gpg-wks-client.c
@@ -78,6 +78,7 @@ enum cmd_and_opt_values
oNoAutostart,
oAddRevocs,
oNoAddRevocs,
+ oRealClean,
oDummy
};
@@ -121,8 +122,9 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_n (oWithColons, "with-colons", "@"),
ARGPARSE_s_s (oBlacklist, "blacklist", "@"),
ARGPARSE_s_s (oDirectory, "directory", "@"),
- ARGPARSE_s_n (oAddRevocs, "add-revocs", "add revocation certificates"),
+ ARGPARSE_s_n (oAddRevocs, "add-revocs", "@"),
ARGPARSE_s_n (oNoAddRevocs, "no-add-revocs", "do not add revocation certificates"),
+ ARGPARSE_s_n (oRealClean, "realclean", "remove most key signatures"),
ARGPARSE_s_s (oFakeSubmissionAddr, "fake-submission-addr", "@"),
@@ -154,7 +156,7 @@ static char **blacklist_array;
static size_t blacklist_array_len;
-static void wrong_args (const char *text) GPGRT_ATTR_NORETURN;
+static void wrong_args (const char *t1, const char *t2) GPGRT_ATTR_NORETURN;
static void add_blacklist (const char *fname);
static gpg_error_t proc_userid_from_stdin (gpg_error_t (*func)(const char *),
const char *text);
@@ -204,10 +206,15 @@ my_strusage( int level )
static void
-wrong_args (const char *text)
+wrong_args (const char *text, const char *text2)
{
- es_fprintf (es_stderr, _("usage: %s [options] %s\n"),
- gpgrt_strusage (11), text);
+#if GPGRT_VERSION_NUMBER >= 0x013000 /* >= 1.48 */
+ /* Skip the leading dashes if build with command support. */
+ if (text[0] == '-' && text[1] == '-' && text[2])
+ text += 2;
+#endif
+ es_fprintf (es_stderr, _("usage: %s %s [options] %s\n"),
+ gpgrt_strusage (11), text, text2);
exit (2);
}
@@ -235,16 +242,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;
@@ -268,6 +275,10 @@ parse_arguments (gpgrt_argparse_t *pargs, gpgrt_opt_t *popts)
opt.add_revocs = 0;
break;
+ case oRealClean:
+ opt.realclean = 1;
+ break;
+
case aSupported:
case aCreate:
case aReceive:
@@ -315,6 +326,9 @@ main (int argc, char **argv)
pargs.argc = &argc;
pargs.argv = &argv;
pargs.flags = ARGPARSE_FLAG_KEEP;
+#if GPGRT_VERSION_NUMBER >= 0x013000 /* >= 1.48 */
+ pargs.flags |= ARGPARSE_FLAG_COMMAND;
+#endif
cmd = parse_arguments (&pargs, opts);
gpgrt_argparse (NULL, &pargs, NULL);
@@ -350,7 +364,7 @@ main (int argc, char **argv)
/* Set defaults for non given options. */
if (!opt.gpg_program)
- opt.gpg_program = gnupg_module_name (GNUPG_MODULE_NAME_GPG);
+ opt.gpg_program = xstrdup (gnupg_module_name (GNUPG_MODULE_NAME_GPG));
if (!opt.directory)
opt.directory = "openpgpkey";
@@ -394,7 +408,7 @@ main (int argc, char **argv)
else
{
if (argc != 1)
- wrong_args ("--supported DOMAIN");
+ wrong_args ("--supported", "DOMAIN");
err = command_supported (argv[0]);
if (err && gpg_err_code (err) != GPG_ERR_FALSE)
log_error ("checking support failed: %s\n", gpg_strerror (err));
@@ -403,7 +417,7 @@ main (int argc, char **argv)
case aCreate:
if (argc != 2)
- wrong_args ("--create FINGERPRINT USER-ID");
+ wrong_args ("--create", "FINGERPRINT USER-ID");
err = command_create (argv[0], argv[1]);
if (err)
log_error ("creating request failed: %s\n", gpg_strerror (err));
@@ -411,7 +425,7 @@ main (int argc, char **argv)
case aReceive:
if (argc)
- wrong_args ("--receive < MIME-DATA");
+ wrong_args ("--receive", "< MIME-DATA");
err = wks_receive (es_stdin, command_receive_cb, NULL);
if (err)
log_error ("processing mail failed: %s\n", gpg_strerror (err));
@@ -419,7 +433,7 @@ main (int argc, char **argv)
case aRead:
if (argc)
- wrong_args ("--read < WKS-DATA");
+ wrong_args ("--read", "< WKS-DATA");
err = read_confirmation_request (es_stdin);
if (err)
log_error ("processing mail failed: %s\n", gpg_strerror (err));
@@ -427,7 +441,7 @@ main (int argc, char **argv)
case aCheck:
if (argc != 1)
- wrong_args ("--check USER-ID");
+ wrong_args ("--check", "USER-ID");
err = command_check (argv[0]);
break;
@@ -444,12 +458,12 @@ main (int argc, char **argv)
else if (argc == 2)
err = wks_cmd_install_key (*argv, argv[1]);
else
- wrong_args ("--install-key [FILE|FINGERPRINT USER-ID]");
+ wrong_args ("--install-key", "[FILE|FINGERPRINT USER-ID]");
break;
case aRemoveKey:
if (argc != 1)
- wrong_args ("--remove-key USER-ID");
+ wrong_args ("--remove-key", "USER-ID");
err = wks_cmd_remove_key (*argv);
break;
@@ -1779,6 +1793,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);
@@ -1903,7 +1919,7 @@ domain_matches_mbox (const char *domain, const char *mbox)
* so that for a key with
* uid: Joe Someone <joe@example.org>
* uid: Joe <joe@example.org>
- * only the news user id (and thus its self-signature) is used.
+ * only the newest user id (and thus its self-signature) is used.
* UIDLIST is nodified to set all MBOX fields to NULL for a processed
* user id. FPR is the fingerprint of the key.
*/
@@ -2010,7 +2026,7 @@ mirror_one_key (estream_t key)
continue; /* No mail box or already processed. */
if (uid->expired)
continue;
- if (!domain_matches_mbox (domain, uid->mbox))
+ if (*domain && !domain_matches_mbox (domain, uid->mbox))
continue; /* We don't want this one. */
if (is_in_blacklist (uid->mbox))
continue;
diff --git a/tools/gpg-wks-server.c b/tools/gpg-wks-server.c
index d3406bd79..31de67618 100644
--- a/tools/gpg-wks-server.c
+++ b/tools/gpg-wks-server.c
@@ -308,7 +308,7 @@ main (int argc, char **argv)
/* Set defaults for non given options. */
if (!opt.gpg_program)
- opt.gpg_program = gnupg_module_name (GNUPG_MODULE_NAME_GPG);
+ opt.gpg_program = xstrdup (gnupg_module_name (GNUPG_MODULE_NAME_GPG));
if (!opt.directory)
opt.directory = "/var/lib/gnupg/wks";
diff --git a/tools/gpg-wks.h b/tools/gpg-wks.h
index 93039c1e8..0601d48fe 100644
--- a/tools/gpg-wks.h
+++ b/tools/gpg-wks.h
@@ -40,9 +40,10 @@ struct
int with_colons;
int no_autostart;
int add_revocs;
- const char *output;
- const char *gpg_program;
- const char *directory;
+ int realclean;
+ char *output;
+ char *gpg_program;
+ char *directory;
const char *default_from;
strlist_t extra_headers;
} opt;
diff --git a/tools/watchgnupg.c b/tools/watchgnupg.c
index 7a7544bb5..39746d489 100644
--- a/tools/watchgnupg.c
+++ b/tools/watchgnupg.c
@@ -461,7 +461,7 @@ main (int argc, char **argv)
if (!tcp && argc == 1)
;
else if (tcp && (argc == 1 || argc == 2))
- ; /* Option --tcp optionally allows to also read from a socket. */
+ ; /* Option --tcp optionally allows one to also read from a socket. */
else if (!tcp && !argc)
{
/* No args given - figure out the socket using gpgconf. We also
diff --git a/tools/wks-util.c b/tools/wks-util.c
index 49dbb6f8a..4a15d672a 100644
--- a/tools/wks-util.c
+++ b/tools/wks-util.c
@@ -246,7 +246,8 @@ wks_get_key (estream_t *r_key, const char *fingerprint, const char *addrspec,
ccparray_put (&ccp, "--always-trust");
if (!binary)
ccparray_put (&ccp, "--armor");
- ccparray_put (&ccp, "--export-options=export-clean");
+ ccparray_put (&ccp, opt.realclean? "--export-options=export-realclean"
+ /* */ : "--export-options=export-clean");
ccparray_put (&ccp, "--export-filter");
ccparray_put (&ccp, filterexp);
ccparray_put (&ccp, "--export");