From 1cb08a35a6eb214202b196aa2e69dafb0ef5aebd Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 17 Nov 2009 13:06:05 +0000 Subject: [PATCH] Fixes for the UI server engine . --- src/ChangeLog | 5 +++++ src/engine-uiserver.c | 42 ++++++++++++++++++++++-------------------- src/sign.c | 6 +++++- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d7af1d6..1117bc4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-11-13 + + * sign.c (_gpgme_sign_status_handler): Handle SIG_CREATED_SEEN. + * engine-uiserver.c (uiserver_sign): Make sending SENDER optional. + 2009-11-10 Marcus Brinkmann * op-support.c (_gpgme_op_reset): Instead of last change, only set diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c index 623dd59..9e910b6 100644 --- a/src/engine-uiserver.c +++ b/src/engine-uiserver.c @@ -1153,6 +1153,7 @@ uiserver_sign (void *engine, gpgme_data_t in, gpgme_data_t out, gpgme_error_t err = 0; const char *protocol; char *cmd; + gpgme_key_t key; if (!uiserver || !in || !out) return gpg_error (GPG_ERR_INV_VALUE); @@ -1169,26 +1170,27 @@ uiserver_sign (void *engine, gpgme_data_t in, gpgme_data_t out, (mode == GPGME_SIG_MODE_DETACH) ? " --detached" : "") < 0) return gpg_error_from_errno (errno); - { - gpgme_key_t key = gpgme_signers_enum (ctx, 0); - const char *s = NULL; - - if (key && key->uids) - s = key->uids->email; - - if (s && strlen (s) < 80) - { - char buf[100]; - - strcpy (stpcpy (buf, "SENDER --info "), s); - err = uiserver_assuan_simple_command (uiserver->assuan_ctx, buf, - uiserver->status.fnc, - uiserver->status.fnc_value); - } - else - err = gpg_error (GPG_ERR_INV_VALUE); - gpgme_key_unref (key); - if (err) + key = gpgme_signers_enum (ctx, 0); + if (key) + { + const char *s = NULL; + + if (key && key->uids) + s = key->uids->email; + + if (s && strlen (s) < 80) + { + char buf[100]; + + strcpy (stpcpy (buf, "SENDER --info "), s); + err = uiserver_assuan_simple_command (uiserver->assuan_ctx, buf, + uiserver->status.fnc, + uiserver->status.fnc_value); + } + else + err = gpg_error (GPG_ERR_INV_VALUE); + gpgme_key_unref (key); + if (err) { free (cmd); return err; diff --git a/src/sign.c b/src/sign.c index c66f06a..3d860da 100644 --- a/src/sign.c +++ b/src/sign.c @@ -286,9 +286,13 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args) break; case GPGME_STATUS_EOF: + /* The UI server does not send information about the created + signature. This is irrelevant for this protocol and thus we + should not check for that. */ if (opd->result.invalid_signers) err = gpg_error (GPG_ERR_UNUSABLE_SECKEY); - else if (!opd->sig_created_seen) + else if (!opd->sig_created_seen + && ctx->protocol != GPGME_PROTOCOL_UISERVER) err = gpg_error (GPG_ERR_GENERAL); break; -- 2.26.2