core: Tweak STATUS_FAILURE handling.

* src/op-support.c (_gpgme_parse_failure): Ignore failures with
location "gpg-exit".
* tests/gpg/t-verify.c (main): Adjust for the now working checking of
the second key.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-04-12 20:36:30 +02:00
parent 478d1650bb
commit b99502274a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 14 additions and 4 deletions

View File

@ -400,7 +400,13 @@ _gpgme_parse_plaintext (char *args, char **filenamep)
/* Parse a FAILURE status line and return the error code. ARGS is
modified to contain the location part. */
* modified to contain the location part. Note that for now we ignore
* failure codes with a location of gpg-exit; they are too trouble
* some. Instead we should eventually record that error in the
* context and provide a function to return a fuller error
* description; this could then also show the location of the error
* (e.g. "option- parser") to make it easier for the user to detect
* the actual error. */
gpgme_error_t
_gpgme_parse_failure (char *args)
{
@ -418,6 +424,8 @@ _gpgme_parse_failure (char *args)
*where = '\0';
where = args;
if (!strcmp (where, "gpg-exit"))
return 0;
return atoi (which);
}

View File

@ -267,10 +267,12 @@ main (int argc, char *argv[])
err = gpgme_op_verify (ctx, sig, text, NULL);
fail_if_err (err);
result = gpgme_op_verify_result (ctx);
check_result (result, 2, 0, 0, "A0FF4590BB6122EDEF6E3C542D727CC768697734",
check_result (result, 2, 0, 0,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
GPG_ERR_NO_ERROR, 1);
check_result (result, 2, 1, 0, "36EC2A70C6426EB0FCE5BB4DF91C98F049D4204C",
GPG_ERR_NO_ERROR, 0);
check_result (result, 2, 1, GPGME_SIGSUM_KEY_MISSING,
"36EC2A70C6426EB0FCE5BB4DF91C98F049D4204C",
GPG_ERR_NO_PUBKEY, 0);
/* Checking a normal signature. */