From: Werner Koch Date: Mon, 5 Apr 2004 13:49:29 +0000 (+0000) Subject: (parse_error): Compare only the last part of the where X-Git-Tag: gpgme-0-4-6~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=761cd12e1ea6718006e87b06adfa19b685e9ceec;p=gpgme.git (parse_error): Compare only the last part of the where token. --- diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 16b2d87..5eb4766 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,8 @@ 2004-04-05 Werner Koch + * verify.c (parse_error): Compare only the last part of the where + token. + * engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation option. Fixed pattern construction. diff --git a/gpgme/conversion.c b/gpgme/conversion.c index 8faf852..12a5822 100644 --- a/gpgme/conversion.c +++ b/gpgme/conversion.c @@ -396,7 +396,7 @@ _gpgme_map_gnupg_error (char *err) /* Future version of GnuPG might return the error code directly, so we first test for a a numerical value and use that verbatim. 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') return strtoul (err, NULL, 10); diff --git a/gpgme/verify.c b/gpgme/verify.c index b3287bd..05ea520 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -430,6 +430,7 @@ parse_error (gpgme_signature_t sig, char *args) gpgme_error_t err; char *where = strchr (args, ' '); char *which; + char *where_last; if (where) { @@ -445,11 +446,16 @@ parse_error (gpgme_signature_t sig, char *args) else 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); - if (!strcmp (where, "verify.findkey")) + if (!strcmp (where_last, ".findkey")) sig->status = err; - else if (!strcmp (where, "verify.keyusage") + else if (!strcmp (where_last, ".keyusage") && gpg_err_code (err) == GPG_ERR_WRONG_KEY_USAGE) sig->wrong_key_usage = 1;