mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
add new gpgsm server command PASSWD
This commit is contained in:
parent
a51675fabe
commit
ed7bf14034
@ -1,3 +1,8 @@
|
||||
2009-12-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* server.c (cmd_passwd): New.
|
||||
(register_commands): Register new command.
|
||||
|
||||
2009-12-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpgsm.c: Add option --ignore-cert-extension.
|
||||
|
35
sm/server.c
35
sm/server.c
@ -1068,7 +1068,6 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static const char hlp_getinfo[] =
|
||||
"GETINFO <what>\n"
|
||||
"\n"
|
||||
@ -1141,6 +1140,39 @@ cmd_getinfo (assuan_context_t ctx, char *line)
|
||||
}
|
||||
|
||||
|
||||
static const char hlp_passwd[] =
|
||||
"PASSWD <userID>\n"
|
||||
"\n"
|
||||
"Change the passphrase of the secret key for USERID.";
|
||||
static gpg_error_t
|
||||
cmd_passwd (assuan_context_t ctx, char *line)
|
||||
{
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
gpg_error_t err;
|
||||
ksba_cert_t cert = NULL;
|
||||
char *grip = NULL;
|
||||
|
||||
line = skip_options (line);
|
||||
|
||||
err = gpgsm_find_cert (line, NULL, &cert);
|
||||
if (err)
|
||||
;
|
||||
else if (!(grip = gpgsm_get_keygrip_hexstring (cert)))
|
||||
err = gpg_error (GPG_ERR_INTERNAL);
|
||||
else
|
||||
{
|
||||
char *desc = gpgsm_format_keydesc (cert);
|
||||
err = gpgsm_agent_passwd (ctrl, grip, desc);
|
||||
xfree (desc);
|
||||
}
|
||||
|
||||
xfree (grip);
|
||||
ksba_cert_release (cert);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Return true if the command CMD implements the option OPT. */
|
||||
static int
|
||||
@ -1184,6 +1216,7 @@ register_commands (assuan_context_t ctx)
|
||||
{ "DELKEYS", cmd_delkeys, hlp_delkeys },
|
||||
{ "GETAUDITLOG", cmd_getauditlog, hlp_getauditlog },
|
||||
{ "GETINFO", cmd_getinfo, hlp_getinfo },
|
||||
{ "PASSWD", cmd_passwd, hlp_passwd },
|
||||
{ NULL }
|
||||
};
|
||||
int i, rc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user