Status with gpgme_op_verify in GPGME
Marcus Brinkmann
Marcus.Brinkmann@ruhr-uni-bochum.de
Mon Feb 25 20:09:02 2002
On Thu, Feb 21, 2002 at 02:40:10PM +0100, Laurent Cheylus wrote:
> But when I verify a signature and I have not the public key in my
> keyring, I have the status "GPGME_SIG_STAT_ERROR" instead of
> "GPGME_SIG_STAT_NOKEY". Is it a bug or I have not understood the status
> with "gpgme_op_verify" ;-(
Yes, that was a small thing missing in the implementation. Could you please
try the following patch if that works for you?
Thanks,
Marcus
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* verify.c (_gpgme_verify_status_handler): Parse the args line to
see if the problem is due to a missing key, and report that back
to the user.
Index: verify.c
===================================================================
RCS file: /cvs/gnupg/gpgme/gpgme/verify.c,v
retrieving revision 1.21
diff -u -r1.21 verify.c
--- verify.c 2002/02/06 01:41:15 1.21
+++ verify.c 2002/02/25 18:49:00
@@ -191,9 +191,14 @@
break;
case STATUS_ERRSIG:
- ctx->result.verify->status = GPGME_SIG_STAT_ERROR;
- /* FIXME: Distinguish between a regular error and a missing key.
- This is encoded in the args. */
+ /* The return code is the 6th argument, if it is 9, the problem
+ is a missing key. */
+ for (p = args, i = 0; p && i < 5; i++)
+ p = strchr (p, ' ');
+ if (p && *(++p) == '9' && *(++p) == '\0')
+ ctx->result.verify->status = GPGME_SIG_STAT_NOKEY;
+ else
+ ctx->result.verify->status = GPGME_SIG_STAT_ERROR;
/* Store the keyID in the fpr field. */
p = ctx->result.verify->fpr;
for (i = 0; i < DIM(ctx->result.verify->fpr)
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de