diff --git a/g10/ChangeLog b/g10/ChangeLog index b55b7e02e..2a6ad9fe9 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,17 @@ +2006-04-08 David Shaw + + * getkey.c (parse_auto_key_locate): Fix dupe-removal code. + + * keyedit.c (menu_backsign): Allow backsigning even if the secret + subkey doesn't have a binding signature. + + * armor.c (radix64_read): Don't report EOF when reading only a pad + (=) character. The EOF actually starts after the pad. + + * gpg.c (main): Make --export, --send-keys, --recv-keys, + --refresh-keys, and --fetch-keys follow their arguments from left + to right. Suggested by Peter Palfrader. + 2006-04-08 Werner Koch * mainproc.c (list_node): Print ring trust value only if not empty @@ -7,7 +21,7 @@ * getkey.c (user_id_not_found_utf8): New. (get_primary_uid, get_user_id): Use it. Fixes Debian bug #205028 - inthe right way. + in the right way. 2006-04-03 Werner Koch diff --git a/g10/armor.c b/g10/armor.c index 24c1ee88c..84d25daec 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -676,7 +676,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, int checkcrc=0; int rc = 0; size_t n = 0; - int idx, i; + int idx, i, onlypad=0; u32 crc; crc = afx->crc; @@ -720,6 +720,8 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, goto again; } } + else if(n==0) + onlypad=1; if( idx == 1 ) buf[n++] = val; @@ -848,7 +850,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn, } } - if( !n ) + if( !n && !onlypad ) rc = -1; *retn = n; diff --git a/g10/getkey.c b/g10/getkey.c index 16b34f00f..c9ae58c88 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -2947,7 +2947,7 @@ parse_auto_key_locate(char *options) while((tok=optsep(&options))) { - struct akl *akl,*last; + struct akl *akl,*check,*last=NULL; int dupe=0; if(tok[0]=='\0') @@ -2976,13 +2976,13 @@ parse_auto_key_locate(char *options) } /* We must maintain the order the user gave us */ - for(last=opt.auto_key_locate;last && last->next;last=last->next) + for(check=opt.auto_key_locate;check;last=check,check=check->next) { /* Check for duplicates */ - if(last && last->type==akl->type + if(check->type==akl->type && (akl->type!=AKL_SPEC || (akl->type==AKL_SPEC - && strcmp(last->spec->uri,akl->spec->uri)==0))) + && strcmp(check->spec->uri,akl->spec->uri)==0))) { dupe=1; free_akl(akl); diff --git a/g10/gpg.c b/g10/gpg.c index 1e86b2d99..e72222204 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -3399,12 +3399,17 @@ main (int argc, char **argv ) import_keys( argc? argv:NULL, argc, NULL, opt.import_options ); break; + /* TODO: There are a number of command that use this same + "make strlist, call function, report error, free strlist" + pattern. Join them together here and avoid all that + duplicated code. */ + case aExport: case aSendKeys: case aRecvKeys: sl = NULL; for( ; argc; argc--, argv++ ) - add_to_strlist2( &sl, *argv, utf8_strings ); + append_to_strlist2( &sl, *argv, utf8_strings ); if( cmd == aSendKeys ) rc=keyserver_export( sl ); else if( cmd == aRecvKeys ) @@ -3436,7 +3441,7 @@ main (int argc, char **argv ) case aRefreshKeys: sl = NULL; for( ; argc; argc--, argv++ ) - add_to_strlist2( &sl, *argv, utf8_strings ); + append_to_strlist2( &sl, *argv, utf8_strings ); rc=keyserver_refresh(sl); if(rc) log_error(_("keyserver refresh failed: %s\n"),g10_errstr(rc)); @@ -3446,7 +3451,7 @@ main (int argc, char **argv ) case aFetchKeys: sl = NULL; for( ; argc; argc--, argv++ ) - add_to_strlist2( &sl, *argv, utf8_strings ); + append_to_strlist2( &sl, *argv, utf8_strings ); rc=keyserver_fetch(sl); if(rc) log_error("key fetch failed: %s\n",g10_errstr(rc)); diff --git a/g10/keyedit.c b/g10/keyedit.c index ce31bdc8c..738c9a658 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -3711,9 +3711,6 @@ menu_backsign(KBNODE pub_keyblock,KBNODE sec_keyblock) break; } - if(!sig_sk) - continue; - /* Now we can get to work. We have a main key and secret part, a signing subkey with signature and secret part with signature. */ @@ -3744,13 +3741,16 @@ menu_backsign(KBNODE pub_keyblock,KBNODE sec_keyblock) xfree(sig_pk->pkt); sig_pk->pkt=newpkt; - /* Put the new sig into place on the seckey */ - newpkt=xmalloc_clear(sizeof(*newpkt)); - newpkt->pkttype=PKT_SIGNATURE; - newpkt->pkt.signature=copy_signature(NULL,newsig); - free_packet(sig_sk->pkt); - xfree(sig_sk->pkt); - sig_sk->pkt=newpkt; + if(sig_sk) + { + /* Put the new sig into place on the seckey */ + newpkt=xmalloc_clear(sizeof(*newpkt)); + newpkt->pkttype=PKT_SIGNATURE; + newpkt->pkt.signature=copy_signature(NULL,newsig); + free_packet(sig_sk->pkt); + xfree(sig_sk->pkt); + sig_sk->pkt=newpkt; + } modified=1; }