From 1ba7158f978dd7cfa0adc837f5798e18d107f346 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 29 Aug 2002 11:57:53 +0000 Subject: [PATCH] * engine-gpgsm.c (_gpgme_gpgsm_op_sign): Implement signer selection. * vasprintf.c (va_copy): Define macro if not yet defined. --- trunk/gpgme/ChangeLog | 6 ++++++ trunk/gpgme/engine-gpgsm.c | 29 ++++++++++++++++++++++++++++- trunk/gpgme/gpgme.h | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index e64a7fa..3e5846d 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,9 @@ +2002-08-29 Werner Koch + + * engine-gpgsm.c (_gpgme_gpgsm_op_sign): Implement signer + selection. + * vasprintf.c (va_copy): Define macro if not yet defined. + 2002-08-29 Marcus Brinkmann * passphrase.c (_gpgme_passphrase_status_handler): Reset diff --git a/trunk/gpgme/engine-gpgsm.c b/trunk/gpgme/engine-gpgsm.c index 1d7ef2e..0e2a7ce 100644 --- a/trunk/gpgme/engine-gpgsm.c +++ b/trunk/gpgme/engine-gpgsm.c @@ -1076,6 +1076,8 @@ _gpgme_gpgsm_op_sign (GpgsmObject gpgsm, GpgmeData in, GpgmeData out, { GpgmeError err; char *assuan_cmd; + int i; + GpgmeKey key; if (!gpgsm) return mk_error (Invalid_Value); @@ -1087,11 +1089,36 @@ _gpgme_gpgsm_op_sign (GpgsmObject gpgsm, GpgmeData in, GpgmeData out, if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0) return mk_error (Out_Of_Core); - err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd, NULL, NULL); + err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd, NULL,NULL); free (assuan_cmd); if (err) return err; + /* We must do a reset becuase we need to reset the list of signers. Note + that RESET does not reset OPTION commands. */ + err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "RESET", NULL, NULL); + if (err) + return err; + + for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) + { + const char *s = gpgme_key_get_string_attr (key, GPGME_ATTR_FPR, + NULL, 0); + if (s && strlen (s) < 80) + { + char buf[100]; + + strcpy (stpcpy (buf, "SIGNER "), s); + err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, buf, + NULL, NULL); + } + else + err = GPGME_Invalid_Key; + gpgme_key_unref (key); + if (err) + return err; + } + gpgsm->input_cb.data = in; err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, map_input_enc (gpgsm->input_cb.data)); diff --git a/trunk/gpgme/gpgme.h b/trunk/gpgme/gpgme.h index ed82ecf..2fc4d67 100644 --- a/trunk/gpgme/gpgme.h +++ b/trunk/gpgme/gpgme.h @@ -43,7 +43,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.3.9" +#define GPGME_VERSION "0.3.10" /* The opaque data types used by GPGME. */ -- 2.26.2