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
|
@ -29,6 +29,7 @@
|
|||
#include "keydb.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
#include "call-agent.h"
|
||||
|
||||
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
|
@ -46,6 +47,7 @@ migrate_secring (ctrl_t ctrl)
|
|||
dotlock_t lockhd = NULL;
|
||||
char *secring = NULL;
|
||||
char *flagfile = NULL;
|
||||
char *agent_version = NULL;
|
||||
|
||||
secring = make_filename (opt.homedir, "secring" EXTSEP_S "gpg", NULL);
|
||||
if (access (secring, F_OK))
|
||||
|
@ -72,6 +74,27 @@ migrate_secring (ctrl_t ctrl)
|
|||
goto leave;
|
||||
}
|
||||
|
||||
if (!agent_get_version (ctrl, &agent_version))
|
||||
{
|
||||
if (!gnupg_compare_version (agent_version, "2.1.0"))
|
||||
{
|
||||
log_error ("error: GnuPG agent version \"%s\" is too old. ",
|
||||
agent_version);
|
||||
log_error ("Please install an updated GnuPG agent.\n");
|
||||
log_error ("migration aborted\n");
|
||||
xfree (agent_version);
|
||||
goto leave;
|
||||
}
|
||||
xfree (agent_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error ("error: GnuPG agent unusable. "
|
||||
"Please check that a GnuPG agent can be started.\n");
|
||||
log_error ("migration aborted\n");
|
||||
goto leave;
|
||||
}
|
||||
|
||||
log_info ("porting secret keys from '%s' to gpg-agent\n", secring);
|
||||
if (!import_old_secring (ctrl, secring))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue