Make recipients command work.
This commit is contained in:
parent
0fae16ae89
commit
d173e6e010
@ -1,7 +1,14 @@
|
|||||||
2009-11-10 Werner Koch <wk@g10code.com>
|
2009-11-10 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* op-support.c (_gpgme_op_reset): Ignore GPG_ERR_NOT_IMPLEMENTED
|
||||||
|
while setting the sub protocol.
|
||||||
|
|
||||||
* engine-uiserver.c (uiserver_new): Pass fdpassing flag to
|
* engine-uiserver.c (uiserver_new): Pass fdpassing flag to
|
||||||
assuan_socket_connect.
|
assuan_socket_connect.
|
||||||
|
(set_recipients): Replace fingerprint by user id.
|
||||||
|
|
||||||
|
* engine-gpgsm.c (set_recipients): Fix non-terminating loop in
|
||||||
|
case of a missing key.
|
||||||
|
|
||||||
2009-11-10 Marcus Brinkmann <marcus@g10code.de>
|
2009-11-10 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
@ -1161,14 +1161,14 @@ set_recipients (engine_gpgsm_t gpgsm, gpgme_key_t recp[])
|
|||||||
char *line;
|
char *line;
|
||||||
int linelen;
|
int linelen;
|
||||||
int invalid_recipients = 0;
|
int invalid_recipients = 0;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
linelen = 10 + 40 + 1; /* "RECIPIENT " + guess + '\0'. */
|
linelen = 10 + 40 + 1; /* "RECIPIENT " + guess + '\0'. */
|
||||||
line = malloc (10 + 40 + 1);
|
line = malloc (10 + 40 + 1);
|
||||||
if (!line)
|
if (!line)
|
||||||
return gpg_error_from_errno (errno);
|
return gpg_error_from_errno (errno);
|
||||||
strcpy (line, "RECIPIENT ");
|
strcpy (line, "RECIPIENT ");
|
||||||
while (!err && recp[i])
|
for (i =0; !err && recp[i]; i++)
|
||||||
{
|
{
|
||||||
char *fpr;
|
char *fpr;
|
||||||
int newlen;
|
int newlen;
|
||||||
@ -1205,7 +1205,6 @@ set_recipients (engine_gpgsm_t gpgsm, gpgme_key_t recp[])
|
|||||||
free (line);
|
free (line);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
free (line);
|
free (line);
|
||||||
return gpg_error (invalid_recipients
|
return gpg_error (invalid_recipients
|
||||||
|
@ -1011,26 +1011,26 @@ set_recipients (engine_uiserver_t uiserver, gpgme_key_t recp[])
|
|||||||
char *line;
|
char *line;
|
||||||
int linelen;
|
int linelen;
|
||||||
int invalid_recipients = 0;
|
int invalid_recipients = 0;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
linelen = 10 + 40 + 1; /* "RECIPIENT " + guess + '\0'. */
|
linelen = 10 + 40 + 1; /* "RECIPIENT " + guess + '\0'. */
|
||||||
line = malloc (10 + 40 + 1);
|
line = malloc (10 + 40 + 1);
|
||||||
if (!line)
|
if (!line)
|
||||||
return gpg_error_from_errno (errno);
|
return gpg_error_from_errno (errno);
|
||||||
strcpy (line, "RECIPIENT ");
|
strcpy (line, "RECIPIENT ");
|
||||||
while (!err && recp[i])
|
for (i=0; !err && recp[i]; i++)
|
||||||
{
|
{
|
||||||
char *fpr;
|
char *uid;
|
||||||
int newlen;
|
int newlen;
|
||||||
|
|
||||||
if (!recp[i]->subkeys || !recp[i]->subkeys->fpr)
|
/* We use only the first user ID of the key. */
|
||||||
|
if (!recp[i]->uids || !(uid=recp[i]->uids->uid) || !*uid)
|
||||||
{
|
{
|
||||||
invalid_recipients++;
|
invalid_recipients++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fpr = recp[i]->subkeys->fpr;
|
|
||||||
|
|
||||||
newlen = 11 + strlen (fpr);
|
newlen = 11 + strlen (uid);
|
||||||
if (linelen < newlen)
|
if (linelen < newlen)
|
||||||
{
|
{
|
||||||
char *newline = realloc (line, newlen);
|
char *newline = realloc (line, newlen);
|
||||||
@ -1043,11 +1043,12 @@ set_recipients (engine_uiserver_t uiserver, gpgme_key_t recp[])
|
|||||||
line = newline;
|
line = newline;
|
||||||
linelen = newlen;
|
linelen = newlen;
|
||||||
}
|
}
|
||||||
strcpy (&line[10], fpr);
|
/* FIXME: need to do proper escaping */
|
||||||
|
strcpy (&line[10], uid);
|
||||||
|
|
||||||
err = uiserver_assuan_simple_command (ctx, line, uiserver->status.fnc,
|
err = uiserver_assuan_simple_command (ctx, line, uiserver->status.fnc,
|
||||||
uiserver->status.fnc_value);
|
uiserver->status.fnc_value);
|
||||||
/* FIXME: This requires more work. */
|
/* FIXME: This might requires more work. */
|
||||||
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY)
|
if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY)
|
||||||
invalid_recipients++;
|
invalid_recipients++;
|
||||||
else if (err)
|
else if (err)
|
||||||
@ -1055,7 +1056,6 @@ set_recipients (engine_uiserver_t uiserver, gpgme_key_t recp[])
|
|||||||
free (line);
|
free (line);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
free (line);
|
free (line);
|
||||||
return gpg_error (invalid_recipients
|
return gpg_error (invalid_recipients
|
||||||
|
@ -131,6 +131,8 @@ _gpgme_op_reset (gpgme_ctx_t ctx, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = _gpgme_engine_set_protocol (ctx->engine, ctx->sub_protocol);
|
err = _gpgme_engine_set_protocol (ctx->engine, ctx->sub_protocol);
|
||||||
|
if (gpg_err_code (err) == GPG_ERR_NOT_IMPLEMENTED)
|
||||||
|
err = 0;
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user