diff options
| author | Marcus Brinkmann <[email protected]> | 2003-06-05 23:39:28 +0000 | 
|---|---|---|
| committer | Marcus Brinkmann <[email protected]> | 2003-06-05 23:39:28 +0000 | 
| commit | 4172e1d56c0ed7bc4db0ae398966038842b37406 (patch) | |
| tree | 136402895084c60e534af779226d85fef2ec6c79 | |
| parent | doc/ (diff) | |
| download | gpgme-4172e1d56c0ed7bc4db0ae398966038842b37406.tar.gz gpgme-4172e1d56c0ed7bc4db0ae398966038842b37406.zip | |
2003-06-06  Marcus Brinkmann  <[email protected]>
	* rungpg.c (struct engine_gpg): Remove arg_error.
	(add_arg): Don't set arg_error.
	(add_data): Likewise.
	(start): Don't check arg_error.
	(gpg_new): Check return value of add_arg.
	* verify.c (parse_notation): Free allocated memory at error.
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | gpgme/ChangeLog | 9 | ||||
| -rw-r--r-- | gpgme/rungpg.c | 50 | ||||
| -rw-r--r-- | gpgme/verify.c | 12 | 
4 files changed, 46 insertions, 27 deletions
| @@ -2,8 +2,6 @@ Hey Emacs, this is -*- outline -*- mode!  * Before release:  ** Change gpgme_invalid_user_id_t to gpgme_invalid_key_t. -** Remove arg_error from rungpg.c -** Make sure that notation value allocation has no leak at error  ** Make sure POSIX I/O functions set errno properly  ** gpgme-config must include info about libgpg-error. diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index a3b2d3f6..2ba08898 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,12 @@ +2003-06-06  Marcus Brinkmann  <[email protected]> + +	* rungpg.c (struct engine_gpg): Remove arg_error. +	(add_arg): Don't set arg_error. +	(add_data): Likewise. +	(start): Don't check arg_error. +	(gpg_new): Check return value of add_arg. +	* verify.c (parse_notation): Free allocated memory at error. +  2003-06-05  Marcus Brinkmann  <[email protected]>  	Everywhere: Use libgpg-error error codes. diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index 9f992b77..d29a718a 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -74,7 +74,6 @@ struct engine_gpg  {    struct arg_and_data_s *arglist;    struct arg_and_data_s **argtail; -  int arg_error;    struct    { @@ -191,10 +190,7 @@ add_arg (engine_gpg_t gpg, const char *arg)    a = malloc (sizeof *a + strlen (arg));    if (!a) -    { -      gpg->arg_error = 1; -      return gpg_error_from_errno (errno); -    } +    return gpg_error_from_errno (errno);    a->next = NULL;    a->data = NULL;    a->dup_to = -1; @@ -214,10 +210,7 @@ add_data (engine_gpg_t gpg, gpgme_data_t data, int dup_to, int inbound)    a = malloc (sizeof *a - 1);    if (!a) -    { -      gpg->arg_error = 1; -      return gpg_error_from_errno (errno); -    } +    return gpg_error_from_errno (errno);    a->next = NULL;    a->data = data;    a->inbound = inbound; @@ -376,16 +369,25 @@ gpg_new (void **engine)        goto leave;      }    gpg->status.eof = 0; -  add_arg (gpg, "--status-fd"); +  rc = add_arg (gpg, "--status-fd"); +  if (rc) +    goto leave; +    {      char buf[25];      sprintf (buf, "%d", gpg->status.fd[1]); -    add_arg (gpg, buf); +    rc = add_arg (gpg, buf); +    if (rc) +      goto leave;    } -  add_arg (gpg, "--no-tty"); -  add_arg (gpg, "--charset"); -  add_arg (gpg, "utf8"); -  add_arg (gpg, "--enable-progress-filter"); + +  rc = add_arg (gpg, "--no-tty"); +  if (!rc) +    rc = add_arg (gpg, "--charset"); +  if (!rc) +    rc = add_arg (gpg, "utf8"); +  if (!rc) +    rc = add_arg (gpg, "--enable-progress-filter");   leave:    if (rc) @@ -476,12 +478,19 @@ gpg_set_command_handler (void *engine, engine_command_handler_t fnc,  			 void *fnc_value, gpgme_data_t linked_data)  {    engine_gpg_t gpg = engine; +  gpgme_error_t rc; + +  rc = add_arg (gpg, "--command-fd"); +  if (rc) +    return err; -  add_arg (gpg, "--command-fd");    /* This is a hack.  We don't have a real data object.  The only       thing that matters is that we use something unique, so we use the       address of the cmd structure in the gpg object.  */ -  add_data (gpg, (void *) &gpg->cmd, -2, 0); +  rc = add_data (gpg, (void *) &gpg->cmd, -2, 0); +  if (rc) +    return err; +    gpg->cmd.fnc = fnc;    gpg->cmd.cb_data = (void *) &gpg->cmd;    gpg->cmd.fnc_value = fnc_value; @@ -1028,11 +1037,6 @@ start (engine_gpg_t gpg)    if (! _gpgme_get_gpg_path ())      return gpg_error (GPG_ERR_INV_ENGINE); -  /* Kludge, so that we don't need to check the return code of all the -     add_arg ().  We bail out here instead.  */ -  if (gpg->arg_error) -    return gpg_error (GPG_ERR_ENOMEM); -    rc = build_argv (gpg);    if (rc)      return rc; @@ -1548,7 +1552,7 @@ gpg_sign (void *engine, gpgme_data_t in, gpgme_data_t out,        if (!err && use_armor)  	err = add_arg (gpg, "--armor");        if (!err && use_textmode) -	add_arg (gpg, "--textmode"); +	err = add_arg (gpg, "--textmode");      }    if (!err) diff --git a/gpgme/verify.c b/gpgme/verify.c index a358772d..105d1c41 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -315,7 +315,11 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)  	    }  	  err = _gpgme_decode_percent_string (args, ¬ation->name, len);  	  if (err) -	    return err; +	    { +	      free (notation->name); +	      free (notation); +	      return err; +	    }  	  notation->value = NULL;  	} @@ -333,7 +337,11 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)  	    }  	  err = _gpgme_decode_percent_string (args, ¬ation->value, len);  	  if (err) -	    return err; +	    { +	      free (notation->value); +	      free (notation); +	      return err; +	    }  	}        *lastp = notation;      } | 
