diff options
author | Werner Koch <wk@gnupg.org> | 2009-08-06 22:12:00 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2009-08-06 22:12:00 +0200 |
commit | 019601191a250f5ec95ca871aa281ae836a1a34e (patch) | |
tree | 2d948f3e1fa834f262519853f5556bfe48f37209 /common | |
parent | Enable readline support in --card-edit. (diff) | |
download | gnupg2-019601191a250f5ec95ca871aa281ae836a1a34e.tar.xz gnupg2-019601191a250f5ec95ca871aa281ae836a1a34e.zip |
Improved detection of bad/invalid signer keys.
Diffstat (limited to 'common')
-rw-r--r-- | common/ChangeLog | 5 | ||||
-rw-r--r-- | common/status.c | 27 | ||||
-rw-r--r-- | common/status.h | 3 |
3 files changed, 35 insertions, 0 deletions
diff --git a/common/ChangeLog b/common/ChangeLog index c056c4c65..b9c48188e 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,8 @@ +2009-08-06 Werner Koch <wk@g10code.com> + + * status.h (STATUS_INV_SGNR, STATUS_NO_SGNR): New. + * status.c (get_inv_recpsgnr_code): New. + 2009-07-23 David Shaw <dshaw@jabberwocky.com> * srv.c (getsrv): Fix type-punning warning. diff --git a/common/status.c b/common/status.c index 7012edf03..e9f84bfd1 100644 --- a/common/status.c +++ b/common/status.c @@ -36,3 +36,30 @@ get_status_string ( int no ) return statusstr_msgstr + statusstr_msgidx[idx]; } + +const char * +get_inv_recpsgnr_code (gpg_error_t err) +{ + const char *errstr; + + switch (gpg_err_code (err)) + { + case GPG_ERR_NO_PUBKEY: errstr = "1"; break; + case GPG_ERR_AMBIGUOUS_NAME: errstr = "2"; break; + case GPG_ERR_WRONG_KEY_USAGE: errstr = "3"; break; + case GPG_ERR_CERT_REVOKED: errstr = "4"; break; + case GPG_ERR_CERT_EXPIRED: errstr = "5"; break; + case GPG_ERR_NO_CRL_KNOWN: errstr = "6"; break; + case GPG_ERR_CRL_TOO_OLD: errstr = "7"; break; + case GPG_ERR_NO_POLICY_MATCH: errstr = "8"; break; + + case GPG_ERR_UNUSABLE_SECKEY: + case GPG_ERR_NO_SECKEY: errstr = "9"; break; + + case GPG_ERR_NOT_TRUSTED: errstr = "10"; break; + case GPG_ERR_MISSING_CERT: errstr = "11"; break; + default: errstr = "0"; break; + } + + return errstr; +} diff --git a/common/status.h b/common/status.h index 50a11914a..a11f2a38c 100644 --- a/common/status.h +++ b/common/status.h @@ -91,7 +91,9 @@ enum STATUS_USERID_HINT, STATUS_UNEXPECTED, STATUS_INV_RECP, + STATUS_INV_SGNR, STATUS_NO_RECP, + STATUS_NO_SGNR, STATUS_ALREADY_SIGNED, STATUS_KEYEXPIRED, @@ -127,6 +129,7 @@ enum const char *get_status_string (int code); +const char *get_inv_recpsgnr_code (gpg_error_t err); #endif /*GNUPG_COMMON_STATUS_H*/ |