summaryrefslogtreecommitdiffstats
path: root/g10/tdbio.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Prepare for a new export option export-realclean.Werner Koch2024-03-041-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/options.h (EXPORT_REALCLEAN): New. Also re-assign other values to keep them more in sync with the corresponding import values. * g10/export.c (parse_export_options): Add "export-realclean". (do_export_stream): Call clean_all_uids directly with the options arg. * g10/import.c (import_one_real): Change for direct use of options in clean_all_uids. * g10/key-clean.c (is_trusted_key_sig): New. Stub for now. (clean_sigs_from_uid): Re-purpose self_only to a general options arg. Implement EXPORT_REALCLEAN code path. (clean_one_uid): Re-purpose self_only to a general options arg. (clean_all_uids): Ditto. * g10/keyedit.c (keyedit_menu): Use EXPORT_MINIMAL instead of a simple flag. (menu_clean): Re-purpose self_only to a general options arg. * g10/keyid.c (fpr20_from_pk): Factor code out to .... (fpr20_from_fpr): new. Remove useless case for ARRAY being NULL. * g10/tdbio.c (tdbio_search_trust_byfpr): Add arg fprlen and use fpr20_from_fpr if needed. (tdbio_search_trust_bypk): Pass 20 for the fingerprint length. -- Note that this code has no function yet. Another patch will follow to extract the trusted-keys flag from the trustdb.
* gpg,common,scd,sm: Function prototype fixes for modern compiler.NIIBE Yutaka2022-09-131-6/+6
| | | | | | | | | | | | | | | | | | | | | | * common/gettime.c (gnupg_get_time): It has no arguments. * common/signal.c (gnupg_block_all_signals): Likewise. (gnupg_unblock_all_signals): Likewise. * common/utf8conv.c (get_native_charset): Likewise. * g10/cpr.c (is_status_enabled, cpr_enabled): Likewise. * g10/getkey.c (getkey_disable_caches): Likewise. * g10/keygen.c (ask_expiredate): Likewise. * g10/passphrase.c (have_static_passphrase): Likewise. (get_last_passphrase): Likewise. * g10/tdbio.c (tdbio_is_dirty, tdbio_sync): Likewise. (tdbio_get_dbname, open_db, tdbio_db_matches_options): Likewise. (tdbio_read_nextcheck): Likewise. * g10/trustdb.c (how_to_fix_the_trustdb): Likewise. * scd/scdaemon.c (scd_get_socket_name): Likewise. * sm/passphrase.c (have_static_passphrase): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Remove remaining support for WindowsCEWerner Koch2022-06-031-31/+1
| | | | --
* gpg: Remove stale ultimately trusted keys from the trustdb.Werner Koch2021-11-131-6/+9
| | | | | | | | | | | | | | | | * g10/tdbdump.c (export_ownertrust): Skip records marked with the option --trusted-key. (import_ownertrust): Clear the trusted-key flag. * g10/tdbio.h (struct trust_record): Add field flags. * g10/tdbio.c (tdbio_dump_record): Improve output. (tdbio_read_record, tdbio_write_record): Handle flags. * g10/trustdb.c (verify_own_keys): Clear stale trusted-keys and set the flag for new --trusted-keys. (tdb_update_ownertrust): Add arg as_trusted_key. Update callers. -- GnuPG-bug-id: 5685 Signed-off-by: Werner Koch <wk@gnupg.org>
* Replace all calls to stat by gnupg_stat.Werner Koch2020-10-201-2/+2
| | | | | | | | | | | * common/sysutils.c (gnupg_stat): New. * common/sysutils.h: Include sys/stat.h. -- Yet another wrapper for Unicode support on Windows. GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <wk@gnupg.org>
* Replace most calls to open by a new wrapper.Werner Koch2020-10-201-3/+3
| | | | | | | | | | | | * common/sysutils.c (any8bitchar) [W32]: New. (gnupg_open): New. Replace most calls to open by this. * common/iobuf.c (any8bitchar) [W32]: New. (direct_open) [W32]: Use CreateFileW if needed. -- This is yet another step for full Unicode support on Windows. GnuPG-bug-id: 5098
* Replace most of the remaining stdio calls by estream calls.Werner Koch2020-10-201-3/+3
| | | | | | | | | | | | -- We need to use es_fopen on Windows to cope with non-ascii file names. This is quite a large but fortunately straightforward change. At a very few places we keep using stdio (for example due to the use of popen). GnuPG-bug-id: 5098 Signed-off-by: Werner Koch <wk@gnupg.org>
* Replace all calls to access by gnupg_accessWerner Koch2020-10-201-3/+5
| | | | | | | | | | | | | | | | * common/sysutils.c (gnupg_access): New. Replace all calls to access by this wrapper. * common/homedir.c (w32_shgetfolderpath): Change to return UTF-8 directory name. (standard_homedir): Adjust for change. (w32_commondir, gnupg_cachedir): Ditto. -- Also use SHGetFolderPathW instead of SHGetFolderPathA on Windows. This is required to correctly handle non-ascii filenames on Windows. GnuPG-bug-id: 5098
* gpg: Fix trustdb for v5key.NIIBE Yutaka2020-08-071-5/+2
| | | | | | | | | | | | | | | | | | | | | | | * g10/keydb.h (fpr20_from_pk): New. * g10/keyid.c (fpr20_from_pk): New. * g10/tdbio.c (tdbio_search_trust_byfpr): Use fpr20_from_pk. * g10/trustdb.c (keyid_from_fpr20): New. (verify_own_keys): Use keyid_from_fpr20. (tdb_update_ownertrust): Use fpr20_from_pk. (update_min_ownertrust): Likewise. (update_validity): Likewise. -- For the compatibility of existing implementation, we keep the format of trustdb untouched. The format of trustdb uses 20-byte fingerprint for the trust record entry. To handle both of v4key (with 20-byte fingerprint) and v5 key (with 32-byte fingerprint), we introduce FPR20 fingerprint, internally. For v4key, FPR20 is as same as v4 fingerprint. For v5key, FPR20 is constructed from v5key fingerprint. GnuPG-bug-id: 5000 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Spelling cleanup.Daniel Kahn Gillmor2020-02-191-1/+1
| | | | | | | | | | | | | | | | No functional changes, just fixing minor spelling issues. --- Most of these were identified from the command line by running: codespell \ --ignore-words-list fpr,stati,keyserver,keyservers,asign,cas,iff,ifset \ --skip '*.po,ChangeLog*,help.*.txt,*.jpg,*.eps,*.pdf,*.png,*.gpg,*.asc' \ doc g13 g10 kbx agent artwork scd tests tools am common dirmngr sm \ NEWS README README.maint TODO Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* all: fix spelling and typosDaniel Kahn Gillmor2018-10-241-3/+3
| | | | Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* gpg: Don't take the a TOFU trust model from the trustdb,Werner Koch2018-10-101-4/+25
| | | | | | | | | | | | | | | | * g10/tdbio.c (tdbio_update_version_record): Never store a TOFU model. (create_version_record): Don't init as TOFU. (tdbio_db_matches_options): Don't indicate a change in case TOFU is stored in an old trustdb file. -- This change allows to switch between a tofu and pgp or tofu+pgp trust model without an auto rebuild of the trustdb. This also requires that the tofu trust model is requested on the command line. If TOFU will ever be the default we need to tweak the model detection via TM_AUTO by also looking into the TOFU data base, GnuPG-bug-id: 4134
* gpg: Auto-fix a broken trustdb with just the version record.Werner Koch2018-03-261-0/+14
| | | | | | | * g10/tdbio.c (get_trusthashrec): Create hashtable on error. GnuPG-bug-id: 3839 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Pass CTRL arg to get_trusthashrec.Werner Koch2018-03-261-7/+9
| | | | | | | | * g10/tdbio.c (get_trusthashrec): Add arg CTRL. (tdbio_search_trust_byfpr): Ditto. (tdbio_search_trust_bypk): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Return better error codes in case of a too short trustdb.Werner Koch2018-03-261-15/+16
| | | | | | | | | | | | | * g10/tdbio.c (tdbio_read_record): Return GPG_ERR_EOF. (tdbio_new_recnum): Never return on error. (lookup_hashtable): Print a more descriptive error in case of !TABLE. -- Also: tdbio_new_recnum had a bug in that it returned an error code and not a record number in the error case. The function is expected to always return a valid new record number. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Fix trustdb updates without lock held.Werner Koch2018-03-261-10/+29
| | | | | | | | | | | | | | | | | | | | | | | * g10/tdbio.c (is_locked): Turn into a counter. (take_write_lock, release_write_lock): Implement recursive locks. -- On trustdb creation we have this call sequence: init_trustdb -> takes lock tdbio_set_dbname create_version_record tdbio_write_record put_record_into_cache -> takes lock put_record_into_cache -> releases lock init_trustdb -> releases lock The second take lock does noting but the first release lock has already released the lock and the second release lock is a thus a NOP. This is likely the cause for the corrupted trustdb as reported in GnuPG-bug-id: 3839 Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Disable unused code parts in tdbio.cWerner Koch2018-03-261-3/+7
| | | | | | | | * g10/tdbio.c (in_transaction): Comment this var. (put_record_into_cache): Comment the transaction code. (tdbio_sync): Ditto Signed-off-by: Werner Koch <wk@gnupg.org>
* Spelling fixes in docs and comments.NIIBE Yutaka2017-04-281-1/+1
| | | | | | | | | | -- In addition, fix trailing spaces in tests/inittests. GnuPG-bug-id: 3121 Reported-by: ka7 (klemens) Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Pass CTRL to many more functions.Werner Koch2017-03-311-37/+39
| | | | | | | | | | -- For proper operations as a server we need to avoid global variables. Thus we need to pass the session state CTRL to most functions. Quite a lot of changes but fortunately straightforward to do. Signed-off-by: Werner Koch <wk@gnupg.org>
* Remove -I option to common.NIIBE Yutaka2017-03-071-4/+4
| | | | | | | | | | | | | * 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 <gniibe@fsij.org>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* g10: Fix opening of trust database.Justus Winter2016-08-101-2/+2
| | | | | | | | | | | | * g10/tdbio.c (tdbio_set_dbname): This function explicitly checks for the file size, but handled the case of a zero-sized file incorrectly by returning success. Fix this by initializing the database in that case. * tests/openpgp/Makefile.am (XTESTS): Add new test. * tests/openpgp/issue2417.scm: New file. GnuPG-bug-id: 2417 Signed-off-by: Justus Winter <justus@g10code.com>
* g10: Fix another race condition for trustdb access.Niibe Yutaka2016-06-151-2/+6
| | | | | | | | | | | | | * g10/tdbio.c (create_version_record): Call create_hashtable to always make hashtable, together with the version record. (get_trusthashrec): Remove call to create_hashtable. -- GnuPG-bug-id: 1675 Thanks to Scott Moser for a reproducible script and patience. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Replace use of opt.homedir by accessor functions.Werner Koch2016-06-071-2/+3
| | | | | | | | | | | | | | | | | | | * common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Remove all assert.h and s/assert/log_assert/.Werner Koch2016-04-291-7/+6
| | | | Signed-off-by: Werner Koch <wk@gnupg.org>
* g10: Make sure to have the directory for trustdb.NIIBE Yutaka2016-02-121-56/+62
| | | | | | | | | | | | | * g10/tdbio.c (tdbio_set_dbname): Return earlier if !CREATE. Check the directory and create it if none before calling take_write_lock. -- Thanks to Marc Deslauriers for the bug report and his patch. GnuPG-bug-id: 2246 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* gpg: Fix warnings about useless assignments.Werner Koch2016-01-071-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | * g10/armor.c (parse_hash_header): Remove duplicate var assignment. * g10/getkey.c (cache_user_id): Ditto. * g10/keygen.c (ask_curve): Ditto. This also fixes a small memory leak. * g10/keygen.c (proc_parameter_file): Remove useless assignment or pointer increment. (generate_keypair): Ditto. * g10/getkey.c (finish_lookup, lookup): Ditto. * g10/card-util.c (change_pin): Ditto. * g10/gpg.c (main) <aVerify>: Ditto. * g10/import.c (import): Ditto. (print_import_check): Ditto * g10/keyring.c (do_copy): Ditto. * g10/tdbio.c (tdbio_read_record): Ditto. * g10/trustdb.c (tdb_update_ownertrust): Ditto. (update_validity): Ditto. * g10/server.c (cmd_passwd): Remove useless call to skip_options. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* Fix typos found using codespell.Justus Winter2015-11-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c: Fix typos. * agent/call-pinentry.c: Likewise. * agent/call-scd.c: Likewise. * agent/command-ssh.c: Likewise. * agent/command.c: Likewise. * agent/divert-scd.c: Likewise. * agent/findkey.c: Likewise. * agent/gpg-agent.c: Likewise. * agent/w32main.c: Likewise. * common/argparse.c: Likewise. * common/audit.c: Likewise. * common/audit.h: Likewise. * common/convert.c: Likewise. * common/dotlock.c: Likewise. * common/exechelp-posix.c: Likewise. * common/exechelp-w32.c: Likewise. * common/exechelp-w32ce.c: Likewise. * common/exechelp.h: Likewise. * common/helpfile.c: Likewise. * common/i18n.h: Likewise. * common/iobuf.c: Likewise. * common/iobuf.h: Likewise. * common/localename.c: Likewise. * common/logging.c: Likewise. * common/openpgp-oid.c: Likewise. * common/session-env.c: Likewise. * common/sexputil.c: Likewise. * common/sysutils.c: Likewise. * common/t-sexputil.c: Likewise. * common/ttyio.c: Likewise. * common/util.h: Likewise. * dirmngr/cdblib.c: Likewise. * dirmngr/certcache.c: Likewise. * dirmngr/crlcache.c: Likewise. * dirmngr/dirmngr-client.c: Likewise. * dirmngr/dirmngr.c: Likewise. * dirmngr/dirmngr_ldap.c: Likewise. * dirmngr/dns-stuff.c: Likewise. * dirmngr/http.c: Likewise. * dirmngr/ks-engine-hkp.c: Likewise. * dirmngr/ks-engine-ldap.c: Likewise. * dirmngr/ldap-wrapper.c: Likewise. * dirmngr/ldap.c: Likewise. * dirmngr/misc.c: Likewise. * dirmngr/ocsp.c: Likewise. * dirmngr/validate.c: Likewise. * g10/encrypt.c: Likewise. * g10/getkey.c: Likewise. * g10/gpg.c: Likewise. * g10/gpgv.c: Likewise. * g10/import.c: Likewise. * g10/keydb.c: Likewise. * g10/keydb.h: Likewise. * g10/keygen.c: Likewise. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/keyring.c: Likewise. * g10/mainproc.c: Likewise. * g10/misc.c: Likewise. * g10/options.h: Likewise. * g10/packet.h: Likewise. * g10/parse-packet.c: Likewise. * g10/pkclist.c: Likewise. * g10/pkglue.c: Likewise. * g10/plaintext.c: Likewise. * g10/server.c: Likewise. * g10/sig-check.c: Likewise. * g10/sqlite.c: Likewise. * g10/tdbio.c: Likewise. * g10/test-stubs.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. * g13/create.c: Likewise. * g13/mountinfo.c: Likewise. * kbx/keybox-blob.c: Likewise. * kbx/keybox-file.c: Likewise. * kbx/keybox-init.c: Likewise. * kbx/keybox-search-desc.h: Likewise. * kbx/keybox-search.c: Likewise. * kbx/keybox-update.c: Likewise. * scd/apdu.c: Likewise. * scd/app-openpgp.c: Likewise. * scd/app-p15.c: Likewise. * scd/app.c: Likewise. * scd/ccid-driver.c: Likewise. * scd/command.c: Likewise. * scd/iso7816.c: Likewise. * sm/base64.c: Likewise. * sm/call-agent.c: Likewise. * sm/call-dirmngr.c: Likewise. * sm/certchain.c: Likewise. * sm/gpgsm.c: Likewise. * sm/import.c: Likewise. * sm/keydb.c: Likewise. * sm/minip12.c: Likewise. * sm/qualified.c: Likewise. * sm/server.c: Likewise. * tools/gpg-check-pattern.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgkey2ssh.c: Likewise. * tools/gpgparsemail.c: Likewise. * tools/gpgtar.c: Likewise. * tools/rfc822parse.c: Likewise. * tools/symcryptrun.c: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* gpg: Mark local function as static.Neal H. Walfield2015-10-191-1/+1
| | | | | | | * g10/tdbio.c (put_record_into_cache): Mark as static. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
* gpg: Replace -1 by GPG_ERR_NOT_FOUND in tdbio.cWerner Koch2015-06-041-12/+9
| | | | | | | | | | | | * g10/tdbio.c (lookup_hashtable): Return GPG_ERR_NOT_FOUND. * g10/tdbdump.c (import_ownertrust): Test for GPG_ERR_NOT_FOUND. * g10/trustdb.c (read_trust_record): Ditto. (tdb_get_ownertrust, tdb_get_min_ownertrust): Ditto. (tdb_update_ownertrust, update_min_ownertrust): Ditto. (tdb_clear_ownertrusts, update_validity): Ditto. (tdb_cache_disabled_value): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Cleanup error code path in case of a bad trustdb.Werner Koch2015-06-041-26/+28
| | | | | | | | | | * g10/tdbio.c (tdbio_read_record): Fix returning of the error. -- Actually the returned error will anyway be GPG_ERR_TRUSTDB but the old code was not correct. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Fix output in case of a corrupted trustdb.Werner Koch2015-06-041-1/+2
| | | | | | | | | * g10/tdbdump.c (list_trustdb): Add arg FP and change callers to pass es_stdout. * g10/tdbio.c (upd_hashtable): On a corrupted trustdb call list_trustdb only in verbose > 1 mode and let it dump to stderr. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Re-indent and improve documentation of g10/tdbio.cWerner Koch2015-06-041-962/+1264
| | | | --
* g10: Fix a race condition initially creating trustdb.NIIBE Yutaka2015-05-281-65/+56
| | | | | | | | | | | | * g10/tdbio.c (take_write_lock, release_write_lock): New. (put_record_into_cache, tdbio_sync, tdbio_end_transaction): Use new lock functions. (tdbio_set_dbname): Fix the race. (open_db): Don't call dotlock_create. -- GnuPG-bug-id: 1675
* g10: Remove g10/signal.c.NIIBE Yutaka2015-05-271-2/+2
| | | | | | | | | | | * g10/signal.c: Remove. * g10/main.h: Remove old function API. * g10/tdbio.c: Use new API, even in the dead code. -- We use common/signal.c now. The file g10/signal.c has been useless since 2003-06-27. Now, the removal.
* gpg: Replace remaining uses of stdio by estream.Werner Koch2015-02-191-31/+34
| | | | | | | | | | | | | | | | | | | | | | | * g10/sign.c (sign_file): Use log_printf instead of stderr. * g10/tdbdump.c (export_ownertrust): Use estream fucntions. (import_ownertrust): Ditto. * g10/tdbio.c (tdbio_dump_record): Ditto. Change arg to estream_t. -- Reported-by: Guilhem Moulin <guilhem@fripost.org> Needed for unattended key edits with --status-fd, because since 2.1 status prompts are preceded by es_fflush (in cpr.c:do_get_from_fd) not fflush(3), so the standard output may not be flushed before each prompt. (Which breaks scripts using select(2) to multiplex between the standard and status outputs.) His patch only affected print_and_check_one_sig_colon() but there are many more places where stdio and estream are mixed. This patch now replaces most of them in g10/. At some places stdio is still used, but that is local to a function and should not have side effects. Signed-off-by: Werner Koch <wk@gnupg.org>
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-111-10/+10
| | | | | | | | | | | | | | | * common/host2net.h (buf16_to_ulong, buf16_to_uint): New. (buf16_to_ushort, buf16_to_u16): New. (buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New. -- Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to avoid all sign extension on shift problems. Hanno Böck found a case with an invalid read due to this problem. To fix that once and for all almost all uses of "<< 24" and "<< 8" are changed by this patch to use an inline function from host2net.h. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Replace remaining old error code macros by GPG_ERR_.Werner Koch2015-01-221-52/+54
| | | | | | | | | * g10/gpg.h (g10_errstr): Remove macro and change all occurrences by gpg_strerror. (G10ERR_): Remove all macros and change all occurrences by their GPG_ERR_ counterparts. Signed-off-by: Werner Koch <wk@gnupg.org>
* Use a unique capitalization for "Note:".Werner Koch2014-10-101-1/+1
| | | | --
* Silence more warnings about unused vars and args.Werner Koch2014-03-071-1/+1
| | | | | | | | | | | | | * dirmngr/cdblib.c (cdb_init) [W32]: Remove unused var. * dirmngr/dirmngr-client.c (start_dirmngr): s/int/assuan_fd_t/. * dirmngr/dirmngr.c (w32_service_control): Mark unused args. (call_real_main): New. (main) [W32]: Use new function to match prototype. (real_main) [W32]: Mark unused vars. (handle_signal) [W32]: Do not build the function at all. (handle_connections) [W32]: Do not define signo. * dirmngr/ldap-wrapper-ce.c (outstream_reader_cb): Remove used vars. * g10/tdbio.c (ftruncate) [DOSISH]: Define only if not yet defined.
* gpg: Do not require a trustdb with --always-trust.Werner Koch2014-03-071-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/tdbio.c (tdbio_set_dbname): Add arg R_NOFILE. * g10/trustdb.c (trustdb_args): Add field no_trustdb. (init_trustdb): Set that field. (revalidation_mark): Take care of a nonexistent trustdb file. (read_trust_options): Ditto. (tdb_get_ownertrust): Ditto. (tdb_get_min_ownertrust): Ditto. (tdb_update_ownertrust): Ditto. (update_min_ownertrust): Ditto. (tdb_clear_ownertrusts): Ditto. (tdb_cache_disabled_value): Ditto. (tdb_check_trustdb_stale): Ditto. (tdb_get_validity_core): Ditto. * g10/gpg.c (main): Do not create a trustdb with most commands for trust-model always. -- This slightly changes the semantics of most commands in that they won't create a trustdb if --trust-model=always is used. It just does not make sense to create a trustdb if there is no need for it. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 1a0eeaacd1bf09fe5125dbc3f56016bc20f3512e) Resolved conflicts: NEWS g10/trustdb.c: Manually apply changes due to changed function names. Note that this also includes the fix for clear_ownertrust, see GnuPG-bug-id: 1622.
* Make use of the *_NAME etc macros.Werner Koch2013-11-181-3/+3
| | | | | | | | | Replace hardwired strings at many places with new macros from config.h and use the new strusage macro replacement feature. * common/asshelp.c (lock_spawning) [W32]: Change the names of the spawn sentinels. * agent/command.c (cmd_import_key): Use asprintf to create the prompt.
* Change all quotes in strings and comments to the new GNU standard.Werner Koch2012-06-051-10/+10
| | | | | | | | | | | | | | | | | | | The asymmetric quotes used by GNU in the past (`...') don't render nicely on modern systems. We now use two \x27 characters ('...'). The proper solution would be to use the correct Unicode symmetric quotes here. However this has the disadvantage that the system requires Unicode support. We don't want that today. If Unicode is available a generated po file can be used to output proper quotes. A simple sed script like the one used for en@quote is sufficient to change them. The changes have been done by applying sed -i "s/\`\([^'\`]*\)'/'\1'/g" to most files and fixing obvious problems by hand. The msgid strings in the po files were fixed with a similar command.
* Changes to --min-cert-level should cause a trustdb rebuild (issue 1366)David Shaw2012-01-201-6/+12
| | | | | | | | | | | | | | | | * g10/gpgv.c, g10/trustdb.c (read_trust_options): Add min_cert_level * g10/trustdb.c (check_trustdb_stale): Request a rebuild if pending_check_trustdb is true (set when we detect a trustdb parameter has changed). * g10/keylist.c (public_key_list): Use 'l' in the "tru" with-colons listing for min_cert_level not matching. * g10/tdbio.c (tdbio_update_version_record, create_version_record, tdbio_db_matches_options, tdbio_dump_record, tdbio_read_record, tdbio_write_record): Add a byte for min_cert_level in the tdbio version record.
* Add a flag parameter to dotlock_create.Werner Koch2011-09-281-3/+3
| | | | This allows us to extend this function in the future.
* Renamed the lock functions.Werner Koch2011-09-231-12/+12
| | | | Also cleaned up the dotlock code for easier readability.
* Do not print read-only trustdb warning with --quiet.Werner Koch2011-07-291-1/+1
| | | | | This is only a warning and gpg would anyway print an error message if it tries to write to the trustdb.
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-4/+3
| | | | | | | | We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
* Change last change. Does now work.Werner Koch2010-12-091-3/+18
|
* Change dirmngr timer under W32CE.Werner Koch2010-12-091-0/+17
| | | | | Fix trustdb open problem under W32CE.