aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-03-22 09:23:00 +0000
committerWerner Koch <[email protected]>2018-03-22 09:23:35 +0000
commit165bc38cefbc03515403b60b704cabf4dc0b71f4 (patch)
treec6ae0ebf291ca12f1213ea55d0a96b8362bac90d
parentscd: Support KDF DO setup. (diff)
downloadgnupg-165bc38cefbc03515403b60b704cabf4dc0b71f4.tar.gz
gnupg-165bc38cefbc03515403b60b704cabf4dc0b71f4.zip
gpg: Implement --dry-run for --passwd.
* g10/keyedit.c (change_passphrase): Take care of --dry-run. Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--doc/gpg.texi4
-rw-r--r--g10/keyedit.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/doc/gpg.texi b/doc/gpg.texi
index e3c3662a8..ad044ffc0 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -1126,7 +1126,9 @@ all affected self-signatures is set one second ahead.
@opindex passwd
Change the passphrase of the secret key belonging to the certificate
specified as @var{user-id}. This is a shortcut for the sub-command
-@code{passwd} of the edit key menu.
+@code{passwd} of the edit key menu. When using together with the
+option @option{--dry-run} this will not actually change the passphrase
+but check that the current passphrase is correct.
@end table
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 17cf7d6ea..4ade5cdba 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -1134,8 +1134,10 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
if (err)
goto leave;
+ /* Note that when using --dry-run we don't change the
+ * passphrase but merely verify the current passphrase. */
desc = gpg_format_keydesc (ctrl, pk, FORMAT_KEYDESC_NORMAL, 1);
- err = agent_passwd (ctrl, hexgrip, desc, 0,
+ err = agent_passwd (ctrl, hexgrip, desc, !!opt.dry_run,
&cache_nonce, &passwd_nonce);
xfree (desc);