gpgme.git
8 months agopython: Sphinx support
Ben McGinnes [Tue, 4 Dec 2018 22:17:31 +0000 (09:17 +1100)]
python: Sphinx support

* Added framework from sphinx-quickstart to lang/python/doc/rst/ so
  that Python developers already using Sphinx can use the generated
  reST files with existing documentation systems.
* Note that when generating source files from Org-mode, the index page
  will require manual intervention to match the Sphinx requirements.

Signed-off-by: Ben McGinnes <ben@adversary.org>
8 months agoMerge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme
Ben McGinnes [Tue, 4 Dec 2018 21:49:41 +0000 (08:49 +1100)]
Merge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme

8 months agopython: docs update
Ben McGinnes [Tue, 4 Dec 2018 21:42:08 +0000 (08:42 +1100)]
python: docs update

* Expanded the section on issues with Windows installations, with
  greater detail of which versions of Visual Studio are needed
  depending on which version of CPython is to be used.
* Included a recommendation which is a bit harsh without being totally
  prickish.
* Updated all files to not link to author's key or related data in
  order to make them all consistent with the changes in commit
  649b19688132dd315e361c0f5b63ba6d8f45996d.

Signed-off-by: Ben McGinnes <ben@adversary.org>
8 months agobuild: Remove --with-*-prefix, which is no need any more.
NIIBE Yutaka [Tue, 4 Dec 2018 03:35:41 +0000 (12:35 +0900)]
build: Remove --with-*-prefix, which is no need any more.

* autogen.rc (configure_opts): Remove --with-*-prefix.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
8 months agoqt,cpp: Consistently use nullptr and override
Andre Heinecke [Mon, 3 Dec 2018 11:20:33 +0000 (12:20 +0100)]
qt,cpp: Consistently use nullptr and override

* lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am (AM_CPPFLAGS):
Add suggest-override and zero-as-null-pointer-constant warnings.

* lang/cpp/src/*, lang/qt/src/*: Consistenly use nullptr and override.

--
This was especially important for the headers so that downstream
users of GpgME++ or QGpgME do not get flooded by warnings if
they have these warnings enabled.

It also improves compiler errors/warnings in case of accidental
mistakes.

8 months agodoc: Minor comment cleanups.
Werner Koch [Mon, 3 Dec 2018 09:40:52 +0000 (10:40 +0100)]
doc: Minor comment cleanups.

--

Signed-off-by: Werner Koch <wk@gnupg.org>
8 months agopython: documentation fixes
Ben McGinnes [Fri, 30 Nov 2018 21:15:43 +0000 (08:15 +1100)]
python: documentation fixes

* Typographic and whitespace error correction pertaining to the
  previous update.

Signed-off-by: Ben McGinnes <ben@adversary.org>
8 months agopython: documentation
Ben McGinnes [Fri, 30 Nov 2018 20:45:50 +0000 (07:45 +1100)]
python: documentation

* Added long description to setup.py.in.
* Added maintenance mode details with clarification for what type of
  things would be a bug as far as MM is concerned and what wouldn't
  be.
** Includes a not too subtle hint directed towards the donations page.
* Miscellaneous tightening of documentation.

Signed-off-by: Ben McGinnes <ben@adversary.org>
8 months agotests, json: Make them run on debian stable
Andre Heinecke [Wed, 28 Nov 2018 09:44:17 +0000 (10:44 +0100)]
tests, json: Make them run on debian stable

* tests/json/t-json.c (main): Relax version check a bit.

8 months agopython docs: checking key signatures
Ben McGinnes [Mon, 26 Nov 2018 02:19:34 +0000 (13:19 +1100)]
python docs: checking key signatures

* Added instructions for checking key certifications or key
  signatures (depending on preferred terminology).
* Added pendulum module to recommended installations, but not to
  requirements.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
9 months agopython: docs update
Ben McGinnes [Thu, 22 Nov 2018 09:00:12 +0000 (20:00 +1100)]
python: docs update

* Added documentation for the new methods added to gpgme.version.
* Removed the Flask based advanced use case from the what-is-new
  section as that type of code will not be added here.

9 months agopython: version as integers
Ben McGinnes [Thu, 22 Nov 2018 07:00:22 +0000 (18:00 +1100)]
python: version as integers

* lang/python/version.py.in: added gpg.version.versionintlist
* If gpg.version.versionintlist[2] ever returns -1 then there's a
  serious problem with the build and it should be lodged as a bug if
  it's repeatable.  Seeing this should never happen, but checking for
  it is better than not doing so.

9 months agocore: Fix format string errors in w32-io.c and use of TRACE_SUC.
Werner Koch [Mon, 19 Nov 2018 11:49:40 +0000 (12:49 +0100)]
core: Fix format string errors in w32-io.c and use of TRACE_SUC.

* src/w32-io.c: Fix use of TRACE_SUC.  Fix some format strung errors.

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agopython: import type
Ben McGinnes [Mon, 19 Nov 2018 10:38:50 +0000 (21:38 +1100)]
python: import type

* Fixed bug T4242 and tested that dropping "Import" in favour of
  "import_type" does indeed work just fine.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
9 months agopython: import constant
Ben McGinnes [Mon, 19 Nov 2018 10:19:42 +0000 (21:19 +1100)]
python: import constant

* lang/python/src/constants/__init__.py: dropped use of Import
  capitalisation and renamed lang/python/src/constants/import.py to
  lang/python/src/constants/import_type.py to address bug T4242.
* lang/python/doc/src/gpgme-python-howto: minor docs updates.

9 months agocore: Protect the trace macros for fun and profit.
Werner Koch [Fri, 16 Nov 2018 17:17:22 +0000 (18:17 +0100)]
core: Protect the trace macros for fun and profit.

* src/debug.h: Protect macros using.
(_trace_err, _trace_sysres, _trace_syserr): New helper inline
functions.

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agocore: Fix a LF problem in the new debug fucntion.
Werner Koch [Fri, 16 Nov 2018 17:15:22 +0000 (18:15 +0100)]
core: Fix a LF problem in the new debug fucntion.

* src/debug.c (_gpgme_debug): Print a LF for an empty FORMAT unless we
are in legacy mode.

9 months agocore: Fix format string errors in trace macros
Werner Koch [Fri, 16 Nov 2018 15:57:09 +0000 (16:57 +0100)]
core: Fix format string errors in trace macros

--

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agocore: Remove old debug helper function
Werner Koch [Fri, 16 Nov 2018 15:39:26 +0000 (16:39 +0100)]
core: Remove old debug helper function

* src/debug.c (_gpgme_debug): Remove.
(_gpgme_debugf): Rename to _gpgme_debug.

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agocore: Simplify the trace maros by using variadics.
Werner Koch [Fri, 16 Nov 2018 15:25:49 +0000 (16:25 +0100)]
core: Simplify the trace maros by using variadics.

* src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros
and remove the TRACE_BEG1 et al.  Change all users to always pass a
format string.
(TRACE): Ditto.
* src/debug.c (_gpgme_debugf): New.
* configure.ac <GCC>: Add -Wno-format-zero-length.
--

This makes it easier for use to enable format checks.  The zero-length
format is required to allow for an empty format due to the comman
problematic of __VA_ARGS__.

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agoAdd SPDX identifiers to most source files
Werner Koch [Fri, 16 Nov 2018 12:27:33 +0000 (13:27 +0100)]
Add SPDX identifiers to most source files

--

Signed-off-by: Werner Koch <wk@gnupg.org>
9 months agotests: Add run-threaded for multithread tests
Andre Heinecke [Thu, 15 Nov 2018 10:57:27 +0000 (11:57 +0100)]
tests: Add run-threaded for multithread tests

* tests/Makefile.am (run-threaded): Add.
* tests/run-threaded.c: New.

--
This test is intended to help detect race conditions
or other multithread problems. It can also be used
to put the whole GnuPG system under extreme load.

9 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

9 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.

9 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.

9 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.

9 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.

9 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..

9 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.

9 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.

9 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.

9 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.

9 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.

9 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.

9 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

9 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.

9 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.

9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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).

9 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.

9 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.

9 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>
9 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

9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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.

9 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.

9 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>
9 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

9 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.

9 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.

9 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.

10 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.

10 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.

10 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.

10 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.

10 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>
10 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>
10 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.

10 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>
10 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>
10 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>
10 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

10 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>
10 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>
10 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>
10 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>
10 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

--

10 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>
10 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.

10 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.

10 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

10 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.

10 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.

10 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.

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

--

10 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>
10 months agobuild: Update .gitignore
Werner Koch [Fri, 5 Oct 2018 13:46:25 +0000 (15:46 +0200)]
build: Update .gitignore

--

10 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>
10 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>
10 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.

10 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.

10 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.

10 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>
10 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>
10 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>