mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Check gpg-agent version before 2.1 migration.
* g10/call-agent.c, g10/call-agent.h (agent_get_version): New. * g10/migrate.c (migrate_secring): Abort migration if agent_get_version returns not at least 2.1.0 -- GnuPG-bug-id: 1718 On the first installation of GnuPG 2.1 it is likely that an old gpg-agent is still running in the environment. In that case the migration would fail. Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
This commit is contained in:
parent
09a8f75f30
commit
a6fcdbc9e0
3 changed files with 55 additions and 0 deletions
|
@ -2277,3 +2277,33 @@ agent_passwd (ctrl_t ctrl, const char *hexkeygrip, const char *desc,
|
|||
cache_nonce_status_cb, &cn_parm);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Return the version reported by gpg-agent. */
|
||||
gpg_error_t
|
||||
agent_get_version (ctrl_t ctrl, char **r_version)
|
||||
{
|
||||
gpg_error_t err;
|
||||
membuf_t data;
|
||||
|
||||
err = start_agent (ctrl, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
init_membuf (&data, 64);
|
||||
err = assuan_transact (agent_ctx, "GETINFO version",
|
||||
membuf_data_cb, &data,
|
||||
NULL, NULL, NULL, NULL);
|
||||
if (err)
|
||||
{
|
||||
xfree (get_membuf (&data, NULL));
|
||||
*r_version = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
put_membuf (&data, "", 1);
|
||||
*r_version = get_membuf (&data, NULL);
|
||||
if (!*r_version)
|
||||
err = gpg_error_from_syserror ();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue