2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* 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.
This commit is contained in:
parent
02536bb72b
commit
4172e1d56c
2
TODO
2
TODO
@ -2,8 +2,6 @@ Hey Emacs, this is -*- outline -*- mode!
|
|||||||
|
|
||||||
* Before release:
|
* Before release:
|
||||||
** Change gpgme_invalid_user_id_t to gpgme_invalid_key_t.
|
** 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
|
** Make sure POSIX I/O functions set errno properly
|
||||||
** gpgme-config must include info about libgpg-error.
|
** gpgme-config must include info about libgpg-error.
|
||||||
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* 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 <marcus@g10code.de>
|
2003-06-05 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
Everywhere: Use libgpg-error error codes.
|
Everywhere: Use libgpg-error error codes.
|
||||||
|
@ -74,7 +74,6 @@ struct engine_gpg
|
|||||||
{
|
{
|
||||||
struct arg_and_data_s *arglist;
|
struct arg_and_data_s *arglist;
|
||||||
struct arg_and_data_s **argtail;
|
struct arg_and_data_s **argtail;
|
||||||
int arg_error;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -191,10 +190,7 @@ add_arg (engine_gpg_t gpg, const char *arg)
|
|||||||
|
|
||||||
a = malloc (sizeof *a + strlen (arg));
|
a = malloc (sizeof *a + strlen (arg));
|
||||||
if (!a)
|
if (!a)
|
||||||
{
|
|
||||||
gpg->arg_error = 1;
|
|
||||||
return gpg_error_from_errno (errno);
|
return gpg_error_from_errno (errno);
|
||||||
}
|
|
||||||
a->next = NULL;
|
a->next = NULL;
|
||||||
a->data = NULL;
|
a->data = NULL;
|
||||||
a->dup_to = -1;
|
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);
|
a = malloc (sizeof *a - 1);
|
||||||
if (!a)
|
if (!a)
|
||||||
{
|
|
||||||
gpg->arg_error = 1;
|
|
||||||
return gpg_error_from_errno (errno);
|
return gpg_error_from_errno (errno);
|
||||||
}
|
|
||||||
a->next = NULL;
|
a->next = NULL;
|
||||||
a->data = data;
|
a->data = data;
|
||||||
a->inbound = inbound;
|
a->inbound = inbound;
|
||||||
@ -376,16 +369,25 @@ gpg_new (void **engine)
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
gpg->status.eof = 0;
|
gpg->status.eof = 0;
|
||||||
add_arg (gpg, "--status-fd");
|
rc = add_arg (gpg, "--status-fd");
|
||||||
|
if (rc)
|
||||||
|
goto leave;
|
||||||
|
|
||||||
{
|
{
|
||||||
char buf[25];
|
char buf[25];
|
||||||
sprintf (buf, "%d", gpg->status.fd[1]);
|
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");
|
rc = add_arg (gpg, "--no-tty");
|
||||||
add_arg (gpg, "utf8");
|
if (!rc)
|
||||||
add_arg (gpg, "--enable-progress-filter");
|
rc = add_arg (gpg, "--charset");
|
||||||
|
if (!rc)
|
||||||
|
rc = add_arg (gpg, "utf8");
|
||||||
|
if (!rc)
|
||||||
|
rc = add_arg (gpg, "--enable-progress-filter");
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if (rc)
|
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)
|
void *fnc_value, gpgme_data_t linked_data)
|
||||||
{
|
{
|
||||||
engine_gpg_t gpg = engine;
|
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
|
/* 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
|
thing that matters is that we use something unique, so we use the
|
||||||
address of the cmd structure in the gpg object. */
|
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.fnc = fnc;
|
||||||
gpg->cmd.cb_data = (void *) &gpg->cmd;
|
gpg->cmd.cb_data = (void *) &gpg->cmd;
|
||||||
gpg->cmd.fnc_value = fnc_value;
|
gpg->cmd.fnc_value = fnc_value;
|
||||||
@ -1028,11 +1037,6 @@ start (engine_gpg_t gpg)
|
|||||||
if (! _gpgme_get_gpg_path ())
|
if (! _gpgme_get_gpg_path ())
|
||||||
return gpg_error (GPG_ERR_INV_ENGINE);
|
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);
|
rc = build_argv (gpg);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
@ -1548,7 +1552,7 @@ gpg_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
|
|||||||
if (!err && use_armor)
|
if (!err && use_armor)
|
||||||
err = add_arg (gpg, "--armor");
|
err = add_arg (gpg, "--armor");
|
||||||
if (!err && use_textmode)
|
if (!err && use_textmode)
|
||||||
add_arg (gpg, "--textmode");
|
err = add_arg (gpg, "--textmode");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
|
@ -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);
|
err = _gpgme_decode_percent_string (args, ¬ation->name, len);
|
||||||
if (err)
|
if (err)
|
||||||
|
{
|
||||||
|
free (notation->name);
|
||||||
|
free (notation);
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
notation->value = NULL;
|
notation->value = NULL;
|
||||||
}
|
}
|
||||||
@ -333,8 +337,12 @@ parse_notation (gpgme_signature_t sig, gpgme_status_code_t code, char *args)
|
|||||||
}
|
}
|
||||||
err = _gpgme_decode_percent_string (args, ¬ation->value, len);
|
err = _gpgme_decode_percent_string (args, ¬ation->value, len);
|
||||||
if (err)
|
if (err)
|
||||||
|
{
|
||||||
|
free (notation->value);
|
||||||
|
free (notation);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*lastp = notation;
|
*lastp = notation;
|
||||||
}
|
}
|
||||||
else if (code == GPGME_STATUS_NOTATION_DATA)
|
else if (code == GPGME_STATUS_NOTATION_DATA)
|
||||||
|
Loading…
Reference in New Issue
Block a user