gnupg.git
4 days agoscd: Make "learn" report about KDF data object. STABLE-BRANCH-2-2
NIIBE Yutaka [Thu, 15 Nov 2018 04:31:12 +0000 (13:31 +0900)]
scd: Make "learn" report about KDF data object.

* scd/app-openpgp.c (do_learn_status): Report KDF attr.
* g10/card-util.c (current_card_status): Output KDF for with_colons.

--

Backport of master commit: 05d163aebc04db109ec5e004eb04a4b3796f6421
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 days agocard: Display if KDF is enabled or not.
NIIBE Yutaka [Thu, 15 Nov 2018 03:19:02 +0000 (12:19 +0900)]
card: Display if KDF is enabled or not.

* g10/call-agent.h (kdf_do_enabled): New field.
* g10/call-agent.c (learn_status_cb): Set kdf_do_enabled if available.
* g10/card-util.c (current_card_status): Inform the availability.

--

Cherry pick of master commit: a5542a4a702c2210facf58a98bc8d3d16089b6ab
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 days agog10: Fix memory leak for --card-status.
NIIBE Yutaka [Tue, 18 Sep 2018 00:34:00 +0000 (09:34 +0900)]
g10: Fix memory leak for --card-status.

* g10/card-util.c (card_status): Release memory of serial number.

--

Cherry pick of master commit: fe8b6339542f3b1228b5fd56fc710ea3b07a3a2b
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 days agog10: Fix print_pubkey_info new line output.
NIIBE Yutaka [Wed, 5 Dec 2018 07:44:59 +0000 (16:44 +0900)]
g10: Fix print_pubkey_info new line output.

* g10/keylist.c (print_pubkey_info): Reverse the condition.

--

This mistakes were introduced when replacing by estream.

It resulted 'gpg --card-status' from a process with no controlling
terminal fails.

Fixes-commit: fb2ba98963beea249474f5d6d7345cf9b4b7f570
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit e154fba30ba0d5f29040a33f5c1b5c25b441b69f)

5 days agogpg: New list-option "show-only-fpr-mbox".
Werner Koch [Tue, 4 Dec 2018 11:32:28 +0000 (12:32 +0100)]
gpg: New list-option "show-only-fpr-mbox".

* g10/gpg.c (parse_list_options): Add option "show-only-fpr-mbox".
* g10/options.h (LIST_SHOW_ONLY_FPR_MBOX): New.
* g10/keylist.c (list_keyblock_simple): New.
(list_keyblock): Call it.
(list_all): Do not print the keyring name in LIST_SHOW_ONLY_FPR_MBOX
mode.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 0e8bf204791ebfd0c9a8e4b49fbadf998ec62e49)

* g10/keylist.c (list_keyblock_simple): Remove optional arg from
mailbox_from_userid

5 days agowks: Fix filter expression syntax flaw.
Werner Koch [Tue, 4 Dec 2018 15:00:49 +0000 (16:00 +0100)]
wks: Fix filter expression syntax flaw.

* tools/wks-util.c (wks_get_key, wks_filter_uid): The filter
expression needs a space before the value.
(install_key_from_spec_file): Replace es_getline by es_read_line and
remove debug output.
--

A value of starting with '<' was considered an invalid operator due to
our tokenization method.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 0c36ec241d285545f286069843de4f663cd274a3)

5 days agowks: Allow reading of --install-key arguments from stdin.
Werner Koch [Tue, 4 Dec 2018 14:27:19 +0000 (15:27 +0100)]
wks: Allow reading of --install-key arguments from stdin.

* tools/wks-util.c (install_key_from_spec_file): New.
(wks_cmd_install_key): Call it.
* tools/gpg-wks-client.c (main): Allow --install-key w/o arguments.
* tools/gpg-wks-server.c (main): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ba46a359b9d6549b74ec8401ea39bad434d87564)

5 days agowks: Create sub-directories
Werner Koch [Tue, 4 Dec 2018 10:37:54 +0000 (11:37 +0100)]
wks: Create sub-directories

* tools/wks-util.c (wks_compute_hu_fname): Stat and create directory
if needed.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 73e5b0ec9b9ba5e04e55f8c42d81e23df7c3afe0)

5 days agowks: Add new commands --install-key and --remove-key to the client.
Werner Koch [Tue, 4 Dec 2018 09:31:42 +0000 (10:31 +0100)]
wks: Add new commands --install-key and --remove-key to the client.

* tools/gpg-wks-client.c (aInstallKey, aRemoveKey, oDirectory): New.
(opts): Add "--install-key", "--remove-key" and "-C".
(parse_arguments): Parse them.
(main): Check that the given directory exists.  Implement the new
commands.
--

These commands maybe useful to prepare a WKD directory on a non-Unix
box using the standard wks client.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 602b1909632925d5a2e0778c102d66109795c627)

5 days agowks: Move a few server functions to wks-util.
Werner Koch [Tue, 4 Dec 2018 08:45:42 +0000 (09:45 +0100)]
wks: Move a few server functions to wks-util.

* tools/gpg-wks-server.c (write_to_file): Move to ...
* tools/wks-util.c: here.
* tools/gpg-wks-server.c (compute_hu_fname): Move to ...
* tools/wks-util.c (wks_compute_hu_fname): here.
* tools/gpg-wks-server.c (fname_from_userid): Move to ...
* tools/wks-util.c (wks_fname_from_userid): here.
* tools/gpg-wks-server.c (command_install_key): Move to ...
* tools/wks-util.c (wks_cmd_install_key): here and change caller.
* tools/gpg-wks-server.c (command_remove_key): Move to ...
* tools/wks-util.c (wks_cmd_remove_key): here and change callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 99094c992c20dd22971beb3527cfda109cd1df89)

5 days agog10/mainproc: disable hash contexts when --skip-verify is used
Jussi Kivilinna [Sat, 1 Dec 2018 11:43:10 +0000 (13:43 +0200)]
g10/mainproc: disable hash contexts when --skip-verify is used

* g10/mainproc.c (proc_plaintext): Do not enable hash contexts when
opt.skip_verify is set.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
(cherry picked from commit 73e74de0e33bbb76300f96a4174024779047df06)

5 days agocommon/iobuf: fix memory wiping in iobuf_copy
Jussi Kivilinna [Sat, 1 Dec 2018 11:43:10 +0000 (13:43 +0200)]
common/iobuf: fix memory wiping in iobuf_copy

* common/iobuf.c (iobuf_copy): Wipe used area of buffer instead of
first sizeof(char*) bytes.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
(cherry picked from commit 654e353d9b20f10fa275e7ae10cc50480654f079)

5 days agocommon: Use platform memory zeroing function for wipememory
Jussi Kivilinna [Sat, 1 Dec 2018 11:43:09 +0000 (13:43 +0200)]
common: Use platform memory zeroing function for wipememory

* common/mischelp.h (wipememory): Replace macro with function
prototype.
(wipememory2): Remove.
* common/mischelp.c (wipememory): New.
* configure.ac (AC_CHECK_FUNCS): Check for 'explicit_bzero' and
remove duplicated checks.
--

In new wipememory function, memory is cleared through platform
provided secure memory zeroing function, SecureZeroMemory
or explicit_bzero.

If none of these is available, memset is called through
volatile function pointer to so that compiler won't optimize
away the call.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
(cherry picked from commit 2a650772b4e1c78a4fd20bc88433930e5551fe9c)

5 days agogpg: Improve error message about failed keygrip computation.
Werner Koch [Fri, 30 Nov 2018 11:35:37 +0000 (12:35 +0100)]
gpg: Improve error message about failed keygrip computation.

* g10/keyid.c (keygrip_from_pk): Print the fingerprint on failure.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit cd64af003d4b6b46b69dbd575f73d53359ae0bcc)

2 weeks agodirmngr: Avoid possible CSRF attacks via http redirects.
Werner Koch [Thu, 22 Nov 2018 21:27:56 +0000 (22:27 +0100)]
dirmngr: Avoid possible CSRF attacks via http redirects.

* dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path.
(http_redir_info_t): New.
* dirmngr/http.c (do_parse_uri): Set new fields.
(same_host_p): New.
(http_prepare_redirect): New.
* dirmngr/t-http-basic.c: New test.
* dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect
instead of the open code.
* dirmngr/ks-engine-http.c (ks_http_fetch): Ditto.
--

With this change a http query will not follow a redirect unless the
Location header gives the same host.  If the host is different only
the host and port is taken from the Location header and the original
path and query parts are kept.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144)

2 weeks agodoc: Clarify use of clear and nodefault in the AKL.
Werner Koch [Wed, 21 Nov 2018 08:20:56 +0000 (09:20 +0100)]
doc: Clarify use of clear and nodefault in the AKL.

--

(cherry picked from commit e5c3a6999a374813134a9e68744444c25c3017f6)

3 weeks agotools: Let gpg-zip print a deprecation warning.
Werner Koch [Thu, 15 Nov 2018 15:13:52 +0000 (16:13 +0100)]
tools: Let gpg-zip print a deprecation warning.

--
GnuPG-bug-id: 4251

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agodirmngr: Add FLUSHCRLs command
Andre Heinecke [Wed, 24 Oct 2018 08:40:42 +0000 (10:40 +0200)]
dirmngr: Add FLUSHCRLs command

Summary:
* dirmngr/crlcache.c (crl_cache_flush): Also deinit the cache.
* dirmngr/server.c (hlp_flushcrls, cmd_flushcrls): New.
(register_commands): Add FLUSHCRLS.

--
This allows it to flush the CRL cache of a running dirmngr
server. This can be useful to debug / analyze CRL issues.

GnuPG-Bug-Id: T3967

Differential Revision: https://dev.gnupg.org/D469

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
4 weeks agoPost release updates.
Werner Koch [Tue, 6 Nov 2018 10:42:26 +0000 (11:42 +0100)]
Post release updates.

--

4 weeks agoRelease 2.1.11 gnupg-2.2.11
Werner Koch [Tue, 6 Nov 2018 10:08:02 +0000 (11:08 +0100)]
Release 2.1.11

Signed-off-by: Werner Koch <wk@gnupg.org>
4 weeks agopo: Update Czech translation
Petr Pisar [Tue, 6 Nov 2018 10:04:25 +0000 (11:04 +0100)]
po: Update Czech translation

--

4 weeks agopo: Update German translation
Werner Koch [Tue, 6 Nov 2018 10:00:27 +0000 (11:00 +0100)]
po: Update German translation

--

4 weeks agog10: Fix print_keygrip for smartcard.
NIIBE Yutaka [Tue, 6 Nov 2018 06:28:43 +0000 (15:28 +0900)]
g10: Fix print_keygrip for smartcard.

* g10/card-util.c (print_keygrip): Use tty_fprintf.

--

Reported-by: Joey Pabalinas <joeypabalinas@gmail.com>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 weeks agowks: New option --with-colons for gpg-wks-client.
Werner Koch [Mon, 5 Nov 2018 19:58:27 +0000 (20:58 +0100)]
wks: New option --with-colons for gpg-wks-client.

* tools/gpg-wks.h (opt): Add field with_colons.
* tools/gpg-wks-client.c (oWithColons): New const.
(opts, parse_arguments): Add option --with-colons.
(main): Change aSupported to take several domains in --with-colons
mode.
(command_send): Factor policy getting code out to ...
(get_policy_and_sa): New function.
(command_supported): Make use of new function.
--

In addition to this the --create command now also supports a
submission address only in the policy file.  That means the
submission-address file is not anymore required and can be replaced by
the policy file.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit e3a1e80d13487c9336640a99b2f6d385d7d6f55c)

5 weeks agospeedo: Remove obsolete configure option of gpgme.
Werner Koch [Mon, 5 Nov 2018 11:47:44 +0000 (12:47 +0100)]
speedo: Remove obsolete configure option of gpgme.

* build-aux/speedo.mk (speedo_pkg_gpgme_configure): Remove
--disable-w32-qt option.
--

This option is obsolete since GPGME 1.7 (in 2016)

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit d7323bb2d957fbeb8192c0ecbd99b1d14d302912)

5 weeks agospeedo: Include Windows patch for gpgme 1.12.0
Werner Koch [Mon, 5 Nov 2018 07:59:13 +0000 (08:59 +0100)]
speedo: Include Windows patch for gpgme 1.12.0

--

We don't want to do a release of gpgme right now, so we include just
this minimal but important fix.

5 weeks agodirmngr: In verbose mode print the OCSP responder id.
Werner Koch [Mon, 22 Oct 2018 12:23:11 +0000 (14:23 +0200)]
dirmngr: In verbose mode print the OCSP responder id.

* dirmngr/ocsp.c (ocsp_isvalid): Print the responder id.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 0a7f446c189201ca6e527af08b44da756b343209)

5 weeks agotools: Replace duplicated code in mime-maker.
Werner Koch [Mon, 15 Oct 2018 09:32:19 +0000 (11:32 +0200)]
tools: Replace duplicated code in mime-maker.

* tools/rfc822parse.c (HEADER_NAME_CHARS): New.  Taken from
mime-maker.c.
(rfc822_valid_header_name_p): New.  Based on code from mime-maker.c.
(rfc822_capitalize_header_name): New.  Copied from mime-maker.c.
(capitalize_header_name): Remove.  Replace calls by new func.
(my_toupper, my_strcasecmp): New.
* tools/mime-maker.c: Include rfc822parse.h.
(HEADER_NAME_CHARS, capitalize_header_name): Remove.
(add_header): Replace check and capitalization by new functions.
--

This is a straightforward change with two minor chnages:

- In rfc822parse.c the capitalization handles MIME-Version special.
- The check in mime-maker bow detects a zero-length name as invalid.

my_toupper and my_strcasecmp are introduced to allow standalone use
of that file.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f03928b16c4fb00077d22d8ec141575ef6d26913)

5 weeks agogpg: Don't take the a TOFU trust model from the trustdb,
Werner Koch [Wed, 10 Oct 2018 09:46:16 +0000 (11:46 +0200)]
gpg: Don't take the a TOFU trust model from the trustdb,

* g10/tdbio.c (tdbio_update_version_record): Never store a TOFU model.
(create_version_record): Don't init as TOFU.
(tdbio_db_matches_options): Don't indicate a change in case TOFU is
stored in an old trustdb file.
--

This change allows to switch between a tofu and pgp or tofu+pgp trust
model without an auto rebuild of the trustdb.  This also requires that
the tofu trust model is requested on the command line.  If TOFU will
ever be the default we need to tweak the model detection via TM_AUTO
by also looking into the TOFU data base,

GnuPG-bug-id: 4134
(cherry picked from commit 150a33df41944d764621f037038683f3d605aa3f)

5 weeks agogpg: Add new card vendor
Werner Koch [Thu, 4 Oct 2018 07:57:03 +0000 (09:57 +0200)]
gpg: Add new card vendor

--

(cherry picked from commit 3c2ffd27f36dfe77005aa01005145904761d8743)

5 weeks agodirmngr: Emit SOURCE status also on NO_DATA.
Werner Koch [Fri, 7 Sep 2018 09:48:18 +0000 (11:48 +0200)]
dirmngr: Emit SOURCE status also on NO_DATA.

* dirmngr/ks-engine-hkp.c (ks_hkp_search): Send SOURCE status also on
NO DATA error.
(ks_hkp_get): Ditto.
* g10/call-dirmngr.c (gpg_dirmngr_ks_search): Print "data source" info
also on error.
(gpg_dirmngr_ks_get): Ditto.
--

If a keyserver does not return any data it can be useful to know which
keyserver out of the pool answered.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit bee65edfbc8cc2c369e5941cc9d1a01a0519b388)

5 weeks agodirmngr: Fix LDAP port parsing.
Werner Koch [Mon, 5 Nov 2018 07:59:13 +0000 (08:59 +0100)]
dirmngr: Fix LDAP port parsing.

* dirmngr/misc.c (host_and_port_from_url): Fix bad port parsing and a
segv for a missing slash after the host name.
--

Reportted-by: Tomas Mraz
GnuPG-bug-id: 4230
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit a3a5a2451924640588e5ecc03a1d4ba6a6ba94a5)

6 weeks agobuild: By default build wks-tools on all Unix platforms.
Werner Koch [Fri, 26 Oct 2018 12:54:52 +0000 (14:54 +0200)]
build: By default build wks-tools on all Unix platforms.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit b83fed64f8051279a8f36e024c1f12f7f13c4716)

6 weeks agowkd: Add option --directory to the server.
Werner Koch [Fri, 26 Oct 2018 12:44:32 +0000 (14:44 +0200)]
wkd: Add option --directory to the server.

* tools/gpg-wks-server.c (opts): Add '--directory',
(main): Explain how to set correct permissions.
(command_list_domains): Create an empty policy file and remove the
warning for an empty policy file.
--

Note that a policy file is meanwhile required and thus is is useful to
create it.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f248416bc9792e80bb0785302058131de49d7639)

6 weeks agospeedo: Sign the windows installer with a timestamp.
Werner Koch [Thu, 25 Oct 2018 16:27:04 +0000 (18:27 +0200)]
speedo: Sign the windows installer with a timestamp.

--

6 weeks agodirmngr: Fix out of scope use of a var in the keyserver LDAP code.
Werner Koch [Thu, 25 Oct 2018 15:21:52 +0000 (17:21 +0200)]
dirmngr: Fix out of scope use of a var in the keyserver LDAP code.

* dirmngr/ks-engine-ldap.c (extract_attributes): Don't use a variabale
out of scope and cleanup the entire pgpKeySize block.
--

GnuPG-bug-id: 4229
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 2b57a8159cdc3b212a4efc68787b40cafcd91ebe)

6 weeks agoagent: Fix possible uninitalized use of CTX in simple_pwquery.
Werner Koch [Wed, 24 Oct 2018 18:22:17 +0000 (20:22 +0200)]
agent: Fix possible uninitalized use of CTX in simple_pwquery.

* common/simple-pwquery.c (agent_open): Clear CTX even on early error.
--

GnuPG-bug-id: 4223
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit bafcf7095159493a656382997f8b0d0bb11a20e8)

6 weeks agoagent: Fix possible release of unitialize var in a genkey error case.
Werner Koch [Wed, 24 Oct 2018 18:16:26 +0000 (20:16 +0200)]
agent: Fix possible release of unitialize var in a genkey error case.

* agent/command.c (cmd_genkey): Initialize 'value'.
--

GnuPG-bug-id: 4222
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 2bdc4b6ed97770ed15ec6c5afa02c2e44568a3bc)

6 weeks agossh: Fix possible infinite loop in case of an read error.
Werner Koch [Wed, 24 Oct 2018 18:11:33 +0000 (20:11 +0200)]
ssh: Fix possible infinite loop in case of an read error.

* agent/command-ssh.c (ssh_handler_add_identity): Handle other errors
than EOF.
--

GnuPG-bug-id: 4221
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 7385e1babf6eef586c79ad23f8e541aaf608c4e5)

6 weeks agotools: Fix FILE memory leak in gpg-connect-agent.
Werner Koch [Wed, 24 Oct 2018 18:04:52 +0000 (20:04 +0200)]
tools: Fix FILE memory leak in gpg-connect-agent.

* tools/gpg-connect-agent.c (do_open): dup the fileno and close the
stream.

GnuPG-bug-id: 4220
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 378719f25fe00d46393541f4a4f79e04484c3000)

6 weeks agosm: Use the correct string in an error message.
Werner Koch [Wed, 24 Oct 2018 17:55:19 +0000 (19:55 +0200)]
sm: Use the correct string in an error message.

* sm/gpgsm.c (main): Fix error message.
--

GnuPG-bug-id: 4219
(cherry picked from commit 793fd8d876777c24c4d5072301fa530333d6e1d9)

6 weeks agodirmngr: Only print info for no ldapserver file
Andre Heinecke [Wed, 24 Oct 2018 07:17:39 +0000 (09:17 +0200)]
dirmngr: Only print info for no ldapserver file

* dirmngr/dirmngr.c (parse_ldapserver_file): Only print info
for ENOENT.

--
It is very common that there is no ldapserver file. In that
case users are confused by an error printed at dirmngr startup.

6 weeks agosm: Fix dirmngr loadcrl for intermediate certs
Andre Heinecke [Tue, 23 Oct 2018 10:46:38 +0000 (12:46 +0200)]
sm: Fix dirmngr loadcrl for intermediate certs

* sm/call-dirmngr.c (run_command_inq_cb): Support ISTRUSTED.
(inq_certificate): Distinguish unsupported inquiry error.

--
When loading a CRL through "gpgsm --call-dirmngr loadcrl foo"
dirmngr can ask gpgsm back if a certificate used ISTRUSTED, which
previously resulted in an error.

7 weeks agodirmngr: Prepare for updated WKD specs with ?l= param
Werner Koch [Mon, 22 Oct 2018 18:13:08 +0000 (20:13 +0200)]
dirmngr: Prepare for updated WKD specs with ?l= param

* dirmngr/server.c (proc_wkd_get): Tack the raw local address to the
request.
--

We append the raw non-canonicalized local address part to the hash.
Servers who serve the requests from static files will ignore the
parameters and a test with posteo shows that also services using a
database ignore the parameter.  The general idea is that service
providers may use their own canonicalization rules.  The problem is
that we currently filter the returned key for the full mail address
and thus we will never see a key if the service did a different
canonicalization than we.  So consider this to be an experiment.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 256a280c51f9ea862e4bfb0bb530c2a96f9088f9)

7 weeks agogpg: Fix extra check for sign usage of a data signature.
Werner Koch [Mon, 8 Oct 2018 14:14:17 +0000 (16:14 +0200)]
gpg: Fix extra check for sign usage of a data signature.

* g10/sig-check.c (check_signature_end_simple):
--

Obviously we should not ignore a back signature here.

Fixes-commit: 214b0077264e35c079e854a8b6374704aea45cd5
GnuPG-bug-id: 4014
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit b6275f3bda8edff34274c5b921508567f491ab9c)

8 weeks agoscd: Fix signing authentication status.
NIIBE Yutaka [Mon, 15 Oct 2018 02:10:15 +0000 (11:10 +0900)]
scd: Fix signing authentication status.

* scd/app-openpgp.c (do_sign): Clear DID_CHV1 after signing.

--

Cherry-picked from master commit of:
78f542e1f4495195db2e668f9cd41657fb1afc77

We have a corner case: In "not forced" situation and authenticated,
and it is changed to "forced", card implementaiton can actually accept
signing, but GnuPG requires authentication, because it is "forced".

GnuPG-bug-id: 4177
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agocommon: Fix gnupg_reopen_std.
NIIBE Yutaka [Tue, 2 Oct 2018 05:22:24 +0000 (14:22 +0900)]
common: Fix gnupg_reopen_std.

* common/sysutils.c (gnupg_reopen_std): Use fcntl instead of fstat.

--

Cherry-pick from master commit of:
50b02dba2060a8969da47b18d9c0ecdccbd30db4

When gpg was invoked by a Perl web application on FreeBSD, fstat in
gnupg_reopen_std failed with EBADF.  Using fcntl, which is considered
lighter than fstat, it works fine.  Since uur purpose is to check if
file descriptor is valid or not, lighter operation is better.

Reported-by: Marcin Gryszkalis <mg@fork.pl>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agopo: Update Japanese translation.
NIIBE Yutaka [Tue, 18 Sep 2018 01:03:02 +0000 (10:03 +0900)]
po: Update Japanese translation.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agocommon: Use iobuf_get_noeof to avoid undefined behaviors.
NIIBE Yutaka [Mon, 10 Sep 2018 04:44:47 +0000 (13:44 +0900)]
common: Use iobuf_get_noeof to avoid undefined behaviors.

* common/iobuf.c (block_filter): Use iobuf_get_noeof.

--

Cherry-pick from master commit of:
f80346f42df4bdc7d0a9741c3922129aceae4f81

When singed integer has negative value, left shift computation is
undefined in C.

GnuPG-bug-id: 4093
Reported-by: Philippe Antoine
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agoagent: Fix error code check from npth_mutex_init.
NIIBE Yutaka [Mon, 10 Sep 2018 00:16:50 +0000 (09:16 +0900)]
agent: Fix error code check from npth_mutex_init.

* agent/call-pinentry.c (initialize_module_call_pinentry): It's an
error when npth_mutex_init returns non-zero.

--

Cherry-pick from master commit of:
adce73b86fd49d5bbb8884231a26cc7533d400e2

Actually, initialize_module_call_pinentry is only called once from
main.  So, this bug had no harm and having the static variable
INITIALIZED is not needed.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agog10: Fix memory leak.
NIIBE Yutaka [Fri, 7 Sep 2018 04:01:52 +0000 (13:01 +0900)]
g10: Fix memory leak.

* g10/import.c (read_block): Call free_packet to skip the packet.

--

Cherry-pick of master commit of:
7c96cc67e108f3a9514a4222ffac2f9f9a2ab19e

Reported-by: Philippe Antoine
GnuPG-bug-id: 3916
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agoFix use of strncpy, which is actually good to use memcpy.
NIIBE Yutaka [Thu, 6 Sep 2018 02:41:13 +0000 (11:41 +0900)]
Fix use of strncpy, which is actually good to use memcpy.

* common/ssh-utils.c (get_fingerprint): Use memcpy.
* g10/build-packet.c (string_to_notation): Use memcpy.

--

Cherry-pick of master commit of:
625ced6e672daa892d334323cce6b3d42a6f929f

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agoPost release updates.
Werner Koch [Thu, 30 Aug 2018 13:34:38 +0000 (15:34 +0200)]
Post release updates.

--

3 months agoRelease 2.2.10 gnupg-2.2.10
Werner Koch [Thu, 30 Aug 2018 12:25:14 +0000 (14:25 +0200)]
Release 2.2.10

3 months agopo: Update Russian translation.
Ineiev [Wed, 29 Aug 2018 16:17:53 +0000 (16:17 +0000)]
po: Update Russian translation.

3 months agopo: Update German translation
Werner Koch [Thu, 30 Aug 2018 07:44:49 +0000 (09:44 +0200)]
po: Update German translation

--

3 months agogpg: Explain error message in key generation with --batch
Werner Koch [Wed, 29 Aug 2018 13:14:29 +0000 (15:14 +0200)]
gpg: Explain error message in key generation with --batch

* g10/keygen.c (generate_keypair): Show more info.
--

GnuPG-bug-id: 3912
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 1bfe766bcf3959135333900934f1a15c9b96c3cf)

3 months agodoc: Minor additions to the gpg man page
Werner Koch [Wed, 29 Aug 2018 13:04:44 +0000 (15:04 +0200)]
doc: Minor additions to the gpg man page

--

Includes a fix for
GnuPG-bug-id: 3906

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 420dc2b49ad816bdd27b40db45d900551c71476f)

3 months agogpg: Remove unused function get_pubkeys.
Werner Koch [Wed, 29 Aug 2018 09:53:59 +0000 (11:53 +0200)]
gpg: Remove unused function get_pubkeys.

* g10/getkey.c (get_pubkeys): Remove.
(pubkey_free): Remove and use code directly ...
(pubkeys_free): ... here.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ed8fe21e6612401846fc4af8631f0136dc633c67)

3 months agodoc: Show how to list envvars send to gpg-agent.
Werner Koch [Wed, 29 Aug 2018 07:53:06 +0000 (09:53 +0200)]
doc: Show how to list envvars send to gpg-agent.

--

GnuPG-bug: 3353
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 53bbac0865719076f7ad7bb57e13f656bd6edf39)

3 months agogpg: New option --known-notation.
Werner Koch [Wed, 29 Aug 2018 07:36:09 +0000 (09:36 +0200)]
gpg: New option --known-notation.

* g10/gpg.c (oKnownNotation): New const.
(opts): Add option --known-notation.
(main): Set option.
* g10/parse-packet.c (known_notations_list): New local var.
(register_known_notation): New.
(can_handle_critical_notation): Rewrite to handle the new feature.
Also print the name of unknown notations in verbose mode.
--

GnuPG-bug-id: 4060
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 3da835713fb6220112d988e1953f3d84beabbf6a)

3 months agopo: Update Russian translation.
Ineiev [Sat, 14 Jul 2018 07:44:22 +0000 (07:44 +0000)]
po: Update Russian translation.

3 months agoassuan: Fix exponential decay for first second.
Werner Koch [Wed, 15 Nov 2017 14:30:21 +0000 (15:30 +0100)]
assuan: Fix exponential decay for first second.

* common/asshelp.c (wait_for_sock): Round SECSLEFT.
* dirmngr/dirmngr.c (main): Take care of --debug-wait also in dameon
mode.
* common/sysutils.c (gnupg_usleep) [HAVE_NANOSLEEP]: Fix nanosleep use.
--

Without the rounding we saw in verbose mose

 [...]to come up ... (5s)
 [...]to come up ... (4s)

immediately without the expected one second delay.  Waiting for the
next seconds did not work if nanosleep was used due to improper passed
parameters in gnupg_usleep.

Adding --debug-wait for dirmngr in daemon mode is required to test
this change.

GnuPG-bug-id: 3490
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 0cfdd3b57d592fb6baa7dafe8fde124e8a6c7798)
Fixes-commit: 1189df2cd7d4b6896ba22aa204c159ff2a425ead
Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agoassuan: Use exponential decay for first 1s of spinlock.
Daniel Kahn Gillmor [Wed, 8 Nov 2017 15:26:40 +0000 (16:26 +0100)]
assuan: Use exponential decay for first 1s of spinlock.

* common/asshelp.c (wait_for_sock): instead of checking the socket
every second, we check 10 times in the first second (with exponential
decay).
--

This cuts the wall clock time for the standard test suite roughly by
half.

GnuPG-bug-id: 3490
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
(cherry picked from commit 149041b0b917f4298239fe18b5ebd5ead71584a6)

3 months agoassuan: Reorganize waiting for socket.
Daniel Kahn Gillmor [Wed, 8 Nov 2017 15:15:30 +0000 (16:15 +0100)]
assuan: Reorganize waiting for socket.

* common/asshelp.c (wait_for_sock): New function, collecting
codepaths from...
(start_new_gpg_agent) here and...
(start_new_dirmngr) here.
--

This has no functional change, but makes it easier to make this
function more efficient.

GnuPG-bug-id: 3490
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
(cherry picked from commit 0471ff9d3bf8d6b9a359f3c426d70d0935066907)

3 months agogpg: Refresh expired keys originating from the WKD.
Werner Koch [Tue, 28 Aug 2018 13:22:35 +0000 (15:22 +0200)]
gpg: Refresh expired keys originating from the WKD.

* g10/getkey.c (getkey_ctx_s): New field found_via_akl.
(get_pubkey_byname): Set it.
(only_expired_enc_subkeys): New.
(get_best_pubkey_byname): Add support to refresh expired keys from the
WKD.
--

A little drawback of that code is that if the WKD has no update for an
expired key each access of the key will trigger a WKD lookup (unless
cached by the dirmngr).  To avoid this we need to record the last time
we have checked for an update but that would in turn require that we
update the keyring for each check.  We defer this until we have a
better key database which allows for fast updates of meta data.

Testing the code is currently a bit cumbersome because it requires to
update a key in the WKD several times.  Eventually we we need a
network emulation layer to provide sample data for the regression
tests.

GnuPG-bug-id: 2917
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 7f172404bfcf719b9b1af4a182d4803525ebff7c)

3 months agogpg: Remove unused arg from a function.
Werner Koch [Tue, 28 Aug 2018 13:11:10 +0000 (15:11 +0200)]
gpg: Remove unused arg from a function.

* g10/getkey.c (get_best_pubkey_byname): Remove unused arg 'no_akl'.
Change both callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit db67ccb759426c1173761574b14bdfe6a76394c2)

3 months agopo: Update Japanese translation.
NIIBE Yutaka [Wed, 22 Aug 2018 08:45:29 +0000 (17:45 +0900)]
po: Update Japanese translation.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agog10: Fix undefined behavior when EOF in parsing packet for S2K.
NIIBE Yutaka [Fri, 10 Aug 2018 06:29:06 +0000 (15:29 +0900)]
g10: Fix undefined behavior when EOF in parsing packet for S2K.

* g10/parse-packet.c (parse_symkeyenc): Use iobuf_get_noeof.
(parse_key): Likewise.

--

Cherry picked from master commit:
    1b309d9f6199a91caa0ca0b97b92d599e00b736e

When EOF comes at parsing s2k.count, it is possible the value will
be (unsigned long)-1.  Then, the result of S2K_DECODE_COUNT will be
undefined.  This patch fixes undefined behavior.

Reported-by: Philippe Antoine
GnuPG-bug-id: 4093
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agogpg: Set a limit for a WKD import of 256 KiB.
Werner Koch [Fri, 27 Jul 2018 15:35:00 +0000 (17:35 +0200)]
gpg: Set a limit for a WKD import of 256 KiB.

* g10/call-dirmngr.c (MAX_WKD_RESULT_LENGTH): New.
(gpg_dirmngr_wkd_get): Use it.
--

WKD should return only a single key with just one UID.  For key
rollover 2 keys may be send.  A total of 256 KiB seems to be a
generous limit here.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit e88f56f1937ac92f6a3b94e50b6db2649ec0be41)

4 months agodirmngr: Validate SRV records in WKD queries.
Werner Koch [Fri, 27 Jul 2018 10:23:38 +0000 (12:23 +0200)]
dirmngr: Validate SRV records in WKD queries.

* dirmngr/server.c (proc_wkd_get): Check the returned SRV record names
to mitigate rogue DNS servers.
--

I am not sure wether this really is very useful because the security
relies on a trustworthy DNS system anyway.  However, that check is
easy enough to do.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ebe727ef596eefebb5eff7d03a98649ffc7ae3ee)

4 months agocommon: New function to validate domain names.
Werner Koch [Fri, 27 Jul 2018 09:56:06 +0000 (11:56 +0200)]
common: New function to validate domain names.

* common/mbox-util.c (is_valid_domain_name): New.
* common/t-mbox-util.c (run_dns_test): New test.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit ddee9f9409fb5a089883eab0fadef7b9b7e61e72)

4 months agoscd: Add support for Trustica Cryptoucan.
Jiří Keresteš [Tue, 17 Jul 2018 15:11:42 +0000 (17:11 +0200)]
scd: Add support for Trustica Cryptoucan.

(cherry picked from commit 967d3649d24aba623133808e8d01675dff389fbb)

4 months agoPost release updates
Werner Koch [Thu, 12 Jul 2018 14:31:34 +0000 (16:31 +0200)]
Post release updates

--

4 months agoRelease 2.2.9 gnupg-2.2.9
Werner Koch [Thu, 12 Jul 2018 12:47:03 +0000 (14:47 +0200)]
Release 2.2.9

4 months agopo: Fix one fuzzy in German translation.
Werner Koch [Thu, 12 Jul 2018 12:49:01 +0000 (14:49 +0200)]
po: Fix one fuzzy in German translation.

--

4 months agopo: auto update
Werner Koch [Thu, 12 Jul 2018 12:10:11 +0000 (14:10 +0200)]
po: auto update

--

5 months agogpg: Remove multiple subkey bindings during export-clean.
Werner Koch [Mon, 9 Jul 2018 10:01:02 +0000 (12:01 +0200)]
gpg: Remove multiple subkey bindings during export-clean.

* g10/key-clean.c (clean_one_subkey_dupsigs): New.
(clean_all_subkeys): Call it.
--

GnuPG-bug-id: 3804
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 76989d5bd89ed11f5b3656dc4748fcfc939a46dc)

5 months agogpg: Let export-clean remove expired subkeys.
Werner Koch [Mon, 9 Jul 2018 07:49:09 +0000 (09:49 +0200)]
gpg: Let export-clean remove expired subkeys.

* g10/key-clean.h (KEY_CLEAN_NONE, KEY_CLEAN_INVALID)
(KEY_CLEAN_ENCR, KEY_CLEAN_AUTHENCR, KEY_CLEAN_ALL): New.
* g10/key-clean.c (clean_one_subkey): New.
(clean_all_subkeys): Add arg CLEAN_LEVEL.
* g10/import.c (import_one): Call clean_all_subkeys with
KEY_CLEAN_NONE.
* g10/export.c (do_export_stream): Call clean_all_subkeys depedning on
the export clean options.
--

GnuPG-bug-id: 3622
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit c2fd65ec8498a08ee36ca52d99b6b014f6db8d93)

5 months agogpg: Split key cleaning function for clarity.
Werner Koch [Fri, 6 Jul 2018 09:48:38 +0000 (11:48 +0200)]
gpg: Split key cleaning function for clarity.

* g10/key-clean.c (clean_key): Rename to clean_all_uids and split
subkey cleaning into ...
(clean_all_subkeys): new.  Call that always after the former clean_key
invocations.
--

Note that the clean_all_subkeys function will later be extended.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 6c3567196f7e72552f326ce07dccbcce31926e5d)

5 months agogpg: Move key cleaning functions to a separate file.
Werner Koch [Fri, 6 Jul 2018 09:40:16 +0000 (11:40 +0200)]
gpg: Move key cleaning functions to a separate file.

* g10/trust.c (mark_usable_uid_certs, clean_sigs_from_uid)
(clean_uid_from_key, clean_one_uid, clean_key): Move to ...
* g10/key-clean.c: new file.
* g10/key-clean.h: New.
* g10/Makefile.am (gpg_sources): Add new files.
* g10/export.c, g10/import.c, g10/keyedit.c, g10/trustdb.c: Include
new header.
* g10/trustdb.h (struct key_item, is_in_klist): Move to ...
* g10/keydb.h: here.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 135e46ea480d749b8a9692f71d4d0bfdadd8ee2f)

5 months agogpg: Allow decryption using several passphrases in may cases.
Werner Koch [Fri, 6 Jul 2018 06:24:57 +0000 (08:24 +0200)]
gpg: Allow decryption using several passphrases in may cases.

* g10/mainproc.c (symkey_decrypt_seskey): Check for a valid algorithm.
(proc_symkey_enc): Clear passpharse on error from above function.
--

This does not work reliable as stated in bug 3795 but we can try to
fix ~95% of all cases.  The real fix is to use AEAD which will come
with 2.3

GnuPG-bug-id: 3795, 4050
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agopo: Add flag options for xgettext.
Werner Koch [Thu, 5 Jul 2018 19:43:25 +0000 (21:43 +0200)]
po: Add flag options for xgettext.

* po/Makevars (XGETTEXT_OPTIONS): Add --flag options.
--

GnuPG-bug-id: 4053, 4054
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agogpg: Prepare for signatures with ISSUER_FPR but without ISSUER.
Werner Koch [Thu, 5 Jul 2018 18:55:32 +0000 (20:55 +0200)]
gpg: Prepare for signatures with ISSUER_FPR but without ISSUER.

* g10/getkey.c (get_pubkey_for_sig): New.
(get_pubkeyblock_for_sig): New.
* g10/mainproc.c (issuer_fpr_raw): Give global scope.
(check_sig_and_print): Use get_pubkeyblock_for_sig.
* g10/pkclist.c (check_signatures_trust): Use get_pubkey_for_sig.
* g10/sig-check.c (check_signature2): Ditto.
(check_signature_over_key_or_uid): Ditto.
--

GnuPG-bug-id: 4046

The whole getkey stuff is still a mess with way to much duplication
and missing caching of already fetched data.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit f7526c7bc754acf68bde0b79c785e875a9365d60)

5 months agopo: Fix bug in german translation
Andre Heinecke [Wed, 4 Jul 2018 15:52:21 +0000 (17:52 +0200)]
po: Fix bug in german translation

* po/de.po (decryption forced to fail!): Fix translation.

--
The unmatched %s actually produced a crash on Windows.

GnuPG-Bug-Id: T4053
GnuPG-Bug-Id: T4054

5 months agogpg: Ignore too large user ids during import.
Werner Koch [Wed, 4 Jul 2018 07:53:10 +0000 (09:53 +0200)]
gpg: Ignore too large user ids during import.

* g10/import.c (read_block): Add special treatment for bad user ids
and comment packets.
--

See
GnuPG-bug-id: 4022
for an example of a bogus user id.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 01cd66f9faf1623833e6afac84164de5a136ecff)

5 months agoindent: Fix indentation of read_block in g10/import.c
Werner Koch [Wed, 4 Jul 2018 07:45:52 +0000 (09:45 +0200)]
indent: Fix indentation of read_block in g10/import.c

--

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 60e7e102a153a246d7e887a64e30dbb4c4f7b6dd)

5 months agogpg: Extra check for sign usage when verifying a data signature.
Werner Koch [Wed, 4 Jul 2018 06:59:12 +0000 (08:59 +0200)]
gpg: Extra check for sign usage when verifying a data signature.

* g10/sig-check.c (check_signature_end_simple): Check sign usage.
--

Without this patch the signature verification fails only due to the
missing back signature.  This check better explains what went wrong.

GnuPG-bug-id: 4014
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 214b0077264e35c079e854a8b6374704aea45cd5)

5 months agogpg: Print revocation reason for "rev" records.
Werner Koch [Thu, 21 Jun 2018 18:28:40 +0000 (20:28 +0200)]
gpg: Print revocation reason for "rev" records.

* g10/main.h: Add prototype.
* g10/keylist.c (list_keyblock_print): Print revocation info.
(list_keyblock_colon): Ditto.

* g10/test-stubs.c (get_revocation_reason): New stub.
* g10/gpgv.c (get_revocation_reason): New stub.
--

GnuPG-bug-id: 1173
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 592deeddb9bf4ae9b3e236b439e2f39644eb6d46)

5 months agogpg: Print revocation reason for "rvs" records.
Werner Koch [Thu, 21 Jun 2018 16:32:13 +0000 (18:32 +0200)]
gpg: Print revocation reason for "rvs" records.

* g10/import.c (get_revocation_reason): New.
(list_standalone_revocation): Extend function.
--

Note that this function extends the "rvs" field signature-class (field
11) with the revocation reason.  GPGME does not yet parse this but it
can be expected that the comma delimiter does not break other parsers.

A new field is added to the "rvs" (and in future also the "rev")
record to carry a record specific comment.  Hopefully all parsers
meanwhile learned the lesson from other new fields and don't bail out
on more fields than they know about.

This is partial solution to
GnuPG-bug-id: 1173

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit b7cd2c2093ae1b47645be50fa1d431a028187cad)

5 months agogpg: Let --show-keys print revocation certificates.
Werner Koch [Thu, 21 Jun 2018 13:06:30 +0000 (15:06 +0200)]
gpg: Let --show-keys print revocation certificates.

* g10/import.c (list_standalone_revocation): New.
(import_revoke_cert): Call new function.
--

GnuPG-bug-id: 4018
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 386b9c4f25b28fd769d7563f2d86ac3a19cc3011)

5 months agog10: Fix memory leak for PKT_signature.
NIIBE Yutaka [Tue, 3 Jul 2018 00:07:03 +0000 (09:07 +0900)]
g10: Fix memory leak for PKT_signature.

* g10/getkey.c (buf_to_sig): Free by free_seckey_enc.
* g10/gpgcompose.c (signature): Likewise.
* g10/sign.c (write_signature_packets): Likewise.

--

Cherry picked from master commit:
    996febbab21eb9283b0634e51303a36b318734a6

Reported-by: Philippe Antoine
GnuPG-bug-id: 4047
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agolibdns: For SOCKS connection, just fails.
NIIBE Yutaka [Mon, 2 Jul 2018 01:37:49 +0000 (10:37 +0900)]
libdns: For SOCKS connection, just fails.

* dirmngr/dns.c (dns_res_exec): If it's DNS_SO_SOCKS_CONN, don't
iterate to other server, but return the error immediately.

--

Cherry picked from master commit:
    1aacd12471935a354cfd85ee1805edc7eb16e6c5

In the function libdns_switch_port_p in dns-stuff.c, this patch
allows to fallback using TOR_PORT2 correctly.

Fixes-commit: bcdbf8b8ebe9d61160e0b007dabe1b6462ffbc93
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agolibdns: Let kernel to decide the local port.
NIIBE Yutaka [Tue, 19 Jun 2018 23:59:05 +0000 (08:59 +0900)]
libdns: Let kernel to decide the local port.

* dirmngr/dns.c (LEAVE_SELECTION_OF_PORT_TO_KERNEL): New.
(dns_socket): Don't select ephemeral port in user space.

--

Cherry picked from master commit:
    861f1da0731bf29dcb9221c4f22c76b40ec15a78

There is no good reason to bind local port aggressively.  It might be
some reason to do so, then, a user can specify it in /etc/resolv.conf
by the second argument of "interface" directive.

At least, it causes a problem on Windows.  Binding a specified port in
user space can trigger the Firewall dialog on Windows.  Since it can
be considered valid question, it is better not to bind with an
ephemeral port which is selected in user space, by default.

GnuPG-bug-id: 3610
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agolibdns: Fix for non-FQDN hostname.
NIIBE Yutaka [Mon, 18 Jun 2018 01:13:35 +0000 (10:13 +0900)]
libdns: Fix for non-FQDN hostname.

* dirmngr/dns.c (dns_resconf_open): Clear search[0] for non-FQDN
hostname.

--

Cherry pick from master commit:
    a4a054bf14fa855715faee01a152755c4e2a74f7

GnuPG-bug-id: T3803
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agolibdns: Fix connect and try next nameserver when ECONNREFUSED.
NIIBE Yutaka [Fri, 15 Jun 2018 03:58:29 +0000 (12:58 +0900)]
libdns: Fix connect and try next nameserver when ECONNREFUSED.

* dirmngr/dns.c (dns_so_check): When EINVAL, release the association
by connect with AF_UNSPEC and try again.  Also try again for
ECONNREFUSED.
(dns_res_exec): Try next nameserver when ECONNREFUSED.

--

Cherry pick from master commit:
    bcdbf8b8ebe9d61160e0b007dabe1b6462ffbc93

GnuPG-bug-id: T3374
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agolibdns: Clear struct sockaddr_storage by zero.
NIIBE Yutaka [Fri, 15 Jun 2018 01:38:22 +0000 (10:38 +0900)]
libdns: Clear struct sockaddr_storage by zero.

* dirmngr/dns.c (dns_resconf_pton): Clear SS.
(dns_resconf_setiface): Clear ->IFACE.
(dns_hints_root, send_query): Clear SS.

--

Cherry pick from master commit:
    1c0b6681e4f322b88ac35d1f21c03d3cfc35fc23

POSIX requires clear the structure of struct sockaddr_in6.  On macOS,
in some case like bind, it is better to clear even for struct
sockaddr_in.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agolibdns: Sync to upstream.
NIIBE Yutaka [Thu, 14 Jun 2018 04:10:57 +0000 (13:10 +0900)]
libdns: Sync to upstream.

* dirmngr/dns.c (dns_nssconf_loadfile): Handle exclamation mark.

--

Cherry pick from master commit:
    3e6ad302eaf3a4a9f3e60379133b3dfdbe0e1b2d

Reverting local change, merge upstream's debug-tracing branch.
(commit 21281fc1b63bb74d51762b8e363c49b1a258783d)

Fixes-commit: d4c0187dd93163f12e9f953366adef81ecf526a6
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agodirmngr: Fix recursive resolver mode.
NIIBE Yutaka [Thu, 14 Jun 2018 04:01:45 +0000 (13:01 +0900)]
dirmngr: Fix recursive resolver mode.

* dirmngr/dns-stuff.c (libdns_init): Initialize options.recurse.

--

Cherry pick from master commit:
    5b40338f12762cd74238c2d2b3101c33dd2d0ed3

To reproduce an error, run:

    ./t-dns-stuff --debug --recursive-resolver www.gnupg.org

Then, it returns "No name" error.  That's because there was only setup
for root servers, and no setup for recursive query in fact.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agogpg: Do not import revocations with --show-keys.
Werner Koch [Tue, 12 Jun 2018 06:44:55 +0000 (08:44 +0200)]
gpg: Do not import revocations with --show-keys.

* g10/import.c (import_revoke_cert): Add arg 'options'.  Take care of
IMPORT_DRY_RUN.
--

GnuPG-bug-id: 4017
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 6c9e37b2e541e96e7c65e1679982a614b4863fdb)