diff --git a/g10/ChangeLog b/g10/ChangeLog index 2703fe34e..eb4feec56 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,17 @@ +2002-06-15 David Shaw + + * keygen.c (keygen_add_revkey): Remove unused code. + + * misc.c (check_permissions): Check directory permissions + properly - they are not special files. + + * pkclist.c (expand_id, expand_group, build_pk_list): When + expanding groups before building a pk list, inherit flags from the + original pre-expanded string. + + * pubkey-enc.c (is_algo_in_prefs): Don't use prefs from expired + uids. + 2002-06-14 David Shaw * free-packet.c (copy_signature): Properly copy a signature that diff --git a/g10/keygen.c b/g10/keygen.c index 7a9e78bd2..4f9becbfe 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -505,9 +505,6 @@ keygen_add_revkey(PKT_signature *sig, void *opaque) build_sig_subpkt(sig,SIGSUBPKT_REV_KEY,buf,2+MAX_FINGERPRINT_LEN); - sig->revkey=m_realloc(sig->revkey, - sizeof(struct revocation_key *)*(sig->numrevkeys+1)); - /* All sigs with revocation keys set are nonrevocable */ sig->flags.revocable=0; buf[0] = 0; diff --git a/g10/misc.c b/g10/misc.c index 8e541905d..54c1239b6 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -368,16 +368,16 @@ check_permissions(const char *path,int extension,int checkonly) goto end; } + isdir=S_ISDIR(statbuf.st_mode); + /* We may have to revisit this if we start piping keyrings to gpg over a named pipe or keyserver character device :) */ - if(!S_ISREG(statbuf.st_mode)) + if(!isdir && !S_ISREG(statbuf.st_mode)) { ret=0; goto end; } - isdir=S_ISDIR(statbuf.st_mode); - /* Per-user files must be owned by the user. Extensions must be owned by the user or root. */ if((!extension && statbuf.st_uid != getuid()) || diff --git a/g10/pkclist.c b/g10/pkclist.c index 83cca6684..70e551fad 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -691,7 +691,7 @@ default_recipient(void) } static int -expand_id(const char *id,STRLIST *into) +expand_id(const char *id,STRLIST *into,unsigned int flags) { struct groupitem *groups; int count=0; @@ -707,7 +707,7 @@ expand_id(const char *id,STRLIST *into) for(each=groups->values;each;each=each->next) { sl=add_to_strlist(into,each->d); - sl->flags=each->flags; + sl->flags=flags; count++; } @@ -726,7 +726,7 @@ expand_group(STRLIST input) STRLIST sl,output=NULL,rover; for(rover=input;rover;rover=rover->next) - if(expand_id(rover->d,&output)==0) + if(expand_id(rover->d,&output,rover->flags)==0) { /* Didn't find any groups, so use the existing string */ sl=add_to_strlist(&output,rover->d); @@ -821,7 +821,7 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use ) m_free(answer); break; } - if(expand_id(answer,&backlog)) + if(expand_id(answer,&backlog,0)) continue; if( pk ) free_public_key( pk ); diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index 99e7dd648..2c8771c27 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -50,7 +50,8 @@ is_algo_in_prefs ( KBNODE keyblock, preftype_t type, int algo ) PKT_user_id *uid = k->pkt->pkt.user_id; prefitem_t *prefs = uid->prefs; - if (uid->created && !uid->is_revoked && prefs ) { + if (uid->created && prefs && + !uid->is_revoked && !uid->is_expired ) { for (; prefs->type; prefs++ ) if (prefs->type == type && prefs->value == algo) return 1; @@ -62,7 +63,7 @@ is_algo_in_prefs ( KBNODE keyblock, preftype_t type, int algo ) /**************** - * Get the session key from a pubkey enc paket and return + * Get the session key from a pubkey enc packet and return * it in DEK, which should have been allocated in secure memory. */ int