1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-11 21:48:50 +01:00

* options.h, keyserver.c (parse_keyserver_uri): Properly parse auth data

from URLs and pass to keyserver helpers.
This commit is contained in:
David Shaw 2004-12-22 18:09:41 +00:00
parent 0361c6f01b
commit f3c33b8768
3 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,8 @@
2004-12-22 David Shaw <dshaw@jabberwocky.com> 2004-12-22 David Shaw <dshaw@jabberwocky.com>
* options.h, keyserver.c (parse_keyserver_uri): Properly parse
auth data from URLs and pass to keyserver helpers.
* keyserver.c (keyserver_typemap): New. Map certain keyserver * keyserver.c (keyserver_typemap): New. Map certain keyserver
types to a common type (e.g. ldaps -> ldap). If we are building types to a common type (e.g. ldaps -> ldap). If we are building
with curl, map both http and ftp to curl. with curl, map both http and ftp to curl.

View File

@ -218,6 +218,23 @@ parse_keyserver_uri(const char *uri,int require_scheme,
if(!assume_hkp) if(!assume_hkp)
uri+=2; uri+=2;
/* Do we have userinfo auth data present? */
for(idx=uri,count=0;*idx && *idx!='@' && *idx!='/';idx++)
count++;
/* We found a @ before the slash, so that means everything
before the @ is auth data. */
if(*idx=='@')
{
if(count==0)
goto fail;
keyserver->auth=m_alloc(count+1);
strncpy(keyserver->auth,uri,count);
keyserver->auth[count]='\0';
uri+=count+1;
}
for(idx=uri,count=0;*idx && *idx!=':' && *idx!='/';idx++) for(idx=uri,count=0;*idx && *idx!=':' && *idx!='/';idx++)
count++; count++;
@ -846,6 +863,9 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
fprintf(spawn->tochild,"OPAQUE %s\n",keyserver->opaque); fprintf(spawn->tochild,"OPAQUE %s\n",keyserver->opaque);
else else
{ {
if(keyserver->auth)
fprintf(spawn->tochild,"AUTH %s\n",keyserver->auth);
if(keyserver->host) if(keyserver->host)
fprintf(spawn->tochild,"HOST %s\n",keyserver->host); fprintf(spawn->tochild,"HOST %s\n",keyserver->host);

View File

@ -129,6 +129,7 @@ struct
{ {
char *uri; char *uri;
char *scheme; char *scheme;
char *auth;
char *host; char *host;
char *port; char *port;
char *path; char *path;