1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: Implement --dry-run for --passwd.

* g10/keyedit.c (change_passphrase): Take care of --dry-run.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-03-22 10:23:00 +01:00
parent 0152ba7c98
commit 165bc38cef
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 6 additions and 2 deletions

View File

@ -1126,7 +1126,9 @@ all affected self-signatures is set one second ahead.
@opindex passwd @opindex passwd
Change the passphrase of the secret key belonging to the certificate Change the passphrase of the secret key belonging to the certificate
specified as @var{user-id}. This is a shortcut for the sub-command 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 @end table

View File

@ -1134,8 +1134,10 @@ change_passphrase (ctrl_t ctrl, kbnode_t keyblock)
if (err) if (err)
goto leave; 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); 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); &cache_nonce, &passwd_nonce);
xfree (desc); xfree (desc);