gpgme.git
5 weeks agoPost release updates. master
Werner Koch [Tue, 12 Dec 2017 12:11:04 +0000 (13:11 +0100)]
Post release updates.

--

5 weeks agoRelease 1.10.0. gpgme-1.10.0
Werner Koch [Tue, 12 Dec 2017 11:46:00 +0000 (12:46 +0100)]
Release 1.10.0.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agoRequire libgpg-error 1.24 and libassuan 2.4.2
Werner Koch [Tue, 12 Dec 2017 11:12:47 +0000 (12:12 +0100)]
Require libgpg-error 1.24 and libassuan 2.4.2

* src/util.h (GPG_ERR_FALSE): Remove due to newer libgpg-error.
--

We require these over one year old versions to better allign with
GnuPG's demand.  Note that the required libassuan is acgtually 2 years
old.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 weeks agoqt: Don't use QDateTime::toSecsSinceEpoch
Andre Heinecke [Mon, 11 Dec 2017 16:07:10 +0000 (17:07 +0100)]
qt: Don't use QDateTime::toSecsSinceEpoch

* lang/qt/src/qgpgmequickjob.cpp (addSubkeyWorker)
(createWorker): Use toMSecsSinceEpoch instead toSecsSinceEpoch.

--
toSecsSinceEpoch was only introduced in Qt 5.8.

5 weeks agocore,w32: Fix popping up of console windows due to gpgconf.
Werner Koch [Mon, 11 Dec 2017 12:54:22 +0000 (13:54 +0100)]
core,w32: Fix popping up of console windows due to gpgconf.

* src/gpgme-w32spawn.c (my_spawn): Create w/o DETACHED_PROCESS.
--

The spawn helper is actually called with DETACHED_PROCESS and should
not need to do a DETACHED_PROCESS of its own.  Interestingly this
patch removes the popups.

See Andre's report
GnuPG-bug-id: 3515

Signed-off-by: Werner Koch <wk@gnupg.org>
6 weeks agoSpelling fixes for comments and doc
Andre Heinecke [Fri, 8 Dec 2017 04:59:11 +0000 (05:59 +0100)]
Spelling fixes for comments and doc

--
Patch provided by ka7 in dev.gnupg.org

Differential D423

6 weeks agocpp: Fix handling of lsig promotion
Andre Heinecke [Thu, 7 Dec 2017 15:21:01 +0000 (16:21 +0100)]
cpp: Fix handling of lsig promotion

* src/gpgsignkeyeditinteractor.cpp (SignKeyState): Add second
CONFIRM state.
(makeTable): Properly handle local_promote_okay.
(action): Handle CONFIRM2.

--
This fixes changing a local signature to a "public" signature.

GnuPG-Bug-Id: T1649

6 weeks agotests: Print userid signatures in run-keylist
Andre Heinecke [Thu, 7 Dec 2017 12:47:18 +0000 (13:47 +0100)]
tests: Print userid signatures in run-keylist

* tests/run-keylist.c (main): Print UID signatures if there
are any.

6 weeks agocore: Also check for a failed selftest in gpgm_data_new.
Werner Koch [Mon, 4 Dec 2017 11:08:31 +0000 (12:08 +0100)]
core: Also check for a failed selftest in gpgm_data_new.

* src/data.c (_gpgme_data_new): Check for failed selftest.
* tests/run-support.h (make_filename): Print a message on mallooc
failure.
(init_gpgme_basic): New.
* tests/run-identify.c (main): Call init_gpgme_basic becuase we do not
need to setup a protocol.
* tests/t-data.c: Define PGM and include run-support.h.
(make_filename): Remove.
(main): Call init_gpgme_basic.
--

Note: This patch may break applications which used gpgme_data but no
gpgme_new without having called the required gpgme_check_version.

GPGME can be used without a protocol for example to work with the data
object abstraction.  Thus a call to gpgme_data_new also needs to check
the result of the core selftests - including on whether
gpgme_check_version has been called.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 weeks agopython: Default whence argument for Data() to SEEK_SET.
Tobias Mueller [Tue, 22 Aug 2017 15:48:25 +0000 (17:48 +0200)]
python: Default whence argument for Data() to SEEK_SET.

* lang/python/gpgme.i: copied signature from gpgme.h and defaulted the
value to SEEK_SET.
* lang/python/tests/t-data.py: Added a test for no second argument
--

Having to import the os package when wanting to read a Data object is a
slight annoyance. With SWIG, we can define default parameters. This
change defaults the whence argument to SEEK_SET which is how StringIO
and BytesIO behave.

Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
6 weeks agoRegister DCO for Tobias Mueller
Werner Koch [Sun, 3 Dec 2017 18:28:11 +0000 (19:28 +0100)]
Register DCO for Tobias Mueller

--

7 weeks agoqt: Add job for quick commands
Andre Heinecke [Fri, 1 Dec 2017 13:29:04 +0000 (14:29 +0100)]
qt: Add job for quick commands

* lang/qt/src/qgpgmequickjob.cpp,
lang/qt/src/qgpgmequickjob.h,
lang/qt/src/quickjob.h: New.
* lang/qt/src/Makefile.am,
lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h,
lang/qt/src/job.cpp: Update accordingly.

--
Keeping it in line with the Job for everything pattern.
Although it's reduced to one job for four commands as
the commands all behave the same.

7 weeks agocpp: Wrap create_key and create_subkey
Andre Heinecke [Fri, 1 Dec 2017 12:21:34 +0000 (13:21 +0100)]
cpp: Wrap create_key and create_subkey

* lang/cpp/src/context.cpp,
lang/cpp/src/context.h (Context::startCreateKey)
(Context::createKey, Context::createSubkey)
(Context::startCreateSubkey): New.

7 weeks agoFix uid parsing for ldap keyserver
Andre Heinecke [Fri, 1 Dec 2017 08:44:47 +0000 (09:44 +0100)]
Fix uid parsing for ldap keyserver

* src/engine-gpg.c (gpg_keylist_preprocess): Check field count
for uid and add fallback.

--
This fixes accessing unintialized memory and resulting
crashes in gpgrt_asprintf.

GnuPG-Bug-Id: T3550

7 weeks agotests: Add missing variable to gpgsm tests Makefile
Werner Koch [Thu, 30 Nov 2017 08:49:38 +0000 (09:49 +0100)]
tests: Add missing variable to gpgsm tests Makefile

* tests/gpgsm/Makefile.am (GPG_AGENT): Set var.  It is used later.
--

Note that the var is used by the gpgsm.conf target.

Reported-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Werner Koch <wk@gnupg.org>
8 weeks agotests: Make portability fix.
NIIBE Yutaka [Tue, 21 Nov 2017 06:35:10 +0000 (15:35 +0900)]
tests: Make portability fix.

* lang/python/tests/Makefile.am: Distinguish target and path.
* tests/gpg/Makefile.am: Ditto.
* tests/gpgsm/Makefile.am: Ditto.

--

GNU Make is powerful enough to match path to target (and vice versa),
but BSD make is not.

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2 months agoqt: Fix IODeviceDataProvider with Process
Andre Heinecke [Tue, 14 Nov 2017 13:28:32 +0000 (14:28 +0100)]
qt: Fix IODeviceDataProvider with Process

* lang/qt/src/dataprovider.cpp (blocking_read): Keep
reading if process is not atEnd.

--
This fixes a regression in Kleopatra that uses this dataprovider
to chain the gpgtar process to the encryption / signing.

3 months agocore: use getdents64 syscall on linux instead of getdents.
Daniel Kahn Gillmor [Wed, 11 Oct 2017 15:38:39 +0000 (11:38 -0400)]
core: use getdents64 syscall on linux instead of getdents.

* src/posix-io.c (get_max_fds): use getdents64 instead of getdents.
--

getdents64 was introduced in linux 2.4, so it should be widely
available.  some Linux architectures which post-date 2.4 (e.g. arm64)
appear to not have getdents at all, so it's probably better to use the
more modern interface.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 months agocore: Allow disabling the use of SYS_getdents for Linux.
Werner Koch [Wed, 4 Oct 2017 16:03:54 +0000 (18:03 +0200)]
core: Allow disabling the use of SYS_getdents for Linux.

* configure.ac (USE_LINUX_GETDENTS): New ac_define.  Add option
--disable-linux-getdents.
* src/posix-io.c: Make use of USE_LINUX_GETDENTS.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agocore: Restore get_max_fds optimization on Linux
Colin Watson [Sat, 16 Sep 2017 03:16:45 +0000 (04:16 +0100)]
core: Restore get_max_fds optimization on Linux

* src/posix-io.c (get_max_fds): Restore Linux optimization, this time
using open/getdents/close rather than opendir/readdir/closedir.
--

opendir/readdir/closedir may allocate/free memory, and aren't required
to do so in an async-signal-safe way.  On the other hand, opening
/proc/self/fd directly and iterating over it using getdents is safe.

(getdents is not strictly speaking documented to be async-signal-safe
because it's not in POSIX.  However, the Linux implementation is
essentially just a souped-up read.  Python >= 3.2.3 makes the same
assumption.)

Signed-off-by: Colin Watson <cjwatson@debian.org>
3 months agoRegister DCO for Colin Watson.
Werner Koch [Wed, 4 Oct 2017 15:25:36 +0000 (17:25 +0200)]
Register DCO for Colin Watson.

--

4 months agoqt: Add test for version info
Andre Heinecke [Mon, 4 Sep 2017 09:25:34 +0000 (11:25 +0200)]
qt: Add test for version info

* lang/qt/tests/t-various.cpp (TestVarious::testVersion): New.

--
If it's not tested it does not work ;-)

4 months agocpp: Fix version info comparison
Andre Heinecke [Mon, 4 Sep 2017 09:23:56 +0000 (11:23 +0200)]
cpp: Fix version info comparison

* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<):
Fix logic.
* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator>):
New.
* NEWS: Mention added API

--
This fixes a logic error that 2.2.0 < 2.1.19 would return true.

4 months agocore: New context flag "auto-key-retrieve"
Werner Koch [Thu, 24 Aug 2017 15:17:11 +0000 (17:17 +0200)]
core: New context flag "auto-key-retrieve"

* src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag
"auto-key-retrieve".
* src/context.h (gpgme_context): New field auto_key_retrieve.
* src/engine-backend.h (struct engine_ops): Add arg auto_key_retrieve
to field 'decrypt'.
* src/engine-gpg.c (gpg_decrypt): Add arg auto_key_retrieve and pass
option --auto-key-retrieve to gpg.  Adjust all callers.
(gpg_verify): Ditto.
* src/engine-gpgsm.c (gpgsm_decrypt): Add dummy arg auto_key_retrieve.
* src/engine-uiserver.c (uiserver_decrypt): Ditto.
* tests/run-verify.c (main): Add option --auto-key-retrieve.
--

This makes the --auto-key-retrieve option available in the GPGME API.

Test plan:
Run

  GPGME_DEBUG=9:out tests/run-verify SIGNEDFILE

with and without its new option --auto-key-retrieve and check in the
trace stored in "out" whether --auto-key-retrieve was passed to gpg.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agoSet next version to 1.10.0
Werner Koch [Thu, 24 Aug 2017 14:19:54 +0000 (16:19 +0200)]
Set next version to 1.10.0

--

4 months agocore: New public enum gpgme_keyorg_t.
Werner Koch [Thu, 24 Aug 2017 12:21:15 +0000 (14:21 +0200)]
core: New public enum gpgme_keyorg_t.

* src/gpgme.h.in (gpgme_keyorg_t): New.
* src/keylist.c (parse_keyorg): New.
(keylist_colon_handler): Set key->ORIGIN.
--

This finally set the key origin value form data supplied by recent gpg
versions.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agogpgconf: Add more comments.
Marcus Brinkmann [Thu, 24 Aug 2017 13:50:16 +0000 (15:50 +0200)]
gpgconf: Add more comments.

* src/engine-gpgconf.c (gpgconf_config_dir_cb, gpgconf_conf_dir):
Add comments.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3018

4 months agoFix a couple of bugs pointed out by clang compiler warnings.
Marcus Brinkmann [Wed, 23 Aug 2017 13:38:11 +0000 (15:38 +0200)]
Fix a couple of bugs pointed out by clang compiler warnings.

* src/engine-gpgconf.c (gpgconf_config_dir_cb): Fix cast.
* src/key.c (_gpgme_key_add_sig): Fix pointer reference.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
4 months agopython: Support parallel build in tests
Alon Bar-Lev [Thu, 3 Aug 2017 18:41:35 +0000 (21:41 +0300)]
python: Support parallel build in tests

* lang/python/tests/Makefile.am: Depend xcheck with all which was lost
due to the check hack.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
4 months agopython: Improve keylist test.
Justus Winter [Mon, 21 Aug 2017 08:54:10 +0000 (10:54 +0200)]
python: Improve keylist test.

* lang/python/tests/t-keylist.py: Check a keylist matching no keys.

Signed-off-by: Justus Winter <justus@g10code.com>
5 months agodoc: Add version information.
Marcus Brinkmann [Wed, 16 Aug 2017 20:52:29 +0000 (22:52 +0200)]
doc: Add version information.

* doc/gpgme.texi (since): New macro.  Use it to add version
information to those APIs that are mentioned in the NEWS file.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3137

5 months agodoc: Clarify import keys operation further.
Marcus Brinkmann [Wed, 16 Aug 2017 13:39:17 +0000 (15:39 +0200)]
doc: Clarify import keys operation further.

* doc/gpgme.texi (gpgme_op_import_keys): Further clarifications.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3215

5 months agogpgconf: Fix some warnings.
Marcus Brinkmann [Tue, 15 Aug 2017 23:50:00 +0000 (01:50 +0200)]
gpgconf: Fix some warnings.

* tests/gpg/t-gpgconf.c (main): Fix warnings.
* src/engine-gpgconf.c (struct gpgconf_config_dir_s): New struct.
(gpgconf_config_dir_cb, gpgconf_conf_dir) Use it to fix warning.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
5 months agogpgconf: Fix symbol export.
Marcus Brinkmann [Tue, 15 Aug 2017 22:59:35 +0000 (00:59 +0200)]
gpgconf: Fix symbol export.

* gpgme.def: Fix last change.
(gpgme_op_conf_save): Replace duplicate from c&p ...
(gpgme_op_conf_dir): ... with this.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
Fixes-commit: 9cd2b58dfb2c21cce64520cf4c726859b583d14e

5 months agoNEWS: Add missing entry.
Marcus Brinkmann [Tue, 15 Aug 2017 18:00:26 +0000 (20:00 +0200)]
NEWS: Add missing entry.

5 months agogpgconf: Add access to --list-dirs for non-default engine.
Marcus Brinkmann [Tue, 15 Aug 2017 17:40:12 +0000 (19:40 +0200)]
gpgconf: Add access to --list-dirs for non-default engine.

* src/engine-assuan.c (_gpgme_engine_ops_assuan): Add conf_dir.
* src/engine-g13.c (_gpgme_engine_ops_g13): Likewise.
* src/engine-gpg.c (_gpgme_engine_ops_gpg): Likewise.
* src/engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise.
* src/engine-spawn.c (_gpgme_engine_ops_spawn): Likewise.
* src/engine-uiserver.c (_gpgme_engine_ops_uiserver): Likewise.
* src/engine-backend.h (struct engine_ops): Likewise.
* src/engine-gpgconf.c (gpgconf_config_dir_cb, gpgconf_conf_dir):
New functions.
(struct engine_ops): Add gpgconf_conf_dir.
* src/engine.c (_gpgme_engine_op_conf_dir): New function.
* src/engine.h (_gpgme_engine_op_conf_dir): New prototype.
* src/gpgconf.c (gpgme_op_conf_dir): New function.
* src/gpgme.def (gpgme_op_conf_save): New symbol.
* src/gpgme.h.in (gpgme_op_conf_dir): New prototype.
* src/libgpgme.vers (gpgme_op_conf_dir): New symbol.
* tests/gpg/t-gpgconf.c (main): Test gpgme_op_conf_dir.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3018

5 months agog10: Add new delete operations that allow more flags.
Marcus Brinkmann [Fri, 11 Aug 2017 17:13:44 +0000 (19:13 +0200)]
g10: Add new delete operations that allow more flags.

* NEWS: Document new interfaces.
* doc/gpgme.texi: Document new interfaces.
* src/gpgme.h.in (GPGME_DELETE_ALLOW_SECRET, GPGME_DELETE_FORCE,
gpgme_op_delete_ext_start, gpgme_op_delete_ext): New.
* src/delete.c (delete_start): Change allow_secret argument to flags.
(gpgme_op_delete_ext, gpgme_op_delete_ext_start): New functions.
* src/engine-backend.h (delete): Change allow_secret argument to flags.
* src/engine.c (_gpgme_engine_op_delete): Likewise.
* src/engine.h (_gpgme_engine_op_delete): Likewise (for prototype).
* src/engine-gpgsm.c (gpgsm_delete): Likewise.
* src/engine-gpg.c (gpg_delete): Likewise.  Implement GPGME_DELETE_FORCE.
* src/gpgme.def (gpgme_op_delete_ext, gpgme_op_delete_ext_start): New.
* src/libgpgme.vers (gpgme_op_delete_ext, gpgme_op_delete_ext_start): New.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 2916

5 months agodoc: Clarify import keys operation.
Marcus Brinkmann [Thu, 10 Aug 2017 14:50:11 +0000 (16:50 +0200)]
doc: Clarify import keys operation.

* doc/gpgme.texi (gpgme_op_import_start): Fix grammar.
(gpgme_op_import_keys): Clarify some wording and fix result.
* src/import.c (gpgme_op_import_keys): Clarify comment.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3215

5 months agodoc: Add more tofu documentation.
Marcus Brinkmann [Thu, 10 Aug 2017 14:10:40 +0000 (16:10 +0200)]
doc: Add more tofu documentation.

* doc/gpgme.texi (gpgme_tofu_info_t): Document structure.
(gpgme_sigsum_t): Document GPGME_SIGSUM_TOFU_CONFLICT.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 2816

5 months agocore: Fix status parsing for decrypt + verify
Andre Heinecke [Thu, 27 Jul 2017 12:20:58 +0000 (14:20 +0200)]
core: Fix status parsing for decrypt + verify

* src/decrypt.c (parse_status_error): Don't modify args.

--
Otherwise chained status handlers will not see the full args
which resulted in a parse error in the verify status handler.

GnuPG-Bug-Id: T3310

5 months agocpp: Fix Key::isDeVs for subkeys
Andre Heinecke [Wed, 26 Jul 2017 13:07:27 +0000 (15:07 +0200)]
cpp: Fix Key::isDeVs for subkeys

* lang/cpp/src/key.cpp (Key::isDeVs): Check all subkeys.

--
Previosly only the primary key was checked and not all subkeys.

6 months agotests: Fix distcheck.
Justus Winter [Thu, 13 Jul 2017 14:06:27 +0000 (16:06 +0200)]
tests: Fix distcheck.

* tests/start-stop-agent: Remove backup file.

Fixes-commit: 9cd2b58dfb2c21cce64520cf4c726859b583d14e
Signed-off-by: Justus Winter <justus@g10code.com>
6 months agotests: Fix blunder.
Justus Winter [Thu, 13 Jul 2017 14:04:07 +0000 (16:04 +0200)]
tests: Fix blunder.

--
Fixes-commit: 9cd2b58dfb2c21cce64520cf4c726859b583d14e
Signed-off-by: Justus Winter <justus@g10code.com>
6 months agotests: Make agent spawning more robust.
Justus Winter [Thu, 13 Jul 2017 13:41:11 +0000 (15:41 +0200)]
tests: Make agent spawning more robust.

* tests/gpgsm/Makefile.am (gpgsm.conf): Add agent-program directive.
* tests/start-stop-agent: Update agent-program directive.
--
Update the 'agent-program' configuration directive to point to the
same agent that we are starting.  Previously, it was possible that a
different agent was started if 'make check' was run with a different
PATH.

Signed-off-by: Justus Winter <justus@g10code.com>
6 months agoSync 'autogen.sh'.
Justus Winter [Thu, 13 Jul 2017 13:30:38 +0000 (15:30 +0200)]
Sync 'autogen.sh'.

--
Signed-off-by: Justus Winter <justus@g10code.com>
6 months agotests: Fix printf compiler warning for an error case.
Werner Koch [Wed, 12 Jul 2017 16:32:50 +0000 (18:32 +0200)]
tests: Fix printf compiler warning for an error case.

* tests/gpg/t-keylist.c (main): Cast DIM to int.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocore: Return NO_SECKEY error code on decryption
Werner Koch [Wed, 12 Jul 2017 16:30:49 +0000 (18:30 +0200)]
core: Return NO_SECKEY error code on decryption

* src/decrypt.c (op_data_t): Add flag any_no_seckey.
(_gpgme_decrypt_status_handler): Consult that flag.
(_gpgme_decrypt_status_handler): Set that flag.
--

The NO_SECKEY is emitted instead of an "S ERROR pkdecrypt_failed" if
gpg knowns that a key has been encrypted to that key (cf. "S ENC_TO").
it is not fool proffof but in the majority of cases we can provide a
better error message than just DECRYPTION_FAILED.

GnuPG-bug-id: 3270
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocore: Return CANCELED and BAD_PASSPHRASE error code on decryption.
Werner Koch [Wed, 12 Jul 2017 15:55:43 +0000 (17:55 +0200)]
core: Return CANCELED and BAD_PASSPHRASE error code on decryption.

* src/decrypt.c (op_data_t): Add field pkdecrypt_failed.
(_gpgme_decrypt_status_handler): Consult new field.
(parse_status_error): Handle some error codes.
--

The idea is to return only a limited set of error codes because a user
won't be able to understand the more esoteric codes.

GnuPG-bug-id: 3270
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocore: Simplify parsing of STATUS_ERROR in decrypt.c
Werner Koch [Wed, 12 Jul 2017 13:59:12 +0000 (15:59 +0200)]
core: Simplify parsing of STATUS_ERROR in decrypt.c

* src/decrypt.c (_gpgme_decrypt_status_handler): Factor some code out
to ...
(parse_status_error): new.  Modernize parsing.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agodoc: Add list of copyright olders to AUTHORS.
Werner Koch [Wed, 12 Jul 2017 12:56:22 +0000 (14:56 +0200)]
doc: Add list of copyright olders to AUTHORS.

--

6 months agopython: Improve error handling.
Justus Winter [Tue, 11 Jul 2017 10:18:42 +0000 (12:18 +0200)]
python: Improve error handling.

* NEWS: Update.
* lang/python/src/core.py (Context.__read__): New helper function.
(Context.encrypt): Attach partial results to exceptions.
(Context.decrypt): Likewise.
(Context.sign): Likewise.
(Context.verify): Likewise.
* lang/python/src/errors.py (GpgError): Move the core of GPGMEError to
this class, add a nicer interface for it.  This makes the errors
thrown by this library more uniform, and allows us to track the
underlying error in synthesized high-level errors.
(GPGMEError): Simplify.
(...): Make sure to call the parent classes' constructor in all other
classes.
--

Attach partial results to errors.  Some operations return results even
though they signal an error.  Of course this information must be taken
with a grain of salt.  But often, this information is useful for
diagnostic uses or to give the user feedback.  Since the normal
control flow is disrupted by the exception, the callee can no longer
return results, hence we attach them to the exception objects.

GnuPG-bug-id: 3271
Signed-off-by: Justus Winter <justus@g10code.com>
6 months agoAdd isDeVs to ostream operator
Andre Heinecke [Mon, 10 Jul 2017 15:27:24 +0000 (17:27 +0200)]
Add isDeVs to ostream operator

* lang/cpp/src/decryptionresult.cpp,
lang/cpp/src/verificationresult.cpp: Extend ostream operator
to include isDeVs.

6 months agoFix some shadow warnings
Andre Heinecke [Mon, 10 Jul 2017 15:26:46 +0000 (17:26 +0200)]
Fix some shadow warnings

--
Warnings in headers hurt downstream.

7 months agocpp: Fix CMake config library name for GPGME
Andre Heinecke [Mon, 12 Jun 2017 13:25:33 +0000 (15:25 +0200)]
cpp: Fix CMake config library name for GPGME

* lang/cpp/src/GpgmeppConfig.cmake.in.in: The link library
is of course also dynamic.

--
GnuPG-Bug-Id: T3181

7 months agoAdd flag 'is_de_vs' to decryption results and signatures.
Justus Winter [Tue, 30 May 2017 12:35:57 +0000 (14:35 +0200)]
Add flag 'is_de_vs' to decryption results and signatures.

* NEWS: Update.
* lang/cpp/src/decryptionresult.cpp (DecryptionResult::isDeVs): New
function.
* lang/cpp/src/decryptionresult.h (DecryptionResult::isDeVs): New
prototype.
* lang/cpp/src/verificationresult.cpp (Signature::isDeVs): New
function.
* lang/cpp/src/verificationresult.h (Signature::isDeVs): New
prototype.
* lang/python/src/results.py (DecryptResult): Turn field 'is_de_vs'
into a boolean.
(Signature): Likewise.
* src/decrypt.c (_gpgme_decrypt_status_handler): Handle the new
compliance status line.
* src/verify.c (_gpgme_verify_status_handler): Likewise.
* src/gpgme.h.in (gpgme_status_code_t): Add new status codes for the
new status lines.
* src/keylist.c (parse_pub_field18): Move function to 'util.h'.
(keylist_colon_handler): Adapt callsites.
* src/status-table.c (status_table): Add new status lines.
* src/util.h (PARSE_COMPLIANCE_FLAGS): New macro.  This used to be
'parse_pub_field18', but turned into a macro to make it polymorphic.
--

When decrypting data and verifying signatures, report whether the
operations are in compliance with the criteria for data classified as
VS-NfD.  This information can the be presented to the user.

GnuPG-bug-id: 3059
Signed-off-by: Justus Winter <justus@g10code.com>
7 months agocore: Sort the status table.
Justus Winter [Tue, 30 May 2017 10:09:23 +0000 (12:09 +0200)]
core: Sort the status table.

--
Signed-off-by: Justus Winter <justus@g10code.com>
8 months agopython: Fix build in certain cases.
Justus Winter [Thu, 18 May 2017 09:42:13 +0000 (11:42 +0200)]
python: Fix build in certain cases.

* lang/python/setup.py.in: Prepend the Python build dir to the list of
include directories so that it takes precedence over any other include
directory.
--
Fixes the build in case an older 'gpgme.h' is installed and is picked
up by the compiler when compiling the Python module.

Signed-off-by: Justus Winter <justus@g10code.com>
8 months agotests: Remove remnants of 'check-local'.
Justus Winter [Wed, 10 May 2017 14:31:58 +0000 (16:31 +0200)]
tests: Remove remnants of 'check-local'.

* tests/gpgsm/Makefile.am (check-local): Drop rule and the dependency
on it.
--
Previously, the test environment was created during 'make check'.
Nowadays we create it using 'BUILT_SOURCES' during 'make all'.  Drop
remnant of the previous method.

Signed-off-by: Justus Winter <justus@g10code.com>
8 months agopython: Fix test environment creation.
Justus Winter [Wed, 10 May 2017 14:19:52 +0000 (16:19 +0200)]
python: Fix test environment creation.

* lang/python/tests/Makefile.am (pubring-stamp): Do not depend on the
configuration files, this can trigger superfluous rebuilds.

Signed-off-by: Justus Winter <justus@g10code.com>
8 months agotests: Make sure to kill all previously running daemons.
Justus Winter [Wed, 10 May 2017 13:52:12 +0000 (15:52 +0200)]
tests: Make sure to kill all previously running daemons.

* lang/python/tests/Makefile.am: Kill all previously running daemons
before creating the private key store.
* lang/qt/tests/Makefile.am: Likewise.
* tests/gpg/Makefile.am: Likewise.
* tests/gpgsm/Makefile.am: Likewise.
--

Now that the daemons sockets are no longer created in the GNUPGHOME,
we cannot rely on cleaning the build directory to make sure they are
shut down.  Therefore, we explicitly kill any running daemons when
creating the test environment.

Signed-off-by: Justus Winter <justus@g10code.com>
8 months agotests: Harmonize test suites.
Justus Winter [Wed, 10 May 2017 13:49:54 +0000 (15:49 +0200)]
tests: Harmonize test suites.

* lang/python/tests/Makefile.am: Create test environment as part of
'make all'.
* tests/gpg/Makefile.am: Make sure the private keystore is created
first.
* tests/gpgsm/Makefile.am: Create test environment as part of
'make all'.  Make sure the private keystore is created
first.

Signed-off-by: Justus Winter <justus@g10code.com>
8 months agoqt: Stop agent on clean.
Justus Winter [Wed, 10 May 2017 13:23:56 +0000 (15:23 +0200)]
qt: Stop agent on clean.

* lang/qt/tests/Makefile.am (clean-local): Stop agent.

Signed-off-by: Justus Winter <justus@g10code.com>
8 months agoqt: Add a missing include <functional>
Andre Heinecke [Wed, 10 May 2017 08:24:18 +0000 (10:24 +0200)]
qt: Add a missing include <functional>

* lang/qt/src/qgpgmenewcryptoconfig.cpp: Include functional.

--
This is intended to fix compilation against the c++ stdlib from
Gentoo / GCC 7.

Patch provided by Martin Väth.
GnuPG-Bug-Id: T3151

8 months agoqt: Undeprecate API that I find useful
Andre Heinecke [Wed, 10 May 2017 08:22:23 +0000 (10:22 +0200)]
qt: Undeprecate API that I find useful

* lang/qt/src/decryptjob.h,
lang/qt/src/decryptverifyjob.h,
lang/qt/src/signencryptjob.h,
lang/qt/src/verifydetachedjob.h,
lang/qt/src/verifyopaquejob.h: Undeprecate ByteArray based API.

--
While an IODevice may be more performant the ByteArray API is
a very easy way to get started with QGpgME as it allows you
basically to encrypt / decrypt any QString.

This also fixes a ton of deprecation warnings in KDE where this
API is used all over the place.

8 months agoqt, tests: Don't use internal API
Andre Heinecke [Wed, 10 May 2017 08:18:41 +0000 (10:18 +0200)]
qt, tests: Don't use internal API

* lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-tofuinfo.cpp:
Only use exported API.

--
With the Job::Context hack we no longer need to use internal API.

8 months agocore: Don't split gpgconf strings on comma
Andre Heinecke [Wed, 5 Apr 2017 16:23:48 +0000 (18:23 +0200)]
core: Don't split gpgconf strings on comma

* src/engine-gpgconf.c (gpgconf_parse_option): Don't split
strings on comma.

--
This only affects values where the main type is string. Values
with the alt_type string but another main type are still split
to keep lists (e.g. groups) working.

8 months agoqt, cpp: Add additional copyright BSI notes
Andre Heinecke [Tue, 25 Apr 2017 11:03:49 +0000 (13:03 +0200)]
qt, cpp: Add additional copyright BSI notes

* lang/cpp/Makefile.am,
lang/cpp/src/Makefile.am,
lang/cpp/src/callbacks.cpp,
lang/cpp/src/callbacks.h,
lang/cpp/src/configuration.cpp,
lang/cpp/src/configuration.h,
lang/cpp/src/context_glib.cpp,
lang/cpp/src/context_p.h,
lang/cpp/src/context_qt.cpp,
lang/cpp/src/context_vanilla.cpp,
lang/cpp/src/data_p.h,
lang/cpp/src/decryptionresult.cpp,
lang/cpp/src/decryptionresult.h,
lang/cpp/src/defaultassuantransaction.cpp,
lang/cpp/src/defaultassuantransaction.h,
lang/cpp/src/editinteractor.cpp,
lang/cpp/src/editinteractor.h,
lang/cpp/src/encryptionresult.cpp,
lang/cpp/src/encryptionresult.h,
lang/cpp/src/engineinfo.cpp,
lang/cpp/src/engineinfo.h,
lang/cpp/src/error.h,
lang/cpp/src/eventloopinteractor.cpp,
lang/cpp/src/eventloopinteractor.h,
lang/cpp/src/exception.cpp,
lang/cpp/src/exception.h,
lang/cpp/src/global.h,
lang/cpp/src/gpgadduserideditinteractor.cpp,
lang/cpp/src/gpgadduserideditinteractor.h,
lang/cpp/src/gpgagentgetinfoassuantransaction.cpp,
lang/cpp/src/gpgagentgetinfoassuantransaction.h,
lang/cpp/src/gpgmefw.h,
lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp,
lang/cpp/src/gpgsetexpirytimeeditinteractor.h,
lang/cpp/src/gpgsetownertrusteditinteractor.cpp,
lang/cpp/src/gpgsetownertrusteditinteractor.h,
lang/cpp/src/gpgsignkeyeditinteractor.cpp,
lang/cpp/src/gpgsignkeyeditinteractor.h,
lang/cpp/src/importresult.cpp,
lang/cpp/src/importresult.h,
lang/cpp/src/interfaces/assuantransaction.h,
lang/cpp/src/interfaces/dataprovider.h,
lang/cpp/src/interfaces/passphraseprovider.h,
lang/cpp/src/interfaces/progressprovider.h,
lang/cpp/src/keygenerationresult.cpp,
lang/cpp/src/keygenerationresult.h,
lang/cpp/src/keylistresult.cpp,
lang/cpp/src/keylistresult.h,
lang/cpp/src/notation.h,
lang/cpp/src/result.h,
lang/cpp/src/result_p.h,
lang/cpp/src/scdgetinfoassuantransaction.cpp,
lang/cpp/src/scdgetinfoassuantransaction.h,
lang/cpp/src/signingresult.cpp,
lang/cpp/src/signingresult.h,
lang/cpp/src/trustitem.cpp,
lang/cpp/src/trustitem.h,
lang/cpp/src/util.h,
lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h,
lang/cpp/src/vfsmountresult.cpp,
lang/qt/Makefile.am,
lang/qt/doc/Makefile.am,
lang/qt/src/Makefile.am,
lang/qt/src/defaultkeygenerationjob.h,
lang/qt/tests/Makefile.am: Add missing copyright.

--
Moving the qt / cpp bindings into GPGME contained global
changes that modified nearly every source file. To reflect
that the copyright year / note should also be updated.

8 months agoChange copyright from Intevation to BSI
Andre Heinecke [Tue, 25 Apr 2017 08:24:11 +0000 (10:24 +0200)]
Change copyright from Intevation to BSI

* lang/cpp/src/gpggencardkeyinteractor.cpp,
lang/cpp/src/gpggencardkeyinteractor.h,
lang/cpp/src/gpgmepp_export.h,
lang/cpp/src/swdbresult.cpp,
lang/cpp/src/swdbresult.h,
lang/cpp/src/tofuinfo.cpp,
lang/cpp/src/tofuinfo.h,
lang/qt/src/abstractimportjob.h,
lang/qt/src/adduseridjob.h,
lang/qt/src/changeexpiryjob.h,
lang/qt/src/changeownertrustjob.h,
lang/qt/src/changepasswdjob.h,
lang/qt/src/cryptoconfig.cpp,
lang/qt/src/cryptoconfig.h,
lang/qt/src/dataprovider.cpp,
lang/qt/src/dataprovider.h,
lang/qt/src/decryptjob.h,
lang/qt/src/decryptverifyjob.h,
lang/qt/src/deletejob.h,
lang/qt/src/dn.cpp,
lang/qt/src/dn.h,
lang/qt/src/downloadjob.h,
lang/qt/src/encryptjob.h,
lang/qt/src/exportjob.h,
lang/qt/src/hierarchicalkeylistjob.h,
lang/qt/src/importfromkeyserverjob.h,
lang/qt/src/importjob.h,
lang/qt/src/job.cpp,
lang/qt/src/job.h,
lang/qt/src/keyformailboxjob.h,
lang/qt/src/keygenerationjob.h,
lang/qt/src/keylistjob.h,
lang/qt/src/listallkeysjob.h,
lang/qt/src/multideletejob.h,
lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h,
lang/qt/src/qgpgme_export.h,
lang/qt/src/qgpgmeadduseridjob.cpp,
lang/qt/src/qgpgmeadduseridjob.h,
lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmebackend.h,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeexpiryjob.h,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.h,
lang/qt/src/qgpgmechangepasswdjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.h,
lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmedecryptjob.h,
lang/qt/src/qgpgmedecryptverifyjob.cpp,
lang/qt/src/qgpgmedecryptverifyjob.h,
lang/qt/src/qgpgmedeletejob.cpp,
lang/qt/src/qgpgmedeletejob.h,
lang/qt/src/qgpgmedownloadjob.cpp,
lang/qt/src/qgpgmedownloadjob.h,
lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmeencryptjob.h,
lang/qt/src/qgpgmeexportjob.cpp,
lang/qt/src/qgpgmeexportjob.h,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.h,
lang/qt/src/qgpgmeimportjob.cpp,
lang/qt/src/qgpgmeimportjob.h,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
lang/qt/src/qgpgmekeyformailboxjob.h,
lang/qt/src/qgpgmekeygenerationjob.cpp,
lang/qt/src/qgpgmekeygenerationjob.h,
lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmekeylistjob.h,
lang/qt/src/qgpgmelistallkeysjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.h,
lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmenewcryptoconfig.h,
lang/qt/src/qgpgmerefreshkeysjob.cpp,
lang/qt/src/qgpgmerefreshkeysjob.h,
lang/qt/src/qgpgmesecretkeyexportjob.cpp,
lang/qt/src/qgpgmesecretkeyexportjob.h,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.h,
lang/qt/src/qgpgmesignjob.cpp,
lang/qt/src/qgpgmesignjob.h,
lang/qt/src/qgpgmesignkeyjob.cpp,
lang/qt/src/qgpgmesignkeyjob.h,
lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.h,
lang/qt/src/qgpgmeverifydetachedjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.h,
lang/qt/src/qgpgmeverifyopaquejob.cpp,
lang/qt/src/qgpgmeverifyopaquejob.h,
lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/qgpgmewkspublishjob.h,
lang/qt/src/refreshkeysjob.h,
lang/qt/src/signencryptjob.h,
lang/qt/src/signjob.h,
lang/qt/src/signkeyjob.h,
lang/qt/src/specialjob.h,
lang/qt/src/threadedjobmixin.cpp,
lang/qt/src/threadedjobmixin.h,
lang/qt/src/tofupolicyjob.h,
lang/qt/src/verifydetachedjob.h,
lang/qt/src/verifyopaquejob.h,
lang/qt/src/wkspublishjob.h,
lang/qt/tests/run-keyformailboxjob.cpp,
lang/qt/tests/t-config.cpp,
lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp,
lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-support.cpp,
lang/qt/tests/t-support.h,
lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-various.cpp,
lang/qt/tests/t-verify.cpp,
lang/qt/tests/t-wkspublish.cpp,
tests/gpg/t-encrypt-mixed.c,
tests/gpg/t-thread-keylist-verify.c,
tests/gpg/t-thread-keylist.c,
tests/run-decrypt.c: Change Intevation GmbH copyright to BSI.

--
This should make it more transparent where the BSI is the actual
copyright holder as the code was mostly developed as part of a
development contract.

8 months agodoc: Improve doc on passphrase_cb / pinentry mode
Andre Heinecke [Mon, 24 Apr 2017 14:46:09 +0000 (16:46 +0200)]
doc: Improve doc on passphrase_cb / pinentry mode

* doc/gpgme.texi (Passphrase Callback): Mention pinentry_mode and
restrictions.
(Pinentry Mode): Fix wording and clarify versions that need
loopback mode for passphrase_cb to work.

8 months agotests: Update encrypted sample files.
Justus Winter [Mon, 24 Apr 2017 13:29:07 +0000 (15:29 +0200)]
tests: Update encrypted sample files.

* tests/gpg/cipher-1.asc: Update file.
* tests/gpg/cipher-2.asc: Likewise.
--
Convert the plaintext to UTF-8 and re-create the encrypted file.

Fixes-commit: a11450eb048df79a3f2b00ebef6d7cab07ad5054
Signed-off-by: Justus Winter <justus@g10code.com>
9 months agopython: Skip TOFU test if not supported by GnuPG.
Justus Winter [Tue, 11 Apr 2017 10:07:59 +0000 (12:07 +0200)]
python: Skip TOFU test if not supported by GnuPG.

* lang/python/tests/support.py (have_tofu_support): New function.
* lang/python/tests/t-quick-key-manipulation.py: Skip TOFU test if not
supported by GnuPG.

Signed-off-by: Justus Winter <justus@g10code.com>
9 months agopython: use autoconf pre-processor when building via autoconf
Alon Bar-Lev [Tue, 11 Apr 2017 00:56:00 +0000 (03:56 +0300)]
python: use autoconf pre-processor when building via autoconf

* configure.ac: Add AC_PROG_CPP.
* lang/python/Makefile.am: Set CPP environment for setup.py to use.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: fix run-tests missing python_libdir
Alon Bar-Lev [Mon, 10 Apr 2017 22:55:13 +0000 (01:55 +0300)]
python: fix run-tests missing python_libdir

* lang/python/tests/run-tests.py: Set python_libdir if --python-libdir
is set.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: Prune CLEANFILES.
Justus Winter [Mon, 10 Apr 2017 13:24:03 +0000 (15:24 +0200)]
python: Prune CLEANFILES.

--
Fixes-commit: e7d9c0c3d773f826dbd2ed417d04e25c410f3374
Signed-off-by: Justus Winter <justus@g10code.com>
9 months agopython: Fix distcheck.
Justus Winter [Mon, 10 Apr 2017 13:20:34 +0000 (15:20 +0200)]
python: Fix distcheck.

* lang/python/Makefile.am (uninstall-local): Explicitly request the
scheme 'posix_prefix'.  On Python2.7 the default scheme is
'posix_local', breaking distcheck.

Fixes-commit: 25e6444b3f4601c7821beab06bc4520deacb007b
Signed-off-by: Justus Winter <justus@g10code.com>
9 months agopython: Support alternatate libdir for tests
Alon Bar-Lev [Sat, 8 Apr 2017 13:34:33 +0000 (16:34 +0300)]
python: Support alternatate libdir for tests

* lang/python/tests/run-tests.py: Add --python-libdir optional
parameter.

--

This will make the python tests usable for downstream that build python
module outside of autotools build system.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: Read gpg-error.h using the pre-processor
Alon Bar-Lev [Sat, 8 Apr 2017 13:34:32 +0000 (16:34 +0300)]
python: Read gpg-error.h using the pre-processor

* lang/python/setup.py.in: Read gpg-error.h using the pre-processor.

--

The libgpg-error may be installed in multilib configuration in which
there is a wrapper header at /usr/include that includes the actual
header at /usr/include/*. This causes invalid errors.i generation.

Let the pre-processor extract the header content instead reading it
explicitly.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: Remove unneeded stats copy
Alon Bar-Lev [Sat, 8 Apr 2017 13:34:31 +0000 (16:34 +0300)]
python: Remove unneeded stats copy

* lang/python/setup.py.in: errors.i, gpgme.h are generated and always
newer than the original.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: Remove usage of PYTHON_VERSIONS
Alon Bar-Lev [Sat, 8 Apr 2017 13:34:30 +0000 (16:34 +0300)]
python: Remove usage of PYTHON_VERSIONS

* configure.ac: Remove PYTHON_VERSIONS subst.
* lang/python/Makefile.am: Use basename of python as builddir prefix.
* lang/python/tests/run-tests.py: Likewise.

--

Two variables needs be at sync PYTHONS and PYTHON_VERSIONS, these may go
out of sync in some cases, for example in Gentoo where default python is
3.4 we get:

PYTHON='/usr/bin/python2'
PYTHONS='/usr/bin/python /usr/bin/python2'
PYTHON_VERSIONS='2.7 3.4'

We can use the basename of the python interpreter to achieve similar
effect without having to sync indexes between these two variables.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agotests: Do not use check-local magic as dependency
Alon Bar-Lev [Fri, 7 Apr 2017 14:32:18 +0000 (17:32 +0300)]
tests: Do not use check-local magic as dependency

* tests/gpg/Makefile.am: Use BUILT_SOURCES instead of check-local
and initial.test.
* lang/qt/tests/Makefile.am: Ditto.

--

This fixes "make dist" failure when source tree is clean:
  git clean -dxf
  autoreconf -ivf
  ./configure
  make dist

BUILT_SOURCES should be used when file as generated without explicit
dependency. The check-local is all-am dependency, this means that it
will be resolved also in "make dist".

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: support .pydistutils.cfg mode
Alon Bar-Lev [Fri, 7 Apr 2017 14:31:47 +0000 (17:31 +0300)]
python: support .pydistutils.cfg mode

* lang/python/setup.py.in: Do not parse arguments.

--

The distutils settings can come from either command-line or
configuration file. Parsing parameters is not working in all cases.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: simplify build, some fixups
Alon Bar-Lev [Wed, 5 Apr 2017 16:47:08 +0000 (19:47 +0300)]
python: simplify build, some fixups

* lang/python/gpg/version.py.in: Rename to lang/python/version.py.in.
configure.ac: Generate version.py.in in lang/python.
* lang/python/MANIFEST.in: Include version.py explicitly.
* lang/python/gpg: Rename to 'src'.
* lang/python/Makefile.am: Do not copy source files, do not use absolute
directories, support lib64 in uninstall, clean also dist directory, use
symlink for gpg src.
* lang/python/setup.py.in: Use builddir, copy sources into builddir,
copy version.py into module.
--

Simplify build to symlink the gpg sources into builddir instead of
copying. This requires handling of version.py as generated file.

In addition apply some cleanups: Drop the absolution pathes, clean the
dist directory as well, support lib64 for sitelib at uninstall.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agopython: Fix vpath builds, fix distcheck.
Justus Winter [Mon, 3 Apr 2017 13:44:14 +0000 (15:44 +0200)]
python: Fix vpath builds, fix distcheck.

* lang/python/gpgme-h-clean.py: Delete file.
* lang/python/MANIFEST.in: Adapt accordingly.
* lang/python/Makefile.am (EXTRA_DIST): Likewise.
(COPY_FILES_GPG): Bring variable back.
(copystamp): Copy files.
(clean-local): Delete copied files.
(install-exec-local): Do not create and install list of installed
files.
(uninstall-local): Instead, create some explicit rules to uninstall
the extension.
* lang/python/setup.py.in: Parse arguments.  Locate files either in
the source directory, or in the build base directory.  Inline the code
from 'gpgme-h-clean.py'.  Copy 'helpers.c', add source directory as
include directory.

Fixes-commit: 801d7d8c5dd530d26ad6c4bcc94d986e6e022da4
Signed-off-by: Justus Winter <justus@g10code.com>
9 months agopython: Generate files into build directory
Alon Bar-Lev [Sat, 1 Apr 2017 23:29:52 +0000 (02:29 +0300)]
python: Generate files into build directory

* lang/python/setup.py.in: Generate files within BuildExtFirstHack
adjust build flags at this point instead of global.
* lang/python/Makefile.am: Remove logic of separate source directory per
python version in favor of build directory.
* lang/python/tests/run-tests.py: Adjust build directory location.
--

Generate files into build directory, leaving the source directory clean.
Use the same source directory for multiple python version build. Result
of 'prepare' target is a standard distutil layout that can be used
easily by downstream to build all python targets in-place.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agoFix typo.
Justus Winter [Wed, 5 Apr 2017 12:48:04 +0000 (14:48 +0200)]
Fix typo.

--
Signed-off-by: Justus Winter <justus@g10code.com>
9 months agoFreeBSD's closefrom(2) does not return errors
Pietro Cerutti [Mon, 3 Apr 2017 08:31:40 +0000 (08:31 +0000)]
FreeBSD's closefrom(2) does not return errors

9 months agoqt: pass fmt to gpgrt_asprintf()
Igor Gnatenko [Wed, 29 Mar 2017 05:20:51 +0000 (07:20 +0200)]
qt: pass fmt to gpgrt_asprintf()

* lang/qt/src/dn.cpp (parse_dn_part): Add fmt argument instead of
using name directly.

GnuPG-Bug-Id: 3023
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
9 months agopython: Don't treat skipped tests as error
Andre Heinecke [Thu, 30 Mar 2017 14:22:20 +0000 (16:22 +0200)]
python: Don't treat skipped tests as error

* lang/python/tests/run-tests.py (failed): Don't count skipped tests
for the return code.

9 months agopython: Fix skipping tests if running with GnuPG < 2.1.12.
Justus Winter [Thu, 30 Mar 2017 12:58:29 +0000 (14:58 +0200)]
python: Fix skipping tests if running with GnuPG < 2.1.12.

* final.py: Import 'support.py' for the side-effect of checking the
GnuPG version.
* t-data.py: Likewise.
* t-protocol-assuan.py: Likewise.
* t-wrapper.py: Likewise.
* t-callbacks.py: Avoid warning about 'support' being unused.
* t-edit.py: Likewise.
* t-encrypt-sym.py: Likewise.
* t-file-name.py: Likewise.
* t-idiomatic.py: Likewise.
* t-sig-notation.py: Likewise.
* t-trustlist.py: Likewise.
* t-verify.py: Likewise.
* t-wait.py: Likewise.
* t-keylist-from-data.py: Trim unused imports.

GnuPG-bug-id: 3008
Fixes-commit: 348da58fe0c3656e6177c98fef6b4c4331326c8e
Signed-off-by: Justus Winter <justus@g10code.com>
9 months agoqt: Handle if gpg does not support tofu in test
Andre Heinecke [Thu, 30 Mar 2017 12:36:49 +0000 (14:36 +0200)]
qt: Handle if gpg does not support tofu in test

* lang/qt/src/t-tofuinfo.cpp (TestTofuInfo::testSupported): Treat
it as unsupported if secret keylisting already fails.

--
The likely cause of this is that the agent can't be started
because the trust model is unsupported. Other tests check
that keylisting actually works.

9 months agopython,build: Reinstate prepare target.
Alon Bar-Lev [Tue, 28 Mar 2017 18:55:59 +0000 (21:55 +0300)]
python,build: Reinstate prepare target.

* lang/python/Makefile.am: Fix 'prepare' target.
* lang/python/setup.py.in: Use 'abs_top_builddir' instead of guessing
the path.
--

'prepare' will prepare target at PREPAREDIR.  The automake integration
will also make use of prepare target.  Downstream distributors may
also make use of prepare target.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
9 months agotests: Run the threading tests only on UNIX.
Justus Winter [Tue, 28 Mar 2017 14:32:09 +0000 (16:32 +0200)]
tests: Run the threading tests only on UNIX.

* tests/gpg/Makefile.am (tests_unix): Add 't-thread-keylist' and
't-thread-keylist-verify'.
(c_tests): Drop them here.
--

The tests use pthreads and we suspect problems with MinGW's wrappers.

Signed-off-by: Justus Winter <justus@g10code.com>
9 months agotests: Make error message more helpful.
Justus Winter [Tue, 28 Mar 2017 14:30:03 +0000 (16:30 +0200)]
tests: Make error message more helpful.

* tests/gpg/t-keylist.c (main): Print number of returned and expected
keys.

Signed-off-by: Justus Winter <justus@g10code.com>
9 months agoMerge branch 'gpgme-1.9-branch'
Werner Koch [Tue, 28 Mar 2017 14:49:42 +0000 (16:49 +0200)]
Merge branch 'gpgme-1.9-branch'

--

9 months agoPost release updates gpgme-1.9-branch
Werner Koch [Tue, 28 Mar 2017 14:38:06 +0000 (16:38 +0200)]
Post release updates

--

9 months agoRelease 1.9.0 gpgme-1.9.0
Werner Koch [Tue, 28 Mar 2017 14:21:37 +0000 (16:21 +0200)]
Release 1.9.0

* configure.ac <c>: Bump LT version to C29/A18/R0.
<cpp>: Bump LT version to C10/A4/R0.
<qt>: Bump LT version to C9/A2/R0.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agoRevert "qt: Disable testEncryptDecryptNowrap"
Andre Heinecke [Tue, 28 Mar 2017 10:34:28 +0000 (12:34 +0200)]
Revert "qt: Disable testEncryptDecryptNowrap"

This reverts commit 57d60b20f16dd5f1bccbbcaa0a6ed75a554a6414.

9 months agocore: Prepare for new key listing data send by gpg.
Werner Koch [Tue, 28 Mar 2017 09:40:44 +0000 (11:40 +0200)]
core: Prepare for new key listing data send by gpg.

* src/gpgme.h.in (gpgme_user_id_t): New fields 'origin' and
'last_update'.
(gpgme_key_t): New fields 'origin' and 'last_update'.
* src/conversion.c (_gpgme_parse_timestamp_ul): New.
* src/keylist.c (keylist_colon_handler): Parse fields 19 and 20.

* tests/run-keylist.c (main): Print new fields.

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agoqt: Disable testEncryptDecryptNowrap
Andre Heinecke [Mon, 27 Mar 2017 16:08:45 +0000 (18:08 +0200)]
qt: Disable testEncryptDecryptNowrap

* lang/qt/tests/t-encrypt.cpp (EncryptTest::testEncryptDecryptNowrap):
Disable test.

--
This test produces failures under CI/ASAN conditions as the
verify after the unwrap returns an error. As we currently
don't have time to look into this more it's disabled for now.
Similar to the testMixedEncryptDecrypt.

9 months agopython: Skip tests if running with GnuPG < 2.1.12.
Justus Winter [Mon, 27 Mar 2017 09:11:47 +0000 (11:11 +0200)]
python: Skip tests if running with GnuPG < 2.1.12.

* lang/python/tests/support.py (assert_gpg_version): Fix error
message.  Skip all tests when we use GnuPG older than 2.1.12.

GnuPG-bug-id: 3008
Signed-off-by: Justus Winter <justus@g10code.com>