gnupg.git
3 days agopo: Update Japanese translation. STABLE-BRANCH-2-2
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>
11 days 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>
11 days 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>
2 weeks 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>
2 weeks 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 weeks agoPost release updates.
Werner Koch [Thu, 30 Aug 2018 13:34:38 +0000 (15:34 +0200)]
Post release updates.

--

3 weeks 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 weeks agopo: Update Russian translation.
Ineiev [Wed, 29 Aug 2018 16:17:53 +0000 (16:17 +0000)]
po: Update Russian translation.

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

--

3 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks agopo: Update Russian translation.
Ineiev [Sat, 14 Jul 2018 07:44:22 +0000 (07:44 +0000)]
po: Update Russian translation.

3 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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)

4 weeks 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>
6 weeks 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>
7 weeks 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)

7 weeks 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)

7 weeks 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)

7 weeks 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)

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

--

2 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

2 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.

--

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

--

2 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)

2 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)

2 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)

2 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)

2 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>
2 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>
2 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)

2 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

2 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)

2 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)

2 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)

2 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)

2 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)

2 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)

2 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>
2 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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)

3 months agogpg: Add new usage option for drop-subkey filters.
Daniel Kahn Gillmor [Tue, 12 Jun 2018 04:41:59 +0000 (00:41 -0400)]
gpg: Add new usage option for drop-subkey filters.

* g10/import.c (impex_filter_getval): Add new "usage" property for
drop-subkey filter.
--

For example, this permits extraction of only encryption-capable
subkeys like so:

    gpg --export-filter 'drop-subkey=usage !~ e' --export $FPR

GnuPG-Bug-id: 4019
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
(cherry picked from commit 2ddfb5bef920919443309ece9fa2930282bbce85)

3 months agodoc: Mention new command --show-keys in the 2.2.7 NEWS.
Werner Koch [Mon, 11 Jun 2018 06:56:04 +0000 (08:56 +0200)]
doc: Mention new command --show-keys in the 2.2.7 NEWS.

--

3 months agogpg: Set some list options with --show-keys
Werner Koch [Mon, 11 Jun 2018 06:46:37 +0000 (08:46 +0200)]
gpg: Set some list options with --show-keys

* g10/gpg.c (main): Set some list options.
--

The new command --show-keys is commonly used to check the content of a
file with keys.  In this case it can be expected that all included
subkeys and uids are of interested, even when they are already expired
or have been revoked.

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

3 months agogpg: Allow building with older libgpg-error.
Werner Koch [Fri, 8 Jun 2018 20:01:10 +0000 (22:01 +0200)]
gpg: Allow building with older libgpg-error.

* g10/mainproc.c (proc_encrypted): Use constant from logging.h
--

Because the log levels are enums I had to change there names in
libgpg-error to avoid clashes.  Master uses the new names but 2.2
needs to stick to the old names.

Fixes-commit: 825909e9cd5f344ece6c0b0ea3a9475df1d643de
Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agoPost release updates
Werner Koch [Fri, 8 Jun 2018 10:47:19 +0000 (12:47 +0200)]
Post release updates

--

3 months agoRelease 2.2.8 gnupg-2.2.8
Werner Koch [Fri, 8 Jun 2018 09:53:00 +0000 (11:53 +0200)]
Release 2.2.8

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agopo: Auto update
Werner Koch [Fri, 8 Jun 2018 09:24:36 +0000 (11:24 +0200)]
po: Auto update

--

3 months agopo: Update German translation
Werner Koch [Fri, 8 Jun 2018 09:24:06 +0000 (11:24 +0200)]
po: Update German translation

--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agopo: Update Russian translation.
Ineiev [Sat, 5 May 2018 19:27:49 +0000 (19:27 +0000)]
po: Update Russian translation.

3 months agogpg: Sanitize diagnostic with the original file name.
Werner Koch [Fri, 8 Jun 2018 08:45:21 +0000 (10:45 +0200)]
gpg: Sanitize diagnostic with the original file name.

* g10/mainproc.c (proc_plaintext): Sanitize verbose output.
--

This fixes a forgotten sanitation of user supplied data in a verbose
mode diagnostic.  The mention CVE is about using this to inject
status-fd lines into the stderr output.  Other harm good as well be
done.  Note that GPGME based applications are not affected because
GPGME does not fold status output into stderr.

CVE-id: CVE-2018-12020
GnuPG-bug-id: 4012
(cherry picked from commit 13f135c7a252cc46cff96e75968d92b6dc8dce1b)

3 months agogpg: Improve import's repair-key duplicate signature detection.
Werner Koch [Thu, 7 Jun 2018 16:41:17 +0000 (18:41 +0200)]
gpg: Improve import's repair-key duplicate signature detection.

* g10/key-check.c (key_check_all_keysigs): Factor some code out to ...
(remove_duplicate_sigs): new.
(key_check_all_keysigs): Call remove_duplicate_sigs again after
reordering.
--

This is a follupup for commit 26bce2f01d2029ea2b8a8dbbe36118e3c83c5cba
to cleanup the code and to add a second de-duplicate step when needed.

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

3 months agogpg: Fix import's repair-key duplicate signature detection.
Werner Koch [Thu, 7 Jun 2018 15:22:58 +0000 (17:22 +0200)]
gpg: Fix import's repair-key duplicate signature detection.

* g10/packet.h (PKG_siganture): Add field 'help_counter'.
* g10/key-check.c (sig_comparison): Take care of HELP_COUNTER.
(key_check_all_keysigs): De-duplicate on a per-block base.
--

The key_check_all_keysigs first does a detection of duplicate
signature.  This is done over all signatures at once.  The problem
here is for example:

   key
   uid_1
     sig_uid_1.1
     sig_uid_1.2
   subkey_1
     sig_sub_1.1
   subkey_2
     sig_sub_2.1
     sig_sub_2.2  (duplicate of sig_sub_1.1)

Now the de-duplication deletes the first signature and keeps the
second.  That works in most cases for foreign signature on userids but
in the above constellation the code simply removes sig_sub_1.1 so that
subkey_1 has no binding signature anymore.  In a later step during
import the missing binding is detected and subkey_1 is removed because
it is not anymore valid.  The sig_sub_2.2 will also be removed later
because it does not check out for subkey_2 (that is as expected).

The fix is to let the de-duplication work only on blocks (ie. within
the signatures of a user id or a subkey).  This will not detect all
duplicates but that does not harm because later steps will detect and
remove them.

In the above case (with this patch applied) the second phase of
key_check_all_keysigs will reorder key signatures and move the
duplicate sig_sub_2.2 directly after sig_sub_1.1.  This duplicates the
signature and for cleanness we should kick the de-duplication process
again.  This will be done with a followup patch.

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

3 months agogpg: Improve verbose output during import.
Werner Koch [Thu, 7 Jun 2018 08:30:07 +0000 (10:30 +0200)]
gpg: Improve verbose output during import.

* g10/import.c (chk_self_sigs): Print the subkeyid in addition to the
keyid.
(delete_inv_parts): Ditto.

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

3 months agoagent: Add DBUS_SESSION_BUS_ADDRESS et al. to the startup list.
Werner Koch [Wed, 6 Jun 2018 16:28:44 +0000 (18:28 +0200)]
agent: Add DBUS_SESSION_BUS_ADDRESS et al. to the startup list.

* agent/gpg-agent.c (agent_copy_startup_env): Replace explicit list
with the standard list.
--

Although the function agent_copy_startup_env is newer than
session_env_list_stdenvnames the latter was not used.  When
DBUS_SESSION_BUS_ADDRESS was added to the latter it was forgotten to
add it to the former as well.  Having all stdnames here seems to be
the Right Thing (tm) to do.

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

3 months agodoc: Typo fixes
Werner Koch [Wed, 6 Jun 2018 15:25:51 +0000 (17:25 +0200)]
doc: Typo fixes

--

Reported-by: Claus Assmann <ca+gnupg-users@esmtp.org>
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 70f26e4263364f4b521c7856c38ba7ee59e38445)

3 months agogpg: Also detect a plaintext packet before an encrypted packet.
Werner Koch [Wed, 6 Jun 2018 13:46:24 +0000 (15:46 +0200)]
gpg: Also detect a plaintext packet before an encrypted packet.

* g10/mainproc.c (proc_encrypted): Print warning and later force an
error.
--

Note that when this error is triggered the plaintext from the literal
data packet has already been outputted before the BEGIN_DECRYPTION
status line.  We fail only later to get more information.  Callers
need to check and act upon the decryption error code anyway.

Thanks to Marcus for pointing out this case.

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

3 months agogpg: New command --show-keys.
Werner Koch [Wed, 6 Jun 2018 09:50:58 +0000 (11:50 +0200)]
gpg: New command --show-keys.

* g10/gpg.c (aShowKeys): New const.
(opts): New command --show-keys.
(main): Implement command.
* g10/import.c (import_keys_internal): Don't print stats in show-only
mode.
(import_one): Be silent in show-only mode.
--

Using

  --import --import-options show-only

to look at a key is too cumbersome.  Provide this shortcut and also
remove some diagnostic cruft in this case.

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

3 months agopo: Fix Swedish and Turkish translations.
NIIBE Yutaka [Mon, 14 May 2018 13:39:44 +0000 (22:39 +0900)]
po: Fix Swedish and Turkish translations.

--

(cherry picked from commit 61b1508281cda47b65c2bbd99cdef67fd6855c7c)

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agopo: Fix Danish translation.
NIIBE Yutaka [Mon, 14 May 2018 13:18:43 +0000 (22:18 +0900)]
po: Fix Danish translation.

--

(cherry picked from commit 49bbbd9dc5e1d4809e508ff4ab32fa238588917d)

Debian-bug-id: 898552
Reported-by: Jonas Smedegaard <dr@jones.dk>
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
3 months agogpg: Print a hint on how to decrypt a non-mdc message anyway.
Werner Koch [Thu, 31 May 2018 10:59:40 +0000 (12:59 +0200)]
gpg: Print a hint on how to decrypt a non-mdc message anyway.

* g10/mainproc.c (proc_encrypted): Print a hint for legacy ciphers w/o
MDC.  Also print a dedicated status error code

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

3 months agogpg: Detect multiple literal plaintext packets more reliable.
Werner Koch [Wed, 30 May 2018 19:45:37 +0000 (21:45 +0200)]
gpg: Detect multiple literal plaintext packets more reliable.

* g10/mainproc.c (proc_encrypted): Bump LITERALS_SEEN.
--

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

3 months agogpg: Remove MDC options
Werner Koch [Tue, 29 May 2018 10:42:44 +0000 (12:42 +0200)]
gpg: Remove MDC options

* g10/gpg.c: Turn options --force-mdc, --no-force-mdc, --disable-mdc
and --no-disable-mdc into NOPs.
* g10/encrypt.c (use_mdc): Simplify.  MDC is now almost always used.
* g10/cipher.c (write_header): Include extra hint and make
translatable.
* g10/options.h (struct opt): Remove fields force_mdc and disable_mdc.

--

The MDC is now always used except with --rfc2440 which will lead to a
a big fat warning.

This is a stripped down version of commit
253e8bdd9014cbe6dc06adce9d9dd2f8f4b31709 which could not directly be
applied due to the AEAD mechanisms there.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agogpg: Hard fail on a missing MDC even for legacy algorithms.
Werner Koch [Tue, 15 May 2018 10:33:03 +0000 (12:33 +0200)]
gpg: Hard fail on a missing MDC even for legacy algorithms.

* g10/mainproc.c (proc_encrypted): Require an MDC or AEAD
* tests/openpgp/defs.scm (create-gpghome): Use --ignore-mdc-error to
allow testing with the current files.
--

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

Resolved Conflicts:
g10/mainproc.c - Remove AEAD stuff.

3 months agogpg: Turn --no-mdc-warn into a NOP.
Werner Koch [Tue, 15 May 2018 10:19:40 +0000 (12:19 +0200)]
gpg: Turn --no-mdc-warn into a NOP.

* g10/gpg.c (oNoMDCWarn): Remove.
(opts): Make --no-mdc-warn a NOP.
(main): Don't set var.
* g10/options.h (struct opt): Remove 'no_mdc_var'.
* g10/cipher-cfb.c (write_header): Assume opt.no_mdc_warn is false.
* g10/mainproc.c (proc_encrypted): Ditto.
--

Users should not be allowed to suppress the warning that they are
shooting into their foot.

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

3 months agopo: Update Spanish translation.
emma peel [Fri, 25 May 2018 15:45:13 +0000 (15:45 +0000)]
po: Update Spanish translation.

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
4 months agodoc: Fix URL in NEWS.
Werner Koch [Sun, 13 May 2018 11:21:57 +0000 (13:21 +0200)]
doc: Fix URL in NEWS.

--

4 months agodoc: Update description of displayed trust values.
Ineiev [Sun, 6 May 2018 05:58:23 +0000 (05:58 +0000)]
doc: Update description of displayed trust values.

* doc/trust-values.texi: New file.
* doc/Makefile.am (EXTRA_DIST): Add trust-values.texi.
* doc/gnupg.texi (Trust Values): New chapter.
* doc/gpg.texi (OpenPGP Key Management): Update the description
of how trust values are displayed, replace table with a reference
to Trust Values.
* doc/gpg.texi (GPG Examples): Add @mansect trust values.

--

Signed-off-by: Ineiev <ineiev@gnu.org>
4 months agoPost release updates
Werner Koch [Wed, 2 May 2018 20:02:40 +0000 (22:02 +0200)]
Post release updates

--

4 months agoRelease 2.2.7 gnupg-2.2.7
Werner Koch [Wed, 2 May 2018 18:58:19 +0000 (20:58 +0200)]
Release 2.2.7

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agospeedo,w32: Install dirmmngr_ldap.exe.
Werner Koch [Wed, 2 May 2018 19:33:41 +0000 (21:33 +0200)]
speedo,w32: Install dirmmngr_ldap.exe.

--

4 months agopo: Auto update
Werner Koch [Wed, 2 May 2018 18:42:51 +0000 (20:42 +0200)]
po: Auto update

--

4 months agogpg: Fix minor memory leak in the compress filter.
Werner Koch [Wed, 2 May 2018 17:44:10 +0000 (19:44 +0200)]
gpg: Fix minor memory leak in the compress filter.

* g10/compress.c (push_compress_filter2): Return an error if no filter
was pushed.
(push_compress_filter): Ditto.
(handle_compressed): Free CFX if no filter was pushed.
* g10/import.c (read_block): Ditto.
--

GnuPG-bug-id: 3898, 3930
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agogpg: Fix "Too many open files" when using --multifile.
Werner Koch [Wed, 2 May 2018 17:03:07 +0000 (19:03 +0200)]
gpg: Fix "Too many open files" when using --multifile.

* common/miscellaneous.c (is_file_compressed): Don't cache the file.
--

This seems to be a pretty old bug.  The fix is easy and also reveals
that -z0 can be used as a workaround.

GnuPG-bug-id: 3951
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Implement timeout for dirmngr_ldap under Windows.
Werner Koch [Wed, 2 May 2018 16:40:01 +0000 (18:40 +0200)]
dirmngr: Implement timeout for dirmngr_ldap under Windows.

* dirmngr/dirmngr_ldap.c (alarm_thread) [W32]: New.
(set_timeout): Implement for W32.
--

GnuPG-bug-id: 3937
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agobuild: New configure option to help with nPth debugging.
Werner Koch [Wed, 2 May 2018 15:06:22 +0000 (17:06 +0200)]
build: New configure option to help with nPth debugging.

* configure.ac: Add option --enable-npth-debug
--

This requires a not yet release nPth version to have an effect.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agospeedo: Install Spanish translation for Libgpg-error.
Werner Koch [Tue, 1 May 2018 17:48:44 +0000 (19:48 +0200)]
speedo: Install Spanish translation for Libgpg-error.

--

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agocommon,w32: Hide spawned processes by default
Andre Heinecke [Wed, 2 May 2018 12:01:33 +0000 (14:01 +0200)]
common,w32: Hide spawned processes by default

* common/exechelp-w32.c (gnupg_spawn_process): Use SW_HIDE
instead of SW_MINIMIZE.

--
Spawning minimized shows icons in the task bar so users
see that background processes are started, which is unusual.

I'm pretty sure that the intention of the code was to hide
the window if not in spawn debug mode. This is also what
GPGME does.

This fixes dirmngr_ldap process windows and other
spurious reports about e.g. a gpgv console window from
loadswdb.

GnuPG-Bug-Id: T3937
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
4 months agodirmngr: Sleep in the ldap wrapper thread.
Werner Koch [Fri, 27 Apr 2018 13:20:45 +0000 (15:20 +0200)]
dirmngr: Sleep in the ldap wrapper thread.

* dirmngr/ldap-wrapper.c (wrapper_list): Rename to reaper_list.
(ldap_reaper_thread): Protect all list modification with a mutex.  Use
a condition var to wake up the reaper thread.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Use the LDAP wrapper process also for Windows.
Werner Koch [Fri, 27 Apr 2018 10:03:41 +0000 (12:03 +0200)]
dirmngr: Use the LDAP wrapper process also for Windows.

* dirmngr/ldap-wrapper.c: Revamp module to make use of es_poll for
portability.
* configure.ac: Always use the ldap wrapper.
--

Since the migration from GNU Pth to nPth the ldap wrapper never worked
reliable on Windows.  Our long term use of the old Window CE wrapper
thing didn't fixed this either.  The new code uses the portable
es_poll function and thus code which is tested at several other
places.  It Should(tm) fix the Windows issues.

GnuPG-bug-id: 3937
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Silence log output from dirmngr_ldap.
Werner Koch [Fri, 27 Apr 2018 09:57:08 +0000 (11:57 +0200)]
dirmngr: Silence log output from dirmngr_ldap.

* dirmngr/dirmngr_ldap.c: Remove assert.h.
(main): Replace assert by log_assert.
* dirmngr/ldap.c (run_ldap_wrapper): Use debug options to pass
verbose options to dirmngr_ldap.
(start_cert_fetch_ldap): Ditto.
--

verbose is a pretty common option in dirmngr.conf and it would clutter
the logs with output from dirmngr_ldap.  Now we require DBG_EXTPROG
or DBG_LOOKUP to make dirmngr_ldap more verbose.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Lower the dead host resurrection time to 1.5h
Werner Koch [Thu, 26 Apr 2018 10:39:59 +0000 (12:39 +0200)]
dirmngr: Lower the dead host resurrection time to 1.5h

* dirmngr/ks-engine-hkp.c (RESURRECT_INTERVAL): Decrease.
(INITIAL_HOSTTABLE_SIZE): Increase because the old values was likely
for development.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Fix handling of CNAMEed keyserver pools.
Werner Koch [Thu, 26 Apr 2018 10:28:53 +0000 (12:28 +0200)]
dirmngr: Fix handling of CNAMEed keyserver pools.

* dirmngr/ks-engine-hkp.c (map_host): Don't use the cname for HTTPHOST.
* dirmngr/server.c (make_keyserver_item): Map keys.gnupg.net.
--

For a description of the problem see the comment in
make_keyserver_item.

GnuPG-bug-id: 3755
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Add the used TLS library to the debug output.
Werner Koch [Wed, 25 Apr 2018 13:25:14 +0000 (15:25 +0200)]
dirmngr: Add the used TLS library to the debug output.

* dirmngr/http.c (send_request): Print the used TLS library in debug
mode.
--

We allow two different TLS libararies and thus it is useful to see
that in the debug output of bug reports.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Allow redirection from https to http for CRLs
Werner Koch [Wed, 25 Apr 2018 10:37:34 +0000 (12:37 +0200)]
dirmngr: Allow redirection from https to http for CRLs

* dirmngr/ks-engine.h (KS_HTTP_FETCH_NOCACHE): New flag.
(KS_HTTP_FETCH_TRUST_CFG): Ditto.
(KS_HTTP_FETCH_NO_CRL): Ditto.
(KS_HTTP_FETCH_ALLOW_DOWNGRADE): Ditto.
* dirmngr/ks-engine-http.c (ks_http_fetch): Replace args send_no_cache
and extra_http_trust_flags by a new flags arg.  Allow redirectiong
from https to http it KS_HTTP_FETCH_ALLOW_DOWNGRADE is set.
* dirmngr/loadswdb.c (fetch_file): Call with KS_HTTP_FETCH_NOCACHE.
* dirmngr/ks-action.c (ks_action_get): Ditto.
(ks_action_fetch): Ditto.
* dirmngr/crlfetch.c (crl_fetch): Call with the appropriate flags.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodirmngr: Implement CRL fetching via https.
Werner Koch [Wed, 25 Apr 2018 07:43:18 +0000 (09:43 +0200)]
dirmngr: Implement CRL fetching via https.

* dirmngr/http.h (HTTP_FLAG_TRUST_CFG): New flag.
* dirmngr/http.c (http_register_cfg_ca): New.
(http_session_new) [HTTP_USE_GNUTLS]: Implement new trust flag.
* dirmngr/certcache.c (load_certs_from_dir): Call new function.
(cert_cache_deinit): Ditto.
* dirmngr/http-ntbtls.c (gnupg_http_tls_verify_cb): Ditto.
* dirmngr/ks-engine-http.c (ks_http_fetch): Add new args
'send_no_cache' and 'extra_http_trust_flags'.  Change all callers to
provide the default value.
* dirmngr/crlfetch.c (crl_fetch): Rewrite to make use of
ks_http_fetch.
--

The old code simply did not use https for downloading of CRLS.
Instead it rewrote https to http under the assumption that the CRL
service was also available without encryption.  Note that a CRL is
self-standing and thus it does not need to have extra authenticity as
provided by TLS.  These days we should not use any unencrypted content
and thus this patch.

Be aware that cacert.org give a https CRL DP but that currently
redirects to to http!  This is a downgrade attack which we detect and
don't allow.  The outcome is that it is right now not possible to use
CAcert certificates.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agog10: Fix printing the keygrip with --card-status.
NIIBE Yutaka [Wed, 25 Apr 2018 00:37:21 +0000 (09:37 +0900)]
g10: Fix printing the keygrip with --card-status.

* g10/card-util.c (current_card_status): Keygrip for Auth is 3.

--

Fixes-commit: fd595c9d3642dba437fbe0f6e25d7aaaae095f94
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agodirmngr: Fallback to CRL if no default OCSP responder is configured.
Werner Koch [Tue, 24 Apr 2018 09:40:51 +0000 (11:40 +0200)]
dirmngr: Fallback to CRL if no default OCSP responder is configured.

* dirmngr/server.c (cmd_isvalid): Use option second arg to trigger
OCSP checkibng.  Fallback to CRL if no default OCSP responder has been
configured.
* sm/call-dirmngr.c (gpgsm_dirmngr_isvalid): Adjust accordingly.

Signed-off-by: Werner Koch <wk@gnupg.org>