[svn] GnuPG - r4897 - in trunk: agent doc

svn author wk cvs at cvs.gnupg.org
Wed Dec 10 13:41:15 CET 2008


Author: wk
Date: 2008-12-10 13:41:15 +0100 (Wed, 10 Dec 2008)
New Revision: 4897

Modified:
   trunk/agent/ChangeLog
   trunk/agent/command.c
   trunk/doc/gpg-agent.texi
Log:
Add option --no-ask for GET_PASSPHRASE.


Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog	2008-12-10 10:57:47 UTC (rev 4896)
+++ trunk/agent/ChangeLog	2008-12-10 12:41:15 UTC (rev 4897)
@@ -1,3 +1,7 @@
+2008-12-10  Werner Koch  <wk at g10code.com>
+
+	* command.c (cmd_get_passphrase): Implement option --no-ask.
+
 2008-12-09  Werner Koch  <wk at g10code.com>
 
 	* gpg-agent.c (main): Call i18n_init before init_common_subsystems.

Modified: trunk/agent/command.c
===================================================================
--- trunk/agent/command.c	2008-12-10 10:57:47 UTC (rev 4896)
+++ trunk/agent/command.c	2008-12-10 12:41:15 UTC (rev 4897)
@@ -836,7 +836,7 @@
 }
 
 
-/* GET_PASSPHRASE [--data] [--check] <cache_id>
+/* GET_PASSPHRASE [--data] [--check] [--no-ask] <cache_id>
                   [<error_message> <prompt> <description>]
 
    This function is usually used to ask for a passphrase to be used
@@ -853,6 +853,10 @@
    If the option "--check" is used the passphrase constraints checks as
    implemented by gpg-agent are applied.  A check is not done if the
    passphrase has been found in the cache.
+
+   If the option "--no-ask" is used and the passphrase is not in the
+   cache the user will not be asked to enter a passphrase but the error
+   code GPG_ERR_NO_DATA is returned.  
 */
 
 static int
@@ -865,10 +869,11 @@
   char *cacheid = NULL, *desc = NULL, *prompt = NULL, *errtext = NULL;
   char *p;
   void *cache_marker;
-  int opt_data, opt_check;
+  int opt_data, opt_check, opt_no_ask;
 
   opt_data = has_option (line, "--data");
   opt_check = has_option (line, "--check");
+  opt_no_ask = has_option (line, "--no-ask");
   line = skip_options (line);
 
   cacheid = line;
@@ -920,6 +925,8 @@
       rc = send_back_passphrase (ctx, opt_data, pw);
       agent_unlock_cache_entry (&cache_marker);
     }
+  else if (opt_no_ask)
+    rc = gpg_error (GPG_ERR_NO_DATA);
   else
     {
       /* Note, that we only need to replace the + characters and

Modified: trunk/doc/gpg-agent.texi
===================================================================
--- trunk/doc/gpg-agent.texi	2008-12-10 10:57:47 UTC (rev 4896)
+++ trunk/doc/gpg-agent.texi	2008-12-10 12:41:15 UTC (rev 4897)
@@ -1036,7 +1036,7 @@
 clients to use the agent with minimum effort.
 
 @example
-  GET_PASSPHRASE [--data] [--check] @var{cache_id} [@var{error_message} @var{prompt} @var{description}]
+  GET_PASSPHRASE [--data] [--check] [--no-ask] @var{cache_id} [@var{error_message} @var{prompt} @var{description}]
 @end example
 
 @var{cache_id} is expected to be a string used to identify a cached
@@ -1067,6 +1067,11 @@
 constraints checks are applied.  A check is not done if the passphrase
 has been found in the cache.
 
+If the option @option{--no-ask} is used and the passphrase is not in the
+cache the user will not be asked to enter a passphrase but the error
+code @code{GPG_ERR_NO_DATA} is returned.  
+
+
 @example
   CLEAR_PASSPHRASE @var{cache_id}
 @end example




More information about the Gnupg-commits mailing list