diff options
author | Werner Koch <wk@gnupg.org> | 1998-02-03 13:09:20 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1998-02-03 13:09:20 +0100 |
commit | 899b8378eca7a3801d02bab5fb4cd13dfb6a8595 (patch) | |
tree | 71b685933a39dfbdc7d6801775dc2c6ff99aeddf /g10 | |
parent | changed structure of trustdb (diff) | |
download | gnupg2-899b8378eca7a3801d02bab5fb4cd13dfb6a8595.tar.xz gnupg2-899b8378eca7a3801d02bab5fb4cd13dfb6a8595.zip |
Fixed a few bugs
Diffstat (limited to 'g10')
-rw-r--r-- | g10/Makefile.in | 1 | ||||
-rw-r--r-- | g10/armor.c | 2 | ||||
-rw-r--r-- | g10/build-packet.c | 6 | ||||
-rw-r--r-- | g10/compress.c | 1 | ||||
-rw-r--r-- | g10/g10.c | 7 | ||||
-rw-r--r-- | g10/g10maint.c | 1 | ||||
-rw-r--r-- | g10/getkey.c | 8 | ||||
-rw-r--r-- | g10/mainproc.c | 4 | ||||
-rw-r--r-- | g10/parse-packet.c | 12 | ||||
-rw-r--r-- | g10/ringedit.c | 1 | ||||
-rw-r--r-- | g10/seckey-cert.c | 2 | ||||
-rw-r--r-- | g10/sign.c | 6 | ||||
-rw-r--r-- | g10/status.c | 1 | ||||
-rw-r--r-- | g10/trustdb.c | 8 |
14 files changed, 34 insertions, 26 deletions
diff --git a/g10/Makefile.in b/g10/Makefile.in index 68c10cba3..808d99fdb 100644 --- a/g10/Makefile.in +++ b/g10/Makefile.in @@ -72,6 +72,7 @@ G10_LOCALEDIR = @G10_LOCALEDIR@ GENCAT = @GENCAT@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ +HAVE_ZLIB_H = @HAVE_ZLIB_H@ INSTOBJEXT = @INSTOBJEXT@ INTLDEPS = @INTLDEPS@ INTLLIBS = @INTLLIBS@ diff --git a/g10/armor.c b/g10/armor.c index 3a6fc41f3..7269b325a 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -698,7 +698,7 @@ armor_filter( void *opaque, int control, iobuf_writestr(a, head_strings[afx->what] ); iobuf_writestr(a, "-----\n"); iobuf_writestr(a, "Version: G10 pre-release " VERSION "\n"); - iobuf_writestr(a, "Comment: This is a alpha test version!\n\n"); + iobuf_writestr(a, "Comment: This is an alpha test version!\n\n"); afx->status++; afx->idx = 0; afx->idx2 = 0; diff --git a/g10/build-packet.c b/g10/build-packet.c index b0fd0859a..2e1a48337 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -211,7 +211,7 @@ hash_public_cert( MD_HANDLE md, PKT_public_cert *pkc ) int rc = 0; int c; IOBUF a = iobuf_temp(); - FILE *fp = fopen("dump.pkc", "a"); + /* FILE *fp = fopen("dump.pkc", "a");*/ /* build the packet */ init_packet(&pkt); @@ -220,10 +220,10 @@ hash_public_cert( MD_HANDLE md, PKT_public_cert *pkc ) if( (rc = build_packet( a, &pkt )) ) log_fatal("build public_cert for hashing failed: %s\n", g10_errstr(rc)); while( (c=iobuf_get(a)) != -1 ) { - putc( c, fp); + /* putc( c, fp);*/ md_putc( md, c ); } - fclose(fp); + /*fclose(fp);*/ iobuf_cancel(a); } diff --git a/g10/compress.c b/g10/compress.c index 8f8b5e6de..c237b4ac7 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -234,7 +234,6 @@ compress_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) { size_t size = *ret_len; - compress_filter_context_t *zfx = opaque; int c, rc=0; size_t n; @@ -146,6 +146,9 @@ set_cmd( enum cmd_values *ret_cmd, enum cmd_values new_cmd ) cmd = aSignEncr; else if( cmd == aKMode && new_cmd == aSym ) cmd = aKModeC; + else if( ( cmd == aSign && new_cmd == aClearsig ) + || ( cmd == aClearsig && new_cmd == aSign ) ) + cmd = aClearsig; else { log_error(_("conflicting commands\n")); g10_exit(2); @@ -294,11 +297,11 @@ main( int argc, char **argv ) break; case 'z': opt.compress = pargs.r.ret_int; break; case 'a': opt.armor = 1; opt.no_armor=0; break; + case 'd': break; /* it is default */ case 'c': set_cmd( &cmd , aSym); break; case 'o': opt.outfile = pargs.r.ret_str; break; case 'e': set_cmd( &cmd, aEncr); break; - case 'b': detached_sig = 1; - /* fall trough */ + case 'b': detached_sig = 1; /* fall trough */ case 's': set_cmd( &cmd, aSign ); break; case 't': set_cmd( &cmd , aClearsig); break; case 'u': /* store the local users */ diff --git a/g10/g10maint.c b/g10/g10maint.c index f02bb11e7..a6ba7dc63 100644 --- a/g10/g10maint.c +++ b/g10/g10maint.c @@ -179,6 +179,7 @@ main( int argc, char **argv ) { 526, "no-verbose", 0, "\r"}, { 531, "list-trustdb",0 , "\r"}, { 533, "list-trust-path",0, "\r"}, + { 532, "quick-random", 0, "\r"}, { 534, "no-comment", 0, N_("do not write comment packets")}, { 535, "completes-needed", 1, N_("(default is 1)")}, { 536, "marginals-needed", 1, N_("(default is 3)")}, diff --git a/g10/getkey.c b/g10/getkey.c index eea9b6beb..6564f1095 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -454,12 +454,12 @@ scan_keyring( PKT_public_cert *pkc, u32 *keyid, if( !DBG_CACHE ) ; else if( shortkeyid ) - log_debug("scan_keyring %s for %08lx\n", filename, keyid[1] ); + log_debug("scan_keyring %s for %08lx\n", filename, (ulong)keyid[1] ); else if( name ) log_debug("scan_keyring %s for '%s'\n", filename, name ); else if( keyid ) log_debug("scan_keyring %s for %08lx %08lx\n", filename, - keyid[0], keyid[1] ); + (ulong)keyid[0], (ulong)keyid[1] ); else log_debug("scan_keyring %s (all)\n", filename ); @@ -740,12 +740,12 @@ get_user_id_string( u32 *keyid ) for(r=user_id_db; r; r = r->next ) if( r->keyid[0] == keyid[0] && r->keyid[1] == keyid[1] ) { p = m_alloc( r->len + 10 ); - sprintf(p, "%08lX %.*s", keyid[1], r->len, r->name ); + sprintf(p, "%08lX %.*s", (ulong)keyid[1], r->len, r->name ); return p; } } while( ++pass < 2 && !get_pubkey( NULL, keyid ) ); p = m_alloc( 15 ); - sprintf(p, "%08lX [?]", keyid[1] ); + sprintf(p, "%08lX [?]", (ulong)keyid[1] ); return p; } diff --git a/g10/mainproc.c b/g10/mainproc.c index 607d7125a..70a50c615 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -476,7 +476,7 @@ list_node( CTX c, KBNODE node ) } } printf("%c %08lX %s ", - sigrc, sig->keyid[1], datestr_from_sig(sig)); + sigrc, (ulong)sig->keyid[1], datestr_from_sig(sig)); if( sigrc == '%' ) printf("[%s] ", g10_errstr(rc2) ); else if( sigrc == '?' ) @@ -597,7 +597,7 @@ check_sig_and_print( CTX c, KBNODE node ) else { write_status( STATUS_ERRSIG ); log_error("Can't check signature made by %08lX: %s\n", - sig->keyid[1], g10_errstr(rc) ); + (ulong)sig->keyid[1], g10_errstr(rc) ); } return rc; } diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 1a11ec467..886bc66e3 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -343,7 +343,7 @@ parse_publickey( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet ) k->pubkey_algo = iobuf_get_noeof(inp); pktlen--; if( list_mode ) printf(":public key encoded packet: keyid %08lX%08lX\n", - k->keyid[0], k->keyid[1]); + (ulong)k->keyid[0], (ulong)k->keyid[1]); if( k->pubkey_algo == PUBKEY_ALGO_ELGAMAL ) { n = pktlen; k->d.elg.a = mpi_read(inp, &n, 0); pktlen -=n; @@ -400,8 +400,8 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen, if( list_mode ) printf(":signature packet: keyid %08lX%08lX\n" "\tversion %d, created %lu, md5len %d, sigclass %02x\n", - sig->keyid[0], sig->keyid[1], - version, sig->timestamp, md5_len, sig->sig_class ); + (ulong)sig->keyid[0], (ulong)sig->keyid[1], + version, (ulong)sig->timestamp, md5_len, sig->sig_class ); if( sig->pubkey_algo == PUBKEY_ALGO_ELGAMAL ) { if( pktlen < 5 ) { log_error("packet(%d) too short\n", pkttype); @@ -477,7 +477,7 @@ parse_onepass_sig( IOBUF inp, int pkttype, unsigned long pktlen, if( list_mode ) printf(":onepass_sig packet: keyid %08lX%08lX\n" "\tversion %d, sigclass %02x, digest %d, pubkey %d, last=%d\n", - ops->keyid[0], ops->keyid[1], + (ulong)ops->keyid[0], (ulong)ops->keyid[1], version, ops->sig_class, ops->digest_algo, ops->pubkey_algo, ops->last ); @@ -832,14 +832,14 @@ parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt ) printf(":literal data packet:\n" "\tmode %c, created %lu, name=\"", mode >= ' ' && mode <'z'? mode : '?', - pt->timestamp ); + (ulong)pt->timestamp ); for(p=pt->name,i=0; i < namelen; p++, i++ ) { if( *p >= ' ' && *p <= 'z' ) putchar(*p); else printf("\\x%02x", *p ); } - printf("\",\n\traw data: %lu bytes\n", pt->len ); + printf("\",\n\traw data: %lu bytes\n", (ulong)pt->len ); } leave: diff --git a/g10/ringedit.c b/g10/ringedit.c index ad5706c1e..61f915c17 100644 --- a/g10/ringedit.c +++ b/g10/ringedit.c @@ -680,6 +680,7 @@ keyring_delete( KBPOS *kbpos ) } len = kbpos->length; + assert( len < 100000 ); /* there is a bug somewhere */ /*log_debug("writing a dummy packet of length %lu\n", (ulong)len);*/ if( len < 2 ) diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c index 0fa297914..855e3d1b9 100644 --- a/g10/seckey-cert.c +++ b/g10/seckey-cert.c @@ -317,7 +317,7 @@ protect_secret_key( PKT_secret_cert *cert, DEK *dek ) if( cert->pubkey_algo == PUBKEY_ALGO_ELGAMAL ) return protect_elg( cert, dek ); - #ifdef 0 /* noy yet implemented */ + #if 0 /* noy yet implemented */ else if( cert->pubkey_algo == PUBKEY_ALGO_RSA ) return protect_rsa( cert, dek ); #endif diff --git a/g10/sign.c b/g10/sign.c index 31fe2bd05..ee9b98254 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -570,7 +570,8 @@ sign_key( const char *username, STRLIST locusr ) && (node->pkt->pkt.signature->sig_class&~3) == 0x10 ) { if( akeyid[0] == node->pkt->pkt.signature->keyid[0] && akeyid[1] == node->pkt->pkt.signature->keyid[1] ) { - log_info("Already signed by keyid %08lX\n", akeyid[1] ); + log_info("Already signed by keyid %08lX\n", + (ulong)akeyid[1] ); skc_rover->mark = 1; } } @@ -833,7 +834,7 @@ make_keysig_packet( PKT_signature **ret_sig, PKT_public_cert *pkc, assert( sigclass >= 0x10 && sigclass <= 0x13 ); md = md_open( digest_algo, 0 ); - /* hash the public key certificate */ + /* hash the public key certificate and the user id */ hash_public_cert( md, pkc ); md_write( md, uid->name, uid->len ); /* and make the signature packet */ @@ -849,6 +850,7 @@ make_keysig_packet( PKT_signature **ret_sig, PKT_public_cert *pkc, md_putc( md, (a >> 8) & 0xff ); md_putc( md, a & 0xff ); } + md_final(md); rc = complete_sig( sig, skc, md ); diff --git a/g10/status.c b/g10/status.c index 6c660b7ee..baae1e96e 100644 --- a/g10/status.c +++ b/g10/status.c @@ -21,6 +21,7 @@ #include <config.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include "status.h" diff --git a/g10/trustdb.c b/g10/trustdb.c index 116d2679f..d317a665a 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -371,8 +371,8 @@ dump_record( ulong rnum, TRUSTREC *rec, FILE *fp ) case RECTYPE_VER: fprintf(fp, "version\n"); break; case RECTYPE_DIR: - fprintf(fp, "dir keyid=%08lx, key=%lu, ctl=%lu, sig=%lu", - rec->r.dir.keyid[1], + fprintf(fp, "dir keyid=%08lX, key=%lu, ctl=%lu, sig=%lu", + (ulong)rec->r.dir.keyid[1], rec->r.dir.keyrec, rec->r.dir.ctlrec, rec->r.dir.sigrec ); if( rec->r.dir.no_sigs == 1 ) fputs(", (none)", fp ); @@ -382,8 +382,8 @@ dump_record( ulong rnum, TRUSTREC *rec, FILE *fp ) fputs(", (revoked)", fp ); putc('\n', fp); break; - case RECTYPE_KEY: fprintf(fp, "key keyid=%08lx, own=%lu, ownertrust=%02x\n", - rec->r.key.keyid[1], + case RECTYPE_KEY: fprintf(fp, "key keyid=%08lX, own=%lu, ownertrust=%02x\n", + (ulong)rec->r.key.keyid[1], rec->r.key.owner, rec->r.key.ownertrust ); break; case RECTYPE_CTL: fprintf(fp, "ctl\n"); |