Fixes for the UI server engine .

This commit is contained in:
Werner Koch 2009-11-17 13:06:05 +00:00
parent aff1ed3fb6
commit 1cb08a35a6
3 changed files with 32 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2009-11-13 <wk@g10code.com>
* sign.c (_gpgme_sign_status_handler): Handle SIG_CREATED_SEEN.
* engine-uiserver.c (uiserver_sign): Make sending SENDER optional.
2009-11-10 Marcus Brinkmann <marcus@g10code.de> 2009-11-10 Marcus Brinkmann <marcus@g10code.de>
* op-support.c (_gpgme_op_reset): Instead of last change, only set * op-support.c (_gpgme_op_reset): Instead of last change, only set

View File

@ -1153,6 +1153,7 @@ uiserver_sign (void *engine, gpgme_data_t in, gpgme_data_t out,
gpgme_error_t err = 0; gpgme_error_t err = 0;
const char *protocol; const char *protocol;
char *cmd; char *cmd;
gpgme_key_t key;
if (!uiserver || !in || !out) if (!uiserver || !in || !out)
return gpg_error (GPG_ERR_INV_VALUE); 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) (mode == GPGME_SIG_MODE_DETACH) ? " --detached" : "") < 0)
return gpg_error_from_errno (errno); return gpg_error_from_errno (errno);
{ key = gpgme_signers_enum (ctx, 0);
gpgme_key_t key = gpgme_signers_enum (ctx, 0); if (key)
const char *s = NULL; {
const char *s = NULL;
if (key && key->uids) if (key && key->uids)
s = key->uids->email; s = key->uids->email;
if (s && strlen (s) < 80) if (s && strlen (s) < 80)
{ {
char buf[100]; char buf[100];
strcpy (stpcpy (buf, "SENDER --info "), s); strcpy (stpcpy (buf, "SENDER --info "), s);
err = uiserver_assuan_simple_command (uiserver->assuan_ctx, buf, err = uiserver_assuan_simple_command (uiserver->assuan_ctx, buf,
uiserver->status.fnc, uiserver->status.fnc,
uiserver->status.fnc_value); uiserver->status.fnc_value);
} }
else else
err = gpg_error (GPG_ERR_INV_VALUE); err = gpg_error (GPG_ERR_INV_VALUE);
gpgme_key_unref (key); gpgme_key_unref (key);
if (err) if (err)
{ {
free (cmd); free (cmd);
return err; return err;

View File

@ -286,9 +286,13 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args)
break; break;
case GPGME_STATUS_EOF: 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) if (opd->result.invalid_signers)
err = gpg_error (GPG_ERR_UNUSABLE_SECKEY); 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); err = gpg_error (GPG_ERR_GENERAL);
break; break;