[svn] GnuPG - r5292 - branches/STABLE-BRANCH-2-0/sm
svn author wk
cvs at cvs.gnupg.org
Fri Mar 12 19:08:02 CET 2010
Author: wk
Date: 2010-03-12 19:08:02 +0100 (Fri, 12 Mar 2010)
New Revision: 5292
Modified:
branches/STABLE-BRANCH-2-0/sm/ChangeLog
branches/STABLE-BRANCH-2-0/sm/server.c
Log:
Add command passwd.
Modified: branches/STABLE-BRANCH-2-0/sm/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-2-0/sm/ChangeLog 2010-03-12 17:24:06 UTC (rev 5291)
+++ branches/STABLE-BRANCH-2-0/sm/ChangeLog 2010-03-12 18:08:02 UTC (rev 5292)
@@ -1,3 +1,8 @@
+2010-03-12 Werner Koch <wk at g10code.com>
+
+ * server.c (cmd_passwd): New. From trunk.
+ (register_commands): Register it.
+
2010-02-11 Marcus Brinkmann <marcus at g10code.de>
From trunk 2009-09-23, 2009-11-02, 2009-11-04, 2009-11-05, 2009-11-25,
Modified: branches/STABLE-BRANCH-2-0/sm/server.c
===================================================================
--- branches/STABLE-BRANCH-2-0/sm/server.c 2010-03-12 17:24:06 UTC (rev 5291)
+++ branches/STABLE-BRANCH-2-0/sm/server.c 2010-03-12 18:08:02 UTC (rev 5292)
@@ -1,6 +1,6 @@
/* server.c - Server mode and main entry point
- * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+ * 2009, 2010 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1142,6 +1142,42 @@
+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
command_has_option (const char *cmd, const char *cmdopt)
@@ -1184,6 +1220,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