1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-03 12:11:33 +01:00

See ChangeLog: Tue Feb 16 14:10:02 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-02-16 13:16:33 +00:00
parent 6e5bc13878
commit e1a1b3fc90
53 changed files with 359 additions and 279 deletions

View File

@ -20,6 +20,7 @@ GNUPG Michael Roth Germany 1998-09-17
Assigns changes. Assigns changes.
mroth@nessie.de mroth@nessie.de
Wrote cipher/des.c. Wrote cipher/des.c.
Changes and bug fixes all over the place.
GNUPG Niklas Hernaeus 1998-09-18 GNUPG Niklas Hernaeus 1998-09-18

View File

@ -1,3 +1,9 @@
Tue Feb 16 14:10:02 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* configure.in (socket): Check for -lsocket and -lnsl.
(osf4): Disable all warnings for DEC's cc.
(-Wall): Add more warning options for gcc
Sat Feb 13 12:04:43 CET 1999 Werner Koch <wk@isil.d.shuttle.de> Sat Feb 13 12:04:43 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* configure.in: Changed detection of compiler flags. * configure.in: Changed detection of compiler flags.

11
NEWS
View File

@ -2,6 +2,17 @@
* changed the internal design of getkey which now allows a * changed the internal design of getkey which now allows a
efficient lookup of multiple keys and add a word match mode. efficient lookup of multiple keys and add a word match mode.
* New option --encrypt-to
* Some changes to the configure stuff. Switched to automake 1.4.
Removed intl/ from CVS, autgen.sh now uses gettextize.
* Preferences now include twofish and removed preference to Blowfish with
a special hack to suppress the "not listed in preferences" warning.
This is to allow us to switch completely to Twofish in the near future.
* Changed the locking stuff.
Noteworthy changes in version 0.9.2 Noteworthy changes in version 0.9.2
----------------------------------- -----------------------------------

20
TODO
View File

@ -11,12 +11,8 @@ Bugs
* README does not verify okay. verify inserts an extra CR,LF * README does not verify okay. verify inserts an extra CR,LF
just before "Esoteric Command" (after ~8k of text). just before "Esoteric Command" (after ~8k of text).
* Did I add -lsocket and -lnls for Solaris?
Important Important
---------- ----------
* replace gettext by a non exploitable one.
* Check revocation and expire stuff. PLEASE: THIS MUST BE TESTED! * Check revocation and expire stuff. PLEASE: THIS MUST BE TESTED!
* Check calculation of key validity. PLEASE: IT IS IMPORTED THAT * Check calculation of key validity. PLEASE: IT IS IMPORTED THAT
@ -28,21 +24,9 @@ Important
Needed Needed
------ ------
* encrypttoself, damit keine Angabe von -r immer noch zu einer
abfrage führt.
* remove more "Fixmes" * remove more "Fixmes"
* Replace Blowfish by Twofish and add the new encrypted packet type * Implement 256 bit key Twofish.
which has a MACing option (append SHA1 hash to the plaintext and
encrypt this all) - We need an identifier for Twofish to put this
one into the cipher preferences.
* The -export-dynamic flag to ld works only for FreeBSD 3.0. It does
not exist on FreeBSD's 2.2.x version of ld.
Also, on my FreeBSD 2.2-stable box, i simply removed the
-Wl,-export-dynamic flag from my Makefile and it linked and seems to
be working OK so far.
* Use capabilities if available. * Use capabilities if available.
@ -55,6 +39,8 @@ Minor Bugs
implementaion to a create handle, make and release implemenation implementaion to a create handle, make and release implemenation
and use an atexit to cleanup all pending locks. This is also and use an atexit to cleanup all pending locks. This is also
faster. faster.
* --list-packets should continue even w/o a passphrase (or in batch
mode).
Nice to have Nice to have
------------ ------------

View File

@ -81,5 +81,6 @@ no-greeting
no-secmem-warning no-secmem-warning
load-extension ../cipher/tiger load-extension ../cipher/tiger
batch batch
lock-once
EOF EOF

View File

@ -455,7 +455,7 @@ decrypt_block( BLOWFISH_context *bc, byte *outbuf, byte *inbuf )
static const char* static const char*
selftest() selftest(void)
{ {
BLOWFISH_context c; BLOWFISH_context c;
byte plain[] = "BLOWFISH"; byte plain[] = "BLOWFISH";

View File

@ -26,9 +26,9 @@
const char * const char *
blowfish_get_info( int algo, size_t *keylen, blowfish_get_info( int algo, size_t *keylen,
size_t *blocksize, size_t *contextsize, size_t *blocksize, size_t *contextsize,
int (**setkey)( void *c, byte *key, unsigned keylen ), int (**setkeyf)( void *c, byte *key, unsigned keylen ),
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), void (**encryptf)( void *c, byte *outbuf, byte *inbuf ),
void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) void (**decryptf)( void *c, byte *outbuf, byte *inbuf )
); );
#endif /*G10_BLOWFISH_H*/ #endif /*G10_BLOWFISH_H*/

View File

@ -455,7 +455,7 @@ decrypt_block( CAST5_context *c, byte *outbuf, byte *inbuf )
static const char* static const char*
selftest() selftest(void)
{ {
CAST5_context c; CAST5_context c;
byte key[16] = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, byte key[16] = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,

View File

@ -25,9 +25,9 @@
const char * const char *
cast5_get_info( int algo, size_t *keylen, cast5_get_info( int algo, size_t *keylen,
size_t *blocksize, size_t *contextsize, size_t *blocksize, size_t *contextsize,
int (**setkey)( void *c, byte *key, unsigned keylen ), int (**setkeyf)( void *c, byte *key, unsigned keylen ),
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), void (**encryptf)( void *c, byte *outbuf, byte *inbuf ),
void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) void (**decryptf)( void *c, byte *outbuf, byte *inbuf )
); );
#endif /*G10_CAST5_H*/ #endif /*G10_CAST5_H*/

View File

@ -77,7 +77,7 @@ dummy_decrypt_block( void *c, byte *outbuf, byte *inbuf ) { BUG(); }
* Put the static entries into the table. * Put the static entries into the table.
*/ */
static void static void
setup_cipher_table() setup_cipher_table(void)
{ {
int i; int i;
@ -146,7 +146,7 @@ setup_cipher_table()
* Try to load all modules and return true if new modules are available * Try to load all modules and return true if new modules are available
*/ */
static int static int
load_cipher_modules() load_cipher_modules(void)
{ {
static int done = 0; static int done = 0;
static int initialized = 0; static int initialized = 0;

View File

@ -26,9 +26,9 @@
const char * const char *
des_get_info( int algo, size_t *keylen, des_get_info( int algo, size_t *keylen,
size_t *blocksize, size_t *contextsize, size_t *blocksize, size_t *contextsize,
int (**setkey)( void *c, byte *key, unsigned keylen ), int (**setkeyf)( void *c, byte *key, unsigned keylen ),
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), void (**encryptf)( void *c, byte *outbuf, byte *inbuf ),
void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) void (**decryptf)( void *c, byte *outbuf, byte *inbuf )
); );
#endif /*G10_DES_H*/ #endif /*G10_DES_H*/

View File

@ -412,7 +412,7 @@ dsa_get_nbits( int algo, MPI *pkey )
*/ */
const char * const char *
dsa_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig, dsa_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig,
int *usage ) int *use )
{ {
*npkey = 4; *npkey = 4;
*nskey = 5; *nskey = 5;
@ -420,8 +420,8 @@ dsa_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig,
*nsig = 2; *nsig = 2;
switch( algo ) { switch( algo ) {
case PUBKEY_ALGO_DSA: *usage = PUBKEY_USAGE_SIG; return "DSA"; case PUBKEY_ALGO_DSA: *use = PUBKEY_USAGE_SIG; return "DSA";
default: *usage = 0; return NULL; default: *use = 0; return NULL;
} }
} }

View File

@ -27,6 +27,6 @@ int dsa_verify( int algo, MPI hash, MPI *data, MPI *pkey,
int (*cmp)(void *, MPI), void *opaquev ); int (*cmp)(void *, MPI), void *opaquev );
unsigned dsa_get_nbits( int algo, MPI *pkey ); unsigned dsa_get_nbits( int algo, MPI *pkey );
const char *dsa_get_info( int algo, int *npkey, int *nskey, const char *dsa_get_info( int algo, int *npkey, int *nskey,
int *nenc, int *nsig, int *usage ); int *nenc, int *nsig, int *use );
#endif /*G10_DSA_H*/ #endif /*G10_DSA_H*/

View File

@ -101,15 +101,15 @@ register_cipher_extension( const char *mainpgm, const char *fname )
mainpgm_path = m_strdup(mainpgm); mainpgm_path = m_strdup(mainpgm);
#endif #endif
if( *fname != '/' ) { /* do tilde expansion etc */ if( *fname != '/' ) { /* do tilde expansion etc */
char *p ; char *tmp;
if( strchr(fname, '/') ) if( strchr(fname, '/') )
p = make_filename(fname, NULL); tmp = make_filename(fname, NULL);
else else
p = make_filename(GNUPG_LIBDIR, fname, NULL); tmp = make_filename(GNUPG_LIBDIR, fname, NULL);
el = m_alloc_clear( sizeof *el + strlen(p) ); el = m_alloc_clear( sizeof *el + strlen(tmp) );
strcpy(el->name, p ); strcpy(el->name, tmp );
m_free(p); m_free(tmp);
} }
else { else {
el = m_alloc_clear( sizeof *el + strlen(fname) ); el = m_alloc_clear( sizeof *el + strlen(fname) );
@ -371,9 +371,9 @@ enum_gnupgext_digests( void **enum_context,
const char * const char *
enum_gnupgext_ciphers( void **enum_context, int *algo, enum_gnupgext_ciphers( void **enum_context, int *algo,
size_t *keylen, size_t *blocksize, size_t *contextsize, size_t *keylen, size_t *blocksize, size_t *contextsize,
int (**setkey)( void *c, byte *key, unsigned keylen ), int (**setkeyf)( void *c, byte *key, unsigned keylen ),
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), void (**encryptf)( void *c, byte *outbuf, byte *inbuf ),
void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) void (**decryptf)( void *c, byte *outbuf, byte *inbuf )
) )
{ {
EXTLIST r; EXTLIST r;
@ -419,7 +419,7 @@ enum_gnupgext_ciphers( void **enum_context, int *algo,
continue; continue;
*algo = *(int*)sym; *algo = *(int*)sym;
algname = (*finfo)( *algo, keylen, blocksize, contextsize, algname = (*finfo)( *algo, keylen, blocksize, contextsize,
setkey, encrypt, decrypt ); setkeyf, encryptf, decryptf );
if( algname ) { if( algname ) {
ctx->r = r; ctx->r = r;
return algname; return algname;
@ -435,11 +435,11 @@ enum_gnupgext_ciphers( void **enum_context, int *algo,
const char * const char *
enum_gnupgext_pubkeys( void **enum_context, int *algo, enum_gnupgext_pubkeys( void **enum_context, int *algo,
int *npkey, int *nskey, int *nenc, int *nsig, int *usage, int *npkey, int *nskey, int *nenc, int *nsig, int *use,
int (**generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ), int (**generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ),
int (**check_secret_key)( int algo, MPI *skey ), int (**check_secret_key)( int algo, MPI *skey ),
int (**encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ), int (**encryptf)( int algo, MPI *resarr, MPI data, MPI *pkey ),
int (**decrypt)( int algo, MPI *result, MPI *data, MPI *skey ), int (**decryptf)( int algo, MPI *result, MPI *data, MPI *skey ),
int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ), int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ),
int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey, int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey,
int (*cmp)(void *, MPI), void *opaquev ), int (*cmp)(void *, MPI), void *opaquev ),
@ -491,9 +491,9 @@ enum_gnupgext_pubkeys( void **enum_context, int *algo,
if( vers != 1 || class != 31 ) if( vers != 1 || class != 31 )
continue; continue;
*algo = *(int*)sym; *algo = *(int*)sym;
algname = (*finfo)( *algo, npkey, nskey, nenc, nsig, usage, algname = (*finfo)( *algo, npkey, nskey, nenc, nsig, use,
generate, check_secret_key, encrypt, generate, check_secret_key, encryptf,
decrypt, sign, verify, get_nbits ); decryptf, sign, verify, get_nbits );
if( algname ) { if( algname ) {
ctx->r = r; ctx->r = r;
return algname; return algname;

View File

@ -37,19 +37,19 @@ enum_gnupgext_digests( void **enum_context,
const char * const char *
enum_gnupgext_ciphers( void **enum_context, int *algo, enum_gnupgext_ciphers( void **enum_context, int *algo,
size_t *keylen, size_t *blocksize, size_t *contextsize, size_t *keylen, size_t *blocksize, size_t *contextsize,
int (**setkey)( void *c, byte *key, unsigned keylen ), int (**setkeyf)( void *c, byte *key, unsigned keylen ),
void (**encrypt)( void *c, byte *outbuf, byte *inbuf ), void (**encryptf)( void *c, byte *outbuf, byte *inbuf ),
void (**decrypt)( void *c, byte *outbuf, byte *inbuf ) void (**decryptf)( void *c, byte *outbuf, byte *inbuf )
); );
const char * const char *
enum_gnupgext_pubkeys( void **enum_context, int *algo, enum_gnupgext_pubkeys( void **enum_context, int *algo,
int *npkey, int *nskey, int *nenc, int *nsig, int *usage, int *npkey, int *nskey, int *nenc, int *nsig, int *use,
int (**generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ), int (**generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ),
int (**check_secret_key)( int algo, MPI *skey ), int (**check_secret_key)( int algo, MPI *skey ),
int (**encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ), int (**encryptf)( int algo, MPI *resarr, MPI data, MPI *pkey ),
int (**decrypt)( int algo, MPI *result, MPI *data, MPI *skey ), int (**decryptf)( int algo, MPI *result, MPI *data, MPI *skey ),
int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ), int (**sign)( int algo, MPI *resarr, MPI data, MPI *skey ),
int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey, int (**verify)( int algo, MPI hash, MPI *data, MPI *pkey,
int (*cmp)(void *, MPI), void *opaquev ), int (*cmp)(void *, MPI), void *opaquev ),

View File

@ -109,9 +109,9 @@ gen_k( MPI p )
for(;;) { for(;;) {
if( DBG_CIPHER ) if( DBG_CIPHER )
fputc('.', stderr); fputc('.', stderr);
{ char *p = get_random_bits( nbits, 1, 1 ); { char *pp = get_random_bits( nbits, 1, 1 );
mpi_set_buffer( k, p, (nbits+7)/8, 0 ); mpi_set_buffer( k, pp, (nbits+7)/8, 0 );
m_free(p); m_free(pp);
/* make sure that the number is of the exact lenght */ /* make sure that the number is of the exact lenght */
if( mpi_test_bit( k, nbits-1 ) ) if( mpi_test_bit( k, nbits-1 ) )
mpi_set_highbit( k, nbits-1 ); mpi_set_highbit( k, nbits-1 );
@ -530,7 +530,7 @@ elg_get_nbits( int algo, MPI *pkey )
*/ */
const char * const char *
elg_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig, elg_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig,
int *usage ) int *use )
{ {
*npkey = 3; *npkey = 3;
*nskey = 4; *nskey = 4;
@ -539,12 +539,12 @@ elg_get_info( int algo, int *npkey, int *nskey, int *nenc, int *nsig,
switch( algo ) { switch( algo ) {
case PUBKEY_ALGO_ELGAMAL: case PUBKEY_ALGO_ELGAMAL:
*usage = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC; *use = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC;
return "ELG"; return "ELG";
case PUBKEY_ALGO_ELGAMAL_E: case PUBKEY_ALGO_ELGAMAL_E:
*usage = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC; *use = PUBKEY_USAGE_SIG|PUBKEY_USAGE_ENC;
return "ELG-E"; return "ELG-E";
default: *usage = 0; return NULL; default: *use = 0; return NULL;
} }
} }

View File

@ -29,7 +29,7 @@ int elg_verify( int algo, MPI hash, MPI *data, MPI *pkey,
int (*cmp)(void *, MPI), void *opaquev ); int (*cmp)(void *, MPI), void *opaquev );
unsigned elg_get_nbits( int algo, MPI *pkey ); unsigned elg_get_nbits( int algo, MPI *pkey );
const char *elg_get_info( int algo, int *npkey, int *nskey, const char *elg_get_info( int algo, int *npkey, int *nskey,
int *nenc, int *nsig, int *usage ); int *nenc, int *nsig, int *use );
#endif /*G10_ELGAMAL_H*/ #endif /*G10_ELGAMAL_H*/

View File

@ -479,15 +479,15 @@ md_asn_oid( int algo, size_t *asnlen, size_t *mdlen )
void void
md_start_debug( MD_HANDLE md, const char *suffix ) md_start_debug( MD_HANDLE md, const char *suffix )
{ {
static int index=0; static int idx=0;
char buf[25]; char buf[25];
if( md->debug ) { if( md->debug ) {
log_debug("Oops: md debug already started\n"); log_debug("Oops: md debug already started\n");
return; return;
} }
index++; idx++;
sprintf(buf, "dbgmd-%05d.%.10s", index, suffix ); sprintf(buf, "dbgmd-%05d.%.10s", idx, suffix );
md->debug = fopen(buf, "w"); md->debug = fopen(buf, "w");
if( !md->debug ) if( !md->debug )
log_debug("md debug: can't open %s\n", buf ); log_debug("md debug: can't open %s\n", buf );

View File

@ -42,7 +42,7 @@ struct pubkey_table_s {
int nskey; int nskey;
int nenc; int nenc;
int nsig; int nsig;
int usage; int use;
int (*generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors ); int (*generate)( int algo, unsigned nbits, MPI *skey, MPI **retfactors );
int (*check_secret_key)( int algo, MPI *skey ); int (*check_secret_key)( int algo, MPI *skey );
int (*encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey ); int (*encrypt)( int algo, MPI *resarr, MPI data, MPI *pkey );
@ -91,7 +91,7 @@ dummy_get_nbits( int algo, MPI *pkey )
* Put the static entries into the table. * Put the static entries into the table.
*/ */
static void static void
setup_pubkey_table() setup_pubkey_table(void)
{ {
int i; int i;
@ -102,7 +102,7 @@ setup_pubkey_table()
&pubkey_table[i].nskey, &pubkey_table[i].nskey,
&pubkey_table[i].nenc, &pubkey_table[i].nenc,
&pubkey_table[i].nsig, &pubkey_table[i].nsig,
&pubkey_table[i].usage ); &pubkey_table[i].use );
pubkey_table[i].generate = elg_generate; pubkey_table[i].generate = elg_generate;
pubkey_table[i].check_secret_key = elg_check_secret_key; pubkey_table[i].check_secret_key = elg_check_secret_key;
pubkey_table[i].encrypt = elg_encrypt; pubkey_table[i].encrypt = elg_encrypt;
@ -119,7 +119,7 @@ setup_pubkey_table()
&pubkey_table[i].nskey, &pubkey_table[i].nskey,
&pubkey_table[i].nenc, &pubkey_table[i].nenc,
&pubkey_table[i].nsig, &pubkey_table[i].nsig,
&pubkey_table[i].usage ); &pubkey_table[i].use );
pubkey_table[i].generate = elg_generate; pubkey_table[i].generate = elg_generate;
pubkey_table[i].check_secret_key = elg_check_secret_key; pubkey_table[i].check_secret_key = elg_check_secret_key;
pubkey_table[i].encrypt = elg_encrypt; pubkey_table[i].encrypt = elg_encrypt;
@ -136,7 +136,7 @@ setup_pubkey_table()
&pubkey_table[i].nskey, &pubkey_table[i].nskey,
&pubkey_table[i].nenc, &pubkey_table[i].nenc,
&pubkey_table[i].nsig, &pubkey_table[i].nsig,
&pubkey_table[i].usage ); &pubkey_table[i].use );
pubkey_table[i].generate = dsa_generate; pubkey_table[i].generate = dsa_generate;
pubkey_table[i].check_secret_key = dsa_check_secret_key; pubkey_table[i].check_secret_key = dsa_check_secret_key;
pubkey_table[i].encrypt = dummy_encrypt; pubkey_table[i].encrypt = dummy_encrypt;
@ -157,7 +157,7 @@ setup_pubkey_table()
* Try to load all modules and return true if new modules are available * Try to load all modules and return true if new modules are available
*/ */
static int static int
load_pubkey_modules() load_pubkey_modules(void)
{ {
static int initialized = 0; static int initialized = 0;
static int done = 0; static int done = 0;
@ -187,7 +187,7 @@ load_pubkey_modules()
/* now load all extensions */ /* now load all extensions */
while( (name = enum_gnupgext_pubkeys( &context, &ct->algo, while( (name = enum_gnupgext_pubkeys( &context, &ct->algo,
&ct->npkey, &ct->nskey, &ct->nenc, &ct->npkey, &ct->nskey, &ct->nenc,
&ct->nsig, &ct->usage, &ct->nsig, &ct->use,
&ct->generate, &ct->generate,
&ct->check_secret_key, &ct->check_secret_key,
&ct->encrypt, &ct->encrypt,
@ -273,21 +273,21 @@ check_pubkey_algo( int algo )
} }
/**************** /****************
* a usage of 0 means: don't care * a use of 0 means: don't care
*/ */
int int
check_pubkey_algo2( int algo, unsigned usage ) check_pubkey_algo2( int algo, unsigned use )
{ {
int i; int i;
do { do {
for(i=0; pubkey_table[i].name; i++ ) for(i=0; pubkey_table[i].name; i++ )
if( pubkey_table[i].algo == algo ) { if( pubkey_table[i].algo == algo ) {
if( (usage & PUBKEY_USAGE_SIG) if( (use & PUBKEY_USAGE_SIG)
&& !(pubkey_table[i].usage & PUBKEY_USAGE_SIG) ) && !(pubkey_table[i].use & PUBKEY_USAGE_SIG) )
return G10ERR_WR_PUBKEY_ALGO; return G10ERR_WR_PUBKEY_ALGO;
if( (usage & PUBKEY_USAGE_ENC) if( (use & PUBKEY_USAGE_ENC)
&& !(pubkey_table[i].usage & PUBKEY_USAGE_ENC) ) && !(pubkey_table[i].use & PUBKEY_USAGE_ENC) )
return G10ERR_WR_PUBKEY_ALGO; return G10ERR_WR_PUBKEY_ALGO;
return 0; /* okay */ return 0; /* okay */
} }

View File

@ -106,7 +106,7 @@ static int gather_faked( void (*add)(const void*, size_t, int), int requester,
static void static void
initialize() initialize(void)
{ {
/* The data buffer is allocated somewhat larger, so that /* The data buffer is allocated somewhat larger, so that
* we can use this extra space (which is allocated in secure memory) * we can use this extra space (which is allocated in secure memory)

View File

@ -401,11 +401,8 @@ slow_poll(FILE *dbgfp, int dbgall, size_t *nbytes )
fd_set fds; fd_set fds;
#if defined( __hpux ) #if defined( __hpux )
size_t maxFD = 0; size_t maxFD = 0;
int pageSize = 4096; /* PHUX doesn't have getpagesize() */
#elif defined( _M_XENIX ) || defined( __aux )
int maxFD = 0, pageSize = 4096;/* Nor do others, but they get fd right */
#else #else
int maxFD = 0, pageSize = getpagesize(); int maxFD = 0;
#endif /* OS-specific brokenness */ #endif /* OS-specific brokenness */
int bufPos, i, usefulness = 0; int bufPos, i, usefulness = 0;

View File

@ -90,9 +90,9 @@ dnl AC_CYGWIN32
MPI_OPT_FLAGS="" MPI_OPT_FLAGS=""
if test "$GCC" = yes; then if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
dnl Always enable optimazation in MPI dnl Always enable optimazation in MPI
if echo "$CFLAGS" | grep "[-]O" >/dev/null ; then if (echo "$CFLAGS" | grep '[-]O') >/dev/null ; then
: :
else else
MPI_OPT_FLAGS=-O2 MPI_OPT_FLAGS=-O2
@ -129,6 +129,13 @@ case "${target}" in
CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE" CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
fi fi
;; ;;
*-dec-osf4*)
if test -z "$GCC" ; then
# Suppress all warnings
# to get rid of the unsigned/signed char mismatch warnings.
CFLAGS="$CFLAGS -w"
fi
;;
m68k-atari-mint) m68k-atari-mint)
;; ;;
*) *)
@ -188,6 +195,10 @@ if test "$try_gdbm" = yes; then
AC_CHECK_LIB(gdbm,gdbm_firstkey) AC_CHECK_LIB(gdbm,gdbm_firstkey)
fi fi
dnl Solaris needs -lsocket and -lnsl
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
if test "$try_dynload" = yes ; then if test "$try_dynload" = yes ; then
AC_CHECK_LIB(dl,dlopen) AC_CHECK_LIB(dl,dlopen)

View File

@ -254,9 +254,16 @@ B<--trusted-key> I<keyid>
your key. your key.
B<-r> I<name>, B<--recipient> I<name> B<-r> I<name>, B<--recipient> I<name>
Use I<name> as the user-id for encryption. Encrypt for user id I<name>. If this option is not
This option is silently ignored for the list commands, specified, GnuPG asks for the user id.
so that it can be used in an options file.
B<--encrypt-to> I<name>
Same as B<--recipient> but this one is intended for
in the options file and may be used together with
an own user-id as an "encrypt-to-self". These keys
are only used when there are other recipients given
either by use of --recipient or by the asked user id.
No trust checking is performed for these user ids.
B<-v>, B<--verbose> B<-v>, B<--verbose>
Give more information during processing. If used Give more information during processing. If used

View File

@ -1,3 +1,15 @@
Tue Feb 16 14:10:02 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* g10.c (main): New option --encrypt-to
* pkclist.c (build_pk_list): Implemented encrypt-to.
* parse-packet.c (parse_user_id): Removed the hack to work with
utf-8 strings.
* g10.c (main): Install lockfile cleanup handler.
* tdbio.c (cleanup): Removed: this is now handled by dotlock.
Sat Feb 13 14:13:04 CET 1999 Werner Koch <wk@isil.d.shuttle.de> Sat Feb 13 14:13:04 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* tdbio.c (tdbio_set_dbname): Init lockhandle for a new trustdb * tdbio.c (tdbio_set_dbname): Init lockhandle for a new trustdb

View File

@ -608,15 +608,16 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
/* some mailers leave quoted-printable encoded characters /* some mailers leave quoted-printable encoded characters
* so we try to workaround this */ * so we try to workaround this */
if( afx->buffer_pos+2 < afx->buffer_len ) { if( afx->buffer_pos+2 < afx->buffer_len ) {
int c1, c2, c3; int cc1, cc2, cc3;
c1 = afx->buffer[afx->buffer_pos]; cc1 = afx->buffer[afx->buffer_pos];
c2 = afx->buffer[afx->buffer_pos+1]; cc2 = afx->buffer[afx->buffer_pos+1];
c3 = afx->buffer[afx->buffer_pos+2]; cc3 = afx->buffer[afx->buffer_pos+2];
if( isxdigit(c1) && isxdigit(c2) && strchr( "=\n\r\t ", c3 )) { if( isxdigit(cc1) && isxdigit(cc2)
&& strchr( "=\n\r\t ", cc3 )) {
/* well it seems to be the case - adjust */ /* well it seems to be the case - adjust */
c = isdigit(c1)? (c1 - '0'): (toupper(c1)-'A'+10); c = isdigit(cc1)? (cc1 - '0'): (toupper(cc1)-'A'+10);
c <<= 4; c <<= 4;
c |= isdigit(c2)? (c2 - '0'): (toupper(c2)-'A'+10); c |= isdigit(cc2)? (cc2 - '0'): (toupper(cc2)-'A'+10);
afx->buffer_pos += 2; afx->buffer_pos += 2;
afx->qp_detected = 1; afx->qp_detected = 1;
goto again; goto again;

View File

@ -677,20 +677,20 @@ do_signature( IOBUF out, int ctb, PKT_signature *sig )
iobuf_put(a, sig->pubkey_algo ); iobuf_put(a, sig->pubkey_algo );
iobuf_put(a, sig->digest_algo ); iobuf_put(a, sig->digest_algo );
if( sig->version >= 4 ) { if( sig->version >= 4 ) {
size_t n; size_t nn;
/* timestamp and keyid must have been packed into the /* timestamp and keyid must have been packed into the
* subpackets prior to the call of this function, because * subpackets prior to the call of this function, because
* these subpackets are hashed */ * these subpackets are hashed */
n = sig->hashed_data?((sig->hashed_data[0]<<8) nn = sig->hashed_data?((sig->hashed_data[0]<<8)
|sig->hashed_data[1]) :0; |sig->hashed_data[1]) :0;
write_16(a, n); write_16(a, nn);
if( n ) if( nn )
iobuf_write( a, sig->hashed_data+2, n ); iobuf_write( a, sig->hashed_data+2, nn );
n = sig->unhashed_data?((sig->unhashed_data[0]<<8) nn = sig->unhashed_data?((sig->unhashed_data[0]<<8)
|sig->unhashed_data[1]) :0; |sig->unhashed_data[1]) :0;
write_16(a, n); write_16(a, nn);
if( n ) if( nn )
iobuf_write( a, sig->unhashed_data+2, n ); iobuf_write( a, sig->unhashed_data+2, nn );
} }
iobuf_put(a, sig->digest_start[0] ); iobuf_put(a, sig->digest_start[0] );
iobuf_put(a, sig->digest_start[1] ); iobuf_put(a, sig->digest_start[1] );

View File

@ -156,6 +156,7 @@ enum cmd_and_opt_values { aNull = 0,
oEscapeFrom, oEscapeFrom,
oLockOnce, oLockOnce,
oKeyServer, oKeyServer,
oEncryptTo,
aTest }; aTest };
@ -218,6 +219,7 @@ static ARGPARSE_OPTS opts[] = {
{ oArmor, "armor", 0, N_("create ascii armored output")}, { oArmor, "armor", 0, N_("create ascii armored output")},
{ oRecipient, "recipient", 2, N_("|NAME|encrypt for NAME")}, { oRecipient, "recipient", 2, N_("|NAME|encrypt for NAME")},
{ oRecipient, "remote-user", 2, "@"}, /* old option name */ { oRecipient, "remote-user", 2, "@"}, /* old option name */
{ oEncryptTo, "encrypt-to", 2, "@" },
#ifdef IS_G10 #ifdef IS_G10
{ oUser, "local-user",2, N_("use this user-id to sign or decrypt")}, { oUser, "local-user",2, N_("use this user-id to sign or decrypt")},
{ oCompress, NULL, 1, N_("|N|set compress level N (0 disables)") }, { oCompress, NULL, 1, N_("|N|set compress level N (0 disables)") },
@ -541,6 +543,7 @@ main( int argc, char **argv )
disable_core_dumps(); disable_core_dumps();
#endif #endif
init_signals(); init_signals();
create_dotlock(NULL); /* register locking cleanup */
i18n_init(); i18n_init();
opt.compress = -1; /* defaults to standard compress level */ opt.compress = -1; /* defaults to standard compress level */
/* fixme: set the next two to zero and decide where used */ /* fixme: set the next two to zero and decide where used */
@ -761,6 +764,13 @@ main( int argc, char **argv )
case oS2KDigest: s2k_digest_string = m_strdup(pargs.r.ret_str); break; case oS2KDigest: s2k_digest_string = m_strdup(pargs.r.ret_str); break;
case oS2KCipher: s2k_cipher_string = m_strdup(pargs.r.ret_str); break; case oS2KCipher: s2k_cipher_string = m_strdup(pargs.r.ret_str); break;
case oEncryptTo: /* store the recipient in the second list */
sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str));
strcpy(sl->d, pargs.r.ret_str);
sl->flags = 1;
sl->next = remusr;
remusr = sl;
break;
#ifdef IS_G10 #ifdef IS_G10
case oRecipient: /* store the recipient */ case oRecipient: /* store the recipient */
sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str)); sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str));

View File

@ -111,13 +111,13 @@ struct pubkey_find_info {
/*-- pkclist.c --*/ /*-- pkclist.c --*/
int check_signatures_trust( PKT_signature *sig ); int check_signatures_trust( PKT_signature *sig );
void release_pk_list( PK_LIST pk_list ); void release_pk_list( PK_LIST pk_list );
int build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage ); int build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use );
int select_algo_from_prefs( PK_LIST pk_list, int preftype ); int select_algo_from_prefs( PK_LIST pk_list, int preftype );
/*-- skclist.c --*/ /*-- skclist.c --*/
void release_sk_list( SK_LIST sk_list ); void release_sk_list( SK_LIST sk_list );
int build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list, int build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list,
int unlock, unsigned usage ); int unlock, unsigned use );
/*-- passphrase.h --*/ /*-- passphrase.h --*/
int have_static_passphrase(void); int have_static_passphrase(void);

View File

@ -49,8 +49,8 @@ static int menu_adduid( KBNODE keyblock, KBNODE sec_keyblock );
static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock ); static void menu_deluid( KBNODE pub_keyblock, KBNODE sec_keyblock );
static void menu_delkey( KBNODE pub_keyblock, KBNODE sec_keyblock ); static void menu_delkey( KBNODE pub_keyblock, KBNODE sec_keyblock );
static int menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock ); static int menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock );
static int menu_select_uid( KBNODE keyblock, int index ); static int menu_select_uid( KBNODE keyblock, int idx );
static int menu_select_key( KBNODE keyblock, int index ); static int menu_select_key( KBNODE keyblock, int idx );
static int count_uids( KBNODE keyblock ); static int count_uids( KBNODE keyblock );
static int count_uids_with_flag( KBNODE keyblock, unsigned flag ); static int count_uids_with_flag( KBNODE keyblock, unsigned flag );
static int count_keys_with_flag( KBNODE keyblock, unsigned flag ); static int count_keys_with_flag( KBNODE keyblock, unsigned flag );
@ -1309,21 +1309,21 @@ menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock )
* Returns: True if the selection changed; * Returns: True if the selection changed;
*/ */
static int static int
menu_select_uid( KBNODE keyblock, int index ) menu_select_uid( KBNODE keyblock, int idx )
{ {
KBNODE node; KBNODE node;
int i; int i;
/* first check that the index is valid */ /* first check that the index is valid */
if( index ) { if( idx ) {
for( i=0, node = keyblock; node; node = node->next ) { for( i=0, node = keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_USER_ID ) { if( node->pkt->pkttype == PKT_USER_ID ) {
if( ++i == index ) if( ++i == idx )
break; break;
} }
} }
if( !node ) { if( !node ) {
tty_printf(_("No user id with index %d\n"), index ); tty_printf(_("No user id with index %d\n"), idx );
return 0; return 0;
} }
} }
@ -1337,7 +1337,7 @@ menu_select_uid( KBNODE keyblock, int index )
/* and toggle the new index */ /* and toggle the new index */
for( i=0, node = keyblock; node; node = node->next ) { for( i=0, node = keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_USER_ID ) { if( node->pkt->pkttype == PKT_USER_ID ) {
if( ++i == index ) if( ++i == idx )
if( (node->flag & NODFLG_SELUID) ) if( (node->flag & NODFLG_SELUID) )
node->flag &= ~NODFLG_SELUID; node->flag &= ~NODFLG_SELUID;
else else
@ -1353,22 +1353,22 @@ menu_select_uid( KBNODE keyblock, int index )
* Returns: True if the selection changed; * Returns: True if the selection changed;
*/ */
static int static int
menu_select_key( KBNODE keyblock, int index ) menu_select_key( KBNODE keyblock, int idx )
{ {
KBNODE node; KBNODE node;
int i; int i;
/* first check that the index is valid */ /* first check that the index is valid */
if( index ) { if( idx ) {
for( i=0, node = keyblock; node; node = node->next ) { for( i=0, node = keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY
|| node->pkt->pkttype == PKT_SECRET_SUBKEY ) { || node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
if( ++i == index ) if( ++i == idx )
break; break;
} }
} }
if( !node ) { if( !node ) {
tty_printf(_("No secondary key with index %d\n"), index ); tty_printf(_("No secondary key with index %d\n"), idx );
return 0; return 0;
} }
} }
@ -1384,7 +1384,7 @@ menu_select_key( KBNODE keyblock, int index )
for( i=0, node = keyblock; node; node = node->next ) { for( i=0, node = keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY
|| node->pkt->pkttype == PKT_SECRET_SUBKEY ) { || node->pkt->pkttype == PKT_SECRET_SUBKEY ) {
if( ++i == index ) if( ++i == idx )
if( (node->flag & NODFLG_SELKEY) ) if( (node->flag & NODFLG_SELKEY) )
node->flag &= ~NODFLG_SELKEY; node->flag &= ~NODFLG_SELKEY;
else else

View File

@ -488,7 +488,7 @@ ask_keysize( int algo )
static u32 static u32
ask_expire_interval() ask_expire_interval(void)
{ {
char *answer; char *answer;
int valid_days=0; int valid_days=0;

View File

@ -72,7 +72,7 @@ int encrypt_filter( void *opaque, int control,
/*-- sign.c --*/ /*-- sign.c --*/
int complete_sig( PKT_signature *sig, PKT_secret_key *sk, MD_HANDLE md ); int complete_sig( PKT_signature *sig, PKT_secret_key *sk, MD_HANDLE md );
int sign_file( STRLIST filenames, int detached, STRLIST locusr, int sign_file( STRLIST filenames, int detached, STRLIST locusr,
int encrypt, STRLIST remusr, const char *outfile ); int do_encrypt, STRLIST remusr, const char *outfile );
int clearsign_file( const char *fname, STRLIST locusr, const char *outfile ); int clearsign_file( const char *fname, STRLIST locusr, const char *outfile );
/*-- sig-check.c --*/ /*-- sig-check.c --*/

View File

@ -1400,19 +1400,8 @@ parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
packet->pkt.user_id = m_alloc(sizeof *packet->pkt.user_id + pktlen); packet->pkt.user_id = m_alloc(sizeof *packet->pkt.user_id + pktlen);
packet->pkt.user_id->len = pktlen; packet->pkt.user_id->len = pktlen;
p = packet->pkt.user_id->name; p = packet->pkt.user_id->name;
for( ; pktlen; pktlen--, p++ ) { for( ; pktlen; pktlen--, p++ )
*p = iobuf_get_noeof(inp); *p = iobuf_get_noeof(inp);
/* 0xff is not a valid utf-8 encoding so we can use it to replace
* Nulls. This has the advantage that we can work with regular
* C strings. When exporting it, we change it back to Null
* the utf-8 functions know about this special convention.
* The advantage of this single character is that we can
* simple replace it. Problem is that we can't handle the 0xff
* character which may have been used by pref rfc2440 implementations
* I hope we can live with this. */
if( !*p )
*p = 0xff;
}
*p = 0; *p = 0;
if( list_mode ) { if( list_mode ) {

View File

@ -511,13 +511,43 @@ release_pk_list( PK_LIST pk_list )
} }
int int
build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage ) build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use )
{ {
PK_LIST pk_list = NULL; PK_LIST pk_list = NULL;
PKT_public_key *pk=NULL; PKT_public_key *pk=NULL;
int rc=0; int rc=0;
int any_recipients=0;
STRLIST rov;
if( !remusr && !opt.batch ) { /* ask */ /* check whether there are any recipients in the list and build the
* list of the encrypt-to ones (we always trust them) */
for( rov = remusr; rov; rov = rov->next ) {
if( !(rov->flags & 1) )
any_recipients = 1;
else if( (use & PUBKEY_USAGE_ENC) ) {
pk = m_alloc_clear( sizeof *pk );
pk->pubkey_usage = use;
if( (rc = get_pubkey_byname( NULL, pk, rov->d, NULL )) ) {
free_public_key( pk ); pk = NULL;
log_error(_("%s: skipped: %s\n"), rov->d, g10_errstr(rc) );
}
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use )) ) {
PK_LIST r;
r = m_alloc( sizeof *r );
r->pk = pk; pk = NULL;
r->next = pk_list;
r->mark = 0;
pk_list = r;
}
else {
free_public_key( pk ); pk = NULL;
log_error(_("%s: skipped: %s\n"), rov->d, g10_errstr(rc) );
}
}
}
if( !any_recipients && !opt.batch ) { /* ask */
char *answer=NULL; char *answer=NULL;
tty_printf(_( tty_printf(_(
@ -534,11 +564,11 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage )
if( pk ) if( pk )
free_public_key( pk ); free_public_key( pk );
pk = m_alloc_clear( sizeof *pk ); pk = m_alloc_clear( sizeof *pk );
pk->pubkey_usage = usage; pk->pubkey_usage = use;
rc = get_pubkey_byname( NULL, pk, answer, NULL ); rc = get_pubkey_byname( NULL, pk, answer, NULL );
if( rc ) if( rc )
tty_printf(_("No such user ID.\n")); tty_printf(_("No such user ID.\n"));
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, usage)) ) { else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use)) ) {
int trustlevel; int trustlevel;
rc = check_trust( pk, &trustlevel ); rc = check_trust( pk, &trustlevel );
@ -554,6 +584,7 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage )
r->next = pk_list; r->next = pk_list;
r->mark = 0; r->mark = 0;
pk_list = r; pk_list = r;
any_recipients = 1;
break; break;
} }
} }
@ -568,12 +599,12 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage )
for(; remusr; remusr = remusr->next ) { for(; remusr; remusr = remusr->next ) {
pk = m_alloc_clear( sizeof *pk ); pk = m_alloc_clear( sizeof *pk );
pk->pubkey_usage = usage; pk->pubkey_usage = use;
if( (rc = get_pubkey_byname( NULL, pk, remusr->d, NULL )) ) { if( (rc = get_pubkey_byname( NULL, pk, remusr->d, NULL )) ) {
free_public_key( pk ); pk = NULL; free_public_key( pk ); pk = NULL;
log_error(_("%s: skipped: %s\n"), remusr->d, g10_errstr(rc) ); log_error(_("%s: skipped: %s\n"), remusr->d, g10_errstr(rc) );
} }
else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, usage )) ) { else if( !(rc=check_pubkey_algo2(pk->pubkey_algo, use )) ) {
int trustlevel; int trustlevel;
rc = check_trust( pk, &trustlevel ); rc = check_trust( pk, &trustlevel );
@ -591,6 +622,7 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage )
r->next = pk_list; r->next = pk_list;
r->mark = 0; r->mark = 0;
pk_list = r; pk_list = r;
any_recipients = 1;
} }
else { /* we don't trust this pk */ else { /* we don't trust this pk */
free_public_key( pk ); pk = NULL; free_public_key( pk ); pk = NULL;
@ -603,8 +635,7 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage )
} }
} }
if( !rc && !any_recipients ) {
if( !rc && !pk_list ) {
log_error(_("no valid addressees\n")); log_error(_("no valid addressees\n"));
rc = G10ERR_NO_USER_ID; rc = G10ERR_NO_USER_ID;
} }

View File

@ -226,8 +226,8 @@ protect_secret_key( PKT_secret_key *sk, DEK *dek )
cipher_encrypt( cipher_hd, sk->protect.iv, sk->protect.iv, 8 ); cipher_encrypt( cipher_hd, sk->protect.iv, sk->protect.iv, 8 );
if( sk->version >= 4 ) { if( sk->version >= 4 ) {
#define NMPIS (PUBKEY_MAX_NSKEY - PUBKEY_MAX_NPKEY) #define NMPIS (PUBKEY_MAX_NSKEY - PUBKEY_MAX_NPKEY)
byte *buffer[NMPIS]; byte *bufarr[NMPIS];
unsigned nbytes[NMPIS]; unsigned narr[NMPIS];
unsigned nbits[NMPIS]; unsigned nbits[NMPIS];
int ndata=0; int ndata=0;
byte *p, *data; byte *p, *data;
@ -235,23 +235,23 @@ protect_secret_key( PKT_secret_key *sk, DEK *dek )
for(j=0, i = pubkey_get_npkey(sk->pubkey_algo); for(j=0, i = pubkey_get_npkey(sk->pubkey_algo);
i < pubkey_get_nskey(sk->pubkey_algo); i++, j++ ) { i < pubkey_get_nskey(sk->pubkey_algo); i++, j++ ) {
assert( !mpi_is_opaque( sk->skey[i] ) ); assert( !mpi_is_opaque( sk->skey[i] ) );
buffer[j] = mpi_get_buffer( sk->skey[i], &nbytes[j], NULL ); bufarr[j] = mpi_get_buffer( sk->skey[i], &narr[j], NULL );
nbits[j] = mpi_get_nbits( sk->skey[i] ); nbits[j] = mpi_get_nbits( sk->skey[i] );
ndata += nbytes[j] + 2; ndata += narr[j] + 2;
} }
for( ; j < NMPIS; j++ ) for( ; j < NMPIS; j++ )
buffer[j] = NULL; bufarr[j] = NULL;
ndata += 2; /* for checksum */ ndata += 2; /* for checksum */
data = m_alloc_secure( ndata ); data = m_alloc_secure( ndata );
p = data; p = data;
for(j=0; j < NMPIS && buffer[j]; j++ ) { for(j=0; j < NMPIS && bufarr[j]; j++ ) {
p[0] = nbits[j] >> 8 ; p[0] = nbits[j] >> 8 ;
p[1] = nbits[j]; p[1] = nbits[j];
p += 2; p += 2;
memcpy(p, buffer[j], nbytes[j] ); memcpy(p, bufarr[j], narr[j] );
p += nbytes[j]; p += narr[j];
m_free(buffer[j]); m_free(bufarr[j]);
} }
#undef NMPIS #undef NMPIS
csum = checksum( data, ndata-2); csum = checksum( data, ndata-2);

View File

@ -62,7 +62,7 @@ is_insecure( PKT_secret_key *sk )
int int
build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list, int unlock, build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list, int unlock,
unsigned usage ) unsigned use )
{ {
SK_LIST sk_list = NULL; SK_LIST sk_list = NULL;
int rc; int rc;
@ -71,14 +71,14 @@ build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list, int unlock,
PKT_secret_key *sk; PKT_secret_key *sk;
sk = m_alloc_clear( sizeof *sk ); sk = m_alloc_clear( sizeof *sk );
sk->pubkey_usage = usage; sk->pubkey_usage = use;
if( (rc = get_seckey_byname( sk, NULL, unlock )) ) { if( (rc = get_seckey_byname( sk, NULL, unlock )) ) {
free_secret_key( sk ); sk = NULL; free_secret_key( sk ); sk = NULL;
log_error("no default secret key: %s\n", g10_errstr(rc) ); log_error("no default secret key: %s\n", g10_errstr(rc) );
} }
else if( !(rc=check_pubkey_algo2(sk->pubkey_algo, usage)) ) { else if( !(rc=check_pubkey_algo2(sk->pubkey_algo, use)) ) {
SK_LIST r; SK_LIST r;
if( sk->version == 4 && (usage & PUBKEY_USAGE_SIG) if( sk->version == 4 && (use & PUBKEY_USAGE_SIG)
&& sk->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E ) { && sk->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E ) {
log_info("this is a PGP generated " log_info("this is a PGP generated "
"ElGamal key which is NOT secure for signatures!\n"); "ElGamal key which is NOT secure for signatures!\n");
@ -107,14 +107,14 @@ build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list, int unlock,
PKT_secret_key *sk; PKT_secret_key *sk;
sk = m_alloc_clear( sizeof *sk ); sk = m_alloc_clear( sizeof *sk );
sk->pubkey_usage = usage; sk->pubkey_usage = use;
if( (rc = get_seckey_byname( sk, locusr->d, unlock )) ) { if( (rc = get_seckey_byname( sk, locusr->d, unlock )) ) {
free_secret_key( sk ); sk = NULL; free_secret_key( sk ); sk = NULL;
log_error(_("skipped `%s': %s\n"), locusr->d, g10_errstr(rc) ); log_error(_("skipped `%s': %s\n"), locusr->d, g10_errstr(rc) );
} }
else if( !(rc=check_pubkey_algo2(sk->pubkey_algo, usage)) ) { else if( !(rc=check_pubkey_algo2(sk->pubkey_algo, use)) ) {
SK_LIST r; SK_LIST r;
if( sk->version == 4 && (usage & PUBKEY_USAGE_SIG) if( sk->version == 4 && (use & PUBKEY_USAGE_SIG)
&& sk->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E ) { && sk->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E ) {
log_info(_("skipped `%s': this is a PGP generated " log_info(_("skipped `%s': this is a PGP generated "
"ElGamal key which is not secure for signatures!\n"), "ElGamal key which is not secure for signatures!\n"),

View File

@ -514,7 +514,8 @@ open_db()
TRUSTREC rec; TRUSTREC rec;
assert( db_fd == -1 ); assert( db_fd == -1 );
lockhandle = create_dotlock( db_name ); if( !lockhandle )
lockhandle = create_dotlock( db_name );
if( !lockhandle ) if( !lockhandle )
log_fatal( _("%s: can't create lock\n"), db_name ); log_fatal( _("%s: can't create lock\n"), db_name );
#ifdef HAVE_DOSISH_SYSTEM #ifdef HAVE_DOSISH_SYSTEM
@ -611,7 +612,7 @@ tdbio_db_matches_options()
* Return the record number of the keyhash tbl or create a new one. * Return the record number of the keyhash tbl or create a new one.
*/ */
static ulong static ulong
get_keyhashrec() get_keyhashrec(void)
{ {
static ulong keyhashtbl; /* record number of the key hashtable */ static ulong keyhashtbl; /* record number of the key hashtable */
@ -636,7 +637,7 @@ get_keyhashrec()
* or create a new one. * or create a new one.
*/ */
static ulong static ulong
get_sdirhashrec() get_sdirhashrec(void)
{ {
static ulong sdirhashtbl; /* record number of the hashtable */ static ulong sdirhashtbl; /* record number of the hashtable */

View File

@ -115,7 +115,7 @@ static int get_dir_record( PKT_public_key *pk, TRUSTREC *rec );
static void upd_pref_record( TRUSTREC *urec, u32 *keyid, PKT_signature *sig ); static void upd_pref_record( TRUSTREC *urec, u32 *keyid, PKT_signature *sig );
static void upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid, static void upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
TRUSTREC *drec, RECNO_LIST *recno_list, int recheck, TRUSTREC *drec, RECNO_LIST *recno_list, int recheck,
TRUSTREC *urec, const byte *uidhash, int revoke ); TRUSTREC *urec, const byte *uidhash, int revoked );
static struct keyid_list *trusted_key_list; static struct keyid_list *trusted_key_list;
@ -138,7 +138,7 @@ static struct local_id_item *unused_lid_items;
**********************************************/ **********************************************/
static void static void
die_invalid_db() die_invalid_db(void)
{ {
log_error(_( log_error(_(
"The trustdb is corrupted; please run \"gpgm --fix-trustdb\".\n") ); "The trustdb is corrupted; please run \"gpgm --fix-trustdb\".\n") );
@ -192,7 +192,7 @@ delete_record( ulong recno )
* sync the db * sync the db
*/ */
static void static void
do_sync( ) do_sync(void)
{ {
int rc = tdbio_sync(); int rc = tdbio_sync();
if( !rc ) if( !rc )
@ -480,7 +480,7 @@ register_trusted_key( const char *string )
* Verify that all our public keys are in the trustdb. * Verify that all our public keys are in the trustdb.
*/ */
static int static int
verify_own_keys() verify_own_keys(void)
{ {
int rc; int rc;
void *enum_context = NULL; void *enum_context = NULL;
@ -2111,7 +2111,7 @@ check_hint_sig( ulong lid, KBNODE keyblock, u32 *keyid, byte *uidrec_hash,
PKT_signature *sigpkt = NULL; PKT_signature *sigpkt = NULL;
TRUSTREC tmp; TRUSTREC tmp;
u32 sigkid[2]; u32 sigkid[2];
int revoke = 0; int revoked = 0;
if( sigrec->r.sig.sig[sigidx].flag & SIGF_CHECKED ) if( sigrec->r.sig.sig[sigidx].flag & SIGF_CHECKED )
log_info(_("NOTE: sig rec %lu[%d] in hintlist " log_info(_("NOTE: sig rec %lu[%d] in hintlist "
@ -2156,7 +2156,7 @@ check_hint_sig( ulong lid, KBNODE keyblock, u32 *keyid, byte *uidrec_hash,
if( sigpkt->keyid[0] == sigkid[0] if( sigpkt->keyid[0] == sigkid[0]
&& sigpkt->keyid[1] == sigkid[1] && sigpkt->keyid[1] == sigkid[1]
&& ( (sigpkt->sig_class&~3) == 0x10 && ( (sigpkt->sig_class&~3) == 0x10
|| ( revoke = (sigpkt->sig_class == 0x30)) ) ) { || ( revoked = (sigpkt->sig_class == 0x30)) ) ) {
state = 2; state = 2;
break; /* found */ break; /* found */
} }
@ -2186,10 +2186,10 @@ check_hint_sig( ulong lid, KBNODE keyblock, u32 *keyid, byte *uidrec_hash,
log_info("sig %08lX.%lu/%02X%02X/%08lX: %s\n", log_info("sig %08lX.%lu/%02X%02X/%08lX: %s\n",
(ulong)keyid[1], lid, uhash[18], uhash[19], (ulong)keyid[1], lid, uhash[18], uhash[19],
(ulong)sigpkt->keyid[1], (ulong)sigpkt->keyid[1],
revoke? _("Valid certificate revocation") revoked? _("Valid certificate revocation")
: _("Good certificate") ); : _("Good certificate") );
sigrec->r.sig.sig[sigidx].flag = SIGF_CHECKED | SIGF_VALID; sigrec->r.sig.sig[sigidx].flag = SIGF_CHECKED | SIGF_VALID;
if( revoke ) if( revoked )
sigrec->r.sig.sig[sigidx].flag |= SIGF_REVOKED; sigrec->r.sig.sig[sigidx].flag |= SIGF_REVOKED;
} }
else if( rc == G10ERR_NO_PUBKEY ) { else if( rc == G10ERR_NO_PUBKEY ) {
@ -2779,9 +2779,9 @@ upd_pref_record( TRUSTREC *urec, u32 *keyid, PKT_signature *sig )
else { /* need more than one pref record */ else { /* need more than one pref record */
TRUSTREC tmp; TRUSTREC tmp;
ulong nextrn; ulong nextrn;
int n = n_prefs_sig;
byte *pp = prefs_sig; byte *pp = prefs_sig;
n = n_prefs_sig;
memcpy( prec.r.pref.data, pp, ITEMS_PER_PREF_RECORD ); memcpy( prec.r.pref.data, pp, ITEMS_PER_PREF_RECORD );
n -= ITEMS_PER_PREF_RECORD; n -= ITEMS_PER_PREF_RECORD;
pp += ITEMS_PER_PREF_RECORD; pp += ITEMS_PER_PREF_RECORD;
@ -2814,7 +2814,7 @@ upd_pref_record( TRUSTREC *urec, u32 *keyid, PKT_signature *sig )
static void static void
upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid, upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
TRUSTREC *drec, RECNO_LIST *recno_list, int recheck, TRUSTREC *drec, RECNO_LIST *recno_list, int recheck,
TRUSTREC *urec, const byte *uidhash, int revoke ) TRUSTREC *urec, const byte *uidhash, int revoked )
{ {
/* We simply insert the signature into the sig records but /* We simply insert the signature into the sig records but
* avoid duplicate ones. We do not check them here because * avoid duplicate ones. We do not check them here because
@ -2893,7 +2893,7 @@ upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
#endif #endif
found_sig = 1; found_sig = 1;
} }
if( !recheck && !revoke && (rec.r.sig.sig[i].flag & SIGF_CHECKED) ) if( !recheck && !revoked && (rec.r.sig.sig[i].flag & SIGF_CHECKED) )
continue; /* we already checked this signature */ continue; /* we already checked this signature */
if( !recheck && (rec.r.sig.sig[i].flag & SIGF_NOPUBKEY) ) if( !recheck && (rec.r.sig.sig[i].flag & SIGF_NOPUBKEY) )
continue; /* we do not have the public key */ continue; /* we do not have the public key */
@ -2907,10 +2907,10 @@ upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
log_info("sig %08lX.%lu/%02X%02X/%08lX: %s\n", log_info("sig %08lX.%lu/%02X%02X/%08lX: %s\n",
(ulong)keyid[1], lid, uidhash[18], (ulong)keyid[1], lid, uidhash[18],
uidhash[19], (ulong)sig->keyid[1], uidhash[19], (ulong)sig->keyid[1],
revoke? _("Valid certificate revocation") revoked? _("Valid certificate revocation")
: _("Good certificate") ); : _("Good certificate") );
rec.r.sig.sig[i].flag = SIGF_CHECKED | SIGF_VALID; rec.r.sig.sig[i].flag = SIGF_CHECKED | SIGF_VALID;
if( revoke ) if( revoked )
rec.r.sig.sig[i].flag |= SIGF_REVOKED; rec.r.sig.sig[i].flag |= SIGF_REVOKED;
} }
else if( rc == G10ERR_NO_PUBKEY ) { else if( rc == G10ERR_NO_PUBKEY ) {
@ -2922,18 +2922,18 @@ upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
_("Hmmm, public key lost?") ); _("Hmmm, public key lost?") );
#endif #endif
rec.r.sig.sig[i].flag = SIGF_NOPUBKEY; rec.r.sig.sig[i].flag = SIGF_NOPUBKEY;
if( revoke ) if( revoked )
rec.r.sig.sig[i].flag |= SIGF_REVOKED; rec.r.sig.sig[i].flag |= SIGF_REVOKED;
} }
else { else {
log_info("sig %08lX.%lu/%02X%02X/%08lX: %s: %s\n", log_info("sig %08lX.%lu/%02X%02X/%08lX: %s: %s\n",
(ulong)keyid[1], lid, uidhash[18], (ulong)keyid[1], lid, uidhash[18],
uidhash[19], (ulong)sig->keyid[1], uidhash[19], (ulong)sig->keyid[1],
revoke? _("Invalid certificate revocation") revoked? _("Invalid certificate revocation")
: _("Invalid certificate"), : _("Invalid certificate"),
g10_errstr(rc)); g10_errstr(rc));
rec.r.sig.sig[i].flag = SIGF_CHECKED; rec.r.sig.sig[i].flag = SIGF_CHECKED;
if( revoke ) if( revoked )
rec.r.sig.sig[i].flag |= SIGF_REVOKED; rec.r.sig.sig[i].flag |= SIGF_REVOKED;
} }
rec.dirty = 1; rec.dirty = 1;
@ -2950,7 +2950,7 @@ upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
(ulong)keyid[1], lid, (ulong)keyid[1], lid,
uidhash[18], uidhash[19], tmp.recnum ); uidhash[18], uidhash[19], tmp.recnum );
rec.r.sig.sig[i].flag = SIGF_NOPUBKEY; rec.r.sig.sig[i].flag = SIGF_NOPUBKEY;
if( revoke ) if( revoked )
rec.r.sig.sig[i].flag |= SIGF_REVOKED; rec.r.sig.sig[i].flag |= SIGF_REVOKED;
rec.dirty = 1; rec.dirty = 1;
/* fixme: should we verify that the record is /* fixme: should we verify that the record is
@ -2991,11 +2991,11 @@ upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
log_info("sig %08lX.%lu/%02X%02X/%08lX: %s\n", log_info("sig %08lX.%lu/%02X%02X/%08lX: %s\n",
(ulong)keyid[1], lid, uidhash[18], (ulong)keyid[1], lid, uidhash[18],
uidhash[19], (ulong)sig->keyid[1], uidhash[19], (ulong)sig->keyid[1],
revoke? _("Valid certificate revocation") revoked? _("Valid certificate revocation")
: _("Good certificate") ); : _("Good certificate") );
newlid = pk_lid; /* this is the pk of the signature */ newlid = pk_lid; /* this is the pk of the signature */
newflag = SIGF_CHECKED | SIGF_VALID; newflag = SIGF_CHECKED | SIGF_VALID;
if( revoke ) if( revoked )
newflag |= SIGF_REVOKED; newflag |= SIGF_REVOKED;
} }
else if( rc == G10ERR_NO_PUBKEY ) { else if( rc == G10ERR_NO_PUBKEY ) {
@ -3005,19 +3005,19 @@ upd_cert_record( KBNODE keyblock, KBNODE signode, u32 *keyid,
uidhash[19], (ulong)sig->keyid[1], g10_errstr(rc) ); uidhash[19], (ulong)sig->keyid[1], g10_errstr(rc) );
newlid = create_shadow_dir( sig, lid ); newlid = create_shadow_dir( sig, lid );
newflag = SIGF_NOPUBKEY; newflag = SIGF_NOPUBKEY;
if( revoke ) if( revoked )
newflag |= SIGF_REVOKED; newflag |= SIGF_REVOKED;
} }
else { else {
log_info( "sig %08lX.%lu/%02X%02X/%08lX: %s: %s\n", log_info( "sig %08lX.%lu/%02X%02X/%08lX: %s: %s\n",
(ulong)keyid[1], lid, uidhash[18], uidhash[19], (ulong)keyid[1], lid, uidhash[18], uidhash[19],
(ulong)sig->keyid[1], (ulong)sig->keyid[1],
revoke? _("Invalid certificate revocation") revoked? _("Invalid certificate revocation")
: _("Invalid certificate"), : _("Invalid certificate"),
g10_errstr(rc)); g10_errstr(rc));
newlid = create_shadow_dir( sig, lid ); newlid = create_shadow_dir( sig, lid );
newflag = SIGF_CHECKED; newflag = SIGF_CHECKED;
if( revoke ) if( revoked )
newflag |= SIGF_REVOKED; newflag |= SIGF_REVOKED;
} }
@ -3264,12 +3264,12 @@ insert_trust_record( PKT_public_key *pk )
for( node=keyblock; node; node = node->next ) { for( node=keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_PUBLIC_KEY if( node->pkt->pkttype == PKT_PUBLIC_KEY
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) { || node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
PKT_public_key *pk = node->pkt->pkt.public_key; PKT_public_key *a_pk = node->pkt->pkt.public_key;
pk->local_id = dirrec.r.dir.lid; a_pk->local_id = dirrec.r.dir.lid;
} }
else if( node->pkt->pkttype == PKT_SIGNATURE ) { else if( node->pkt->pkttype == PKT_SIGNATURE ) {
PKT_signature *sig = node->pkt->pkt.signature; PKT_signature *a_sig = node->pkt->pkt.signature;
sig->local_id = dirrec.r.dir.lid; a_sig->local_id = dirrec.r.dir.lid;
} }
} }

View File

@ -1,3 +1,7 @@
Tue Feb 16 14:10:02 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* types.h (STRLIST): Add field flags.
Wed Feb 10 17:15:39 CET 1999 Werner Koch <wk@isil.d.shuttle.de> Wed Feb 10 17:15:39 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* cipher.h (CIPHER_ALGO_TWOFISH): Chnaged ID to 10 and renamed * cipher.h (CIPHER_ALGO_TWOFISH): Chnaged ID to 10 and renamed

View File

@ -144,7 +144,7 @@ void cipher_sync( CIPHER_HANDLE c );
int string_to_pubkey_algo( const char *string ); int string_to_pubkey_algo( const char *string );
const char * pubkey_algo_to_string( int algo ); const char * pubkey_algo_to_string( int algo );
int check_pubkey_algo( int algo ); int check_pubkey_algo( int algo );
int check_pubkey_algo2( int algo, unsigned usage ); int check_pubkey_algo2( int algo, unsigned use );
int pubkey_get_npkey( int algo ); int pubkey_get_npkey( int algo );
int pubkey_get_nskey( int algo ); int pubkey_get_nskey( int algo );
int pubkey_get_nsig( int algo ); int pubkey_get_nsig( int algo );

View File

@ -52,7 +52,7 @@ typedef enum {
struct http_context { struct http_context {
int initialized; int initialized;
unsigned int status_code; unsigned int status_code;
int socket; int sock;
int in_data; int in_data;
IOBUF fp_read; IOBUF fp_read;
IOBUF fp_write; IOBUF fp_write;

View File

@ -36,8 +36,9 @@
typedef struct iobuf_struct *IOBUF; typedef struct iobuf_struct *IOBUF;
/* fixme: we should hide most of this stuff */
struct iobuf_struct { struct iobuf_struct {
int usage; /* 1 input , 2 output, 3 temp */ int use; /* 1 input , 2 output, 3 temp */
unsigned long nlimit; unsigned long nlimit;
unsigned long nbytes; /* used together with nlimit */ unsigned long nbytes; /* used together with nlimit */
unsigned long ntotal; /* total bytes read (position of stream) */ unsigned long ntotal; /* total bytes read (position of stream) */
@ -69,7 +70,7 @@ struct iobuf_struct {
int iobuf_debug_mode; int iobuf_debug_mode;
IOBUF iobuf_alloc(int usage, size_t bufsize); IOBUF iobuf_alloc(int use, size_t bufsize);
IOBUF iobuf_temp(void); IOBUF iobuf_temp(void);
IOBUF iobuf_temp_with_content( const char *buffer, size_t length ); IOBUF iobuf_temp_with_content( const char *buffer, size_t length );
IOBUF iobuf_open( const char *fname ); IOBUF iobuf_open( const char *fname );
@ -136,6 +137,6 @@ int iobuf_in_block_mode( IOBUF a );
#define iobuf_get_temp_buffer(a) ( (a)->d.buf ) #define iobuf_get_temp_buffer(a) ( (a)->d.buf )
#define iobuf_get_temp_length(a) ( (a)->d.len ) #define iobuf_get_temp_length(a) ( (a)->d.len )
#define iobuf_is_temp(a) ( (a)->usage == 3 ) #define iobuf_is_temp(a) ( (a)->use == 3 )
#endif /*G10_IOBUF_H*/ #endif /*G10_IOBUF_H*/

View File

@ -153,8 +153,8 @@ int mpi_cmp_ui( MPI u, ulong v );
int mpi_cmp( MPI u, MPI v ); int mpi_cmp( MPI u, MPI v );
/*-- mpi-scan.c --*/ /*-- mpi-scan.c --*/
int mpi_getbyte( MPI a, unsigned index ); int mpi_getbyte( MPI a, unsigned idx );
void mpi_putbyte( MPI a, unsigned index, int value ); void mpi_putbyte( MPI a, unsigned idx, int value );
unsigned mpi_trailing_zeros( MPI a ); unsigned mpi_trailing_zeros( MPI a );
/*-- mpi-bit.c --*/ /*-- mpi-bit.c --*/

View File

@ -102,6 +102,7 @@
typedef struct string_list { typedef struct string_list {
struct string_list *next; struct string_list *next;
unsigned int flags;
char d[1]; char d[1];
} *STRLIST; } *STRLIST;

View File

@ -41,7 +41,7 @@ typedef struct {
char *ret_str; char *ret_str;
} r; /* Return values */ } r; /* Return values */
struct { struct {
int index; int idx;
int inarg; int inarg;
int stopped; int stopped;
const char *last; const char *last;

View File

@ -32,7 +32,7 @@
* FIXME: This code is VERY ugly! * FIXME: This code is VERY ugly!
*/ */
int int
mpi_getbyte( MPI a, unsigned index ) mpi_getbyte( MPI a, unsigned idx )
{ {
int i, j; int i, j;
unsigned n; unsigned n;
@ -43,7 +43,7 @@ mpi_getbyte( MPI a, unsigned index )
for(n=0,i=0; i < a->nlimbs; i++ ) { for(n=0,i=0; i < a->nlimbs; i++ ) {
limb = ap[i]; limb = ap[i];
for( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ ) for( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ )
if( n == index ) if( n == idx )
return (limb >> j*8) & 0xff; return (limb >> j*8) & 0xff;
} }
return -1; return -1;
@ -51,10 +51,10 @@ mpi_getbyte( MPI a, unsigned index )
/**************** /****************
* Put a value at position INDEX into A. index counts from lsb to msb * Put a value at position IDX into A. idx counts from lsb to msb
*/ */
void void
mpi_putbyte( MPI a, unsigned index, int xc ) mpi_putbyte( MPI a, unsigned idx, int xc )
{ {
int i, j; int i, j;
unsigned n; unsigned n;
@ -66,7 +66,7 @@ mpi_putbyte( MPI a, unsigned index, int xc )
for(n=0,i=0; i < a->alloced; i++ ) { for(n=0,i=0; i < a->alloced; i++ ) {
limb = ap[i]; limb = ap[i];
for( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ ) for( j=0; j < BYTES_PER_MPI_LIMB; j++, n++ )
if( n == index ) { if( n == idx ) {
#if BYTES_PER_MPI_LIMB == 4 #if BYTES_PER_MPI_LIMB == 4
if( j == 0 ) if( j == 0 )
limb = (limb & 0xffffff00) | c; limb = (limb & 0xffffff00) | c;

View File

@ -1,3 +1,10 @@
Tue Feb 16 14:10:02 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* strgutil.c (add_to_strglist): Clear the new flags field
(append_to_strglist): Ditto.
* dotlock.c (read_lockfile): terminate pidstr (Michael).
Wed Feb 10 17:15:39 CET 1999 Werner Koch <wk@isil.d.shuttle.de> Wed Feb 10 17:15:39 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* dotlock.c (remove_lockfiles): Add cleanup function. * dotlock.c (remove_lockfiles): Add cleanup function.

View File

@ -49,7 +49,7 @@
* char *ret_str; * char *ret_str;
* } r; Return values * } r; Return values
* struct { * struct {
* int index; * int idx;
* const char *last; * const char *last;
* void *aliases; * void *aliases;
* } internal; DO NOT CHANGE * } internal; DO NOT CHANGE
@ -143,7 +143,7 @@ static void
initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno ) initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno )
{ {
if( !(arg->flags & (1<<15)) ) { /* initialize this instance */ if( !(arg->flags & (1<<15)) ) { /* initialize this instance */
arg->internal.index = 0; arg->internal.idx = 0;
arg->internal.last = NULL; arg->internal.last = NULL;
arg->internal.inarg = 0; arg->internal.inarg = 0;
arg->internal.stopped = 0; arg->internal.stopped = 0;
@ -230,7 +230,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts) ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
{ {
int state, i, c; int state, i, c;
int index=0; int idx=0;
char keyword[100]; char keyword[100];
char *buffer = NULL; char *buffer = NULL;
size_t buflen = 0; size_t buflen = 0;
@ -256,13 +256,13 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
for(i=0; opts[i].short_opt; i++ ) for(i=0; opts[i].short_opt; i++ )
if( opts[i].long_opt && !strcmp( opts[i].long_opt, keyword) ) if( opts[i].long_opt && !strcmp( opts[i].long_opt, keyword) )
break; break;
index = i; idx = i;
arg->r_opt = opts[index].short_opt; arg->r_opt = opts[idx].short_opt;
if( inverse ) /* this does not have an effect, hmmm */ if( inverse ) /* this does not have an effect, hmmm */
arg->r_opt = -arg->r_opt; arg->r_opt = -arg->r_opt;
if( !opts[index].short_opt ) /* unknown command/option */ if( !opts[idx].short_opt ) /* unknown command/option */
arg->r_opt = (opts[index].flags & 256)? -7:-2; arg->r_opt = (opts[idx].flags & 256)? -7:-2;
else if( (opts[index].flags & 8) ) /* no argument */ else if( (opts[idx].flags & 8) ) /* no argument */
arg->r_opt = -3; /* error */ arg->r_opt = -3; /* error */
else /* no or optional argument */ else /* no or optional argument */
arg->r_type = 0; /* okay */ arg->r_type = 0; /* okay */
@ -271,9 +271,9 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
else if( state == 3 ) { /* no argument found */ else if( state == 3 ) { /* no argument found */
if( in_alias ) if( in_alias )
arg->r_opt = -3; /* error */ arg->r_opt = -3; /* error */
else if( !(opts[index].flags & 7) ) /* does not take an arg */ else if( !(opts[idx].flags & 7) ) /* does not take an arg */
arg->r_type = 0; /* okay */ arg->r_type = 0; /* okay */
else if( (opts[index].flags & 8) ) /* no optional argument */ else if( (opts[idx].flags & 8) ) /* no optional argument */
arg->r_type = 0; /* okay */ arg->r_type = 0; /* okay */
else /* no required argument */ else /* no required argument */
arg->r_opt = -3; /* error */ arg->r_opt = -3; /* error */
@ -301,7 +301,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
} }
} }
} }
else if( !(opts[index].flags & 7) ) /* does not take an arg */ else if( !(opts[idx].flags & 7) ) /* does not take an arg */
arg->r_opt = -6; /* error */ arg->r_opt = -6; /* error */
else { else {
if( !buffer ) { if( !buffer ) {
@ -312,7 +312,7 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
buffer[i] = 0; buffer[i] = 0;
trim_spaces( buffer ); trim_spaces( buffer );
if( !set_opt_arg(arg, opts[index].flags, buffer) ) if( !set_opt_arg(arg, opts[idx].flags, buffer) )
m_free(buffer); m_free(buffer);
} }
break; break;
@ -340,15 +340,15 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
for(i=0; opts[i].short_opt; i++ ) for(i=0; opts[i].short_opt; i++ )
if( opts[i].long_opt && !strcmp( opts[i].long_opt, keyword) ) if( opts[i].long_opt && !strcmp( opts[i].long_opt, keyword) )
break; break;
index = i; idx = i;
arg->r_opt = opts[index].short_opt; arg->r_opt = opts[idx].short_opt;
if( !opts[index].short_opt ) { if( !opts[idx].short_opt ) {
if( !strcmp( keyword, "alias" ) ) { if( !strcmp( keyword, "alias" ) ) {
in_alias = 1; in_alias = 1;
state = 3; state = 3;
} }
else { else {
arg->r_opt = (opts[index].flags & 256)? -7:-2; arg->r_opt = (opts[idx].flags & 256)? -7:-2;
state = -1; /* skip rest of line and leave */ state = -1; /* skip rest of line and leave */
} }
} }
@ -445,7 +445,7 @@ find_long_option( ARGPARSE_ARGS *arg,
int int
arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts) arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
{ {
int index; int idx;
int argc; int argc;
char **argv; char **argv;
char *s, *s2; char *s, *s2;
@ -454,10 +454,10 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
initialize( arg, NULL, NULL ); initialize( arg, NULL, NULL );
argc = *arg->argc; argc = *arg->argc;
argv = *arg->argv; argv = *arg->argv;
index = arg->internal.index; idx = arg->internal.idx;
if( !index && argc && !(arg->flags & (1<<4)) ) { /* skip the first entry */ if( !idx && argc && !(arg->flags & (1<<4)) ) { /* skip the first entry */
argc--; argv++; index++; argc--; argv++; idx++;
} }
next_one: next_one:
@ -473,7 +473,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
arg->r_opt = -1; /* not an option but a argument */ arg->r_opt = -1; /* not an option but a argument */
arg->r_type = 2; arg->r_type = 2;
arg->r.ret_str = s; arg->r.ret_str = s;
argc--; argv++; index++; /* set to next one */ argc--; argv++; idx++; /* set to next one */
} }
else if( arg->internal.stopped ) { /* ready */ else if( arg->internal.stopped ) { /* ready */
arg->r_opt = 0; arg->r_opt = 0;
@ -485,7 +485,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
arg->internal.inarg = 0; arg->internal.inarg = 0;
if( !s[2] && !(arg->flags & (1<<3)) ) { /* stop option processing */ if( !s[2] && !(arg->flags & (1<<3)) ) { /* stop option processing */
arg->internal.stopped = 1; arg->internal.stopped = 1;
argc--; argv++; index++; argc--; argv++; idx++;
goto next_one; goto next_one;
} }
@ -548,7 +548,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
else { else {
set_opt_arg(arg, opts[i].flags, s2); set_opt_arg(arg, opts[i].flags, s2);
if( !argpos ) { if( !argpos ) {
argc--; argv++; index++; /* skip one */ argc--; argv++; idx++; /* skip one */
} }
} }
} }
@ -558,7 +558,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
else else
arg->r_type = 0; arg->r_type = 0;
} }
argc--; argv++; index++; /* set to next one */ argc--; argv++; idx++; /* set to next one */
} }
else if( (*s == '-' && s[1]) || arg->internal.inarg ) { /* short option */ else if( (*s == '-' && s[1]) || arg->internal.inarg ) { /* short option */
int dash_kludge = 0; int dash_kludge = 0;
@ -611,7 +611,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
} }
else { else {
set_opt_arg(arg, opts[i].flags, s2); set_opt_arg(arg, opts[i].flags, s2);
argc--; argv++; index++; /* skip one */ argc--; argv++; idx++; /* skip one */
} }
} }
s = "x"; /* so that !s[1] yields false */ s = "x"; /* so that !s[1] yields false */
@ -622,14 +622,14 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
} }
if( !s[1] || dash_kludge ) { /* no more concatenated short options */ if( !s[1] || dash_kludge ) { /* no more concatenated short options */
arg->internal.inarg = 0; arg->internal.inarg = 0;
argc--; argv++; index++; argc--; argv++; idx++;
} }
} }
else if( arg->flags & (1<<2) ) { else if( arg->flags & (1<<2) ) {
arg->r_opt = -1; /* not an option but a argument */ arg->r_opt = -1; /* not an option but a argument */
arg->r_type = 2; arg->r_type = 2;
arg->r.ret_str = s; arg->r.ret_str = s;
argc--; argv++; index++; /* set to next one */ argc--; argv++; idx++; /* set to next one */
} }
else { else {
arg->internal.stopped = 1; /* stop option processing */ arg->internal.stopped = 1; /* stop option processing */
@ -639,7 +639,7 @@ arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts)
leave: leave:
*arg->argc = argc; *arg->argc = argc;
*arg->argv = argv; *arg->argv = argv;
arg->internal.index = index; arg->internal.idx = idx;
return arg->r_opt; return arg->r_opt;
} }

View File

@ -85,7 +85,7 @@ create_dotlock( const char *file_to_lock )
h = m_alloc_clear( sizeof *h ); h = m_alloc_clear( sizeof *h );
#ifndef HAVE_DOSISH_SYSTEM #ifndef HAVE_DOSISH_SYSTEM
sprintf( pidstr, "%10d\n", getpid() ); sprintf( pidstr, "%10d\n", (int)getpid() );
/* fixme: add the hostname to the second line (FQDN or IP addr?) */ /* fixme: add the hostname to the second line (FQDN or IP addr?) */
/* create a temporary file */ /* create a temporary file */
@ -298,12 +298,13 @@ read_lockfile( const char *name )
errno = e; errno = e;
return -1; return -1;
} }
if( read(fd, pidstr, 10 ) != 10 ) { if( read(fd, pidstr, 10 ) != 10 ) { /* Read 10 digits w/o newline */
log_debug("error reading lockfile `%s'", name ); log_debug("error reading lockfile `%s'", name );
close(fd); close(fd);
errno = 0; errno = 0;
return -1; return -1;
} }
pidstr[10] = 0; /* terminate pid string */
close(fd); close(fd);
pid = atoi(pidstr); pid = atoi(pidstr);
if( !pid || pid == -1 ) { if( !pid || pid == -1 ) {

View File

@ -61,7 +61,7 @@ static byte *build_rel_path( PARSED_URI uri );
static int parse_response( HTTP_HD hd ); static int parse_response( HTTP_HD hd );
static int connect_server( const char *server, ushort port ); static int connect_server( const char *server, ushort port );
static int write_server( int socket, const char *data, size_t length ); static int write_server( int sock, const char *data, size_t length );
int int
@ -75,7 +75,7 @@ http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
/* initialize the handle */ /* initialize the handle */
memset( hd, 0, sizeof *hd ); memset( hd, 0, sizeof *hd );
hd->socket = -1; hd->sock = -1;
hd->initialized = 1; hd->initialized = 1;
hd->req_type = reqtype; hd->req_type = reqtype;
@ -83,15 +83,15 @@ http_open( HTTP_HD hd, HTTP_REQ_TYPE reqtype, const char *url,
if( !rc ) { if( !rc ) {
rc = send_request( hd ); rc = send_request( hd );
if( !rc ) { if( !rc ) {
hd->fp_write = iobuf_fdopen( hd->socket , "w" ); hd->fp_write = iobuf_fdopen( hd->sock , "w" );
if( hd->fp_write ) if( hd->fp_write )
return 0; return 0;
rc = G10ERR_GENERAL; rc = G10ERR_GENERAL;
} }
} }
if( !hd->fp_read && !hd->fp_write && hd->socket != -1 ) if( !hd->fp_read && !hd->fp_write && hd->sock != -1 )
close( hd->socket ); close( hd->sock );
iobuf_close( hd->fp_read ); iobuf_close( hd->fp_read );
iobuf_close( hd->fp_write); iobuf_close( hd->fp_write);
release_parsed_uri( hd->uri ); release_parsed_uri( hd->uri );
@ -119,15 +119,15 @@ http_wait_response( HTTP_HD hd, unsigned int *ret_status )
http_start_data( hd ); /* make sure that we are in the data */ http_start_data( hd ); /* make sure that we are in the data */
iobuf_flush( hd->fp_write ); iobuf_flush( hd->fp_write );
hd->socket = dup( hd->socket ); hd->sock = dup( hd->sock );
if( hd->socket == -1 ) if( hd->sock == -1 )
return G10ERR_GENERAL; return G10ERR_GENERAL;
iobuf_close( hd->fp_write ); iobuf_close( hd->fp_write );
hd->fp_write = NULL; hd->fp_write = NULL;
shutdown( hd->socket, 1 ); shutdown( hd->sock, 1 );
hd->in_data = 0; hd->in_data = 0;
hd->fp_read = iobuf_fdopen( hd->socket , "r" ); hd->fp_read = iobuf_fdopen( hd->sock , "r" );
if( !hd->fp_read ) if( !hd->fp_read )
return G10ERR_GENERAL; return G10ERR_GENERAL;
@ -166,8 +166,8 @@ http_close( HTTP_HD hd )
{ {
if( !hd || !hd->initialized ) if( !hd || !hd->initialized )
return; return;
if( !hd->fp_read && !hd->fp_write && hd->socket != -1 ) if( !hd->fp_read && !hd->fp_write && hd->sock != -1 )
close( hd->socket ); close( hd->sock );
iobuf_close( hd->fp_read ); iobuf_close( hd->fp_read );
iobuf_close( hd->fp_write ); iobuf_close( hd->fp_write );
release_parsed_uri( hd->uri ); release_parsed_uri( hd->uri );
@ -427,8 +427,8 @@ send_request( HTTP_HD hd )
server = *hd->uri->host? hd->uri->host : "localhost"; server = *hd->uri->host? hd->uri->host : "localhost";
port = hd->uri->port? hd->uri->port : 80; port = hd->uri->port? hd->uri->port : 80;
hd->socket = connect_server( server, port ); hd->sock = connect_server( server, port );
if( hd->socket == -1 ) if( hd->sock == -1 )
return G10ERR_NETWORK; return G10ERR_NETWORK;
p = build_rel_path( hd->uri ); p = build_rel_path( hd->uri );
@ -440,7 +440,7 @@ send_request( HTTP_HD hd )
*p == '/'? "":"/", p ); *p == '/'? "":"/", p );
m_free(p); m_free(p);
rc = write_server( hd->socket, request, strlen(request) ); rc = write_server( hd->sock, request, strlen(request) );
m_free( request ); m_free( request );
return rc; return rc;
@ -656,13 +656,13 @@ connect_server( const char *server, ushort port )
static int static int
write_server( int socket, const char *data, size_t length ) write_server( int sock, const char *data, size_t length )
{ {
int nleft, nwritten; int nleft, nwritten;
nleft = length; nleft = length;
while( nleft > 0 ) { while( nleft > 0 ) {
nwritten = write( socket, data, nleft ); nwritten = write( sock, data, nleft );
if( nwritten == -1 ) { if( nwritten == -1 ) {
if( errno == EINTR ) if( errno == EINTR )
continue; continue;

View File

@ -46,7 +46,7 @@ typedef struct {
#define OP_MIN_PARTIAL_CHUNK_2POW 9 #define OP_MIN_PARTIAL_CHUNK_2POW 9
typedef struct { typedef struct {
int usage; int use;
size_t size; size_t size;
size_t count; size_t count;
int partial; /* 1 = partial header, 2 in last partial packet */ int partial; /* 1 = partial header, 2 in last partial packet */
@ -340,7 +340,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
log_debug("init block_filter %p\n", a ); log_debug("init block_filter %p\n", a );
if( a->partial ) if( a->partial )
a->count = 0; a->count = 0;
else if( a->usage == 1 ) else if( a->use == 1 )
a->count = a->size = 0; a->count = a->size = 0;
else else
a->count = a->size; /* force first length bytes */ a->count = a->size; /* force first length bytes */
@ -352,7 +352,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
*(char**)buf = "block_filter"; *(char**)buf = "block_filter";
} }
else if( control == IOBUFCTRL_FREE ) { else if( control == IOBUFCTRL_FREE ) {
if( a->usage == 2 ) { /* write the end markers */ if( a->use == 2 ) { /* write the end markers */
if( a->partial ) { if( a->partial ) {
u32 len; u32 len;
/* write out the remaining bytes without a partial header /* write out the remaining bytes without a partial header
@ -426,17 +426,17 @@ print_chain( IOBUF a )
/**************** /****************
* Allocate a new io buffer, with no function assigned. * Allocate a new io buffer, with no function assigned.
* Usage is the desired usage: 1 for input, 2 for output, 3 for temp buffer * Use is the desired usage: 1 for input, 2 for output, 3 for temp buffer
* BUFSIZE is a suggested buffer size. * BUFSIZE is a suggested buffer size.
*/ */
IOBUF IOBUF
iobuf_alloc(int usage, size_t bufsize) iobuf_alloc(int use, size_t bufsize)
{ {
IOBUF a; IOBUF a;
static int number=0; static int number=0;
a = m_alloc_clear(sizeof *a); a = m_alloc_clear(sizeof *a);
a->usage = usage; a->use = use;
a->d.buf = m_alloc( bufsize ); a->d.buf = m_alloc( bufsize );
a->d.size = bufsize; a->d.size = bufsize;
a->no = ++number; a->no = ++number;
@ -462,7 +462,7 @@ iobuf_close( IOBUF a )
for( ; a && !rc ; a = a2 ) { for( ; a && !rc ; a = a2 ) {
a2 = a->chain; a2 = a->chain;
if( a->usage == 2 && (rc=iobuf_flush(a)) ) if( a->use == 2 && (rc=iobuf_flush(a)) )
log_error("iobuf_flush failed on close: %s\n", g10_errstr(rc)); log_error("iobuf_flush failed on close: %s\n", g10_errstr(rc));
if( DBG_IOBUF ) if( DBG_IOBUF )
@ -481,7 +481,7 @@ iobuf_cancel( IOBUF a )
{ {
const char *s; const char *s;
if( a && a->usage == 2 ) { if( a && a->use == 2 ) {
s = get_real_fname(a); s = get_real_fname(a);
if( s && *s ) if( s && *s )
remove(s); /* remove the file. Fixme: this will fail for MSDOZE*/ remove(s); /* remove the file. Fixme: this will fail for MSDOZE*/
@ -720,7 +720,7 @@ iobuf_push_filter( IOBUF a,
if( a->directfp ) if( a->directfp )
BUG(); BUG();
if( a->usage == 2 && (rc=iobuf_flush(a)) ) if( a->use == 2 && (rc=iobuf_flush(a)) )
return rc; return rc;
/* make a copy of the current stream, so that /* make a copy of the current stream, so that
* A is the new stream and B the original one. * A is the new stream and B the original one.
@ -733,10 +733,10 @@ iobuf_push_filter( IOBUF a,
a->filter = NULL; a->filter = NULL;
a->filter_ov = NULL; a->filter_ov = NULL;
a->filter_eof = 0; a->filter_eof = 0;
if( a->usage == 3 ) if( a->use == 3 )
a->usage = 2; /* make a write stream from a temp stream */ a->use = 2; /* make a write stream from a temp stream */
if( a->usage == 2 ) { /* allocate a fresh buffer for the original stream */ if( a->use == 2 ) { /* allocate a fresh buffer for the original stream */
b->d.buf = m_alloc( a->d.size ); b->d.buf = m_alloc( a->d.size );
b->d.len = 0; b->d.len = 0;
b->d.start = 0; b->d.start = 0;
@ -805,7 +805,7 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control,
log_bug("iobuf_pop_filter(): filter function not found\n"); log_bug("iobuf_pop_filter(): filter function not found\n");
/* flush this stream if it is an output stream */ /* flush this stream if it is an output stream */
if( a->usage == 2 && (rc=iobuf_flush(b)) ) { if( a->use == 2 && (rc=iobuf_flush(b)) ) {
log_error("iobuf_flush failed in pop_filter: %s\n", g10_errstr(rc)); log_error("iobuf_flush failed in pop_filter: %s\n", g10_errstr(rc));
return rc; return rc;
} }
@ -853,7 +853,7 @@ underflow(IOBUF a)
int rc; int rc;
assert( a->d.start == a->d.len ); assert( a->d.start == a->d.len );
if( a->usage == 3 ) if( a->use == 3 )
return -1; /* EOF because a temp buffer can't do an underflow */ return -1; /* EOF because a temp buffer can't do an underflow */
if( a->filter_eof ) { if( a->filter_eof ) {
@ -909,7 +909,7 @@ underflow(IOBUF a)
#endif #endif
} }
if( a->usage == 1 && rc == -1 ) { /* EOF: we can remove the filter */ if( a->use == 1 && rc == -1 ) { /* EOF: we can remove the filter */
size_t dummy_len; size_t dummy_len;
/* and tell the filter to free itself */ /* and tell the filter to free itself */
@ -965,7 +965,7 @@ iobuf_flush(IOBUF a)
return 0; return 0;
/*log_debug("iobuf-%d.%d: flush\n", a->no, a->subno );*/ /*log_debug("iobuf-%d.%d: flush\n", a->no, a->subno );*/
if( a->usage == 3 ) { /* increase the temp buffer */ if( a->use == 3 ) { /* increase the temp buffer */
char *newbuf; char *newbuf;
size_t newsize = a->d.size + 8192; size_t newsize = a->d.size + 8192;
@ -978,7 +978,7 @@ iobuf_flush(IOBUF a)
a->d.size = newsize; a->d.size = newsize;
return 0; return 0;
} }
else if( a->usage != 2 ) else if( a->use != 2 )
log_bug("flush on non-output iobuf\n"); log_bug("flush on non-output iobuf\n");
else if( !a->filter ) else if( !a->filter )
log_bug("iobuf_flush: no filter\n"); log_bug("iobuf_flush: no filter\n");
@ -1332,15 +1332,15 @@ iobuf_set_block_mode( IOBUF a, size_t n )
{ {
block_filter_ctx_t *ctx = m_alloc_clear( sizeof *ctx ); block_filter_ctx_t *ctx = m_alloc_clear( sizeof *ctx );
assert( a->usage == 1 || a->usage == 2 ); assert( a->use == 1 || a->use == 2 );
ctx->usage = a->usage; ctx->use = a->use;
if( !n ) { if( !n ) {
if( a->usage == 1 ) if( a->use == 1 )
log_debug("pop_filter called in set_block_mode - please report\n"); log_debug("pop_filter called in set_block_mode - please report\n");
pop_filter(a, block_filter, NULL ); pop_filter(a, block_filter, NULL );
} }
else { else {
ctx->size = n; /* only needed for usage 2 */ ctx->size = n; /* only needed for use 2 */
iobuf_push_filter(a, block_filter, ctx ); iobuf_push_filter(a, block_filter, ctx );
} }
} }
@ -1354,10 +1354,10 @@ iobuf_set_partial_block_mode( IOBUF a, size_t len )
{ {
block_filter_ctx_t *ctx = m_alloc_clear( sizeof *ctx ); block_filter_ctx_t *ctx = m_alloc_clear( sizeof *ctx );
assert( a->usage == 1 || a->usage == 2 ); assert( a->use == 1 || a->use == 2 );
ctx->usage = a->usage; ctx->use = a->use;
if( !len ) { if( !len ) {
if( a->usage == 1 ) if( a->use == 1 )
log_debug("pop_filter called in set_partial_block_mode" log_debug("pop_filter called in set_partial_block_mode"
" - please report\n"); " - please report\n");
pop_filter(a, block_filter, NULL ); pop_filter(a, block_filter, NULL );

View File

@ -71,7 +71,7 @@ static int suspend_warning;
static void static void
print_warn() print_warn(void)
{ {
if( !no_warning ) if( !no_warning )
log_info(_("Warning: using insecure memory!\n")); log_info(_("Warning: using insecure memory!\n"));

View File

@ -67,6 +67,7 @@ add_to_strlist( STRLIST *list, const char *string )
STRLIST sl; STRLIST sl;
sl = m_alloc( sizeof *sl + strlen(string)); sl = m_alloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string); strcpy(sl->d, string);
sl->next = *list; sl->next = *list;
*list = sl; *list = sl;
@ -79,6 +80,7 @@ append_to_strlist( STRLIST *list, const char *string )
STRLIST r, sl; STRLIST r, sl;
sl = m_alloc( sizeof *sl + strlen(string)); sl = m_alloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string); strcpy(sl->d, string);
sl->next = NULL; sl->next = NULL;
if( !*list ) if( !*list )

View File

@ -76,7 +76,7 @@ cleanup(void)
#endif #endif
static void static void
init_ttyfp() init_ttyfp(void)
{ {
if( initialized ) if( initialized )
return; return;