aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* core: Handle multiple TOFU_USER lines in verifyAndre Heinecke2017-02-021-8/+31
| | | | | | | | | | | | * src/verify.c (op_data_t): Add conflict_user_seen. (parse_tofu_user): Return ERR_DUP_VALUE for mutltiple TOFU_USERS. (_gpgme_verify_status_handler): Handle ERR_DUP_VALUE from parse_tofu_user to ignore the next TOFU_STATS. -- This fixes TOFU Conflict verification with GnuPG-2.1.17 and 2.1.18 GnuPG-Bug-Id: 2914
* core: Replace all calls to *sprintf by gpgrt_*sprintf.Werner Koch2017-02-0213-301/+97
| | | | | | | | | | | | | | * configure.ac (vasprintf): Remove check. * src/vasprintf.c: Remove file. * src/util.h (vasprintf, asprintf): Remove prototypes. Replace all calls to vasprintf and asprintf by gpgrt_vasprintf or gpgrt_asprintf. Also take care to use gpgrt_free on the returned value. * src/w32-util.c (_gpgme_get_gpgconf_path): Replace a gpgrt_asprintf by _gpgme_strconcat. (snprintf): New macro to use gpgrt_snprintf instead of the system's standard snprintf. Signed-off-by: Werner Koch <[email protected]>
* core: Remove unused check for funopen/fopencookie.Werner Koch2017-02-022-78/+0
| | | | | | | * configure.ac (funopen): Remove check. * src/funopen.c: Remove file. Signed-off-by: Werner Koch <[email protected]>
* core: Explain in gpgme.h that most stucts are read-only.Werner Koch2017-02-021-10/+70
| | | | | | | | | | | -- It is common that developers look up only the header file and do not read the manual. These comments should make it clear that most structures in gpgme.h are read-only and may only be allocated by gpgme. Signed-off-by: Werner Koch <[email protected]>
* core: Un-deprecate gpgme_data_rewind.Werner Koch2017-02-024-16/+17
| | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_data_rewind): Un-deprecate. * src/data-compat.c (gpgme_data_rewind): Move to ... * src/data.c (gpgme_data_rewind): here. -- That function is very convenient because it is required a lot with memory streams. It also documents the intention of the caller better than gpgme_data_seek with its addition parameters and the need to map system errors. Thus it does not make sense to make it a first class citizen again. Signed-off-by: Werner Koch <[email protected]>
* core: Move all deprecated stuff to the end of gpgme.h.Werner Koch2017-02-021-315/+315
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Cleanup gpgme_key_unref freesAndre Heinecke2017-02-011-17/+8
| | | | * src/key.c (gpgme_key_unref): Nowadays we assume free(NULL) is ok.
* core: Fix leakage of address for mail only uidsAndre Heinecke2017-02-011-9/+1
| | | | | | | | | | * src/key.c (gpgme_key_unref): Always free address if set. (_gpgme_key_append_name): Remove memory optimization for address. -- The check if address is not allocated would now be more complicated then just comparing it to email because email is set to address also when an email was not parsed from the user id.
* core: Improve mailbox only uid handlingAndre Heinecke2017-02-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | * src/key.c (_gpgme_key_append_name): Set email and remove name for uid only keys. -- If we have a name and no email but the name can be parsed as an address we now treat the address as email and remove the name. This fixes downstream users that rely on email to show email addresses and don't expilicity handle this case. E.g. A userid [email protected] was: uid->name = "[email protected]" uid->email = "" uid->address = "[email protected]" It is now: uid->name = "" uid->email = "[email protected]" uid->address = "[email protected]"
* qt: Increase timeout when waiting for signals.Justus Winter2017-01-316-13/+17
| | | | | | | | | | | | | | | * lang/qt/tests/t-support.h (QSIGNALSPY_TIMEOUT): New macro. * lang/qt/tests/t-encrypt.cpp: Use the new macro as timeout when waiting for signals. * lang/qt/tests/t-keylist.cpp: Likewise. * lang/qt/tests/t-keylocate.cpp: Likewise. * lang/qt/tests/t-ownertrust.cpp: Likewise. * lang/qt/tests/t-wkspublish.cpp: Likewise. -- Increase the timeout when waiting for signals from 5 seconds to 60. This addresses intermittent test failures on slow machines. Signed-off-by: Justus Winter <[email protected]>
* core: Add new context flag "redraw".Werner Koch2017-01-316-1/+49
| | | | | | | | | | * src/context.h (struct gpgme_context): New field 'redraw_suggested'. * src/op-support.c (_gpgme_op_reset): Clear REDRAW_SUGGESTED. * src/progress.c (_gpgme_progress_status_handler): Set REDRAW_SUGGESTED. * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add "redraw". * tests/run-sign.c (main): Use it. Signed-off-by: Werner Koch <[email protected]>
* tests: Reduce iterations / threadsAndre Heinecke2017-01-303-3/+3
| | | | | | | | | | | | * tests/gpg/t-gpgconf.c (main): Reduce iterations to 10. * tests/gpg/t-thread-keylist-verify.c, tests/gpg/t-thread-keylist.c (THREAD_COUNT): Reduce to 10. -- While these tests tested for race conditions a smaller number of iteration should still show problems if they are run on multiple systems and regulary. While the 100 Thread count in the t-thread tests could lead to resource problems.
* python: Ensure quick-random is used if gpg is gpg2Andre Heinecke2017-01-261-0/+2
| | | | | * lang/python/tests/Makefile.am (gpg.conf): Configure agent-program accordingly.
* python: default op_keylist_start parameters.Tobias Mueller2017-01-252-0/+21
| | | | | | | | | | | | | | * lang/python/gpgme.i: Added gpgme_op_keylist_start with defaults * lang/python/tests/t-keylist.py: Added tests for default parameters -- To increase the ease of use, op_keylist_start parameters default to sensible values. The empty string matches all keys. We assume that the user wants to retrieve public keys most of the time, so we default to public keys rather than secret keys. Signed-off-by: Tobias Mueller <[email protected]>
* tests: Use --debug-quick-random for testsAndre Heinecke2017-01-251-5/+7
| | | | | | | | | | * tests/start-stop-agent: Don't autostart agent on --stop and running check. Use --debug-quick-random when starting. -- This should speed up the tests especially on low entropy systems. Possibly fixing a hang on pythons op_genkey test in the Launchpad build enviorment (see launchpad issue 1655298)
* w32: Fix closing file descriptors.Justus Winter2017-01-231-2/+8
| | | | | | | | | * src/w32-io.c (writer): Only stop once the buffer is drained. (destroy_writer): Wait for the writers buffer to be drained. This aligns '_gpgme_io_close's behavior with close(2) and fclose(3). GnuPG-bug-id: 2881 Signed-off-by: Justus Winter <[email protected]>
* tests: Add safeguards against nullptr derefAndre Heinecke2017-01-171-6/+9
| | | | * t-gpgconf.c (main): Test some values before dereferencing them.
* qt: Use QVERIFY instead of Q_ASSERT in conf testAndre Heinecke2017-01-161-3/+3
| | | | * lang/qt/tests/t-config.cpp: Use QVERIFY instead of Q_ASSERT.
* qt: Add test for CryptoConfigAndre Heinecke2017-01-162-3/+98
| | | | | * lang/qt/tests/t-config.cpp: New. * lang/qt/tests/Makefile.am: Update accordingly.
* tests: Fix distcheck.Justus Winter2017-01-161-1/+1
| | | | | | | * tests/gpg/Makefile.am (CLEANFILES): Remove gpgconf backups. Fixes-commit: ea7bb62f5d981615847528b3ce53be9cc4d741a7 Signed-off-by: Justus Winter <[email protected]>
* Fix changing options with gpgconf.Justus Winter2017-01-161-12/+54
| | | | | | | | | * src/engine-gpgconf.c (gpgconf_write): Connect a pipe to the child's stderr, and wait for it to be closed as an indication that gpgconf has exited. Also improve error handling. GnuPG-bug-id: 2881 Signed-off-by: Justus Winter <[email protected]>
* tests: Improve the gpgconf test.Justus Winter2017-01-122-53/+129
| | | | | | | | | | | | * tests/gpg/t-gpgconf.c: Include support functions. (fail_if_err): Remove macro. (init_gpgme): Remove function. (lookup): New function. (main): Update some values and verify that the changes are applied. * tests/gpg/t-support.h (test): New assert-like macro. GnuPG-bug-id: 2881 Signed-off-by: Justus Winter <[email protected]>
* tests: Enable gpgconf test.Justus Winter2017-01-121-4/+0
| | | | | | -- Fixes: 02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b Signed-off-by: Justus Winter <[email protected]>
* qt: Add support for stringValueList in CryptoConfAndre Heinecke2017-01-126-1/+69
| | | | | | | | | | | | | | | | * lang/qt/src/Makefile.am (qgpgme_sources): Add cryptoconfig.cpp * lang/qt/src/cryptoconfig.cpp: New. * lang/qt/src/cryptoconfig.h (CryptoConfigEntry::stringValueList): New. * lang/qt/src/qgpgmenewcryptoconfig.cpp (QGpgMENewCryptoConfigEntry::stringValueList): New. * lang/qt/src/qgpgmenewcryptoconfig.h: Update accordingly. -- This is a pardigm change in cryptoconfig.h to avoid ABI breaks with each new config value we support it now has an implementation that is directly related to qgpgmenewcryptoconfig, which is now the only one.
* qt: Don't use qstrdup in test passphrase cbAndre Heinecke2017-01-121-1/+5
| | | | | | | | | | * lang/qt/tests/t-support.h (TestPassphraseProvider::getPassphrase): Use gpgrt_asprintf instead of strdup. -- To avoid problems on MacOS we want to avoid strdup so that qgpgme can be built without extensions. But qstrdup allocates with new and not with malloc, so use gpgrt_asprintf instead.
* qt: Clean up test dirs on failureAndre Heinecke2017-01-118-174/+174
| | | | | | | | | | | * t-encrypt.cpp, t-keylist.cpp, t-keylocate.cpp, t-ownertrust.cpp, t-tofuinfo.cpp, t-various.cpp, t-verify.cpp, t-wkspublish.cpp: Use QVERIFY instead of Q_ASSERT
* qt: Add test for uid functionsAndre Heinecke2017-01-112-3/+131
| | | | | * lang/qt/tests/t-various.cpp: New. * lang/qt/tests/Makefile.am: Update accordingly.
* cpp: Add revuid and adduid supportAndre Heinecke2017-01-115-0/+87
| | | | | | | | | | | * lang/cpp/src/context.cpp (Context::revUid, Context::startRevUid), (Context::addUid, Context::startAddUid): New. * lang/cpp/src/context.h: Declare new functions. * lang/cpp/src/key.cpp (Key::UserID::revoke) (Key::addUid): Idomatic helpers. lang/cpp/src/key.h: Declare new functions. * NEWS: Update accordingly.
* Fix Qgpgme build for macosAndre Heinecke2017-01-112-2/+4
| | | | | | * lang/qt/src/dn.cpp: Include string.h (parse_dn_part): Use qstrdup. * lang/qt/tests/t-support.h (getPassphrase): Use qstrdup.
* Fix cmake configuration files for MacOSAndre Heinecke2017-01-115-2/+26
| | | | | | | | | | | | * configure.ac: Set HAVE_MACOS_SYSTEM conditional. * lang/qt/src/Makefile.am, lang/cpp/src/Makefile.am, lang/qt/src/QGpgmeConfig.cmake.in.in, lang/cpp/src/GpgmeConfig.cmake.in.in: Use libsuffix again to distinguish between macos .dylib -- GnuPG-Bug-Id: 2884
* python: Improve compatibility with Scheme tests.Justus Winter2017-01-031-0/+2
| | | | | | * lang/python/tests/run-tests.py: Add stub --parallel option. Signed-off-by: Justus Winter <[email protected]>
* python: Add a switch '--quiet' to the test runner.Justus Winter2017-01-031-5/+12
| | | | | | | | * lang/python/tests/run-tests.py: Add and honor a switch '--quiet'. This way we can use this script to run Python tests one by one without the noise, and the script will setup the necessary environment for us. Signed-off-by: Justus Winter <[email protected]>
* qt: Update config sync doc / commentAndre Heinecke2017-01-022-12/+6
| | | | | | | | * lang/qt/src/cryptoconfig.h (CryptoConfig::sync): Document that runtime option is always set. * lang/qt/Src/qgpgmenewcryptoconfig.cpp (QGpgMENewCryptoConfigComponent::sync): Remove outdated comment and warn on error.
* core: Always use runtime for gpgconf changesAndre Heinecke2017-01-022-2/+4
| | | | | | | | | | | | * src/engine-gpgconf.c (gpgconf_write): Add --runtime. * src/gpgme.h.in (gpgme_conf_opt_change): Document this behavior. -- If a tool uses GPGME for changing configuration values it needs a way to ensure that these changes take effect. Otherwise users may change and see config values and do not understand why they are not working.
* Fix gpg_addkey() to work with GPGME_CREATE_NOPASSWD as well.Ben Kibbey2016-12-311-0/+2
| | | | | | | | * src/engine-gpg.c (gpg_addkey): Pass --batch to gpg when GPGME_CREATE_NOPASSWD is set to fix pinentry without loopback mode. -- Signed-off-by: Ben Kibbey <[email protected]>
* Fix GPGME_CREATE_NOPASSWD without pinentry loopback.Ben Kibbey2016-12-271-0/+2
| | | | | | | | * src/engine-gpg.c(gpg_createkey): Pass --batch to gpg when GPGME_CREATE_NOPASSWD is set. -- Signed-off-by: Ben Kibbey <[email protected]>
* Qt: Make sure extended grep is used with '|'.Raphael Kubo da Costa2016-12-191-3/+3
| | | | | | | | | | | | | * m4/qt.m4: Use grep -E when using the alternation character. -- POSIX specifies '|' is only supposed to work as an alternation special character when grep is used in extended mode. The code worked fine with GNU grep because it accepts extended regular expressions by default, but other POSIX-compliant implementations might fail and take it literally. Signed-off-by: Raphael Kubo da Costa <[email protected]>
* cpp: Ensure that hasSecret is correct after updateAndre Heinecke2016-12-161-1/+6
| | | | | | | | | | | * lang/cpp/src/key.cpp (Key::update): Check for a secret key first before listing public keys. -- This is a performance delay but the update should only be called in a non gui thread anyway. The information if we have the secret key for this key is important to provide after update.
* cpp: Fix addrSpec for keys without emailAndre Heinecke2016-12-151-1/+6
| | | | | | | | | | | * lang/cpp/src/key.cpp (UserID::addrSpec): Use uid->address instead of normalizing again. (&operator<<(std::ostream &, const UserID &): Print it. -- This saves a normalization and fixes the case where a user id is just a mail address without name, in that case gpgme sets "address" but not email. Because the email is then the name.
* cpp: Fix update of partial key in verifyresultAndre Heinecke2016-12-151-1/+2
| | | | | | | | | | | * lang/cpp/src/verificationresult.cpp (Signature::key(bool,bool)): Don't update the returned copy but the actual key of the signature. -- The whole point of the update is to change the partial key from the signature (e.g. only fingerprint and one uid as we would have from tofu) to a fully keylisted one.
* doc: Let's suggest GNU guidelines for bit checking.Werner Koch2016-12-071-1/+1
| | | | | | | | | -- While educating students we can also get them to use useful habits, in particular to parenthese bit tests. Signed-off-by: Werner Koch <[email protected]>
* Clarify what "checking on bit" meansAndre Heinecke2016-12-071-1/+13
| | | | | | | | | | | | | | * doc/gpgme.texi (gpgme_sigsum_t summary): Clarify what "you can check one bit means" -- It was unclear which bit to test for is. And tests with students have shown that they would "test" for this one bit by using if(sig.summary == GPGME_SIGSUM_VALID) which would fail because valid sigs are also SIGSUM_GREEN. So lets give an example for people not used to checking bits and clarify through this example which bit is meant to be checked.
* python: Try to be more helpful when given a string to encrypt().Tobias Mueller2016-12-052-2/+19
| | | | | | | | | | | | | * lang/python/helpers.c (_gpg_obj2gpgme_data_t): Extended error message. * lang/python/tests/t-encrypt.py: Test for "encode" in error message. -- The motivation is to help the user when encrypting fails. I claim that it is not obvious to not being able to encrypt a string directly. To nudge the user into encoding it to bytes, the error message is a bit extended. Signed-off-by: Tobias Mueller <[email protected]>
* python: Define a macro for wrapping fragile result objects.Tobias Mueller2016-12-051-57/+12
| | | | | | | | | | * lang/python/gpgme.i (wrapresult): New Macro. -- This reduces the amount of copy and pasted code at the expense of a slightly more complicated logic with a macro. Signed-off-by: Tobias Mueller <[email protected]>
* python: Check "buffer" when writing to sys.stdout for python2 compat.Tobias Mueller2016-12-011-1/+5
| | | | | | | | | | | * lang/python/tests/support.py (print_data): Add check for buffer. -- When running with something like make -C lang/python check verbose=2 the test would fail under python2, because the file objects do not have a buffer property. Signed-off-by: Tobias Mueller <[email protected]>
* python: Make Context have a repr method.Tobias Mueller2016-12-011-0/+8
| | | | | | | | | * lang/python/gpg/core.py (Context.__repr__): New function. -- This makes Context objects look nicer in a REPL. Signed-off-by: Tobias Mueller <[email protected]>
* python: Make Results have a nicer __repr__.Tobias Mueller2016-12-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang/python/gpg/results.py (Result.__str__): Renamed to '__repr__' ... * lang/python/gpg/results.py (Result.__repr__): ... and added fields. -- So that it looks a bit nicer in the Python REPL. It looked like this before: In [2]: gpg.core.get_engine_info()[0] Out[2]: <gpg.results.EngineInfo at 0x7fb23509a240> Now the output is In [2]: gpg.core.get_engine_info()[0] Out[2]: EngineInfo(file_name='/usr/bin/gpg2', home_dir=None, protocol=0, req_version='1.4.0', version='2.1.11') This also applies to other results, e.g. the ImportResult. Note that the format now changed from "<Class >" to "Class()". The Python documentation on repr states: "For many object types, including most builtins, eval(repr(obj)) == obj." Signed-off-by: Tobias Mueller <[email protected]>
* python: Fix removing the TOFU database.Justus Winter2016-11-252-2/+2
| | | | | | | | * lang/python/Makefile.am (CLEANFILES): Move 'tofu.db'... * lang/python/tests/Makefile.am (CLEANFILES): ... here. Fixes-commit: 9b22f82afc5518961e4bea1fc516b79800e379a2 Signed-off-by: Justus Winter <[email protected]>
* tests: Remove tofu.db.Justus Winter2016-11-252-2/+3
| | | | | | | * lang/python/Makefile.am (CLEANFILES): Add 'tofu.db'. * tests/gpg/Makefile.am (CLEANFILES): Likewise. Signed-off-by: Justus Winter <[email protected]>
* Remove a forgotten instance of @libsuffix@Heiko Becker2016-11-171-1/+1
| | | | | | | | | | | * lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove a forgotten instance of @libsuffix@. -- b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a removed @libsuffix@ from cmake config files, but missed one instance. Signed-off-by: Heiko Becker <[email protected]>