aboutsummaryrefslogtreecommitdiffstats
path: root/g10/gpg.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-06-05 09:19:59 +0000
committerWerner Koch <[email protected]>2014-06-05 09:19:59 +0000
commit4f0625889b768eabdec52696bf15059a9e8d9c02 (patch)
treef523eab5acb0666c12c067ba27a159e21f434aa7 /g10/gpg.c
parentgpgsm: Fix commit be07ed65. (diff)
downloadgnupg-4f0625889b768eabdec52696bf15059a9e8d9c02.tar.gz
gnupg-4f0625889b768eabdec52696bf15059a9e8d9c02.zip
gpg: Auto-migrate existing secring.gpg.
* g10/migrate.c: New. * g10/import.c (import_old_secring): New. (import_one): Add arg silent. (transfer_secret_keys): Add arg batch. (import_secret_one): Add args batch and for_migration. * g10/gpg.c (main): Call migration function.
Diffstat (limited to 'g10/gpg.c')
-rw-r--r--g10/gpg.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index bd4ca4057..47cc85104 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3594,6 +3594,43 @@ main (int argc, char **argv)
break;
}
+
+ /* Check for certain command whether we need to migrate a
+ secring.gpg to the gpg-agent. */
+ switch (cmd)
+ {
+ case aListSecretKeys:
+ case aSign:
+ case aSignEncr:
+ case aSignEncrSym:
+ case aSignSym:
+ case aClearsign:
+ case aDecrypt:
+ case aSignKey:
+ case aLSignKey:
+ case aEditKey:
+ case aPasswd:
+ case aDeleteSecretKeys:
+ case aDeleteSecretAndPublicKeys:
+ case aKeygen:
+ case aImport:
+ case aExportSecret:
+ case aExportSecretSub:
+ case aGenRevoke:
+ case aDesigRevoke:
+ case aCardEdit:
+ case aChangePIN:
+ migrate_secring (ctrl);
+ break;
+ case aListKeys:
+ if (opt.with_secret)
+ migrate_secring (ctrl);
+ break;
+ default:
+ break;
+ }
+
+ /* The command dispatcher. */
switch( cmd )
{
case aServer: