gpgme.git
5 months agotests,json: Clean openpgp-revocs.d aheinecke/json-test
Andre Heinecke [Thu, 15 Nov 2018 09:33:35 +0000 (10:33 +0100)]
tests,json: Clean openpgp-revocs.d

* tests/json/clean-local: Remove revocs.d

5 months agotests,json: Move version check into t-json
Andre Heinecke [Thu, 15 Nov 2018 09:31:22 +0000 (10:31 +0100)]
tests,json: Move version check into t-json

* tests/gpg/t-support.h (check_gpg_version, compare_versions),
(parse_version_string, parse_version_number): Remove version
check code.
* tests/json/t-json.c (check_gpg_version, compare_versions),
(parse_version_string, parse_version_number): Add.
--

t-support header was not a good place for this. It should
go into a library e.g. gpgrt in the future. For now we
can keep it close to where it is needed.

5 months agotests,json: Add sig-notations test
Andre Heinecke [Wed, 14 Nov 2018 16:56:23 +0000 (17:56 +0100)]
tests,json: Add sig-notations test

* tests/json/t-sig-notations.in.json,
tests/json/t-sig-notations.out.json: New
* tests/json/Makefile.am (EXTRA_DIST): Add files.
* tests/json/t-json.c: Register it.

5 months agotests,json: Fix distcheck
Andre Heinecke [Wed, 14 Nov 2018 16:21:24 +0000 (17:21 +0100)]
tests,json: Fix distcheck

* tests/json/Makefile.am (EXTRA_DIST): Add inital and final scripts.
(t_json_SOURCES): Don't use cJSON.o as source.

5 months agotests,json: Add more tests
Andre Heinecke [Wed, 14 Nov 2018 16:05:25 +0000 (17:05 +0100)]
tests,json: Add more tests

* t-config-opt.in.json,
 t-config-opt.out.json,
 t-import.in.json,
 t-import.out.json,
 t-sign.in.json,
 t-sign.out.json: New.
--
These should actually have been in a previous commit as
they are already registered.

5 months agotests,json: Add missing files and chunking test
Andre Heinecke [Wed, 14 Nov 2018 14:55:02 +0000 (15:55 +0100)]
tests,json: Add missing files and chunking test

* tests/json/Makefile.am, tests/json/final.test,
tests/json/initial.test: New.
* tests/json/t-chunking.in.json, tests/json/t-chunking.out.json:
New test.
* tests/json/t-json.c: Register new test.

--
Oops..

5 months agotests,json: Fix match if the first child differs
Andre Heinecke [Wed, 14 Nov 2018 14:17:18 +0000 (15:17 +0100)]
tests,json: Fix match if the first child differs

* tests/json/t-json.c (test_contains): Try all siblings of
the haystack child.

--
This fixes the case where we don't match against the
first child because the order might have changed or
a new element was inserted at the top. Then we
have to try out also all the siblings.

5 months agotests,json: Add the bulk of tests
Andre Heinecke [Wed, 14 Nov 2018 14:15:21 +0000 (15:15 +0100)]
tests,json: Add the bulk of tests

* t-json.c (tests): Register new tests.
* t-createkey.in.json,
  t-createkey.out.json,
  t-decrypt-verify.in.json,
  t-decrypt-verify.out.json,
  t-decrypt.in.json,
  t-decrypt.out.json,
  t-delete.in.json,
  t-delete.out.json,
  t-encrypt-sign.in.json,
  t-encrypt-sign.out.json,
  t-encrypt.in.json,
  t-encrypt.out.json,
  t-export-secret-info.in.json,
  t-export-secret-info.out.json,
  t-export.in.json,
  t-export.out.json,
  t-json.c,
  t-keylist-secret.in.json,
  t-keylist-secret.out.json,
  t-keylist.in.json,
  t-keylist.out.json,
  t-verify.in.json,
  t-verify.out.json,
  t-version.in.json,
  t-version.out.json: New.

--
Except for help and getmore there is now a test for each command.

5 months agotests,json: Add wildcard string matching
Andre Heinecke [Wed, 14 Nov 2018 13:57:40 +0000 (14:57 +0100)]
tests,json: Add wildcard string matching

* tests/json/t-json.c (test_contains): When searching for "*" accept
every string.

--
This allows it to write tests that check for the existence of
a string value but don't care about the contents. E.g. for Data.

5 months agotests,json: Skip tests for older GnuPG versions
Andre Heinecke [Wed, 14 Nov 2018 13:55:09 +0000 (14:55 +0100)]
tests,json: Skip tests for older GnuPG versions

* tests/json/t-json.c (main): Skip if version is not at least
2.2.0

--
In the past new tests often failed when a modern GPGME was
used with old GnuPG's.
This should avoid the hassle for packagers without the
requirement that we test against old versions.

5 months agotests,json: Suffix .json to test pattern
Andre Heinecke [Wed, 14 Nov 2018 13:53:28 +0000 (14:53 +0100)]
tests,json: Suffix .json to test pattern

* tests/json/t-config.in, tests/json/t-config.out: Renamed.
* t-json.c (run_test): Use new naming pattern.

5 months agotests,gpg: Add version check hlp to t-support
Andre Heinecke [Wed, 14 Nov 2018 13:50:57 +0000 (14:50 +0100)]
tests,gpg: Add version check hlp to t-support

* t-support.h (parse_version_number, parse_version_string)
(compare_versions): New. Copy&Paste from src/version.c
(check_gpg_version): New helper to check for a gpg version.

--
This should make it easier to write tests that e.g.
rely on modern gnupg features.

5 months agotests,json: Improve verbose mode and add verbose 2
Andre Heinecke [Wed, 14 Nov 2018 12:14:52 +0000 (13:14 +0100)]
tests,json: Improve verbose mode and add verbose 2

* tests/json/t-json.c (main): Handle multiple verbose args.
(test-contains): Improve verbose output

5 months agotests,json: Fix and improve t-json
Andre Heinecke [Wed, 14 Nov 2018 12:05:36 +0000 (13:05 +0100)]
tests,json: Fix and improve t-json

* tests/json/t-json.c (run_test): Terminate argv array correctly.
(run_test): Note and handle empty response.

5 months agotests: Add json testrunner
Andre Heinecke [Wed, 14 Nov 2018 10:47:59 +0000 (11:47 +0100)]
tests: Add json testrunner

* configure.ac: Configure makefile.
* tests/Makefile.am: Run json tests if gpg tests are run.
* tests/json/t-json.c: New testrunner for json tests.
* tests/json/t-config.in, tests/json/t-config.out: First test.
--
The idea of this test runner is that it only looks for parts
in the output. This should allow it to write robust tests
that check for the basics in the output but don't fail when
the output is extended or slightly changed.

5 months agobuild: Update gpg-error.m4 and libassuan.m4.
NIIBE Yutaka [Tue, 13 Nov 2018 02:44:24 +0000 (11:44 +0900)]
build: Update gpg-error.m4 and libassuan.m4.

* m4/gpg-error.m4: Update from master.
* m4/libassuan.m4: Update from master.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agoFix the previous commit.
NIIBE Yutaka [Mon, 12 Nov 2018 10:11:49 +0000 (19:11 +0900)]
Fix the previous commit.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agobuild: Make gpgme.m4 use gpgrt-config with *.pc.
NIIBE Yutaka [Mon, 12 Nov 2018 01:01:16 +0000 (10:01 +0900)]
build: Make gpgme.m4 use gpgrt-config with *.pc.

* src/gpgme.m4 (_AM_PATH_GPGME_CONFIG): Use gpgrt-config with gpgme.pc
when possible.
(AM_PATH_GPGME_GLIB): Likewise with gpgme-glib.pc.

--

Keeping AM_PATH_GPGME_PTHREAD, as is, untouched.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agobuild: Provide gpgme-glib.pc too.
NIIBE Yutaka [Mon, 12 Nov 2018 00:59:05 +0000 (09:59 +0900)]
build: Provide gpgme-glib.pc too.

* src/gpgme-glib.pc.in: New.
* src/gpgme.pc.in (avail_lang): Remove.

--

Provide gpgme-glib.pc for gpgme-glib library.  The avial_lang
information is no use because *.pc is for C.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agobuild: Provide gpgme.pc, generated by configure.
NIIBE Yutaka [Mon, 12 Nov 2018 00:03:49 +0000 (09:03 +0900)]
build: Provide gpgme.pc, generated by configure.

* configure.ac: Generate src/gpgme.pc.
* src/Makefile.am (pkgconfigdir, pkgconfig_DATA): New.
(EXTRA_DIST): Add gpgme.pc.in.
* src/gpgme.pc.in: New.
* src/gpgme-config.in: Use variables.

--

Some usages of gpgme-config is not compatible to pkg-config style;
The --glib option and --thread option which affect the output
by --cflags or --libs are not supported by gpgme.pc.

gpgme-config's embedding information for gpg-error and libassuan at
the build time of gpgme is considered inflexible than pkg-config
style.  It is now handled by dependency of gpgme.pc (Requires field).

To use gpgme.pc, newer libgpg-error (>= 1.33) and libassuan (>= 2.5.3)
are required, which provide gpg-error.pc and libassuan.pc respectively.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
5 months agospelling: fix misspellings
Daniel Kahn Gillmor [Thu, 8 Nov 2018 05:34:27 +0000 (12:34 +0700)]
spelling: fix misspellings

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 months agodocs: python bindings
Ben McGinnes [Tue, 6 Nov 2018 05:22:50 +0000 (16:22 +1100)]
docs: python bindings

* Continued restructuring as part of moving beyond mere;y the HOWTO
  file.
* Generated the alternative source files for reST and Texinfo.
* Fixed some errors and updated links after moving the what's new
  section to two new files (yes, two).

5 months agopython examples: another importer
Ben McGinnes [Tue, 6 Nov 2018 03:58:15 +0000 (14:58 +1100)]
python examples: another importer

* Fixed a similar type of bug with the non-protonmail importer.

5 months agopython examples: protonmail hkp scripts
Ben McGinnes [Tue, 6 Nov 2018 03:11:01 +0000 (14:11 +1100)]
python examples: protonmail hkp scripts

* fixed a bug in the import try statement for both versions.

5 months agogpg: Avoid error diagnostics with --override-session-key.
Werner Koch [Mon, 5 Nov 2018 09:30:27 +0000 (10:30 +0100)]
gpg: Avoid error diagnostics with --override-session-key.

* src/engine-gpg.c (gpg_decrypt): Add --no-keyring.
--

GnuPG-bug-id: 3464
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agodocs: typo
Ben McGinnes [Sat, 3 Nov 2018 07:12:25 +0000 (18:12 +1100)]
docs: typo

* lang/python/doc/src/gpgme-python-howto: s/Revokinging/Revoking/g

5 months agow32: Fix a few compiler warnings.
Werner Koch [Fri, 2 Nov 2018 11:54:22 +0000 (12:54 +0100)]
w32: Fix a few compiler warnings.

* src/debug.h (TRACE_SYSERR_NR): New.
* src/w32-io.c: Fix compiler warnings.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Log all errors from CloseHandle and WFSO in w32-io.
Werner Koch [Fri, 2 Nov 2018 11:28:17 +0000 (12:28 +0100)]
w32: Log all errors from CloseHandle and WFSO in w32-io.

* src/w32-io.c (close_handle, _close_handle): New macro and function;
use in place of all CloseHandle calls.
(wait_for_single_object, _wait_for_single_object): Likewise.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Don't use CloseHandle on an arbitrary integer.
Werner Koch [Fri, 2 Nov 2018 10:26:19 +0000 (11:26 +0100)]
w32: Don't use CloseHandle on an arbitrary integer.

* src/assuan-support.c (my_waitpid): Do not close the PID = it is not
a handle.
--

At some time in the distant past we might have used the process object
as pid which obviously required a close.  However this was changed and
so what we did here was to close an arbitrary handle (one which
matches the pid).

GnuPG-bug-id: 4237
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Revamp the closing of system objects.
Werner Koch [Fri, 2 Nov 2018 08:14:07 +0000 (09:14 +0100)]
w32: Revamp the closing of system objects.

* src/w32-io.c (hddesc_t): New.
(reader_context_s, writer_context_s): Replace file_sock and file_hd by
the hddesc_t hdd.
(fd_table): Ditto.  Add want_reader and want_writer.
(hddesc_lock): New lock variable.
(new_hddesc, ref_hddesc): New.
(release_hddesc): New.
(reader, writer): Call release_hddesc.
(create_reader, create_writer): Change for new hddesc scheme.
(destroy_reader, destroy_writer): Replace closing by a call to
release_hddesc.
(_gpgme_io_pipe): Change for new hddesc scheme.
(_gpgme_io_close): Ditto.
(_gpgme_io_dup): Ditto.  Use want_reader and want_writer.
(_gpgme_io_socket): Change for new hddesc scheme.
--

GnuPG-bug-id: 4237
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agocore: Print a dump of the I/O data only at level 8.
Werner Koch [Fri, 2 Nov 2018 08:03:43 +0000 (09:03 +0100)]
core: Print a dump of the I/O data only at level 8.

* src/debug.h (TRACE_SUC3): New.
(TRACE_LOGBUFX): New.
* src/posix-io.c: Use TRACE_LOGBUFX instead of TRACE_LOGBUF.
* src/w32-glib-io.c: Ditto.
--

This will also be changed for w32-io as part of another commit.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Fix and improve CancelSynchronousIo use.
Werner Koch [Fri, 2 Nov 2018 07:47:44 +0000 (08:47 +0100)]
w32: Fix and improve CancelSynchronousIo use.

* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL
and print trace info only on error.
--

Fixes-commit: 63ba09b541dabbe838253926896e721cb9be564a
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Use CancelSynchronousIo in destroy_reader.
Werner Koch [Thu, 1 Nov 2018 08:55:24 +0000 (09:55 +0100)]
w32: Use CancelSynchronousIo in destroy_reader.

* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): New.
* src/w32-io.c (destroy_reader): Use it here.
--

This has not been tested but should on Vista and later help to fix a
possible hang.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Merge all the object tables of w32-io into one.
Werner Koch [Thu, 1 Nov 2018 08:53:48 +0000 (09:53 +0100)]
w32: Merge all the object tables of w32-io into one.

* src/w32-io.c (fd_table_size): New.  Used in most places instead of
the MAX_SLAFD constant.
(reader_table, writer_table, notify_table): Merge them into ...
(fd_table): this table.  Chnage all affected code to take just one
lock.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Remove unused arg from two functions.
Werner Koch [Wed, 31 Oct 2018 13:58:23 +0000 (14:58 +0100)]
w32: Remove unused arg from two functions.

* src/w32-io.c (find_reader, find_writer): Remove unused start_it
arg.  It is always passed as true.  Change callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Remove all support for WindowsCE
Werner Koch [Wed, 31 Oct 2018 11:27:27 +0000 (12:27 +0100)]
w32: Remove all support for WindowsCE

* configure.ac: Remove WindwosCE support.
* contrib/: Remove all; it was only used for WindowsCE.
* src/w32-ce.c, src/w32-ce.h: Remove files.
* src/Makefile.am (system_components): Remove these files.
* src/ath.c, src/ath.h: Remove W32CE support.
* src/data-compat.c (gpgme_data_new_from_filepart): Ditto.
(gpgme_data_new_from_file): Ditto.
* src/debug.c (debug_init, _gpgme_debug): Ditto.
* src/gpgme-tool.c (gpgme_server): Ditto.
(main): Ditto.
* src/priv-io.h: Do not include w32-ce.h.
* src/util.h: Remove WindowsCE support.
* src/w32-io.c: Ditto.
* src/w32-util.c: Ditto.
* src/debug.h (TRACE_SUC4): New.
--

There is no more hardware to test our code, the support for Windows CE
terminated along time ago.  Note that our code worked only with the
old WindowsCE with that overall system limit of 31 processes.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agow32: Remove cruft in w32-io from WindowsME times.
Werner Koch [Wed, 31 Oct 2018 10:57:45 +0000 (11:57 +0100)]
w32: Remove cruft in w32-io from WindowsME times.

* src/w32-io.c (set_synchronize): Remove.
(create_reader, create_writer): No need for set_synchronize.
--

The set_synchronize dates back to 2001 at a time when I wrote the
Windows support on WindowsME and Windows2000.  Maybe this was required
then due to bugs in that old NT or partly NT based Windows versions.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agodocs: python docs restructure
Ben McGinnes [Tue, 30 Oct 2018 16:41:47 +0000 (03:41 +1100)]
docs: python docs restructure

* Moved the what's new section out of the HOWTO (mostly), in
  anticipation of expanding the docs to be more than merely a HOWTO.

5 months agodocs: python
Ben McGinnes [Tue, 30 Oct 2018 14:24:47 +0000 (01:24 +1100)]
docs: python

* dropped the ".org" extension and added a mode line for each file as
  this will make scripting format conversions a lot easier.

5 months agow32: Fix previous commit.
Werner Koch [Tue, 30 Oct 2018 10:19:33 +0000 (11:19 +0100)]
w32: Fix previous commit.

* src/w32-io.c (_gpgme_io_spawn): Move freeing of TMP_NAME behind its
use in an error handling.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agocore,w32: Fix memleak of tmp_name in w32-io
Andre Heinecke [Mon, 29 Oct 2018 18:44:02 +0000 (19:44 +0100)]
core,w32: Fix memleak of tmp_name in w32-io

* src/w32-io.c (_gpgme_io_spawn): Free tmp_name.

--
GnuPG-Bug-Id: T4238

5 months agotests: Add repeat argument to run-verify
Andre Heinecke [Mon, 29 Oct 2018 15:33:04 +0000 (16:33 +0100)]
tests: Add repeat argument to run-verify

* tests/run-verify.c (main): Add repeat argument.

--
This helps reproducing rare / random crashes.

5 months agocore: Do not crash if CMS plaintext is ignored
Andre Heinecke [Mon, 29 Oct 2018 15:11:22 +0000 (16:11 +0100)]
core: Do not crash if CMS plaintext is ignored

* src/engine-gpgsm.c (gpgsm_verify): Fix handling both
plaintext and signed_text as NULL.

--
Previously if plaintext was NULL and signed_text was NULL
it would set MESSAGE_FD to NULL which resulted in a
crash.

Ignoring the plaintext of an opaque signature might
make sense in some cases and engine-gpg handles it.

5 months agocpp,tests: Add another test runner
Andre Heinecke [Mon, 29 Oct 2018 14:36:45 +0000 (15:36 +0100)]
cpp,tests: Add another test runner

* lang/cpp/tests/run-verify.cpp: New.
* lang/cpp/tests/Makefile.am: Update accordingly.

--
Add another test runner which helps to find problems on windows.

5 months agocpp: Add some convenience functions
Andre Heinecke [Thu, 25 Oct 2018 12:09:37 +0000 (14:09 +0200)]
cpp: Add some convenience functions

* lang/cpp/src/context.cpp (Context::create): New.
* lang/cpp/src/context.h: Update accordingly.
* lang/cpp/src/key.cpp, lang/cpp/src/key.h:
(Key::isBad, Subkey::isBad, UserID::isBad)
(UserID::Signature::isBad): Add shorthand for the isX checks.
* NEWS: Mention it.

--
I don't know how often I wrote:
if (key.isNull() || key.isExpired() || key.isRevoked() ...

And for the context it is good practice to use a unique ptr
so the API should make it easy.

5 months agodocs: python howto
Ben McGinnes [Tue, 23 Oct 2018 12:38:56 +0000 (23:38 +1100)]
docs: python howto

* Fixed a few spelling and grammatical errors.

6 months agoPython: docs tweaks
Ben McGinnes [Sun, 21 Oct 2018 18:43:36 +0000 (05:43 +1100)]
Python: docs tweaks

* Fixed a minor error in how the reST version of the HOWTO is
  generated.
* Updated the help() in __init__.py with a little more detail as to
  why not to use the lower level functions.

6 months agopython bindings: callback test
Ben McGinnes [Sat, 20 Oct 2018 00:07:55 +0000 (11:07 +1100)]
python bindings: callback test

* lang/python/tests/t-callbacks.py: Updated test logic to try
  generating a key which expires in 2099 and if that fails then
  fallback to an expiration in 2037 in an attempt to catch the 32-bit
  systems.

6 months agocore: Fix segv in genkey when no endtag is provided.
Werner Koch [Thu, 18 Oct 2018 15:36:30 +0000 (17:36 +0200)]
core: Fix segv in genkey when no endtag is provided.

* src/genkey.c (get_key_parameter): Provide a fallback ENDTAG.
--

It would actually be more correct to return an error in this case but
it is possible tha there are users who did not provide an endtag and
out of luck they also didn't trigger a segv.

GnuPG-bug-id: 4192
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocore: Return an error if NULL is provided for genkey's parms.
Werner Koch [Thu, 18 Oct 2018 14:50:18 +0000 (16:50 +0200)]
core: Return an error if NULL is provided for genkey's parms.

* src/debug.c (_gpgme_debug_buffer): Bail out of BUF is NULL.
* src/genkey.c (gpgme_op_genkey): Do no deref a NULL in
TRACE_LOGBUF.
(gpgme_op_genkey_start): Ditto. Return an error if PARMS is NULL.
--

This robustness patch should solve one part of
GnuPG-bug-id: 4192
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agopython: do not export HAVE_CXX11 definition
Daniel Kahn Gillmor [Thu, 18 Oct 2018 02:23:59 +0000 (22:23 -0400)]
python: do not export HAVE_CXX11 definition

* lang/python/gpgme.i: ignore HAVE_CXX11 in SWIG interface

--

If there are two distinct builds (a) and (b) of gpgme which both build
python bindings, and build (a) also happens to build the C++ bindings,
then the generated gpg/gpgme.py file from build (a) will not be usable
with the .so generated in build (b), despite them being exactly the
same, and having nothing to do with C++.

In particular, it will fail with:

-----------
  File "…/gpg/__init__.py", line 99, in <module>
    from . import core
  File "…/gpg/core.py", line 10, in <module>
    from . import gpgme
  File "…/gpg/gpgme.py", line 152, in <module>
    HAVE_CXX11 = _gpgme.HAVE_CXX11
AttributeError: module 'gpg._gpgme' has no attribute 'HAVE_CXX11'
-----------

By asking SWIG to ignore this definition, we stabilize the generated
.py and the .so, ensuring that they are more cleanly interoperable.

6 months agodoc: convert more links to equivalent https:// URLs
Daniel Kahn Gillmor [Thu, 18 Oct 2018 04:19:34 +0000 (00:19 -0400)]
doc: convert more links to equivalent https:// URLs

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
6 months agodoc: convert more http:// links to https://
Daniel Kahn Gillmor [Thu, 18 Oct 2018 04:10:19 +0000 (00:10 -0400)]
doc: convert more http:// links to https://

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
6 months agodoc: use https:// for www.gnu.org
Daniel Kahn Gillmor [Thu, 18 Oct 2018 03:56:27 +0000 (23:56 -0400)]
doc: use https:// for www.gnu.org

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
6 months agojs: increase default startup timeout
Maximilian Krambach [Wed, 17 Oct 2018 11:13:31 +0000 (13:13 +0200)]
js: increase default startup timeout

--

* src/index.js: change the init default if none is given, so that all
  initialization defaults line up to 1000 miliseconds

6 months agopython: Auto-check for all installed python versions.
Werner Koch [Wed, 17 Oct 2018 08:05:04 +0000 (10:05 +0200)]
python: Auto-check for all installed python versions.

* m4/python.m4 (AM_PATH_PYTHON): Add a 4th arg.
* configure.ac (available_languages): Remove separate python2 and
python3 and keep just python.  Simplify test for pythons.  Use an
explicit list of python versions to test.
--

This seems to be a starightforward chnage to support more than two
python versions.  I am not sure why we had that complicated thing
before.  On my box I get builds and run tests for 2.7, 3.4 and 3.5.
If 3.6, 3.7 or 3.8 are installed they should also work.

GnuPG-bug-id: 3354
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocore: Really remove CR from version output.
Werner Koch [Tue, 16 Oct 2018 15:05:14 +0000 (17:05 +0200)]
core: Really remove CR from version output.

* src/version.c (_gpgme_get_program_version): Fix test.
--

Fixes-commit: 6bde056355796f15b6e6954372e87f349847515b
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocl: Add missing file
Werner Koch [Fri, 12 Oct 2018 07:05:41 +0000 (09:05 +0200)]
cl: Add missing file

--
Fixes-commit: 85d7af8ff2f6afd63701079e23f31be08d58a15d
My fault, sorry.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agocl: Several fixes
Guillaume LE VAILLANT [Fri, 12 Oct 2018 06:49:26 +0000 (08:49 +0200)]
cl: Several fixes

--

* Use wrapper types calling translation functions instead of
  TRANSLATE-{FROM,TO}-FOREIGN methods as they seem not to be
  called in some cases.
* Use the (:STRUCT SOME-C-STRUCT) notation instead of the
  deprecated direct reference to SOME-C-STRUCT.
* Add missing values in enums and bit fields.
* Use cffi-grovel to define system types (SIZE-T, OFF-T, etc).
* Wrap GPGME-DATA-T in a class (like contexts).
* Use the FINALIZE function from trivial-garbage to free the
  C objects for contexts, keys and data automatically.
* Make DATA-READ-CB and DATA-WRITE-CB run faster.
* Update the README file.

Signed-off-by: Guillaume LE VAILLANT <glv@posteo.net>
6 months agoRegister DCO for Guillaume LE VAILLANT
Werner Koch [Fri, 12 Oct 2018 06:38:10 +0000 (08:38 +0200)]
Register DCO for Guillaume LE VAILLANT

--

6 months agobuild: Let configure create the VERSION file.
NIIBE Yutaka [Wed, 10 Oct 2018 04:39:42 +0000 (13:39 +0900)]
build: Let configure create the VERSION file.

* autogen.sh: Update from libgpg-error.
* configure.ac: Use mym4_version to create VERSION file.
* Makefile.am (dist-hook): Do not create VERSION.
(EXTRA_DIST): Add VERSION.

--

GnuPG-bug-id: 3283
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
6 months agocpp: Add KeyListMode::Locate
Andre Heinecke [Tue, 9 Oct 2018 09:26:15 +0000 (11:26 +0200)]
cpp: Add KeyListMode::Locate

* cpp/src/global.h (KeyListMode): Add Locate.

--
Similar to locate in core.

6 months agocpp: Add first manual tests
Andre Heinecke [Tue, 9 Oct 2018 09:24:18 +0000 (11:24 +0200)]
cpp: Add first manual tests

* lang/cpp/Makefile.am: Add tests subdir.
* lang/cpp/tests/Makefile.am: New.
* lang/cpp/tests/README,
lang/cpp/tests/run-getkey.cpp,
lang/cpp/tests/run-keylist.cpp: New.
* configure.ac: Configure tests makefile.

--
The autotests for c++ live in lang/qt/tests these
tests are more for manual experiments to validate some
functionality.

6 months agocore: Add trust-model flag
Andre Heinecke [Wed, 12 Sep 2018 07:42:09 +0000 (09:42 +0200)]
core: Add trust-model flag

* src/context.h (gpgme_context): Extend with trust_model.
* src/engine-gpg.c (engine_gpg): Extend with trust_model.
(gpg_set_engine_flags): Take trust_model from context.
(build_argv): Handle trust_model.
(gpg_release): Free trust_model.
* src/gpgme.c (gpgme_set_ctx_flag): Handle trust-model flag.
(gpgme_release): Release trust-model.
* doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag.
(Context Flags): New subsection for the context flags.
* tests/run-keylist.c (show_usage, main): Add new --trust-model
parameter.

--
This gives a GPGME user fine grained control over the
trust-model.

Changing the trust model for only a single application depends
on:
GnuPG-Bug-Id: T4134
Maniphest Tasks: T4134
Differential Revision: https://dev.gnupg.org/D466

6 months agocpp: Initialize all gpgme_key_t's in context
Andre Heinecke [Tue, 9 Oct 2018 08:47:16 +0000 (10:47 +0200)]
cpp: Initialize all gpgme_key_t's in context

* lang/cpp/src/context.cpp (Context::startKeyListing),
(Context::keyListResult, Context::signingKeys): Initialize key.

--
"Should" not be neccessary but it's cleaner and would have
covered the case of the previous commit.

6 months agocore: Ensure r_key init in gpgme_get_key
Andre Heinecke [Tue, 9 Oct 2018 08:45:12 +0000 (10:45 +0200)]
core: Ensure r_key init in gpgme_get_key

* src/keylist.c (gpgme_get_key): Move r_key init above
the first invalid value check.

--
This fixes the case where someone passes an unitialized
r_key and no fingerprint.

6 months agoqt, tests: Add test for single get key
Andre Heinecke [Tue, 9 Oct 2018 07:37:28 +0000 (09:37 +0200)]
qt, tests: Add test for single get key

* lang/qt/tests/t-keylist.cpp (testGetKey): New.

--
Added this to check if there was a memleak in that function.

6 months agoPost release updates
Werner Koch [Mon, 8 Oct 2018 09:36:37 +0000 (11:36 +0200)]
Post release updates

--

6 months agoRelease 1.12.0 gpgme-1.12.0
Werner Koch [Mon, 8 Oct 2018 08:28:43 +0000 (10:28 +0200)]
Release 1.12.0

* configure.ac: Bump core LT version to C32/A21/R0.  Bump C++ LT
version to C14/A8/R0.

* lang/qt/tests/Makefile.am (CLEANFILES): Add reader status files.
* Makefile.am (EXTRA_DIST): Add conf/whatisthis.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agobuild: Update .gitignore
Werner Koch [Fri, 5 Oct 2018 13:46:25 +0000 (15:46 +0200)]
build: Update .gitignore

--

6 months agocore: Apply GPGME_EXPORT_MODE_NOUID also to keyserver exports.
Werner Koch [Fri, 5 Oct 2018 13:16:53 +0000 (15:16 +0200)]
core: Apply GPGME_EXPORT_MODE_NOUID also to keyserver exports.

* src/engine-gpg.c (export_common): Add keyserver-options to the
send-keys commands.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agobuild: Move config.h to conf/config.h
Werner Koch [Fri, 5 Oct 2018 13:14:58 +0000 (15:14 +0200)]
build: Move config.h to conf/config.h

* conf/: New dir.
* configure.ac (AC_CONFIG_HEADER): Move header to conf dir.
* doc/Makefile.am (mkdefsinc): Adjust rule.
* lang/python/Makefile.am (copystamp): Ditto.
--

C++ uses those stupid files without a suffix and thus the new standard
header <version> as included by newer other libc++ versions may
conflict with the VERSION file in out top directory.   This change
should solve the problem.

GnuPG-bug-id: 4168
Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agodocs: whitespace bug
Ben McGinnes [Thu, 4 Oct 2018 16:41:45 +0000 (02:41 +1000)]
docs: whitespace bug

* Same as before, but exported.

6 months agodocs: org to texinfo whitspace bug
Ben McGinnes [Thu, 4 Oct 2018 16:38:14 +0000 (02:38 +1000)]
docs: org to texinfo whitspace bug

* replaced "." in headings with "·" to prevent whitspace being
  appended by texinfo and breaking git.

6 months agodocs: python
Ben McGinnes [Thu, 4 Oct 2018 16:30:20 +0000 (02:30 +1000)]
docs: python

* Fixed an error in the new index page and then exported to the other
  two "source" formats.

6 months agodocs: python
Ben McGinnes [Thu, 4 Oct 2018 15:47:56 +0000 (01:47 +1000)]
docs: python

* lang/python/doc/meta/TODO.org: Added the two major documentation
  build system tasks to the TODO list.
* Added an index page in preparation for sorting out the second of
  those TODO lists (Docutils is a lot easier to handle than Texinfo).
* Meanwhile, have confirmed that it all builds just fine under
  GNU/Linux, OS X and FreeBSD while retaining the documentation, so
  that's a nice improvement from 1.11.1.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agopython: makefiles
Ben McGinnes [Thu, 4 Oct 2018 11:10:46 +0000 (21:10 +1000)]
python: makefiles

* doc/Makefile.am: Removed a bit I forgot about.
* Renamed lang/python/docs to lang/python/doc bvecause apparently
  automake cares about that too.
* Decided to be extra explicit in the manifest because if I don't then
  all sorts of things get deleted ... like lang/python
* Tested on an external linux system just in case my osx workstation
  introduces too much weirdness.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agopython: make file
Ben McGinnes [Thu, 4 Oct 2018 08:28:47 +0000 (18:28 +1000)]
python: make file

* lang/python/Makefile.am: Attempting to remove the docs/meta
  directory did a lot worse than I thought it was doing, so better to
  just be sure the documentation is available than destroy the entire
  bindings directory.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agopython: make file
Ben McGinnes [Thu, 4 Oct 2018 08:11:01 +0000 (18:11 +1000)]
python: make file

* lang/python/Makefile.am: Now that gpg2 has been renamed back to gpg
  and gpg1 is semi-deprecated, we should check what the actual gpg
  binary is with gpgconf and use that rather than make assumptions per
  system.
* Also, it means less worry if gpg3 is ever a thing.  (Trust me, I
  remember the Python 1 to 2 transition as well as the current 2 to 3
  transition).  ;)

Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agodocs: more whitespace checks
Ben McGinnes [Wed, 3 Oct 2018 21:20:32 +0000 (07:20 +1000)]
docs: more whitespace checks

* lang/python/docs/texinfo/short-history.texi:

6 months agodpcs: python howto
Ben McGinnes [Wed, 3 Oct 2018 21:09:40 +0000 (07:09 +1000)]
dpcs: python howto

* More updates to the docs themselves and the versions to be available
  with the next release.
* .texi and .rst copies of the HOWTO and the short history of (this
  part) of the project.

6 months agodocs: python
Ben McGinnes [Wed, 3 Oct 2018 21:06:57 +0000 (07:06 +1000)]
docs: python

* More restructuring.  Also the painstaking task of deciphering some
  of the more eclectic aspects of Texinfo and make.

6 months agodocs: python bindings
Ben McGinnes [Wed, 3 Oct 2018 20:57:51 +0000 (06:57 +1000)]
docs: python bindings

* Restructured the docs directory to account for the GNU preferred
  source doc format (.texi) and the Python preferred source doc
  format (.rst) and the real source doc format (.org).
* Both the perceived source formats will need to be generated from the
  .org files and included at this stage.  Unfortunately there is not
  yet a native org-to-rst transformation method in the org-mode
  software in Emacs nor is there a a direct means of going from reST
  to Org-mode from Docutils.  There's only third party packages like
  Pandoc and, while very good, there is no guarantee of consistency;
  so we can't entirely automate this bit (yet).

6 months agodocs: pre-python preparation
Ben McGinnes [Wed, 3 Oct 2018 15:42:12 +0000 (01:42 +1000)]
docs: pre-python preparation

* doc/Makefile.am: removed the python howto from this file, restoring
  it to just the main project and the newer .js files.
* deleted: doc/gpgme-python-howto.texi
* renamed the Short_History.org file to short-history.org to keep the
  naming conventions similar.
* All the Python files can (and should) live together.

6 months agopython bindings: CPython order
Ben McGinnes [Tue, 2 Oct 2018 20:58:51 +0000 (06:58 +1000)]
python bindings: CPython order

* Changed the order of python versions the configure/make process
  checks for, placing Python 3.7 ahead of 3.6.
* Updated the HOWTO documentation to reflect this change.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agocore: add experimental GPGME_EXPORT_MODE_NOUID.
Werner Koch [Tue, 2 Oct 2018 09:18:00 +0000 (11:18 +0200)]
core: add experimental GPGME_EXPORT_MODE_NOUID.

* src/gpgme.h.in (GPGME_EXPORT_MODE_NOUID): New.
* src/export.c (export_start): Adjust option check.
* src/engine-gpg.c (export_common): Implement option.

Signed-off-by: Werner Koch <wk@gnupg.org>
6 months agodocs: python bindings
Ben McGinnes [Sun, 30 Sep 2018 16:10:03 +0000 (02:10 +1000)]
docs: python bindings

* Tightened up the docs a little bit, updated the "what's new"
  section, dropped the "-draft" version in preparation for GPGME
  1.12.0's release.
* Exported another .texi version (and updated the draft copies to this
  commit (which ought to be 1.11.1-beta313).

Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agopython bindings: fixing decrypt-verify
Ben McGinnes [Sun, 30 Sep 2018 09:32:45 +0000 (19:32 +1000)]
python bindings: fixing decrypt-verify

* lang/python/src/core.py: First restoring the exception to the being
  just that.
* The means to manipulate the error output is temporarily in commented
  out code, but ought to be added to a proper test later.
* In the mean time the original test, with a very slight change, works
  again.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agopython bindings: ctx.decrypt
Ben McGinnes [Sun, 30 Sep 2018 06:28:54 +0000 (16:28 +1000)]
python bindings: ctx.decrypt

* lang/python/src/core.py: Fixed methods of detecting whether verify
  is a boolean variable or a list.
* Added methods of catching the missing keys exceptions.
* Still retained PEP8 compliance (which might have been where one or
  two problems crept in).
* Though this is essentially the correct behaviour, it still does not
  quite fit the otiginal test; so that will also require some adjustment.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agoexample: local signatures
Ben McGinnes [Thu, 27 Sep 2018 13:23:37 +0000 (23:23 +1000)]
example: local signatures

* lang/python/examples/howto/local-sign-group.py: added the bit where
  specifying the signing key is actually used for signing rather than
  just pruning the list of keys to certify.

Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agoexample: python bindings
Ben McGinnes [Thu, 27 Sep 2018 12:45:37 +0000 (22:45 +1000)]
example: python bindings

* lang/python/examples/howto/local-sign-group.py: locally sign every
  key in a group line except one's own keys.  Intended to address the
  sort of thing one might see on lists like PGPNET or other closed
  groups amongst activists, journalists, etc. where everyone encrypts
  to all recipients, but may not sign everyone's keys publicly..

Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agodocs: python bindings installation
Ben McGinnes [Thu, 27 Sep 2018 04:06:48 +0000 (14:06 +1000)]
docs: python bindings installation

* lang/python/docs/gpgme-python-howto.org: added a section on
  installing the bindings to a python virtualenv.

6 months agotests: python bindings
Ben McGinnes [Thu, 27 Sep 2018 00:07:08 +0000 (10:07 +1000)]
tests: python bindings

* Fixed the final assertion to look for what will actually be reported
  in that case instead of something else (i.e. it looks for an
  IMPORT_ERROR status code).

6 months agoexamples: python bindings
Ben McGinnes [Wed, 26 Sep 2018 23:57:50 +0000 (09:57 +1000)]
examples: python bindings

* Fixed homedir specifying logic in several cases.

6 months agodocs: a typographical two-step
Ben McGinnes [Tue, 25 Sep 2018 00:17:39 +0000 (10:17 +1000)]
docs: a typographical two-step

* Sometimes you really do need or want punctuation in a heading, but
  ideally without something else generating whitespace and other
  annoyances to go with it.
* Trying a real decimal point instead.

Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agodocs and examples: python bindings
Ben McGinnes [Mon, 24 Sep 2018 23:59:31 +0000 (09:59 +1000)]
docs and examples: python bindings

* Woumd up the "what's new" section.
* Added an example for sending a key to the keyservers via hkp4py.
* Updated the export key code to use a more complete check for the
  $GNUPGHOME location.
* Expanded on the installation and reinstallation troubleshooting
  section.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agodocs: python bindings howto
Ben McGinnes [Mon, 24 Sep 2018 18:32:13 +0000 (04:32 +1000)]
docs: python bindings howto

* Added a What's New section to summarise changes since the last
  release.  There have been quite a few and some attention does need
  to be drawn to some of them.
* Confirming certain issues with some platform builds, especially
  BSD/OSX vs. Linux issues which will need to update the installation
  troubleshooting guides.

6 months agodocs and examples: python bindings howto
Ben McGinnes [Sun, 23 Sep 2018 09:36:54 +0000 (19:36 +1000)]
docs and examples: python bindings howto

* Added more comprehensive examples using hkp4py and added a couple
  more example scripts for protonmail.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
6 months agoexamples: python bindings and hkp4py updates
Ben McGinnes [Sun, 23 Sep 2018 01:43:34 +0000 (11:43 +1000)]
examples: python bindings and hkp4py updates

* Mostly tightening up the details on the hkp4py example script.
* Also fixed a typo in the LGPL boiler plate text included in all the
  other example scripts for the HOWTO.

7 months agopython bindings: importing from keyservers with hkp4py
Ben McGinnes [Sat, 22 Sep 2018 22:18:44 +0000 (08:18 +1000)]
python bindings: importing from keyservers with hkp4py

* added a new example script to search the keyservers and import the
  results, this time using Marcel Fest's hkp4py module.
* Updated the key importing section to match this addition.
* Tested with the current version of hkp4py from github.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>