aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Fix keyring support.Neal H. Walfield2015-10-291-1/+2
| | | | | | | | | * g10/keydb.c (keydb_rebuild_caches): Only mark the cached as prepared if it is actually prepared, which it only is if the resource is a keybox. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Change sqlite3_stepx to pass the sqlite3_stmt * to the callback.Neal H. Walfield2015-10-293-10/+58
| | | | | | | | | | | * g10/sqlite.h (enum sqlite_arg_type): Add SQLITE_ARG_BLOB. (sqlite3_stepx_callback): New declaration. (sqlite3_stepx): Change the callback's type to sqlite3_stepx_callback, which passes an additional parameter, the sqlite3_stmt *. Update users. -- Signed-off-by: Neal H. Walfield <[email protected]>
* gpg: Move sqlite helper functions into their own file.Neal H. Walfield2015-10-294-224/+293
| | | | | | | | | | | | | | * g10/tofu.c (sqlite3_exec_printf): Move from here... * g10/sqlite.c (sqlite3_exec_printf): ... to this new file. Don't mark as static. * g10/tofu.c (sqlite3_stepx): Move from here... * g10/sqlite.c (sqlite3_stepx): ... to this new file. Don't mark as static. * g10/tofu.c (enum sqlite_arg_type): Move from here... * g10/sqlite.h (enum sqlite_arg_type): ... to this new file. -- Signed-off-by: Neal H. Walfield <[email protected]>
* doc: Don't install gpg-zip.1.NIIBE Yutaka2015-10-291-2/+2
| | | | | | | | | | | * doc/Makefile.am (myman_pages): Remove gpg-zip.1. (DISTCLEANFILES): Add gpg-zip.1. -- Thanks to Thomas Klausner. GnuPG-bug-id: 2095
* sm: Allow combination of usage flags --gen-key.Werner Koch2015-10-281-31/+46
| | | | | | | | | * sm/certreqgen.c (create_request): Re-implement building of the key-usage extension. -- GnuPG-bug-id: 2029 Signed-off-by: Werner Koch <[email protected]>
* doc: Document some changed default options.Damien Goutte-Gattat2015-10-281-4/+4
| | | | | | | * doc/gpg.texi: Update the description of some options which are now enabled by default. Signed-off-by: Damien Goutte-Gattat <[email protected]>
* dirmngr: Fix NULL-deref while loading a CRL.Werner Koch2015-10-281-1/+2
| | | | | | | | | * dirmngr/crlcache.c (crl_parse_insert): Set error before leaping to failure. -- GnuPG-bug-id: 2082 Signed-off-by: Werner Koch <[email protected]>
* Fix typosDaniel Kahn Gillmor2015-10-286-6/+6
| | | | --
* agent: Clarify agent's KEYWRAP_KEY description.Daniel Kahn Gillmor2015-10-281-1/+1
| | | | | | -- Signed-Off-By: Daniel Kahn Gillmor <[email protected]>
* dirmngr: Minor cleanup of the SRV RR code.Werner Koch2015-10-282-9/+16
| | | | | | | * dirmngr/dns-stuff.c: Include unistd.h. (getsrv): Run srand only once. * dirmngr/t-dns-stuff.c (main): Allow passing another name for --srv and change output format.
* dirmngr: Add a getaddrinfo wrapper backend using ADNS.Werner Koch2015-10-281-51/+143
| | | | | | | | | * dirmngr/dns-stuff.c: Replace all use of default_errsource. (my_adns_init): Move to top. (resolve_name_adns): New. (resolve_dns_name) [USE_ADNS]: Divert to new func. Signed-off-by: Werner Koch <[email protected]>
* gpg: Do not call an extra get_validity if no-show-uid-validity is used.Werner Koch2015-10-261-6/+25
| | | | | | | * g10/mainproc.c (check_sig_and_print): Do not call the informational get_validity if we are not going to use it. Signed-off-by: Werner Koch <[email protected]>
* gpg: Ensure all weak digest rejection notices are shownDaniel Kahn Gillmor2015-10-266-37/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/main.h: Add rejection_shown flag to each weakhash struct * g10/misc.c (print_digest_algo_note, additional_weak_digest): Do not treat MD5 separately; (print_digest_rejected_note): Use weakhash.rejection_shown instead of static shown. * g10/options.h (opt): Change from additional_weak_digests to weak_digests. * g10/sig-check.c: Do not treat MD5 separately. * g10/gpg.c (main): Explicitly set MD5 as weak. * g10/gpgv.c (main): Explicitly set MD5 as weak. -- Previously, only one weak digest rejection message was shown, of whichever was the first type encountered. This meant that if "gpg --weak-digest SHA224" encountered both an MD5 digest and a SHA224 digest, it would only show the user that the MD5 digest was rejected. In order to let the user know which algorithms were rejected, we needed to move the "shown" flag into a per-weak-algorithm location. Given this additional complication, it made no sense to continue to treat MD5 specially, so it is added as a default weak algorithm in the same opt.weak_digests data structure as any other. Signed-Off-By: Daniel Kahn Gillmor <[email protected]>
* 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.