1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

With --enable-gpg the keyservers are now build and a first test using gpg2

shows no prblems.   Needs more testing of course.
This commit is contained in:
Werner Koch 2006-08-16 10:47:53 +00:00
parent 5be40e9fad
commit b744f963d7
36 changed files with 952 additions and 372 deletions

View file

@ -1,3 +1,20 @@
2006-08-16 Werner Koch <wk@g10code.com>
* Makefile.am: Renamed all binaries to gpg2keys_*.
(gpg2keys_ldap_CPPFLAGS): Add AM_CPPFLAGS.
2006-08-15 Werner Koch <wk@g10code.com>
* Makefile.am: Adjusted to the gnupg2 framework.
2006-08-14 Werner Koch <wk@g10code.com>
* curl-shil.c, curl-shim.h: Changed to make use of the new http.c
API.
* curl-shim.c (curl_easy_perform): Add missing http_close to the
POST case.
2006-07-24 David Shaw <dshaw@jabberwocky.com> (wk)
* curl-shim.c (curl_easy_perform): Minor cleanup of proxy code.

View file

@ -18,36 +18,47 @@
## Process this file with automake to produce Makefile.in
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl
EXTRA_PROGRAMS = gpgkeys_ldap gpgkeys_hkp gpgkeys_finger gpgkeys_curl
EXTRA_SCRIPTS = gpgkeys_mailto
EXTRA_PROGRAMS = gpg2keys_ldap gpg2keys_hkp gpg2keys_finger gpg2keys_curl
EXTRA_SCRIPTS = gpg2keys_mailto
gpglibexecdir = $(libexecdir)/@PACKAGE@
AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/common -I$(top_srcdir)/intl
gpglibexec_PROGRAMS = @GPGKEYS_LDAP@ @GPGKEYS_HKP@ @GPGKEYS_FINGER@ @GPGKEYS_CURL@
gpglibexec_SCRIPTS = @GPGKEYS_MAILTO@
AM_CFLAGS = $(LIBGCRYPT_CFLAGS)
include $(top_srcdir)/am/cmacros.am
libexec_PROGRAMS = $(GPGKEYS_LDAP) $(GPGKEYS_HKP) $(GPGKEYS_FINGER) \
$(GPGKEYS_CURL)
libexec_SCRIPTS = $(GPGKEYS_MAILTO)
noinst_SCRIPTS = gpgkeys_test
gpgkeys_ldap_SOURCES = gpgkeys_ldap.c ksutil.c ksutil.h
gpgkeys_hkp_SOURCES = gpgkeys_hkp.c ksutil.c ksutil.h
gpgkeys_finger_SOURCES = gpgkeys_finger.c ksutil.c ksutil.h
gpgkeys_curl_SOURCES = gpgkeys_curl.c ksutil.c ksutil.h
needed_libs = ../gl/libgnu.a ../common/libcommon.a ../jnlib/libjnlib.a
other_libs = $(LIBICONV) $(LIBINTL) $(CAPLIBS)
gpgkeys_ldap_CPPFLAGS = @LDAP_CPPFLAGS@
gpgkeys_ldap_LDADD = ../util/libutil.a @LDAPLIBS@ @NETLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
gpg2keys_ldap_SOURCES = gpgkeys_ldap.c ksutil.c ksutil.h
gpg2keys_hkp_SOURCES = gpgkeys_hkp.c ksutil.c ksutil.h
gpg2keys_finger_SOURCES = gpgkeys_finger.c ksutil.c ksutil.h
gpg2keys_curl_SOURCES = gpgkeys_curl.c ksutil.c ksutil.h
gpgkeys_finger_LDADD = ../util/libutil.a @NETLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
gpg2keys_ldap_CPPFLAGS = $(LDAP_CPPFLAGS) $(AM_CPPFLAGS)
gpg2keys_ldap_LDADD = $(needed_libs) $(LDAPLIBS) $(NETLIBS) \
$(other_libs) $(W32LIBS)
gpg2keys_finger_LDADD = $(needed_libs) $(LIBGCRYPT_LIBS) \
$(NETLIBS) $(other_libs) $(W32LIBS)
if FAKE_CURL
gpgkeys_curl_SOURCES += curl-shim.c curl-shim.h
gpgkeys_curl_LDADD = ../util/libutil.a @NETLIBS@ @SRVLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
gpgkeys_hkp_SOURCES += curl-shim.c curl-shim.h
gpgkeys_hkp_LDADD = ../util/libutil.a @NETLIBS@ @SRVLIBS@ $(other_libs) @GETOPT@ @W32LIBS@
gpg2keys_curl_SOURCES += curl-shim.c curl-shim.h
gpg2keys_curl_LDADD = $(needed_libs) $(NETLIBS) $(DNSLIBS) \
$(other_libs) $(W32LIBS)
gpg2keys_hkp_SOURCES += curl-shim.c curl-shim.h
gpg2keys_hkp_LDADD = $(needed_libs) $(NETLIBS) $(DNSLIBS) \
$(other_libs) $(W32LIBS)
else
gpgkeys_curl_CPPFLAGS = @LIBCURL_CPPFLAGS@
gpgkeys_curl_LDADD = @LIBCURL@ @GETOPT@
gpgkeys_hkp_CPPFLAGS = @LIBCURL_CPPFLAGS@
gpgkeys_hkp_LDADD = @LIBCURL@ @GETOPT@
gpg2keys_curl_CPPFLAGS = $(LIBCURL_CPPFLAGS) $(AM_CPPFLAGS)
gpg2keys_curl_LDADD = $(LIBCURL) $(GETOPT)
gpg2keys_hkp_CPPFLAGS = $(LIBCURL_CPPFLAGS) $(AM_CPPFLAGS)
gpg2keys_hkp_LDADD = $(LIBCURL) $(GETOPT)
endif

View file

@ -27,6 +27,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include "http.h"
#include "util.h"
#include "ksutil.h"
@ -100,7 +101,11 @@ curl_easy_init(void)
void
curl_easy_cleanup(CURL *curl)
{
free(curl);
if (curl)
{
http_close (curl->hd);
free(curl);
}
}
CURLcode
@ -177,42 +182,46 @@ curl_easy_perform(CURL *curl)
if(curl->flags.post)
{
rc=http_open(&curl->hd,HTTP_REQ_POST,curl->url,curl->auth,0,proxy);
if(rc==0)
rc = http_open (&curl->hd, HTTP_REQ_POST, curl->url, curl->auth,
0, proxy, NULL);
if (!rc)
{
char content_len[50];
unsigned int post_len=strlen(curl->postfields);
unsigned int post_len = strlen(curl->postfields);
iobuf_writestr(curl->hd.fp_write,
"Content-Type: application/x-www-form-urlencoded\r\n");
sprintf(content_len,"Content-Length: %u\r\n",post_len);
es_fprintf (http_get_write_ptr (curl->hd),
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: %u\r\n", post_len);
http_start_data (curl->hd);
es_write (http_get_write_ptr (curl->hd),
curl->postfields, post_len, NULL);
iobuf_writestr(curl->hd.fp_write,content_len);
http_start_data(&curl->hd);
iobuf_write(curl->hd.fp_write,curl->postfields,post_len);
rc=http_wait_response(&curl->hd,&curl->status);
if(rc==0 && curl->flags.failonerror && curl->status>=300)
err=CURLE_HTTP_RETURNED_ERROR;
rc = http_wait_response (curl->hd);
curl->status = http_get_status_code (curl->hd);
if (!rc && curl->flags.failonerror && curl->status>=300)
err = CURLE_HTTP_RETURNED_ERROR;
http_close(curl->hd);
curl->hd = NULL;
}
}
else
{
rc=http_open(&curl->hd,HTTP_REQ_GET,curl->url,curl->auth,0,proxy);
if(rc==0)
rc = http_open (&curl->hd, HTTP_REQ_GET, curl->url, curl->auth,
0, proxy, NULL);
if (!rc)
{
rc=http_wait_response(&curl->hd,&curl->status);
if(rc==0)
rc = http_wait_response (curl->hd);
curl->status = http_get_status_code (curl->hd);
if (!rc)
{
if(curl->flags.failonerror && curl->status>=300)
err=CURLE_HTTP_RETURNED_ERROR;
if (curl->flags.failonerror && curl->status>=300)
err = CURLE_HTTP_RETURNED_ERROR;
else
{
unsigned int maxlen=1024,buflen,len;
byte *line=NULL;
unsigned int maxlen = 1024, buflen, len;
unsigned char *line = NULL;
while((len=iobuf_read_line(curl->hd.fp_read,
&line,&buflen,&maxlen)))
while ((len = es_read_line (http_get_read_ptr (curl->hd),
&line, &buflen, &maxlen)))
{
size_t ret;
@ -226,12 +235,16 @@ curl_easy_perform(CURL *curl)
}
}
xfree(line);
http_close(&curl->hd);
es_free (line);
http_close(curl->hd);
curl->hd = NULL;
}
}
else
http_close(&curl->hd);
{
http_close (curl->hd);
curl->hd = NULL;
}
}
}

View file

@ -73,7 +73,7 @@ typedef struct
unsigned int failonerror:1;
unsigned int verbose:1;
} flags;
struct http_context hd;
http_t hd;
} CURL;
#define CURL_ERROR_SIZE 256

View file

@ -46,6 +46,7 @@
#include "util.h"
#include "keyserver.h"
#include "ksutil.h"
#include "iobuf.h"
#ifdef _WIN32
#define sock_close(a) closesocket(a)
@ -289,7 +290,7 @@ get_key (char *getkey)
{
int rc;
int sock;
IOBUF fp_read;
iobuf_t fp_read;
unsigned int maxlen, buflen, gotit=0;
byte *line = NULL;