(gpgsm_keylist_ext): Send with-validation

option.  Fixed pattern construction.
This commit is contained in:
Werner Koch 2004-04-05 11:53:55 +00:00
parent 78cdfffd92
commit 92dff6e4f1
4 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-04-05 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (gpgsm_keylist_ext): Send with-validation
option. Fixed pattern construction.
2004-03-23 Marcus Brinkmann <marcus@g10code.de> 2004-03-23 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new): Protect _only_ tty related code with * engine-gpgsm.c (gpgsm_new): Protect _only_ tty related code with

View File

@ -29,7 +29,9 @@
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#ifndef _WIN32
#include <sys/wait.h> #include <sys/wait.h>
#endif
#include "ath.h" #include "ath.h"

View File

@ -1293,6 +1293,7 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
/* Length is "LISTSECRETKEYS " + p + '\0'. */ /* Length is "LISTSECRETKEYS " + p + '\0'. */
int length = 15 + 1; int length = 15 + 1;
char *linep; char *linep;
int any_pattern = 0;
int list_mode = 0; int list_mode = 0;
if (reserved) if (reserved)
@ -1310,6 +1311,15 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
if (err) if (err)
return 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) if (pattern && *pattern)
{ {
const char **pat = pattern; const char **pat = pattern;
@ -1326,7 +1336,6 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
patlet++; patlet++;
} }
pat++; pat++;
/* This will allocate one byte more than necessary. */
length++; length++;
} }
} }
@ -1375,9 +1384,13 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only,
} }
patlet++; patlet++;
} }
any_pattern = 1;
*linep++ = ' ';
pattern++; pattern++;
} }
} }
if (any_pattern)
linep--;
*linep = '\0'; *linep = '\0';
_gpgme_io_close (gpgsm->input_cb.fd); _gpgme_io_close (gpgsm->input_cb.fd);

View File

@ -37,6 +37,9 @@
typedef long ssize_t; typedef long ssize_t;
#else #else
# include <sys/types.h> # include <sys/types.h>
#ifdef _WIN32
typedef long ssize_t;
#endif
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -71,7 +74,7 @@ extern "C" {
AM_PATH_GPGME macro) check that this header matches the installed AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do library. Warning: Do not edit the next line. configure will do
that for you! */ that for you! */
#define GPGME_VERSION "0.4.5-cvs" #define GPGME_VERSION "0.4.6-cvs"
/* Some opaque data types used by GPGME. */ /* Some opaque data types used by GPGME. */