mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
* gpgkeys_hkp.c (append_path, send_key, get_key, search_key, main),
gpgkeys_oldhkp.c (main): Properly handle double slashes in paths.
This commit is contained in:
parent
d010af07f9
commit
4e9797031f
@ -1,3 +1,9 @@
|
|||||||
|
2005-06-20 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* gpgkeys_hkp.c (append_path, send_key, get_key, search_key,
|
||||||
|
main), gpgkeys_oldhkp.c (main): Properly handle double slashes in
|
||||||
|
paths.
|
||||||
|
|
||||||
2005-06-05 David Shaw <dshaw@jabberwocky.com>
|
2005-06-05 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* ksutil.c (init_ks_options, parse_ks_options): Provide a default
|
* ksutil.c (init_ks_options, parse_ks_options): Provide a default
|
||||||
|
@ -69,6 +69,18 @@ curl_mrindex_writer(const void *ptr,size_t size,size_t nmemb,void *stream)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Append but avoid creating a double slash // in the path. */
|
||||||
|
static char *
|
||||||
|
append_path(char *dest,const char *src)
|
||||||
|
{
|
||||||
|
size_t n=strlen(dest);
|
||||||
|
|
||||||
|
if(src[0]=='/' && n>0 && dest[n-1]=='/')
|
||||||
|
dest[n-1]='\0';
|
||||||
|
|
||||||
|
return strcat(dest,src);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
send_key(int *eof)
|
send_key(int *eof)
|
||||||
{
|
{
|
||||||
@ -162,11 +174,10 @@ send_key(int *eof)
|
|||||||
strcat(request,opt->port);
|
strcat(request,opt->port);
|
||||||
else
|
else
|
||||||
strcat(request,"11371");
|
strcat(request,"11371");
|
||||||
if(opt->path)
|
strcat(request,opt->path);
|
||||||
strcat(request,opt->path);
|
|
||||||
/* request is MAX_URL+15 bytes long - MAX_URL covers the whole URL,
|
/* request is MAX_URL+15 bytes long - MAX_URL covers the whole URL,
|
||||||
including any supplied path. The 15 covers /pks/add. */
|
including any supplied path. The 15 covers /pks/add. */
|
||||||
strcat(request,"/pks/add");
|
append_path(request,"/pks/add");
|
||||||
|
|
||||||
if(opt->verbose>2)
|
if(opt->verbose>2)
|
||||||
fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request);
|
fprintf(console,"gpgkeys: HTTP URL is `%s'\n",request);
|
||||||
@ -229,12 +240,11 @@ get_key(char *getkey)
|
|||||||
strcat(request,opt->port);
|
strcat(request,opt->port);
|
||||||
else
|
else
|
||||||
strcat(request,"11371");
|
strcat(request,"11371");
|
||||||
if(opt->path)
|
strcat(request,opt->path);
|
||||||
strcat(request,opt->path);
|
|
||||||
/* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL,
|
/* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL,
|
||||||
including any supplied path. The 60 overcovers this /pks/... etc
|
including any supplied path. The 60 overcovers this /pks/... etc
|
||||||
string plus the 8 bytes of key id */
|
string plus the 8 bytes of key id */
|
||||||
strcat(request,"/pks/lookup?op=get&options=mr&search=0x");
|
append_path(request,"/pks/lookup?op=get&options=mr&search=0x");
|
||||||
|
|
||||||
/* fingerprint or long key id. Take the last 8 characters and treat
|
/* fingerprint or long key id. Take the last 8 characters and treat
|
||||||
it like a short key id */
|
it like a short key id */
|
||||||
@ -301,9 +311,8 @@ search_key(char *searchkey)
|
|||||||
strcat(request,opt->port);
|
strcat(request,opt->port);
|
||||||
else
|
else
|
||||||
strcat(request,"11371");
|
strcat(request,"11371");
|
||||||
if(opt->path)
|
strcat(request,opt->path);
|
||||||
strcat(request,opt->path);
|
append_path(request,"/pks/lookup?op=index&options=mr&search=");
|
||||||
strcat(request,"/pks/lookup?op=index&options=mr&search=");
|
|
||||||
strcat(request,searchkey_encoded);
|
strcat(request,searchkey_encoded);
|
||||||
|
|
||||||
if(opt->verbose>2)
|
if(opt->verbose>2)
|
||||||
@ -599,7 +608,7 @@ main(int argc,char *argv[])
|
|||||||
fprintf(console,"Host:\t\t%s\n",opt->host);
|
fprintf(console,"Host:\t\t%s\n",opt->host);
|
||||||
if(opt->port)
|
if(opt->port)
|
||||||
fprintf(console,"Port:\t\t%s\n",opt->port);
|
fprintf(console,"Port:\t\t%s\n",opt->port);
|
||||||
if(opt->path)
|
if(strcmp(opt->path,"/")!=0)
|
||||||
fprintf(console,"Path:\t\t%s\n",opt->path);
|
fprintf(console,"Path:\t\t%s\n",opt->path);
|
||||||
fprintf(console,"Command:\t%s\n",ks_action_to_string(opt->action));
|
fprintf(console,"Command:\t%s\n",ks_action_to_string(opt->action));
|
||||||
}
|
}
|
||||||
|
@ -761,6 +761,7 @@ main(int argc,char *argv[])
|
|||||||
int failed=0;
|
int failed=0;
|
||||||
struct keylist *keylist=NULL,*keyptr=NULL;
|
struct keylist *keylist=NULL,*keyptr=NULL;
|
||||||
unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT;
|
unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT;
|
||||||
|
size_t n;
|
||||||
|
|
||||||
console=stderr;
|
console=stderr;
|
||||||
|
|
||||||
@ -956,6 +957,11 @@ main(int argc,char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Avoid the double slash // in a path */
|
||||||
|
n=strlen(path);
|
||||||
|
if(n>0 && path[n-1]=='/')
|
||||||
|
path[n-1]='\0';
|
||||||
|
|
||||||
if(timeout && register_timeout()==-1)
|
if(timeout && register_timeout()==-1)
|
||||||
{
|
{
|
||||||
fprintf(console,"gpgkeys: unable to register timeout handler\n");
|
fprintf(console,"gpgkeys: unable to register timeout handler\n");
|
||||||
@ -1028,7 +1034,7 @@ main(int argc,char *argv[])
|
|||||||
fprintf(console,"Host:\t\t%s\n",host);
|
fprintf(console,"Host:\t\t%s\n",host);
|
||||||
if(port[0])
|
if(port[0])
|
||||||
fprintf(console,"Port:\t\t%s\n",port);
|
fprintf(console,"Port:\t\t%s\n",port);
|
||||||
if(path[0])
|
if(strcmp(path,"/")!=0)
|
||||||
fprintf(console,"Path:\t\t%s\n",path);
|
fprintf(console,"Path:\t\t%s\n",path);
|
||||||
fprintf(console,"Command:\t%s\n",action==GET?"GET":
|
fprintf(console,"Command:\t%s\n",action==GET?"GET":
|
||||||
action==SEND?"SEND":"SEARCH");
|
action==SEND?"SEND":"SEARCH");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user