summaryrefslogtreecommitdiffstats
path: root/keyserver
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2006-07-27 16:18:55 +0200
committerWerner Koch <wk@gnupg.org>2006-07-27 16:18:55 +0200
commitde5070caf07854852a36722a0d85453cbbc93c84 (patch)
tree39ae89adce5a02311686d4b86bedc1e05b9fbaca /keyserver
parentCreate bag attributes so that Mozilla will accept these files. (diff)
downloadgnupg2-de5070caf07854852a36722a0d85453cbbc93c84.tar.xz
gnupg2-de5070caf07854852a36722a0d85453cbbc93c84.zip
Preparing a new releasegnupg-1.9.22
Diffstat (limited to 'keyserver')
-rw-r--r--keyserver/ChangeLog9
-rw-r--r--keyserver/curl-shim.c8
-rw-r--r--keyserver/gpgkeys_hkp.c9
-rw-r--r--keyserver/gpgkeys_ldap.c22
4 files changed, 32 insertions, 16 deletions
diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog
index c171f6a3a..c427c4778 100644
--- a/keyserver/ChangeLog
+++ b/keyserver/ChangeLog
@@ -1,3 +1,12 @@
+2006-07-24 David Shaw <dshaw@jabberwocky.com> (wk)
+
+ * curl-shim.c (curl_easy_perform): Minor cleanup of proxy code.
+
+ * gpgkeys_hkp.c (send_key)
+ * gpgkeys_ldap.c (send_key, send_key_keyserver): Fix string
+ matching problem when the ascii armored form of the key happens to
+ match "KEY" at the beginning of the line.
+
2006-04-26 David Shaw <dshaw@jabberwocky.com>
* gpgkeys_http.c, gpgkeys_oldhkp.c: Removed.
diff --git a/keyserver/curl-shim.c b/keyserver/curl-shim.c
index 4a4d18f56..c71c655b5 100644
--- a/keyserver/curl-shim.c
+++ b/keyserver/curl-shim.c
@@ -164,13 +164,11 @@ curl_easy_perform(CURL *curl)
/* Emulate the libcurl proxy behavior. If the calling program set a
proxy, use it. If it didn't set a proxy or set it to NULL, check
for one in the environment. If the calling program explicitly
- set a null-string proxy, don't set a proxy at all. */
+ set a null-string proxy the http code doesn't use a proxy at
+ all. */
if(curl->proxy)
- {
- if(*curl->proxy)
- proxy=curl->proxy;
- }
+ proxy=curl->proxy;
else
proxy=getenv(HTTP_PROXY_ENV);
diff --git a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c
index b3ebcf1a9..e6de3634c 100644
--- a/keyserver/gpgkeys_hkp.c
+++ b/keyserver/gpgkeys_hkp.c
@@ -86,7 +86,7 @@ send_key(int *eof)
CURLcode res;
char request[MAX_URL+15];
int begin=0,end=0,ret=KEYSERVER_INTERNAL_ERROR;
- char keyid[17];
+ char keyid[17],state[6];
char line[MAX_LINE];
char *key=NULL,*encoded_key=NULL;
size_t keylen=0,keymax=0;
@@ -94,7 +94,8 @@ send_key(int *eof)
/* Read and throw away input until we see the BEGIN */
while(fgets(line,MAX_LINE,input)!=NULL)
- if(sscanf(line,"KEY %16s BEGIN\n",keyid)==1)
+ if(sscanf(line,"KEY%*[ ]%16s%*[ ]%5s\n",keyid,state)==2
+ && strcmp(state,"BEGIN")==0)
{
begin=1;
break;
@@ -112,7 +113,8 @@ send_key(int *eof)
/* Now slurp up everything until we see the END */
while(fgets(line,MAX_LINE,input))
- if(sscanf(line,"KEY %16s END\n",keyid)==1)
+ if(sscanf(line,"KEY%*[ ]%16s%*[ ]%3s\n",keyid,state)==2
+ && strcmp(state,"END")==0)
{
end=1;
break;
@@ -194,6 +196,7 @@ send_key(int *eof)
{
fprintf(console,"gpgkeys: HTTP post error %d: %s\n",res,errorbuffer);
ret=curl_err_to_gpg_err(res);
+ goto fail;
}
else
fprintf(output,"\nKEY %s SENT\n",keyid);
diff --git a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c
index b4bd00e4f..b56cca1cf 100644
--- a/keyserver/gpgkeys_ldap.c
+++ b/keyserver/gpgkeys_ldap.c
@@ -567,7 +567,7 @@ send_key(int *eof)
{
int err,begin=0,end=0,keysize=1,ret=KEYSERVER_INTERNAL_ERROR;
char *dn=NULL,line[MAX_LINE],*key=NULL;
- char keyid[17];
+ char keyid[17],state[6];
LDAPMod **modlist,**addlist,**ml;
modlist=malloc(sizeof(LDAPMod *));
@@ -608,7 +608,8 @@ send_key(int *eof)
/* Assemble the INFO stuff into LDAP attributes */
while(fgets(line,MAX_LINE,input)!=NULL)
- if(sscanf(line,"INFO %16s BEGIN\n",keyid)==1)
+ if(sscanf(line,"INFO%*[ ]%16s%*[ ]%5s\n",keyid,state)==2
+ && strcmp(state,"BEGIN")==0)
{
begin=1;
break;
@@ -653,7 +654,8 @@ send_key(int *eof)
/* Now parse each line until we see the END */
while(fgets(line,MAX_LINE,input)!=NULL)
- if(sscanf(line,"INFO %16s END\n",keyid)==1)
+ if(sscanf(line,"INFO%*[ ]%16s%*[ ]%3s\n",keyid,state)==2
+ && strcmp(state,"END")==0)
{
end=1;
break;
@@ -674,7 +676,8 @@ send_key(int *eof)
/* Read and throw away stdin until we see the BEGIN */
while(fgets(line,MAX_LINE,input)!=NULL)
- if(sscanf(line,"KEY %16s BEGIN\n",keyid)==1)
+ if(sscanf(line,"KEY%*[ ]%16s%*[ ]%5s\n",keyid,state)==2
+ && strcmp(state,"BEGIN")==0)
{
begin=1;
break;
@@ -692,7 +695,8 @@ send_key(int *eof)
/* 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)
+ if(sscanf(line,"KEY%*[ ]%16s%*[ ]%3s\n",keyid,state)==2
+ && strcmp(state,"END")==0)
{
end=1;
break;
@@ -778,7 +782,7 @@ send_key_keyserver(int *eof)
{
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];
+ char keyid[17],state[6];
LDAPMod mod, *attrs[2];
memset(&mod,0,sizeof(mod));
@@ -812,7 +816,8 @@ send_key_keyserver(int *eof)
/* Read and throw away stdin until we see the BEGIN */
while(fgets(line,MAX_LINE,input)!=NULL)
- if(sscanf(line,"KEY %16s BEGIN\n",keyid)==1)
+ if(sscanf(line,"KEY%*[ ]%16s%*[ ]%5s\n",keyid,state)==2
+ && strcmp(state,"BEGIN")==0)
{
begin=1;
break;
@@ -830,7 +835,8 @@ send_key_keyserver(int *eof)
/* 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)
+ if(sscanf(line,"KEY%*[ ]%16s%*[ ]%3s\n",keyid,state)==2
+ && strcmp(state,"END")==0)
{
end=1;
break;