mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
* pkclist.c (expand_id, expand_group, build_pk_list): Groups now work
properly when used in the "Enter the user ID" prompt.
This commit is contained in:
parent
0686d7c10c
commit
c5a82f99dc
@ -1,3 +1,8 @@
|
|||||||
|
2002-06-14 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* pkclist.c (expand_id, expand_group, build_pk_list): Groups now
|
||||||
|
work properly when used in the "Enter the user ID" prompt.
|
||||||
|
|
||||||
2002-06-14 David Shaw <dshaw@jabberwocky.com>
|
2002-06-14 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* keyedit.c (show_key_with_all_names): Display warning if a user
|
* keyedit.c (show_key_with_all_names): Display warning if a user
|
||||||
|
@ -690,42 +690,48 @@ default_recipient(void)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
expand_id(const char *id,STRLIST *into)
|
||||||
|
{
|
||||||
|
struct groupitem *groups;
|
||||||
|
int count=0;
|
||||||
|
|
||||||
|
for(groups=opt.grouplist;groups;groups=groups->next)
|
||||||
|
{
|
||||||
|
/* need strcasecmp() here, as this should be localized */
|
||||||
|
if(strcasecmp(groups->name,id)==0)
|
||||||
|
{
|
||||||
|
STRLIST each,sl;
|
||||||
|
|
||||||
|
/* this maintains the current utf8-ness */
|
||||||
|
for(each=groups->values;each;each=each->next)
|
||||||
|
{
|
||||||
|
sl=add_to_strlist(into,each->d);
|
||||||
|
sl->flags=each->flags;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
/* For simplicity, and to avoid potential loops, we only expand once -
|
/* For simplicity, and to avoid potential loops, we only expand once -
|
||||||
you can't make an alias that points to an alias. */
|
you can't make an alias that points to an alias. */
|
||||||
static STRLIST
|
static STRLIST
|
||||||
expand_groups(STRLIST input)
|
expand_group(STRLIST input)
|
||||||
{
|
{
|
||||||
STRLIST sl,output=NULL,rover;
|
STRLIST sl,output=NULL,rover;
|
||||||
struct groupitem *groups;
|
|
||||||
|
|
||||||
for(rover=input;rover;rover=rover->next)
|
for(rover=input;rover;rover=rover->next)
|
||||||
{
|
if(expand_id(rover->d,&output)==0)
|
||||||
for(groups=opt.grouplist;groups;groups=groups->next)
|
{
|
||||||
{
|
/* Didn't find any groups, so use the existing string */
|
||||||
/* need strcasecmp() here, as this should be localized */
|
sl=add_to_strlist(&output,rover->d);
|
||||||
if(strcasecmp(groups->name,rover->d)==0)
|
sl->flags=rover->flags;
|
||||||
{
|
}
|
||||||
STRLIST each;
|
|
||||||
|
|
||||||
/* maintain current utf8-ness */
|
|
||||||
for(each=groups->values;each;each=each->next)
|
|
||||||
{
|
|
||||||
sl=add_to_strlist(&output,each->d);
|
|
||||||
/* maintain the flags from the original */
|
|
||||||
sl->flags=each->flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Didn't find any groups, so use the existing string */
|
|
||||||
if(!groups)
|
|
||||||
{
|
|
||||||
sl=add_to_strlist(&output,rover->d);
|
|
||||||
sl->flags=rover->flags;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
@ -741,7 +747,7 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
|
|||||||
char *def_rec = NULL;
|
char *def_rec = NULL;
|
||||||
|
|
||||||
if(opt.grouplist)
|
if(opt.grouplist)
|
||||||
remusr=expand_groups(rcpts);
|
remusr=expand_group(rcpts);
|
||||||
else
|
else
|
||||||
remusr=rcpts;
|
remusr=rcpts;
|
||||||
|
|
||||||
@ -788,6 +794,7 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
|
|||||||
if( !any_recipients && !opt.batch ) { /* ask */
|
if( !any_recipients && !opt.batch ) { /* ask */
|
||||||
int have_def_rec;
|
int have_def_rec;
|
||||||
char *answer=NULL;
|
char *answer=NULL;
|
||||||
|
STRLIST backlog=NULL;
|
||||||
|
|
||||||
def_rec = default_recipient();
|
def_rec = default_recipient();
|
||||||
have_def_rec = !!def_rec;
|
have_def_rec = !!def_rec;
|
||||||
@ -801,6 +808,9 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
|
|||||||
answer = def_rec;
|
answer = def_rec;
|
||||||
def_rec = NULL;
|
def_rec = NULL;
|
||||||
}
|
}
|
||||||
|
else if(backlog) {
|
||||||
|
answer=pop_strlist(&backlog);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
answer = cpr_get_utf8("pklist.user_id.enter",
|
answer = cpr_get_utf8("pklist.user_id.enter",
|
||||||
_("\nEnter the user ID. End with an empty line: "));
|
_("\nEnter the user ID. End with an empty line: "));
|
||||||
@ -811,6 +821,8 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use )
|
|||||||
m_free(answer);
|
m_free(answer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(expand_id(answer,&backlog))
|
||||||
|
continue;
|
||||||
if( pk )
|
if( pk )
|
||||||
free_public_key( pk );
|
free_public_key( pk );
|
||||||
pk = m_alloc_clear( sizeof *pk );
|
pk = m_alloc_clear( sizeof *pk );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user