Commit Graph

220 Commits

Author SHA1 Message Date
Daniel Kahn Gillmor 2b2f276785
curl-shim: clean up varargs
* keyserver/curl-shim.c (curl_easy_setopt) : ensure that va_end is
  called.

--

stdarg(3) says:
      Each invocation of va_start() must be matched by a
      corresponding invocation of va_end() in the same function.

Observed by Joshua Rogers <honey@internot.info>

Debian-Bug-Id: #773475

[dkg: rebased to STABLE-BRANCH-1-4]
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2015-02-23 10:52:48 +01:00
Werner Koch 592e1aa407 Modernize to automake 1.14.
* Makefile.am (AUTOMAKE_OPTIONS): Move to ...
* configure.ac (AM_INIT_AUTOMAKE): here and add serial-tests.

* keyserver/Makefile.am: Replace INCLUDES by AM_CPPFLAGS.
* mpi/Makefile.am: Ditto.
* util/Makefile.am: Ditto.
* keyserver/Makefile.am: Ditto.  Adjusted other things.

* m4/intl.m4, m4/po.m4: Use autoconf's AC_PROG_MKDIR_P.
2015-01-19 18:59:13 +01:00
Werner Koch 69088ac76f keyserver: Allow use of cURL's default CA store.
* keyserver/gpgkeys_curl.c (main): Set CURLOPT_CAINFO only if a file
has been given.
* keyserver/gpgkeys_hkp.c (main): Ditto.
--

GnuPG-bug-id: 1542
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit e957b9b3f4)
2013-10-04 20:47:48 +02:00
David Shaw 6f0ec6ab48 Differentiate between success (full or partial), not-found, and failure.
* keyserver/gpgkeys_hkp.c (get_key): Use curl_easy_setinfo to get the
  HTTP status code so we can tell the difference between a successful
  retrieval, a partial retrieval, a not-found, or a server failed.
2013-03-02 20:39:48 -05:00
David Shaw ca0b94d4d4 Emulate curl_easy_getinfo and CURLINFO_RESPONSE_CODE in curl-shim.
* keyserver/curl-shim.h, keyserver/curl-shim.c (curl_easy_getinfo):
  New. Return the HTTP status code for the last transfer.
2013-03-02 20:39:22 -05:00
Werner Koch 2812ab7d6a Last fix for the SRV record patches.
* keyserver/gpgkeys_hkp.c (srv_replace): Make sure SRVCOUNT is
always initialized.
--

See commit 5c557a51.
2012-12-20 20:29:53 +01:00
David Shaw 5c557a51cd Issue 1447: Pass proper Host header and SNI when SRV is used with curl.
* configure.ac: Check for inet_ntop.

* m4/libcurl.m4: Provide a #define for the version of the curl
  library.

* keyserver/gpgkeys_hkp.c (main, srv_replace): Call getaddrinfo() on
  each target.  Once we find one that resolves to an address (whether
  IPv4 or IPv6), pass it into libcurl via CURLOPT_RESOLVE using the
  SRV name as the "host".  Force the HTTP Host header to be the same.

Backported from 6b1f71055e

* keyserver/gpgkeys_hkp.c (main): Only default try-dns-srv to on if we
  have SRV support in the first place.

Backported from 732f3d1d47
2012-12-19 13:54:27 -05:00
David Shaw f2f12f41ef Fix issue 1446: honor ports given in SRV responses.
* common/http.c (send_request, connect_server, http_open): Use a
  struct srv instead of a single srvtag so we can pass the chosen host
  and port back to the caller.
  (connect_server): Use the proper port in the HAVE_GETADDRINFO case.

* keyserver/curl-shim.c (curl_easy_perform): Use struct srv and log
  chosen host and port.

* keyserver/gpgkeys_hkp.c (main): Properly take the port given by SRV.

Backported from ba9e974f1f
2012-12-18 21:58:53 -05:00
Werner Koch 3a22b622c8 Allow building with the 32 bit mingw-w64 toolchain.
* scripts/autogen.sh <--build-w32>: Support i686-w64-mingw32 and use
it by default if installed.
* keyserver/gpgkeys_ldap.c (my_ldap_start_tls_s): Define macro
depending on compiler version.
(main): Use new macro.
* util/miscutil.c [!HAVE_TIMEGM]: Add prototype for the timegm
autoconf replacement function.
--

It seems that the LDAP keyserver helper build with the old mingw32
toolchain never worked correctly for LDAPS.  The prototype there for
ldap_start_tls_s is plainly wrong for Windows.  Anyway I included
special support so not to break building with the old compiler.
2012-01-12 18:10:30 +01:00
David Shaw 6fe25e5602 Use the longest key ID available when talking to a HKP server.
This is issue 1340.  Now that PKSD is dead, and SKS supports long key
IDs, this is safe to do.  Patch from Daniel Kahn Gillmor
<dkg@fifthhorseman.net>.
2011-12-28 16:41:31 -05:00
Werner Koch 76b73caf91 Rename all ChangeLog files to ChangeLog-2011.
* ChangeLog: New file.
2011-12-02 19:42:56 +01:00
Werner Koch a95143e225 Removed some set but unused vars. 2011-08-09 10:54:22 +02:00
Werner Koch 5f9caad6f1 Last minute fixes 2009-09-02 17:30:53 +00:00
Werner Koch 20fe42d10b Restructured the compat functions and changed its license.
New fucntion xstrconcat for future use.
2009-08-25 20:00:24 +00:00
David Shaw 4401184ea7 * gpgkeys_hkp.c (main, srv_replace): Minor tweaks to use the DNS-SD
names ("pgpkey-http" and "pgpkey-https") in SRV lookups instead of
"hkp" and "hkps".
2009-07-08 03:50:26 +00:00
Werner Koch 64f24da283 Fix a couple of minor bugs. 2009-06-24 14:01:20 +00:00
David Shaw e9a1d6da83 * Makefile.am (gpgkeys_hkp_LDADD): Need DNSLIBS for the resolver now
that we're using SRVs.
2009-06-09 23:07:48 +00:00
David Shaw 0f993bbd65 * gpgkeys_hkp.c (srv_replace): Fix build warning. 2009-05-28 04:33:10 +00:00
David Shaw e8436d575e Avoid caches to get the most recent copy of the key. This is bug
#1061
2009-05-26 14:15:56 +00:00
David Shaw 7c57091f10 * gpgkeys_mailto.in: Set 'mail-from' as a keyserver-option, rather
than the ugly ?from= syntax.
2009-05-04 03:03:38 +00:00
David Shaw ee9edfe19f * gpgkeys_hkp.c (srv_replace): New function to transform a SRV
hostname to a real hostname.  (main): Call it from here for the
HAVE_LIBCURL case (without libcurl is handled via the curl-shim).
2009-04-21 03:04:08 +00:00
David Shaw a929f4c78e * curl-shim.h, curl-shim.c (curl_easy_setopt, curl_easy_perform): Add
a CURLOPT_SRVTAG_GPG_HACK (passed through the the http engine).

* http.h: Allow passing srvtag to http_open and http_open_document.

 * http.c (http_open, http_open_document): Allow passing srvtag to
http_open and http_open_document.
2009-04-03 03:59:07 +00:00
David Shaw c641585a42 * gpgkeys_hkp.c (main): Switch default port for SSLized HKP to 443
(i.e. the regular https port).
2009-04-02 03:50:50 +00:00
David Shaw fe57cdc2fb * gpgkeys_hkp.c (send_key, get_key, get_name, search_key, main): Add
support for SSLized HKP.
2009-02-03 19:40:28 +00:00
David Shaw b3ac8341d9 * curl-shim.h, gpgkeys_curl.c, gpgkeys_hkp.c (main): Always show curl
version (even for curl-shim).
2008-11-18 18:43:13 +00:00
Werner Koch 5452f53c5c Make --version close to GNU standards. 2008-11-18 18:17:10 +00:00
David Shaw 9e0919fad1 * curl-shim.h (curl_version): No need to provide a version for
curl-shim as it always matches the GnuPG version.

* gpgkeys_curl.c, gpgkeys_hkp.c (main): Show which version of curl
we're using as part of --version.

* gpgkeys_curl.c, gpgkeys_finger.c, gpgkeys_hkp.c, gpgkeys_ldap.c
(show_help): Document --version.
2008-11-18 17:09:07 +00:00
David Shaw 06278768b4 * gpgkeys_curl.c (main), gpgkeys_hkp.c (main): Make sure all libcurl
number options are passed as long.
2008-04-14 17:41:47 +00:00
David Shaw b9cbb0aa0b * curl-shim.c (curl_easy_setopt): Minor tweak to match the real curl
better - libcurl uses 'long', not 'unsigned int'.
2008-04-14 16:08:00 +00:00
Werner Koch 2c045c4fca Powerpc64 fix. 2008-03-25 10:45:59 +00:00
David Shaw 4c39fb56b8 * Makefile.am: Fix compile error when libcurl is in a nonstandard
location.
2007-12-17 21:27:10 +00:00
Werner Koch 9a2a818887 Switched to GPLv3.
Updated gettext.
2007-10-23 10:48:09 +00:00
David Shaw 43f18c4b65 * gpgkeys_ldap.c (main): Fix bug in setting up whether to verify peer
SSL cert.  This used to work with older OpenLDAP, but is now more
strictly handled.
2007-07-29 02:58:26 +00:00
David Shaw 3349267ee5 * gpgkeys_ldap.c: Fix build warning with mozldap. 2007-07-27 16:33:05 +00:00
David Shaw 8898e869a2 * gpgkeys_ldap.c (search_key, main): Fix bug where searching for foo
bar (no quotes) on the command line resulted in searching for
"foo\2Abar" due to LDAP quoting.  The proper search is "foo*bar".
2007-07-27 16:21:18 +00:00
David Shaw 1fc3e4a299 * gpgkeys_hkp.c (main): Show curl or fake-curl version string.
* Makefile.am: Link with libcompat.a for ascii_str(n)casecmp.
2007-04-16 22:47:20 +00:00
David Shaw e7c72ccc2f * gpgkeys_curl.c, gpgkeys_ldap.c, gpgkeys_hkp.c, ksutil.c: Rename all
str(n)casecmp to ascii_str(n)casecmp.  We want the locale-independent
ones here.
2007-04-16 22:43:29 +00:00
David Shaw 7a81947753 * gpgkeys_curl.c (main): Use curl_version_info to verify that the
protocol we're about to use is actually available.

* curl-shim.h, curl-shim.c (curl_free): Make into a macro.
(curl_version_info): New.  Only advertises "http" for our shim, of
course.
2007-03-13 17:53:57 +00:00
David Shaw 1475939994 * gpgkeys_ldap.c (send_key): Missing a free().
* curl-shim.c (curl_easy_perform): Some debugging items that may be
handy.
2007-02-11 03:56:59 +00:00
David Shaw b8bd7b6186 * curl-shim.h, curl-shim.c, gpgkeys_hkp.c: Rename curl_escape() to
curl_easy_escape() to match cURL.
2007-01-16 18:12:43 +00:00
David Shaw a15b16a356 * gpgkeys_hkp.c (send_key): Allow GPG to send any armored key line
length without problems.  Reported by Felix von Leitner.
2007-01-16 04:31:49 +00:00
David Shaw ede66f6fb5 * ksutil.c (classify_ks_search): Try and recognize a key ID even
without the 0x prefix.  This isn't exact (it's possible that a user ID
string happens to be 8 or 16 digits of hex), but it's extremely
unlikely.  Plus GPG itself makes the same assumption.
2006-12-04 01:20:55 +00:00
David Shaw 928db7d34b * gpgkeys_hkp.c (search_key): HKP keyservers like the 0x to be present
when searching by keyID.
2006-12-03 05:57:57 +00:00
David Shaw 1b41117e2a * gpgkeys_hkp.c (curl_mrindex_writer): Revert previous change.
Key-not-found still has a HTML response.
2006-11-06 03:37:08 +00:00
David Shaw 9e9214b944 * gpgkeys_hkp.c (curl_mrindex_writer): Print a warning if we see HTML
coming back from a MR hkp query.
2006-10-20 03:56:17 +00:00
David Shaw 6f32b4e4d1 Move strsep() and ascii_isspace() to libcompat. 2006-09-28 19:53:17 +00:00
David Shaw b17fcc5d51 Put in the basic wiring (just hextobyte for now) for a libcompat.a that
can contain replacement files that can be linked to keyserver helpers
without bringing in the whole libutil.a.  libutil.a contains a complete 
copy of libcompat.a so we only need to link to one of them.
2006-09-28 19:36:55 +00:00
David Shaw 61765b20e6 * gpgkeys_ldap.c (build_attrs), ksutil.c (ks_toupper, ks_strcasecmp),
ksutil.h: Remove the need for strcasecmp as the field tags are always
lowercase.
2006-09-28 19:30:03 +00:00
Werner Koch 29f68725d0 Allow to build w/o curl. 2006-09-26 14:15:17 +00:00
David Shaw 519435f06c * Makefile.am: Fix missing include path for gpgkeys_finger (needs the
libcurl path, even though it doesn't use libcurl because of
ksutil.c:curl_err_to_gpg_err().  Noted by Gilbert Fernandes.
2006-07-26 21:12:55 +00:00