[git] GnuPG - branch, master, updated. gnupg-2.1.4-6-g3a93054

by Neal H. Walfield cvs at cvs.gnupg.org
Tue May 19 15:32:18 CEST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  3a9305439b75ccd4446378d4fd87da087fd9c892 (commit)
       via  e201c20f25e7bed29088186c5f717d43047a0f4b (commit)
      from  c771963140cad7c1c25349bcde27e427effc0058 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3a9305439b75ccd4446378d4fd87da087fd9c892
Author: Neal H. Walfield <neal at g10code.com>
Date:   Tue May 19 15:00:16 2015 +0200

    agent: When the password cache is cleared, also clear the ext. cache.
    
    * agent/agent.h (agent_clear_passphrase): New declaration.
    * agent/call-pinentry.c (agent_clear_passphrase): New function.
    * agent/command.c (cmd_clear_passphrase): Call agent_clear_passphrase.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/agent/agent.h b/agent/agent.h
index d5d6392..dbbf689 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -374,7 +374,8 @@ int agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn);
 int agent_popup_message_start (ctrl_t ctrl,
                                const char *desc, const char *ok_btn);
 void agent_popup_message_stop (ctrl_t ctrl);
-
+int agent_clear_passphrase (ctrl_t ctrl,
+			    const char *keyinfo, cache_mode_t cache_mode);
 
 /*-- cache.c --*/
 void initialize_module_cache (void);
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index abfea93..018a609 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -1416,3 +1416,29 @@ agent_popup_message_stop (ctrl_t ctrl)
   /* Now we can close the connection. */
   unlock_pinentry (0);
 }
+
+int
+agent_clear_passphrase (ctrl_t ctrl,
+			const char *keyinfo, cache_mode_t cache_mode)
+{
+  int rc;
+  char line[ASSUAN_LINELENGTH];
+
+  if (! (keyinfo && (cache_mode == CACHE_MODE_NORMAL
+		     || cache_mode == CACHE_MODE_USER
+		     || cache_mode == CACHE_MODE_SSH)))
+    return gpg_error (GPG_ERR_NOT_SUPPORTED);
+
+  rc = start_pinentry (ctrl);
+  if (rc)
+    return rc;
+
+  snprintf (line, DIM(line)-1, "CLEARPASSPHRASE %c/%s",
+	    cache_mode == CACHE_MODE_USER? 'u' :
+	    cache_mode == CACHE_MODE_SSH? 's' : 'n',
+	    keyinfo);
+  rc = assuan_transact (entry_ctx, line,
+			NULL, NULL, NULL, NULL, NULL, NULL);
+
+  return unlock_pinentry (rc);
+}
diff --git a/agent/command.c b/agent/command.c
index 8ed9a0f..a5dce44 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -1602,6 +1602,10 @@ cmd_clear_passphrase (assuan_context_t ctx, char *line)
 
   agent_put_cache (cacheid, opt_normal ? CACHE_MODE_NORMAL : CACHE_MODE_USER,
                    NULL, 0);
+
+  agent_clear_passphrase (ctrl, cacheid,
+			  opt_normal ? CACHE_MODE_NORMAL : CACHE_MODE_USER);
+
   return 0;
 }
 

commit e201c20f25e7bed29088186c5f717d43047a0f4b
Author: Neal H. Walfield <neal at g10code.com>
Date:   Tue May 19 14:58:04 2015 +0200

    agent: Modify agent_clear_passphrase to support an ext. password cache.
    
    * agent/agent.h (agent_get_passphrase): Add arguments keyinfo and
    cache_mode.  Update callers.
    * agent/call-pinentry.c (agent_get_passphrase): Add arguments keyinfo
    and cache_mode.  If KEYINFO and CACHE_MODE describe a cachable key,
    then send SETKEYINFO to the pinentry.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>

diff --git a/agent/agent.h b/agent/agent.h
index 45f71eb..d5d6392 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -366,7 +366,8 @@ int agent_askpin (ctrl_t ctrl,
                   const char *keyinfo, cache_mode_t cache_mode);
 int agent_get_passphrase (ctrl_t ctrl, char **retpass,
                           const char *desc, const char *prompt,
-                          const char *errtext, int with_qualitybar);
+                          const char *errtext, int with_qualitybar,
+			  const char *keyinfo, cache_mode_t cache_mode);
 int agent_get_confirmation (ctrl_t ctrl, const char *desc, const char *ok,
 			    const char *notokay, int with_cancel);
 int agent_show_message (ctrl_t ctrl, const char *desc, const char *ok_btn);
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 5c3743a..abfea93 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -1015,7 +1015,8 @@ agent_askpin (ctrl_t ctrl,
 int
 agent_get_passphrase (ctrl_t ctrl,
                       char **retpass, const char *desc, const char *prompt,
-                      const char *errtext, int with_qualitybar)
+                      const char *errtext, int with_qualitybar,
+		      const char *keyinfo, cache_mode_t cache_mode)
 {
 
   int rc;
@@ -1060,6 +1061,26 @@ agent_get_passphrase (ctrl_t ctrl,
     prompt = desc && strstr (desc, "PIN")? "PIN": _("Passphrase");
 
 
+  /* If we have a KEYINFO string and are normal, user, or ssh cache
+     mode, we tell that the Pinentry so it may use it for own caching
+     purposes.  Most pinentries won't have this implemented and thus
+     we do not error out in this case.  */
+  if (keyinfo && (cache_mode == CACHE_MODE_NORMAL
+                  || cache_mode == CACHE_MODE_USER
+                  || cache_mode == CACHE_MODE_SSH))
+    snprintf (line, DIM(line)-1, "SETKEYINFO %c/%s",
+	      cache_mode == CACHE_MODE_USER? 'u' :
+	      cache_mode == CACHE_MODE_SSH? 's' : 'n',
+	      keyinfo);
+  else
+    snprintf (line, DIM(line)-1, "SETKEYINFO --clear");
+
+  rc = assuan_transact (entry_ctx, line,
+			NULL, NULL, NULL, NULL, NULL, NULL);
+  if (rc && gpg_err_code (rc) != GPG_ERR_ASS_UNKNOWN_CMD)
+    return unlock_pinentry (rc);
+
+
   if (desc)
     snprintf (line, DIM(line)-1, "SETDESC %s", desc);
   else
diff --git a/agent/command.c b/agent/command.c
index 3188bbd..8ed9a0f 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -1519,7 +1519,7 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
     next_try:
       rc = agent_get_passphrase (ctrl, &response, desc, prompt,
                                  repeat_errtext? repeat_errtext:errtext,
-                                 opt_qualbar);
+                                 opt_qualbar, cacheid, CACHE_MODE_USER);
       xfree (repeat_errtext);
       repeat_errtext = NULL;
       if (!rc)
@@ -1536,7 +1536,8 @@ cmd_get_passphrase (assuan_context_t ctx, char *line)
               char *response2;
 
               rc = agent_get_passphrase (ctrl, &response2, desc2, prompt,
-                                         errtext, 0);
+                                         errtext, 0,
+					 cacheid, CACHE_MODE_USER);
               if (rc)
                 break;
               if (strcmp (response2, response))

-----------------------------------------------------------------------

Summary of changes:
 agent/agent.h         |  6 ++++--
 agent/call-pinentry.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 agent/command.c       |  9 +++++++--
 3 files changed, 59 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list