mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
gpg: Make --no-literal work again for -c and --store.
* g10/dearmor.c (dearmor_file): Check for errors of iobuf_copy.
(enarmor_file): Ditto.
* g10/encrypt.c (encrypt_simple): Fix error check of iobuf_copy
(encrypt_crypt): Use iobuf_copy.
--
Fixes-commit: 756c0bd5d8
GnuPG-bug-id: 5852
This commit is contained in:
parent
1eaf1e236e
commit
9a741aba3d
@ -67,6 +67,12 @@ dearmor_file( const char *fname )
|
|||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
iobuf_copy (out, inp);
|
iobuf_copy (out, inp);
|
||||||
|
if ((rc = iobuf_error (inp)))
|
||||||
|
log_error (_("error reading '%s': %s\n"),
|
||||||
|
iobuf_get_fname_nonnull (inp), gpg_strerror (rc));
|
||||||
|
else if ((rc = iobuf_error (out)))
|
||||||
|
log_error (_("error writing '%s': %s\n"),
|
||||||
|
iobuf_get_fname_nonnull (out), gpg_strerror (rc));
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if( rc )
|
if( rc )
|
||||||
@ -115,6 +121,12 @@ enarmor_file( const char *fname )
|
|||||||
push_armor_filter ( afx, out );
|
push_armor_filter ( afx, out );
|
||||||
|
|
||||||
iobuf_copy (out, inp);
|
iobuf_copy (out, inp);
|
||||||
|
if ((rc = iobuf_error (inp)))
|
||||||
|
log_error (_("error reading '%s': %s\n"),
|
||||||
|
iobuf_get_fname_nonnull (inp), gpg_strerror (rc));
|
||||||
|
else if ((rc = iobuf_error (out)))
|
||||||
|
log_error (_("error writing '%s': %s\n"),
|
||||||
|
iobuf_get_fname_nonnull (out), gpg_strerror (rc));
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
if( rc )
|
if( rc )
|
||||||
|
@ -633,9 +633,13 @@ encrypt_simple (const char *filename, int mode, int use_seskey)
|
|||||||
{
|
{
|
||||||
/* User requested not to create a literal packet, so we copy the
|
/* User requested not to create a literal packet, so we copy the
|
||||||
plain data. */
|
plain data. */
|
||||||
rc = iobuf_copy (out, inp);
|
iobuf_copy (out, inp);
|
||||||
if (rc)
|
if ((rc = iobuf_error (inp)))
|
||||||
log_error ("copying input to output failed: %s\n", gpg_strerror (rc));
|
log_error (_("error reading '%s': %s\n"),
|
||||||
|
iobuf_get_fname_nonnull (inp), gpg_strerror (rc));
|
||||||
|
else if ((rc = iobuf_error (out)))
|
||||||
|
log_error (_("error writing '%s': %s\n"),
|
||||||
|
iobuf_get_fname_nonnull (out), gpg_strerror (rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish the stuff. */
|
/* Finish the stuff. */
|
||||||
@ -760,8 +764,8 @@ write_symkey_enc (STRING2KEY *symkey_s2k, aead_algo_t aead_algo,
|
|||||||
* The caller may provide a checked list of public keys in
|
* The caller may provide a checked list of public keys in
|
||||||
* PROVIDED_KEYS; if not the function builds a list of keys on its own.
|
* PROVIDED_KEYS; if not the function builds a list of keys on its own.
|
||||||
*
|
*
|
||||||
* Note that FILEFD is currently only used by cmd_encrypt in the
|
* Note that FILEFD and OUTPUTFD are currently only used by
|
||||||
* not yet finished server.c.
|
* cmd_encrypt in the not yet finished server.c.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
encrypt_crypt (ctrl_t ctrl, gnupg_fd_t filefd, const char *filename,
|
encrypt_crypt (ctrl_t ctrl, gnupg_fd_t filefd, const char *filename,
|
||||||
@ -996,19 +1000,14 @@ encrypt_crypt (ctrl_t ctrl, gnupg_fd_t filefd, const char *filename,
|
|||||||
{
|
{
|
||||||
/* User requested not to create a literal packet, so we copy the
|
/* User requested not to create a literal packet, so we copy the
|
||||||
plain data. */
|
plain data. */
|
||||||
byte copy_buffer[4096];
|
iobuf_copy (out, inp);
|
||||||
int bytes_copied;
|
if ((rc = iobuf_error (inp)))
|
||||||
while ((bytes_copied = iobuf_read (inp, copy_buffer, 4096)) != -1)
|
log_error (_("error reading '%s': %s\n"),
|
||||||
{
|
iobuf_get_fname_nonnull (inp), gpg_strerror (rc));
|
||||||
rc = iobuf_write (out, copy_buffer, bytes_copied);
|
else if ((rc = iobuf_error (out)))
|
||||||
if (rc)
|
log_error (_("error writing '%s': %s\n"),
|
||||||
{
|
iobuf_get_fname_nonnull (out), gpg_strerror (rc));
|
||||||
log_error ("copying input to output failed: %s\n",
|
|
||||||
gpg_strerror (rc));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wipememory (copy_buffer, 4096); /* Burn the buffer. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish the stuff. */
|
/* Finish the stuff. */
|
||||||
|
Loading…
Reference in New Issue
Block a user