GNUPG-1-9-BRANCH gnupg/common (ChangeLog simple-pwquery.c simple-pwquery.h)

cvs user marcus cvs at cvs.gnupg.org
Mon Jul 4 06:31:30 CEST 2005


    Date: Monday, July 4, 2005 @ 06:55:48
  Author: marcus
    Path: /cvs/gnupg/gnupg/common
     Tag: GNUPG-1-9-BRANCH

Modified: ChangeLog simple-pwquery.c simple-pwquery.h

2005-07-04  Marcus Brinkmann  <marcus at g10code.de>

	* simple-pwquery.h (simple_pwclear): New prototype.
	* simple-pwquery.c (simple_pwclear): New function.


------------------+
 ChangeLog        |    5 +++++
 simple-pwquery.c |   24 +++++++++++++++++++++++-
 simple-pwquery.h |    3 +++
 3 files changed, 31 insertions(+), 1 deletion(-)


Index: gnupg/common/ChangeLog
diff -u gnupg/common/ChangeLog:1.30.2.54 gnupg/common/ChangeLog:1.30.2.55
--- gnupg/common/ChangeLog:1.30.2.54	Thu Jun 16 10:12:00 2005
+++ gnupg/common/ChangeLog	Mon Jul  4 06:55:48 2005
@@ -1,3 +1,8 @@
+2005-07-04  Marcus Brinkmann  <marcus at g10code.de>
+
+	* simple-pwquery.h (simple_pwclear): New prototype.
+	* simple-pwquery.c (simple_pwclear): New function.
+
 2005-06-15  Werner Koch  <wk at g10code.com>
 
 	* miscellaneous.c (make_printable_string): Made P a void*.
Index: gnupg/common/simple-pwquery.c
diff -u gnupg/common/simple-pwquery.c:1.1.2.11 gnupg/common/simple-pwquery.c:1.1.2.12
--- gnupg/common/simple-pwquery.c:1.1.2.11	Thu Jun 16 10:12:00 2005
+++ gnupg/common/simple-pwquery.c	Mon Jul  4 06:55:48 2005
@@ -546,6 +546,28 @@
 }
 
 
+/* Ask the gpg-agent to clear the passphrase for the cache ID CACHEID.  */
+int
+simple_pwclear (const char *cacheid)
+{
+  char line[500];
+  char *p;
+
+  /* We need not more than 50 characters for the command and the
+     terminating nul.  */
+  if (strlen (cacheid) * 3 > sizeof (line) - 50)
+    return SPWQ_PROTOCOL_ERROR;
+
+  strcpy (line, "CLEAR_PASSPHRASE ");
+  p = line + 17;
+  p = copy_and_escape (p, cacheid);
+  *p++ = '\n';
+  *p++ = '\0';
+
+  return simple_query (line);
+}
+
+
 /* Perform the simple query QUERY (which must be new-line and 0
    terminated) and return the error code.  */
 int
@@ -576,7 +598,7 @@
       rc = SPWQ_PROTOCOL_ERROR;
       goto leave;
     }
-      
+  
   if (response[0] == 'O' && response[1] == 'K') 
     /* OK, do nothing.  */;
   else if ((nread > 7 && !memcmp (response, "ERR 111", 7)
Index: gnupg/common/simple-pwquery.h
diff -u gnupg/common/simple-pwquery.h:1.1.2.1 gnupg/common/simple-pwquery.h:1.1.2.2
--- gnupg/common/simple-pwquery.h:1.1.2.1	Tue Dec 21 20:05:15 2004
+++ gnupg/common/simple-pwquery.h	Mon Jul  4 06:55:48 2005
@@ -57,6 +57,9 @@
                       const char *description,
                       int *errorcode);
 
+/* Ask the gpg-agent to clear the passphrase for the cache ID CACHEID.  */
+int simple_pwclear (const char *cacheid);
+
 /* Perform the simple query QUERY (which must be new-line and 0
    terminated) and return the error code.  */
 int simple_query (const char *query);




More information about the Gnupg-commits mailing list