[git] GPGME - branch, master, updated. gpgme-1.5.5-10-g70b3e59

by Ben Kibbey cvs at cvs.gnupg.org
Sun Aug 16 00:25:48 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 "GnuPG Made Easy".

The branch, master has been updated
       via  70b3e5964ea0592bd09d1877d720b2c63f501970 (commit)
       via  6dd24c3c6133ec54f75abd056191a8027fe01de0 (commit)
       via  4fadcf06ec8b0ebfb05c7622dbc3b73fd3c1bad9 (commit)
       via  2b6ae3dadf4432f7a72fd119144b835f7b1adcc4 (commit)
      from  e07d38f5f9f3b94e403f1265ff7fd3d7009dd557 (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 70b3e5964ea0592bd09d1877d720b2c63f501970
Author: Ben Kibbey <bjk at luxsci.net>
Date:   Sat Aug 15 16:58:04 2015 -0400

    Fix gpgme_{get,set}_status_cb to match documentation.
    
    * doc/gpgme.texi: Minor fixes.
    * src/gpgme.c (gpgme_get_status_cb): Set return variables to NULL and
    check for a valid ctx pointer.

diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index bce6aef..010b914 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -2690,8 +2690,6 @@ a status message callback function.
 The argument @var{keyword} is the name of the status message while the
 @var{args} argument contains any arguments for the status message.
 
-The status message may have come from gpg or libgpgme.
-
 If an error occurs, return the corresponding @code{gpgme_error_t}
 value. Otherwise, return @code{0}.
 @end deftp
@@ -2699,9 +2697,9 @@ value. Otherwise, return @code{0}.
 @deftypefun void gpgme_set_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t @var{statusfunc}}, @w{void *@var{hook_value}})
 The function @code{gpgme_set_status_cb} sets the function that is used when a
 status message is received from gpg to @var{statusfunc}. The function
- at var{statusfunc} needs to implemented by the user, and whenever it is called,
-it is called with its first argument being @var{hook_value}.  By default, no
-status message callback function is set.
+ at var{statusfunc} needs to be implemented by the user, and whenever it is
+called, it is called with its first argument being @var{hook_value}.  By
+default, no status message callback function is set.
 
 The user can disable the use of a status message callback function by calling
 @code{gpgme_set_status_cb} with @var{statusfunc} being @code{NULL}.
@@ -2713,9 +2711,6 @@ process status messages from gpg in @var{*statusfunc}, and the first argument
 for this function in @var{*hook_value}.  If no status message callback is set,
 or @var{ctx} is not a valid pointer, @code{NULL} is returned in both
 variables.
-
- at var{statusfunc} or @var{hook_value} can be @code{NULL}.  In this case,
-the corresponding value will not be returned.
 @end deftypefun
 
 
diff --git a/src/gpgme.c b/src/gpgme.c
index 9c09827..0cf999a 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -679,7 +679,17 @@ gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb,
 		       void **r_cb_value)
 {
   TRACE2 (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p",
-	  ctx->status_cb, ctx->status_cb_value);
+	  ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL);
+
+  if (r_cb)
+    *r_cb = NULL;
+
+  if (r_cb_value)
+    *r_cb_value = NULL;
+
+  if (!ctx || !ctx->status_cb)
+    return;
+
   if (r_cb)
     *r_cb = ctx->status_cb;
   if (r_cb_value)

commit 6dd24c3c6133ec54f75abd056191a8027fe01de0
Author: Ben Kibbey <bjk at luxsci.net>
Date:   Thu Apr 16 21:05:01 2015 -0400

    Parse the INQUIRE_MAXLEN status message.
    
    * src/gpgme.h.in: (gpgme_status_code_t): Add INQUIRE_MAXLEN.
    * src/status-table.c (status_table_s): Ditto.
    * src/genkey.c (genkey_status_handler): Parse INQUIRE_MAXLEN.
    * src/decrypt.c (_gpgme_decrypt_status_handler): Ditto.
    * src/sign.c (_gpgme_sign_status_handler): Ditto.
    
    This status message informs the client of the maximum length of an
    inquired line. It is sent from gpg and forwarded to the client via
    gpgme_status_cb_t.

diff --git a/src/decrypt.c b/src/decrypt.c
index 4742060..4fd92c6 100644
--- a/src/decrypt.c
+++ b/src/decrypt.c
@@ -291,6 +291,16 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
       err = _gpgme_parse_plaintext (args, &opd->result.file_name);
       if (err)
 	return err;
+      break;
+
+    case GPGME_STATUS_INQUIRE_MAXLEN:
+      if (ctx->status_cb)
+        {
+          err = ctx->status_cb (ctx->status_cb_value, "INQUIRE_MAXLEN", args);
+          if (err)
+            return err;
+        }
+      break;
 
     default:
       break;
diff --git a/src/genkey.c b/src/genkey.c
index 17009bd..18765dd 100644
--- a/src/genkey.c
+++ b/src/genkey.c
@@ -124,6 +124,15 @@ genkey_status_handler (void *priv, gpgme_status_code_t code, char *args)
 	return gpg_error (GPG_ERR_GENERAL);
       break;
 
+    case GPGME_STATUS_INQUIRE_MAXLEN:
+      if (ctx->status_cb)
+        {
+          err = ctx->status_cb (ctx->status_cb_value, "INQUIRE_MAXLEN", args);
+          if (err)
+            return err;
+        }
+      break;
+
     default:
       break;
     }
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index ffcc7ba..8255e63 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -544,7 +544,8 @@ typedef enum
     GPGME_STATUS_PINENTRY_LAUNCHED = 88,
     GPGME_STATUS_ATTRIBUTE = 89,
     GPGME_STATUS_BEGIN_SIGNING = 90,
-    GPGME_STATUS_KEY_NOT_CREATED = 91
+    GPGME_STATUS_KEY_NOT_CREATED = 91,
+    GPGME_STATUS_INQUIRE_MAXLEN = 92
   }
 gpgme_status_code_t;
 
diff --git a/src/sign.c b/src/sign.c
index ffbde56..9e22fdb 100644
--- a/src/sign.c
+++ b/src/sign.c
@@ -338,6 +338,11 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args)
 	err = gpg_error (GPG_ERR_GENERAL);
       break;
 
+    case GPGME_STATUS_INQUIRE_MAXLEN:
+      if (ctx->status_cb)
+        err = ctx->status_cb (ctx->status_cb_value, "INQUIRE_MAXLEN", args);
+      break;
+
     default:
       break;
     }
diff --git a/src/status-table.c b/src/status-table.c
index b936997..c85fa95 100644
--- a/src/status-table.c
+++ b/src/status-table.c
@@ -80,6 +80,7 @@ static struct status_table_s status_table[] =
   { "IMPORT_PROBLEM", GPGME_STATUS_IMPORT_PROBLEM },
   { "IMPORT_RES", GPGME_STATUS_IMPORT_RES },
   { "IMPORTED", GPGME_STATUS_IMPORTED },
+  { "INQUIRE_MAXLEN", GPGME_STATUS_INQUIRE_MAXLEN },
   { "INV_RECP", GPGME_STATUS_INV_RECP },
   { "INV_SGNR", GPGME_STATUS_INV_SGNR },
   { "KEY_CREATED", GPGME_STATUS_KEY_CREATED },

commit 4fadcf06ec8b0ebfb05c7622dbc3b73fd3c1bad9
Author: Ben Kibbey <bjk at luxsci.net>
Date:   Thu Apr 16 20:23:38 2015 -0400

    Add gpgme_set/get_status_cb().
    
    * src/gpgme.h.in (gpgme_set_status_cb): New.
    (gpgme_get_status_cb): New.
    (gpgme_status_cb_t): New.
    * src/gpgme.c (gpgme_set_status_cb): New.
    (gpgme_get_status_cb): New.
    * src/context.h (status_cb): New.
    (status_cb_value): New.
    * src/gpgme.def: Export new symbols.
    * src/libgpgme.vers: Ditto.
    * doc/gpgme.texi: Document these new functions.
    
    --
    This callback function is used to forward status messages from gpg back
    to the client.

diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index ef4936d..bce6aef 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -194,6 +194,7 @@ Context Attributes
 * Key Listing Mode::              Selecting key listing mode.
 * Passphrase Callback::           Getting the passphrase from the user.
 * Progress Meter Callback::       Being informed about the progress.
+* Status Message Callback::       Status messages received from gpg.
 * Locale::                        Setting the locale of a context.
 
 Key Management
@@ -2291,6 +2292,7 @@ started.  In fact, these references are accessed through the
 * Key Listing Mode::              Selecting key listing mode.
 * Passphrase Callback::           Getting the passphrase from the user.
 * Progress Meter Callback::       Being informed about the progress.
+* Status Message Callback::       Status messages received from gpg.
 * Locale::                        Setting the locale of a context.
 @end menu
 
@@ -2675,6 +2677,48 @@ the corresponding value will not be returned.
 @end deftypefun
 
 
+ at node Status Message Callback
+ at subsection Status Message Callback
+ at cindex callback, status message
+ at cindex status message callback
+
+ at deftp {Data type} {gpgme_error_t (*gpgme_status_cb_t)(void *@var{hook}, const char *@var{keyword}, const char *@var{args})}
+ at tindex gpgme_status_cb_t
+The @code{gpgme_status_cb_t} type is the type of function usable as
+a status message callback function.
+
+The argument @var{keyword} is the name of the status message while the
+ at var{args} argument contains any arguments for the status message.
+
+The status message may have come from gpg or libgpgme.
+
+If an error occurs, return the corresponding @code{gpgme_error_t}
+value. Otherwise, return @code{0}.
+ at end deftp
+
+ at deftypefun void gpgme_set_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t @var{statusfunc}}, @w{void *@var{hook_value}})
+The function @code{gpgme_set_status_cb} sets the function that is used when a
+status message is received from gpg to @var{statusfunc}. The function
+ at var{statusfunc} needs to implemented by the user, and whenever it is called,
+it is called with its first argument being @var{hook_value}.  By default, no
+status message callback function is set.
+
+The user can disable the use of a status message callback function by calling
+ at code{gpgme_set_status_cb} with @var{statusfunc} being @code{NULL}.
+ at end deftypefun
+
+ at deftypefun void gpgme_get_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t *@var{statusfunc}}, @w{void **@var{hook_value}})
+The function @code{gpgme_get_status_cb} returns the function that is used to
+process status messages from gpg in @var{*statusfunc}, and the first argument
+for this function in @var{*hook_value}.  If no status message callback is set,
+or @var{ctx} is not a valid pointer, @code{NULL} is returned in both
+variables.
+
+ at var{statusfunc} or @var{hook_value} can be @code{NULL}.  In this case,
+the corresponding value will not be returned.
+ at end deftypefun
+
+
 @node Locale
 @subsection Locale
 @cindex locale, default
diff --git a/src/context.h b/src/context.h
index 8cd86e9..757d9b4 100644
--- a/src/context.h
+++ b/src/context.h
@@ -135,6 +135,10 @@ struct gpgme_context
   gpgme_progress_cb_t progress_cb;
   void *progress_cb_value;
 
+  /* The user provided status callback and its hook value.  */
+  gpgme_status_cb_t status_cb;
+  void *status_cb_value;
+
   /* A list of file descriptors in active use by the current
      operation.  */
   struct fd_table fdt;
diff --git a/src/gpgme.c b/src/gpgme.c
index c24b620..9c09827 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -656,6 +656,37 @@ gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
 }
 
 
+/* This function sets a callback function to be used as a status
+   message forwarder.  */
+void
+gpgme_set_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t cb, void *cb_value)
+{
+  TRACE2 (DEBUG_CTX, "gpgme_set_status_cb", ctx, "status_cb=%p/%p",
+	  cb, cb_value);
+
+  if (!ctx)
+    return;
+
+  ctx->status_cb = cb;
+  ctx->status_cb_value = cb_value;
+}
+
+
+/* This function returns the callback function to be used as a
+   status message forwarder.  */
+void
+gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb,
+		       void **r_cb_value)
+{
+  TRACE2 (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p",
+	  ctx->status_cb, ctx->status_cb_value);
+  if (r_cb)
+    *r_cb = ctx->status_cb;
+  if (r_cb_value)
+    *r_cb_value = ctx->status_cb_value;
+}
+
+
 /* Set the I/O callback functions for CTX to IO_CBS.  */
 void
 gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
diff --git a/src/gpgme.def b/src/gpgme.def
index cf167b4..a3f5fb4 100644
--- a/src/gpgme.def
+++ b/src/gpgme.def
@@ -220,5 +220,8 @@ EXPORTS
 
     gpgme_set_offline                     @165
     gpgme_get_offline                     @166
+
+    gpgme_set_status_cb                   @167
+    gpgme_get_status_cb                   @168
 ; END
 
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 099cc8a..ffcc7ba 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -839,6 +839,11 @@ typedef gpgme_error_t (*gpgme_passphrase_cb_t) (void *hook,
 typedef void (*gpgme_progress_cb_t) (void *opaque, const char *what,
 				     int type, int current, int total);
 
+/* Status messages from gpg. */
+typedef gpgme_error_t (*gpgme_status_cb_t) (void *opaque, const char *keyword,
+                                            const char *args);
+
+
 /* Interact with the user about an edit operation.  */
 typedef gpgme_error_t (*gpgme_edit_cb_t) (void *opaque,
 					  gpgme_status_code_t status,
@@ -936,6 +941,16 @@ void gpgme_set_progress_cb (gpgme_ctx_t c, gpgme_progress_cb_t cb,
 void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *cb,
 			    void **hook_value);
 
+/* Set the status callback function in CTX to CB.  HOOK_VALUE is
+   passed as first argument to thes status callback function.  */
+void gpgme_set_status_cb (gpgme_ctx_t c, gpgme_status_cb_t cb,
+                          void *hook_value);
+
+/* Get the current status callback function in *CB and the current
+   hook value in *HOOK_VALUE.  */
+void gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *cb,
+                          void **hook_value);
+
 /* This function sets the locale for the context CTX, or the default
    locale if CTX is a null pointer.  */
 gpgme_error_t gpgme_set_locale (gpgme_ctx_t ctx, int category,
diff --git a/src/libgpgme.vers b/src/libgpgme.vers
index fc2920f..6687571 100644
--- a/src/libgpgme.vers
+++ b/src/libgpgme.vers
@@ -95,6 +95,9 @@ GPGME_1.1 {
 
     gpgme_set_offline;
     gpgme_get_offline;
+
+    gpgme_set_status_cb;
+    gpgme_get_status_cb;
 };
 
 

commit 2b6ae3dadf4432f7a72fd119144b835f7b1adcc4
Author: Ben Kibbey <bjk at luxsci.net>
Date:   Tue Apr 14 18:39:26 2015 -0400

    Make use of user passphrase handler during genkey.
    
    * src/genkey.c (genkey_start): set engine passphrase command handler.
    
    --
    This allows for inquiring a new passphrase during key generation rather
    than requiring a pinentry. Needs a patch to gnupg to make use of
    --command-fd with --gen-key.

diff --git a/src/genkey.c b/src/genkey.c
index fd6685e..17009bd 100644
--- a/src/genkey.c
+++ b/src/genkey.c
@@ -186,6 +186,14 @@ genkey_start (gpgme_ctx_t ctx, int synchronous, const char *parms,
 
   _gpgme_engine_set_status_handler (ctx->engine, genkey_status_handler, ctx);
 
+  if (ctx->passphrase_cb)
+    {
+      err = _gpgme_engine_set_command_handler
+        (ctx->engine, _gpgme_passphrase_command_handler, ctx, NULL);
+      if (err)
+        return err;
+    }
+
   return _gpgme_engine_op_genkey (ctx->engine, opd->key_parameter,
 				  ctx->use_armor, pubkey, seckey);
 }

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

Summary of changes:
 doc/gpgme.texi     | 39 +++++++++++++++++++++++++++++++++++++++
 src/context.h      |  4 ++++
 src/decrypt.c      | 10 ++++++++++
 src/genkey.c       | 17 +++++++++++++++++
 src/gpgme.c        | 41 +++++++++++++++++++++++++++++++++++++++++
 src/gpgme.def      |  3 +++
 src/gpgme.h.in     | 18 +++++++++++++++++-
 src/libgpgme.vers  |  3 +++
 src/sign.c         |  5 +++++
 src/status-table.c |  1 +
 10 files changed, 140 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list