Mailing List Archive

[PATCH gnupg] sm (gpgsm_verify): Use gpg_err_code() instead of -1
* sm/verify.c (gpgsm_verify): use gpg_err_code instead of 'rc == -1'
comparison.
--

In ed6ebb696e (sm: Implement initial support for keyboxd., 2020-09-10),
the return of keydb_search() was changed to use gpg_err_code(). Adjust
gpgsm_verify() to use it. This provides a nicer error message to users
when a certificate is not found -- the same error that is seen from 2.2.

Prior to this change, when a cert was not found, gpgsm output:

gpgsm: failed to find the certificate: Not found

as opposed to the more human-readable message from 2.2:

gpgsm: certificate not found

They now return the same message.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
sm/verify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sm/verify.c b/sm/verify.c
index fe111c32a..3dc494beb 100644
--- a/sm/verify.c
+++ b/sm/verify.c
@@ -428,7 +428,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
rc = keydb_search_issuer_sn (ctrl, kh, issuer, serial);
if (rc)
{
- if (rc == -1)
+ if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
{
log_error ("certificate not found\n");
rc = gpg_error (GPG_ERR_NO_PUBKEY);

_______________________________________________
Gnupg-devel mailing list
Gnupg-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel