gnupg/keyserver (6 files)
cvs user dshaw
cvs at cvs.gnupg.org
Wed Jul 20 23:22:29 CEST 2005
Date: Wednesday, July 20, 2005 @ 23:48:28
Author: dshaw
Path: /cvs/gnupg/gnupg/keyserver
Modified: ChangeLog Makefile.am curl-shim.c curl-shim.h gpgkeys_curl.c
ksutil.c
* gpgkeys_curl.c (get_key, main): Don't try and be smart about what
protocols we handle. Directly pass them to curl or fake-curl and see if
an error comes back.
* curl-shim.h, curl-shim.c (handle_error), ksutil.c (curl_err_to_gpg_err):
Add support for CURLE_UNSUPPORTED_PROTOCOL in fake curl.
* Makefile.am: Don't need -DFAKE_CURL any longer since it's in config.h.
----------------+
ChangeLog | 13 +++++++++++++
Makefile.am | 2 --
curl-shim.c | 26 ++++++++++++++++++++------
curl-shim.h | 1 +
gpgkeys_curl.c | 25 ++-----------------------
ksutil.c | 1 +
6 files changed, 37 insertions(+), 31 deletions(-)
Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.136 gnupg/keyserver/ChangeLog:1.137
--- gnupg/keyserver/ChangeLog:1.136 Fri Jun 24 01:42:35 2005
+++ gnupg/keyserver/ChangeLog Wed Jul 20 23:48:28 2005
@@ -1,3 +1,16 @@
+2005-07-20 David Shaw <dshaw at jabberwocky.com>
+
+ * gpgkeys_curl.c (get_key, main): Don't try and be smart about
+ what protocols we handle. Directly pass them to curl or fake-curl
+ and see if an error comes back.
+
+ * curl-shim.h, curl-shim.c (handle_error), ksutil.c
+ (curl_err_to_gpg_err): Add support for CURLE_UNSUPPORTED_PROTOCOL
+ in fake curl.
+
+ * Makefile.am: Don't need -DFAKE_CURL any longer since it's in
+ config.h.
+
2005-06-23 David Shaw <dshaw at jabberwocky.com>
* gpgkeys_mailto.in, gpgkeys_test.in: Use @VERSION@ so version
Index: gnupg/keyserver/Makefile.am
diff -u gnupg/keyserver/Makefile.am:1.29 gnupg/keyserver/Makefile.am:1.30
--- gnupg/keyserver/Makefile.am:1.29 Tue May 31 10:39:15 2005
+++ gnupg/keyserver/Makefile.am Wed Jul 20 23:48:28 2005
@@ -44,10 +44,8 @@
gpgkeys_hkp_SOURCES += gpgkeys_hkp.c
if FAKE_CURL
gpgkeys_curl_SOURCES += curl-shim.c curl-shim.h
-gpgkeys_curl_CPPFLAGS = -DFAKE_CURL
gpgkeys_curl_LDADD = ../util/libutil.a @NETLIBS@ @SRVLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
gpgkeys_hkp_SOURCES += curl-shim.c curl-shim.h
-gpgkeys_hkp_CPPFLAGS = -DFAKE_CURL
gpgkeys_hkp_LDADD = ../util/libutil.a @NETLIBS@ @SRVLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
else
gpgkeys_curl_CPPFLAGS = @LIBCURL_CPPFLAGS@
Index: gnupg/keyserver/curl-shim.c
diff -u gnupg/keyserver/curl-shim.c:1.8 gnupg/keyserver/curl-shim.c:1.9
--- gnupg/keyserver/curl-shim.c:1.8 Fri Jun 24 01:42:35 2005
+++ gnupg/keyserver/curl-shim.c Wed Jul 20 23:48:28 2005
@@ -45,6 +45,10 @@
strcpy(curl->errorbuffer,"okay");
break;
+ case CURLE_UNSUPPORTED_PROTOCOL:
+ strcpy(curl->errorbuffer,"unsupported protocol");
+ break;
+
case CURLE_COULDNT_CONNECT:
strcpy(curl->errorbuffer,"couldn't connect");
break;
@@ -217,16 +221,26 @@
}
}
- if(rc!=0)
+ switch(rc)
{
- if(rc==G10ERR_NETWORK)
- errstr=strerror(errno);
- else
- errstr=g10_errstr(rc);
+ case 0:
+ break;
+
+ case G10ERR_INVALID_URI:
+ err=CURLE_UNSUPPORTED_PROTOCOL;
+ break;
+ case G10ERR_NETWORK:
+ errstr=strerror(errno);
err=CURLE_COULDNT_CONNECT;
- }
+ break;
+ default:
+ errstr=g10_errstr(rc);
+ err=CURLE_COULDNT_CONNECT;
+ break;
+ }
+
return handle_error(curl,err,errstr);
}
Index: gnupg/keyserver/curl-shim.h
diff -u gnupg/keyserver/curl-shim.h:1.6 gnupg/keyserver/curl-shim.h:1.7
--- gnupg/keyserver/curl-shim.h:1.6 Thu Jun 23 06:44:20 2005
+++ gnupg/keyserver/curl-shim.h Wed Jul 20 23:48:28 2005
@@ -27,6 +27,7 @@
typedef enum
{
CURLE_OK=0,
+ CURLE_UNSUPPORTED_PROTOCOL=1,
CURLE_COULDNT_CONNECT=7,
CURLE_FTP_COULDNT_RETR_FILE=19,
CURLE_HTTP_RETURNED_ERROR=22,
Index: gnupg/keyserver/gpgkeys_curl.c
diff -u gnupg/keyserver/gpgkeys_curl.c:1.19 gnupg/keyserver/gpgkeys_curl.c:1.20
--- gnupg/keyserver/gpgkeys_curl.c:1.19 Fri Jun 24 01:42:35 2005
+++ gnupg/keyserver/gpgkeys_curl.c Wed Jul 20 23:48:28 2005
@@ -68,7 +68,7 @@
curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errorbuffer);
res=curl_easy_perform(curl);
- if(res!=0)
+ if(res!=CURLE_OK)
{
fprintf(console,"gpgkeys: %s fetch error %d: %s\n",opt->scheme,
res,errorbuffer);
@@ -77,7 +77,7 @@
else
fprintf(output,"\nKEY 0x%s END\n",getkey);
- return KEYSERVER_OK;
+ return curl_err_to_gpg_err(res);
}
static void
@@ -226,27 +226,6 @@
ret=KEYSERVER_SCHEME_NOT_FOUND;
goto fail;
}
-#ifdef HTTP_VIA_LIBCURL
- else if(strcasecmp(opt->scheme,"http")==0)
- ;
-#endif /* HTTP_VIA_LIBCURL */
-#ifdef HTTPS_VIA_LIBCURL
- else if(strcasecmp(opt->scheme,"https")==0)
- ;
-#endif /* HTTP_VIA_LIBCURL */
-#ifdef FTP_VIA_LIBCURL
- else if(strcasecmp(opt->scheme,"ftp")==0)
- ;
-#endif /* FTP_VIA_LIBCURL */
-#ifdef FTPS_VIA_LIBCURL
- else if(strcasecmp(opt->scheme,"ftps")==0)
- ;
-#endif /* FTPS_VIA_LIBCURL */
- else
- {
- fprintf(console,"gpgkeys: scheme `%s' not supported\n",opt->scheme);
- return KEYSERVER_SCHEME_NOT_FOUND;
- }
if(!opt->host)
{
Index: gnupg/keyserver/ksutil.c
diff -u gnupg/keyserver/ksutil.c:1.12 gnupg/keyserver/ksutil.c:1.13
--- gnupg/keyserver/ksutil.c:1.12 Sun Jun 5 16:34:47 2005
+++ gnupg/keyserver/ksutil.c Wed Jul 20 23:48:28 2005
@@ -342,6 +342,7 @@
switch(error)
{
case CURLE_FTP_COULDNT_RETR_FILE: return KEYSERVER_KEY_NOT_FOUND;
+ case CURLE_UNSUPPORTED_PROTOCOL: return KEYSERVER_SCHEME_NOT_FOUND;
default: return KEYSERVER_INTERNAL_ERROR;
}
}
More information about the Gnupg-commits
mailing list