* m4/ax_python_devel.m4: Do not emit 'HAVE_PYTHON'.
* m4/python.m4 (_AM_PYTHON_INTERPRETER_LIST): Add newer Python
versions, drop older ones. Also, sort the list with older versions at
the front, newer and generic versions towards the end. This makes the
algorithm pick the lowest version that meets the version requirement.
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/qt/src/dn.cpp (parse_dn_part): Use gpgrt_asprintf instead
of qstrdup.
--
This fixes a new / free mismatch because qstrdup uses new and
the allocated parts are freed with free. Similar to: a09ed3f2
* src/engine-gpgsm.c (gpgsm_assuan_simple_command): Make sure CB_ERR
is returned.
* src/import.c (parse_import_res): Do not return an error for the last
field.
(import_status_handler): Actually return the error from
parse_import_res.
Signed-off-by: Werner Koch <wk@gnupg.org>
* lang/python/tests/initial.py: Print path of the Python module used
during tests. Useful to detect if by any mistake the wrong module is
picked up.
Signed-off-by: Justus Winter <justus@g10code.com>
--
This reverts commit 6df6e01ed5.
gpgme_error_t et al are from a time where we had no hard dependency on
libgpg-error. Now libgpg-error is a required and thus it does not
make sense to have these surrogates. In fact we should ventually
completely remove them.
Signed-off-by: Werner Koch <wk@gnupg.org>
* doc/gpgme.texi (gpgme_op_encrypt_sign_start): recp is an array of
gpgme_key_t, not a single element.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* lang/python/tests/t-quick-key-manipulation.py: Modify the
configuration file in the ephemeral home directory, not the one used
by all the tests.
Fixes-commit: 15fbac9e72
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/tests/support.py (EphemeralContext): New function.
* lang/python/tests/t-quick-key-creation.py: Use the new function to
manage ephemeral contexts.
* lang/python/tests/t-quick-key-manipulation.py: Likewise.
* lang/python/tests/t-quick-subkey-creation.py: Likewise.
--
Previously, there was a problem with cleaning up ephemeral home
directories. shutil.rmtree deleted the agents main socket, gpg-agent
detected that, and deleted the other sockets as well, racing
shutil.rmtree which did not cope will with that.
Fix this by asking the agent nicely to shut down.
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/gpg/core.py (Context.assuan_transact): Fix testing
whether the command is a string on Python2.
* lang/python/tests/t-protocol-assuan.py: Improve the test to detect
this problem.
Signed-off-by: Justus Winter <justus@g10code.com>
* NEWS: Update.
* doc/gpgme.texi (gpgme_op_createkey): Clarify the meaning of the
'expire' parameter.
(GPGME_CREATE_NOEXPIRE): Document new flag.
(gpgme_op_createsubkey): Clarify the meaning of the 'expire'
parameter.
* src/engine-gpg.c (gpg_add_algo_usage_expire): Fix handling of the
expiration time.
* src/gpgme.h.in (GPGME_CREATE_NOEXPIRE): New macro.
--
Previously, the documentation stated that the expiration time was an
absolute timestamp. However, this value was passed using the
'seconds=N' syntax to GnuPG which specifies the expiration time in
seconds relative to the creation time. Fix the documentation.
Furthermore, the documentation stated that using 0 results in keys
that do not expire. This was communicated to GnuPG by using the
implicit default. However, as of GnuPG 2.1.17, the default was
changed to create keys that expire within a reasonable timespan.
Fix this discrepancy by aligning the behavior with recent GnuPG
versions: 0 means use a reasonable default, and introduce a flag that
can be used to create keys that do not expire. Communicate this
explicitly to GnuPG.
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/Makefile.am (copystamp): Also copy the setup script, and
link the header files.
(all-local): Use local setup script.
(sdist): Fix Python source distribution creation.
(CLEANFILES): Remove now obsolete files.
(install-exec-local): Use local setup script.
* lang/python/setup.py.in: Adjust relative paths to in-tree files.
Fixes-commit: fe65a26ab5
Signed-off-by: Justus Winter <justus@g10code.com>
* NEWS: Update.
* src/data.c (gpgme_data_set_flag): Return a 'gpgme_error_t'.
* src/error.c (gpgme_strerror_r): Fix type of first argument.
* src/gpgme.h.in (gpgme_strerror_r): Adapt.
(gpgme_data_set_flag): Likewise.
--
Fix for consistency. This should not pose problems, because typedef
gpg_error_t gpgme_error_t.
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/python/gpgme.i: Added a genericrepr macro and use it for
gpgme_key, gpgme_subkey, and gpgme_key_sig.
--
To look nicer in Python's REPL.
We define a generic __repr__ as a SWIG macro and use that to extend some
defined SWIG objects.
The alternative would have been to write a custom __repr__ function for
each class but that would need to be changed everytime the object's
structure changes. The bindings should be easy to maintain, I guess.
This comes at the expense that the reprs are now relatively long and
contain, for example, both keyid and fingerprint.
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
* lang/python/setup.py.in: Call SWIG without the builtin flag.
--
The SWIG documentation
<http://www.swig.org/Doc2.0/Python.html#Python_nn28> leaves the
impression that -builtin is solely for increasing performance:
New in SWIG version 2.0.4: The use of Python proxy classes has
performance implications that may be unacceptable for a high-
performance library. The new -builtin option instructs SWIG to
forego the use of proxy classes, and instead create wrapped types as
new built-in Python types. When this option is used, the following
section ("Proxy classes") does not apply. Details on the use of the
-builtin option are in the Built-in Types section.
While not wasting CPU cycles is good, it also prevents Python code being
written in the wrapper itself. That, however, may be useful to make it
easier to extend the wrapper.
Partially reverts: 856bcfe293
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
* lang/python/gpgme.i (pygpgme_wrap_gpgme_data_t): Provide a "self"
variable for SWIG_NewPointerObj and call SWIG_NewPointerObj rather than
SWIG_Python_NewPointerObj.
--
SWIG_Python_NewPointerObj seems to be an implementation detail, because
SWIG's documentation does not mention that function at all. In fact,
SWIG_NewPointerObj is a call to SWIG_Python_NewPointerObj with the first
parameter being either NULL or the "self" variable, depending on whether
SWIG is called with the -builtin flag. So far, the first parameter was
hard-coded to NULL. This change also hard-codes it to NULL but makes
it more explicit. The benefit is that the documented function is being
used and that compilation works regardless of the -builtin flag.
Partially reverts: 856bcfe293
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
* lang/python/setup.py.in: Only call with -py3 when we run under python3
or higher.
--
If we ever remove the -builtin flag and leave the the -py3 flag, SWIG
will generate Python code which will be incompatible with Python 2,
because the py3 flag generates python3 code which is incompatible with
python2.
So we conditionally generate SWIG bindings with -py3.
Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
* lang/python/Makefile.am (copystamp): Create one copy per Python
version.
(all-local): Adapt.
(clean-local): Likewise.
(install-exec-local): Likewise.
* lang/python/tests/run-tests.py: Likewise.
--
Currently, we use one copy of the Python module's source to build for
all Python versions. This is problematic, because SWIG writes a
wrapper file into the source tree. Currently, this file works with
both Python 2 and 3, but this is purely by chance.
Improve the situation by creating one copy per Python version so that
SWIG can write version-specific code into each copy.
Signed-off-by: Justus Winter <justus@g10code.com>
* configure.ac: On macOS, use the compatibility macros to expose every
feature of the libc. This is the equivalent of _GNU_SOURCE on GNU
libc.
--
Not defining this leads to compilation errors or superfluous warnings
on macOS.
GnuPG-bug-id: 2910
Signed-off-by: Justus Winter <justus@g10code.com>
* lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/threadedjobmixin.h: Include functional.
--
With GCC 7.0, functional is not included transitively and we get:
In file included from qgpgmedeletejob.h:39:0,
from qgpgmedeletejob.cpp:38:
threadedjobmixin.h:98:33: error: 'function' in namespace 'std'
does not name a template type
void setFunction(const std::function<T_result()> &function)
^~~~~~~~
std::{function,bind,placeholders,mem_fn} are defined in functional.
References: https://bugzilla.redhat.com/show_bug.cgi?id=1417383
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
GnuPG-Bug-Id: 2955
Commit Message amended by Andre Heinecke
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
* src/verify.c (parse_tofu_user): For cleanness use gpg_error ...
(_gpgme_verify_status_handler): ... and gpg_err_code.
Signed-off-by: Werner Koch <wk@gnupg.org>
* src/verify.c (op_data_t): Add conflict_user_seen.
(parse_tofu_user): Return ERR_DUP_VALUE for mutltiple TOFU_USERS.
(_gpgme_verify_status_handler): Handle ERR_DUP_VALUE from
parse_tofu_user to ignore the next TOFU_STATS.
--
This fixes TOFU Conflict verification with GnuPG-2.1.17 and 2.1.18
GnuPG-Bug-Id: 2914
* configure.ac (vasprintf): Remove check.
* src/vasprintf.c: Remove file.
* src/util.h (vasprintf, asprintf): Remove prototypes. Replace all
calls to vasprintf and asprintf by gpgrt_vasprintf or gpgrt_asprintf.
Also take care to use gpgrt_free on the returned value.
* src/w32-util.c (_gpgme_get_gpgconf_path): Replace a gpgrt_asprintf
by _gpgme_strconcat.
(snprintf): New macro to use gpgrt_snprintf instead of the system's
standard snprintf.
Signed-off-by: Werner Koch <wk@gnupg.org>
--
It is common that developers look up only the header file and do not
read the manual. These comments should make it clear that most
structures in gpgme.h are read-only and may only be allocated by
gpgme.
Signed-off-by: Werner Koch <wk@gnupg.org>