1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* gpgkeys_hkp.c (parse_hkp_index): Error if the keyserver returns an

unparseable HKP response.

* gpgkeys_hkp.c (main): Warn on honor-http-proxy, broken-http-proxy, and
include-subkeys (not supported yet).

* gpgkeys_ldap.c (main), gpgkeys_hkp.c (http_connect, main): Fix some
shadowing warnings.
This commit is contained in:
David Shaw 2002-07-01 17:46:56 +00:00
parent db765c90d8
commit 2b0bb77e6d
3 changed files with 48 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2002-07-01 David Shaw <dshaw@jabberwocky.com>
* gpgkeys_hkp.c (parse_hkp_index): Error if the keyserver returns
an unparseable HKP response.
* gpgkeys_hkp.c (main): Warn on honor-http-proxy,
broken-http-proxy, and include-subkeys (not supported yet).
* gpgkeys_ldap.c (main), gpgkeys_hkp.c (http_connect, main): Fix
some shadowing warnings.
2002-06-11 David Shaw <dshaw@jabberwocky.com> 2002-06-11 David Shaw <dshaw@jabberwocky.com>
* Makefile.am: Don't hard-code the LDAP libraries - get them from * Makefile.am: Don't hard-code the LDAP libraries - get them from

View File

@ -48,7 +48,7 @@ struct keylist
struct keylist *next; struct keylist *next;
}; };
int http_connect(const char *host,unsigned short port) int http_connect(const char *http_host,unsigned short port)
{ {
int sock=-1; int sock=-1;
struct hostent *ent; struct hostent *ent;
@ -61,7 +61,7 @@ int http_connect(const char *host,unsigned short port)
goto fail; goto fail;
} }
ent=gethostbyname(host); ent=gethostbyname(http_host);
if(ent==NULL) if(ent==NULL)
{ {
fprintf(console,"gpgkeys: DNS error: %s\n",hstrerror(h_errno)); fprintf(console,"gpgkeys: DNS error: %s\n",hstrerror(h_errno));
@ -88,7 +88,8 @@ int http_connect(const char *host,unsigned short port)
} }
if(verbose>3) if(verbose>3)
fprintf(console,"gpgkeys: HKP connect to %s:%d\n",host,port?port:11371); fprintf(console,"gpgkeys: HKP connect to %s:%d\n",
http_host,port?port:11371);
return 0; return 0;
@ -397,10 +398,26 @@ unsigned int scan_isodatestr( const char *string )
int parse_hkp_index(char *line,char **buffer) int parse_hkp_index(char *line,char **buffer)
{ {
static int open=0,revoked=0; static int open=0,revoked=0;
static char *key,*uid; static char *key=NULL,*uid=NULL;
static unsigned int bits,createtime; static unsigned int bits,createtime;
int ret=0; int ret=0;
/* printf("Open %d, LINE: %s, uid: %s\n",open,line,uid); */
/* Try and catch some bastardization of HKP. If we don't have
certain unchanging landmarks, we can't reliably parse the
response. */
if(open && strncasecmp(line,"</pre>",6)!=0 &&
strncasecmp(line,"pub ",5)!=0 &&
strncasecmp(line," ",5)!=0)
{
free(key);
free(uid);
fprintf(console,"gpgkeys; this keyserver is not fully HKP compatible\n");
return -1;
}
/* printf("Open %d, LINE: %s\n",open,line); */ /* printf("Open %d, LINE: %s\n",open,line); */
/* For multiple UIDs */ /* For multiple UIDs */
@ -640,7 +657,7 @@ int search_key(char *searchkey)
} }
fprintf(output,"COUNT %d\n%s",count,buffer); fprintf(output,"COUNT %d\n%s",count,buffer);
// fprintf(output,"COUNT -1\n%s",buffer); /* fprintf(output,"COUNT -1\n%s",buffer); */
fprintf(output,"SEARCH %s END\n",searchkey); fprintf(output,"SEARCH %s END\n",searchkey);
@ -789,6 +806,13 @@ int main(int argc,char *argv[])
else else
include_revoked=1; include_revoked=1;
} }
else if(strcasecmp(start,"honor-http-proxy")==0 ||
strcasecmp(start,"broken-http-proxy")==0 ||
strcasecmp(start,"include-subkeys")==0)
{
fprintf(stderr,"gpgkeys: HKP does not currently support %s\n",
start);
}
continue; continue;
} }
@ -897,17 +921,17 @@ int main(int argc,char *argv[])
case SEND: case SEND:
{ {
int ret; int ret2;
do do
{ {
http_connect(host,port); http_connect(host,port);
ret=send_key(); ret2=send_key();
if(ret==-1) if(ret2==-1)
failed++; failed++;
http_disconnect(); http_disconnect();
} }
while(ret!=1); while(ret2!=1);
} }
break; break;

View File

@ -901,15 +901,15 @@ int main(int argc,char *argv[])
case SEND: case SEND:
{ {
int ret; int ret2;
do do
{ {
ret=send_key(); ret2=send_key();
if(ret==-1) if(ret2==-1)
failed++; failed++;
} }
while(ret!=1); while(ret2!=1);
} }
break; break;