mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
* compress.c (init_compress): Remove "-z10" trick to get uncompressed data
inside a compressed data packet. This is possibly dangerous without an MDC. (push_compress_filter2): Do the right thing (i.e. nothing) with compress algo 0. * main.h, decrypt.c (decrypt_messages): Accept filenames to decrypt on stdin. This is bug #253.
This commit is contained in:
parent
7690350b7a
commit
fc60e6779d
@ -1,3 +1,14 @@
|
||||
2004-01-26 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* compress.c (init_compress): Remove "-z10" trick to get
|
||||
uncompressed data inside a compressed data packet. This is
|
||||
possibly dangerous without an MDC.
|
||||
(push_compress_filter2): Do the right thing (i.e. nothing) with
|
||||
compress algo 0.
|
||||
|
||||
* main.h, decrypt.c (decrypt_messages): Accept filenames to
|
||||
decrypt on stdin. This is bug #253.
|
||||
|
||||
2004-01-21 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* getkey.c (merge_selfsigs): If a subkey is already revoked by the
|
||||
|
@ -50,12 +50,10 @@ init_compress( compress_filter_context_t *zfx, z_stream *zs )
|
||||
int rc;
|
||||
int level;
|
||||
|
||||
if( opt.compress >= 0 && opt.compress <= 9 )
|
||||
if( opt.compress >= 1 && opt.compress <= 9 )
|
||||
level = opt.compress;
|
||||
else if( opt.compress == -1 )
|
||||
level = Z_DEFAULT_COMPRESSION;
|
||||
else if( opt.compress == 10 ) /* remove this ! */
|
||||
level = 0;
|
||||
else {
|
||||
log_error("invalid compression level; using default level\n");
|
||||
level = Z_DEFAULT_COMPRESSION;
|
||||
@ -330,7 +328,7 @@ void
|
||||
push_compress_filter2(IOBUF out,compress_filter_context_t *zfx,
|
||||
int algo,int rel)
|
||||
{
|
||||
if(algo>0)
|
||||
if(algo>=0)
|
||||
zfx->algo=algo;
|
||||
else
|
||||
zfx->algo=DEFAULT_COMPRESS_ALGO;
|
||||
|
@ -83,13 +83,14 @@ decrypt_message( const char *filename )
|
||||
}
|
||||
|
||||
void
|
||||
decrypt_messages(int nfiles, char **files)
|
||||
decrypt_messages(int nfiles, char *files[])
|
||||
{
|
||||
IOBUF fp;
|
||||
armor_filter_context_t afx;
|
||||
progress_filter_context_t pfx;
|
||||
char *p, *output = NULL;
|
||||
int rc = 0;
|
||||
int rc=0,use_stdin=0;
|
||||
unsigned int lno=0;
|
||||
|
||||
if (opt.outfile)
|
||||
{
|
||||
@ -98,20 +99,53 @@ decrypt_messages(int nfiles, char **files)
|
||||
|
||||
}
|
||||
|
||||
while (nfiles--)
|
||||
if(!nfiles)
|
||||
use_stdin=1;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
print_file_status(STATUS_FILE_START, *files, 3);
|
||||
output = make_outfile_name(*files);
|
||||
char line[2048];
|
||||
char *filename=NULL;
|
||||
|
||||
if(use_stdin)
|
||||
{
|
||||
if(fgets(line, DIM(line), stdin))
|
||||
{
|
||||
lno++;
|
||||
if (!*line || line[strlen(line)-1] != '\n')
|
||||
log_error("input line %u too long or missing LF\n", lno);
|
||||
else
|
||||
{
|
||||
line[strlen(line)-1] = '\0';
|
||||
filename=line;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nfiles)
|
||||
{
|
||||
filename=*files;
|
||||
nfiles--;
|
||||
files++;
|
||||
}
|
||||
}
|
||||
|
||||
if(filename==NULL)
|
||||
break;
|
||||
|
||||
print_file_status(STATUS_FILE_START, filename, 3);
|
||||
output = make_outfile_name(filename);
|
||||
if (!output)
|
||||
goto next_file;
|
||||
fp = iobuf_open(*files);
|
||||
fp = iobuf_open(filename);
|
||||
if (!fp)
|
||||
{
|
||||
log_error(_("can't open `%s'\n"), print_fname_stdin(*files));
|
||||
log_error(_("can't open `%s'\n"), print_fname_stdin(filename));
|
||||
goto next_file;
|
||||
}
|
||||
|
||||
handle_progress (&pfx, fp, *files);
|
||||
handle_progress (&pfx, fp, filename);
|
||||
|
||||
if (!opt.no_armor)
|
||||
{
|
||||
@ -124,7 +158,7 @@ decrypt_messages(int nfiles, char **files)
|
||||
rc = proc_packets(NULL, fp);
|
||||
iobuf_close(fp);
|
||||
if (rc)
|
||||
log_error("%s: decryption failed: %s\n", print_fname_stdin(*files),
|
||||
log_error("%s: decryption failed: %s\n", print_fname_stdin(filename),
|
||||
g10_errstr(rc));
|
||||
p = get_last_passphrase();
|
||||
set_next_passphrase(p);
|
||||
@ -134,7 +168,7 @@ decrypt_messages(int nfiles, char **files)
|
||||
/* Note that we emit file_done even after an error. */
|
||||
write_status( STATUS_FILE_DONE );
|
||||
m_free(output);
|
||||
files++;
|
||||
}
|
||||
|
||||
set_next_passphrase(NULL);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ int verify_files( int nfiles, char **files );
|
||||
|
||||
/*-- decrypt.c --*/
|
||||
int decrypt_message( const char *filename );
|
||||
void decrypt_messages(int nfiles, char **files);
|
||||
void decrypt_messages(int nfiles, char *files[]);
|
||||
|
||||
/*-- plaintext.c --*/
|
||||
int hash_datafiles( MD_HANDLE md, MD_HANDLE md2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user