aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-07-20dirmngr: Avoid automatically checking upstream swdb.Daniel Kahn Gillmor1-2/+0
* dirmngr/dirmngr.c (housekeeping_thread): Avoid automatically checking upstream's software database. In Debian, software updates should be handled by the distro mechanism, and additional upstream checks only confuse the user. * doc/dirmngr.texi: document that --allow-version-check does nothing. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic dirmngr-idling Gbp-Pq: Name dirmngr-Avoid-automatically-checking-upstream-swdb.patch
2019-07-20dirmngr: Avoid need for hkp housekeeping.Daniel Kahn Gillmor1-3/+0
* dirmngr/ks-engine-hkp.c (host_is_alive): New function. Test whether host is alive and resurrects it if it has been dead long enough. (select_random_host, map_host, ks_hkp_mark_host): Use host_is_alive instead of testing hostinfo_t->dead directly. (ks_hkp_housekeeping): Remove function, no longer needed. * dirmngr/dirmngr.c (housekeeping_thread): Remove call to ks_hkp_housekeeping. -- Rather than resurrecting hosts upon scheduled resurrection times, test whether hosts should be resurrected as they're inspected for being dead. This removes the need for explicit housekeeping, and makes host resurrections happen "just in time", rather than being clustered on HOUSEKEEPING_INTERVAL seconds. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic dirmngr-idling Gbp-Pq: Name dirmngr-Avoid-need-for-hkp-housekeeping.patch
2019-02-06dirmngr: Fix initialization of assuan's nPth hook.NIIBE Yutaka1-1/+1
* dirmngr/dirmngr.c (main): Move assuan_set_system_hooks to... (thread_init): ... here. -- Cherry picked master commit of: 1f8817475f59ede3f28f57edc10ba56bbdd08b49 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-10-24dirmngr: Only print info for no ldapserver fileAndre Heinecke1-1/+5
* 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.
2018-08-28assuan: Fix exponential decay for first second.Werner Koch1-0/+8
* 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 <[email protected]> (cherry picked from commit 0cfdd3b57d592fb6baa7dafe8fde124e8a6c7798) Fixes-commit: 1189df2cd7d4b6896ba22aa204c159ff2a425ead Signed-off-by: Werner Koch <[email protected]>
2018-04-27dirmngr: Silence log output from dirmngr_ldap.Werner Koch1-1/+2
* 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 <[email protected]>
2017-12-12Change backlog from 5 to 64 and provide option --listen-backlog.Werner Koch1-2/+13
* agent/gpg-agent.c (oListenBacklog): New const. (opts): New option --listen-backlog. (listen_backlog): New var. (main): Parse new options. (create_server_socket): Use var instead of 5. * dirmngr/dirmngr.c: Likewise. * scd/scdaemon.c: Likewise. -- GnuPG-bug-id: 3473 Signed-off-by: Werner Koch <[email protected]>
2017-12-11dirmngr: Add a background task framework.Werner Koch1-2/+12
* dirmngr/workqueue.c: New. * dirmngr/Makefile.am (dirmngr_SOURCES): Add new file. * dirmngr/server.c (server_local_s): New field session_id. (cmd_wkd_get): Add a task. (task_check_wkd_support): New stub function. (cmd_getinfo): New sub-commands "session_id" and "workqueue". (start_command_handler): Add arg session_id and store it in SERVER_LOCAL. (dirmngr_status_helpf): New. * dirmngr/dirmngr.h (wqtask_t): New type. * dirmngr/dirmngr.c (main): Pass 0 as session_id to start_command_handler. (start_connection_thread): Introduce a session_id and pass it to start_command_handler. Run post session tasks. (housekeeping_thread): Run global workqueue tasks. -- Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 96a4fbecd1acf946dcde20bef4752c539dae196b)
2017-12-11dirmngr: Keep track of domains used for WKD queriesWerner Koch1-0/+3
* dirmngr/domaininfo.c: New file. * dirmngr/Makefile.am (dirmngr_SOURCES): Add file. * dirmngr/server.c (cmd_wkd_get): Check whether the domain is already known and tell domaininfo about the results. -- This adds a registry for domain information to eventually avoid useless queries for domains which do not support WKD. The missing part is a background task to check whether a queried domain supports WKD at all and to expire old entries. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 65038e6852185c20413d8f6602218ee636413b77)
2017-11-07dirmngr: Reduce default LDAP timeout to 15 seconds.Werner Koch1-1/+1
* dirmngr/dirmngr.c (DEFAULT_LDAP_TIMEOUT): Change to 15. * dirmngr/dirmngr_ldap.c (DEFAULT_LDAP_TIMEOUT): Ditto. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit ab7ac827041b5cd97bbca7a75b0930072dd6611f) GnuPG-bug-id: 3487
2017-07-26dirmngr: Auto-enable Tor on startup or reload.Werner Koch1-1/+11
* dirmngr/dirmngr.c (dirmngr_use_tor): Test for Tor availibility. -- GnuPG-bug-id: 2935 Signed-off-by: Werner Koch <[email protected]>
2017-07-26agent,dirmngr: Check for homedir removal also using stat(2).Werner Koch1-4/+18
* agent/gpg-agent.c (have_homedir_inotify): New var. (reliable_homedir_inotify): New var. (main): Set reliable_homedir_inotify. (handle_tick): Call stat on the homedir. (handle_connections): Mark availibility of the inotify watch. * dirmngr/dirmngr.c (handle_tick): Call stat on the homedir. (TIMERTICK_INTERVAL_SHUTDOWN): New. (handle_connections): Depend tick interval on the shutdown state. -- The stat call is used on systems which do not support inotify and also when we assume that the inotify does not work reliable. Signed-off-by: Werner Koch <[email protected]>
2017-07-25w32: Also change the directory on daemon startup.Werner Koch1-2/+5
* agent/gpg-agent.c (main): Always to the chdir. * dirmngr/dirmngr.c (main): Ditto. * scd/scdaemon.c (main): Ditto. -- Note that only dirmngr did not call the chdir with --no-detach. thus we kept it this way. Tested gpg-agent by checking the properties shown by procexp. Gnupg-bug-id: 2670 Signed-off-by: Werner Koch <[email protected]>
2017-07-25common: New functions gnupg_daemon_rootdir and gnupg_chdir.Werner Koch1-2/+4
* common/sysutils.c (gnupg_chdir): New. * common/homedir.c (gnupg_daemon_rootdir): New. * agent/gpg-agent.c (main): Use these functions instead chdir("/"). * dirmngr/dirmngr.c (main): Ditto. * scd/scdaemon.c (main): Ditto. -- Signed-off-by: Werner Koch <[email protected]>
2017-07-25Revert "w32: Change directory on daemon startup."Werner Koch1-10/+3
-- This reverts commit 78ebc62604d77600b9865950610717d28c6027a2. Gnupg-bug-id: 2670
2017-07-24w32: Change directory on daemon startup.Marcus Brinkmann1-3/+10
* agent/gpg-agent.c [HAVE_W32_SYSTEM]: Include <direct.h>. (main) [HAVE_W32_SYSTEM]: Change working directory to \. * dirmngr/dirmngr.c [HAVE_W32_SYSTEM]: Include <direct.h>. (main) [HAVE_W32_SYSTEM]: Change working directory to \. * scd/scdaemon.c [HAVE_W32_SYSTEM]: Include <direct.h>. (main) [HAVE_W32_SYSTEM]: Change working directory to \. Signed-off-by: Marcus Brinkmann <[email protected]> GnuPG-bug-id: 2670
2017-06-08dirmngr: Implement HTTP connect timeouts of 15 or 2 seconds.Werner Koch1-4/+39
* dirmngr/dirmngr.c (oConnectTimeout, oConnectQuickTimeout): New enums. (opts): New options --connect-timeout and --connect-quick-timeout. (DEFAULT_CONNECT_TIMEOUT): New. (DEFAULT_CONNECT_QUICK_TIMEOUT): New. (parse_rereadable_options): Handle new options. (post_option_parsing): New. Use instead of direct calls to set_debug() and set_tor_mode (). (main): Setup default timeouts. (dirmngr_init_default_ctrl): Set standard connect timeout. * dirmngr/dirmngr.h (opt): New fields connect_timeout and connect_quick_timeout. (server_control_s): New field timeout. * dirmngr/ks-engine-finger.c (ks_finger_fetch): Pass timeout to http_raw_connect. * dirmngr/ks-engine-hkp.c (send_request): Call http_session_set_timeout. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. * dirmngr/server.c (cmd_wkd_get, cmd_ks_search, cmd_ks_get) (cmd_ks_fetch): Implement --quick option. -- The standard connect timeouts are way to long so we add a timeout to the connect calls. Also implement the --quick option which is already used by gpg for non-important requests (e.g. looking up a key for verification). Signed-off-by: Werner Koch <[email protected]>
2017-04-18dirmngr: Fix final close of LISTEN_FD.NIIBE Yutaka1-3/+3
* dirmngr/dirmngr.c (handle_connections): Close LISTEN_FD. Signed-off-by: NIIBE Yutaka <[email protected]>
2017-04-13dirmngr: Fix thread key type.NIIBE Yutaka1-1/+1
* dirmngr/dirmngr.c (my_tlskey_current_fd): Use npth_key_t. Signed-off-by: NIIBE Yutaka <[email protected]>
2017-04-03dirmngr: New option --disable-ipv6Werner Koch1-0/+4
* dirmngr/dirmngr.h (struct opt): Add field 'disable_ipv6'. * dirmngr/dirmngr.c (oDisableIPv6): New const. (opts): New option --disable-ipv6. (parse_rereadable_options): Set that option. * dirmngr/dns-stuff.c (opt_disable_ipv6): New var. (set_dns_disable_ipv6): New. (resolve_name_standard): Make use of it. * dirmngr/ks-engine-finger.c (ks_finger_fetch): Take care of OPT.DISABLE_IPV6. * dirmngr/ks-engine-hkp.c (map_host): Ditto. (send_request): Ditto. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. * dirmngr/ocsp.c (do_ocsp_request): Ditto. Signed-off-by: Werner Koch <[email protected]>
2017-03-07Remove -I option to common.NIIBE Yutaka1-2/+2
* dirmngr/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * g10/Makefile.am (AM_CPPFLAGS): Ditto. * g13/Makefile.am (AM_CPPFLAGS): Ditto. * kbx/Makefile.am (AM_CPPFLAGS): Ditto. * scd/Makefile.am (AM_CPPFLAGS): Ditto. * sm/Makefile.am (AM_CPPFLAGS): Ditto. * tools/Makefile.am (AM_CPPFLAGS): Ditto. * Throughout: Follow the change. Signed-off-by: NIIBE Yutaka <[email protected]>
2017-03-02dirmngr: Rearrange files to fix de6d831.Werner Koch1-0/+1
* dirmngr/http-common.c: New. * dirmngr/http-common.h: New. * dirmngr/Makefile.am (dirmngr_SOURCES): Add them. (t_http_SOURCES): Add them. (t_ldap_parse_uri_SOURCES): Add them. * dirmngr/misc.c (get_default_keyserver): Move to ... * dirmngr/http-common.c: here. * dirmngr/http.c: Include http-common.h instead of misc.h. * dirmngr/http-ntbtls.c: Ditto. Signed-off-by: Werner Koch <[email protected]>
2017-03-02dirmngr: Let --gpgconf-list return the default keyserver.Werner Koch1-1/+7
* dirmngr/misc.c (get_default_keyserver): New. * dirmngr/http.c: Include misc.h (http_session_new): Use get_default_keyserver instead of hardwired "hkps.pool.sks-keyservers.net". * dirmngr/http-ntbtls.c (gnupg_http_tls_verify_cb): Ditto. * dirmngr/dirmngr.c (main) <aGPGCongList>: Return default keyserver. Signed-off-by: Werner Koch <[email protected]>
2017-02-23dirmngr: Add new debug flag "extprog"Werner Koch1-1/+2
* dirmngr/dirmngr.h (DBG_EXTPROG_VALUE, DBG_EXTPROG): New macros. * dirmngr/dirmngr.c (debug_flags): Add flag "extprog". (handle_connections): Use a macro instead of -1 for an invalid socket. * dirmngr/loadswdb.c (verify_status_cb): Debug the gpgv call. Signed-off-by: Werner Koch <[email protected]>
2017-02-21dirmngr: Load --hkp-cacert values into the certificate cache.Werner Koch1-6/+14
* dirmngr/dirmngr.c (hkp_cacert_filenames): New var. (parse_rereadable_options): Store filenames from --hkp-cacert in the new var. (main, dirmngr_sighup_action): Pass that var to cert_cache_init. * dirmngr/certcache.c (cert_cache_init): Add arg 'hkp_cacert' and load those certs. (load_certs_from_file): Use autodetect so that PEM and DER encodings are possible. Signed-off-by: Werner Koch <[email protected]>
2017-02-21dirmngr: New Assuan option "http-crl".Werner Koch1-0/+1
* dirmngr/dirmngr.h (server_control_s): New flag 'http_no_crl'. * dirmngr/dirmngr.c (dirmngr_init_default_ctrl): Set this flag. * dirmngr/server.c (option_handler): New option "http-crl" * dirmngr/http.h (HTTP_FLAG_NO_CRL): New flag. * dirmngr/http-ntbtls.c (gnupg_http_tls_verify_cb): Consult this flag. * dirmngr/ks-engine-hkp.c (send_request): Set flag depending on CTRL. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. * dirmngr/t-http.c (main): New option --no-crl. -- This new option can be used to enable CRL checks on a per session base. The default is not to use CRLs for https connections. Signed-off-by: Werner Koch <[email protected]>
2017-02-20dirmngr: Setup a log handler for ntbtls.Werner Koch1-0/+21
* dirmngr/dirmngr.c (my_ntbtls_log_handler) [HTTP_USE_NTBTLS]: New. (main) [HTTP_USE_NTBTLS]: Register log handler. Signed-off-by: Werner Koch <[email protected]>
2017-02-19dirmngr: First take on ntbtls cert verification.Werner Koch1-0/+3
* dirmngr/http-ntbtls.c: New. * dirmngr/Makefile.am (dirmngr_SOURCES): Add file. * dirmngr/dirmngr.h (SERVER_CONTROL_MAGIC): New. (server_conrol_s): Add field 'magic', * dirmngr/dirmngr.c (dirmngr_init_default_ctrl): Set MAGIC. (dirmngr_deinit_default_ctrl): Set MAGIC to deadbeef. * dirmngr/http.c (my_ntbtls_verify_cb): New. (http_session_new) [HTTP_USE_NTBTLS]: Remove all CA setting code. (send_request) [HTTP_USE_NTBTLS]: Set the verify callback. Do not call the verify callback after the handshake. * dirmngr/ks-engine-hkp.c (send_request): Pass gnupg_http_tls_verify_cb to http_session_new. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. * dirmngr/t-http.c (my_http_tls_verify_cb): New. (main): Rename option --gnutls-debug to --tls-debug. (main) [HTTP_USE_NTBTLS]: Create a session. Signed-off-by: Werner Koch <[email protected]>
2017-02-01dirmngr: New option --no-use-tor and internal changes.Werner Koch1-3/+43
* dirmngr/dns-stuff.c (disable_dns_tormode): New. * dirmngr/dirmngr.c (oNoUseTor): New const. (opts): New option --no-use-tor. (tor_mode): New var. (parse_rereadable_options): Change to use TOR_MODE. (dirmngr_use_tor): New. (set_tor_mode): Call disable_dns_tormode. Implement oNoUseTor. * dirmngr/dirmngr.h (opt): Remove field 'use_tor'. Replace all references by a call to dirmngr_use_tor(). * dirmngr/server.c (cmd_getinfo): Distinguish between default and enforced TOR_MODE. -- This patch replaces the global variable opt.use_tar by a function testing a file local mode flag. This patch prepares for a use-tor-if-available mode. GnuPG-bug-id: 2935 Signed-off-by: Werner Koch <[email protected]>
2017-01-31dirmngr: Require --allow-version-check even if --use-tor is used.Werner Koch1-1/+1
* dirmngr/dirmngr.c (housekeeping_thread): Load swdb only if the option is set. Signed-off-by: Werner Koch <[email protected]>
2017-01-24dirmngr: New option --disable-ipv4.Werner Koch1-0/+5
* dirmngr/dirmngr.c (oDisableIPv4): New const. (opts): New option --disable-ipv4. (parse_rereadable_options): Set that option. * dirmngr/dirmngr.h (opt): New field 'disable_ipv4'. * dirmngr/dns-stuff.c (opt_disable_ipv4): bew var. (set_dns_disable_ipv4): New. (resolve_name_standard): Skip v4 addresses when OPT_DISABLE_IPV4 is set. * dirmngr/ks-engine-hkp.c (map_host): Ditto. (send_request): Pass HTTP_FLAG_IGNORE_IPv4 if opt.disable_v4 is set. * dirmngr/crlfetch.c (crl_fetch): Ditto. * dirmngr/ks-engine-finger.c (ks_finger_fetch): Ditto. * dirmngr/ks-engine-http.c (ks_http_fetch): Ditto. * dirmngr/ocsp.c (do_ocsp_request): Ditto. Signed-off-by: Werner Koch <[email protected]>
2017-01-23dirmngr: On SIGHUP mark all keyservers alive.Werner Koch1-0/+1
* dirmngr/ks-engine-hkp.c (ks_hkp_reload): New. * dirmngr/dirmngr.c (dirmngr_sighup_action): Call it. Signed-off-by: Werner Koch <[email protected]>
2017-01-11dirmngr: Implement debug option "network" for http.Werner Koch1-0/+1
* dirmngr/dirmngr.c (parse_rereadable_options): Set http debugging. Signed-off-by: Werner Koch <[email protected]>
2017-01-03dirmngr: Make sure Tor mode is also set for DNS on SIGHUP.Werner Koch1-7/+3
* 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]>
2016-12-20dirmngr: New option --resolver-timeout.Werner Koch1-0/+10
* dirmngr/dns-stuff.c (DEFAULT_TIMEOUT): New. (opt_timeout): New var. (set_dns_timeout): New. (libdns_res_open): Set the default timeout. (libdns_res_wait): Use configurable timeout. (resolve_name_libdns): Ditto. * dirmngr/dirmngr.c (oResolverTimeout): New const. (opts): New option --resolver-timeout. (parse_rereadable_options): Set that option. (main) <aGPGConfList>: Add --nameserver and --resolver-timeout. * tools/gpgconf-comp.c (gc_options_dirmngr): Add --resolver-timeout and --nameserver. * dirmngr/http.c (connect_server): Fix yesterday introduced bug in error diagnostic. -- This timeout is a pretty crude thing because libdns has a few other internal timeouts as well. Signed-off-by: Werner Koch <[email protected]>
2016-12-19dirmngr: Fix problems with the getsrv function.Werner Koch1-0/+2
* dirmngr/dns-stuff.c (opt_debug, opt_verbose): New vars. (set_dns_verbose): New func. (libdns_switch_port_p): Add debug output. (resolve_dns_name): Ditto. (get_dns_cert): Ditto. (get_dns_cname): Ditto. (getsrv_libdns, getsrv_standard): Change SRVCOUNT to an unsigend int. (getsrv): Rename to ... ((get_dns_srv): this. Add arg R_COUNT and return an error. Add debug output. * dirmngr/http.c: Adjust for chnaged getsrv(). * dirmngr/ks-engine-hkp.c (map_host): Ditto. * dirmngr/t-dns-stuff.c (main): Ditto. Call set_dns_verbose. * dirmngr/dirmngr.c (parse_rereadable_options): Call set_dns_verbose. -- Due to our switch to Libdns getsrv didn't worked correctly because it returned -1 for an NXDOMAIN. However, it is perfectly okay to have no SRV record and thus we change the way this function is called to be aligned with the other functions and also map NXDOMAIN to a zero SRV record count. Signed-off-by: Werner Koch <[email protected]>
2016-12-19Remove unused debug flags and add "dns" and "network".Werner Koch1-0/+2
* g10/options.h (DBG_CARD_IO_VALUE, DBG_CARD_IO): Remove. * g10/gpg.c (debug_flags): Remove "cardio". * agent/agent.h (DBG_COMMAND_VALUE, DBG_COMMAND): Remove. * agent/gpg-agent.c (debug_flags): Remove "command". * scd/scdaemon.h (DBG_COMMAND_VALUE, DBG_COMMAND): Remove. * scd/scdaemon.c (debug_flags): Remove "command". * dirmngr/dirmngr.h (DBG_DNS_VALUE, DBG_DNS): New. (DBG_NETWORK_VALUE, DNG_NETWORK): New. * dirmngr/dirmngr.c (debug_flags): Add "dns" and "network". -- Note that "dns" and "network" are not yet used but will soon be added to dirmngr. Signed-off-by: Werner Koch <[email protected]>
2016-12-16dirmngr: Use one context for all libdns queries.Werner Koch1-0/+2
* dirmngr/dns-stuff.c (libdns_reinit_pending): New var. (enable_recursive_resolver): Set var. (set_dns_nameserver): Ditto. (libdns_init): Avoid double initialization. (libdns_deinit): New. (reload_dns_stuff): New. (libdns_res_open): Act upon LIBDNS_REINIT_PENDING. * dirmngr/t-dns-stuff.c (main): Call reload_dns_stuff to release memory. * dirmngr/dirmngr.c (cleanup): Ditto. (dirmngr_sighup_action): Call reload_dns_stuff to set LIBDNS_REINIT_PENDING. Signed-off-by: Werner Koch <[email protected]>
2016-12-14dirmngr: New configure option --disable-libdns.Werner Koch1-0/+3
* configure.ac: Add option --disable-libdns (USE_LIBDNS): New ac_subst and am_conditional. (USE_C99_CFLAGS): Set only if libdns is used. * dirmngr/Makefile.am (dirmngr_SOURCES): Move dns.c and dns.h to ... (dirmngr_SOURCES) [USE_LIBDNS0: here. (t_common_src): Ditto. * dirmngr/dirmngr.c (oRecursiveResolver): New constant. (opts): New option "--recursive-resolver". (parse_rereadable_options): Set option. * dirmngr/t-dns-stuff.c (main): Add option --recursive-resolver. * dirmngr/server.c (cmd_getinfo): Depend output of "dnsinfo" on the new variables. * dirmngr/dns-stuff.c: Include dns.h only if USE_DNSLIB is defined. Also build and call dnslib functions only if USE_DNSLIB is defined. (recursive_resolver): New var. (enable_recursive_resolver): New func. (recursive_resolver_p): New func. -- In case users run into problems building GnuPG, the configure option allows to disable that support and continue w/o Tor support using the system resolver. --recursive-resolver was easy enough to implement and may be useful in some situation. It does not fully work, though. Signed-off-by: Werner Koch <[email protected]>
2016-12-01dirmngr: Add option --standard-resolver.Werner Koch1-0/+5
* dirmngr/dirmngr.c (oStandardResolver): New constant. (opts): New option --standard-resolver. (parse_rereadable_options): Set option. * dirmngr/dns-stuff.c: Refactor all code to support the new option. (standard_resolver): New var. (enable_standard_resolver, standard_resolver_p): New func. * dirmngr/http.c (connect_server): Remove USE_DNS_SRV build conditional. * dirmngr/ks-engine-hkp.c (map_host): Ditto. * dirmngr/server.c (cmd_getinfo) <dnsinfo>: Take care of new option * configure.ac (HAVE_ADNS_IF_TORMODE): Remove var ADNSLIB. ac_define USE_ADNS in the adns checking code. Remove options --disable-dns-srv and --disable-dns-cert. Always look for the system resolver. Print warning if no system resolver was found. (USE_DNS_CERT, USE_DNS_SRV): Remove ac_defines. (HAVE_SYSTEM_RESOLVER): New ac_define. (USE_DNS_SRV): Remove am_conditional; not used anyway. -- This option allows for runtime switching to the system's standard resolver. This is mainly useful to work around possible bugs in the optional resolver libraries (as of now ADNS). Note that on Windows there is no code to use systems's resolver and thus for full functionality dirmngr must be build with a separate resolver. This patch also does way with configure options to disable the use of CERT and SRV records. Signed-off-by: Werner Koch <[email protected]>
2016-11-29agent,dirmngr: Tiny restructuring.Werner Koch1-4/+12
* agent/gpg-agent.c (handle_connections): Add a comment. * dirmngr/dirmngr.c (main): Move assuan_sock_close of the listening socket to ... (handle_connections): here. Add a comment why we keep the listening socket open during a shutdown. Signed-off-by: Werner Koch <[email protected]>
2016-11-29agent,dirmngr: Handle corner case in shutdown mode.Werner Koch1-5/+7
* agent/gpg-agent.c (handle_connections): Keep on selecting on the inotify fd even when a shutdown is pending. * dirmngr/dirmngr.c (handle_connections): Ditto. Also simplifyy the use of the HAVE_INOTIFY_INIT cpp conditional. -- Without that patch we won't notice a removed socket when a shutdown is pending. This is somewhat related to bug report 2849. Signed-off-by: Werner Koch <[email protected]>
2016-11-29dirmngr: Lazily launch ldap reaper thread.Daniel Kahn Gillmor1-18/+0
* dirmngr/dirmngr.c (main): Avoid calling ldap_wrapper_launch_thread() Before we need it. * dirmngr/ldap-wrapper.c (ldap_wrapper): Call ldap_wrapper_launch_thread() just in time (before any attempt to use an ldap subprocess). -- A dirmngr process that never looks anything up in LDAP has no need for a reaper thread, but one was started automatically. This thread wakes up every two seconds to look for ldap processes that might never have been running. We won't start more than one reaper thread for any given dirmngr due to the static int "done" in ldap_wrapper_launch_thread(), so it's safe to call this every time there is a use of ldap_wrapper. If someone wants to do further dirmngr optimizations for ldap users, the reaper thread itself could use dynamically-calculated timeouts (and probably needs to be alerted dynamically when a new ldap subprocess is available so it can re-calculate those timeouts). Note: It's not clear to me how to test ldap access effectively; i know of no public ldap services that i can verify against, and i do not run my own ldap servers. If someone has a publicly-available ldap server that developers can run tests against, i would be happy to hear about it. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2016-11-18dirmngr: Use a longer timer tick interval.Werner Koch1-10/+3
* dirmngr/dirmngr.c (TIMERTICK_INTERVAL): Always use 60 seconds like we did for WindowsCE. -- Given that the timer tick is only used for housekeeping tasks and these are done every 10 minutes, it makes no sense to use 2 seconds. The minor drawback is tha the housekeeping may be delayed by one minute. NB: For the purpose of power saving, we already make sure that the process wakes up at the full second so that it is synchronized to the wakeup time of other processes. Signed-off-by: Werner Koch <[email protected]>
2016-11-18dirmngr: More w32 system daemon cleanupDaniel Kahn Gillmor1-14/+0
* dirmngr/dirmngr.c (handle_tick): Remove w32 tests for shutdown_pending; no longer needed. -- In d83ba4897bf217d1045c58d1b99e52bd31c58812, we removed the Windows-specific system daemon features, where shutdown_pending was set from w32_service_control(). shutdown_pending is now never assigned outside of handle_signal() or within an inotify test, neither of which are available on w32. As a result, this stanza in handle_tick() should be dead code, and can be removed to keep things simple. Signed-off-by: Daniel Kahn Gillmor <[email protected]> s/win32/w32/ to please RMS ;-) -wk
2016-11-17dirmngr: Register hkp-cacert even if the file doesn't exist yetDaniel Kahn Gillmor1-9/+3
* dirmngr/dirmngr.c (parse_readable_options): If we're unable to turn an argument for hkp-cacert into an absolute filename, terminate completely. * dirmngr/http.c (http_register_tls_ca): Show a warning if file is not immediately accessible, but register it anyway. -- Without this changeset, the condition of the filesystem when dirmngr is initialized will have an effect on later activities of dirmngr. For example, if a file identified by a hkp-cacert directive doesn't exist when dirmngr starts, dirmngr will behave as though it simply didn't have the hkp-cacert directive set at all, even if the file should appear later. dirmngr currently behaves differently if no hkp-cacert directives have been set then it does when at least one hkp-cacert directive has been set. For example, its choice of CA cert for hkps://hkps.pool.sks-keyservers.net depends on whether a TLS CA file has been registered. That behavior shouldn't additionally depend on the state of the filesystem at the time of dirmngr launch. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2016-11-17dirmngr: Auto-sownload the swdb.lstWerner Koch1-10/+23
* dirmngr/dirmngr.h (struct opt): Add field allow_version_check. * dirmngr/dirmngr.c (oAllowVersionCheck): New. (opts): Add --allow-version-check. (network_activity_seen): New variable. (parse_rereadable_options): Set opt.allow_version_check. (main) <aGPGConfList>: Do not anymore set the no change flag for Windows. Add allow-version-check. (netactivity_action): Set network_activity_seen. (housekeeping_thread): Call dirmngr_load_swdb. * tools/gpgconf-comp.c (gc_options_dirmngr): Add allow-version-check. Make "use-tor" available at Basic level. Signed-off-by: Werner Koch <[email protected]>
2016-11-16scd,dirmngr: Keep the standard fds when daemonizing.Werner Koch1-1/+11
* dirmngr/dirmngr.c (main): Before calling setsid do not close the standard fds but connect them to /dev/null. * scd/scdaemon.c (main): Ditto. Noet that the old test for a log stream was even reverted. -- Note that this was fixed for gpg-agent 10 years ago on 2006-11-09. Signed-off-by: Werner Koch <[email protected]>
2016-11-11dirmngr: Prepare to trigger jobs by network activity.Werner Koch1-0/+14
* dirmngr/http.c (netactivity_cb): New. (http_register_netactivity_cb): New. (notify_netactivity): New. (connect_server): Call that function. * dirmngr/dirmngr.c (main): Call http_register_netactivity_cb. (netactivity_action): New stub handler. Signed-off-by: Werner Koch <[email protected]>
2016-11-05Change all http://www.gnu.org in license notices to https://Werner Koch1-1/+1
--