mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Print warnings if old daemon versions are used.
* common/status.h (STATUS_WARNING): New. * g10/call-agent.c (warn_version_mismatch): New. (start_agent): Call warn function. * g10/call-dirmngr.c: Include status.h. (warn_version_mismatch): New. (create_context): Call warn function. * sm/call-agent.c (warn_version_mismatch): New. (start_agent): Call warn function. (gpgsm_agent_learn): Call warn function. * sm/call-dirmngr.c (warn_version_mismatch): New. (prepare_dirmngr): Call warn function. -- We have seen too often bug reports which are due to still running old versions of the daemons. To catch this problematic use we now print warning messages and also provide the warning via the status interface. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
4d7ac43ff7
commit
2aa42baaf3
6 changed files with 164 additions and 7 deletions
|
@ -76,6 +76,41 @@ struct import_key_parm_s
|
|||
|
||||
|
||||
|
||||
/* Print a warning if the server's version number is less than our
|
||||
version number. Returns an error code on a connection problem. */
|
||||
static gpg_error_t
|
||||
warn_version_mismatch (ctrl_t ctrl, assuan_context_t ctx,
|
||||
const char *servername, int mode)
|
||||
{
|
||||
gpg_error_t err;
|
||||
char *serverversion;
|
||||
const char *myversion = strusage (13);
|
||||
|
||||
err = get_assuan_server_version (ctx, mode, &serverversion);
|
||||
if (err)
|
||||
log_error (_("error getting version from '%s': %s\n"),
|
||||
servername, gpg_strerror (err));
|
||||
else if (!compare_version_strings (serverversion, myversion))
|
||||
{
|
||||
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);
|
||||
gpgsm_status2 (ctrl, STATUS_WARNING, "server_version_mismatch 0",
|
||||
warn, NULL);
|
||||
xfree (warn);
|
||||
}
|
||||
}
|
||||
xfree (serverversion);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Try to connect to the agent via socket or fork it off and work by
|
||||
pipes. Handle the server's initial greeting */
|
||||
static int
|
||||
|
@ -108,7 +143,8 @@ start_agent (ctrl_t ctrl)
|
|||
log_info (_("no gpg-agent running in this session\n"));
|
||||
}
|
||||
}
|
||||
else if (!rc)
|
||||
else if (!rc && !(rc = warn_version_mismatch (ctrl, agent_ctx,
|
||||
GPG_AGENT_NAME, 0)))
|
||||
{
|
||||
/* Tell the agent that we support Pinentry notifications. No
|
||||
error checking so that it will work also with older
|
||||
|
@ -919,6 +955,10 @@ gpgsm_agent_learn (ctrl_t ctrl)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = warn_version_mismatch (ctrl, agent_ctx, SCDAEMON_NAME, 2);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
init_membuf (&data, 4096);
|
||||
learn_parm.error = 0;
|
||||
learn_parm.ctrl = ctrl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue