(parse_error): Compare only the last part of the where

token.
This commit is contained in:
Werner Koch 2004-04-05 13:49:29 +00:00
parent 92dff6e4f1
commit 761cd12e1e
3 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,8 @@
2004-04-05 Werner Koch <wk@gnupg.org> 2004-04-05 Werner Koch <wk@gnupg.org>
* verify.c (parse_error): Compare only the last part of the where
token.
* engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation * engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation
option. Fixed pattern construction. option. Fixed pattern construction.

View File

@ -396,7 +396,7 @@ _gpgme_map_gnupg_error (char *err)
/* Future version of GnuPG might return the error code directly, so /* Future version of GnuPG might return the error code directly, so
we first test for a a numerical value and use that verbatim. we first test for a a numerical value and use that verbatim.
Note that this numerical value might be followed by an Note that this numerical value might be followed by an
udnerschore and the textual representation of the error code. */ underschore and the textual representation of the error code. */
if (*err >= '0' && *err <= '9') if (*err >= '0' && *err <= '9')
return strtoul (err, NULL, 10); return strtoul (err, NULL, 10);

View File

@ -430,6 +430,7 @@ parse_error (gpgme_signature_t sig, char *args)
gpgme_error_t err; gpgme_error_t err;
char *where = strchr (args, ' '); char *where = strchr (args, ' ');
char *which; char *which;
char *where_last;
if (where) if (where)
{ {
@ -445,11 +446,16 @@ parse_error (gpgme_signature_t sig, char *args)
else else
return gpg_error (GPG_ERR_INV_ENGINE); return gpg_error (GPG_ERR_INV_ENGINE);
/* It is often useful to compare only the last part of the where token. */
where_last = strrchr (where, '.');
if (!where_last)
where_last = where;
err = _gpgme_map_gnupg_error (which); err = _gpgme_map_gnupg_error (which);
if (!strcmp (where, "verify.findkey")) if (!strcmp (where_last, ".findkey"))
sig->status = err; sig->status = err;
else if (!strcmp (where, "verify.keyusage") else if (!strcmp (where_last, ".keyusage")
&& gpg_err_code (err) == GPG_ERR_WRONG_KEY_USAGE) && gpg_err_code (err) == GPG_ERR_WRONG_KEY_USAGE)
sig->wrong_key_usage = 1; sig->wrong_key_usage = 1;