gpgme.git
14 months agoRelease 1.8.0 gpgme-1.8.0
Werner Koch [Wed, 16 Nov 2016 12:29:02 +0000 (13:29 +0100)]
Release 1.8.0

* configure.ac: Set version to 1.8.0.  Set LT version C28/A17/RO.
Set CPP LT version to C9/A3/R0.  Set Qt LT version to C8/A1/R0.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agodoc: Replace http: by https: in core source files.
Werner Koch [Wed, 16 Nov 2016 12:27:00 +0000 (13:27 +0100)]
doc: Replace http: by https: in core source files.

--

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agocore: Do not leak the override session key to ps(1).
Werner Koch [Wed, 16 Nov 2016 09:12:19 +0000 (10:12 +0100)]
core: Do not leak the override session key to ps(1).

* src/engine-gpg.c (struct engine_gpg): New field
override_session_key.
(gpg_release): Free that field.
(gpg_decrypt): With gnupg 2.1.16 use --override-session-key-fd.

* tests/run-decrypt.c (main): Fix setting over the override key.
--

Note that this works only with gnupg 2.1.16 and later.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agodoc,tests: Require use of ctx_flag before use of session_key.
Daniel Kahn Gillmor [Wed, 16 Nov 2016 05:10:22 +0000 (14:10 +0900)]
doc,tests: Require use of ctx_flag before use of session_key.

* doc/gpgme.texi: Document requirements of verifying that it is OK to
use session_key.
* tests/run-decrypt.c: Ensure that we fail if we're unable to access
the session key, so that we do not violate the guidance above.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Changed the description

 -@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns
 -@code{GPG_ERR_NO_ERROR} or @code{gpgme_get_ctx_flag (ctx,
 -"export-session-key")} returns @code{"1"}.
 +@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success
 +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true
 +(non-empty string).

to get gpgme_get_ctx_flag for boolean values in sync with its own
description.

Note that I don't agree with the above suggestion but it does not
really harm to have it in the man page.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agoqt, cpp: Add cmake config files for w32
Andre Heinecke [Tue, 15 Nov 2016 13:33:31 +0000 (14:33 +0100)]
qt, cpp: Add cmake config files for w32

* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
lang/qt/src/QGpgmeConfig-w32.cmake.in.in: New.
* lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in: Remove libsuffix handling.
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Create / install w32 config files.
* configure.ac: Configure them.

--
To work with DLL's cmake needs to know about the implib and
the final DLL. So the config files look different enough
that it's better to use alternative files.

14 months agoqt: Use new style connect in th..mixin
Andre Heinecke [Tue, 15 Nov 2016 11:30:56 +0000 (12:30 +0100)]
qt: Use new style connect in th..mixin

* lang/qt/src/threadedjobmixin.h
(ThreadedJobMixin::lateInitialization): Use new style connect.

14 months agodoc: Fix typos.
Daniel Kahn Gillmor [Tue, 15 Nov 2016 10:53:35 +0000 (19:53 +0900)]
doc: Fix typos.

--

14 months agocore: Implement context flag "override-session-key".
Werner Koch [Tue, 15 Nov 2016 09:29:48 +0000 (10:29 +0100)]
core: Implement context flag "override-session-key".

* src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and
"override-session-key".
(gpgme_get_ctx_flag): Ditto.
(gpgme_set_export_session_keys): Remove.
(gpgme_get_export_session_keys): Remove.
* src/gpgme.def, src/libgpgme.vers: Remove them.
* src/context.h (struct gpgme_context): Add field
override_session_key.
* src/decrypt-verify.c (decrypt_verify_start): Pass
override_session_key value to the engine.
* src/decrypt.c (decrypt_start): Ditto.
* src/engine.c (_gpgme_engine_op_decrypt): Ditto.
(_gpgme_engine_op_decrypt_verify): Ditto.
* src/engine-backend.h (struct engine_ops): Extend DECRYPT and
DECRYPT_VERIFY_START with override_session_key.
* src/engine-uiserver.c (_uiserver_decrypt): Add stub arg
override_session_key.
(uiserver_decrypt): Ditto.
(uiserver_decrypt_verify): Ditto.
* src/engine-gpgsm.c (gpgsm_decrypt): Ditto.
* src/engine-gpg.c (gpg_decrypt): Add arg override_session_key and set
corresponding gpg option.

* tests/run-decrypt.c (print_result): Print the session key if
available.
(main): Add options --export-session-key and --override-session-key.

--

To keep the number of context manipulation functions at bay, this
patches removes the just added gpgme_set_export_session_keys and
gpgme_get_export_session_keys by flags for the generic context
function.

The patch also implements the --override-session-key feature.

GnuPG-bug-id: 2754
Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agocore: Add public function gpgme_get_ctx_flag.
Werner Koch [Tue, 15 Nov 2016 08:24:17 +0000 (09:24 +0100)]
core: Add public function gpgme_get_ctx_flag.

* src/gpgme.h.in (gpgme_get_ctx_flag): New.
* src/gpgme.c (gpgme_set_ctx_flag): Move down the file and add a trace
statement.
(gpgme_get_ctx_flag): New.
* src/gpgme.def, src/libgpgme.vers: Add new interface.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agocore: Enable extraction of session keys.
Daniel Kahn Gillmor [Fri, 11 Nov 2016 07:49:28 +0000 (16:49 +0900)]
core: Enable extraction of session keys.

* src/gpgme.c (gpgme_set_export_session_keys): New function.
(gpgme_get_export_session_keys): New function.
* src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key
member.
(gpgme_{set,get}_export_session_keys): Declare new functions.
* src/libgpgme.vers, src/gpgme.def: Export new functions in shared
object.
* src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key
parameter.
(_gpgme_engine_op_decrypt_verify): Add export_session_key parameter.
* src/engine-backend.h: (struct engine_ops): Change function
pointer declarations to match.
* src/context.h (struct gpgme_context): Add export_session_keys member.
* src/decrypt.c (release_op_data): Free result.session_key.
(_gpgme_decrypt_status_handler): Store a copy of the exported session
key.
(decrypt_start): Pass export_session_keys from the context.
* src/decrypt-verify.c (decrypt_verify_start): Pass
export_session_keys from context.
* src/engine.c (_gpgme_engine_op_decrypt): Pass through
export_session_key flag.
(_gpgme_engine_op_decrypt_verify): Pass through export_session_key
flag.
* src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add
--export-session-key to argument list.
* src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for
now, since gpgsm offers no such mechanism.
* src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is
set, add --export-session-key flag to cmd.
* doc/gpgme.texi: Document new functions and session_key member of
decrypt_result_t.
* doc/uiserver.texi: Add --export-session-key flag to DECRYPT command.

--

gpg(1) documents session key export as useful for key escrow, and is
rightly dubious of that use case.  However, session key export is also
useful in other use cases.  Two examples from MUA development (where
this functionality would be specifically useful to me right now):

 * If the MUA stores a local copy of the session key upon decrypting
   the message, it can re-decrypt the message without expensive
   asymmetric operations.  When rendering a thread with dozens of
   encrypted messages, this can represent a significant speedup.

 * A user may have expired encryption-capable secret key material,
   along with many messages encrypted to that material.  If she stores
   the session keys for those messages she wants to keep, she can
   destroy her secret key material and make any messages she has
   deleted completely unrecoverable, even to an attacker who gets her
   remaining secret keys in the future.

This patchset makes a two specific implementation decisions that could
have gone in different ways.  I welcome feedback on preferred outcomes.

 0) session key representation: we currently represent the session key
    as an opaque textual string, rather than trying to provide any
    sort of in-memory structure.  While it wouldn't be hard to parse
    the data produced by gpg's --export-session-key, I chose to use
    the opaque string rather than lock in a particular data format.

 1) API/ABI: i've added a member to gpgme_op_decrypt_result_t.  This
    has the potential to cause an out-of-bound memory access if
    someone uses code compiled against the newer verision, but linked
    at runtime against an older version.  I've attempted to limit that
    risk by documenting that users must verify
    gpgme_get_export_session_keys() before accessing this new struct
    member -- this means that code expecting this capability will
    require the symbol at link-time, and will refuse to link against
    older versions.

    Another approach to solving this problem would be to avoid
    modifying gpgme_op_decrypt_result_t, and to introduce instead a
    new function gpgme_op_session_key(), which could be called in the
    same places as gpgme_op_decrypt_result().  Depending on the
    representation of the session key, this might introduce new
    memory-management burdens on the user of the library, and the
    session key is certainly part of a decryption result, so it seemed
    simpler to go with what i have here.

If anyone has strong preferences that these choices should be solved
in a different way, i'm happy to hear them.

Additionally, I note that i'm also still pretty unclear about how the
"UI Server" fits into this whole ecosystem. In particular, I don't
know whether it's kosher to just add an --export-session-key flag to
the DECRYPT operation without actually having implemented it anywhere,
but i don't see where i would actually implement it either :/

If this patch (or some variant) is adopted, i will supply another
patch that permits offering a session key during decryption (e.g. "gpg
--override-session-key"), but I wanted to get these implementation
choices ironed out first.

Gnupg-Bug-Id: 2754
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
On the concern of adding a new field to a structure: It may not be
clearly documented but we don't expect that a user ever allocates such
a structure - those result structure may only be created bu gpgme and
are read-only for the user.  Adding a new member constitutes a
compatible ABI change and thus an older SO may not be used by code
compiled with a header for the newer API.  Unless someone tinkers with
the build system, this should never happen.  We have added new fields
to result structure may times and I can't remember any problems.

 - wk

14 months agoqt: Add API to get the context for a Job
Andre Heinecke [Mon, 14 Nov 2016 19:40:29 +0000 (20:40 +0100)]
qt: Add API to get the context for a Job

* lang/qt/src/job.cpp,
lang/qt/src/job.h (Job::context): New.
* lang/qt/src/threadedjobmixin.cpp
(ThreadedJobMixin::~ThreadedJobMixin): New. Unregister context.
(ThreadedJobMixin::lateInitialization): Register context.
* NEWS: Update for cpp and qt.

--
The global map hack is necessary because the job class does
not know about the context which is held in threadedjobmixin.
Adding a virtual function in Job would be an ABI break which
I'd like to avoid at this point. Although QGpgME's API will
need a big ABI break to make it ABI maintainable. The virtual
jobs -> implementation classes are nearly unmaintainable ABI wise.

The context is exposed to provide more flexibility to users, e.g.
to add a passphrase callback or to set the sender in a context.

14 months agocpp: Add get / set Sender API
Andre Heinecke [Mon, 14 Nov 2016 15:13:27 +0000 (16:13 +0100)]
cpp: Add get / set Sender API

* cpp/src/context.cpp, cpp/src/context.h (Context::setSender),
(Context::getSender): Add simple wrappers.

14 months agoqt, cpp: Enable dll build for windows
Andre Heinecke [Mon, 14 Nov 2016 18:37:34 +0000 (19:37 +0100)]
qt, cpp: Enable dll build for windows

* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Add -no-undefined to LDFLAGS.

14 months agow32: Fix build of w32-glib
Andre Heinecke [Mon, 14 Nov 2016 16:18:50 +0000 (17:18 +0100)]
w32: Fix build of w32-glib

* src/Makefile.am (main_sources): Remove system_components_not_extra.
(libgpgme_la_SOURCES): Add system_components_not_extra.
(libgpgme_glib_la_SOURCES): Remove duplicated ath files.

14 months agodoc: Correct deftypefun for gpgme_op_decrypt_verify_start.
Daniel Kahn Gillmor [Fri, 11 Nov 2016 06:16:43 +0000 (15:16 +0900)]
doc: Correct deftypefun for gpgme_op_decrypt_verify_start.

* doc/gpgme.texi: Documentationabout gpgme_op_decrypt_verify_start was
stored under the name gpgme_op_decrypt_verify instead.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
14 months agodoc: Correct text about gpgme_cancel_async.
Daniel Kahn Gillmor [Fri, 11 Nov 2016 05:25:19 +0000 (14:25 +0900)]
doc: Correct text about gpgme_cancel_async.

* doc/gpgme.texi: Documentation about gpgme_cancel_async should refer
to the correct name.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
14 months agocore: Non-zero values should set _armor, _textmode, and _online.
Daniel Kahn Gillmor [Thu, 10 Nov 2016 23:47:48 +0000 (15:47 -0800)]
core: Non-zero values should set _armor, _textmode, and _online.

* src/gpgme.c (gpgme_set_armor, gpgme_set_textmode,
gpgme_set_offline): Ensure that non-zero values actually set the
appropriate internal bit.

--

The documentation for these functions says things like "disabled if
YES is zero, and enabled otherwise", where YES is an integer.
However, if you pass an even integer, it will be aliased back to 0
because the context member variables are declared as single bits.

This should make the implementation match the documentation.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
14 months agodoc: Fix regression in macro handling
Werner Koch [Fri, 11 Nov 2016 14:10:57 +0000 (15:10 +0100)]
doc: Fix regression in macro handling

--

The way macros are handled seem to have changed since 2008.  Fix that:

Reported-by: dkg@fifthhorseman.net
Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agotests,python: Atomic directory creation
Alon Bar-Lev [Wed, 19 Oct 2016 09:04:07 +0000 (12:04 +0300)]
tests,python: Atomic directory creation

* lang/python/tests/Makefile.am:  Use MIDIR_P.
* tests/gpg/Makefile.am: Ditto.
* tests/gpgsm/Makefile.am: Ditto.

--
Solves race in parallel build when mkdir fails if directory exists.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
- Tweaked the ChangeLog

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agocore: Use better error code when using select with a too high fd.
Werner Koch [Thu, 10 Nov 2016 18:49:13 +0000 (19:49 +0100)]
core: Use better error code when using select with a too high fd.

* src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF.
--

Also EBADF seem more correct, EMFILE (Too man open files) gives
a clearer message to the user that there are somehow too many files
open.  The problem can be exhibited by running lots of threads,

We should eventually move to poll but that would be a large change and
so we better fix it with the planned migration of the I/O subsystem to
libgpgrt (currently known as libgpg-error).

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agotests: Reduce thread count in new thread tests
Andre Heinecke [Thu, 10 Nov 2016 17:32:26 +0000 (18:32 +0100)]
tests: Reduce thread count in new thread tests

* gpg/t-thread-keylist-verify.c,
gpg/t-thread-keylist.c: Reduce threads to 100

--
Due to the limit of FD_SETSIZE the
number of parallel threads is limited. So some systems
run into this problem when running the testsuite.

14 months agodoc: s/Multi Threading/Multi-Threading/
Werner Koch [Thu, 10 Nov 2016 16:28:29 +0000 (17:28 +0100)]
doc: s/Multi Threading/Multi-Threading/

--

14 months agocore: Detect unreadable keyrings.
Werner Koch [Thu, 10 Nov 2016 16:13:02 +0000 (17:13 +0100)]
core: Detect unreadable keyrings.

* src/keylist.c (op_data_t): Add field keydb_search_err.
(keylist_status_handler): Parse STATUS_ERROR into that var.
(gpgme_op_keylist_next): Use that err instead of GPG_ERR_EOF.
--

With a recent GnuPG version this allows to detect a keyring with wrong
permissions (i.e. no read access).  GPG_ERR_OPEN_KEYRING will be
returned instead of GPG_ERR_EOF.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agotests: Fix additional memleaks in thread tests
Andre Heinecke [Thu, 10 Nov 2016 14:04:17 +0000 (15:04 +0100)]
tests: Fix additional memleaks in thread tests

* tests/gpg/t-thread-keylist-verify.c (start_verify): Release
data.
(start_keylist): Unref keys.
* tests/gpg/t-thread-keylist.c (start_keylist): Unref keys.

14 months agotests: Improve new thread tests
Andre Heinecke [Thu, 10 Nov 2016 13:10:11 +0000 (14:10 +0100)]
tests: Improve new thread tests

* tests/gpg/t-thread-keylist-verify.c (start_keylist): Mark
arg as unused. Release context.
(start_verify): Ditto.
(main): Mark args as unused.
* tests/gpg/t-thread-keylist.c (start_keylist):  Mark
arg as unused. Release context.
(main): Mark args as unused.

14 months agocore: Use gpgrt locking for thread safeness
Andre Heinecke [Tue, 8 Nov 2016 14:32:14 +0000 (15:32 +0100)]
core: Use gpgrt locking for thread safeness

* configure.ac: Require libgpg-error 1.17. No longer
check for pthread.
* doc/gpgme.texi: Document removed neccessity for thread
safe gpgme flavours.
* src/sema.h (DEFINE_GLOBAL_LOCK),
(DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK)
(DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents.
* src/posix-sema.c, src/w32-sema.c: Removed.
* src/Makefile.am: Remove libpthread and
Update accordingly.
* src/ath.c, src/ath.h (ath_mutex_init)
(ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed.
* src/ath.h (ATH_MUTEX_INITIALIZER): Removed.
* src/version.c (do_subsystem_inits): sema_subsystem_init is
no longer required.
* tests/gpg/Makefile.am: Add new threading tests.
(t_thread1_LDADD, t_cancel_LDADD):
Use just gpgme.
* tests/gpg/t-thread-keylist-verify.c,
tests/gpg/t-thread-keylist.c: New.
* src/gpgme-config.in: Use -lgpgme for thread-model pthread.

--
Using gpgrt locks instead of pthread locks removes
the neccessity to link pthread directly to gpgme and
have a different, thread safe flavor of gpgme. Now
gpgme is thread-safe if the conditions mentioned
in the doc are met.

As the cpp bindings linked against libgpgme
and not libgpgme-pthread this fixes threading problems
with them.

libgpgme-pthread is removed but gpgme-config still supports
--thread=pthread for compatibility with find scripts.

14 months agopython: Require at least GPGME 1.7 for out-of-tree builds.
Justus Winter [Wed, 9 Nov 2016 12:56:00 +0000 (13:56 +0100)]
python: Require at least GPGME 1.7 for out-of-tree builds.

* lang/python/setup.py.in: Bump required version to 1.7.

Signed-off-by: Justus Winter <justus@g10code.com>
14 months agow32: Better protect the IO-system's fd_table
Werner Koch [Wed, 9 Nov 2016 07:33:02 +0000 (08:33 +0100)]
w32: Better protect the IO-system's fd_table

* src/w32-io.c (fd_table_lock): New.
(new_fd): Lock allocation of a new slot.
(release_fd): Lock deallocation of a slot.
--

Note that we lock only the allocation but not the sanitiy checks we do
further down in the code.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agocpp: Add API for swdb queries
Andre Heinecke [Fri, 4 Nov 2016 11:33:57 +0000 (12:33 +0100)]
cpp: Add API for swdb queries

* lang/cpp/src/swdbresult.cpp,
 lang/cpp/src/swdbresult.h (SwdbResult): New.
* lang/cpp/src/Makefile.am: Update accordingly.

14 months agocpp: Add more EngineInfo::Version ctors
Andre Heinecke [Fri, 4 Nov 2016 11:29:32 +0000 (12:29 +0100)]
cpp: Add more EngineInfo::Version ctors

* lang/cpp/src/engineinfo.h
(EngineInfo::Version::Version(const char*)),
(EngineInfo::Version::Version()): New.

14 months agocpp: Don't include gpgme.h in tofuinfo header
Andre Heinecke [Fri, 4 Nov 2016 11:26:46 +0000 (12:26 +0100)]
cpp: Don't include gpgme.h in tofuinfo header

* lang/cpp/src/tofuinfo.h: Don't include gpgme.h

--
No public header should include gpgme.h

14 months agocpp: Extend gpgmefw for tofuinfo and swdb query
Andre Heinecke [Fri, 4 Nov 2016 11:24:34 +0000 (12:24 +0100)]
cpp: Extend gpgmefw for tofuinfo and swdb query

* lang/cpp/src/gpgmefw.h (gpgme_tofu_info_t)
(gpgme_query_swdb_result_t): New forwards.

14 months agow32: Fix locating gpgconf on 64 bit systems.
Werner Koch [Fri, 4 Nov 2016 07:10:34 +0000 (08:10 +0100)]
w32: Fix locating gpgconf on 64 bit systems.

* src/w32-util.c (find_program_at_standard_place): Use access to check
whether the binary is at CSIDL_PROGRAM_FILES before testing
CSIDL_PROGRAM_FILESX86.
--

Suggested-by: ticho
Fixes-commit: a82e9b182f62966207cad0972be6fa284329a5a1
GnuPG-bug-id: 2814
Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agocore: Add gpgme_op_query_swdb and helper.
Werner Koch [Thu, 3 Nov 2016 15:29:45 +0000 (16:29 +0100)]
core: Add gpgme_op_query_swdb and helper.

* src/gpgme.h.in (gpgme_query_swdb_result_t): New.
(gpgme_op_query_swdb): New.
(gpgme_op_query_swdb_result): New.
* src/libgpgme.vers, src/gpgme.def: Add the two new functions.
* src/queryswdb.c: New.
* src/Makefile.am (main_sources): Add new file.
* src/context.h (OPDATA_QUERY_SWDB): New.
* src/engine-backend.h (struct engine_ops): Add field 'query_swdb'.
Adjust all initializer.
* src/engine.c (_gpgme_engine_op_query_swdb): New.
* src/engine-gpgconf.c (parse_swdb_line): New.
(gpgconf_query_swdb): New.
(_gpgme_engine_ops_gpgconf): Register that function.

* src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error.
(GPG_ERR_ENGINE_TOO_OLD): Ditto.

* tests/run-swdb.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add new debug tool.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agoqt: Change license of export / version header
Andre Heinecke [Thu, 3 Nov 2016 08:40:00 +0000 (09:40 +0100)]
qt: Change license of export / version header

* lang/qt/src/qgpgme_export.h,
lang/qt/src/qgpgme_version.h: Change license to GPLv2+

--
These files were based on copies from the cpp version/export
headers. This change is meant to clarify the licensing by
bringing it in line with the overall licesense of the
qgpgme library.

14 months agocore: Make use of --homedir in gpgconf.
Werner Koch [Thu, 3 Nov 2016 08:31:30 +0000 (09:31 +0100)]
core: Make use of --homedir in gpgconf.

* src/engine-gpgconf.c (struct engine_gpgconf): Add field 'version'.
(have_gpgconf_version): New.
(gpgconf_release): Free VERSION.
(gpgconf_new): Set VERSION.
(gpgconf_read, gpgconf_write): Use --homedir with recent gnupg.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agoqt: Fix build with g++ 4.8.x
Andras Mantia [Wed, 2 Nov 2016 09:23:42 +0000 (11:23 +0200)]
qt: Fix build with g++ 4.8.x

* lang/qt/src/defaultkeygenerationjob.cpp
(DefaultKeyGenerationJob::start): Explicitly connect pointer
in the QPointer.

--
Commit message written by Andre Heinecke <aheinecke@intevation.de>

14 months agoqt, cpp: Fix versioning in cmake config and header
Andre Heinecke [Wed, 2 Nov 2016 13:43:44 +0000 (14:43 +0100)]
qt, cpp: Fix versioning in cmake config and header

* configure.ac (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO): New
subst variables for the version header.
* lang/cpp/src/GpgmeppConfigVersion.cmake.in,
lang/cpp/src/gpgmepp_version.h.in,
lang/qt/src/QGpgmeConfigVersion.cmake.in,
lang/qt/src/qgpgme_version.h.in: Use new variables.

--
Using the LT_* variables was just wrong. Reporting the
package version also makes more sense then the library version.
Having different versions might make ABI breaks more visible
by increasing the major version number, but to have different
versions in the same package is too confusing imo and gpgme
uses a versioning that is unrelated to the library version number.

14 months agoqt: Install cmake config into qgpgme subdir
Andre Heinecke [Wed, 2 Nov 2016 13:36:56 +0000 (14:36 +0100)]
qt: Install cmake config into qgpgme subdir

* lang/qt/src/Makefile.am: Install cmake config file in qgpgme subdir.

--
Putting it together with Gpgmepp was done for historic reasons
but the proper way is for each library to have its own subdir.

14 months agoqt: Require gpgmepp from cmake config script
Andre Heinecke [Wed, 2 Nov 2016 13:31:35 +0000 (14:31 +0100)]
qt: Require gpgmepp from cmake config script

* lang/qt/src/QGpgmeConfig.cmake.in.in: Require cpp.

--
This fixes an error if a user only does find_package(QGpgme)

14 months agoqt, cpp: Add all generated files to cleanfiles
Andre Heinecke [Wed, 2 Nov 2016 11:24:42 +0000 (12:24 +0100)]
qt, cpp: Add all generated files to cleanfiles

* cpp/src/Makefile.am (CLEANFILES),
qt/src/Makefile.am (CLEANFILES): Add all generated files
to cleanfiles.

14 months agoqt: Add Distinguished Name parser from libkleo
Andre Heinecke [Tue, 1 Nov 2016 17:28:20 +0000 (18:28 +0100)]
qt: Add Distinguished Name parser from libkleo

* lang/qt/src/dn.cpp (DN, DN::Attribute): New public API.
* lang/qt/src/dn.h: New.
* lang/qt/src/Makefile.am: Update accordingly.

--
This is a general useful API to work with X509 distinguished
names and is useful when doing CMS with GpgME.

Adding this class from libkleo allows kmails messagelib to
avoid any KDE UI Frameworks and so can be used more versatile
in the future.

This class can be combined with libkleos DNAttributeMapper
to have the same bevavior as before in libkleo when using
DN::prettyDN calls can be converted from:

    Kleo::DN(uid).prettyDN();

to:
    QGpgME::DN dn(uid);
    uid.setAttributeOrder(
        Kleo::DNAttributeMapper::instance()->attributeOrder());
    dn.prettyDN();

14 months agoqt, cpp: Install version headers in subdirs
Andre Heinecke [Tue, 1 Nov 2016 09:13:49 +0000 (10:13 +0100)]
qt, cpp: Install version headers in subdirs

* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Install version headers in include
subdirs.

--
This change was requested on the gnupg-devel mailing list to
avoid placing these headers into the top level include directories.
There is currently no known user of these headers so changing it
now should not break things downstream.

14 months agopython: Use vanity modules for constants in tests and examples.
Justus Winter [Mon, 31 Oct 2016 14:28:26 +0000 (15:28 +0100)]
python: Use vanity modules for constants in tests and examples.

* lang/python/gpg/constants/sig/notation.py: New file.
* lang/python/gpg/constants/sig/__init__.py: Import new module.

* lang/python/examples/assuan.py: Use more specific module for
constants, e.g. 'protocol.ASSUAN' instead of 'PROTOCOL_ASSUAN'.
* lang/python/examples/testCMSgetkey.py: Likewise.
* lang/python/tests/initial.py: Likewise.
* lang/python/tests/t-callbacks.py: Likewise.
* lang/python/tests/t-decrypt-verify.py: Likewise.
* lang/python/tests/t-decrypt.py: Likewise.
* lang/python/tests/t-edit.py: Likewise.
* lang/python/tests/t-encrypt-large.py: Likewise.
* lang/python/tests/t-encrypt-sign.py: Likewise.
* lang/python/tests/t-encrypt-sym.py: Likewise.
* lang/python/tests/t-encrypt.py: Likewise.
* lang/python/tests/t-export.py: Likewise.
* lang/python/tests/t-file-name.py: Likewise.
* lang/python/tests/t-idiomatic.py: Likewise.
* lang/python/tests/t-import.py: Likewise.
* lang/python/tests/t-keylist.py: Likewise.
* lang/python/tests/t-protocol-assuan.py: Likewise.
* lang/python/tests/t-sig-notation.py: Likewise.
* lang/python/tests/t-sign.py: Likewise.
* lang/python/tests/t-signers.py: Likewise.
* lang/python/tests/t-trustlist.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.
* lang/python/tests/t-wait.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
14 months agopython: Import the topmost module in tests and examples.
Justus Winter [Mon, 31 Oct 2016 13:42:26 +0000 (14:42 +0100)]
python: Import the topmost module in tests and examples.

* examples/verifydetails.py: Only import the topmost module 'gpg' and
update the code accordingly.
* tests/support.py: Likewise.
* tests/t-callbacks.py: Likewise.
* tests/t-data.py: Likewise.
* tests/t-decrypt-verify.py: Likewise.
* tests/t-decrypt.py: Likewise.
* tests/t-edit.py: Likewise.
* tests/t-encrypt-large.py: Likewise.
* tests/t-encrypt-sign.py: Likewise.
* tests/t-encrypt-sym.py: Likewise.
* tests/t-encrypt.py: Likewise.
* tests/t-export.py: Likewise.
* tests/t-file-name.py: Likewise.
* tests/t-import.py: Likewise.
* tests/t-keylist.py: Likewise.
* tests/t-sig-notation.py: Likewise.
* tests/t-sign.py: Likewise.
* tests/t-signers.py: Likewise.
* tests/t-trustlist.py: Likewise.
* tests/t-verify.py: Likewise.
* tests/t-wait.py: Likewise.
* tests/t-wrapper.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
14 months agopython: Improve constants module.
Justus Winter [Mon, 31 Oct 2016 13:28:08 +0000 (14:28 +0100)]
python: Improve constants module.

* lang/python/gpg/constants/__init__.py: Import all modules below
'constants/'.  Interface hygiene: delete 'util'.
* lang/python/gpg/constants/data/encoding.py: Delete 'util'.
* lang/python/gpg/constants/event.py: Likewise.
* lang/python/gpg/constants/import.py: Likewise.
* lang/python/gpg/constants/keylist/mode.py: Likewise.
* lang/python/gpg/constants/md.py: Likewise.
* lang/python/gpg/constants/pk.py: Likewise.
* lang/python/gpg/constants/protocol.py: Likewise.
* lang/python/gpg/constants/sig/mode.py: Likewise.
* lang/python/gpg/constants/sigsum.py: Likewise.
* lang/python/gpg/constants/validity.py: Likewise.
* lang/python/gpg/errors.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
14 months agopython: Rename Python module from PyME to gpg.
Daniel Kahn Gillmor [Fri, 28 Oct 2016 20:45:49 +0000 (16:45 -0400)]
python: Rename Python module from PyME to gpg.

This follows weeks of discussion on the gnupg-devel mailing list.
Hopefully it will make it easier for people using Python to use GnuPG
in the future.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
14 months agocore: New API functions gpgme_set_sender, gpgme_get_sender.
Werner Koch [Tue, 25 Oct 2016 15:27:49 +0000 (17:27 +0200)]
core: New API functions gpgme_set_sender, gpgme_get_sender.

* src/context.h (struct gpgme_context): Add field 'sender'.
* src/gpgme.c: Include mbox-util.h.
(gpgme_release): Free SENDER.
(gpgme_set_sender): New.
(gpgme_get_sender): New.
* src/gpgme.def, src/libgpgme.vers: Add new functions.

* src/engine-gpg.c (append_args_from_sender): New.
(gpg_encrypt_sign, gpg_sign): Call append_args_from_sender.
(gpg_verify): Add arg CTX.  Call append_args_from_sender/
* src/engine-gpgsm.c (gpgsm_verify): Add dummy arg CTX.
* src/engine-uiserver.c (uiserver_verify): Ditto.
* src/engine.c (_gpgme_engine_op_verify): Add arg CTX.
* src/verify.c (verify_start): Pass CTX to engine function.

* tests/gpg/t-verify.c (main): Add some checks for new functions.
* tests/run-sign.c (main): Add option --sender.
* tests/run-verify.c (main): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
14 months agoqt: Improve WKSPublishJob apidoc
Andre Heinecke [Wed, 19 Oct 2016 13:17:09 +0000 (15:17 +0200)]
qt: Improve WKSPublishJob apidoc

* lang/qt/src/wkspublishjob.h: Improve doc.

14 months agoPost release updates gpgme-1.7-branch
Werner Koch [Tue, 18 Oct 2016 17:40:11 +0000 (19:40 +0200)]
Post release updates

--

14 months agoRelease 1.7.1. gpgme-1.7.1
Werner Koch [Tue, 18 Oct 2016 17:23:59 +0000 (19:23 +0200)]
Release 1.7.1.

* configure.ac: Set LT version to C27/A16/R0.  Note that the LT
versions for cpp and Qt have already been updated.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agotests: Make t-cancel more portable.
Werner Koch [Fri, 14 Oct 2016 14:29:06 +0000 (16:29 +0200)]
tests: Make t-cancel more portable.

* tests/gpg/t-cancel.c: Include sys/time.h and protect sys/select.h.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agopython: Call ln(1) in a portable way.
Werner Koch [Fri, 14 Oct 2016 14:20:15 +0000 (16:20 +0200)]
python: Call ln(1) in a portable way.

* lang/python/Makefile.am: Specify target dir for ln.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agocpp: Fix init of string from null
Andre Heinecke [Fri, 14 Oct 2016 14:23:57 +0000 (16:23 +0200)]
cpp: Fix init of string from null

* lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return
value before creating the string.

15 months agopython: Make 'get_key' more idiomatic.
Justus Winter [Thu, 13 Oct 2016 11:13:23 +0000 (13:13 +0200)]
python: Make 'get_key' more idiomatic.

* lang/python/pyme/core.py (Context.get_key): Raise errors.KeyNotFound
if the key is not found.  This error is both a KeyError for idiomatic
error handling as well as a GPGMEError so we don't break existing
code.
* lang/python/pyme/errors.py (KeyNotFound): New class.
* lang/python/tests/support.py (no_such_key): New variable.
* lang/python/tests/t-keylist.py: Test the new behavior.

Signed-off-by: Justus Winter <justus@g10code.com>
15 months agopython: Return public keys by default.
Justus Winter [Thu, 13 Oct 2016 10:05:59 +0000 (12:05 +0200)]
python: Return public keys by default.

* lang/python/pyme/core.py (Core.get_key): Return public keys by
default, improve docstring.
* lang/python/examples/testCMSgetkey.py: Update example.
* lang/python/examples/verifydetails.py: Likewise.

GnuPG-bug-id: 2751
Signed-off-by: Justus Winter <justus@g10code.com>
15 months agopython: Fix example.
Justus Winter [Thu, 13 Oct 2016 10:45:50 +0000 (12:45 +0200)]
python: Fix example.

* lang/python/examples/inter-edit.py: Fix example.

Fixes-commit: a458e7fe
Signed-off-by: Justus Winter <justus@g10code.com>
15 months agocpp: Fix version number
Andre Heinecke [Thu, 13 Oct 2016 08:13:47 +0000 (10:13 +0200)]
cpp: Fix version number

* configure.ac (LIBGPGMEPP_LT_CURRENT): Bump.
--
Added API so it should have been correct to bump current
and age and not to bump age.

15 months agoqt, cpp: Fix permissions of Config files
Andre Heinecke [Thu, 13 Oct 2016 07:35:30 +0000 (09:35 +0200)]
qt, cpp: Fix permissions of Config files

* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Do not install config files as executable.

15 months agoqt: Install SpecialJob
Andre Heinecke [Thu, 13 Oct 2016 07:13:50 +0000 (09:13 +0200)]
qt: Install SpecialJob

* lang/qt/src/Makefile.am: Install SpecialJob
* NEWS: mention it.

--
SpecialJob was and is public API. So it needs to be installed.

15 months agoqt, cpp: Fix expected targets in Config files
Andre Heinecke [Thu, 13 Oct 2016 07:07:36 +0000 (09:07 +0200)]
qt, cpp: Fix expected targets in Config files

* lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in: Remove KF5 variants.

15 months agoMention Qt API fixes in news
Andre Heinecke [Tue, 11 Oct 2016 17:57:35 +0000 (19:57 +0200)]
Mention Qt API fixes in news

--

15 months agoqt: Add missing implementation of MultiDeleteJob
Daniel Vrátil [Tue, 11 Oct 2016 17:32:54 +0000 (19:32 +0200)]
qt: Add missing implementation of MultiDeleteJob

* lang/qt/src/multideletejob.h: Fix include, cryptobackend.h is now
called protocol.h
* lang/qt/src/multideletejob.cpp: New file.
* lang/qt/src/Makefile.am: Add multideletejob.cpp.

15 months agoqt: Install abstractimportjob.h
Daniel Vrátil [Tue, 11 Oct 2016 17:32:08 +0000 (19:32 +0200)]
qt: Install abstractimportjob.h

* lang/cpp/src/Makefile.am: Install abstractimportjob.h since it's
included from importjob.h

--
Fixes build when someone inclues importjob.h in their code.

15 months agocpp: Add API for gpgme_addrspec_from_uid
Andre Heinecke [Tue, 11 Oct 2016 12:13:15 +0000 (14:13 +0200)]
cpp: Add API for gpgme_addrspec_from_uid

* lang/cpp/src/key.cpp (UserID::addrSpecFromString): New static
function to expose addrspec from uid.
(UserID::addrSpec): New. Get addrSpec from Userid.
* NEWS: Update accordingly.

15 months agoAdd NEWS for cpp and qt, bump cpp version
Andre Heinecke [Mon, 10 Oct 2016 15:42:10 +0000 (17:42 +0200)]
Add NEWS for cpp and qt, bump cpp version

* NEWS: Add entries for cpp and qt changes.
* configure.ac: Bump cpp version because of added API.

15 months agoAdd convenience function to get key from sig
Andre Heinecke [Mon, 10 Oct 2016 15:38:43 +0000 (17:38 +0200)]
Add convenience function to get key from sig

* lang/cpp/src/verificationresult.cpp (Signature::key(bool, bool)):
New. Can be used to search / update the key associcated with this
signature.

--
By using update a caller can ensure that an incomplete key
obtainable through the new key() function is fully loaded.
With search the key can be looked up in the internal keyring.

As the results are cached this can be done in the crypto thread
and the result then better used in the UI thread.

15 months agocpp: Return null key if the signature had no key
Andre Heinecke [Mon, 10 Oct 2016 15:36:41 +0000 (17:36 +0200)]
cpp: Return null key if the signature had no key

* lang/cpp/src/verificationresult.cpp (Private): Add null key
to list when there is no key associated with the signature.

--
This fixes an out of bounds read when a verification did
not have a key.

15 months agoqt: Add simple verify test
Andre Heinecke [Mon, 10 Oct 2016 13:22:17 +0000 (15:22 +0200)]
qt: Add simple verify test

* lang/qt/tests/t-verify.cpp: New. Small test if a signature
returns a key with fingerprint.
* lang/qt/tests/Makefile.am: Add new test.

15 months agocore: Fix w32 crash in find_program_in_dir
Andre Heinecke [Mon, 10 Oct 2016 10:19:48 +0000 (12:19 +0200)]
core: Fix w32 crash in find_program_in_dir

* src/w32-util.c (find_program_in_dir): Fix call to _gpgme_strconcat.

--
This fixes a crash introduced by dc39552d0 because it tried
to concat a strlen.

15 months agocore: New helper function gpgme_addrspec_from_uid.
Werner Koch [Sat, 8 Oct 2016 19:14:52 +0000 (21:14 +0200)]
core: New helper function gpgme_addrspec_from_uid.

* src/gpgme.h.in: Add gpgme_addrspec_from_uid.
* src/gpgme.def, src/libgpgme.vers: Ditto.
* src/mbox-util.c (gpgme_addrspec_from_uid): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agoAdd missing includes.
Justus Winter [Thu, 6 Oct 2016 11:12:28 +0000 (13:12 +0200)]
Add missing includes.

* lang/cpp/src/key.cpp: Include <strings.h> for 'strcasecmp'.
* tests/gpg/t-cancel.c: Include <sys/select.h> for 'fd_set' and
friends.

Signed-off-by: Justus Winter <justus@g10code.com>
15 months agocpp: Bump Revision
Andre Heinecke [Wed, 5 Oct 2016 15:38:49 +0000 (17:38 +0200)]
cpp: Bump Revision

* configure.ac (LIBGPGMEPP_LT_REVISION): Bump revision.

--
The Data::Encoding enum now supports more encodings so
this should have been done then.

15 months agoqt: Fix spelling error in WKSPublishJob
Andre Heinecke [Wed, 5 Oct 2016 15:27:36 +0000 (17:27 +0200)]
qt: Fix spelling error in WKSPublishJob

* src/qgpgmewkspublishjob.cpp,
src/qgpgmewkspublishjob.h,
src/wkspublishjob.h,
tests/t-wkspublish.cpp: Fix spelling of received.
* src/configure.ac (LIBQGPGME_LT_CURRENT): Bump
accordingly.

--
While this is an API break I've decided to fix this now
instead of deprecating / keeping it around forever in the API.

The only known users of QGpgME are KDE Applications and
there it is not yet used.

15 months agoqt: Disable tests that require a password for 2.0
Andre Heinecke [Wed, 5 Oct 2016 15:19:20 +0000 (17:19 +0200)]
qt: Disable tests that require a password for 2.0

* lang/qt/tests/t-encrypt.cpp: Disable tests that require
a password for 2.0.

--
The passphrase_cb apparently does not work with 2.0 so we would
need a fake pinentry to get this to work. We just disable the
test instead as this is a rarely used feature and works with
1.4 and 2.1.

15 months agoAdd warning flags for c++ compiler, too
Andre Heinecke [Wed, 5 Oct 2016 14:55:14 +0000 (16:55 +0200)]
Add warning flags for c++ compiler, too

* configure.ac (CXXFLAGS): Add Wall and Wextra.

15 months agoqt: Fix unused variable warnings
Andre Heinecke [Wed, 5 Oct 2016 14:44:53 +0000 (16:44 +0200)]
qt: Fix unused variable warnings

* qt/src/qgpgmenewcryptoconfig.cpp,
qt/src/threadedjobmixin.h,
qt/tests/t-encrypt.cpp,
qt/tests/t-support.h,
qt/tests/t-wkspublish.cpp: Mark additional variables as unused.

15 months agocpp: Add support for URL Data encodings
Andre Heinecke [Wed, 5 Oct 2016 14:43:16 +0000 (16:43 +0200)]
cpp: Add support for URL Data encodings

* lang/cpp/src/data.h (Data::Encoding): Extend enum.
* lang/cpp/src/data.cpp (Data::encoding),
Data::setEncoding): Support new values.

15 months agocpp: Fix gcc diagnostic push / pop
Andre Heinecke [Wed, 5 Oct 2016 14:27:18 +0000 (16:27 +0200)]
cpp: Fix gcc diagnostic push / pop

* lang/cpp/src/context.cpp: Fix pragmas.

--
This fixes an error with -Werror=unknown-pragmas

15 months agoqt: Disable t-wkspublish test
Andre Heinecke [Wed, 5 Oct 2016 14:01:20 +0000 (16:01 +0200)]
qt: Disable t-wkspublish test

* lang/qt/tests/Makefile.am (TESTS): Remove t-wkspublish.

--
Even the only enabled test did a connection to localhost this
might fail if it is stalled and is an outside factor. It also might
be disturbing other services locally.

15 months agopython: Link 'data.h' and 'config.h' into the builddir.
Alon Bar-Lev [Thu, 29 Sep 2016 07:30:58 +0000 (10:30 +0300)]
python: Link 'data.h' and 'config.h' into the builddir.

* lang/python/Makefile.am: Link to the files.
* lang/python/gpgme.i: Update path.
* lang/python/setup.py.in: Do not add the top builddir to the include
path.
--
To make it easy to build the subpackage using standard tools without
altering environment or CFLAGS, symlink the required artifacts from
source tree into subpackage directory when preparing sources.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
15 months agopython: Add 'prepare' target.
Alon Bar-Lev [Thu, 29 Sep 2016 07:30:57 +0000 (10:30 +0300)]
python: Add 'prepare' target.

* lang/python/Makefile.am: Add 'prepare' target.
--
This enables preparing the package using autoconf then build using
distutils as separate stage.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
15 months agopython: Make generated 'setup.py' executable.
Alon Bar-Lev [Thu, 29 Sep 2016 07:30:56 +0000 (10:30 +0300)]
python: Make generated 'setup.py' executable.

--
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
15 months agocpp, qt: Handle modified includedir installation
Andre Heinecke [Thu, 29 Sep 2016 10:46:18 +0000 (12:46 +0200)]
cpp, qt: Handle modified includedir installation

* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Replace resolved_includedir.
* lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in: Use resolved_includedir
instead of relying on a common installation prefix.

--
This fixes usage of the config files in case gpgme
is configured with a custom --includedir.
We have to do the replacement manually like for libdir
because configure would include variables in the replacement.

15 months agotests: Fix blunder.
Justus Winter [Tue, 27 Sep 2016 10:49:24 +0000 (12:49 +0200)]
tests: Fix blunder.

--
Fixes-commit: a423603f
Signed-off-by: Justus Winter <justus@g10code.com>
15 months agoClarify licensing
Daniel Kahn Gillmor [Fri, 23 Sep 2016 11:58:58 +0000 (07:58 -0400)]
Clarify licensing

* src/b64dec.c, src/mbox-util.c, src/mbox-util.h: These three files
  are explicitly licensed under LGPL, but their comments suggest that
  details about the warranty can be found in the GPL.  Adjust comments
  to refer to the correct license.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
15 months agotests: Fix check for gpg versions not reporting the critical flag.
Justus Winter [Tue, 27 Sep 2016 10:28:38 +0000 (12:28 +0200)]
tests: Fix check for gpg versions not reporting the critical flag.

* lang/python/tests/t-sig-notation.py: Also blacklist 2.0.x.
* tests/gpg/t-sig-notation.c: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
15 months agopython: Get rid of the last C++-style comments.
Justus Winter [Mon, 26 Sep 2016 14:45:21 +0000 (16:45 +0200)]
python: Get rid of the last C++-style comments.

--
Signed-off-by: Justus Winter <justus@g10code.com>
15 months agopython: Correctly translate to size_t.
Justus Winter [Mon, 26 Sep 2016 11:16:59 +0000 (13:16 +0200)]
python: Correctly translate to size_t.

* lang/python/gpgme.i: Correctly translate Python number to size_t.

Signed-off-by: Justus Winter <justus@g10code.com>
15 months agopython: Correctly translate off_t.
Justus Winter [Mon, 26 Sep 2016 11:04:35 +0000 (13:04 +0200)]
python: Correctly translate off_t.

* lang/python/gpgme.i: Improve int/long translations, correctly handle
off_t with large file support.

Signed-off-by: Justus Winter <justus@g10code.com>
15 months agopython: Include 'config.h'.
Justus Winter [Mon, 26 Sep 2016 09:35:40 +0000 (11:35 +0200)]
python: Include 'config.h'.

* lang/python/Makefile.am: Pass 'top_builddir' to 'setup.py'.
* lang/python/gpgme.i: Include 'config.h'.
* lang/python/helpers.c: Likewise.
* lang/python/helpers.h: Likewise.
* lang/python/setup.py.in: Make sure that 'config.h' can be found.
--
Fixes build on 32 bit platforms with large file support.

Signed-off-by: Justus Winter <justus@g10code.com>
15 months agoFix spelling
Daniel Kahn Gillmor [Thu, 22 Sep 2016 22:43:48 +0000 (18:43 -0400)]
Fix spelling

 * lang/cpp/src/context.h, lang/qt/src/protocol.h,
   lang/qt/src/wkspublishjob.h, src/data-identify.c, src/engine-gpg.c:
   minor spelling cleanup.
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
15 months agomove some file encodings to UTF-8
Daniel Kahn Gillmor [Thu, 22 Sep 2016 22:23:04 +0000 (18:23 -0400)]
move some file encodings to UTF-8

* THANKS, doc/ChangeLog-2011, tests/ChangeLog-2011,
  tests/gpg/geheim.txt: convert from iso 8859-1 to utf-8.
* lang/qt/src/dataprovider.cpp, lang/qt/src/qgpgmerefreshkeysjob.cpp,
  lang/qt/src/qgpgmesecretkeyexportjob.cpp: replace U+FFFD REPLACEMENT
  CHARACTER with proper U+00E4 LATIN SMALL LETTER A WITH DIAERESIS.

--
Note that src/versioninfo.rc.in is still ISO-8859-1.  I don't know
whether Windows will properly handle UTF-8 in this file or not, so i
have not touched it.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
15 months agotests: Check data after decryption
Andre Heinecke [Fri, 23 Sep 2016 14:03:37 +0000 (16:03 +0200)]
tests: Check data after decryption

* tests/gpgsm/t-decrypt.c (main): Check data matches expected.
Only print result if it does not.

15 months agocpp, qt: Include config.h
Andre Heinecke [Fri, 23 Sep 2016 13:22:29 +0000 (15:22 +0200)]
cpp, qt: Include config.h

lang/cpp/src/callbacks.cpp,
lang/cpp/src/configuration.cpp,
lang/cpp/src/context.cpp,
lang/cpp/src/context_glib.cpp,
lang/cpp/src/context_qt.cpp,
lang/cpp/src/context_vanilla.cpp,
lang/cpp/src/data.cpp,
lang/cpp/src/decryptionresult.cpp,
lang/cpp/src/defaultassuantransaction.cpp,
lang/cpp/src/editinteractor.cpp,
lang/cpp/src/encryptionresult.cpp,
lang/cpp/src/engineinfo.cpp,
lang/cpp/src/eventloopinteractor.cpp,
lang/cpp/src/exception.cpp,
lang/cpp/src/gpgadduserideditinteractor.cpp,
lang/cpp/src/gpgagentgetinfoassuantransaction.cpp,
lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp,
lang/cpp/src/gpgsetownertrusteditinteractor.cpp,
lang/cpp/src/gpgsignkeyeditinteractor.cpp,
lang/cpp/src/importresult.cpp,
lang/cpp/src/key.cpp,
lang/cpp/src/keygenerationresult.cpp,
lang/cpp/src/keylistresult.cpp,
lang/cpp/src/scdgetinfoassuantransaction.cpp,
lang/cpp/src/signingresult.cpp,
lang/cpp/src/tofuinfo.cpp,
lang/cpp/src/trustitem.cpp,
lang/cpp/src/verificationresult.cpp,
lang/cpp/src/vfsmountresult.cpp,
lang/qt/src/dataprovider.cpp,
lang/qt/src/defaultkeygenerationjob.cpp,
lang/qt/src/gpgme_backend_debug.cpp,
lang/qt/src/job.cpp,
lang/qt/src/qgpgmeadduseridjob.cpp,
lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.cpp,
lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmedecryptverifyjob.cpp,
lang/qt/src/qgpgmedeletejob.cpp,
lang/qt/src/qgpgmedownloadjob.cpp,
lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmeexportjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportjob.cpp,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
lang/qt/src/qgpgmekeygenerationjob.cpp,
lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.cpp,
lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmerefreshkeysjob.cpp,
lang/qt/src/qgpgmesecretkeyexportjob.cpp,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmesignjob.cpp,
lang/qt/src/qgpgmesignkeyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.cpp,
lang/qt/src/qgpgmeverifyopaquejob.cpp,
lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/threadedjobmixin.cpp,
lang/qt/tests/run-keyformailboxjob.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-tofuinfo.cpp,
lang/qt/tests/t-wkspublish.cpp: Include config.h

--
This fixes problems with mismatching definitions. Most
notably _FILE_OFFSET_BITS is now always set correctly.

15 months agow32: Silence some warnings about unused parameters.
Werner Koch [Thu, 22 Sep 2016 10:58:23 +0000 (12:58 +0200)]
w32: Silence some warnings about unused parameters.

* src/assuan-support.c (my_recvmsg, my_sendmsg, my_waitpid)
(my_socketpair) [W32]: Mark unused parameters.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agocore: Fix error checking in _gpgme_mkstemp.
Werner Koch [Thu, 22 Sep 2016 10:46:06 +0000 (12:46 +0200)]
core: Fix error checking in _gpgme_mkstemp.

* src/w32-util.c (_gpgme_mkstemp): Fix error checking.
(dlopen): Mark FLAGS as unused.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agocore: New helper function _gpgme_strconcat.
Werner Koch [Thu, 22 Sep 2016 10:41:55 +0000 (12:41 +0200)]
core: New helper function _gpgme_strconcat.

* src/conversion.c: Include stdarg.h.
(do_strconcat): New.
(_gpgme_strconcat): New.
* src/util.h: Provide fallback for GPGRT_ATTR_SENTINEL.
(_gpgme_strconcat): New with sentinel.

* src/w32-util.c (find_program_in_dir): Replace malloc and stpcpy by
_gpgme_strconcat.
(find_program_at_standard_place): Ditto.
(_gpgme_set_default_gpg_name): Ditto.
(_gpgme_set_default_gpgconf_name): Ditto.
(_gpgme_mkstemp): Ditto.
(_gpgme_set_override_inst_dir): Repalce malloc and strcpy by strdup.
--

The function has been taken from gnupg/common/stringhelp.c and license
changed to LPGLv2.1+.  I am the original author of that code.

Signed-off-by: Werner Koch <wk@gnupg.org>
15 months agotests: Add test for cancellation
Daiki Ueno [Tue, 9 Feb 2016 08:03:54 +0000 (17:03 +0900)]
tests: Add test for cancellation

* tests/gpg/t-cancel.c: New file.
* tests/gpg/Makefile.am (tests_skipped): New variable, default to
t-genkey and t-cancel.
(noinst_PROGRAMS): Add $(tests_skipped).
* tests/gpg/.gitignore: Add t-cancel.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
15 months agogpg: Add option --exit-on-status-write-error
Daiki Ueno [Tue, 9 Feb 2016 08:03:53 +0000 (17:03 +0900)]
gpg: Add option --exit-on-status-write-error

* src/engine-gpg.c (gpg_new): Add --exit-on-status-write-error if the
engine version is latest enough to expect progress output from gpg.

--
GnuPG-bug-id: 1415
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Changed the version test from the patch to use the newer
have_gpg_version.

Signed-off-by: Werner Koch <wk@gnupg.org>