From 231d27e0fec905be52d679961332947c3331f15f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 24 Nov 2011 15:48:24 +0100 Subject: [PATCH] Make HKP keyserver engine work again. We had some debug code here which prevented it from working. The host selection code still needs a review! * ks-engine-http.c (ks_http_help): Do not print help for hkp. * ks-engine-hkp.c (ks_hkp_help): Print help only for hkp. (send_request): Remove test code. (map_host): Use xtrymalloc. * certcache.c (classify_pattern): Remove unused variable and make explicit substring search work. --- dirmngr/ChangeLog | 10 ++++++++++ dirmngr/certcache.c | 5 ++--- dirmngr/ks-action.c | 2 +- dirmngr/ks-engine-hkp.c | 8 ++++---- dirmngr/ks-engine-http.c | 2 +- dirmngr/ldap.c | 4 ++-- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/dirmngr/ChangeLog b/dirmngr/ChangeLog index a06558c0e..0968b411c 100644 --- a/dirmngr/ChangeLog +++ b/dirmngr/ChangeLog @@ -1,3 +1,13 @@ +2011-11-24 Werner Koch + + * ks-engine-http.c (ks_http_help): Do not print help for hkp. + * ks-engine-hkp.c (ks_hkp_help): Print help only for hkp. + (send_request): Remove test code. + (map_host): Use xtrymalloc. + + * certcache.c (classify_pattern): Remove unused variable and make + explicit substring search work. + 2011-06-01 Marcus Brinkmann * Makefile.am (dirmngr_ldap_CFLAGS): Add $(LIBGCRYPT_CFLAGS), diff --git a/dirmngr/certcache.c b/dirmngr/certcache.c index 3ada60dfe..a8b84e6e3 100644 --- a/dirmngr/certcache.c +++ b/dirmngr/certcache.c @@ -681,11 +681,10 @@ get_cert_bysubject (const char *subject_dn, unsigned int seq) static enum pattern_class classify_pattern (const char *pattern, size_t *r_offset, size_t *r_sn_offset) { - enum pattern_class result = PATTERN_UNKNOWN; + enum pattern_class result; const char *s; int hexprefix = 0; int hexlength; - int mode = 0; *r_offset = *r_sn_offset = 0; @@ -718,7 +717,7 @@ classify_pattern (const char *pattern, size_t *r_offset, size_t *r_sn_offset) break; case '*': /* Case insensitive substring search. */ - mode = PATTERN_SUBSTR; + result = PATTERN_SUBSTR; s++; break; diff --git a/dirmngr/ks-action.c b/dirmngr/ks-action.c index 14de4d6c0..9ebf69b3c 100644 --- a/dirmngr/ks-action.c +++ b/dirmngr/ks-action.c @@ -87,7 +87,7 @@ ks_action_help (ctrl_t ctrl, const char *url) if (!parsed_uri) ks_print_help (ctrl, - "(Use the schema followed by a colon for specific help.)"); + "(Use an URL for engine specific help.)"); else http_release_parsed_uri (parsed_uri); return err; diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index d4a12111b..98187ab01 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -209,7 +209,7 @@ map_host (const char *name) int refidx; reftblsize = 100; - reftbl = xmalloc (reftblsize * sizeof *reftbl); + reftbl = xtrymalloc (reftblsize * sizeof *reftbl); if (!reftbl) return NULL; refidx = 0; @@ -280,7 +280,7 @@ map_host (const char *name) else { if (ai->ai_family == AF_INET) - hosttable[tmpidx]->v4 = 1; + hosttable[tmpidx]->v4 = 1; if (ai->ai_family == AF_INET6) hosttable[tmpidx]->v6 = 1; @@ -409,7 +409,7 @@ ks_hkp_help (ctrl_t ctrl, parsed_uri_t uri) if (!uri) err = ks_print_help (ctrl, " hkp"); - else if (uri->is_http) + else if (uri->is_http && !strcmp (uri->scheme, "hkp")) err = ks_print_help (ctrl, data); else err = 0; @@ -472,7 +472,7 @@ send_request (ctrl_t ctrl, const char *request, const char *hostportstr, char *request_buffer = NULL; *r_fp = NULL; - return gpg_error (GPG_ERR_NOT_SUPPORTED); + once_more: err = http_open (&http, post_cb? HTTP_REQ_POST : HTTP_REQ_GET, diff --git a/dirmngr/ks-engine-http.c b/dirmngr/ks-engine-http.c index 2ce1b19a1..b0e2e14cb 100644 --- a/dirmngr/ks-engine-http.c +++ b/dirmngr/ks-engine-http.c @@ -43,7 +43,7 @@ ks_http_help (ctrl_t ctrl, parsed_uri_t uri) if (!uri) err = ks_print_help (ctrl, " http"); - else if (uri->is_http) + else if (uri->is_http && strcmp (uri->scheme, "hkp")) err = ks_print_help (ctrl, data); else err = 0; diff --git a/dirmngr/ldap.c b/dirmngr/ldap.c index 87121fd83..638348b5b 100644 --- a/dirmngr/ldap.c +++ b/dirmngr/ldap.c @@ -666,7 +666,7 @@ fetch_next_cert_ldap (cert_fetch_context_t context, char *p, *pend; int n; int okay = 0; - int is_cms = 0; + /* int is_cms = 0; */ *value = NULL; *valuelen = 0; @@ -758,7 +758,7 @@ fetch_next_cert_ldap (cert_fetch_context_t context, { p = context->tmpbuf; p[n] = 0; /*(we allocated one extra byte for this.)*/ - is_cms = 0; + /* fixme: is_cms = 0; */ if ( (pend = strchr (p, ';')) ) *pend = 0; /* Strip off the extension. */ if (!ascii_strcasecmp (p, USERCERTIFICATE))