diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index e64a7fa1..3e5846db 100644 --- a/gpgme/ChangeLog +++ b/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/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 1d7ef2ed..0e2a7ce4 100644 --- a/gpgme/engine-gpgsm.c +++ b/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/gpgme/gpgme.h b/gpgme/gpgme.h index ed82ecfe..2fc4d67e 100644 --- a/gpgme/gpgme.h +++ b/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. */