diff options
author | David Shaw <dshaw@jabberwocky.com> | 2005-12-07 23:25:58 +0100 |
---|---|---|
committer | David Shaw <dshaw@jabberwocky.com> | 2005-12-07 23:25:58 +0100 |
commit | c826ccdec1f484266894e2e0be6ffd8c8bcce2fe (patch) | |
tree | 4736ae2da64185289c4aa4717e56b7230669943b | |
parent | Missed file. (diff) | |
download | gnupg2-c826ccdec1f484266894e2e0be6ffd8c8bcce2fe.tar.xz gnupg2-c826ccdec1f484266894e2e0be6ffd8c8bcce2fe.zip |
* ksutil.c (curl_err_to_gpg_err): Add CURLE_OK and CURLE_COULDNT_CONNECT.
* gpgkeys_curl.c (get_key): Give key-not-found error if no data is found
(or file itself is not found) during a fetch.
-rw-r--r-- | keyserver/ChangeLog | 8 | ||||
-rw-r--r-- | keyserver/gpgkeys_curl.c | 16 | ||||
-rw-r--r-- | keyserver/ksutil.c | 5 |
3 files changed, 24 insertions, 5 deletions
diff --git a/keyserver/ChangeLog b/keyserver/ChangeLog index 676cc5dff..6ac71ab98 100644 --- a/keyserver/ChangeLog +++ b/keyserver/ChangeLog @@ -1,3 +1,11 @@ +2005-12-07 David Shaw <dshaw@jabberwocky.com> + + * ksutil.c (curl_err_to_gpg_err): Add CURLE_OK and + CURLE_COULDNT_CONNECT. + + * gpgkeys_curl.c (get_key): Give key-not-found error if no data is + found (or file itself is not found) during a fetch. + 2005-12-06 David Shaw <dshaw@jabberwocky.com> * curl-shim.c (curl_easy_perform): Fix build warning (code before diff --git a/keyserver/gpgkeys_curl.c b/keyserver/gpgkeys_curl.c index c411b231f..73f8671d2 100644 --- a/keyserver/gpgkeys_curl.c +++ b/keyserver/gpgkeys_curl.c @@ -50,6 +50,7 @@ get_key(char *getkey) char errorbuffer[CURL_ERROR_SIZE]; char request[MAX_URL]; struct curl_writer_ctx ctx; + int ret=KEYSERVER_OK; memset(&ctx,0,sizeof(ctx)); @@ -70,14 +71,21 @@ get_key(char *getkey) res=curl_easy_perform(curl); if(res!=CURLE_OK) { - fprintf(console,"gpgkeys: %s fetch error %d: %s\n",opt->scheme, - res,errorbuffer); - fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res)); + fprintf(console,"gpgkeys: unable to fetch %s: %s\n",request,errorbuffer); + ret=curl_err_to_gpg_err(res); } + else if(!ctx.done) + { + fprintf(console,"gpgkeys: no key data found for %s\n",request); + ret=KEYSERVER_KEY_NOT_FOUND; + } + + if(ret) + fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,ret); else fprintf(output,"\nKEY 0x%s END\n",getkey); - return curl_err_to_gpg_err(res); + return ret; } static void diff --git a/keyserver/ksutil.c b/keyserver/ksutil.c index 595637756..e858bd410 100644 --- a/keyserver/ksutil.c +++ b/keyserver/ksutil.c @@ -46,6 +46,7 @@ int register_timeout(void) {return 0;} static void catch_alarm(int foo) { + (void)foo; _exit(KEYSERVER_TIMEOUT); } @@ -362,8 +363,10 @@ curl_err_to_gpg_err(CURLcode error) { switch(error) { - case CURLE_FTP_COULDNT_RETR_FILE: return KEYSERVER_KEY_NOT_FOUND; + case CURLE_OK: return KEYSERVER_OK; case CURLE_UNSUPPORTED_PROTOCOL: return KEYSERVER_SCHEME_NOT_FOUND; + case CURLE_COULDNT_CONNECT: return KEYSERVER_UNREACHABLE; + case CURLE_FTP_COULDNT_RETR_FILE: return KEYSERVER_KEY_NOT_FOUND; default: return KEYSERVER_INTERNAL_ERROR; } } |