* decrypt.c (gpgsm_decrypt): Bail out after an decryption error.

* server.c (reset_notify): Close input and output FDs.
(cmd_encrypt,cmd_decrypt,cmd_verify,cmd_sign.cmd_import)
(cmd_genkey): Close the FDs and release the recipient list even in
the error case.
This commit is contained in:
Werner Koch 2002-02-06 14:52:03 +00:00
parent 0c4c0f2ecc
commit 6aa7267865
3 changed files with 45 additions and 45 deletions

View File

@ -1,3 +1,12 @@
2002-02-06 Werner Koch <wk@gnupg.org>
* decrypt.c (gpgsm_decrypt): Bail out after an decryption error.
* server.c (reset_notify): Close input and output FDs.
(cmd_encrypt,cmd_decrypt,cmd_verify,cmd_sign.cmd_import)
(cmd_genkey): Close the FDs and release the recipient list even in
the error case.
2002-02-01 Marcus Brinkmann <marcus@g10code.de>
* sign.c (gpgsm_sign): Do not release certificate twice.

View File

@ -385,8 +385,13 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
&dfparm);
xfree (enc_val);
if (rc)
log_error ("decrypting session key failed: %s\n",
gnupg_strerror (rc));
{
/* fixme: as soon as we support multiple recipients, we
should just set a flag and try the next recipient */
log_error ("decrypting session key failed: %s\n",
gnupg_strerror (rc));
goto leave;
}
else
{ /* setup the bulk decrypter */
ksba_writer_set_filter (writer,

View File

@ -83,6 +83,8 @@ reset_notify (ASSUAN_CONTEXT ctx)
gpgsm_release_certlist (ctrl->server_local->recplist);
ctrl->server_local->recplist = NULL;
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
@ -178,15 +180,12 @@ cmd_encrypt (ASSUAN_CONTEXT ctx, char *line)
inp_fd, out_fp);
fclose (out_fp);
if (!rc)
{
gpgsm_release_certlist (ctrl->server_local->recplist);
ctrl->server_local->recplist = NULL;
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
gpgsm_release_certlist (ctrl->server_local->recplist);
ctrl->server_local->recplist = NULL;
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return map_to_assuan_status (rc);
}
@ -218,13 +217,10 @@ cmd_decrypt (ASSUAN_CONTEXT ctx, char *line)
rc = gpgsm_decrypt (ctrl, inp_fd, out_fp);
fclose (out_fp);
if (!rc)
{
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return map_to_assuan_status (rc);
}
@ -263,13 +259,10 @@ cmd_verify (ASSUAN_CONTEXT ctx, char *line)
if (out_fp)
fclose (out_fp);
if (!rc)
{
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return map_to_assuan_status (rc);
}
@ -304,13 +297,10 @@ cmd_sign (ASSUAN_CONTEXT ctx, char *line)
rc = gpgsm_sign (assuan_get_pointer (ctx), inp_fd, detached, out_fp);
fclose (out_fp);
if (!rc)
{
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return map_to_assuan_status (rc);
}
@ -334,13 +324,11 @@ cmd_import (ASSUAN_CONTEXT ctx, char *line)
rc = gpgsm_import (assuan_get_pointer (ctx), fd);
if (!rc)
{
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
/* close and reset the fd */
close_message_fd (ctrl);
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return map_to_assuan_status (rc);
}
@ -423,12 +411,10 @@ cmd_genkey (ASSUAN_CONTEXT ctx, char *line)
rc = gpgsm_genkey (ctrl, inp_fd, out_fp);
fclose (out_fp);
if (!rc)
{
/* close and reset the fds */
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
}
/* close and reset the fds */
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
return map_to_assuan_status (rc);
}