From 92dff6e4f17567cbe64fc4779deb9d2c51716ab0 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 5 Apr 2004 11:53:55 +0000 Subject: [PATCH] (gpgsm_keylist_ext): Send with-validation option. Fixed pattern construction. --- gpgme/ChangeLog | 5 +++++ gpgme/ath-compat.c | 2 ++ gpgme/engine-gpgsm.c | 15 ++++++++++++++- gpgme/gpgme.h | 5 ++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 9e52ee8..16b2d87 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2004-04-05 Werner Koch + + * engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation + option. Fixed pattern construction. + 2004-03-23 Marcus Brinkmann * engine-gpgsm.c (gpgsm_new): Protect _only_ tty related code with diff --git a/gpgme/ath-compat.c b/gpgme/ath-compat.c index 02ccc58..a4bd3f1 100644 --- a/gpgme/ath-compat.c +++ b/gpgme/ath-compat.c @@ -29,7 +29,9 @@ # include #endif #include +#ifndef _WIN32 #include +#endif #include "ath.h" diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 929b98c..79eb210 100644 --- a/gpgme/engine-gpgsm.c +++ b/gpgme/engine-gpgsm.c @@ -1293,6 +1293,7 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only, /* Length is "LISTSECRETKEYS " + p + '\0'. */ int length = 15 + 1; char *linep; + int any_pattern = 0; int list_mode = 0; if (reserved) @@ -1310,6 +1311,15 @@ gpgsm_keylist_ext (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); + + if (pattern && *pattern) { const char **pat = pattern; @@ -1326,7 +1336,6 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only, patlet++; } pat++; - /* This will allocate one byte more than necessary. */ length++; } } @@ -1375,9 +1384,13 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only, } patlet++; } + any_pattern = 1; + *linep++ = ' '; pattern++; } } + if (any_pattern) + linep--; *linep = '\0'; _gpgme_io_close (gpgsm->input_cb.fd); diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 04615e6..adc769f 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -37,6 +37,9 @@ typedef long ssize_t; #else # include +#ifdef _WIN32 +typedef long ssize_t; +#endif #endif #ifdef __cplusplus @@ -71,7 +74,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.5-cvs" +#define GPGME_VERSION "0.4.6-cvs" /* Some opaque data types used by GPGME. */ -- 2.26.2