diff options
author | Andre Heinecke <aheinecke@intevation.de> | 2014-09-19 19:38:13 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2014-10-03 12:19:07 +0200 |
commit | a6fcdbc9e0fc0e45a3badc23813e689e83059b61 (patch) | |
tree | 6696e86689cb3770dd5f3bd360e7a998b721a995 /g10/call-agent.c | |
parent | po: Auto update translations. (diff) | |
download | gnupg2-a6fcdbc9e0fc0e45a3badc23813e689e83059b61.tar.xz gnupg2-a6fcdbc9e0fc0e45a3badc23813e689e83059b61.zip |
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>
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r-- | g10/call-agent.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c index 58f4a92c5..080df1867 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -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; +} |