mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-10 13:04:23 +01:00
* gpgkeys_hkp.c (send_key), gpgkeys_ldap.c (send_key): Properly handle an
input file that does not include any key data at all.
This commit is contained in:
parent
91a8e4a6fb
commit
f7b357ebfe
@ -1,3 +1,8 @@
|
||||
2002-11-04 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* gpgkeys_hkp.c (send_key), gpgkeys_ldap.c (send_key): Properly
|
||||
handle an input file that does not include any key data at all.
|
||||
|
||||
2002-10-24 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* gpgkeys_hkp.c (main), gpgkeys_ldap.c (main): Add -V flag to
|
||||
|
@ -79,7 +79,7 @@ urlencode_filter( void *opaque, int control,
|
||||
int
|
||||
send_key(int *eof)
|
||||
{
|
||||
int rc,gotit=0,ret=KEYSERVER_INTERNAL_ERROR;
|
||||
int rc,begin=0,end=0,ret=KEYSERVER_INTERNAL_ERROR;
|
||||
char keyid[17];
|
||||
char *request;
|
||||
struct http_context hd;
|
||||
@ -87,6 +87,8 @@ send_key(int *eof)
|
||||
IOBUF temp = iobuf_temp();
|
||||
char line[MAX_LINE];
|
||||
|
||||
memset(&hd,0,sizeof(hd));
|
||||
|
||||
request=malloc(strlen(host)+100);
|
||||
if(!request)
|
||||
{
|
||||
@ -101,11 +103,11 @@ send_key(int *eof)
|
||||
while(fgets(line,MAX_LINE,input)!=NULL)
|
||||
if(sscanf(line,"KEY %16s BEGIN\n",keyid)==1)
|
||||
{
|
||||
gotit=1;
|
||||
begin=1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!gotit)
|
||||
if(!begin)
|
||||
{
|
||||
/* i.e. eof before the KEY BEGIN was found. This isn't an
|
||||
error. */
|
||||
@ -114,14 +116,12 @@ send_key(int *eof)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gotit=0;
|
||||
|
||||
/* Now slurp up everything until we see the END */
|
||||
|
||||
while(fgets(line,MAX_LINE,input))
|
||||
if(sscanf(line,"KEY %16s END\n",keyid)==1)
|
||||
{
|
||||
gotit=1;
|
||||
end=1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -131,7 +131,7 @@ send_key(int *eof)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if(!gotit)
|
||||
if(!end)
|
||||
{
|
||||
fprintf(console,"gpgkeys: no KEY %s END found\n",keyid);
|
||||
*eof=1;
|
||||
@ -176,7 +176,6 @@ send_key(int *eof)
|
||||
if((status/100)!=2)
|
||||
{
|
||||
fprintf(console,"gpgkeys: remote server returned error %d\n",status);
|
||||
fprintf(output,"KEY %s FAILED %d\n",keyid,ret);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -189,6 +188,9 @@ send_key(int *eof)
|
||||
iobuf_close(temp);
|
||||
http_close(&hd);
|
||||
|
||||
if(ret!=0 && begin)
|
||||
fprintf(output,"KEY %s FAILED %d\n",keyid,ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ ldap_to_gpg_err(LDAP *ld)
|
||||
int
|
||||
send_key(int *eof)
|
||||
{
|
||||
int err,gotit=0,keysize=1,ret=KEYSERVER_INTERNAL_ERROR;
|
||||
int err,begin=0,end=0,keysize=1,ret=KEYSERVER_INTERNAL_ERROR;
|
||||
char *dn=NULL,line[MAX_LINE],*key[2]={NULL,NULL};
|
||||
char keyid[17];
|
||||
LDAPMod mod, *attrs[2];
|
||||
@ -147,11 +147,11 @@ send_key(int *eof)
|
||||
while(fgets(line,MAX_LINE,input)!=NULL)
|
||||
if(sscanf(line,"KEY %16s BEGIN\n",keyid)==1)
|
||||
{
|
||||
gotit=1;
|
||||
begin=1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!gotit)
|
||||
if(!begin)
|
||||
{
|
||||
/* i.e. eof before the KEY BEGIN was found. This isn't an
|
||||
error. */
|
||||
@ -160,14 +160,12 @@ send_key(int *eof)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gotit=0;
|
||||
|
||||
/* Now slurp up everything until we see the END */
|
||||
|
||||
while(fgets(line,MAX_LINE,input)!=NULL)
|
||||
if(sscanf(line,"KEY %16s END\n",keyid)==1)
|
||||
{
|
||||
gotit=1;
|
||||
end=1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -184,7 +182,7 @@ send_key(int *eof)
|
||||
strcat(key[0],line);
|
||||
}
|
||||
|
||||
if(!gotit)
|
||||
if(!end)
|
||||
{
|
||||
fprintf(console,"gpgkeys: no KEY %s END found\n",keyid);
|
||||
*eof=1;
|
||||
@ -208,7 +206,7 @@ send_key(int *eof)
|
||||
free(key[0]);
|
||||
free(dn);
|
||||
|
||||
if(ret!=0)
|
||||
if(ret!=0 && begin)
|
||||
fprintf(output,"KEY %s FAILED %d\n",keyid,ret);
|
||||
|
||||
/* Not a fatal error */
|
||||
|
Loading…
x
Reference in New Issue
Block a user