aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* dirmngr: Mark hosts dead on ENETDOWN.Werner Koch2017-01-111-0/+5
| | | | | | | * dirmngr/ks-engine-hkp.c (handle_send_request_error): Take care of ENETDOWN. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Fix Tor access for v6 addresses.Werner Koch2017-01-111-1/+63
| | | | | | | | | | | | | | | | | | | * dirmngr/http.c (use_socks): New. (my_sock_new_for_addr): New. (connect_server): Replace assuan_sock_new by my_sock_new_for_addr. -- Libassuan always uses 127.0.0.1 to connect to the local Tor proxy. https.c used to create a socket for the actual address family and thus the connect call in Libassuan fails when it tries to connect to a v6 address using a v4 socket. It would be cleaner to have the my_sock_new_for_addr function as a public interface in Libassuan; for now we need to duplicate some code. from Libassuan. GnuPG-bug-id: 2902 Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Remove warnings about unused global variables.Werner Koch2017-01-112-2/+2
| | | | | | | * dirmngr/crlcache.c (oidstr_issuingDistributionPoint): Comment. * dirmngr/ocsp.c (oidstr_certHash): Comment. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Implement debug option "network" for http.Werner Koch2017-01-112-3/+6
| | | | | | * dirmngr/dirmngr.c (parse_rereadable_options): Set http debugging. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Add debug code to http.c.Werner Koch2017-01-112-22/+54
| | | | | | | | | | | | | * dirmngr/http.c (opt_verbose, opt_debug): New vars. (http_set_verbose): New function. (_my_socket_new): Add debug output. (_my_socket_ref, _my_socket_unref, session_unref): Call log_debug if OPT_DEBUG has ben set to 2 in a debugger. (http_session_new, http_session_ref): Ditto. (send_request, http_start_data): Print debug output for the request. (parse_response): Change to use log_debug_string for the response. Signed-off-by: Werner Koch <[email protected]>
* common: New function log_debug_with_string.Werner Koch2017-01-112-37/+106
| | | | | | | | | | | | | | | * common/logging.c (do_logv): Factor some code out to ... (print_prefix): new. (log_logv): Add arg EXTRASTRING and print it. Change all callers to pass NULL for it. (log_debug_with_string): New. Uses EXTRASTRING. -- This function can be used to print a human readable buffer in addition to a log message to the log stream. This function will keep all lines together and prefix them with ">> ". Signed-off-by: Werner Koch <[email protected]>
* common: Avoid unnecessary ambiguity in argparse.Daniel Kahn Gillmor2017-01-111-1/+3
| | | | | | | | | | | | | * common/argparse.c (find_long_option): Avoid unnecessary ambiguity. -- If two struct ARGPARSE_OPTS share a prefix in their long_opt name, but have the exact same short_opt and flags, they are aliases and not distinct options. Avoid reporting this as an ambiguity, so that (for example) both --clearsign and --clear-sign can be invoked as --clear. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Debian-Bug-Id: 850475
* systemd-user: Enable "systemctl --user reload {dirmngr,gpg-agent}"Daniel Kahn Gillmor2017-01-102-0/+2
| | | | | | | | | | | | * doc/examples/systemd-user/*.service: Add ExecReload directives to indicate the canonical way to reload the services. GnuPG recommends reloading the agent and dirmngr with "gpgconf --reload". if anyone is running them as systemd user services, they might ask them to reload in the systemd way, so teach systemd the right thing to do. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* doc: Mention dirmngr.confWerner Koch2017-01-101-2/+15
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* tests: Improve gpgconf test.Justus Winter2017-01-102-6/+25
| | | | | | | | * tests/openpgp/defs.scm (valgrind): New variable. (gpg-config): Fix clearing an option. * tests/openpgp/gpgconf.scm: Also toggle 'quiet'. Signed-off-by: Justus Winter <[email protected]>
* tools: Fix memory leaks and improve error handling.Justus Winter2017-01-103-6/+52
| | | | | | | | | | | | | * tools/gpgconf-comp.c (gc_option_free): New function. (gc_components_free): Likewise. (gc_components_init): Likewise. (retrieve_options_from_program): Use 'xfree', fix memory leak. (change_options_program): Improve error handling. (gc_component_change_options): Fix memory leaks. * tools/gpgconf.c (main): Initialize components. * tools/gpgconf.h (gc_components_init): New prototype. Signed-off-by: Justus Winter <[email protected]>
* tests: Add test for gpgconf.Justus Winter2017-01-103-2/+73
| | | | | | | | | | * tests/openpgp/Makefile.am (XTESTS): Add new test. * tests/openpgp/defs.scm (percent-encode): New function. (gpg-conf): Generalize so that we can feed stdin. (gpg-config): New function. * tests/openpgp/gpgconf.scm: New file. Signed-off-by: Justus Winter <[email protected]>
* common: Fix fallback code.Justus Winter2017-01-102-2/+2
| | | | | | | | * common/logging.c (_log_assert): Fix the variant for compilers that do not support __FUNCTION__. * common/logging.h (_log_assert): Likewise. Signed-off-by: Justus Winter <[email protected]>
* dirmngr: Use "pgpkey-hkps" and "pgpkey-hkp" for SRV record lookups.Werner Koch2017-01-091-29/+34
| | | | | | | | | | | | | * dirmngr/ks-engine-hkp.c (map_host): Chnage arg NO_SRV to SRVTAG. (make_host_part): Rewrite. -- This fixes a regression from 2.0 and 1.4 where these tags have been in used since 2009. For whatever reason this was not ported to 2.1 and "hkp" was always used. GnuPG-bug-id: 2451 Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Do not use a SRV record for HKP if a port was specified.Werner Koch2017-01-093-28/+40
| | | | | | | | | | | | | | | | | * dirmngr/http.h (parsed_uri_s): Add field EXPLICIT_PORT. * dirmngr/http.c (do_parse_uri): That it. * dirmngr/ks-engine-hkp.c (map_host): Add arg NO_SRV. (make_host_part): Ditto. (ks_hkp_resolve): Set NO_SRV from EXPLICIT_PORT. (ks_hkp_search): Ditto. (ks_hkp_get): Ditto. (ks_hkp_put): Ditto. -- This implements the behaviour of the keyserver helpers from 1.4 and 2.0. Signed-off-by: Werner Koch <[email protected]>
* doc: Update man page for watchgnupgWerner Koch2017-01-091-18/+25
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Implement experimental SRV record lookup for WKD.Werner Koch2017-01-081-1/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dirmngr/server.c (cmd_wkd_get): Support SRV records. -- This patch changes the way a WKD query is done. Now we first look for a SRV record for service "openpgpkey" and port "tcp" under the to-be-queried domain. If such a record was found and the target host matches the to-be-queried domain or is a suffix to that domain, that target host is used instead of the domain name. The SRV record also allows to change the port and obviously can be used for load-balancing. For example a query for the submission address of example.org with the SRV record specification _openpgpkey._tcp IN SRV 0 0 0 wkd.foo.org. IN SRV 0 0 0 wkd.example.net. IN SRV 0 0 4711 wkd.example.org. (queried using the name "_openpgpkey._tcp.example.org") would fetch from this URL: https://wkd.example.org:4711/.well-known/openpgpkey/submission-address Note that the first two SRV records won't be used because foo.org and example.net do not match example.org. We require that the target host is identical to the domain or be a subdomain of it. This is so that an attacker modifying the SRV records needs to setup a server in a sub-domain of the actual domain and can't use an arbitrary domain. Whether this is a sufficient requirement is not clear and needs further discussion. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Improve debug output for TLS.Werner Koch2017-01-081-0/+8
| | | | | | * dirmngr/misc.c (dump_cert): Also print SubjectAltNames. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Change internal SRV lookup API.Werner Koch2017-01-085-37/+31
| | | | | | | | | | | | | * dirmngr/dns-stuff.c (get_dns_srv): Add args SERVICE and PROTO. * dirmngr/http.c (connect_server): Simplify SRV lookup. * dirmngr/ks-engine-hkp.c (map_host): Ditto. * dirmngr/t-dns-stuff.c (main): Adjust for changed get_dns_srv. -- This new API is more convenient because it includes commonly used code. Note that right now http.c's SRV record code is not used. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Strip root zone suffix from libdns SRV results.Werner Koch2017-01-081-0/+4
| | | | | | | | | * dirmngr/dns-stuff.c (getsrv_libdns): Strip trailing dot from the target. -- See-also: b200e636ab20d2aa93d9f71f3789db5a04af0a56 Signed-off-by: Werner Koch <[email protected]>
* agent,w32: Fix annoying output to DebugView.Werner Koch2017-01-062-7/+14
| | | | | | | | | * agent/gpg-agent.c (startup_fd_list): Do not define for W32. (main) [W32]: Do not call get_all_open_fds. -- GnuPG-bug-id: 2267 Signed-off-by: Werner Koch <[email protected]>
* doc: Document summary values of TOFU_STATSAndre Heinecke2017-01-061-0/+13
| | | | | | -- Signed-off-by: Andre Heinecke <[email protected]>
* scd: Fix for --disable-ccid for scdaemon.NIIBE Yutaka2017-01-061-6/+7
| | | | | | | | * scd/apdu.c (apdu_dev_list_finish): Don't call ccid_dev_scan_finish with no table. (apdu_open_reader): Only increment when it's zero. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix for --disable-ccid-driver.NIIBE Yutaka2017-01-061-1/+6
| | | | | | | * scd/apdu.c [HAVE_LIBUSB] (apdu_dev_list_start): Conditionalize. [HAVE_LIBUSB] (apdu_dev_list_finish, apdu_open_reader): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Support multiple readers by CCID driver.NIIBE Yutaka2017-01-066-190/+589
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start. (close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled... (apdu_close_reader): ... by this function now. (apdu_prepare_exit): Likewise. (open_ccid_reader): Open with dev_list. (apdu_dev_list_start, apdu_dev_list_finish): New. (apdu_open_one_reader): New. (apdu_open_reader): Support multiple readers. * scd/app.c (select_application): With SCAN, opening all readers available, and register as new APP. (app_write_learn_status): app->ref_count == 0 is valid for APP which is not yet used. (app_list_start, app_list_finish): New. * scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE. Add BAI. (parse_ccid_descriptor): BCD_DEVICE is now on the arguments. (ccid_dev_scan, ccid_dev_scan_finish): New. (ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New. (ccid_open_reader): Support multiple readers. (ccid_set_progress_cb, ccid_close_reader): No RID any more. -- With this change, multiple readers/tokens are supported by the internal CCID driver of GnuPG. Until the changes of upper layers (scdaemon, gpg-agent, and gpg front end), only a single reader is used, though. Signed-off-by: NIIBE Yutaka <[email protected]>
* Silence two -Wlogical-op warnings.Werner Koch2017-01-052-3/+7
| | | | | | | | * common/tlv.c (parse_ber_header): Avoid compiler warning about a duplicate condition. * tools/gpgtar-create.c (pattern_valid_p): Likewise. Signed-off-by: Werner Koch <[email protected]>
* doc: Mention gpgv in the description of gpg --verify.Werner Koch2017-01-051-0/+7
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* tests: New test for --{show,override}-session-key.Justus Winter2017-01-052-0/+46
| | | | | | | * tests/openpgp/Makefile.am (XTESTS): Add new test. * tests/openpgp/decrypt-session-key.scm: New file. Signed-off-by: Justus Winter <[email protected]>
* tests: Fix macro.Justus Winter2017-01-053-8/+12
| | | | | | | | | | * tests/openpgp/defs.scm (with-ephemeral-home-directory): Make hygienic, use define-macro, do not change to the ephemeral home directory. * tests/gpgsm/setup.scm: Change to the ephemeral home directory. * tests/openpgp/setup.scm: Likewise. Signed-off-by: Justus Winter <[email protected]>
* g10: avoid warning when --disable-tofuDaniel Kahn Gillmor2017-01-041-1/+1
| | | | | If configured with --disable-tofu, we see compiler warnings about an unused variable. This should remove those warnings.
* doc: Add release announcement pointers to NEWS entries.Werner Koch2017-01-041-2/+97
| | | | | | | | | -- These are used by the website buider to link to the announcement mails. Signed-off-by: Werner Koch <[email protected]>
* tests,w32: Fix locating the components.Justus Winter2017-01-041-9/+29
| | | | | | | | | | | * tests/openpgp/defs.scm (percent-decode): New function. (bin-prefix): New variable. (installed?): Likewise. (tool-hardcoded): Use the new variables. (gpg-conf): Use the new function to decode the values. (gpg-components): Do not use '--build-prefix' when 'installed?'. Signed-off-by: Justus Winter <[email protected]>
* doc: Extend dirmngr's --allow-version-check descriptionWerner Koch2017-01-031-1/+7
| | | | --
* dirmngr: Make sure Tor mode is also set for DNS on SIGHUP.Werner Koch2017-01-035-37/+14
| | | | | | | | | | | | | | | | | | | * dirmngr/dns-stuff.c (enable_dns_tormode): Always succeed. (reload_dns_stuff): Reset tor port. * dirmngr/dirmngr.c (set_tor_mode): Also enable Tor mode for DNS. (main): Remove warning that Tor mode may not fully work. * dirmngr/server.c (cmd_dns_cert): Remove explicit Tor for DNS initialization. * dirmngr/t-dns-stuff.c (main): Remove option --new-circuit and error checking for enable_dns_tormode. -- This patch also resets the port on SIGHUP so that after starting Tor SIGHUP is sufficient to use Tor. Without the SIGHUP and when not using the Tor browser Dirmngr would keep on trying the Tor browser port. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: New debug message on correctly initialized libdns.Werner Koch2017-01-031-1/+4
| | | | | | | | | | * dirmngr/dns-stuff.c (libdns_init): Add debug level diagnostic on success. -- This output may help to avoid questions when evaluating an Assuan log. Signed-off-by: Werner Koch <[email protected]>
* common: Turn assertions into expressions.Justus Winter2017-01-021-8/+8
| | | | | | | * common/logging.h (log_assert): Turn this into an expression so it can be used in expressions. Signed-off-by: Justus Winter <[email protected]>
* tests: Fix faked time in the TOFU test.Justus Winter2017-01-021-1/+1
| | | | | | * tests/openpgp/tofu.scm (GPG): Fix time delta. Signed-off-by: Justus Winter <[email protected]>
* g13: Improve printing of debug infos.Werner Koch2017-01-021-1/+1
| | | | | | * g13/g13tuple.c (all_printable): Make it work. Signed-off-by: Werner Koch <[email protected]>
* Replace use of variable-length-arrays.Werner Koch2017-01-025-18/+42
| | | | | | | | | | | | | * common/t-iobuf.c (main): Replace variable-length-array. * g10/gpgcompose.c (mksubpkt_callback): Ditto. (encrypted): Ditto. * g10/t-stutter.c (log_hexdump): Ditto. (oracle_test): Ditto. * g10/tofu.c (get_policy): Ditto. Use "%zu" for size_t. * scd/app-openpgp.c (ecc_writekey): Replace variable-length-array. Check for zero length OID_LEN. Signed-off-by: Werner Koch <[email protected]>
* build: Enable gcc warnings to detect non-portable code.Werner Koch2017-01-021-0/+9
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* gpgscm: Fail if too many arguments are given.Justus Winter2017-01-022-6/+4
| | | | | | | * tests/gpgscm/scheme.c (opexe_0): Enable check. * tests/gpgscm/tests.scm (test::report): Remove superfluous argument. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Add 'finally', rework all macros.Justus Winter2017-01-022-44/+52
| | | | | | | | | | | | | | | * tests/gpgscm/init.scm (finally): New macro. * tests/gpgscm/tests.scm (letfd): Rewrite. (with-working-directory): Likewise. (with-temporary-working-directory): Likewise. (lettmp): Likewise. -- Rewrite all our macros using 'define-macro'. Use the new control flow mechanism 'finally', or 'dynamic-wind' where appropriate. Make sure the macros are hygienic. Reduce code duplication. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Use boxed values for source locations.Justus Winter2017-01-022-46/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | * tests/gpgscm/scheme-private.h (struct port): Use boxed values for filename and current line. This allows us to use the same Scheme object for labeling all expressions in a file. * tests/gpgscm/scheme.c (file_push): Use boxed type for filename. (mark): Mark location objects of port objects. (gc): Mark location objects in the load stack. (port_clear_location): New function. (port_reset_current_line): Likewise. (port_increment_current_line): Likewise. (file_pop): Adapt accordingly. (port_rep_from_filename): Likewise. (port_rep_from_file): Likewise. (port_close): Likewise. (skipspace): Likewise. (token): Likewise. (_Error_1): Likewise. (opexe_0): Likewise. (opexe_5): Likewise. (scheme_deinit): Likewise. (scheme_load_file): Likewise. (scheme_load_named_file): Likewise. Signed-off-by: Justus Winter <[email protected]>
* doc: Remove warning that DNS is not routed via TorWerner Koch2017-01-021-4/+2
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Strip root zone suffix from libdns cname results.Werner Koch2017-01-021-0/+11
| | | | | | | | * dirmngr/dns-stuff.c (resolve_name_libdns): Strip trailing dot. (get_dns_cname_libdns): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
* scd: Fix select_application.NIIBE Yutaka2016-12-301-2/+4
| | | | | | * scd/app.c (select_application): Fix the condition for open. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix card removal monitor.NIIBE Yutaka2016-12-303-60/+70
| | | | | | | | * scd/app.c (app_reset): Call send_client_notification with REMOVAL. (scd_update_reader_status_file): Likewise. * scd/command.c (send_client_notifications): Distinguish removal. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Improve internal CCID driver.NIIBE Yutaka2016-12-291-152/+151
| | | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Don't scan for configuration but use active configuration. Support alt_setting. (scan_or_find_devices): Support alt_setting. (ccid_open_reader): Support alt_setting. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix a race condition for new_reader_slot.NIIBE Yutaka2016-12-295-47/+74
| | | | | | | | | | | | | | | | | | | * scd/apdu.c (reader_table_lock, apdu_init): New. (new_reader_slot): Serialize by reader_table_lock. * scd/app.c (lock_app, unlock_app, app_new_register): Fix error code usage. (initialize_module_command): Call apdu_init. * scd/scdaemon.c (main): Handle error for initialize_module_command. -- This is a long standing bug. There are two different things; The serialization of allocating a new SLOT, and the serialization of using the SLOT. The latter was implemented in new_reader_slot by lock_slot. However, the former was not done. Thus, there was a possible race where a same SLOT is allocated to multiple threads. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: APP centric approach for device management.NIIBE Yutaka2016-12-284-766/+403
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/app.c (lock_app): Rename from lock_reader and use internal field of APP. (unlock_app): Likewise. (app_dump_state): Use APP. (application_notify_card_reset): Remove. (check_conflict): Change API for APP, instead of SLOT. (check_application_conflict): Likewise. (release_application_internal): New. (app_reset): New. (app_new_register): New. (select_application): Change API for APP, instead of SLOT. (deallocate_app, release_application): Modify for manage link. (report_change): New. (scd_update_reader_status_file): Moved from command.c and use APP list, instead of VREADER. (initialize_module_command): Moved from command.c. * scd/command.c (TEST_CARD_REMOVAL): Remove. (IS_LOCKED): Simplify. (vreader_table): Remove. (vreader_slot, update_card_removed): Remove. (do_reset): Call app_reset. (get_current_reader): Remove. (open_card): Add SCAN arg. (cmd_serialno): No retry, since retry is done in lower layer in apdu.c. No do_reset, since it is done in lower layer. Add clearing card_removed flag. (cmd_disconnect): Call apdu_disconnect. (send_client_notifications): Modify for APP. (update_reader_status_file): Remove. -- APP is the abstraction of the card application. For management of cards, it is better to focus on the APP instead of the physical reader. This change makes support of multiple card/token easier. Signed-off-by: NIIBE Yutaka <[email protected]>