[svn] GnuPG - r5225 - trunk/sm
svn author wk
cvs at cvs.gnupg.org
Mon Dec 14 13:33:24 CET 2009
Author: wk
Date: 2009-12-14 13:33:23 +0100 (Mon, 14 Dec 2009)
New Revision: 5225
Modified:
trunk/sm/ChangeLog
trunk/sm/server.c
Log:
add new gpgsm server command PASSWD
Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog 2009-12-10 13:00:30 UTC (rev 5224)
+++ trunk/sm/ChangeLog 2009-12-14 12:33:23 UTC (rev 5225)
@@ -1,3 +1,8 @@
+2009-12-14 Werner Koch <wk at g10code.com>
+
+ * server.c (cmd_passwd): New.
+ (register_commands): Register new command.
+
2009-12-10 Werner Koch <wk at g10code.com>
* gpgsm.c: Add option --ignore-cert-extension.
Modified: trunk/sm/server.c
===================================================================
--- trunk/sm/server.c 2009-12-10 13:00:30 UTC (rev 5224)
+++ trunk/sm/server.c 2009-12-14 12:33:23 UTC (rev 5225)
@@ -1068,7 +1068,6 @@
return rc;
}
-
static const char hlp_getinfo[] =
"GETINFO <what>\n"
"\n"
@@ -1141,6 +1140,39 @@
}
+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 @@
{ "DELKEYS", cmd_delkeys, hlp_delkeys },
{ "GETAUDITLOG", cmd_getauditlog, hlp_getauditlog },
{ "GETINFO", cmd_getinfo, hlp_getinfo },
+ { "PASSWD", cmd_passwd, hlp_passwd },
{ NULL }
};
int i, rc;
More information about the Gnupg-commits
mailing list