diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/engine-g13.c | 40 | ||||
| -rw-r--r-- | src/vfs-mount.c | 26 | 
3 files changed, 43 insertions, 30 deletions
| diff --git a/src/ChangeLog b/src/ChangeLog index 1fe09919..c4793b10 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@  2009-11-05  Marcus Brinkmann  <[email protected]> +	* engine-g13.c (struct engine_g13): Remove members RESULT_CB and +	RESULT_CB_VALUE. +	(g13_assuan_simple_command, status_handler): Don't use those anymore. +	(g13_transact): Remove them from argument list, too. +	* vfs-mount.c (_gpgme_vfs_mount_status_handler): New function. +	(_gpgme_op_vfs_mount): Pass it to transact. +  	* engine-assuan.c (llass_new): Update use of assuan_socket_connect.  	* engine-gpgsm.c (gpgsm_new): Update use of assuan_pipe_connect.  	* engine-g13.c (g13_new): Likewise. diff --git a/src/engine-g13.c b/src/engine-g13.c index 8ecdcdfe..4bb1630a 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -69,10 +69,6 @@ struct engine_g13    struct gpgme_io_cbs io_cbs; -  /* Internal callbacks.  */ -  engine_assuan_result_cb_t result_cb; -  void *result_cb_value;  -    /* User provided callbacks.  */    struct {      gpgme_assuan_data_cb_t data_cb; @@ -398,8 +394,8 @@ g13_set_locale (void *engine, int category, const char *value)  static gpgme_error_t  g13_assuan_simple_command (assuan_context_t ctx, char *cmd, -			     engine_status_handler_t status_fnc, -			     void *status_fnc_value) +			   engine_status_handler_t status_fnc, +			   void *status_fnc_value)  {    gpg_error_t err;    char *line; @@ -480,17 +476,13 @@ status_handler (void *opaque, int fd)  		  "fd 0x%x: ERR line: %s",                    fd, err ? gpg_strerror (err) : "ok"); -	  /* In g13, command execution errors are not fatal, as we use +	  /* Command execution errors are not fatal, as we use  	     a session based protocol.  */ -          if (g13->result_cb) -            err = g13->result_cb (g13->result_cb_value, err); -          else -            err = 0; -          if (!err) -            { -              _gpgme_io_close (g13->status_cb.fd); -              return 0; -	    } +	  data->op_err = err; + +	  /* The caller will do the rest (namely, call cancel_op, +	     which closes status_fd).  */ +	  return 0;  	}        else if (linelen >= 2  	       && line[0] == 'O' && line[1] == 'K' @@ -498,15 +490,9 @@ status_handler (void *opaque, int fd)  	{            TRACE1 (DEBUG_CTX, "gpgme:status_handler", g13,  		  "fd 0x%x: OK line", fd); -          if (g13->result_cb) -            err = g13->result_cb (g13->result_cb_value, 0); -          else -            err = 0; -	  if (!err) -            { -              _gpgme_io_close (g13->status_cb.fd); -              return 0; -            } + +	  _gpgme_io_close (g13->status_cb.fd); +	  return 0;  	}        else if (linelen > 2  	       && line[0] == 'D' && line[1] == ' ') @@ -704,8 +690,6 @@ g13_reset (void *engine)  static gpgme_error_t  g13_transact (void *engine,                  const char *command, -                engine_assuan_result_cb_t result_cb, -                void *result_cb_value,                  gpgme_assuan_data_cb_t data_cb,                  void *data_cb_value,                  gpgme_assuan_inquire_cb_t inq_cb, @@ -719,8 +703,6 @@ g13_transact (void *engine,    if (!g13 || !command || !*command)      return gpg_error (GPG_ERR_INV_VALUE); -  g13->result_cb = result_cb; -  g13->result_cb_value = result_cb_value;    g13->user.data_cb = data_cb;    g13->user.data_cb_value = data_cb_value;    g13->user.inq_cb = inq_cb; diff --git a/src/vfs-mount.c b/src/vfs-mount.c index 85a92adf..f5a6286c 100644 --- a/src/vfs-mount.c +++ b/src/vfs-mount.c @@ -56,6 +56,30 @@ gpgme_op_vfs_mount_result (gpgme_ctx_t ctx)  static gpgme_error_t +_gpgme_vfs_mount_status_handler (void *priv, const char *code, const char *args) +{ +  gpgme_ctx_t ctx = (gpgme_ctx_t) priv; +  gpgme_error_t err; +  void *hook; +  op_data_t opd; + +  err = _gpgme_op_data_lookup (ctx, OPDATA_VFS_MOUNT, &hook, -1, NULL); +  opd = hook; +  if (err) +    return err; + +  if (! strcasecmp ("MOUNTPOINT", code)) +    { +      if (opd->result.mount_dir) +	free (opd->result.mount_dir); +      opd->result.mount_dir = strdup (args); +    } + +  return 0; +} + + +static gpgme_error_t  vfs_start (gpgme_ctx_t ctx, int synchronous,  	   const char *command,  	   gpgme_assuan_data_cb_t data_cb, @@ -190,7 +214,7 @@ _gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,      }    err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, -			       NULL, NULL, op_err); +			       _gpgme_vfs_mount_status_handler, ctx, op_err);    free (cmd);    return err; | 
