gnupg/keyserver (ChangeLog gpgkeys_ftp.c)
cvs user dshaw
cvs at cvs.gnupg.org
Wed Dec 22 06:18:19 CET 2004
Date: Wednesday, December 22, 2004 @ 06:23:22
Author: dshaw
Path: /cvs/gnupg/gnupg/keyserver
Modified: ChangeLog gpgkeys_ftp.c
* gpgkeys_ftp.c (main, get_key): Use auth data as passed by gpg. Use
CURLOPT_FILE instead of CURLOPT_WRITEDATA (same option, but backwards
compatible).
---------------+
ChangeLog | 6 ++++++
gpgkeys_ftp.c | 19 +++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.94 gnupg/keyserver/ChangeLog:1.95
--- gnupg/keyserver/ChangeLog:1.94 Wed Dec 22 00:39:57 2004
+++ gnupg/keyserver/ChangeLog Wed Dec 22 06:23:22 2004
@@ -1,3 +1,9 @@
+2004-12-22 David Shaw <dshaw at jabberwocky.com>
+
+ * gpgkeys_ftp.c (main, get_key): Use auth data as passed by gpg.
+ Use CURLOPT_FILE instead of CURLOPT_WRITEDATA (same option, but
+ backwards compatible).
+
2004-12-21 David Shaw <dshaw at jabberwocky.com>
* gpgkeys_ftp.c: New.
Index: gnupg/keyserver/gpgkeys_ftp.c
diff -u gnupg/keyserver/gpgkeys_ftp.c:1.1 gnupg/keyserver/gpgkeys_ftp.c:1.2
--- gnupg/keyserver/gpgkeys_ftp.c:1.1 Wed Dec 22 00:39:57 2004
+++ gnupg/keyserver/gpgkeys_ftp.c Wed Dec 22 06:23:22 2004
@@ -37,15 +37,16 @@
#define GET 0
#define MAX_LINE 80
#define MAX_PATH 1023
+#define MAX_AUTH 127
#define MAX_HOST 79
#define MAX_PORT 9
-#define MAX_URL (3+3+MAX_HOST+1+1+MAX_PORT+1+1+MAX_PATH+1+50)
+#define MAX_URL (3+3+MAX_AUTH+1+MAX_HOST+1+1+MAX_PORT+1+1+MAX_PATH+1+50)
#define STRINGIFY(x) #x
#define MKSTRING(x) STRINGIFY(x)
static int verbose=0;
-static char host[MAX_HOST+1]={'\0'},port[MAX_PORT+1]={'\0'},path[MAX_PATH+1]={'\0'};
+static char auth[MAX_AUTH+1],host[MAX_HOST+1]={'\0'},port[MAX_PORT+1]={'\0'},path[MAX_PATH+1]={'\0'};
static FILE *input=NULL,*output=NULL,*console=NULL;
static CURL *curl;
static char request[MAX_URL]={'\0'};
@@ -61,12 +62,12 @@
fprintf(output,"KEY 0x%s BEGIN\n",getkey);
- sprintf(request,"ftp://%s%s%s%s%s",host,port[0]?":":"",
- port[0]?port:"",path[0]?"":"/",path);
+ sprintf(request,"ftp://%s%s%s%s%s%s%s",auth[0]?auth:"",auth[0]?"@":"",
+ 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_WRITEDATA,output);
+ curl_easy_setopt(curl,CURLOPT_FILE,output);
curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errorbuffer);
if(verbose>2)
@@ -132,7 +133,7 @@
return KEYSERVER_OK;
case 'o':
- output=fopen(optarg,"w");
+ output=fopen(optarg,"wb");
if(output==NULL)
{
fprintf(console,"gpgkeys: Cannot open output file `%s': %s\n",
@@ -185,6 +186,12 @@
continue;
}
+ if(sscanf(line,"AUTH %" MKSTRING(MAX_AUTH) "s\n",auth)==1)
+ {
+ host[MAX_AUTH]='\0';
+ continue;
+ }
+
if(sscanf(line,"HOST %" MKSTRING(MAX_HOST) "s\n",host)==1)
{
host[MAX_HOST]='\0';
More information about the Gnupg-commits
mailing list