aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-08-29 11:57:53 +0000
committerWerner Koch <[email protected]>2002-08-29 11:57:53 +0000
commitc642b7d54ab14de278c9c6cc1224d6eea9e42403 (patch)
tree4053b61d2169363c2f489bc4a4251bd495a287bd
parent* acinclude.m4 (GNUPG_CHECK_VA_COPY): New. (diff)
downloadgpgme-c642b7d54ab14de278c9c6cc1224d6eea9e42403.tar.gz
gpgme-c642b7d54ab14de278c9c6cc1224d6eea9e42403.zip
* engine-gpgsm.c (_gpgme_gpgsm_op_sign): Implement signer
selection. * vasprintf.c (va_copy): Define macro if not yet defined.
-rw-r--r--gpgme/ChangeLog6
-rw-r--r--gpgme/engine-gpgsm.c29
-rw-r--r--gpgme/gpgme.h2
3 files changed, 35 insertions, 2 deletions
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 <[email protected]>
+
+ * 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 <[email protected]>
* 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. */