gnupg/keyserver (ChangeLog gpgkeys_curl.c gpgkeys_http.c)
cvs user dshaw
cvs at cvs.gnupg.org
Wed Dec 22 19:02:16 CET 2004
Date: Wednesday, December 22, 2004 @ 19:07:22
Author: dshaw
Path: /cvs/gnupg/gnupg/keyserver
Modified: ChangeLog gpgkeys_curl.c gpgkeys_http.c
* gpgkeys_curl.c (get_key, writer): New function to wrap around fwrite to
avoid DLL access problem on win32.
* gpgkeys_http.c (main, get_key): Properly pass authentication info
through to the http library.
----------------+
ChangeLog | 6 ++++++
gpgkeys_curl.c | 10 +++++++++-
gpgkeys_http.c | 12 +++++++++---
3 files changed, 24 insertions(+), 4 deletions(-)
Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.96 gnupg/keyserver/ChangeLog:1.97
--- gnupg/keyserver/ChangeLog:1.96 Wed Dec 22 18:12:23 2004
+++ gnupg/keyserver/ChangeLog Wed Dec 22 19:07:21 2004
@@ -1,5 +1,11 @@
2004-12-22 David Shaw <dshaw at jabberwocky.com>
+ * gpgkeys_curl.c (get_key, writer): New function to wrap around
+ fwrite to avoid DLL access problem on win32.
+
+ * gpgkeys_http.c (main, get_key): Properly pass authentication
+ info through to the http library.
+
* Makefile.am: Build gpgkeys_http or gpgkeys_curl as needed.
* gpgkeys_curl.c (main, get_key): Minor tweaks to work with either
Index: gnupg/keyserver/gpgkeys_curl.c
diff -u gnupg/keyserver/gpgkeys_curl.c:1.1 gnupg/keyserver/gpgkeys_curl.c:1.2
--- gnupg/keyserver/gpgkeys_curl.c:1.1 Wed Dec 22 18:12:23 2004
+++ gnupg/keyserver/gpgkeys_curl.c Wed Dec 22 19:07:21 2004
@@ -62,6 +62,14 @@
}
}
+/* We wrap fwrite so to avoid DLL problems on Win32 (see curl faq for
+ more). */
+static size_t
+writer(const void *ptr,size_t size,size_t nmemb,void *stream)
+{
+ return fwrite(ptr,size,nmemb,stream);
+}
+
static int
get_key(char *getkey)
{
@@ -77,7 +85,7 @@
host,port[0]?":":"",port[0]?port:"",path[0]?"":"/",path);
curl_easy_setopt(curl,CURLOPT_URL,request);
- curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,fwrite);
+ curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,writer);
curl_easy_setopt(curl,CURLOPT_FILE,output);
curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errorbuffer);
Index: gnupg/keyserver/gpgkeys_http.c
diff -u gnupg/keyserver/gpgkeys_http.c:1.7 gnupg/keyserver/gpgkeys_http.c:1.8
--- gnupg/keyserver/gpgkeys_http.c:1.7 Fri Oct 15 14:19:06 2004
+++ gnupg/keyserver/gpgkeys_http.c Wed Dec 22 19:07:21 2004
@@ -41,7 +41,7 @@
static int verbose=0;
static unsigned int http_flags=0;
-static char host[80]={'\0'},proxy[80]={'\0'},port[10]={'\0'},path[1024]={'\0'};
+static char auth[128]={'\0'},host[80]={'\0'},proxy[80]={'\0'},port[10]={'\0'},path[1024]={'\0'};
static FILE *input=NULL,*output=NULL,*console=NULL;
#define BEGIN "-----BEGIN PGP PUBLIC KEY BLOCK-----"
@@ -72,8 +72,8 @@
return KEYSERVER_NO_MEMORY;
}
- sprintf(request,"http://%s%s%s%s%s",host,port[0]?":":"",
- port[0]?port:"",path[0]?"":"/",path);
+ sprintf(request,"http://%s%s%s%s%s%s%s",auth[0]?auth:"",auth[0]?"@":"",
+ host,port[0]?":":"",port[0]?port:"",path[0]?"":"/",path);
rc=http_open_document(&hd,request,http_flags,proxy[0]?proxy:NULL);
if(rc!=0)
@@ -219,6 +219,12 @@
continue;
}
+ if(sscanf(line,"AUTH %127s\n",auth)==1)
+ {
+ auth[127]='\0';
+ continue;
+ }
+
if(sscanf(line,"HOST %79s\n",host)==1)
{
host[79]='\0';
More information about the Gnupg-commits
mailing list