aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | Adjust for changed macro names in libgpg-error master.Werner Koch2017-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | * common/logging.h (GPGRT_LOGLVL_): New replacement macros for older libgpg-error versions. -- Updates-commit: b56dfdfc1865ceb7c3c025d79996e049faee7fdf Signed-off-by: Werner Koch <[email protected]>
* | Use the gpgrt log functions if possible.Werner Koch2017-11-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.c: Do not build any code if we can use the gpgrt_log functions. (log_logv_with_prefix): Rename to log_logv_prefix and change order of args so that this function matches its printf like counterpart gpgrt_logv_prefix. Change all callers. (log_debug_with_string): Rename to log_debug_string. Change all callers. (log_printhex): Move first arg to end so that this function matches its printf like counterpart gpgrt_log_printhex. Change all callers. * common/logging.h: Divert to gpgrt/libgpg-error if we can use the gpgrt_log functions. (bug_at): Add inline versions if we can use the gpgrt_log functions. * configure.ac (GPGRT_ENABLE_LOG_MACROS): Add to AH_BOTTOM. (mycflags): Add -Wno-format-zero-length. -- This patch enables the use of the log function from libgpgrt (aka libgpg-error). Instead of checking a version number, we enable them depending on macros set by recent gpg-error versions. Eventually the whole divert stuff can be removed. The -Wno-format-zero-length is required because log_printhex can be called with an empty format string. Note that this is fully specified standard C behaviour. Signed-off-by: Werner Koch <[email protected]>
* | assuan: Fix exponential decay for first second.Werner Koch2017-11-151-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 Fixes-commit: 149041b0b917f4298239fe18b5ebd5ead71584a6 Signed-off-by: Werner Koch <[email protected]>
* | dirmngr: Add a background task framework.Werner Koch2017-11-141-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]>
* | dirmngr: Keep track of domains used for WKD queriesWerner Koch2017-11-131-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]>
* | dirmngr: Reduce default LDAP timeout to 15 seconds.Werner Koch2017-11-071-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]>
* dirmngr: Auto-enable Tor on startup or reload.Werner Koch2017-07-261-1/+11
| | | | | | | | * dirmngr/dirmngr.c (dirmngr_use_tor): Test for Tor availibility. -- GnuPG-bug-id: 2935 Signed-off-by: Werner Koch <[email protected]>
* agent,dirmngr: Check for homedir removal also using stat(2).Werner Koch2017-07-261-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]>
* w32: Also change the directory on daemon startup.Werner Koch2017-07-251-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]>
* common: New functions gnupg_daemon_rootdir and gnupg_chdir.Werner Koch2017-07-251-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]>
* Revert "w32: Change directory on daemon startup."Werner Koch2017-07-251-10/+3
| | | | | | -- This reverts commit 78ebc62604d77600b9865950610717d28c6027a2. Gnupg-bug-id: 2670
* w32: Change directory on daemon startup.Marcus Brinkmann2017-07-241-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
* dirmngr: Implement HTTP connect timeouts of 15 or 2 seconds.Werner Koch2017-06-081-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]>
* dirmngr: Fix final close of LISTEN_FD.NIIBE Yutaka2017-04-181-3/+3
| | | | | | * dirmngr/dirmngr.c (handle_connections): Close LISTEN_FD. Signed-off-by: NIIBE Yutaka <[email protected]>
* dirmngr: Fix thread key type.NIIBE Yutaka2017-04-131-1/+1
| | | | | | * dirmngr/dirmngr.c (my_tlskey_current_fd): Use npth_key_t. Signed-off-by: NIIBE Yutaka <[email protected]>
* dirmngr: New option --disable-ipv6Werner Koch2017-04-031-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]>
* Remove -I option to common.NIIBE Yutaka2017-03-071-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]>
* dirmngr: Rearrange files to fix de6d831.Werner Koch2017-03-021-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]>
* dirmngr: Let --gpgconf-list return the default keyserver.Werner Koch2017-03-021-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]>
* dirmngr: Add new debug flag "extprog"Werner Koch2017-02-231-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]>
* dirmngr: Load --hkp-cacert values into the certificate cache.Werner Koch2017-02-211-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]>
* dirmngr: New Assuan option "http-crl".Werner Koch2017-02-211-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]>
* dirmngr: Setup a log handler for ntbtls.Werner Koch2017-02-201-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]>
* dirmngr: First take on ntbtls cert verification.Werner Koch2017-02-191-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]>
* dirmngr: New option --no-use-tor and internal changes.Werner Koch2017-02-011-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]>
* dirmngr: Require --allow-version-check even if --use-tor is used.Werner Koch2017-01-311-1/+1
| | | | | | | * dirmngr/dirmngr.c (housekeeping_thread): Load swdb only if the option is set. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: New option --disable-ipv4.Werner Koch2017-01-241-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]>
* dirmngr: On SIGHUP mark all keyservers alive.Werner Koch2017-01-231-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]>
* dirmngr: Implement debug option "network" for http.Werner Koch2017-01-111-0/+1
| | | | | | * dirmngr/dirmngr.c (parse_rereadable_options): Set http debugging. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Make sure Tor mode is also set for DNS on SIGHUP.Werner Koch2017-01-031-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]>
* dirmngr: New option --resolver-timeout.Werner Koch2016-12-201-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]>
* dirmngr: Fix problems with the getsrv function.Werner Koch2016-12-191-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]>
* Remove unused debug flags and add "dns" and "network".Werner Koch2016-12-191-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]>
* dirmngr: Use one context for all libdns queries.Werner Koch2016-12-161-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]>
* dirmngr: New configure option --disable-libdns.Werner Koch2016-12-141-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]>
* dirmngr: Add option --standard-resolver.Werner Koch2016-12-011-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]>
* agent,dirmngr: Tiny restructuring.Werner Koch2016-11-291-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]>
* agent,dirmngr: Handle corner case in shutdown mode.Werner Koch2016-11-291-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]>
* dirmngr: Lazily launch ldap reaper thread.Daniel Kahn Gillmor2016-11-291-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]>
* dirmngr: Use a longer timer tick interval.Werner Koch2016-11-181-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]>
* dirmngr: More w32 system daemon cleanupDaniel Kahn Gillmor2016-11-181-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
* dirmngr: Register hkp-cacert even if the file doesn't exist yetDaniel Kahn Gillmor2016-11-171-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]>
* dirmngr: Auto-sownload the swdb.lstWerner Koch2016-11-171-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]>
* scd,dirmngr: Keep the standard fds when daemonizing.Werner Koch2016-11-161-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]>
* dirmngr: Prepare to trigger jobs by network activity.Werner Koch2016-11-111-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]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* dirmngr: Do not implement --supervised in Windows.Werner Koch2016-10-271-3/+7
| | | | | | | * dirmngr/dirmngr.c (opts) [W32]: Remove --supervised. (main) [W32]: Ditto. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Implement --supervised command (for systemd, etc).Daniel Kahn Gillmor2016-10-271-0/+40
| | | | | | | | | | | | | | | | | | | | | | | * dirmngr/dirmngr.c (main): Add new --supervised command, which is a mode designed for running under a process supervision system like systemd or runit. * doc/dirmngr.texi: document --supervised option. -- "dirmngr --supervised" is a way to invoke dirmngr such that a system supervisor like systemd can provide socket-activated startup, log management, and scheduled shutdown. When running in this mode, dirmngr: * Does not open its own listening socket; rather, it expects to be given a listening socket on file descriptor 3. * Does not detach from the invoking process, staying in the foreground instead. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* dirmngr: report actual socket name.Daniel Kahn Gillmor2016-10-271-0/+9
| | | | | | | | | | | | | | * dirmngr/dirmngr.[ch] (dirmngr_get_current_socket_name): new function to report known socket name. * dirmngr/server.c (cmd_getinfo): use dirmngr_get_current_socket_name to report correct socket name. -- This fixes the output of 'getinfo socket_name' when dirmngr is invoked with --socket-name. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* dirmngr: Fix hang due to deferred thread initialization.Werner Koch2016-10-261-13/+12
| | | | | | | | | * dirmngr/dirmngr.c (main): Call ldap_wrapper_launch_thread after thread_init. -- Fixes-commit: eda17649f8bd3b8ce7bfc00a3c11cbcae63c845d Signed-off-by: Werner Koch <[email protected]>