[git] GnuPG - branch, master, updated. gnupg-2.1.8-85-gf70f669

by NIIBE Yutaka cvs at cvs.gnupg.org
Fri Oct 9 04:39:41 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  f70f6695368444d8058305ab696e5e5a1bace18c (commit)
      from  ea079d283de6bf4ac70d7530fac70938e7c5e8f5 (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 f70f6695368444d8058305ab696e5e5a1bace18c
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Fri Oct 9 11:33:13 2015 +0900

    agent: Fix function return type for check_cb and agent_askpin.
    
    * agent/call-pinentry.c (unlock_pinentry): Return gpg_error_t.
    (start_pinentry, setup_qualitybar): Likewise.
    (agent_askpin): Fix return value check of check_cb.
    * agent/command-ssh.c (reenter_compare_cb): Return gpg_error_t.
    (ssh_identity_register): Fix return value check of agent_askpin.
    * agent/cvt-openpgp.c (try_do_unprotect_cb): Return gpg_error_t.
    * agent/findkey.c (try_unprotect_cb): Likewise.
    * agent/genkey.c (reenter_compare_cb): Return gpg_error_t.
    (agent_ask_new_passphrase): Fix return value check of agent_askpin.

diff --git a/agent/agent.h b/agent/agent.h
index b3e8470..6e24df4 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -257,7 +257,8 @@ struct pin_entry_info_s
   int with_qualitybar; /* Set if the quality bar should be displayed.  */
   int with_repeat;  /* Request repetition of the passphrase.  */
   int repeat_okay;  /* Repetition worked. */
-  int (*check_cb)(struct pin_entry_info_s *); /* CB used to check the PIN */
+  gpg_error_t (*check_cb)(struct pin_entry_info_s *); /* CB used to check
+                                                         the PIN */
   void *check_cb_arg;  /* optional argument which might be of use in the CB */
   const char *cb_errtext; /* used by the cb to display a specific error */
   size_t max_length;   /* Allocated length of the buffer PIN. */
@@ -402,11 +403,11 @@ void initialize_module_call_pinentry (void);
 void agent_query_dump_state (void);
 void agent_reset_query (ctrl_t ctrl);
 int pinentry_active_p (ctrl_t ctrl, int waitseconds);
-int agent_askpin (ctrl_t ctrl,
-                  const char *desc_text, const char *prompt_text,
-                  const char *inital_errtext,
-                  struct pin_entry_info_s *pininfo,
-                  const char *keyinfo, cache_mode_t cache_mode);
+gpg_error_t agent_askpin (ctrl_t ctrl,
+                          const char *desc_text, const char *prompt_text,
+                          const char *inital_errtext,
+                          struct pin_entry_info_s *pininfo,
+                          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,
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 0140387..def3320 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -127,8 +127,8 @@ agent_reset_query (ctrl_t ctrl)
    disconnect that pinentry - we do this after the unlock so that a
    stalled pinentry does not block other threads.  Fixme: We should
    have a timeout in Assuan for the disconnect operation. */
-static int
-unlock_pinentry (int rc)
+static gpg_error_t
+unlock_pinentry (gpg_error_t rc)
 {
   assuan_context_t ctx = entry_ctx;
   int err;
@@ -229,7 +229,7 @@ getinfo_pid_cb (void *opaque, const void *buffer, size_t length)
    that this function must always be used to aquire the lock for the
    pinentry - we will serialize _all_ pinentry calls.
  */
-static int
+static gpg_error_t
 start_pinentry (ctrl_t ctrl)
 {
   int rc = 0;
@@ -709,7 +709,7 @@ inq_quality (void *opaque, const char *line)
 
 
 /* Helper for agent_askpin and agent_get_passphrase.  */
-static int
+static gpg_error_t
 setup_qualitybar (ctrl_t ctrl)
 {
   int rc;
@@ -801,14 +801,14 @@ pinentry_status_cb (void *opaque, const char *line)
    number here and repeat it as long as we have invalid formed
    numbers.  KEYINFO and CACHE_MODE are used to tell pinentry something
    about the key. */
-int
+gpg_error_t
 agent_askpin (ctrl_t ctrl,
               const char *desc_text, const char *prompt_text,
               const char *initial_errtext,
               struct pin_entry_info_s *pininfo,
               const char *keyinfo, cache_mode_t cache_mode)
 {
-  int rc;
+  gpg_error_t rc;
   char line[ASSUAN_LINELENGTH];
   struct entry_parm_s parm;
   const char *errtext = NULL;
@@ -1006,7 +1006,8 @@ agent_askpin (ctrl_t ctrl,
           /* More checks by utilizing the optional callback. */
           pininfo->cb_errtext = NULL;
           rc = pininfo->check_cb (pininfo);
-          if (rc == -1 && pininfo->cb_errtext)
+          if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE
+              && pininfo->cb_errtext)
             errtext = pininfo->cb_errtext;
           else if (gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE
                    || gpg_err_code (rc) == GPG_ERR_BAD_PIN)
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 0aa0098..6144ae1 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -3040,14 +3040,14 @@ ssh_key_to_protected_buffer (gcry_sexp_t key, const char *passphrase,
 
 /* Callback function to compare the first entered PIN with the one
    currently being entered. */
-static int
+static gpg_error_t
 reenter_compare_cb (struct pin_entry_info_s *pi)
 {
   const char *pin1 = pi->check_cb_arg;
 
   if (!strcmp (pin1, pi->pin))
     return 0; /* okay */
-  return -1;
+  return gpg_error (GPG_ERR_BAD_PASSPHRASE);
 }
 
 
@@ -3133,7 +3133,7 @@ ssh_identity_register (ctrl_t ctrl, ssh_key_type_spec_t *spec,
   if (*pi->pin && !pi->repeat_okay)
     {
       err = agent_askpin (ctrl, description2, NULL, NULL, pi2, NULL, 0);
-      if (err == -1)
+      if (gpg_err_code (err) == GPG_ERR_BAD_PASSPHRASE)
 	{ /* The re-entered one did not match and the user did not
 	     hit cancel. */
 	  initial_errtext = L_("does not match - try again");
diff --git a/agent/cvt-openpgp.c b/agent/cvt-openpgp.c
index fb5a473..0b9ecf0 100644
--- a/agent/cvt-openpgp.c
+++ b/agent/cvt-openpgp.c
@@ -657,7 +657,7 @@ do_unprotect (const char *passphrase,
 
 /* Callback function to try the unprotection from the passphrase query
    code.  */
-static int
+static gpg_error_t
 try_do_unprotect_cb (struct pin_entry_info_s *pi)
 {
   gpg_error_t err;
diff --git a/agent/findkey.c b/agent/findkey.c
index c49c37a..af61e7e 100644
--- a/agent/findkey.c
+++ b/agent/findkey.c
@@ -111,7 +111,7 @@ agent_write_private_key (const unsigned char *grip,
 
 /* Callback function to try the unprotection from the passphrase query
    code. */
-static int
+static gpg_error_t
 try_unprotect_cb (struct pin_entry_info_s *pi)
 {
   struct try_unprotect_arg_s *arg = pi->check_cb_arg;
diff --git a/agent/genkey.c b/agent/genkey.c
index e8195c2..b780c50 100644
--- a/agent/genkey.c
+++ b/agent/genkey.c
@@ -326,14 +326,14 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw,
 
 /* Callback function to compare the first entered PIN with the one
    currently being entered. */
-static int
+static gpg_error_t
 reenter_compare_cb (struct pin_entry_info_s *pi)
 {
   const char *pin1 = pi->check_cb_arg;
 
   if (!strcmp (pin1, pi->pin))
     return 0; /* okay */
-  return -1;
+  return gpg_error (GPG_ERR_BAD_PASSPHRASE);
 }
 
 
@@ -410,7 +410,7 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
       if (*pi->pin && !pi->repeat_okay)
         {
           err = agent_askpin (ctrl, text2, NULL, NULL, pi2, NULL, 0);
-          if (err == -1)
+          if (gpg_err_code (err) == GPG_ERR_BAD_PASSPHRASE)
             { /* The re-entered one did not match and the user did not
                  hit cancel. */
               initial_errtext = xtrystrdup (L_("does not match - try again"));

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

Summary of changes:
 agent/agent.h         | 13 +++++++------
 agent/call-pinentry.c | 15 ++++++++-------
 agent/command-ssh.c   |  6 +++---
 agent/cvt-openpgp.c   |  2 +-
 agent/findkey.c       |  2 +-
 agent/genkey.c        |  6 +++---
 6 files changed, 23 insertions(+), 21 deletions(-)


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




More information about the Gnupg-commits mailing list