diff options
Diffstat (limited to 'sm/call-agent.c')
-rw-r--r-- | sm/call-agent.c | 16 |
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; |