1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-22 19:58:29 +01:00

* keyserver.c (keyserver_search_prompt): Make sure the search string is

converted from UTF-8 before display.
This commit is contained in:
David Shaw 2004-08-23 14:39:48 +00:00
parent b27b7aea6d
commit ba0ba64b85
2 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2004-08-23 David Shaw <dshaw@jabberwocky.com>
* keyserver.c (keyserver_search_prompt): Make sure the search
string is converted from UTF-8 before display.
2004-08-19 Werner Koch <wk@g10code.de> 2004-08-19 Werner Koch <wk@g10code.de>
* seskey.c (encode_session_key): Changed the zero random byte * seskey.c (encode_session_key): Changed the zero random byte

View File

@ -598,7 +598,7 @@ show_prompt(KEYDB_SEARCH_DESC *desc,int numdesc,int count,const char *search)
/* Count and searchstr are just for cosmetics. If the count is too /* Count and searchstr are just for cosmetics. If the count is too
small, it will grow safely. If negative it disables the "Key x-y small, it will grow safely. If negative it disables the "Key x-y
of z" messages. */ of z" messages. searchstr should be UTF-8 (rather than native). */
static void static void
keyserver_search_prompt(IOBUF buffer,const char *searchstr) keyserver_search_prompt(IOBUF buffer,const char *searchstr)
{ {
@ -606,6 +606,10 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr)
unsigned int maxlen,buflen,numlines=0; unsigned int maxlen,buflen,numlines=0;
KEYDB_SEARCH_DESC *desc; KEYDB_SEARCH_DESC *desc;
byte *line=NULL; byte *line=NULL;
char *localstr=NULL;
if(searchstr)
localstr=utf8_to_native(searchstr,strlen(searchstr),0);
desc=m_alloc(count*sizeof(KEYDB_SEARCH_DESC)); desc=m_alloc(count*sizeof(KEYDB_SEARCH_DESC));
@ -686,7 +690,7 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr)
for(;;) for(;;)
{ {
if(show_prompt(desc,i,validcount?count:0,searchstr)) if(show_prompt(desc,i,validcount?count:0,localstr))
break; break;
validcount=0; validcount=0;
} }
@ -715,7 +719,7 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr)
/* screen_lines - 1 for the prompt. */ /* screen_lines - 1 for the prompt. */
if(numlines+keyrec->lines>opt.screen_lines-1) if(numlines+keyrec->lines>opt.screen_lines-1)
{ {
if(show_prompt(desc,i,validcount?count:0,searchstr)) if(show_prompt(desc,i,validcount?count:0,localstr))
break; break;
else else
numlines=0; numlines=0;
@ -733,18 +737,18 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr)
} }
} }
m_free(desc);
m_free(line);
notfound: notfound:
if(count==0) if(count==0)
{ {
if(searchstr) if(localstr)
log_info(_("key \"%s\" not found on keyserver\n"),searchstr); log_info(_("key \"%s\" not found on keyserver\n"),localstr);
else else
log_info(_("key not found on keyserver\n")); log_info(_("key not found on keyserver\n"));
return;
} }
m_free(localstr);
m_free(desc);
m_free(line);
} }
#define KEYSERVER_ARGS_KEEP " -o \"%O\" \"%I\"" #define KEYSERVER_ARGS_KEEP " -o \"%O\" \"%I\""
@ -1427,6 +1431,12 @@ keyidlist(STRLIST users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3)
(*klist)[*count].u.fpr,&dummy); (*klist)[*count].u.fpr,&dummy);
} }
/* This is a little hackish, using the skipfncvalue as a
void* pointer to the keyserver spec, but we don't need
the skipfnc here, and it saves having an additional field
for this (which would be wasted space most of the
time). */
(*klist)[*count].skipfncvalue=NULL; (*klist)[*count].skipfncvalue=NULL;
/* Are we honoring preferred keyservers? */ /* Are we honoring preferred keyservers? */