1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-25 15:27:03 +01:00

* keylist.c (list_keyblock_colon): Show 1F direct key signatures in

--with-colons listing.

* keyserver.c (keyserver_spawn): Properly handle line truncation. Don't
leak memory (~10-20 bytes) on searches.
(keyserver_search_prompt): Cleanup.

* hkp.c (hkp_search): Properly handle line truncation.
This commit is contained in:
David Shaw 2002-09-19 16:32:44 +00:00
parent 32a3f9ec4b
commit d477cf2bfb
4 changed files with 30 additions and 16 deletions

View File

@ -1,3 +1,14 @@
2002-09-19 David Shaw <dshaw@jabberwocky.com>
* keylist.c (list_keyblock_colon): Show 1F direct key signatures
in --with-colons listing.
* keyserver.c (keyserver_spawn): Properly handle line truncation.
Don't leak memory (~10-20 bytes) on searches.
(keyserver_search_prompt): Cleanup.
* hkp.c (hkp_search): Properly handle line truncation.
2002-09-16 David Shaw <dshaw@jabberwocky.com> 2002-09-16 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (menu_addrevoker): The direct key signature for * keyedit.c (menu_addrevoker): The direct key signature for

View File

@ -475,7 +475,6 @@ parse_hkp_index(IOBUF buffer,char *line)
int hkp_search(STRLIST tokens) int hkp_search(STRLIST tokens)
{ {
int rc=0,len=0,max,first=1; int rc=0,len=0,max,first=1;
unsigned int maxlen=1024,buflen=0;
#ifndef __riscos__ #ifndef __riscos__
unsigned char *searchstr=NULL,*searchurl; unsigned char *searchstr=NULL,*searchurl;
unsigned char *request; unsigned char *request;
@ -485,7 +484,6 @@ int hkp_search(STRLIST tokens)
#endif #endif
struct http_context hd; struct http_context hd;
unsigned int hflags=opt.keyserver_options.honor_http_proxy?HTTP_FLAG_TRY_PROXY:0; unsigned int hflags=opt.keyserver_options.honor_http_proxy?HTTP_FLAG_TRY_PROXY:0;
byte *line=NULL;
/* Glue the tokens together to make a search string */ /* Glue the tokens together to make a search string */
@ -569,13 +567,17 @@ int hkp_search(STRLIST tokens)
{ {
IOBUF buffer; IOBUF buffer;
int count=1; int count=1;
int ret; int ret=0; /* gcc wants me to initialize this */
unsigned int buflen;
byte *line=NULL;
buffer=iobuf_temp(); buffer=iobuf_temp();
rc=1; rc=1;
while(rc!=0) while(rc!=0)
{ {
unsigned int maxlen=1024;
/* This is a judgement call. Is it better to slurp up all /* This is a judgement call. Is it better to slurp up all
the results before prompting the user? On the one hand, the results before prompting the user? On the one hand,
it probably makes the keyserver happier to not be blocked it probably makes the keyserver happier to not be blocked

View File

@ -837,6 +837,8 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
sigstr = "sig"; sigstr = "sig";
else if( sig->sig_class == 0x18 ) else if( sig->sig_class == 0x18 )
sigstr = "sig"; sigstr = "sig";
else if( sig->sig_class == 0x1F )
sigstr = "sig";
else { else {
printf ("sig::::::::::%02x%c:\n", printf ("sig::::::::::%02x%c:\n",
sig->sig_class, sig->flags.exportable?'x':'l'); sig->sig_class, sig->flags.exportable?'x':'l');

View File

@ -335,7 +335,7 @@ keyserver_spawn(int action,STRLIST list,
{ {
int ret=0,i,gotversion=0,outofband=0; int ret=0,i,gotversion=0,outofband=0;
STRLIST temp; STRLIST temp;
unsigned int maxlen=256,buflen; unsigned int maxlen,buflen;
char *command=NULL,*searchstr=NULL; char *command=NULL,*searchstr=NULL;
byte *line=NULL; byte *line=NULL;
struct kopts *kopts; struct kopts *kopts;
@ -545,6 +545,7 @@ keyserver_spawn(int action,STRLIST list,
char *ptr; char *ptr;
int plen; int plen;
maxlen=1024;
if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0) if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0)
{ {
ret=G10ERR_READ_FILE; ret=G10ERR_READ_FILE;
@ -583,8 +584,6 @@ keyserver_spawn(int action,STRLIST list,
outofband=1; /* Currently the only OPTION */ outofband=1; /* Currently the only OPTION */
} }
m_free(line);
if(!gotversion) if(!gotversion)
{ {
log_error(_("keyserver did not send VERSION\n")); log_error(_("keyserver did not send VERSION\n"));
@ -600,12 +599,12 @@ keyserver_spawn(int action,STRLIST list,
stats_handle=import_new_stats_handle(); stats_handle=import_new_stats_handle();
/* Slurp up all the key data. In the future, it might be nice /* Slurp up all the key data. In the future, it might be
to look for KEY foo OUTOFBAND and FAILED indicators. It's nice to look for KEY foo OUTOFBAND and FAILED indicators.
harmless to ignore them, but ignoring them does make gpg It's harmless to ignore them, but ignoring them does make
complain about "no valid OpenPGP data found". One way to gpg complain about "no valid OpenPGP data found". One
do this could be to continue parsing this line-by-line and way to do this could be to continue parsing this
make a temp iobuf for each key. */ line-by-line and make a temp iobuf for each key. */
import_keys_stream(spawn->fromchild,0,stats_handle, import_keys_stream(spawn->fromchild,0,stats_handle,
opt.keyserver_options.import_options); opt.keyserver_options.import_options);
@ -622,12 +621,10 @@ keyserver_spawn(int action,STRLIST list,
case SEARCH: case SEARCH:
{ {
line=NULL;
buflen = 0;
maxlen = 80;
/* Look for the COUNT line */ /* Look for the COUNT line */
do do
{ {
maxlen=1024;
if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0) if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0)
{ {
ret=G10ERR_READ_FILE; ret=G10ERR_READ_FILE;
@ -647,6 +644,8 @@ keyserver_spawn(int action,STRLIST list,
} }
fail: fail:
m_free(line);
*prog=exec_finish(spawn); *prog=exec_finish(spawn);
return ret; return ret;
@ -1003,7 +1002,7 @@ void
keyserver_search_prompt(IOBUF buffer,int count,const char *searchstr) keyserver_search_prompt(IOBUF buffer,int count,const char *searchstr)
{ {
int i=0,validcount=1; int i=0,validcount=1;
unsigned int maxlen=256,buflen=0; unsigned int maxlen,buflen;
KEYDB_SEARCH_DESC *desc; KEYDB_SEARCH_DESC *desc;
byte *line=NULL; byte *line=NULL;
char *answer; char *answer;