From afabac4c9dbc0ee0a88ad225b27be3836509f5f9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 17 Feb 2004 15:27:42 +0000 Subject: [PATCH] * gpgme.texi (Key Listing Mode): Doc KEYLIST_MODE_VALIDATE. * gpgme.h: Add GPGME_KEYLIST_MODE_VALIDATE. * engine-gpgsm.c (gpgsm_keylist): Send this to gpgsm. --- TODO | 7 ++++++- doc/ChangeLog | 4 ++++ doc/gpgme.texi | 13 ++++++++++++- gpgme/ChangeLog | 5 +++++ gpgme/engine-gpgsm.c | 12 +++++++++++- gpgme/gpgme.h | 7 ++++--- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index bd2eaca2..b80bef87 100644 --- a/TODO +++ b/TODO @@ -144,4 +144,9 @@ Hey Emacs, this is -*- outline -*- mode! * Build suite ** Make sure everything is cleaned correctly (esp. test area). -** Cofnigure test for gpg and gpgsm version (as a warning). +** Configure test for gpg and gpgsm version (as a warning). + + +* Error checking +** engine-gpgsm, with-validation + Add error checking some time after releasing a new gpgsm. diff --git a/doc/ChangeLog b/doc/ChangeLog index 0565d7e4..809cc14d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2004-02-17 Werner Koch + + * gpgme.texi (Key Listing Mode): Doc KEYLIST_MODE_VALIDATE. + 2004-02-06 Moritz Schulte * gpgme.texi: A couple of small fixes regarding the Largfile diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 4f735c8e..3e5e8989 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -1983,6 +1983,14 @@ certificate server. @item GPGME_KEYLIST_MODE_SIGS The @code{GPGME_KEYLIST_MODE_SIGS} symbol specifies that the key signatures should be included in the listed keys. + +@item GPGME_KEYLIST_MODE_VALIDATE +The @code{GPGME_KEYLIST_MODE_VALIDATE} symbol specifies that the +backend should do key or certificate validation and not just get the +validity information from an interna cache. This might be an +expensive operation and is in general not usefule. Currently only +implemented for the S/MIME backend and ignored for other backends. + @end table At least one of @code{GPGME_KEYLIST_MODE_LOCAL} and @@ -2348,7 +2356,10 @@ This is true if the key is expired. This is true if the key is disabled. @item unsigned int invalid : 1 -This is true if the key is invalid. +This is true if the key is invalid. This might have several reasons, +for a example for the S/MIME backend, it will be set in during key +listsing if the key could not be validated due to a missing +certificates or unmatched policies. @item unsigned int can_encrypt : 1 This is true if the key (ie one of its subkeys) can be used for diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 065f8cde..2a3488bf 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2004-02-17 Werner Koch + + * gpgme.h: Add GPGME_KEYLIST_MODE_VALIDATE. + * engine-gpgsm.c (gpgsm_keylist): Send this to gpgsm. + 2004-02-15 Werner Koch * memrchr.c (memrchr): Fixed implementation. Problem pointed out diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 486c7458..46c8090c 100644 --- a/gpgme/engine-gpgsm.c +++ b/gpgme/engine-gpgsm.c @@ -1,6 +1,6 @@ /* engine-gpgsm.c - GpgSM engine. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. @@ -1226,6 +1226,16 @@ gpgsm_keylist (void *engine, const char *pattern, int secret_only, if (err) return err; + + /* Use the validation mode if required. We don't check for an error + yet because this is a pretty fresh gpgsm features. */ + gpgsm_assuan_simple_command (gpgsm->assuan_ctx, + (mode & GPGME_KEYLIST_MODE_VALIDATE)? + "OPTION with-validation=1": + "OPTION with-validation=0" , + NULL, NULL); + + /* Length is "LISTSECRETKEYS " + p + '\0'. */ line = malloc (15 + strlen (pattern) + 1); if (!line) diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 110fad0b..4dd72ff2 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -1,6 +1,6 @@ /* gpgme.h - Public interface to GnuPG Made Easy. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. @@ -71,7 +71,7 @@ extern "C" { AM_PATH_GPGME macro) check that this header matches the installed library. Warning: Do not edit the next line. configure will do that for you! */ -#define GPGME_VERSION "0.4.4" +#define GPGME_VERSION "0.4.5-cvs" /* Some opaque data types used by GPGME. */ @@ -698,7 +698,8 @@ typedef enum { GPGME_KEYLIST_MODE_LOCAL = 1, GPGME_KEYLIST_MODE_EXTERN = 2, - GPGME_KEYLIST_MODE_SIGS = 4 + GPGME_KEYLIST_MODE_SIGS = 4, + GPGME_KEYLIST_MODE_VALIDATE = 256 } gpgme_keylist_mode_t;