summaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-09-01 20:43:57 +0200
committerWerner Koch <wk@gnupg.org>2020-09-01 20:43:57 +0200
commit2cd8bae23d7382588cf096df3eed83e02331a2bf (patch)
tree33d1132e0e52cd80ddfd9d9b624676cc25a8f491 /g10/call-agent.c
parentsm: Fix a bug in the rfc2253 parser (diff)
downloadgnupg2-2cd8bae23d7382588cf096df3eed83e02331a2bf.tar.xz
gnupg2-2cd8bae23d7382588cf096df3eed83e02331a2bf.zip
Use only one copy of the warn_server_mismatch function.
* common/asshelp.c (warn_server_version_mismatch): New. Actually a slightly modified version of warn_version_mismatch found in other modules. * common/status.c (gnupg_status_strings): New. * g10/cpr.c (write_status_strings2): New. * g10/call-agent.c (warn_version_mismatch): Use the new unified warn_server_version_mismatch function. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * g10/call-keyboxd.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. * tools/card-call-scd.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r--g10/call-agent.c38
1 files changed, 3 insertions, 35 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 806475de9..4e3bdf9e4 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -220,41 +220,9 @@ default_inq_cb (void *opaque, const char *line)
static gpg_error_t
warn_version_mismatch (assuan_context_t ctx, const char *servername, int mode)
{
- gpg_error_t err;
- char *serverversion;
- const char *myversion = gpgrt_strusage (13);
-
- err = get_assuan_server_version (ctx, mode, &serverversion);
- if (err)
- log_log (gpg_err_code (err) == GPG_ERR_NOT_SUPPORTED?
- GPGRT_LOGLVL_INFO : GPGRT_LOGLVL_ERROR,
- _("error getting version from '%s': %s\n"),
- servername, gpg_strerror (err));
- else if (compare_version_strings (serverversion, myversion) < 0)
- {
- char *warn;
-
- warn = xtryasprintf (_("server '%s' is older than us (%s < %s)"),
- servername, serverversion, myversion);
- if (!warn)
- err = gpg_error_from_syserror ();
- else
- {
- log_info (_("WARNING: %s\n"), warn);
- if (!opt.quiet)
- {
- log_info (_("Note: Outdated servers may lack important"
- " security fixes.\n"));
- log_info (_("Note: Use the command \"%s\" to restart them.\n"),
- "gpgconf --kill all");
- }
- write_status_strings (STATUS_WARNING, "server_version_mismatch 0",
- " ", warn, NULL);
- xfree (warn);
- }
- }
- xfree (serverversion);
- return err;
+ return warn_server_version_mismatch (ctx, servername, mode,
+ write_status_strings2, NULL,
+ !opt.quiet);
}