1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* certlist.c (gpgsm_add_to_certlist): Check that the specified

name identifies a certificate unambiguously.
(gpgsm_find_cert): Ditto.
* server.c (cmd_listkeys): Check that the data stream is available.
(cmd_listsecretkeys): Ditto.
(has_option): New.
(cmd_sign): Fix ambiguousity in option recognition.
* gpgsm.c (main): Enable --logger-fd.
* encrypt.c (gpgsm_encrypt): Increased buffer size for better
performance.
* call-agent.c (gpgsm_agent_pksign): Check the S-Exp received from
the agent.
* keylist.c (list_cert_colon): Filter out control characters.
This commit is contained in:
Werner Koch 2002-02-07 18:43:22 +00:00
parent 6aa7267865
commit 2a28f5d0ae
10 changed files with 79 additions and 21 deletions

View file

@ -42,6 +42,17 @@ struct server_local_s {
CERTLIST recplist;
};
/* Check whether the option NAME appears in LINE */
static int
has_option (const char *line, const char *name)
{
const char *s;
int n = strlen (name);
s = strstr (line, name);
return (s && (s == line || spacep (s-1)) && (!s[n] || spacep (s+n)));
}
static void
close_message_fd (CTRL ctrl)
@ -289,7 +300,7 @@ cmd_sign (ASSUAN_CONTEXT ctx, char *line)
if (out_fd == -1)
return set_error (No_Output, NULL);
detached = !!strstr (line, "--detached"); /* fixme: this is ambiguous */
detached = has_option (line, "--detached");
out_fp = fdopen ( dup(out_fd), "w");
if (!out_fp)
@ -362,11 +373,12 @@ static int
cmd_listkeys (ASSUAN_CONTEXT ctx, char *line)
{
CTRL ctrl = assuan_get_pointer (ctx);
FILE *fp = assuan_get_data_fp (ctx);
if (!fp)
return set_error (General_Error, "no data stream");
ctrl->with_colons = 1;
/* fixme: check that the returned data_fp is not NULL */
gpgsm_list_keys (assuan_get_pointer (ctx), NULL,
assuan_get_data_fp (ctx), 3);
gpgsm_list_keys (assuan_get_pointer (ctx), NULL, fp, 3);
return 0;
}
@ -375,11 +387,12 @@ static int
cmd_listsecretkeys (ASSUAN_CONTEXT ctx, char *line)
{
CTRL ctrl = assuan_get_pointer (ctx);
FILE *fp = assuan_get_data_fp (ctx);
ctrl->with_colons = 1;
/* fixme: check that the returned data_fp is not NULL */
gpgsm_list_keys (assuan_get_pointer (ctx), NULL,
assuan_get_data_fp (ctx), 2);
if (!fp)
return set_error (General_Error, "no data stream");
gpgsm_list_keys (assuan_get_pointer (ctx), NULL, fp, 2);
return 0;
}