aboutsummaryrefslogtreecommitdiffstats
path: root/sm/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2004-02-21 13:05:52 +0000
committerWerner Koch <[email protected]>2004-02-21 13:05:52 +0000
commit0c224cadf3f8b5ae259d8936f7963b56f63a0c26 (patch)
treea72e923d4d3d40e148e843d1be3608ec634a36f3 /sm/call-agent.c
parent* command.c (cmd_passwd): Take acount of a key description. (diff)
downloadgnupg-0c224cadf3f8b5ae259d8936f7963b56f63a0c26.tar.gz
gnupg-0c224cadf3f8b5ae259d8936f7963b56f63a0c26.zip
* keylist.c (list_internal_keys): Return error codes.
(list_external_keys, gpgsm_list_keys): Ditto. * server.c (do_listkeys): Ditto. * gpgsm.c (main): Display a key description for --passwd. * call-agent.c (gpgsm_agent_passwd): New arg DESC.
Diffstat (limited to 'sm/call-agent.c')
-rw-r--r--sm/call-agent.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c
index a0a1da5c3..053959b2c 100644
--- a/sm/call-agent.c
+++ b/sm/call-agent.c
@@ -710,9 +710,11 @@ gpgsm_agent_learn ()
}
-/* Ask the agent to change the passphrase of the key identified by HEXKEYGRIP. */
+/* Ask the agent to change the passphrase of the key identified by
+ HEXKEYGRIP. If DESC is not NULL, display instead of the default
+ description message. */
int
-gpgsm_agent_passwd (const char *hexkeygrip)
+gpgsm_agent_passwd (const char *hexkeygrip, const char *desc)
{
int rc;
char line[ASSUAN_LINELENGTH];
@@ -724,6 +726,16 @@ gpgsm_agent_passwd (const char *hexkeygrip)
if (!hexkeygrip || strlen (hexkeygrip) != 40)
return gpg_error (GPG_ERR_INV_VALUE);
+ if (desc)
+ {
+ snprintf (line, DIM(line)-1, "SETKEYDESC %s", desc);
+ line[DIM(line)-1] = 0;
+ rc = assuan_transact (agent_ctx, line,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ if (rc)
+ return map_assuan_err (rc);
+ }
+
snprintf (line, DIM(line)-1, "PASSWD %s", hexkeygrip);
line[DIM(line)-1] = 0;