gpgme.git
3 years agopython: Fix error handling.
Justus Winter [Tue, 7 Jun 2016 14:07:33 +0000 (16:07 +0200)]
python: Fix error handling.

* lang/python/gpgme.i: Fix freeing an uninitialized pointer in the
error handling of generated wrapper functions by explicitly storing
the pointer in a local variable which can be initialized.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Wrap file-like objects on demand.
Justus Winter [Mon, 6 Jun 2016 11:11:15 +0000 (13:11 +0200)]
python: Wrap file-like objects on demand.

* lang/python/gpgme.i (gpgme_data_t): Use new function to create
wrapper objects if necessary, and deallocate them after the function
call.
* lang/python/helpers.c (object_to_gpgme_data_t): New function.
* lang/python/helpers.h (object_to_gpgme_data_t): New prototype.
* lang/python/tests/Makefile.am (pytests): Add new test.
* lang/python/tests/t-idiomatic.py: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Move helper function.
Justus Winter [Thu, 2 Jun 2016 15:14:53 +0000 (17:14 +0200)]
python: Move helper function.

* lang/python/gpgme.i (object_to_gpgme_t): Move...
* lang/python/helpers.c: ... here.
* lang/python/helpers.h (object_to_gpgme_t): New prototype.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Fix error handling.
Justus Winter [Thu, 2 Jun 2016 13:32:35 +0000 (15:32 +0200)]
python: Fix error handling.

* lang/python/gpgme.i (object_to_gpgme_t): Properly propagate
exceptions.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Initialize GPGME for the user.
Justus Winter [Thu, 2 Jun 2016 13:18:40 +0000 (15:18 +0200)]
python: Initialize GPGME for the user.

* lang/python/pyme/core.py: Call 'check_version' and explain why.
* lang/python/tests/support.py (init_gpgme): Drop call here.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Drop obsolete VCS keywords.
Justus Winter [Mon, 6 Jun 2016 12:12:09 +0000 (14:12 +0200)]
python: Drop obsolete VCS keywords.

--
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Fix test suite with GnuPG prior to 2.1.12.
Justus Winter [Wed, 1 Jun 2016 13:40:49 +0000 (15:40 +0200)]
python: Fix test suite with GnuPG prior to 2.1.12.

* lang/python/tests/Makefile.am (gpg-agent.conf): Use
'allow-loopback-pinentry'.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Make Python detection more robust.
Justus Winter [Wed, 1 Jun 2016 13:33:52 +0000 (15:33 +0200)]
python: Make Python detection more robust.

Previously, missing Python development packages made configure fail
instead of merely disabling the bindings.

* configure.ac: Check for 'PYTHON_VERSION'.
* m4/ax_python_devel.m4: Make test non-fatal.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Improve build system integration, fix warnings.
Justus Winter [Wed, 1 Jun 2016 12:16:27 +0000 (14:16 +0200)]
python: Improve build system integration, fix warnings.

* lang/python/Makefile.am: Pass CFLAGS to python build system.
* lang/python/helpers.c (pyPassphraseCb): Use correct type for length.
(pygpgme_data_new_from_cbs): Drop unused variable.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agoCpp: Use whitelist for status messages
Andre Heinecke [Wed, 1 Jun 2016 11:46:27 +0000 (13:46 +0200)]
Cpp: Use whitelist for status messages

* lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse):
Use whitelist instead of blacklist.

--
This should be more robust when new status messages are added.
The whitelist is the same GPA uses. Fixes Qt's t-ownertrust.

3 years agoQt: Fix debug output in t-ownertrust
Andre Heinecke [Wed, 1 Jun 2016 08:01:43 +0000 (10:01 +0200)]
Qt: Fix debug output in t-ownertrust

* lang/qt/tests/t-ownertrust.cpp (testChangeOwnerTrust): Remove
general debug of trust level. Add debug output for error.

3 years agotests: Fix notation tests.
Justus Winter [Wed, 1 Jun 2016 10:50:32 +0000 (12:50 +0200)]
tests: Fix notation tests.

* lang/python/tests/t-sig-notation.py (check_result): Check critical
flag.
* tests/gpg/t-sig-notation.c (check_result): Likewise.

Fixes-commit: 1cacd7d0
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agocore: Set notation flags for verify.
Werner Koch [Wed, 1 Jun 2016 09:10:30 +0000 (11:10 +0200)]
core: Set notation flags for verify.

* src/gpgme.h.in (GPGME_STATUS_NOTATION_FLAGS): New.
* src/status-table.c (status_table): Add new status.
* src/verify.c (parse_notation): Handle flags.  Also fix NOTATION_DATA
in case gpg would not percent-escape spaces.
(_gpgme_verify_status_handler): Handle flags.
* tests/run-verify.c (print_result): Print notaion data.
--

Note that this does only work with the soon to be released GnuPG
2.1.13.

3 years agopython: use GPG_ERROR_CONFIG variable
Tobias Mueller [Tue, 31 May 2016 12:41:12 +0000 (14:41 +0200)]
python: use GPG_ERROR_CONFIG variable

instead of calling gpg-error-config.
This is useful when configuring with --with-gpgerror-prefix
because then GPG_ERROR_CONFIG contains the correct
/path/to/bin/gpg-error-config whereas calling gpg-error-config
directly would look in the user's PATH (and not in the prefix
where gpg-error-config was installed).

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Port more tests.
Justus Winter [Tue, 31 May 2016 14:21:06 +0000 (16:21 +0200)]
python: Port more tests.

* lang/python/gpgme.i: Hide length fields of notations.
* lang/python/tests/Makefile.am (pytests): Add new tests.
* lang/python/tests/t-decrypt-verify.py: New file.
* lang/python/tests/t-sig-notation.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agobuild: Fix URL.
Justus Winter [Tue, 31 May 2016 09:01:36 +0000 (11:01 +0200)]
build: Fix URL.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoSpeedup closing of fds before exec.
Werner Koch [Fri, 27 May 2016 20:19:35 +0000 (22:19 +0200)]
Speedup closing of fds before exec.

* src/posix-io.c [__linux__]: Include dirent.h.
(get_max_fds) [__linux__]: Try to figure out the highest used fd.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agopython: Port more tests.
Justus Winter [Fri, 27 May 2016 13:58:23 +0000 (15:58 +0200)]
python: Port more tests.

* lang/python/pyme/core.py (Data._error_check): Add
'gpgme_data_get_file_name' to the list of functions not returning an
error code.
* lang/python/tests/Makefile.am (pytests): Add new tests.
* lang/python/tests/support.py (verbose): New variable.
* lang/python/tests/t-data.py: Test setting and getting the filename.
* lang/python/tests/t-encrypt-large.py: New file.
* lang/python/tests/t-file-name.py: Likewise.
* lang/python/tests/t-trustlist.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agosrc: Fix typo.
Justus Winter [Fri, 27 May 2016 13:46:17 +0000 (15:46 +0200)]
src: Fix typo.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agotests: Fix test.
Justus Winter [Fri, 27 May 2016 13:27:55 +0000 (15:27 +0200)]
tests: Fix test.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Implement data callbacks.
Justus Winter [Fri, 27 May 2016 12:04:28 +0000 (14:04 +0200)]
python: Implement data callbacks.

* lang/python/gpgme.i (object_to_gpgme_t): Set exception on error.
* lang/python/helpers.c (pyDataReadCb): New function.
(pyDataWriteCb): Likewise.
(pyDataSeekCb): Likewise.
(pyDataReleaseCb): Likewise.
(pygpgme_data_new_from_cbs): Likewise.
* lang/python/helpers.h (pygpgme_data_new_from_cbs): New prototype.
* lang/python/pyme/core.py (Data.__init__): Fix docstring, fix read
callbacks.
(Data.__del__): Fix read callbacks.
(Data._free_readcb): Drop function.
(Data._free_datacbs): New function.
(Data.new_from_cbs): Fix setting the callbacks.
(Data.write): Raise stashed exceptions.
(Data.read): Likewise.
* lang/python/tests/t-callbacks.py: Test new functionality.
* lang/python/tests/t-data.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix object deallocation.
Justus Winter [Fri, 27 May 2016 10:25:59 +0000 (12:25 +0200)]
python: Fix object deallocation.

Handing a reference to the wrapper object created a non-trivial
circular reference that Pythons garbage collector is unable to break.
Explicitly break it by using a weak reference.

* lang/python/helpers.c (pygpgme_stash_callback_exception): Retrieve
object from weak reference.
* lang/python/pyme/core.py (Context.__del__): Free status callback.
(Context.set_passphrase_cb): Use a weak reference.
(Context.set_progress_cb): Likewise.
(Context.set_status_cb): Likewise.
(Context.op_edit): Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoImprove comments.
Justus Winter [Fri, 27 May 2016 10:19:52 +0000 (12:19 +0200)]
Improve comments.

* src/gpgme.h.in (gpgme_data_seek_cb_t, gpgme_data_seek): Clarify that
these functions return the new offset.
(gpgme_data_release_cb_t): Fix name of parameter.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix reading data from existing files.
Justus Winter [Wed, 25 May 2016 10:47:28 +0000 (12:47 +0200)]
python: Fix reading data from existing files.

* lang/python/pyme/core.py (Data.__init__): Add 'copy' kwargument, and
pass it to functions supporting it.  PEP8 fix.
(Data.new_from_fd): PEP8 fix.
(Data.new_from_file): Give a more helpful error message if copy is
False.  PEP8 fix.
(Data.new_from_fd): Hand the file descriptor to
'gpgme_data_new_from_fd', not a stream.  Fix docstring.
* lang/python/tests/t-data.py: Add tests for this.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agosrc: Fix trace string.
Justus Winter [Wed, 25 May 2016 10:45:25 +0000 (12:45 +0200)]
src: Fix trace string.

* src/data-compat.c (gpgme_data_new_from_file): Fix trace string.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Improve and test Context.wait.
Justus Winter [Tue, 24 May 2016 15:57:10 +0000 (17:57 +0200)]
python: Improve and test Context.wait.

* lang/python/pyme/core.py (Context.wait): Improve docstring.  As the
context passed to 'gpgme_wait' is never NULL, it is pointless to look
at the returned context.  Always raise exceptions.
* lang/python/tests/Makefile.am (pytests): Add new test.
* lang/python/tests/t-wait.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Make all GnuPG errors available.
Justus Winter [Tue, 24 May 2016 15:22:08 +0000 (17:22 +0200)]
python: Make all GnuPG errors available.

* lang/python/Makefile.am (errors.i): Generate file.
* lang/python/gpgme.i: Include generated file.
* lang/python/pyme/errors.py: Pull in all errors and error sources.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Move the base wrapper class.
Justus Winter [Tue, 24 May 2016 14:45:39 +0000 (16:45 +0200)]
python: Move the base wrapper class.

* python/lang/pyme/util.py (GpgmeWrapper): Move...
* python/lang/pyme/core.py: ... here.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Support status callbacks.
Justus Winter [Tue, 24 May 2016 13:14:53 +0000 (15:14 +0200)]
python: Support status callbacks.

* lang/python/helpers.c (pyStatusCb): New function.
(pygpgme_set_status_cb): Likewise.
* lang/python/helpers.h (pygpgme_set_status_cb): New prototype.
* lang/python/pyme/core.py (Context.__init__): Initialize
'last_statuscb'.
(Context._free_statuscb): New function.
(Context.set_status_cb): Likewise.
* lang/python/tests/t-callbacks.py: Test status callbacks.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Improve docstring.
Justus Winter [Tue, 24 May 2016 13:12:40 +0000 (15:12 +0200)]
python: Improve docstring.

* lang/python/pyme/core.py (Context.set_progress_cb): Improve
docstring.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoQt: Fix test build with clang
Andre Heinecke [Tue, 24 May 2016 14:00:42 +0000 (16:00 +0200)]
Qt: Fix test build with clang

* lang/qt/tests/Makefile.am (LDADD): Explicitly add -lstdc++

--
g++ does not need that but clang does need it explicitly

3 years agoCpp: Set -std=c++11 also if CXXCPP is already set
Andre Heinecke [Tue, 24 May 2016 12:10:16 +0000 (14:10 +0200)]
Cpp: Set -std=c++11 also if CXXCPP is already set

* m4/ax_cxx_compile_stdxx.m4 (AX_CXX_COMPILE_STDCXX): Set CXXCPP if
neccessary.

--
This fixes the build with scan-build where CXXCPP is already set but
does not include stdc++11. While this deviates from the
autotools-archive version of the script it does not make sense
to me first to check if stdc++11 needs to be set and then not
set it.

3 years agopython: Improve support for edit callbacks.
Justus Winter [Tue, 24 May 2016 10:29:32 +0000 (12:29 +0200)]
python: Improve support for edit callbacks.

* lang/python/helpers.c (pyEditCb): Stash exceptions.
* lang/python/pyme/core.py (Context.op_edit): Hand in 'self'.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-callbacks.py: Test edit callbacks.
* lang/python/tests/t-edit.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix hook.
Justus Winter [Mon, 23 May 2016 16:23:34 +0000 (18:23 +0200)]
python: Fix hook.

* lang/python/helpers.c (pyProgressCb): Fix getting hook data.
* lang/python/tests/t-callbacks.py: Show that this works.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Move edit callback function.
Justus Winter [Mon, 23 May 2016 16:09:22 +0000 (18:09 +0200)]
python: Move edit callback function.

* lang/python/gpgme.i (pyEditCb): Move...
* lang/python/helpers.c: ... here.
* lang/python/helpers.h (pyEditCb): New prototype.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Port more tests.
Justus Winter [Mon, 23 May 2016 13:42:14 +0000 (15:42 +0200)]
python: Port more tests.

* lang/python/tests/Makefile.am (TESTS_ENVIRONMENT): Set
LD_LIBRARY_PATH.
(pytests): Add new tests.
* lang/python/tests/t-callbacks.py: Trim imports.
* lang/python/tests/t-encrypt-sign.py: New file.
* lang/python/tests/t-export.py: Likewise.
* lang/python/tests/t-signers.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Translate list of strings.
Justus Winter [Mon, 23 May 2016 13:41:06 +0000 (15:41 +0200)]
python: Translate list of strings.

* lang/python/gpgme.i: Add typemap translating list of strings.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoapi: Return Tofu info for signatures.
Werner Koch [Sat, 21 May 2016 08:29:49 +0000 (10:29 +0200)]
api: Return Tofu info for signatures.

* src/gpgme.h.in (gpgme_tofu_policy_t): New.
(gpgme_status_code_t): Add status codes for TOFU.
(struct _gpgme_tofu_info, gpgme_tofu_info_t): New.
(struct _gpgme_signature): Add field 'tofu'.
* src/status-table.c (status_table): Add new codes.
* src/verify.c: Include limits.h.
(release_tofu_info): New.
(release_op_data): Call that.
(parse_tofu_user): New.
(parse_tofu_stats): New.
(parse_tofu_stats_long): New.
(_gpgme_verify_status_handler): Handle TOFU status lines.

* tests/run-verify.c (print_description): New.
(print_result): print tofu info.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoapi: Add new context flag "raw-description".
Werner Koch [Sat, 21 May 2016 08:22:57 +0000 (10:22 +0200)]
api: Add new context flag "raw-description".

* src/context.h (struct gpgme_context): Add field raw_description.
* src/gpgme.c (gpgme_set_ctx_flag): New flag.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocore: New functions to help parsing of status lines.
Werner Koch [Sat, 21 May 2016 08:21:06 +0000 (10:21 +0200)]
core: New functions to help parsing of status lines.

* src/conversion.c (_gpgme_split_fields): New.
(_gpgme_strtoul_field): New.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoQt: Add test for changeownertrust
Andre Heinecke [Fri, 20 May 2016 14:04:50 +0000 (16:04 +0200)]
Qt: Add test for changeownertrust

* lang/qt/tests/t-ownertrust.cpp: New test.
* lang/qt/tests/Makefile.am: Add test.

--
This test would have catched the issue created by not handling
GPGME_STATUS_KEY_CONSIDERED.

3 years agoCpp: Ignore STATUS_KEY_CONSIDERED when editing
Andre Heinecke [Fri, 20 May 2016 14:03:08 +0000 (16:03 +0200)]
Cpp: Ignore STATUS_KEY_CONSIDERED when editing

* lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse):
Handle GPGME_STATUS_KEY_CONSIDERED.

3 years agoapi: Add new function gpgme_set_ctx_flag.
Werner Koch [Thu, 19 May 2016 15:01:07 +0000 (17:01 +0200)]
api: Add new function gpgme_set_ctx_flag.

* src/gpgme.h.in (gpgme_set_ctx_flag): New prototype.
* src/gpgme.c (gpgme_set_ctx_flag): New.
* src/gpgme.def, src/libgpgme.vers: Add new function.
* src/context.h (struct gpgme_context): Add FULL_STATUS.
* src/decrypt.c (_gpgme_decrypt_status_handler): Do not call the
  status callback if FULL_STATUS is set.
* src/genkey.c (genkey_status_handler): Ditto.
* src/passphrase.c (_gpgme_passphrase_status_handler): Ditto.
* src/sign.c (_gpgme_sign_status_handler): Ditto.

* src/engine-backend.h (struct engine_ops): Add SET_STATUS_CB and add
adjust all definitions of that variable.
* src/engine.c (_gpgme_engine_set_status_cb): New.
* src/op-support.c (_gpgme_op_reset): Call this function.

* src/engine-gpg.c (struct engine_gpg): Add fields MON_CB and
MON_CB_VALUE.
(gpg_set_status_cb): New.
(_gpgme_engine_ops_gpg): Register that function.
(read_status): Call the monitor callback.

* src/engine-gpgsm.c (struct engine_gpgsm): Add fields MON_CB and
MON_CB_VALUE.
(_gpgme_engine_ops_gpgsm): Register that function.
(gpgsm_assuan_simple_command): Change first arg to be an engine
context and adjust call callers.  Call the monitor callback.

* src/engine-uiserver.c (struct engine_uiserver): Add fields MON_CB
and MON_CB_VALUE.
(_gpgme_engine_ops_uiserver): Register that function.
(uiserver_assuan_simple_command): Change first arg to be an engine
context and adjust call callers.  Call the monitor callback.

* tests/run-verify.c (status_cb): New.
(print_result): Print algo names.
(main): Add option --status.
--

This new feature is mainly intended for bug tracking.  Having access
to the raw status lines might also be useful for applications, though.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoapi: Remove arbitrary restriction from gpgme_op_verify.
Werner Koch [Thu, 19 May 2016 12:26:22 +0000 (14:26 +0200)]
api: Remove arbitrary restriction from gpgme_op_verify.

* src/verify.c (verify_start): Do not return GPG_ERR_INV_VALUES when
when SIGNED_TEXT is not given.
--

The original idea behind this restriction probably was that it is
useless to verify a non-detached signatures without also returning the
signed text.  However, it is sometimes useful to just check the
signature, for example to see who signed it.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agopython: Improve progress callbacks.
Justus Winter [Thu, 19 May 2016 13:53:19 +0000 (15:53 +0200)]
python: Improve progress callbacks.

* lang/python/helpers.c (pyProgressCb): Stash python errors, convert
'what' to Unicode object.
* lang/python/pyme/core.py (Context.set_progress_cb): Hand in 'self'.
* lang/python/tests/t-callbacks.py: Test progress callbacks.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Robust exception handling in callbacks.
Justus Winter [Thu, 19 May 2016 09:03:27 +0000 (11:03 +0200)]
python: Robust exception handling in callbacks.

* lang/python/helpers.c (pygpgme_stash_callback_exception): New
function.
(pygpgme_raise_callback_exception): Likewise.
(pyPassphraseCb): Stash python errors.
* lang/python/helpers.h (pygpgme_raise_callback_exception): New
prototype.
* lang/python/pyme/core.py ({Context,Data}.__init__): Move common
initialization to superclass.
(Context.set_progress_cb): Hand in 'self'.
* lang/python/pyme/util.py (GpgmeWrapper.__init__): New function.
(GpgmeWrapper.__getattr__): Raise stashed exceptions.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-callbacks.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoQt: Check for graphviz and set HAVE_DOT correctly
Andre Heinecke [Thu, 19 May 2016 09:14:24 +0000 (11:14 +0200)]
Qt: Check for graphviz and set HAVE_DOT correctly

* configure.ac: Check for graphviz and define HAVE_DOT.
* lang/qt/doc/Doxyfile.in (HAVE_DOT): Use variable.

3 years agopython: Add more tests.
Justus Winter [Wed, 18 May 2016 13:33:36 +0000 (15:33 +0200)]
python: Add more tests.

* lang/python/tests/Makefile.am (py_tests): Add new tests.
* lang/python/tests/support.py (print_data): New function.
* lang/python/tests/t-decrypt.py: Use new function.
* lang/python/tests/t-encrypt.py: Likewise.
* lang/python/tests/t-sign.py: New file.
* lang/python/tests/t-encrypt-sym.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: More type conversion fixes.
Justus Winter [Thu, 19 May 2016 08:55:34 +0000 (10:55 +0200)]
python: More type conversion fixes.

* lang/python/helpers.c (pyPassphraseCb): Cope with 'uid_hint' being
NULL, convert it to an Unicode object, and cope with the callback
returning both Unicode and bytes objects.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix import.
Justus Winter [Thu, 19 May 2016 08:49:43 +0000 (10:49 +0200)]
python: Fix import.

* lang/python/helpers.c (pygpgme_exception_init): Make module import
relative.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoQt: Fix compilation of unit tests
Andre Heinecke [Thu, 19 May 2016 08:56:49 +0000 (10:56 +0200)]
Qt: Fix compilation of unit tests

* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Add -DBUILDING_QGPGME.

--
Without building QGpgME the headers of gpgme++ are not included
corretly and taken from an already installed gpgme++.

3 years agopython: Various fixes.
Justus Winter [Wed, 18 May 2016 11:17:59 +0000 (13:17 +0200)]
python: Various fixes.

* configure.ac: Fix SWIG detection, bump required Python version.
* lang/python/Makefile.am: Portability fix.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoFix typo in compatibility declaration
Andre Heinecke [Wed, 18 May 2016 13:27:32 +0000 (15:27 +0200)]
Fix typo in compatibility declaration

* src/op-support.c (GPG_ERR_SUBKEYS_EXP_REV): Change to
GPG_ERR_SUBKEYS_EXP_OR_REV.

--
This fixes the build with libgpg-error < 1.23

3 years agotests: New maintenance helper run-encrypt.
Werner Koch [Tue, 17 May 2016 17:59:51 +0000 (19:59 +0200)]
tests: New maintenance helper run-encrypt.

* tests/run-encrypt.c: New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoReturn dedicated error code for all subkeys expired or revoked.
Werner Koch [Tue, 17 May 2016 18:21:01 +0000 (20:21 +0200)]
Return dedicated error code for all subkeys expired or revoked.

* src/gpgme.h.in (GPGME_STATUS_KEY_CONSIDERED): New.
(GPGME_SIGSUM_TOFU_CONFLICT): New.
* src/status-table.c (KEY_CONSIDERED): New.
* src/op-support.c (_gpgme_parse_inv_recp): Add argc KC_FPR and
KC_FLAGS.  Use calloc.  Detect all expired or revoked subkeys.
(_gpgme_parse_key_considered): New.
* src/sign.c (op_data_t): Add fields KC_FPR and KC_FLAGS.
(release_op_data): Free KC_FPR.
(_gpgme_sign_status_handler): Handle STATUS_KEY_CONSIDERED.
* src/encrypt.c (op_data_t): Add fields KC_FPR and KC_FLAGS.
(release_op_data): Free KC_FPR.
(_gpgme_encrypt_status_handler): Handle STATUS_KEY_CONSIDERED.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoQt / Cpp: Port auto_ptr to unique_ptr
Andre Heinecke [Tue, 17 May 2016 15:49:56 +0000 (17:49 +0200)]
Qt / Cpp: Port auto_ptr to unique_ptr

* lang/cpp/src/context.cpp,
lang/cpp/src/context.h,
lang/cpp/src/context_p.h (Context::createForEngine),
(Context::edit, Context::startEditing),
(Context::takeLastEditInteractor, Context::cardEdit),
(Context::startCardEditing, Context::takeLastCardEditInteractor),
(Context::assuanTransact, Context::startAssuanTransaction),
(Context::takeLastAssuanTransaction): Port to unique_ptr.
* lang/qt/src/qgpgmeadduseridjob.cpp,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.cpp,
lang/qt/src/qgpgmesignkeyjob.cpp: Update accordingly.

--
This is another API break but as we already broke API with GpgME++
and QGpgME from KDE Frameworks this is a good time to do this
to avoid using a deprected C++ class in the API.

3 years agopython: Delete duplicated license texts/
Werner Koch [Tue, 17 May 2016 14:57:11 +0000 (16:57 +0200)]
python: Delete duplicated license texts/

--

3 years agobuild: Add python autoconf macro.
Justus Winter [Tue, 17 May 2016 14:34:39 +0000 (16:34 +0200)]
build: Add python autoconf macro.

* m4/ax_python_devel.m4: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoMerge branch 'master' of git+ssh://playfair.gnupg.org/git/gpgme
Justus Winter [Tue, 17 May 2016 13:13:46 +0000 (15:13 +0200)]
Merge branch 'master' of git+ssh://playfair.gnupg.org/git/gpgme

3 years agoMerge branch 'justus/pyme3'
Justus Winter [Tue, 17 May 2016 13:10:28 +0000 (15:10 +0200)]
Merge branch 'justus/pyme3'

3 years agoTrailing white space cleanup for 2 files in tests/.
Werner Koch [Tue, 17 May 2016 12:33:49 +0000 (14:33 +0200)]
Trailing white space cleanup for 2 files in tests/.

--

3 years agopython: Clean up examples.
Justus Winter [Tue, 17 May 2016 12:15:21 +0000 (14:15 +0200)]
python: Clean up examples.

* lang/python/examples/delkey.py: Clean up example.
* lang/python/examples/encrypt-to-all.py: Likewise.
* lang/python/examples/genkey.py: Likewise.
* lang/python/examples/inter-edit.py: Likewise.
* lang/python/examples/sign.py: Likewise.
* lang/python/examples/signverify.py: Likewise.
* lang/python/examples/simple.py: Likewise.
* lang/python/examples/t-edit.py: Likewise.
* lang/python/examples/verifydetails.py: Likewise.
* lang/python/pyme/__init__.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Import GPGMEError.
Justus Winter [Tue, 17 May 2016 12:14:25 +0000 (14:14 +0200)]
python: Import GPGMEError.

* pyme/core.py: Import GPGMEError.

Fixes c5d118b2.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Port more tests.
Justus Winter [Tue, 17 May 2016 11:46:44 +0000 (13:46 +0200)]
python: Port more tests.

* lang/python/Makefile.am: Add bits from the c test suite.
* lang/python/support.py: New file.
* lang/python/t-decrypt.py: Likewise.
* lang/python/t-encrypt.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoQt: Add keyLocateJob and test for it
Andre Heinecke [Fri, 13 May 2016 11:16:12 +0000 (13:16 +0200)]
Qt: Add keyLocateJob and test for it

* configure.ac (LIBQGPGME_LT_REVISION): Bump.
* lang/qt/src/protocol.h (locateKeysJob): Add Job.
* lang/qt/src/protocol_p.h (locateKeysJob): Implement.
* lang/qt/tests/Makefile.am: Add t-keylocate.
* lang/qt/tests/t-keylocate.cpp: New.

3 years agoQt: Add missing copyright header in test
Andre Heinecke [Fri, 13 May 2016 10:52:52 +0000 (12:52 +0200)]
Qt: Add missing copyright header in test

* lang/qt/tests/t-keylist.cpp: Add copyright header.

3 years agopython: Share generated methods between objects. justus/pyme3
Justus Winter [Thu, 12 May 2016 16:29:04 +0000 (18:29 +0200)]
python: Share generated methods between objects.

* lang/python/pyme/util.py (GpgmeWrapper.__getattr__): Monkey-patch
the class.
* lang/python/tests/t-wrapper.py: Demonstrate the sharing.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Raise exceptions on write errors.
Justus Winter [Thu, 12 May 2016 16:00:16 +0000 (18:00 +0200)]
python: Raise exceptions on write errors.

* lang/python/pyme/core.py (Data.write): Handle errors.
* lang/python/pyme/errors.py (GPGMEError.fromSyserror): New function.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix writing to data buffers.
Justus Winter [Thu, 12 May 2016 15:44:54 +0000 (17:44 +0200)]
python: Fix writing to data buffers.

* lang/python/gpgme.i: Add typemap for buffers.
* lang/python/pyme/core.py (Data.write): Fix function.
* lang/python/tests/Makefile.am: Add new test.
* lang/python/tests/t-data.py: New file.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Add a test suite.
Justus Winter [Thu, 12 May 2016 13:27:50 +0000 (15:27 +0200)]
python: Add a test suite.

* configure.ac: Add new Makefile.
* lang/python/Makefile.am: Add subdirectory.
* lang/python/tests/Makefile.am: New file.
* lang/python/tests/t-wrapper.py: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Cache generated wrapper functions.
Justus Winter [Thu, 12 May 2016 12:57:42 +0000 (14:57 +0200)]
python: Cache generated wrapper functions.

* lang/python/util.py (GpgmeWrap.__getattr__): Cache generated wrapper
functions.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix function invocation.
Justus Winter [Thu, 12 May 2016 10:54:15 +0000 (12:54 +0200)]
python: Fix function invocation.

* lang/python/pyme/core.py (Data.new_from_fd): Fix function
invocation.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix name of exception, make slot methods explicit.
Justus Winter [Thu, 12 May 2016 10:51:30 +0000 (12:51 +0200)]
python: Fix name of exception, make slot methods explicit.

* lang/python/pyme/util.py (GpgmeWrapper._getctype): Fix exception,
add docstring.
(GpgmeWrapper._getnameprepend): New function.
(GpgmeWrapper._errorcheck): Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Handle interpreter shutdown.
Justus Winter [Thu, 12 May 2016 09:53:43 +0000 (11:53 +0200)]
python: Handle interpreter shutdown.

* lang/python/pyme/core.py: Avoid races at interpreter shutdown.  This
silences the most annoying occurrences, however this problem also
affects the SWIG generated code, which might indicate that the real
problem is somewhere else.  If so, this change can be easily reverted.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Make test case more robust.
Justus Winter [Thu, 12 May 2016 09:51:21 +0000 (11:51 +0200)]
python: Make test case more robust.

* lang/python/examples/t-edit.py: Check if key is found.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Fix type translation.
Justus Winter [Thu, 12 May 2016 09:21:58 +0000 (11:21 +0200)]
python: Fix type translation.

* lang/python/gpgme.i: Adjust to Python3's string type being
'Unicode', not 'bytes'.  Fix type checking.
* lang/python/core.py (Data.write): Add docstring mentioning the
expected type of parameter 'buffer'.
(Data.read): Adjust read loop.  Also, use a saner chunk size, and join
all chunks at the end instead of adding them.
* lang/python/examples/simple.py: Adjust example.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoCpp: Ensure gpgme.h is taken from current build
Andre Heinecke [Wed, 11 May 2016 12:56:20 +0000 (14:56 +0200)]
Cpp: Ensure gpgme.h is taken from current build

* lang/cpp/src/Makefile.am (AM_CPPFLAGS): Add gpgme.h location.
--
This fixes the build in case an incompatible gpgme.h is also
installed in other include locations.

3 years agopython: Fix simple example.
Justus Winter [Wed, 11 May 2016 11:51:40 +0000 (13:51 +0200)]
python: Fix simple example.

* lang/python/examples/simple.py: Flush stdout, encode name as
UTF-8 before passing it to GPGME.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Integrate into the build system.
Justus Winter [Wed, 11 May 2016 09:42:00 +0000 (11:42 +0200)]
python: Integrate into the build system.

* configure.ac: Make Python bindings configurable, add new Makefile.
* lang/python/Makefile.am: New file.
* lang/python/setup.py: Integrate into the build system.
* m4/ax_pkg_swig.m4: New file from the autoconf archive.
* m4/m4_ax_swig_python.m4: Likewise.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoMerge branch 'gpgmepp'
Andre Heinecke [Tue, 10 May 2016 14:43:36 +0000 (16:43 +0200)]
Merge branch 'gpgmepp'

3 years agoQt / Cpp: Fix make dist gpgmepp
Andre Heinecke [Tue, 10 May 2016 13:05:11 +0000 (15:05 +0200)]
Qt / Cpp: Fix make dist

* lang/cpp/src/Makefile.am (EXTRA_DIST): Fix typo.
(private_gpgmepp_headers): New. Private headers.
(libgpgmepp_la_SOURCES): Add private headers.
* lang/qt/src/Makefile.am (t_keylist_SOURCES): Remove non existent
header.

3 years agopython: PEP8 fixes.
Justus Winter [Tue, 10 May 2016 12:45:44 +0000 (14:45 +0200)]
python: PEP8 fixes.

Cherry picked from 0267c151.

Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoQt: Fix unkonwn doxygen keyword warnings
Andre Heinecke [Tue, 10 May 2016 12:32:22 +0000 (14:32 +0200)]
Qt: Fix unkonwn doxygen keyword warnings

--
Reimp is not a keqword and we inherit documentation anyway.

3 years agoQt: Make Protocol class public API
Andre Heinecke [Tue, 10 May 2016 12:05:10 +0000 (14:05 +0200)]
Qt: Make Protocol class public API

* lang/qt/src/Makefile.am (qgpgme_headers): Add protocol.h
(private_qgpgme_headers): Add protocol_p.h
* lang/qt/src/protocol.h: New. From QGpgMEBackend.
* lang/qt/src/protocol_p.h: New. From QGpgMEBackend.
* lang/qt/src/qgpgmebackend.h,
lang/qt/src/qgpgmebackend.cpp (Protocol): Removed.

--
The backend class does not make much sense anymore as we
only have the GpgME backend obviously. It's purpose was
for Libkleo's Backend abstraction.

3 years agoQt: Make doxygen quieter
Andre Heinecke [Tue, 10 May 2016 10:52:43 +0000 (12:52 +0200)]
Qt: Make doxygen quieter

* lang/qt/doc/Doxyfile.in: Quiet and no undocumented warnings.

3 years agoQt: Only install public headers
Andre Heinecke [Tue, 10 May 2016 10:47:53 +0000 (12:47 +0200)]
Qt: Only install public headers

* lang/qt/src/Makefile.am: Do not install all headers.
--
The qgpgme classes hide the implementation and thus make it
easier to change it without ABI breaks. They should not
be installed.

3 years agopython: Delete trailing whitespace.
Justus Winter [Tue, 10 May 2016 11:30:30 +0000 (13:30 +0200)]
python: Delete trailing whitespace.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Drop Debian packaging.
Justus Winter [Tue, 10 May 2016 11:21:34 +0000 (13:21 +0200)]
python: Drop Debian packaging.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agopython: Rename bindings.
Justus Winter [Tue, 10 May 2016 11:19:26 +0000 (13:19 +0200)]
python: Rename bindings.

--
Signed-off-by: Justus Winter <justus@gnupg.org>
3 years agoMerge branch 'master' into justus/pyme3
Justus Winter [Tue, 10 May 2016 11:03:34 +0000 (13:03 +0200)]
Merge branch 'master' into justus/pyme3

3 years agoQt: Add test for async keylisting
Andre Heinecke [Fri, 6 May 2016 14:33:49 +0000 (16:33 +0200)]
Qt: Add test for async keylisting

* src/lang/qt/tests/t-keylist.cpp(KeyListTest::testKeyListAsync): New.

3 years agoAllow cc to detect missing cases in a switch.
Werner Koch [Tue, 10 May 2016 08:27:54 +0000 (10:27 +0200)]
Allow cc to detect missing cases in a switch.

* src/delete.c (delete_status_handler): Remove default case from a
switch so that cc can check the use of all enum values.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoUse common error message style for qt lang checks
Andre Heinecke [Fri, 6 May 2016 12:47:24 +0000 (14:47 +0200)]
Use common error message style for qt lang checks

* configure.ac: Use common error highliting for qt lang options.

3 years agoQt: Fix license mentioned in README
Andre Heinecke [Fri, 6 May 2016 12:41:22 +0000 (14:41 +0200)]
Qt: Fix license mentioned in README

* lang/qt/README: License is GPLv2+ and not LGPL.
--
The only part under lgpl is the QByteArray dataprovider.

3 years agoQt: Fix library name in Copyright headers
Andre Heinecke [Fri, 6 May 2016 12:20:45 +0000 (14:20 +0200)]
Qt: Fix library name in Copyright headers

--
Files are not part of libkleopatra anymore.

3 years agoAdd maybe mode for langs and default to it
Andre Heinecke [Fri, 6 May 2016 12:17:15 +0000 (14:17 +0200)]
Add maybe mode for langs and default to it

* configure.ac (languages): Warn and disable langs for which
requirements are not met.

--
If the languages are explicitly enabled on the command line
missing dependencies for them will still lead to errors.

3 years agoCpp: Handle PINENTRY_LAUNCHED status line
Andre Heinecke [Fri, 6 May 2016 11:19:18 +0000 (13:19 +0200)]
Cpp: Handle PINENTRY_LAUNCHED status line

* lang/cpp/src/editinteractor.cpp (EditInteractor::needsNoResponse):
Add GPGME_STATUS_PINENTRY_LAUNCHED.

--
PINENTRY_LAUNCHED needs no response in any Job. This fixes
Jobs which errored out on unknown status lines.

3 years agoCpp: Add support for pubkey_algo_name
Andre Heinecke [Tue, 12 Apr 2016 14:08:10 +0000 (16:08 +0200)]
Cpp: Add support for pubkey_algo_name

* lang/cpp/src/key.cpp (Subkey::algoName): New.
* lang/cpp/src/key.h: Declare.

3 years agoCpp: Add support for gpgme_data_identify
Andre Heinecke [Tue, 12 Apr 2016 14:05:31 +0000 (16:05 +0200)]
Cpp: Add support for gpgme_data_identify

* lang/cpp/src/data.cpp (Data::type): New.
* lang/cpp/src/data.h (Data::Type): New enum mapping.

3 years agoFix configuration without Qt language
Andre Heinecke [Tue, 12 Apr 2016 07:42:36 +0000 (09:42 +0200)]
Fix configuration without Qt language

* configure.ac: Define HAVE_DOXYGEN also if qt should not be built.