aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* core: Add closer inspection of "PGP MESSAGE".Werner Koch2016-06-231-2/+27
| | | | | | | * src/data-identify.c (inspect_pgp_message): New. (basic_detection): Un-const arg DATA. Call inspect_pgp_message. Signed-off-by: Werner Koch <[email protected]>
* core: Add a base 64 decoder.Werner Koch2016-06-233-1/+272
| | | | | | | | | | | | | | * src/b64dec.c: New. Taken from gnupg. Prefix function names with _gpgme_ and change to use standard C malloc functions. * src/util.h.h (struct b64state): New. * src/Makefile.am (main_sources): Add file. -- The file b64dec.c has been taken from gnupg commit e430ff6ad0b7dcfcebd92b825dd5168205447ff3 Signed-off-by: Werner Koch <[email protected]>
* core: Detect compressed signed OpenPGP data.Werner Koch2016-06-221-9/+18
| | | | | | | | * src/data-identify.c (next_openpgp_packet): Allow partial encoding. (pgp_binary_detection): Handle compressed packets. -- Signed-off-by: Werner Koch <[email protected]>
* tests: Add new test tool run-identify.Werner Koch2016-06-213-1/+132
| | | | | | | | * src/gpgme-tool.c (gt_identify): Add new strings. * tests/run-identify.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add run-identify. Signed-off-by: Werner Koch <[email protected]>
* core: Enhance gpgme_data_identify to detect binary PGP messages.Werner Koch2016-06-213-1/+233
| | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DATA_TYPE_PGP_ENCRYPTED): New. (GPGME_DATA_TYPE_PGP_SIGNATURE): New. * src/data-identify.c: Add enum for OpenPGP packet types. (buf32_to_ulong): New. (next_openpgp_packet): New. Based on the gnupg/kbx/keybox-openpgp.c implementation and relicensed to LGPL by g10 Code. (pgp_binary_detection): New. (basic_detection): Call pgp_binary_detection instead of returning unknown. Signed-off-by: Werner Koch <[email protected]>
* python: Improve autmatically generated docstrings.Justus Winter2016-06-162-10/+23
| | | | | | | | * lang/python/gpgme.i: Add comment. * lang/python/pyme/core.py (__getattr__): Rewrite automatically generated doctrings for the wrapper methods. Signed-off-by: Justus Winter <[email protected]>
* python: Make result objects more robust.Justus Winter2016-06-164-4/+224
| | | | | | | | | | | | | | | | Results returned by the GPGME are fragile, i.e. they are only valid until the next operation is performed in the context. We cannot arbitrarily constrain the lifetime of Python objects, we therefore create deep copies of the results. * lang/python/gpgme.i (gpgme_tofu_info_t): Turn these into a list. (gpgme_*_result_t): Create deep copies of these objects. * lang/python/helpers.c (pygpgme_wrap_fragile_result): New function. * lang/python/helpers.h (pygpgme_wrap_fragile_result): New prototype. * lang/python/pyme/results.py: New file. Signed-off-by: Justus Winter <[email protected]>
* python: Avoid creating SWIG proxy classes.Justus Winter2016-06-162-2/+2
| | | | | | | | * lang/python/Makefile.am (gpgme_wrap.c): Use '-builtin' to make SWIG generate builtin types for c types. * lang/python/gpgme.i (pygpgme_wrap_gpgme_data_t): Adapt slightly. Signed-off-by: Justus Winter <[email protected]>
* python: Simplify wrapping glue.Justus Winter2016-06-162-23/+22
| | | | | | | | * lang/python/pyme/core.py: Rename '_getctype' to '_ctype' and turn it into a string. Likewise rename '_getnameprepend' to '_cprefix'. * lang/python/helpers.c: Adapt accordingly. Signed-off-by: Justus Winter <[email protected]>
* python: Rework callbacks.Justus Winter2016-06-164-89/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | Simplify how the lifetime of callback arguments is managed. * lang/python/gpgme.i (gpgme_edit_cb_t): Check arguments. (PyObject_p_p, void_p_p): Drop rather dangerous interface. (pygpgme_unwrap_gpgme_ctx_t): New function. * lang/python/helpers.c (pygpgme_clear_generic_cb): Drop dangerous function. (pyPassphraseCb): Assert contract. (pygpgme_set_passphrase_cb): Use Python's calling convention so that we can raise exceptions. Hand in 'self', get the wrapped object, and simply store the hook data as attribute of the wrapper object. (pyProgressCb, pygpgme_set_progress_cb): Likewise. (pygpgme_set_status_cb): Likewise. (pygpgme_data_new_from_cbs): Likewise. * lang/python/helpers.h (pygpgme_clear_generic_cb): Drop prototype. (pygpgme_set_passphrase_cb): Update prototype. (pygpgme_set_progress_cb): Likewise. (pygpgme_set_status_cb): Likewise. (pygpgme_data_new_from_cbs): Likewise. (pygpgme_unwrap_gpgme_ctx_t): New prottotype. * lang/python/pyme/core.py (Context, Data): Update callsites. Signed-off-by: Justus Winter <[email protected]>
* python: Wrap objects implementing the buffer protocol.Justus Winter2016-06-165-63/+179
| | | | | | | | | | | | | | | | | * lang/python/Makefile.am: Add the toplevel source directory to CFLAGS when compiling the bindings so that we can use private header files. * lang/python/gpgme.i (gpgme_data_t): Rework the object wrapping. Do not create a Python wrapper object, merely a gpgme_data_t object, and keep references to buffer objects, if any. If necessary, update the buffer after the function call. (pygpgme_wrap_gpgme_data_t): New function. * lang/python/helpers.c (object_to_gpgme_data_t): Rework object wrapping. Also wrap objects implementing the buffer protocol. * lang/python/helpers.h (object_to_gpgme_data_t): Update prototype. (pygpgme_wrap_gpgme_data_t): New prototype. * lang/python/tests/t-idiomatic.py: Demonstrate this. Signed-off-by: Justus Winter <[email protected]>
* python: Add properties to wrapped object.Justus Winter2016-06-161-6/+82
| | | | | | | | | | | | | | | | | * lang/python/pyme/core.py (GpgmeWrapper.__repr__): Saner representation. (GpgmeWrapper.__str__): Construct a nicer human readable string. (GpgmeWrapper._boolean_properties): New field. (GpgmeWrapper.__wrap_boolean_property): New function. (GpgmeWrapper.__getattr__): Wrap functions using properties. (GpgmeWrapper.__setattr__): New method. Likewise wrap functions. (Context.signers): New property. (Context.pinentry_mode): Likewise. (Context._boolean_properties): List boolean properties. (Context.__init__): Add keyword arguments for properties and apply them. Signed-off-by: Justus Winter <[email protected]>
* python: Improve the documentation.Justus Winter2016-06-165-102/+148
| | | | | | | | | | * lang/python/Makefile.am: Copy the README file. * lang/python/README: Rename, convert to org, and update. * lang/python/pyme/__init__.py: Move license out of the docstring, update docstring. * lang/python/pyme/core.py: Add and update docstrings. Signed-off-by: Justus Winter <[email protected]>
* python: Get version information from the build system.Justus Winter2016-06-165-59/+76
| | | | | | | | | | | * configure.ac: Generate 'setup.py' and 'version.py'. * lang/python/Makefile.am: Use generated setup script. * lang/python/pyme/version.py: Turn it into a template, and get version information from the build system. Also drop some variables. * lang/python/setup.py: Likewise. This way we can avoid importing the version module, which is frowned upon and actually caused a problem. Signed-off-by: Justus Winter <[email protected]>
* python: Fix exception leak.Justus Winter2016-06-161-0/+1
| | | | | | * lang/python/helpers.c (pygpgme_stash_callback_exception): Fix leak. Signed-off-by: Justus Winter <[email protected]>
* python: Fix license.Justus Winter2016-06-161-3/+3
| | | | | | | | Other parts of the build system are also LGPLed. * lang/python/Makefile.am: Fix license. Signed-off-by: Justus Winter <[email protected]>
* core: Make sure FD_SET is not used with an out of range fd.Werner Koch2016-06-141-0/+12
| | | | | | | * src/posix-io.c (_gpgme_io_select): Check for FD out of range. -- Signed-off-by: Werner Koch <[email protected]>
* python: Improve error handling.Justus Winter2016-06-081-6/+23
| | | | | | | * lang/python/helpers.c (pyPassphraseCb): Handle write errors. (pyEditCb): Likewise. Signed-off-by: Justus Winter <[email protected]>
* python: Add function to raise exceptions from c.Justus Winter2016-06-081-0/+20
| | | | | | * lang/python/helpers.c (pygpgme_raise_exception): New function. Signed-off-by: Justus Winter <[email protected]>
* python: Fix stripping deprecated functionality.Justus Winter2016-06-082-3/+8
| | | | | | | | | * lang/python/Makefile.am (gpgme.h): Add script as input. * lang/python/gpgme-h-clean.py (deprec_func): Also match struct members. (line_break): Fix matching on struct members. Signed-off-by: Justus Winter <[email protected]>
* python: Fix type.Justus Winter2016-06-081-2/+12
| | | | | | * lang/python/gpgme.i: Use correct Python type for size. Signed-off-by: Justus Winter <[email protected]>
* python: Implement the context manager protocol.Justus Winter2016-06-082-7/+29
| | | | | | | | | | | | | * lang/python/pyme/core.py (Context.__del__): Make function idemptotent. (Context.{__enter__,__exit__}): Implement the context manager protocol. (Data.__del__): Make function idemptotent, drop debug print. (Data.{__enter__,__exit__}): Implement the context manager protocol. * lang/python/tests/t-idiomatic.py: Demonstrate this. Signed-off-by: Justus Winter <[email protected]>
* python: Fix error handling.Justus Winter2016-06-071-3/+4
| | | | | | | | * 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 <[email protected]>
* python: Wrap file-like objects on demand.Justus Winter2016-06-065-3/+127
| | | | | | | | | | | | * 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 <[email protected]>
* python: Move helper function.Justus Winter2016-06-063-31/+38
| | | | | | | | * 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 <[email protected]>
* python: Fix error handling.Justus Winter2016-06-061-8/+1
| | | | | | | * lang/python/gpgme.i (object_to_gpgme_t): Properly propagate exceptions. Signed-off-by: Justus Winter <[email protected]>
* python: Initialize GPGME for the user.Justus Winter2016-06-062-1/+6
| | | | | | | * 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 <[email protected]>
* python: Drop obsolete VCS keywords.Justus Winter2016-06-0636-36/+0
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* python: Fix test suite with GnuPG prior to 2.1.12.Justus Winter2016-06-011-1/+2
| | | | | | | * lang/python/tests/Makefile.am (gpg-agent.conf): Use 'allow-loopback-pinentry'. Signed-off-by: Justus Winter <[email protected]>
* python: Make Python detection more robust.Justus Winter2016-06-012-2/+11
| | | | | | | | | | 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 <[email protected]>
* python: Improve build system integration, fix warnings.Justus Winter2016-06-012-3/+7
| | | | | | | | * 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 <[email protected]>
* Cpp: Use whitelist for status messagesAndre Heinecke2016-06-011-12/+8
| | | | | | | | | * 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.
* Qt: Fix debug output in t-ownertrustAndre Heinecke2016-06-011-1/+3
| | | | | * lang/qt/tests/t-ownertrust.cpp (testChangeOwnerTrust): Remove general debug of trust level. Add debug output for error.
* tests: Fix notation tests.Justus Winter2016-06-012-6/+5
| | | | | | | | | * 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 <[email protected]>
* core: Set notation flags for verify.Werner Koch2016-06-015-10/+60
| | | | | | | | | | | | | * 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.
* python: use GPG_ERROR_CONFIG variableTobias Mueller2016-05-311-1/+1
| | | | | | | | | | | 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 <[email protected]>
* python: Port more tests.Justus Winter2016-05-315-5/+280
| | | | | | | | | | * 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 <[email protected]>
* build: Fix URL.Justus Winter2016-05-311-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* Speedup closing of fds before exec.Werner Koch2016-05-271-7/+47
| | | | | | | | * 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 <[email protected]>
* python: Port more tests.Justus Winter2016-05-277-7/+155
| | | | | | | | | | | | | | * 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 <[email protected]>
* src: Fix typo.Justus Winter2016-05-271-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* tests: Fix test.Justus Winter2016-05-271-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* python: Implement data callbacks.Justus Winter2016-05-276-21/+405
| | | | | | | | | | | | | | | | | | | | | | * 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 <[email protected]>
* python: Fix object deallocation.Justus Winter2016-05-272-14/+29
| | | | | | | | | | | | | | | | 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 <[email protected]>
* Improve comments.Justus Winter2016-05-271-4/+6
| | | | | | | | * 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 <[email protected]>
* python: Fix reading data from existing files.Justus Winter2016-05-272-16/+51
| | | | | | | | | | | | | * 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 <[email protected]>
* src: Fix trace string.Justus Winter2016-05-251-1/+1
| | | | | | * src/data-compat.c (gpgme_data_new_from_file): Fix trace string. Signed-off-by: Justus Winter <[email protected]>
* python: Improve and test Context.wait.Justus Winter2016-05-243-13/+50
| | | | | | | | | | * 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 <[email protected]>
* python: Make all GnuPG errors available.Justus Winter2016-05-243-5/+12
| | | | | | | | * 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 <[email protected]>
* python: Move the base wrapper class.Justus Winter2016-05-242-79/+77
| | | | | | | * python/lang/pyme/util.py (GpgmeWrapper): Move... * python/lang/pyme/core.py: ... here. Signed-off-by: Justus Winter <[email protected]>