aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2004-12-22 18:09:41 +0000
committerDavid Shaw <[email protected]>2004-12-22 18:09:41 +0000
commitf3c33b876897392563bdc9a7e4ea97286d642308 (patch)
tree719a5d188950c19f76ea391cea3dd02bef0328af
parent* gpgkeys_curl.c (get_key, writer): New function to wrap around fwrite to (diff)
downloadgnupg-f3c33b876897392563bdc9a7e4ea97286d642308.tar.gz
gnupg-f3c33b876897392563bdc9a7e4ea97286d642308.zip
* options.h, keyserver.c (parse_keyserver_uri): Properly parse auth data
from URLs and pass to keyserver helpers.
-rw-r--r--g10/ChangeLog3
-rw-r--r--g10/keyserver.c20
-rw-r--r--g10/options.h1
3 files changed, 24 insertions, 0 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index beb9dec02..3fda46d4c 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,5 +1,8 @@
2004-12-22 David Shaw <[email protected]>
+ * 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
types to a common type (e.g. ldaps -> ldap). If we are building
with curl, map both http and ftp to curl.
diff --git a/g10/keyserver.c b/g10/keyserver.c
index 854187f74..815e784a6 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -218,6 +218,23 @@ parse_keyserver_uri(const char *uri,int require_scheme,
if(!assume_hkp)
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++)
count++;
@@ -846,6 +863,9 @@ keyserver_spawn(int action,STRLIST list,KEYDB_SEARCH_DESC *desc,
fprintf(spawn->tochild,"OPAQUE %s\n",keyserver->opaque);
else
{
+ if(keyserver->auth)
+ fprintf(spawn->tochild,"AUTH %s\n",keyserver->auth);
+
if(keyserver->host)
fprintf(spawn->tochild,"HOST %s\n",keyserver->host);
diff --git a/g10/options.h b/g10/options.h
index 668b71f7b..1ad6b44a2 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -129,6 +129,7 @@ struct
{
char *uri;
char *scheme;
+ char *auth;
char *host;
char *port;
char *path;