aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* w32: Make it build again if Tofu support is not available.Werner Koch2015-10-261-0/+4
| | | | | | | * g10/keylist.c (public_key_list) [!USE_TOFU]: Do not call tofu functions. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Add example Tor hidden service.Werner Koch2015-10-262-1/+4
| | | | --
* dirmngr: Support Tor hidden services.Werner Koch2015-10-264-2/+62
| | | | | | | | | | | | | | * dirmngr/dns-stuff.c (is_onion_address): New. * dirmngr/ks-engine-hkp.c (hostinfo_s): Add field "onion". (map_host): Special case onion addresses. (ks_hkp_print_hosttable): Print an 'O' for an onion address. * dirmngr/http.c (connect_server): Special case onion addresses. -- Note that this requires the latest libassuan from git. Onion addresses are always support regardless of the --use-tor flag. Signed-off-by: Werner Koch <[email protected]>
* dirmngr,w32: Remove gethostbyname hack and make it build again.Werner Koch2015-10-262-37/+10
| | | | | | | | | * dirmngr/http.c (connect_server) [W32]: Remove gethostbyname hack; we require getaddrinfo anyway. * dirmngr/dns-stuff.c (AI_ADDRCONFIG): Add replacement if not defined. (map_eai_to_gpg_error) [W32]: Take care of unsupported codes. Signed-off-by: Werner Koch <[email protected]>
* gpg: Make sure we only have a single SQL statement.Neal H. Walfield2015-10-261-1/+16
| | | | | | | | * g10/tofu.c (sqlite3_stepx): Make sure SQL only contains a single SQL statement. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: When the TOFU DB is in batch mode, periodically drop the locks.Neal H. Walfield2015-10-261-0/+30
| | | | | | | | | | | | * g10/tofu.c: Include <sched.h>. (batch_update_started): New variable. (begin_transaction): If we've been in batch mode for a while, then commit any extant batch transactions. (tofu_begin_batch_update): If we are not in batch mode, initialize batch_update_started. -- Signed-off-by: Neal H. Walfield <[email protected]>
* dirmngr: Add workaround for broken getaddrinfo.Werner Koch2015-10-255-3/+161
| | | | | | | | | | | | | | | | | | * dirmngr/dns-stuff.c (resolve_name_standard): On failure retry by first resolving the CNAME. (get_dns_cname): New. * dirmngr/t-dns-stuff.c (main): Add option --cname. -- At least the getaddrinfo implementation in glibc 2.19-13 from Debian returns EAI_NONAME if the CNAME points to a too long list of A/AAAA addresses. Looking at the wire the data is correctly returned from the server but getaddrinfo seems to get confused by truncation and retry. To fix this we resolve the CNAME again and call getaddrinfo again with the canonical name. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Better handle systems without IPv6 or IPv4.Werner Koch2015-10-251-1/+2
| | | | * dirmngr/dns-stuff.c (resolve_name_standard): Use AI_ADDRCONFIG.
* dirmngr: Replace use of getnameinfo by resolve_dns_addr.Werner Koch2015-10-252-77/+36
| | | | | | | * dirmngr/ks-engine-hkp.c (my_getnameinfo): Remove. (map_host): Use resolve_dns_addr. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Implement a getnameinfo wrapper.Werner Koch2015-10-254-60/+221
| | | | | | | | | | | | | | | | | | | * dirmngr/dns-stuff.h (DNS_NUMERICHOST): New. (DNS_WITHBRACKET): New. * dirmngr/dns-stuff.c (resolve_name_standard): Factor code out to... (map_eai_to_gpg_error): new. (resolve_addr_standard): New. (resolve_dns_addr): New. * dirmngr/ks-engine-hkp.c (is_ip_address): Move to ... * dirmngr/dns-stuff.c (is_ip_address): here. Add support for non bracketed v6 addresses. * dirmngr/t-dns-stuff.c: Remove header netdb.h. (main): Add option --bracket. Use resolve_dns_name instead of getnameinfo. Signed-off-by: Werner Koch <[email protected]>
* gpg: Provide an interface to patch TOFU updates.Neal H. Walfield2015-10-235-53/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/tofu.c (struct db): Rename begin_transaction to savepoint_batch. Rename end_transaction to savepoint_batch_commit. Update users. Remove field rollback. Add fields savepoint_inner and savepoint_inner_commit. Add field batch_update. (dump_cache): New function. (batch_update): New variable. (begin_transaction). New function. (end_transaction): New function. (rollback_transaction): New function. (tofu_begin_batch_update): New function. (tofu_end_batch_update): New function. (closedb): End any pending batch transaction. (closedbs): Assert that none of the DBs have a started batch transaction if we not in batch mode. (record_binding): Use the begin_transaction, end_transaction and rollback_transaction functions instead of including the SQL inline. Also start a batch mode transaction if we are using the flat format. (tofu_register): Use the begin_transaction, end_transaction and rollback_transaction functions instead of including the SQL inline. * g10/gpgv.c (tofu_begin_batch_update): New function. (tofu_end_batch_update): New function. * g10/test-stubs.c (tofu_begin_batch_update): New function. (tofu_end_batch_update): New function. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Cache prepared SQL queries and open DB connections.Neal H. Walfield2015-10-231-211/+518
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/tofu.c: Include <stdarg.h>. (prepares_saved) [DEBUG_TOFU_CACHE]: New variable. (queries) [DEBUG_TOFU_CACHE]: New variable. (struct db): Add fields prevp, begin_transaction, end_transaction, rollback, record_binding_get_old_policy, record_binding_update, record_binding_update2, get_policy_select_policy_and_conflict, get_trust_bindings_with_this_email, get_trust_gather_other_user_ids, get_trust_gather_other_keys, register_already_seen, and register_insert. [DEBUG_TOFU_CACHE]: Add field hits. (STRINGIFY): New macro. (STRINGIFY2): New macro. (enum sqlite_arg_type): New enum. (sqlite3_stepx): New function. (combined_db): Remove variable. (opendb): Don't cache the combined db. (struct dbs): New struct. Update users to use this as the head of the local DB list rather than overloading struct db. (unlink_db): New function. (link_db): New function. (db_cache): New variable. (db_cache_count): New variable. (DB_CACHE_ENTRIES): Define. (getdb): If the dbs specific cache doesn't include the DB, look at DB_CACHE. Only if that also doesn't include the DB open the corresponding DB. (closedb): New function. (opendbs): Don't open the combined DB. Just return an initialized struct dbs. (closedbs): Don't close the dbs specific dbs. Attach them to the front of DB_CACHE. If DB_CACHE contains more than DB_CACHE_ENTRIES, close enough dbs from the end of the DB_CACHE list such that DB_CACHE only contains DB_CACHE_ENTRIES. Don't directly close the dbs, instead use the new closedb function. [DEBUG_TOFU_CACHE]: Print out some statistics. (record_binding): Use sqlite3_stepx instead of sqlite3_exec or sqlite3_exec_printf. (get_policy): Likewise. (get_trust): Likewise. (tofu_register): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Return the DBs meta-handle rather than the sqlite3 handle.Neal H. Walfield2015-10-231-28/+28
| | | | | | | | * g10/tofu.c (getdb): Return a struct db * instead of an sqlite *. Update users. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Use the proper type.Neal H. Walfield2015-10-233-13/+2
| | | | | | | | | | * g10/options.h: Include "tofu.h". (opt.tofu_default_policy): Change type to enum tofu_policy. * g10/gpgv.c (enum tofu_policy): Don't redeclare. * g10/test-stubs.c (enum tofu_policy): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>
* dirmngr: Implement Tor mode for SRV RRs.Werner Koch2015-10-222-14/+50
| | | | | | | | | | | * dirmngr/dns-stuff.c (get_dns_cert): Factor adns init out to... (my_adns_init): new. (getsrv)[USE_ADNS]: Use my_adns_init. (getsrv)[!USE_ADNS]: Return an error if Tor mode is active. * dirmngr/t-dns-stuff.c: Add option --use-tor. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Do not use MAXDNAME.Werner Koch2015-10-223-15/+20
| | | | | | | | | | | | | | | | | | | * dirmngr/dns-stuff.c (getsrv): Replace MAXDNAME. * dirmngr/dns-stuff.h (MAXDNAME): Remove. (struct srventry): Use a fixed value instead of MAXDNAME. * dirmngr/http.c (connect_server): Use DIMof instead of MAXDNAME. Malloc a helper array. -- Depending on the order of included headers it might be that we allocate the array with a different size than what we test against in another module. To make it more robust we use the actual known size of checking. A better would be to use a linked list and avoid these large arrays. Signed-off-by: Werner Koch <[email protected]>
* Move SRV RR code from common/ to dirmngr/.Werner Koch2015-10-228-429/+300
| | | | | | | | | | | | * common/srv.c: Merge into dirmngr/dns-stuff.c. Delete file. * common/srv.h: Merge into dirmngr/dns-stuff.h. Delete file. * common/Makefile.am (common_sources): Remove srv.c and srv.h. * g10/keyserver.c: Do not include srv.h. The code using it is anyway disabled. * dirmngr/http.c: Remove header srv.h and stubs. * dirmngr/t-dns-stuff.c: Add option --srv. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Use the new DNS wrapper for the HTTP module.Werner Koch2015-10-212-78/+21
| | | | | | | | | * dirmngr/t-http.c (main): Init assuan sockets. * dirmngr/http.c: Include dns-stuff.h. (connect_server)[!HAVE_GETADDRINFO]: Remove all code. (connect_server): Change to use resolve_dns_name. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Allow use of http.c if USE_NPTH is not defined.Werner Koch2015-10-211-8/+14
| | | | | | | | | | | | | | | * dirmngr/http.c (send_request): Always set the gnutls pull/push functions. (my_npth_read): Rename to ... (my_gnutls_read) .. this. Use system read if !USE_NPTH. (my_npth_write): Rename to ... (my_gnutls_write) .. this. Use system write if !USE_NPTH. -- This is necessary to run t-http because we once switched to a ref counted object with the socket descriptor. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Check that getaddrinfo is available.Werner Koch2015-10-212-2/+7
| | | | | | | | | | | | | | | | * dirmngr/Makefile.am (t_http_SOURCES): Add dns-stuff.c. (t_ldap_parse_uri_SOURCES): Ditto. * dirmngr/dns-stuff.c: Bail out if neither ADNS nor getaddrinfo is available. -- We used to have replacement code for getaddrinfo and thus check for it in configure. However, this was for the old http and dns-cert code from common/. For dirmngr I made liberal use of getaddrinfo w/o without checking. Just in case someone tries to build on an old platform we now error our with a suitable #error. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add a new OpenPGP card vendor.Werner Koch2015-10-211-0/+1
| | | | --
* Change capitalization of TOR to Tor.Werner Koch2015-10-2111-33/+33
| | | | --
* dirmngr: Use the new DNS wrapper for the HKP engine.Werner Koch2015-10-211-25/+30
| | | | | | | | | | | | * dirmngr/ks-engine-hkp.c (my_getnameinfo): Change arg type to dns_addrinfo_t. (map_host): Replace getaddrinfo by resolve_dns_name. -- Note that we still need to replace getnameinfo so that the PTR lookup is either suppressed or also done via ADNS. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Implement a getaddrinfo wrapper.Werner Koch2015-10-213-49/+310
| | | | | | | | | | | | | | | | | | | * dirmngr/dns-stuff.h: Include some header files. (dns_addinfo_t, dns_addrinfo_s): New. * dirmngr/dns-stuff.c: Always include DNS related headers. (free_dns_addrinfo): New. (resolve_name_standard): New. (resolve_dns_name): New. * dirmngr/t-dns-stuff.c: Include netdb.h. (main): Keep old default mode with no args but else print outout of resolve_dns_name. Revamp option parser. -- This wrapper allows us to switch to ADNS and thus Tor for standard name resultion. Signed-off-by: Werner Koch <[email protected]>
* common: Add more replacement error codes.Werner Koch2015-10-211-0/+3
| | | | | | | | * common/util.h (GPG_ERR_SERVER_FAILED): New. (GPG_ERR_NO_KEY): New. (GPG_ERR_NO_NAME): New. Signed-off-by: Werner Koch <[email protected]>
* gpg: If the saved trust model is unknown, default to tofu+pgp.Neal H. Walfield2015-10-211-2/+2
| | | | | | | | * g10/trustdb.c (init_trustdb): If the saved trust model is unknown, default to tofu+pgp instead of pgp. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Don't accidentally free UTK_LIST.Neal H. Walfield2015-10-211-1/+2
| | | | | | | * g10/trustdb.c (validate_keys): Don't free UTK_LIST. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: When evaluating trust reg exps, treat tofu+pgp like pgp.Neal H. Walfield2015-10-211-2/+4
| | | | | | | | | * g10/trustdb.c (validate_one_keyblock): When checking trust regular expressions, treat the tofu+pgp trust model the same as the pgp trust model. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: If a key is ultimate trusted, return that in the tofu model.Neal H. Walfield2015-10-211-2/+54
| | | | | | | | | | | | * g10/tofu.c (get_trust): If the policy is auto or none, check if the key is ultimately trusted. If so, return that. (tofu_register): If the key is ultimately trusted, don't show any statistics. (tofu_get_validity): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]> Suggested-by: Andre Heinecke <[email protected]>
* gpg: Keep the trust DB up to date for the tofu and tofu+pgp models.Neal H. Walfield2015-10-211-7/+18
| | | | | | | | | | | | | | * g10/trustdb.c (init_trustdb): Recognize tofu and tofu+pgp as possibly saved trust models. Also register the ultimately trusted keys if the trust model is tofu or tofu+pgp. (check_trustdb): Don't skip if the trust model is tofu or tofu+pgp. (update_trustdb): Likewise. (tdb_check_trustdb_stale): Likewise. (validate_keys): If the trust model is TOFU, just write out the ultimately trusted keys. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Factor out code into a standalone function.Neal H. Walfield2015-10-212-7/+16
| | | | | | | | * g10/trustdb.c (tdb_keyid_is_utk): New function. (add_utk): Use it. -- Signed-off-by: Neal H. Walfield <[email protected]>
* dirmngr: Allow building with libassuan < 2.3.Neal H. Walfield2015-10-211-0/+2
| | | | | | | | | * dirmngr/http.c (send_request): Use newer assuan function only if available. -- Signed-off-by: Neal H. Walfield <[email protected]> Regression-due-to: 4e42ad30
* gpg: Make the tofu DB check and initialization atomic.Neal H. Walfield2015-10-211-14/+16
| | | | | | | | | * g10/tofu.c (initdb): Make the version check and the database initialization atomic. -- Signed-off-by: Neal H. Walfield <[email protected]> Co-authored-by: Andre Heinecke <[email protected]>
* build: Make --disable-g13 the default.Werner Koch2015-10-212-2/+2
| | | | | | | | | | | | * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Add --enable-g13. Remove --enable-gpgtar because that is enabled anyway. * configure.ac: Do not build g13 by default. -- The g13 part is not very useful for a standard user right now, thus do not build it. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Rename file dns-cert.c.Werner Koch2015-10-215-15/+22
| | | | | | | | | | * dirmngr/dns-cert.c: Rename to dirmngr/dns-stuff.c. * dirmngr/dns-cert.h: Rename to dirmngr/dns-stuff.h and change includers. * dirmngr/t-dns-cert.c: Rename to dirmngr/t-dns-stuff.c. * dirmngr/Makefile.am: Adjust. Signed-off-by: Werner Koch <[email protected]>
* common: Add status code for use by g13.Werner Koch2015-10-211-0/+2
| | | | * common/status.h (STATUS_PLAINTEXT_FOLLOWS): New.
* dirmngr: Prefer ADNS over system resolver.Werner Koch2015-10-204-55/+86
| | | | | | | | | * configure.ac (HAVE_ADNS_IF_TORMODE): New ac_define. (USE_DNS_CERT): Prefer ADNS over the system resolver. * dirmngr/dns-cert.c (tor_mode): New global var. (enable_dns_tormode): New func. (get_dns_cert): Use DNS resolver at 8.8.8.8 in tor-mode. * dirmngr/server.c (cmd_dns_cert): If supported allow DNS requests.
* w32: Allow building again.Werner Koch2015-10-201-1/+1
| | | | | | * dirmngr/http.c (connect_server): Fix called function name. Signed-off-by: Werner Koch <[email protected]>
* build: Allow building without SQLlite support.Werner Koch2015-10-208-9/+80
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Add option --dsiable-tofu and --disable-sqlite. (NEED_SQLITE_VERSION): New var. (USE_TOFU): New ac_define and am_conditional. * autogen.sh (build-w32): Add PKG_CONFIG_LIBDIR to configure so that pkg-config find the correct .pc file. * g10/Makefile.am (tofu_source): New. Build only if enabled. * g10/gpg.c (parse_trust_model)[!USE_TOFU]: Disable tofu models. (parse_tofu_policy)[!USE_TOFU]: Disable all. (parse_tofu_db_format)[!USE_TOFU]: Disable all. (main) <aTOFUPolicy>[!USE_TOFU]: Skip. * g10/keyedit.c (show_key_with_all_names_colon)[!USE_TOFU]: Do not call tofu functions. * g10/keylist.c (list_keyblock_colon)[!USE_TOFU]: Ditto. * g10/trustdb.c (tdb_get_validity_core)[!USE_TOFU]: Skip tofu processing. -- This allows to build a minimal version of GnuPG. It is also currently required to build for Windows. Signed-off-by: Werner Koch <[email protected]>
* gpg: Don't die immediately if the TOFU DB is locked.Neal H. Walfield2015-10-201-0/+4
| | | | | | | * g10/tofu.c (opendb): Don't die immediately if the DB is locked. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Improve output.Neal H. Walfield2015-10-201-4/+4
| | | | | | | | * g10/tofu.c (get_trust): Also show the binding when indicating a conflict occurred. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Synchronize translation template.Neal H. Walfield2015-10-201-1/+1
| | | | | | | * g10/tofu.c (show_statistics): Synchronize translation template. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: When showing conflicts, also show bindings with no recorded sigs.Neal H. Walfield2015-10-201-20/+34
| | | | | | | | | | * g10/tofu.c (signature_stats_collect_cb): If the time_ago column is NULL, then both time_ago and count should be 0. (get_trust): Reverse the direction of the join so that we also get statistics about bindings without any signatures. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Improve text.Neal H. Walfield2015-10-201-7/+9
| | | | | | | | * g10/tofu.c (show_statistics): Improve text. -- Signed-off-by: Neal H. Walfield <[email protected]> Suggested-by: Malte <[email protected]>
* gpg: Use the right variable to display the information.Neal H. Walfield2015-10-201-3/+4
| | | | | | | | | * g10/tofu.c (get_trust): Use the right variable to display the conflicting key. -- Signed-off-by: Neal H. Walfield <[email protected]> Reported-by: Andre Heinecke <[email protected]>
* gpg: Make failing to create a directory a soft error.Neal H. Walfield2015-10-201-1/+1
| | | | | | | | * g10/tofu.c (getdb): Don't exit if we can't create the directory. Just return an error. -- Signed-off-by: Neal H. Walfield <[email protected]>
* common: Make sure tilde expansion works for the mkdir functions.Neal H. Walfield2015-10-201-1/+1
| | | | | | | | | | | * common/mkdir_p.c (gnupg_amkdir_p): Use make_filename_try on the first directory component as well. -- If there is only a single directory component, then tilde expansion won't be done. Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Remove unused prototype digest_algo_from_sig.Neal H. Walfield2015-10-201-1/+0
| | | | | | | | * g10/packet.h (digest_algo_from_sig): Remove prototype without a corresponding implementation. -- Signed-off-by: Neal H. Walfield <[email protected]>
* dirmngr: Allow building with libassuan < 2.3.Werner Koch2015-10-192-0/+4
| | | | | | | | | | * dirmngr/dirmngr.c (set_tor_mode): Use newer assuan function only if available. * dirmngr/http.c (http_raw_connect): Ditto. -- Frankly we should require that but we can also wait for 2.4.0 and switch then.
* gpg: Fix --desig-revoke.Neal H. Walfield2015-10-193-11/+14
| | | | | | | | | | * g10/revoke.c (gen_desig_revoke): Add additional parameter ctrl. Check that the secret key is available. If not, display an error message. -- Signed-off-by: Neal H. Walfield <[email protected]> Regression-due-to: 8459bcf9