aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* dirmngr: Improve concurrency in the non-adns case.Werner Koch2016-11-102-35/+60
| | | | | | | | * dirmngr/dns-stuff.c (map_adns_status_to_gpg_error): New. (resolve_name_adns, get_dns_cert, get_dns_cname): Use that function. (getsrv) [!USE_ADNS]: Call res_query outside of nPth. Signed-off-by: Werner Koch <[email protected]>
* tests: Fix environment setup.Justus Winter2016-11-081-2/+1
| | | | | | | | | * tests/openpgp/defs.scm (setup-legacy-environment): Do not call 'setup-environment' because that will start the agent, and hence register the atexit function twice. Fixes: a55393cb5f4b331cb3a715c7d9a8b91f7606f337 Signed-off-by: Justus Winter <[email protected]>
* tests: Log and display output from tests when run in parallel.Justus Winter2016-11-081-11/+22
| | | | | | | | | | | | | | * tests/openpgp/run-tests.scm (test): Add field 'logfd'. (test::new, test::set-*): Adapt accordingly. (test::set-logfd): New function. (test::open-log-file): Likewise. (test::run-sync): Use the new function. (test::run-async): Likewise. (test::report): Replay the log. (run-tests-parallel): Reverse the results to restore the original order. Signed-off-by: Justus Winter <[email protected]>
* tests: Simplify test.Justus Winter2016-11-081-18/+6
| | | | | | * tests/openpgp/issue2417.scm: Simplify. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Expose seek and associated constants.Justus Winter2016-11-082-0/+27
| | | | | | | | * tests/gpgscm/ffi.c (do_seek): New function. (ffi_init): Expose 'seek' and 'SEEK_{SET,CUR,END}'. * tests/gpgscm/lib.scm: Document the new function. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Fix error message.Justus Winter2016-11-081-18/+21
| | | | | | | * tests/gpgscm/ffi.c (do_wait_processes): Fix and improve error messages. Signed-off-by: Justus Winter <[email protected]>
* tests,w32: Make cleanup more robust.Justus Winter2016-11-081-2/+4
| | | | | | | | | * tests/openpgp/run-tests.scm (run-tests-parallel): Catch errors when removing the working directory. On Windows this can fail if there is still a process using one of the files there. (run-tests-sequential): Likewise. Signed-off-by: Justus Winter <[email protected]>
* common,w32: Simplify locking.Justus Winter2016-11-081-49/+0
| | | | | | | | * common/asshelp.c (lock_spawning): Use the same code on Windows that we use on all other platforms. (unlock_spawning): Likewise. Signed-off-by: Justus Winter <[email protected]>
* tests: Write a log file for each test.Justus Winter2016-11-072-11/+13
| | | | | | | * tests/openpgp/Makefile.am (CLEANFILES): Delete logs. * tests/openpgp/run-tests.scm (test::run-sync): Write logs. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Generalize splice to write to multiple sinks.Justus Winter2016-11-072-7/+42
| | | | | | | | * tests/gpgscm/ffi.c (ordinal_suffix): New function. (do_splice): Generalize splice to write to multiple sinks. * tests/gpgscm/lib.scm (splice): Document this fact. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Drop 'len' argument from splice.Justus Winter2016-11-072-11/+5
| | | | | | | * tests/gpgscm/ffi.c (do_splice): Drop 'len' argument, no-one uses it. * tests/gpgscm/lib.scm (splice): Document foreign function. Signed-off-by: Justus Winter <[email protected]>
* tests: Move environment creation and teardown into each test.Justus Winter2016-11-0750-168/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/gpgscm/tests.scm (log): New function. * tests/openpgp/run-tests.scm (run-tests-parallel): Do not run the startup and teardown scripts. (run-tests-sequential): Likewise. * tests/openpgp/setup.scm: Move all functions... * tests/openpgp/defs.scm: ... here and make them less verbose. (setup-environment): New function. (setup-legacy-environment): Likewise. (start-agent): Make less verbose, run 'stop-agent' at interpreter exit. (stop-agent): Make less verbose. * tests/openpgp/finish.scm: Drop file. * tests/openpgp/Makefile.am (EXTRA_DIST): Drop removed file. * tests/openpgp/4gb-packet.scm: Use 'setup-environment' or 'setup-legacy-environment' as appropriate. * tests/openpgp/armdetach.scm: Likewise. * tests/openpgp/armdetachm.scm: Likewise. * tests/openpgp/armencrypt.scm: Likewise. * tests/openpgp/armencryptp.scm: Likewise. * tests/openpgp/armor.scm: Likewise. * tests/openpgp/armsignencrypt.scm: Likewise. * tests/openpgp/armsigs.scm: Likewise. * tests/openpgp/clearsig.scm: Likewise. * tests/openpgp/conventional-mdc.scm: Likewise. * tests/openpgp/conventional.scm: Likewise. * tests/openpgp/decrypt-dsa.scm: Likewise. * tests/openpgp/decrypt.scm: Likewise. * tests/openpgp/default-key.scm: Likewise. * tests/openpgp/detach.scm: Likewise. * tests/openpgp/detachm.scm: Likewise. * tests/openpgp/ecc.scm: Likewise. * tests/openpgp/encrypt-dsa.scm: Likewise. * tests/openpgp/encrypt.scm: Likewise. * tests/openpgp/encryptp.scm: Likewise. * tests/openpgp/export.scm: Likewise. * tests/openpgp/finish.scm: Likewise. * tests/openpgp/genkey1024.scm: Likewise. * tests/openpgp/gpgtar.scm: Likewise. * tests/openpgp/gpgv-forged-keyring.scm: Likewise. * tests/openpgp/import.scm: Likewise. * tests/openpgp/issue2015.scm: Likewise. * tests/openpgp/issue2417.scm: Likewise. * tests/openpgp/issue2419.scm: Likewise. * tests/openpgp/key-selection.scm: Likewise. * tests/openpgp/mds.scm: Likewise. * tests/openpgp/multisig.scm: Likewise. * tests/openpgp/quick-key-manipulation.scm: Likewise. * tests/openpgp/seat.scm: Likewise. * tests/openpgp/shell.scm: Likewise. * tests/openpgp/signencrypt-dsa.scm: Likewise. * tests/openpgp/signencrypt.scm: Likewise. * tests/openpgp/sigs-dsa.scm: Likewise. * tests/openpgp/sigs.scm: Likewise. * tests/openpgp/ssh.scm: Likewise. * tests/openpgp/tofu.scm: Likewise. * tests/openpgp/use-exact-key.scm: Likewise. * tests/openpgp/verify.scm: Likewise. * tests/openpgp/version.scm: Likewise. * tests/openpgp/issue2346.scm: Likewise and simplify. -- The previous Bourne Shell-based test suite created the environment before running all tests, and tore it down after executing them. When we created the Scheme-based test suite, we kept this design at first, but introduced a way to run each test in its own environment to prevent tests from interfering with each other. Nevertheless, every test started out with the same environment. Move the creation of the test environment into each test. This gives us finer control over the environment each test is run in. It also makes it possible to run each test by simply executing it using gpgscm without the use of the runner. Furthermore, it has the neat side-effect of speeding up the test suite if run in parallel. Signed-off-by: Justus Winter <[email protected]>
* tests: Do not allow tests to be run in a shared environment.Justus Winter2016-11-072-38/+9
| | | | | | | | | | | * tests/openpgp/README: Update. * tests/openpgp/run-tests.scm (run-tests-parallel-shared): Drop function. (run-tests-parallel-isolated): Rename to 'run-tests-parallel'. (run-tests-sequential-shared): Drop function. (run-tests-sequential-isolated): Rename to 'run-tests-sequential'. Signed-off-by: Justus Winter <[email protected]>
* tests: Fix build.Justus Winter2016-11-071-1/+0
| | | | | | | * tests/openpgp/Makefile.am: Drop dependency on 'mk-tdata'. Fixes: 70215ff470c82d144e872057dfa5a478cc9195f2 Signed-off-by: Justus Winter <[email protected]>
* wks: Encrypt all client mails also the target key,Werner Koch2016-11-071-14/+32
| | | | | | | | | | | | | * tools/gpg-wks-client.c (encrypt_response): Add arg FINGERPRINT. (send_confirmation_response): Ditto. (process_confirmation_request): Parse out fingerprint and pass send_confirmation_response. -- This is useful for debugging the protocol and to avoid surprises when the sender tries to open a message from the Sent folder. Signed-off-by: Werner Koch <[email protected]>
* tests,tools: Reimplement 'mk-tdata' in Scheme.Justus Winter2016-11-075-87/+17
| | | | | | | | | | * tests/openpgp/defs.scm (tools): Drop 'mk-tdata'. * tests/openpgp/setup.scm (make-test-data): New function. * tests/openpgp/verify.scm: Avoid 'mk-tdata'. * tools/Makefile.am (noinst_PROGRAMS): Drop 'mk-tdata'. * tools/mk-tdata.c: Drop file. Signed-off-by: Justus Winter <[email protected]>
* gpgscm,w32: Provide schemish file handling for binary files.Justus Winter2016-11-071-0/+14
| | | | | | | * tests/gpgscm/lib.scm (call-with-binary-input-file): New function. (call-with-binary-output-file): Likewise. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Add support for pseudo-random numbers.Justus Winter2016-11-072-0/+94
| | | | | | | | | | | | * tests/gpgscm/ffi.c (do_getpid): New function. (do_srandom): Likewise. (random_scaled): Likewise. (do_random): Likewise. (do_make_random_string): Likewise. (ffi_init): Expose the new functions. * tests/gpgscm/lib.scm: Document the new functions. Signed-off-by: Justus Winter <[email protected]>
* g10: Fix crash.Justus Winter2016-11-071-3/+4
| | | | | | | | | | | * g10/getkey.c (get_best_pubkey_byname): If 'get_pubkey_byname' does not return a getkey context, then it can return at most one key, therefore there is nothing to rank. Also, always initialize '*retctx' to be on the safe side. GnuPG-bug-id: 2828 Fixes: ab89164be02012f1bf159c971853b8610e966301 Signed-off-by: Justus Winter <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-05453-461/+461
| | | | --
* indent: Move comments inside the block.Werner Koch2016-11-041-48/+56
| | | | | | | | | | | | | | | | | | | | -- This fixes a few if (foo) /* A comment with several lines. */ { } Which has the problem that the block is visually not related to the "if" and might thus falsely be considered a standalone block. Also adds a asterisk on the left side of longer comments. Signed-off-by: Werner Koch <[email protected]>
* gpgscm: Fix printing strings containing zero bytes.Justus Winter2016-11-041-1/+3
| | | | | | | * tests/gpgscm/scheme.c (atom2str): Fix computing the length of Scheme strings. Scheme strings can contain zero bytes. Signed-off-by: Justus Winter <[email protected]>
* gpgscm: Implement 'atexit'.Justus Winter2016-11-042-0/+19
| | | | | | | | | | | | * tests/gpgscm/ffi.scm (throw): Run *run-atexit-handlers* when terminating the interpreter. (*atexit-handlers*): New variable. (*run-atexit-handlers*): New function. (atexit): Likewise. * tests/gpgscm/main.c (main): Run *run-atexit-handlers* at normal interpreter shutdown. Signed-off-by: Justus Winter <[email protected]>
* scd: Fix length error for READKEY.NIIBE Yutaka2016-11-041-0/+2
| | | | | | | * scd/app-openpgp.c (do_readkey): Decrement the length. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Add --advanced option for READKEY.NIIBE Yutaka2016-11-045-61/+99
| | | | | | | | | | | | | * scd/command.c (cmd_readkey) : Support ADVANCED arg. * scd/app.c (app_readcert): Add ADVANCED arg. * scd/app-openpgp.c (do_readkey): Implement ADVANCED arg. * scd/app-nks.c (do_readkey): Error return with GPG_ERR_NOT_SUPPORTED. -- "SCD READKEY --advanced OPENPGP.3" returns key in advanced format. With this suport, poldi-ctrl will be no longer needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Extend the PINENTRY_LAUNCHED inquiry and status.Werner Koch2016-11-034-5/+44
| | | | | | | | | * agent/call-pinentry.c (start_pinentry): Get flavor and version and pass it to agent_inq_pinentry_launched. * agent/command.c (agent_inq_pinentry_launched): Add arg EXTRA. * g10/server.c (gpg_proxy_pinentry_notify): Print a new diagnostic. Signed-off-by: Werner Koch <[email protected]>
* g10: Improve and unify key selection for -r and --locate-keys.Justus Winter2016-11-0311-3/+454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/getkey.c (struct pubkey_cmp_cookie): New type. (key_is_ok, uid_is_ok, subkey_is_ok): New functions. (pubkey_cmp): Likewise. (get_best_pubkey_byname): Likewise. * g10/keydb.h (get_best_pubkey_byname): New prototype. * g10/keylist.c (locate_one): Use the new function. * g10/pkclist.c (find_and_check_key): Likewise. * tests/openpgp/Makefile.am (XTESTS): Add new test. (TEST_FILES): Add new files. * tests/openpgp/key-selection.scm: New file. * tests/openpgp/key-selection/0.asc: Likewise. * tests/openpgp/key-selection/1.asc: Likewise. * tests/openpgp/key-selection/2.asc: Likewise. * tests/openpgp/key-selection/3.asc: Likewise. * tests/openpgp/key-selection/4.asc: Likewise. -- When a name resembling a mail address is given to either --locate-keys or --recipient, rank the search results and use only the most relevant key. This also lets us query which key will be used for encryption using --locate-keys. However, note that --locate-keys may also return keys incapable of encryption, though it will prefer keys that have an encryption subkey. GnuPG-bug-id: 2359 Signed-off-by: Justus Winter <[email protected]>
* gpgscm,tests: Add new functions to the test environment.Justus Winter2016-11-035-2/+63
| | | | | | | | | | * tests/gpgscm/lib.scm (first, last, powerset): New functions. * tests/gpgscm/tests.scm (interactive-shell): New function. * tests/openpgp/Makefile.am (EXTRA_DIST): Add new file. * tests/openpgp/README: Document 'interactive-shell'. * tests/openpgp/shell.scm: New file. Signed-off-by: Justus Winter <[email protected]>
* gpgconf: Add a new field to the --query-swdb output.Werner Koch2016-11-032-7/+23
| | | | | | | * tools/gpgconf.c (query_swdb): Insert new field with the installed version. Check that the supplied version does not contain a colon. Signed-off-by: Werner Koch <[email protected]>
* gpgconf: Add command --query-swdb.Werner Koch2016-11-022-0/+334
| | | | | | | | | | | | | | | | * tools/gpgconf.c (aQuerySWDB): New. (opts): Add --query-swdb. (valid_swdb_name_p): New. (query_swdb): New. (main): Implement command --query-swdb. -- Right now this command is not very useful because dimngr has not yet been changed to create the swdb.lst. For manual tests the swdb.lst file from the Net can be used with these additional lines: .filedate 20161102T130337 .verified 20161102T150000
* common: Improve compare_string_versions.Werner Koch2016-11-026-49/+87
| | | | | | | | | | | | | | | * common/stringhelp.c: Include limits.h. (compare_version_strings): Change semantics to behave like strcmp. Include the patch lebel in the comparison. Allow checking a single version string. * common/t-stringhelp.c (test_compare_version_strings): Adjust test vectors and a few new vectors. * g10/call-agent.c (warn_version_mismatch): Adjust to new sematics. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <[email protected]>
* gpgscm: Fix inclusion of readline header.Justus Winter2016-11-021-0/+1
| | | | | | | | * tests/gpgscm/ffi.c: Define magic macro to prevent the completion function from redefined. GnuPG-bug-id: 2824 Signed-off-by: Justus Winter <[email protected]>
* build: Fix misspelled dirmngr.Daniel Kahn Gillmor2016-11-021-1/+1
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Spelling: correct spelling of "passphrase".Daniel Kahn Gillmor2016-11-0233-35/+35
| | | | | | | | | | | There were several different variant spellings of "passphrase". This should fix them all for all English text. I did notice that po/it.po contains multiple instances of "passhprase", which also looks suspect to me, but i do not know Italian, so i did not try to correct it. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* g10,w32: Fix build on Windows.Justus Winter2016-11-021-4/+1
| | | | | | * g10/tofu.c (begin_transaction): Use the new 'gnupg_usleep'. Signed-off-by: Justus Winter <[email protected]>
* common: New function gnupg_usleep.Werner Koch2016-10-313-1/+56
| | | | | | | | | | | * configure.ac (HAVE_NANOSLEEP): Test for nanosleep. * common/sysutils.c: Always include time.h. (gnupg_usleep): New. -- This function has been compiled from nPth and Libassuan. Signed-off-by: Werner Koch <[email protected]>
* w32: Fix PKG_CONFIG_LIBDIR in --build-w32Andre Heinecke2016-10-311-1/+1
| | | | | | | | | | | * autogen.sh: Point pkg-config to the right location. -- PKG_CONFIG_LIBDIR is located to usually be /usr/lib/pkgconfig so in our case it should also point directly to the pkgconfig location and not the prefix. This fixes gnutls and sqlite detection. Signed-off-by: Andre Heinecke <[email protected]>
* g10: Avoid gratuitious SQLite aborts and starving writers.Neal H. Walfield2016-10-311-16/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/tofu.c: Include <time.h>, <utime.h>, <fcntl.h> and <unistd.h>. (tofu_dbs_s): Add fields want_lock_file and want_lock_file_ctime. (begin_transaction): Only yield if DBS->WANT_LOCK_FILE_CTIME has changed since we took the lock. Don't use gpgrt_yield to yield, but sleep for 100ms. After taking the batch lock, update DBS->WANT_LOCK_FILE_CTIME. Also take the batch lock the first time we take the real lock. When taking the real lock, use immediate not deferred mode to avoid gratuitious aborts. (end_transaction): When dropping the outermost real lock, drop the batch lock. (busy_handler): New function. (opendbs): Set the busy handler to it when opening the DB. Initialize CTRL->TOFU.DBS->WANT_LOCK_FILE. (tofu_closedbs): Free DBS->WANT_LOCK_FILE. -- Signed-off-by: Neal H. Walfield <[email protected]> By default, SQLite defers transactions until they are actually needed. A consequence of this is that if we have two readers and both decide to do a write, then one has to abort. To avoid this problem, we can make the outermost transaction an immediate transaction. This has the disadvantage that we only allow a single reader at a time, but at least we don't have gratuitous aborts anymore. A second problem is that SQLite apparently doesn't actually create a queue of waiters. The result is that doing a sched_yield between dropping and retaking the batch transaction is not enough to allow the other process to make progress. Instead, we need to wait a while (emperically: 100ms seems reasonable). To avoid waiting when there is no contention, we use a new file's timestamp to signal that there is a waiter.
* g10: Avoid reading in keys when possible.Neal H. Walfield2016-10-301-2/+16
| | | | | | | | | * g10/tofu.c (build_conflict_set): If CONFLICT_SET contains a single element, don't bother to check for cross sigs. Add parameter PK. Update callers. -- Signed-off-by: Neal H. Walfield <[email protected]>
* g10: Fix bit setting.Neal H. Walfield2016-10-301-4/+4
| | | | | | | | * g10/tofu.c (build_conflict_set): Fix bit setting. -- Signed-off-by: Neal H. Walfield <[email protected]> Fixes-commit: 1f1f56e606c1cb28eec68c60bd8bcb7ab30805de
* gpg: Enable the Issuer Fingerprint from rfc4880bisWerner Koch2016-10-282-12/+6
| | | | | | | | | | | | | | | | * g10/build-packet.c (build_sig_subpkt_from_sig): Always write the new Issuer Fingerprint sub-packet. * g10/mainproc.c (check_sig_and_print): Always consider that sub-packet. -- The specs for this sub-packet have been pushed to the OpenPGP WG's repo today. See-also: https://mailarchive.ietf.org/arch/msg/\ openpgp/GvPo2eSL9GW9WcGhOocY7KBa9FY Signed-off-by: Werner Koch <[email protected]>
* dirmngr: Fix signature checking.Werner Koch2016-10-271-25/+76
| | | | | | | | | | | | | | * dirmngr/server.c: Include cpparray.h. (verify_swdb_parm_s): New. (verify_swdb_status_cb): New. (cmd_versioncheck): Use gpgv to correclty verify the signature. Rename some variable to comply with GNU standards. -- Relying on the return code of gpg is not a robust way to check signatures. We better use our dedicated tool. Signed-off-by: Werner Koch <[email protected]>
* gpg: Verify multiple detached signatures with different hash algos.Werner Koch2016-10-271-5/+23
| | | | | | * g10/mainproc.c (proc_tree): Loose check. Enable all algos. Signed-off-by: Werner Koch <[email protected]>
* common: Add GNUPG_MODULE_NAME_GPGV.Werner Koch2016-10-272-0/+8
| | | | | | | * common/util.h (GNUPG_MODULE_NAME_GPGV): New. * common/homedir.c (gnupg_module_name): Implement. Signed-off-by: Werner Koch <[email protected]>
* g10: Fix iteration over getkey results.Justus Winter2016-10-271-3/+6
| | | | | | | * g10/getkey.c (getkey_next): Return the public key in PK even if RET_KEYBLOCK is NULL. Signed-off-by: Justus Winter <[email protected]>
* Fix typos.Justus Winter2016-10-2713-14/+14
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* g10: Assert preconditions.Justus Winter2016-10-271-0/+3
| | | | | | * g10/getkey.c (get_pubkey_byname): Assert preconditions. Signed-off-by: Justus Winter <[email protected]>
* dirmngr: Do not implement --supervised in Windows.Werner Koch2016-10-272-4/+8
| | | | | | | * dirmngr/dirmngr.c (opts) [W32]: Remove --supervised. (main) [W32]: Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: Remove debug output from gnupg_get_socket_name.Werner Koch2016-10-271-4/+4
| | | | | | | * common/sysutils.c (gnupg_get_socket_name): Remove debug message and use my_error_from_syserror. Signed-off-by: Werner Koch <[email protected]>
* dirmngr: ADNS error handling fix.NIIBE Yutaka2016-10-271-4/+4
| | | | | | | | | | * dirmngr/dns-stuff.c (resolve_name_adns, get_dns_cert, get_dns_cname): Use gpg_error and gpg_err_code_from_errno to compose the error value. -- This fixes commits 6f1d8123d61b3efac94b4c61ee75bd947790ba42. Signed-off-by: NIIBE Yutaka <[email protected]>