mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* gpgkeys_hkp.c (send_key, get_key, get_name, search_key, main): Add
support for SSLized HKP.
This commit is contained in:
parent
3aa63ab224
commit
fe57cdc2fb
@ -1,3 +1,8 @@
|
|||||||
|
2009-02-03 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
|
* gpgkeys_hkp.c (send_key, get_key, get_name, search_key, main):
|
||||||
|
Add support for SSLized HKP.
|
||||||
|
|
||||||
2008-11-18 David Shaw <dshaw@jabberwocky.com>
|
2008-11-18 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* curl-shim.h, gpgkeys_curl.c, gpgkeys_hkp.c (main): Always show
|
* curl-shim.h, gpgkeys_curl.c, gpgkeys_hkp.c (main): Always show
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* gpgkeys_hkp.c - talk to an HKP keyserver
|
/* gpgkeys_hkp.c - talk to an HKP keyserver
|
||||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||||
* 2008 Free Software Foundation, Inc.
|
* 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
@ -54,6 +54,7 @@ static FILE *input,*output,*console;
|
|||||||
static CURL *curl;
|
static CURL *curl;
|
||||||
static struct ks_options *opt;
|
static struct ks_options *opt;
|
||||||
static char errorbuffer[CURL_ERROR_SIZE];
|
static char errorbuffer[CURL_ERROR_SIZE];
|
||||||
|
static char *proto,*port;
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
curl_mrindex_writer(const void *ptr,size_t size,size_t nmemb,void *stream)
|
curl_mrindex_writer(const void *ptr,size_t size,size_t nmemb,void *stream)
|
||||||
@ -186,13 +187,10 @@ send_key(int *eof)
|
|||||||
strcpy(key,"keytext=");
|
strcpy(key,"keytext=");
|
||||||
strcat(key,encoded_key);
|
strcat(key,encoded_key);
|
||||||
|
|
||||||
strcpy(request,"http://");
|
strcpy(request,proto);
|
||||||
strcat(request,opt->host);
|
strcat(request,opt->host);
|
||||||
strcat(request,":");
|
strcat(request,":");
|
||||||
if(opt->port)
|
strcat(request,port);
|
||||||
strcat(request,opt->port);
|
|
||||||
else
|
|
||||||
strcat(request,"11371");
|
|
||||||
strcat(request,opt->path);
|
strcat(request,opt->path);
|
||||||
/* request is MAX_URL+15 bytes long - MAX_URL covers the whole URL,
|
/* request is MAX_URL+15 bytes long - MAX_URL covers the whole URL,
|
||||||
including any supplied path. The 15 covers /pks/add. */
|
including any supplied path. The 15 covers /pks/add. */
|
||||||
@ -253,13 +251,10 @@ get_key(char *getkey)
|
|||||||
return KEYSERVER_NOT_SUPPORTED;
|
return KEYSERVER_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(request,"http://");
|
strcpy(request,proto);
|
||||||
strcat(request,opt->host);
|
strcat(request,opt->host);
|
||||||
strcat(request,":");
|
strcat(request,":");
|
||||||
if(opt->port)
|
strcat(request,port);
|
||||||
strcat(request,opt->port);
|
|
||||||
else
|
|
||||||
strcat(request,"11371");
|
|
||||||
strcat(request,opt->path);
|
strcat(request,opt->path);
|
||||||
/* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL,
|
/* request is MAX_URL+55 bytes long - MAX_URL covers the whole URL,
|
||||||
including any supplied path. The 60 overcovers this /pks/... etc
|
including any supplied path. The 60 overcovers this /pks/... etc
|
||||||
@ -334,13 +329,10 @@ get_name(const char *getkey)
|
|||||||
|
|
||||||
fprintf(output,"NAME %s BEGIN\n",getkey);
|
fprintf(output,"NAME %s BEGIN\n",getkey);
|
||||||
|
|
||||||
strcpy(request,"http://");
|
strcpy(request,proto);
|
||||||
strcat(request,opt->host);
|
strcat(request,opt->host);
|
||||||
strcat(request,":");
|
strcat(request,":");
|
||||||
if(opt->port)
|
strcat(request,port);
|
||||||
strcat(request,opt->port);
|
|
||||||
else
|
|
||||||
strcat(request,"11371");
|
|
||||||
strcat(request,opt->path);
|
strcat(request,opt->path);
|
||||||
append_path(request,"/pks/lookup?op=get&options=mr&search=");
|
append_path(request,"/pks/lookup?op=get&options=mr&search=");
|
||||||
strcat(request,searchkey_encoded);
|
strcat(request,searchkey_encoded);
|
||||||
@ -420,13 +412,10 @@ search_key(const char *searchkey)
|
|||||||
|
|
||||||
fprintf(output,"SEARCH %s BEGIN\n",searchkey);
|
fprintf(output,"SEARCH %s BEGIN\n",searchkey);
|
||||||
|
|
||||||
strcpy(request,"http://");
|
strcpy(request,proto);
|
||||||
strcat(request,opt->host);
|
strcat(request,opt->host);
|
||||||
strcat(request,":");
|
strcat(request,":");
|
||||||
if(opt->port)
|
strcat(request,port);
|
||||||
strcat(request,opt->port);
|
|
||||||
else
|
|
||||||
strcat(request,"11371");
|
|
||||||
strcat(request,opt->path);
|
strcat(request,opt->path);
|
||||||
append_path(request,"/pks/lookup?op=index&options=mr&search=");
|
append_path(request,"/pks/lookup?op=index&options=mr&search=");
|
||||||
|
|
||||||
@ -633,6 +622,28 @@ main(int argc,char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!opt->scheme)
|
||||||
|
{
|
||||||
|
fprintf(console,"gpgkeys: no scheme supplied!\n");
|
||||||
|
ret=KEYSERVER_SCHEME_NOT_FOUND;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ascii_strcasecmp(opt->scheme,"hkps")==0)
|
||||||
|
{
|
||||||
|
proto="https://";
|
||||||
|
port="11372";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
proto="http://";
|
||||||
|
port="11371";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(opt->port)
|
||||||
|
port=opt->port;
|
||||||
|
|
||||||
if(!opt->host)
|
if(!opt->host)
|
||||||
{
|
{
|
||||||
fprintf(console,"gpgkeys: no keyserver host provided\n");
|
fprintf(console,"gpgkeys: no keyserver host provided\n");
|
||||||
@ -666,6 +677,9 @@ main(int argc,char *argv[])
|
|||||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1L);
|
curl_easy_setopt(curl,CURLOPT_VERBOSE,1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,(long)opt->flags.check_cert);
|
||||||
|
curl_easy_setopt(curl,CURLOPT_CAINFO,opt->ca_cert_file);
|
||||||
|
|
||||||
if(proxy)
|
if(proxy)
|
||||||
curl_easy_setopt(curl,CURLOPT_PROXY,proxy);
|
curl_easy_setopt(curl,CURLOPT_PROXY,proxy);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user