mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-24 16:43:28 +02:00
* getkey.c: Set MAX_PK_CACHE_ENTRIES and MAX_UID_CACHE_ENTRIES to
PK_UID_CACHE_SIZE (set in ./configure). * getkey.c (get_pubkey): When reading key data into the cache, properly handle keys that are partially (pk, no UIDs) cached already. This is Debian bug #176425 and #229549. * compress.c (init_compress, 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
45bbdcc57c
commit
654ba16db5
@ -1,3 +1,18 @@
|
|||||||
|
2004-01-27 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* getkey.c: Set MAX_PK_CACHE_ENTRIES and MAX_UID_CACHE_ENTRIES to
|
||||||
|
PK_UID_CACHE_SIZE (set in ./configure).
|
||||||
|
|
||||||
|
* getkey.c (get_pubkey): When reading key data into the cache,
|
||||||
|
properly handle keys that are partially (pk, no UIDs) cached
|
||||||
|
already. This is Debian bug #176425 and #229549.
|
||||||
|
|
||||||
|
* compress.c (init_compress, 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-23 David Shaw <dshaw@jabberwocky.com>
|
2004-01-23 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* mainproc.c (list_node): Show sigs with --verbose.
|
* mainproc.c (list_node): Show sigs with --verbose.
|
||||||
|
@ -60,7 +60,7 @@ init_compress( compress_filter_context_t *zfx, z_stream *zs )
|
|||||||
zlib_initialized = riscos_load_module("ZLib", zlib_path, 1);
|
zlib_initialized = riscos_load_module("ZLib", zlib_path, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( opt.compress_level >= 0 && opt.compress_level <= 9 )
|
if( opt.compress_level >= 1 && opt.compress_level <= 9 )
|
||||||
level = opt.compress_level;
|
level = opt.compress_level;
|
||||||
else if( opt.compress_level == -1 )
|
else if( opt.compress_level == -1 )
|
||||||
level = Z_DEFAULT_COMPRESSION;
|
level = Z_DEFAULT_COMPRESSION;
|
||||||
@ -337,7 +337,7 @@ void
|
|||||||
push_compress_filter2(IOBUF out,compress_filter_context_t *zfx,
|
push_compress_filter2(IOBUF out,compress_filter_context_t *zfx,
|
||||||
int algo,int rel)
|
int algo,int rel)
|
||||||
{
|
{
|
||||||
if(algo>0)
|
if(algo>=0)
|
||||||
zfx->algo=algo;
|
zfx->algo=algo;
|
||||||
else
|
else
|
||||||
zfx->algo=DEFAULT_COMPRESS_ALGO;
|
zfx->algo=DEFAULT_COMPRESS_ALGO;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* decrypt.c - verify signed data
|
/* decrypt.c - verify signed data
|
||||||
* Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||||
|
* 2004 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -83,13 +84,14 @@ decrypt_message( const char *filename )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
decrypt_messages(int nfiles, char **files)
|
decrypt_messages(int nfiles, char *files[])
|
||||||
{
|
{
|
||||||
IOBUF fp;
|
IOBUF fp;
|
||||||
armor_filter_context_t afx;
|
armor_filter_context_t afx;
|
||||||
progress_filter_context_t pfx;
|
progress_filter_context_t pfx;
|
||||||
char *p, *output = NULL;
|
char *p, *output = NULL;
|
||||||
int rc = 0;
|
int rc=0,use_stdin=0;
|
||||||
|
unsigned int lno=0;
|
||||||
|
|
||||||
if (opt.outfile)
|
if (opt.outfile)
|
||||||
{
|
{
|
||||||
@ -98,20 +100,53 @@ decrypt_messages(int nfiles, char **files)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (nfiles--)
|
if(!nfiles)
|
||||||
|
use_stdin=1;
|
||||||
|
|
||||||
|
for(;;)
|
||||||
{
|
{
|
||||||
print_file_status(STATUS_FILE_START, *files, 3);
|
char line[2048];
|
||||||
output = make_outfile_name(*files);
|
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)
|
if (!output)
|
||||||
goto next_file;
|
goto next_file;
|
||||||
fp = iobuf_open(*files);
|
fp = iobuf_open(filename);
|
||||||
if (!fp)
|
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;
|
goto next_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle_progress (&pfx, fp, *files);
|
handle_progress (&pfx, fp, filename);
|
||||||
|
|
||||||
if (!opt.no_armor)
|
if (!opt.no_armor)
|
||||||
{
|
{
|
||||||
@ -124,7 +159,7 @@ decrypt_messages(int nfiles, char **files)
|
|||||||
rc = proc_packets(NULL, fp);
|
rc = proc_packets(NULL, fp);
|
||||||
iobuf_close(fp);
|
iobuf_close(fp);
|
||||||
if (rc)
|
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));
|
g10_errstr(rc));
|
||||||
p = get_last_passphrase();
|
p = get_last_passphrase();
|
||||||
set_next_passphrase(p);
|
set_next_passphrase(p);
|
||||||
@ -134,8 +169,7 @@ decrypt_messages(int nfiles, char **files)
|
|||||||
/* Note that we emit file_done even after an error. */
|
/* Note that we emit file_done even after an error. */
|
||||||
write_status( STATUS_FILE_DONE );
|
write_status( STATUS_FILE_DONE );
|
||||||
m_free(output);
|
m_free(output);
|
||||||
files++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_next_passphrase(NULL);
|
set_next_passphrase(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
g10/getkey.c
26
g10/getkey.c
@ -35,14 +35,13 @@
|
|||||||
#include "trustdb.h"
|
#include "trustdb.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
#define MAX_PK_CACHE_ENTRIES 200
|
#define MAX_PK_CACHE_ENTRIES PK_UID_CACHE_SIZE
|
||||||
#define MAX_UID_CACHE_ENTRIES 200
|
#define MAX_UID_CACHE_ENTRIES PK_UID_CACHE_SIZE
|
||||||
|
|
||||||
#if MAX_PK_CACHE_ENTRIES < 2
|
#if MAX_PK_CACHE_ENTRIES < 2
|
||||||
#error We need the cache for key creation
|
#error We need the cache for key creation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct getkey_ctx_s {
|
struct getkey_ctx_s {
|
||||||
int exact;
|
int exact;
|
||||||
KBNODE keyblock;
|
KBNODE keyblock;
|
||||||
@ -320,16 +319,21 @@ get_pubkey( PKT_public_key *pk, u32 *keyid )
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
#if MAX_PK_CACHE_ENTRIES
|
#if MAX_PK_CACHE_ENTRIES
|
||||||
{ /* Try to get it from the cache */
|
if(pk)
|
||||||
|
{
|
||||||
|
/* Try to get it from the cache. We don't do this when pk is
|
||||||
|
NULL as it does not guarantee that the user IDs are
|
||||||
|
cached. */
|
||||||
pk_cache_entry_t ce;
|
pk_cache_entry_t ce;
|
||||||
for( ce = pk_cache; ce; ce = ce->next ) {
|
for( ce = pk_cache; ce; ce = ce->next )
|
||||||
if( ce->keyid[0] == keyid[0] && ce->keyid[1] == keyid[1] ) {
|
{
|
||||||
if( pk )
|
if( ce->keyid[0] == keyid[0] && ce->keyid[1] == keyid[1] )
|
||||||
copy_public_key( pk, ce->pk );
|
{
|
||||||
|
copy_public_key( pk, ce->pk );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* more init stuff */
|
/* more init stuff */
|
||||||
if( !pk ) {
|
if( !pk ) {
|
||||||
|
@ -232,7 +232,7 @@ int verify_files( int nfiles, char **files );
|
|||||||
|
|
||||||
/*-- decrypt.c --*/
|
/*-- decrypt.c --*/
|
||||||
int decrypt_message( const char *filename );
|
int decrypt_message( const char *filename );
|
||||||
void decrypt_messages(int nfiles, char **files);
|
void decrypt_messages(int nfiles, char *files[]);
|
||||||
|
|
||||||
/*-- plaintext.c --*/
|
/*-- plaintext.c --*/
|
||||||
int hash_datafiles( MD_HANDLE md, MD_HANDLE md2,
|
int hash_datafiles( MD_HANDLE md, MD_HANDLE md2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user