gpgme.git
13 months agocore: Import cJSON code from the payproc project.
Werner Koch [Wed, 14 Mar 2018 09:55:52 +0000 (10:55 +0100)]
core: Import cJSON code from the payproc project.

* src/cJSON.c: New.
* src/cJSON.h: New.
* src/cJSON.readme: New.
--

This is a copy of the code from the payproc commit
af5d6b4f820ee19e246a2cab6f56465fe91f1233.  The code was originally
added to payproc with the commit below.

Signed-off-by: Werner Koch <wk@gnupg.org>
===============================================
commit 7ae7ef29bc5ec19e005e6a5a739233d655f3f05f
Author:     Werner Koch <wk@gnupg.org>
AuthorDate: Wed Apr 2 09:01:42 2014 +0200
Commit:     Werner Koch <wk@gnupg.org>
CommitDate: Wed Apr 2 09:12:02 2014 +0200

Simplify cJSON and add new macros.

* src/cJSON.h: Re-indented.
(cjson_t): New.
(cjson_is_): New macros.
* src/cJSON.c: Re-indented.  Include errno.h and our util.h.
(ep): Remove global var.
(cJSON_GetErrorPtr): Remove.
(cJSON_strcasecmp): Cast args for use with tolower.
(cJSON_malloc, cJSON_free): Remove.  Change callers to use xtrymalloc
and xfree.
(cJSON_InitHooks): Remove.
(cJSON_strdup): Remove.  Change callers to use xtrystrdup.
(cJSON_New_Item): Simplify.
(cJSON_ParseWithOpts, cJSON_Parse): Add arg R_ERROFF.
(parse_string, parse_value, parse_array, parse_object): Add arg EP.
--

cJSON has been taken from cjson-code-58.zip.  The README file has been
renamed to cJSON.readme and the files have been changed to GNU coding
standards.  Because that parser is small enough to be source copied it
does not make sense to treat it as a library and I changed the memory
allocation functions to the usual xmalloc ones. The only external
dependency now is out util.h which declares those functions.

The lowercase cjson_t better fits into our coding style as well as the
new macros.  Thanks to Dave Gamble for this nice parser.
===============================================

13 months agodocs: TODO
Ben McGinnes [Thu, 8 Mar 2018 22:01:53 +0000 (09:01 +1100)]
docs: TODO

* Removed WS.

13 months agodoc: TODO list update
Ben McGinnes [Thu, 8 Mar 2018 21:36:12 +0000 (08:36 +1100)]
doc: TODO list update

* Closed off a few ancient items and added recommendation to others to
  use the dev.gnupg.org site for real bugs/features updates.
* See also this statement on the gnupg-devel list regarding this file:
  https://lists.gnupg.org/pipermail/gnupg-devel/2018-March/033499.html

13 months agoMissed a couple
Ben McGinnes [Sat, 3 Mar 2018 21:59:41 +0000 (08:59 +1100)]
Missed a couple

* WS indicated 2 custom-ids were missed, now they're set.

Signed-off-by: Ben McGinnes <ben@adversary.org>
13 months agoTODO DONE
Ben McGinnes [Sat, 3 Mar 2018 21:56:26 +0000 (08:56 +1100)]
TODO DONE

* Marked off a TODO for this clean-up.

Signed-off-by: Ben McGinnes <ben@adversary.org>
13 months agoTODO ben/docs/2018-02
Ben McGinnes [Sat, 3 Mar 2018 21:38:19 +0000 (08:38 +1100)]
TODO

* WS removal

13 months agoTODO updates
Ben McGinnes [Sat, 3 Mar 2018 21:32:31 +0000 (08:32 +1100)]
TODO updates

* Updated TODO with tags to make everything appear properly when
  exported to HTML or PDF.
* Added a couple more items, mainly to do with docs or future bindings.
* Marked some, but not all as actual TODO items.
* Some items should probably be removed, but haven't been yet.
* Some have probably been completed already.

13 months agoNew stuff
Ben McGinnes [Tue, 27 Feb 2018 16:43:59 +0000 (03:43 +1100)]
New stuff

* Added the idea for alternative Emacs bindings (to extend the
  existing ones, not replace them outright).
* Added a reference to the API Squared part of the project.

13 months agoTODO the TODO
Ben McGinnes [Tue, 27 Feb 2018 16:30:46 +0000 (03:30 +1100)]
TODO the TODO

* Added an actual TODO to fix the TODOs.
* Pretty sure I know who will be completing this one ...  ;)

13 months agoTODO ... the TODO
Ben McGinnes [Tue, 27 Feb 2018 16:21:18 +0000 (03:21 +1100)]
TODO ... the TODO

* If we're going to use Org, let's actually use Org.
* Added the properties tags for each point.
* Some of thems still need custom ID tags assigned properly.
* Probably ought to make them actual TODOs at some point, but that can
  wait until they can be marked as DONE anyway.
* Will add a TODO for some of this stuff ... oh, the irony.

13 months agocore: Support non-thread-safe getenv.
NIIBE Yutaka [Tue, 27 Feb 2018 09:43:40 +0000 (18:43 +0900)]
core: Support non-thread-safe getenv.

* src/get-env.c (_gpgme_getenv): Use gpgrt_lock_lock
and gpgrt_lock_unlock to protect call of getnev.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
13 months agoWS removal
Ben McGinnes [Mon, 26 Feb 2018 03:09:38 +0000 (14:09 +1100)]
WS removal

* Whitespace removal.

13 months agoMerge branch 'ben/python-docs-01'
Ben McGinnes [Mon, 26 Feb 2018 03:04:23 +0000 (14:04 +1100)]
Merge branch 'ben/python-docs-01'

* Documentation and the first brush strokes towards the future.

Signed-off-by: Ben McGinnes <ben@adversary.org>
13 months agoLaTeX headers ben/python-docs-01
Ben McGinnes [Mon, 26 Feb 2018 02:51:23 +0000 (13:51 +1100)]
LaTeX headers

* Set LaTeX headers to enable ligatures and a 12pt font by default.
* Paper size left for regional defaults.
* Using XeLaTeX for easier font control.
* Using default LaTeX font of Latin Main, but that's easy enough to change.

13 months agoMerge branch 'ben/gitsettings' of ben/gitignored
Ben McGinnes [Mon, 26 Feb 2018 01:15:01 +0000 (12:15 +1100)]
Merge branch 'ben/gitsettings' of ben/gitignored

Signed-off-by: Ben McGinnes <ben@adversary.org>
13 months agoRenaming ad infinitum ...
Ben McGinnes [Mon, 19 Feb 2018 16:13:42 +0000 (03:13 +1100)]
Renaming ad infinitum ...

* Dropped the .txt from the end of the file ...

13 months agoText conversion
Ben McGinnes [Mon, 19 Feb 2018 16:11:50 +0000 (03:11 +1100)]
Text conversion

* Exported from Org Mode to UTF-8 text.
* Removed my name from just under the title.

13 months agoTitle fix
Ben McGinnes [Mon, 19 Feb 2018 16:11:02 +0000 (03:11 +1100)]
Title fix

* Fixed title.

13 months agoConflict with Phabricator files
Ben McGinnes [Mon, 19 Feb 2018 15:51:02 +0000 (02:51 +1100)]
Conflict with Phabricator files

* The developers of Phabricator, the web front-end on dev.gnupg.org
  have not implemented renderers for Markdown, Org-Mode or any other
  common markdown like language.
* They also refuse to do so.
* Instead they re-invented the wheel and implemented their own version
  of Markdown-like thing which is incompatible with everything else.
  It is called Remarkup.
* The developers of Phabricator and Remarkup have refused to provide
  conversion tools to move files to/from any format to/from Remarkup.
* They expect everyone to learn their new favourite pet project.
* Remarkup may or may not display Org Mode files, but if so then it is
  likely to only want to do so as plain text.
* There is an unaffiliated and unofficial project to convert Github
  Markdown to Remarkup via Pandoc.  This might be adapted for our use,
  but requires testing.
* Until then exporting from Org Mode to UTF-8 text is likely the least
  worst plan.
* Which means renaming this file to README.org first.

13 months agoSchizophrenic file types
Ben McGinnes [Mon, 19 Feb 2018 15:45:44 +0000 (02:45 +1100)]
Schizophrenic file types

* Removed Markdown style heading underlining.
* Removed in-line file type declaration (which is not correctly parsed
  by the web interface on dev.gnupg.org).

14 months agocpp: Add shorthand for key locate
Andre Heinecke [Fri, 16 Feb 2018 11:58:54 +0000 (12:58 +0100)]
cpp: Add shorthand for key locate

* lang/cpp/src/key.cpp (Key::locate): New static helper.
* lang/cpp/src/key.h: Update accordingly.

14 months agoHistory path
Ben McGinnes [Fri, 16 Feb 2018 08:15:32 +0000 (19:15 +1100)]
History path

* Fixed a typo in a filepath reference.
* Moved conjecture regarding the first version of Python used to a
  footnote.

14 months agoMerge branch 'master' of /Users/ben/dev/hgit/mine/gnupg/gpgme/master into ben/python...
Ben McGinnes [Thu, 15 Feb 2018 15:04:57 +0000 (02:04 +1100)]
Merge branch 'master' of /Users/ben/dev/hgit/mine/gnupg/gpgme/master into ben/python-docs-01

14 months agoLaTeX margins
Ben McGinnes [Thu, 15 Feb 2018 14:26:20 +0000 (01:26 +1100)]
LaTeX margins

* Added LaTeX header for 1 inch margins in the quite likely event that
  all PDF output ultimately uses LaTeX.

14 months agoTODO Documentation
Ben McGinnes [Thu, 15 Feb 2018 10:30:32 +0000 (21:30 +1100)]
TODO Documentation

* Checked off the decision to stick with Org Mode.

14 months agoTODO
Ben McGinnes [Thu, 15 Feb 2018 10:28:07 +0000 (21:28 +1100)]
TODO

* Beginning to turn the first part of this into something kind of like
  an actual TODO list as Org Mode uses it (maybe).

14 months agotests: Fix previous commit
NIIBE Yutaka [Thu, 15 Feb 2018 02:31:57 +0000 (11:31 +0900)]
tests: Fix previous commit

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agotests: More Makefile portability.
NIIBE Yutaka [Thu, 15 Feb 2018 02:24:33 +0000 (11:24 +0900)]
tests: More Makefile portability.

* tests/gpg/Makefile.am: Invoke GPG with TESTS_ENVIRONMENT.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agotests: Makefile portability.
NIIBE Yutaka [Thu, 15 Feb 2018 02:14:49 +0000 (11:14 +0900)]
tests: Makefile portability.

* tests/gpg/Makefile.am: Don't use "export" directive.
* tests/gpgsm/Makefile.am: Ditto.
* lang/qt/tests/Makefile.am: Ditto.
* lang/python/tests/Makefile.am: Ditto.

--

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agobuild: More Makefile fix.
NIIBE Yutaka [Thu, 15 Feb 2018 01:27:59 +0000 (10:27 +0900)]
build: More Makefile fix.

* lang/python/tests/Makefile.am: Avoid target with '/'.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agoShort History
Ben McGinnes [Wed, 14 Feb 2018 17:19:15 +0000 (04:19 +1100)]
Short History

* Fixed or updated the most fundamental errors.
* Also included some details on which modules are available on PyPI,
  as well as what happened to the PyME commit log.

14 months agoSubsectioned history
Ben McGinnes [Wed, 14 Feb 2018 14:03:12 +0000 (01:03 +1100)]
Subsectioned history

* Split the main parts down into subsections.
* Still need to cull the incorrect stuff towards the end and add more
  recent changes.

14 months agoHistory
Ben McGinnes [Wed, 14 Feb 2018 11:44:27 +0000 (22:44 +1100)]
History

* Reshaping the history file to fit Org Mode's structuring for docs.
* Also said history needs to be a bit more clear (it was kind of
  unfinished).

14 months agoTODO
Ben McGinnes [Wed, 14 Feb 2018 11:28:50 +0000 (22:28 +1100)]
TODO

* Updated TODO.
* The entirety of the old TODO has been replaced with either more
  relevant tasks or goals for the examples and a more measured
  approach to the docs and why, in this project, Org Mode trumps reST,
  even though it's Python through and through.

14 months agoTODO
Ben McGinnes [Wed, 14 Feb 2018 10:25:45 +0000 (21:25 +1100)]
TODO

* Removed reST version of file.

14 months agoTODO
Ben McGinnes [Wed, 14 Feb 2018 10:24:54 +0000 (21:24 +1100)]
TODO

* Converted document from reST to org-mode.

14 months agoShort History
Ben McGinnes [Wed, 14 Feb 2018 10:23:04 +0000 (21:23 +1100)]
Short History

* Removed reST version.

14 months agoShort History
Ben McGinnes [Wed, 14 Feb 2018 10:21:58 +0000 (21:21 +1100)]
Short History

* Converted document from reST to org-mode.

14 months agoHouse keeping ben/gitsettings
Ben McGinnes [Wed, 14 Feb 2018 10:08:04 +0000 (21:08 +1100)]
House keeping

* Added a bunch of things to .gitignore that might otherwise creep in
  during Python development.
* This really should be merged ASAP.  You'll thank me later ...

14 months agobuild: Fix Makefiles for portability.
NIIBE Yutaka [Wed, 14 Feb 2018 08:34:28 +0000 (17:34 +0900)]
build: Fix Makefiles for portability.

* tests/gpg/Makefile.am: Don't allow target with '/'.
* tests/gpgsm/Makefile.am: Ditto.

--

BSD Make doesn't allow a target with '/'.  We still have such a target
in lang/python/Makefile.am, but it's for maintainer only, so,
assumption to GNU Make is OK there.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agoconfigure: Fix mingw check for getenv.
Andre Heinecke [Tue, 13 Feb 2018 06:49:10 +0000 (07:49 +0100)]
configure: Fix mingw check for getenv.

* configure.ac: have_thread_safe_getenv=yes with have_w32_system.

--
We want to define this for both 32 and 64 bit targets if
we use mingw. have_w32_system is defined for both targets.

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
14 months agoconfigure: MinGW has thread-safe getenv.
NIIBE Yutaka [Mon, 12 Feb 2018 23:51:26 +0000 (08:51 +0900)]
configure: MinGW has thread-safe getenv.

* configure.ac: have_thread_safe_getenv=yes with have_w64_system.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agocpp: Add SpawnShowWindow flag
Andre Heinecke [Fri, 9 Feb 2018 15:10:32 +0000 (16:10 +0100)]
cpp: Add SpawnShowWindow flag

* lang/cpp/src/context.h (SpawnShowWindow): New.

14 months agocore, w32: Enable spawning GUI applications
Andre Heinecke [Fri, 9 Feb 2018 15:07:58 +0000 (16:07 +0100)]
core, w32: Enable spawning GUI applications

* src/engine-spawn.c (engspawn_start): Translate spawn flag
to IOSPAWN flag.
* src/gpgme-w32spawn.c (my_spawn): Handle the new flag.
* src/gpgme.h.in (GPGME_SPAWN_SHOW_WINDOW): New.
* src/priv-io.h (IOSPAWN_FLAG_SHOW_WINDOW): New.

--
Used by GpgOL

14 months agocore, w32: Fix flags passing to gpgme-w32-spawn
Andre Heinecke [Fri, 9 Feb 2018 15:04:54 +0000 (16:04 +0100)]
core, w32: Fix flags passing to gpgme-w32-spawn

* src/w32-io.c (_gpgme_io_spawn): Don't hardcode flags value.

--
IOSPAWN_FLAG_ALLOW_SET_FG is 2 and was translated to 1.

This might fix the pinentry foreground handling pass through.

14 months agocpp: Add conveniance Data::toString
Andre Heinecke [Fri, 9 Feb 2018 15:03:37 +0000 (16:03 +0100)]
cpp: Add conveniance Data::toString

* lang/cpp/src/data.h, lang/cpp/src/data.cpp: Add Data::toString.

--
I'm lazy and like to waste memory.

14 months agoFix for BSD Make.
NIIBE Yutaka [Mon, 29 Jan 2018 23:22:57 +0000 (08:22 +0900)]
Fix for BSD Make.

* tests/gpg/Makefile.am, tests/gpgsm/Makefile.am: Remove ./.

--

GNU Make is powerful enough for handling and interpreting of
pathname as target, but BSD Make is not.

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agoFix compile error message.
NIIBE Yutaka [Mon, 29 Jan 2018 10:38:49 +0000 (19:38 +0900)]
Fix compile error message.

* src/get-env.c (_gpgme_getenv): Fix error message.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agotests: Fix for NetBSD.
NIIBE Yutaka [Mon, 29 Jan 2018 03:04:55 +0000 (12:04 +0900)]
tests: Fix for NetBSD.

* tests/gpg/pinentry: Use /bin/sh instead of Bash.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
14 months agocore: Implement _gpgme_getenv for NetBSD.
NIIBE Yutaka [Mon, 29 Jan 2018 02:45:33 +0000 (11:45 +0900)]
core: Implement _gpgme_getenv for NetBSD.

* src/get-env.c [HAVE_GETENV_R] (_gpgme_getenv): New.

--

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
16 months agoPost release updates.
Werner Koch [Tue, 12 Dec 2017 12:11:04 +0000 (13:11 +0100)]
Post release updates.

--

16 months agoRelease 1.10.0. gpgme-1.10.0
Werner Koch [Tue, 12 Dec 2017 11:46:00 +0000 (12:46 +0100)]
Release 1.10.0.

Signed-off-by: Werner Koch <wk@gnupg.org>
16 months agoRequire libgpg-error 1.24 and libassuan 2.4.2
Werner Koch [Tue, 12 Dec 2017 11:12:47 +0000 (12:12 +0100)]
Require libgpg-error 1.24 and libassuan 2.4.2

* src/util.h (GPG_ERR_FALSE): Remove due to newer libgpg-error.
--

We require these over one year old versions to better allign with
GnuPG's demand.  Note that the required libassuan is acgtually 2 years
old.

Signed-off-by: Werner Koch <wk@gnupg.org>
16 months agoqt: Don't use QDateTime::toSecsSinceEpoch
Andre Heinecke [Mon, 11 Dec 2017 16:07:10 +0000 (17:07 +0100)]
qt: Don't use QDateTime::toSecsSinceEpoch

* lang/qt/src/qgpgmequickjob.cpp (addSubkeyWorker)
(createWorker): Use toMSecsSinceEpoch instead toSecsSinceEpoch.

--
toSecsSinceEpoch was only introduced in Qt 5.8.

16 months agocore,w32: Fix popping up of console windows due to gpgconf.
Werner Koch [Mon, 11 Dec 2017 12:54:22 +0000 (13:54 +0100)]
core,w32: Fix popping up of console windows due to gpgconf.

* src/gpgme-w32spawn.c (my_spawn): Create w/o DETACHED_PROCESS.
--

The spawn helper is actually called with DETACHED_PROCESS and should
not need to do a DETACHED_PROCESS of its own.  Interestingly this
patch removes the popups.

See Andre's report
GnuPG-bug-id: 3515

Signed-off-by: Werner Koch <wk@gnupg.org>
16 months agoSpelling fixes for comments and doc
Andre Heinecke [Fri, 8 Dec 2017 04:59:11 +0000 (05:59 +0100)]
Spelling fixes for comments and doc

--
Patch provided by ka7 in dev.gnupg.org

Differential D423

16 months agocpp: Fix handling of lsig promotion
Andre Heinecke [Thu, 7 Dec 2017 15:21:01 +0000 (16:21 +0100)]
cpp: Fix handling of lsig promotion

* src/gpgsignkeyeditinteractor.cpp (SignKeyState): Add second
CONFIRM state.
(makeTable): Properly handle local_promote_okay.
(action): Handle CONFIRM2.

--
This fixes changing a local signature to a "public" signature.

GnuPG-Bug-Id: T1649

16 months agotests: Print userid signatures in run-keylist
Andre Heinecke [Thu, 7 Dec 2017 12:47:18 +0000 (13:47 +0100)]
tests: Print userid signatures in run-keylist

* tests/run-keylist.c (main): Print UID signatures if there
are any.

16 months agocore: Also check for a failed selftest in gpgm_data_new.
Werner Koch [Mon, 4 Dec 2017 11:08:31 +0000 (12:08 +0100)]
core: Also check for a failed selftest in gpgm_data_new.

* src/data.c (_gpgme_data_new): Check for failed selftest.
* tests/run-support.h (make_filename): Print a message on mallooc
failure.
(init_gpgme_basic): New.
* tests/run-identify.c (main): Call init_gpgme_basic becuase we do not
need to setup a protocol.
* tests/t-data.c: Define PGM and include run-support.h.
(make_filename): Remove.
(main): Call init_gpgme_basic.
--

Note: This patch may break applications which used gpgme_data but no
gpgme_new without having called the required gpgme_check_version.

GPGME can be used without a protocol for example to work with the data
object abstraction.  Thus a call to gpgme_data_new also needs to check
the result of the core selftests - including on whether
gpgme_check_version has been called.

Signed-off-by: Werner Koch <wk@gnupg.org>
16 months agopython: Default whence argument for Data() to SEEK_SET.
Tobias Mueller [Tue, 22 Aug 2017 15:48:25 +0000 (17:48 +0200)]
python: Default whence argument for Data() to SEEK_SET.

* lang/python/gpgme.i: copied signature from gpgme.h and defaulted the
value to SEEK_SET.
* lang/python/tests/t-data.py: Added a test for no second argument
--

Having to import the os package when wanting to read a Data object is a
slight annoyance. With SWIG, we can define default parameters. This
change defaults the whence argument to SEEK_SET which is how StringIO
and BytesIO behave.

Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
16 months agoRegister DCO for Tobias Mueller
Werner Koch [Sun, 3 Dec 2017 18:28:11 +0000 (19:28 +0100)]
Register DCO for Tobias Mueller

--

16 months agoqt: Add job for quick commands
Andre Heinecke [Fri, 1 Dec 2017 13:29:04 +0000 (14:29 +0100)]
qt: Add job for quick commands

* lang/qt/src/qgpgmequickjob.cpp,
lang/qt/src/qgpgmequickjob.h,
lang/qt/src/quickjob.h: New.
* lang/qt/src/Makefile.am,
lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h,
lang/qt/src/job.cpp: Update accordingly.

--
Keeping it in line with the Job for everything pattern.
Although it's reduced to one job for four commands as
the commands all behave the same.

16 months agocpp: Wrap create_key and create_subkey
Andre Heinecke [Fri, 1 Dec 2017 12:21:34 +0000 (13:21 +0100)]
cpp: Wrap create_key and create_subkey

* lang/cpp/src/context.cpp,
lang/cpp/src/context.h (Context::startCreateKey)
(Context::createKey, Context::createSubkey)
(Context::startCreateSubkey): New.

16 months agoFix uid parsing for ldap keyserver
Andre Heinecke [Fri, 1 Dec 2017 08:44:47 +0000 (09:44 +0100)]
Fix uid parsing for ldap keyserver

* src/engine-gpg.c (gpg_keylist_preprocess): Check field count
for uid and add fallback.

--
This fixes accessing unintialized memory and resulting
crashes in gpgrt_asprintf.

GnuPG-Bug-Id: T3550

16 months agotests: Add missing variable to gpgsm tests Makefile
Werner Koch [Thu, 30 Nov 2017 08:49:38 +0000 (09:49 +0100)]
tests: Add missing variable to gpgsm tests Makefile

* tests/gpgsm/Makefile.am (GPG_AGENT): Set var.  It is used later.
--

Note that the var is used by the gpgsm.conf target.

Reported-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Werner Koch <wk@gnupg.org>
16 months agotests: Make portability fix.
NIIBE Yutaka [Tue, 21 Nov 2017 06:35:10 +0000 (15:35 +0900)]
tests: Make portability fix.

* lang/python/tests/Makefile.am: Distinguish target and path.
* tests/gpg/Makefile.am: Ditto.
* tests/gpgsm/Makefile.am: Ditto.

--

GNU Make is powerful enough to match path to target (and vice versa),
but BSD make is not.

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
17 months agoqt: Fix IODeviceDataProvider with Process
Andre Heinecke [Tue, 14 Nov 2017 13:28:32 +0000 (14:28 +0100)]
qt: Fix IODeviceDataProvider with Process

* lang/qt/src/dataprovider.cpp (blocking_read): Keep
reading if process is not atEnd.

--
This fixes a regression in Kleopatra that uses this dataprovider
to chain the gpgtar process to the encryption / signing.

18 months agocore: use getdents64 syscall on linux instead of getdents.
Daniel Kahn Gillmor [Wed, 11 Oct 2017 15:38:39 +0000 (11:38 -0400)]
core: use getdents64 syscall on linux instead of getdents.

* src/posix-io.c (get_max_fds): use getdents64 instead of getdents.
--

getdents64 was introduced in linux 2.4, so it should be widely
available.  some Linux architectures which post-date 2.4 (e.g. arm64)
appear to not have getdents at all, so it's probably better to use the
more modern interface.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
18 months agocore: Allow disabling the use of SYS_getdents for Linux.
Werner Koch [Wed, 4 Oct 2017 16:03:54 +0000 (18:03 +0200)]
core: Allow disabling the use of SYS_getdents for Linux.

* configure.ac (USE_LINUX_GETDENTS): New ac_define.  Add option
--disable-linux-getdents.
* src/posix-io.c: Make use of USE_LINUX_GETDENTS.

Signed-off-by: Werner Koch <wk@gnupg.org>
18 months agocore: Restore get_max_fds optimization on Linux
Colin Watson [Sat, 16 Sep 2017 03:16:45 +0000 (04:16 +0100)]
core: Restore get_max_fds optimization on Linux

* src/posix-io.c (get_max_fds): Restore Linux optimization, this time
using open/getdents/close rather than opendir/readdir/closedir.
--

opendir/readdir/closedir may allocate/free memory, and aren't required
to do so in an async-signal-safe way.  On the other hand, opening
/proc/self/fd directly and iterating over it using getdents is safe.

(getdents is not strictly speaking documented to be async-signal-safe
because it's not in POSIX.  However, the Linux implementation is
essentially just a souped-up read.  Python >= 3.2.3 makes the same
assumption.)

Signed-off-by: Colin Watson <cjwatson@debian.org>
18 months agoRegister DCO for Colin Watson.
Werner Koch [Wed, 4 Oct 2017 15:25:36 +0000 (17:25 +0200)]
Register DCO for Colin Watson.

--

19 months agoqt: Add test for version info
Andre Heinecke [Mon, 4 Sep 2017 09:25:34 +0000 (11:25 +0200)]
qt: Add test for version info

* lang/qt/tests/t-various.cpp (TestVarious::testVersion): New.

--
If it's not tested it does not work ;-)

19 months agocpp: Fix version info comparison
Andre Heinecke [Mon, 4 Sep 2017 09:23:56 +0000 (11:23 +0200)]
cpp: Fix version info comparison

* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<):
Fix logic.
* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator>):
New.
* NEWS: Mention added API

--
This fixes a logic error that 2.2.0 < 2.1.19 would return true.

19 months agocore: New context flag "auto-key-retrieve"
Werner Koch [Thu, 24 Aug 2017 15:17:11 +0000 (17:17 +0200)]
core: New context flag "auto-key-retrieve"

* src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag
"auto-key-retrieve".
* src/context.h (gpgme_context): New field auto_key_retrieve.
* src/engine-backend.h (struct engine_ops): Add arg auto_key_retrieve
to field 'decrypt'.
* src/engine-gpg.c (gpg_decrypt): Add arg auto_key_retrieve and pass
option --auto-key-retrieve to gpg.  Adjust all callers.
(gpg_verify): Ditto.
* src/engine-gpgsm.c (gpgsm_decrypt): Add dummy arg auto_key_retrieve.
* src/engine-uiserver.c (uiserver_decrypt): Ditto.
* tests/run-verify.c (main): Add option --auto-key-retrieve.
--

This makes the --auto-key-retrieve option available in the GPGME API.

Test plan:
Run

  GPGME_DEBUG=9:out tests/run-verify SIGNEDFILE

with and without its new option --auto-key-retrieve and check in the
trace stored in "out" whether --auto-key-retrieve was passed to gpg.

Signed-off-by: Werner Koch <wk@gnupg.org>
19 months agoSet next version to 1.10.0
Werner Koch [Thu, 24 Aug 2017 14:19:54 +0000 (16:19 +0200)]
Set next version to 1.10.0

--

19 months agocore: New public enum gpgme_keyorg_t.
Werner Koch [Thu, 24 Aug 2017 12:21:15 +0000 (14:21 +0200)]
core: New public enum gpgme_keyorg_t.

* src/gpgme.h.in (gpgme_keyorg_t): New.
* src/keylist.c (parse_keyorg): New.
(keylist_colon_handler): Set key->ORIGIN.
--

This finally set the key origin value form data supplied by recent gpg
versions.

Signed-off-by: Werner Koch <wk@gnupg.org>
19 months agogpgconf: Add more comments.
Marcus Brinkmann [Thu, 24 Aug 2017 13:50:16 +0000 (15:50 +0200)]
gpgconf: Add more comments.

* src/engine-gpgconf.c (gpgconf_config_dir_cb, gpgconf_conf_dir):
Add comments.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3018

19 months agoFix a couple of bugs pointed out by clang compiler warnings.
Marcus Brinkmann [Wed, 23 Aug 2017 13:38:11 +0000 (15:38 +0200)]
Fix a couple of bugs pointed out by clang compiler warnings.

* src/engine-gpgconf.c (gpgconf_config_dir_cb): Fix cast.
* src/key.c (_gpgme_key_add_sig): Fix pointer reference.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
19 months agopython: Support parallel build in tests
Alon Bar-Lev [Thu, 3 Aug 2017 18:41:35 +0000 (21:41 +0300)]
python: Support parallel build in tests

* lang/python/tests/Makefile.am: Depend xcheck with all which was lost
due to the check hack.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
19 months agopython: Improve keylist test.
Justus Winter [Mon, 21 Aug 2017 08:54:10 +0000 (10:54 +0200)]
python: Improve keylist test.

* lang/python/tests/t-keylist.py: Check a keylist matching no keys.

Signed-off-by: Justus Winter <justus@g10code.com>
20 months agodoc: Add version information.
Marcus Brinkmann [Wed, 16 Aug 2017 20:52:29 +0000 (22:52 +0200)]
doc: Add version information.

* doc/gpgme.texi (since): New macro.  Use it to add version
information to those APIs that are mentioned in the NEWS file.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3137

20 months agodoc: Clarify import keys operation further.
Marcus Brinkmann [Wed, 16 Aug 2017 13:39:17 +0000 (15:39 +0200)]
doc: Clarify import keys operation further.

* doc/gpgme.texi (gpgme_op_import_keys): Further clarifications.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3215

20 months agogpgconf: Fix some warnings.
Marcus Brinkmann [Tue, 15 Aug 2017 23:50:00 +0000 (01:50 +0200)]
gpgconf: Fix some warnings.

* tests/gpg/t-gpgconf.c (main): Fix warnings.
* src/engine-gpgconf.c (struct gpgconf_config_dir_s): New struct.
(gpgconf_config_dir_cb, gpgconf_conf_dir) Use it to fix warning.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
20 months agogpgconf: Fix symbol export.
Marcus Brinkmann [Tue, 15 Aug 2017 22:59:35 +0000 (00:59 +0200)]
gpgconf: Fix symbol export.

* gpgme.def: Fix last change.
(gpgme_op_conf_save): Replace duplicate from c&p ...
(gpgme_op_conf_dir): ... with this.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
Fixes-commit: 9cd2b58dfb2c21cce64520cf4c726859b583d14e

20 months agoNEWS: Add missing entry.
Marcus Brinkmann [Tue, 15 Aug 2017 18:00:26 +0000 (20:00 +0200)]
NEWS: Add missing entry.

20 months agogpgconf: Add access to --list-dirs for non-default engine.
Marcus Brinkmann [Tue, 15 Aug 2017 17:40:12 +0000 (19:40 +0200)]
gpgconf: Add access to --list-dirs for non-default engine.

* src/engine-assuan.c (_gpgme_engine_ops_assuan): Add conf_dir.
* src/engine-g13.c (_gpgme_engine_ops_g13): Likewise.
* src/engine-gpg.c (_gpgme_engine_ops_gpg): Likewise.
* src/engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise.
* src/engine-spawn.c (_gpgme_engine_ops_spawn): Likewise.
* src/engine-uiserver.c (_gpgme_engine_ops_uiserver): Likewise.
* src/engine-backend.h (struct engine_ops): Likewise.
* src/engine-gpgconf.c (gpgconf_config_dir_cb, gpgconf_conf_dir):
New functions.
(struct engine_ops): Add gpgconf_conf_dir.
* src/engine.c (_gpgme_engine_op_conf_dir): New function.
* src/engine.h (_gpgme_engine_op_conf_dir): New prototype.
* src/gpgconf.c (gpgme_op_conf_dir): New function.
* src/gpgme.def (gpgme_op_conf_save): New symbol.
* src/gpgme.h.in (gpgme_op_conf_dir): New prototype.
* src/libgpgme.vers (gpgme_op_conf_dir): New symbol.
* tests/gpg/t-gpgconf.c (main): Test gpgme_op_conf_dir.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3018

20 months agog10: Add new delete operations that allow more flags.
Marcus Brinkmann [Fri, 11 Aug 2017 17:13:44 +0000 (19:13 +0200)]
g10: Add new delete operations that allow more flags.

* NEWS: Document new interfaces.
* doc/gpgme.texi: Document new interfaces.
* src/gpgme.h.in (GPGME_DELETE_ALLOW_SECRET, GPGME_DELETE_FORCE,
gpgme_op_delete_ext_start, gpgme_op_delete_ext): New.
* src/delete.c (delete_start): Change allow_secret argument to flags.
(gpgme_op_delete_ext, gpgme_op_delete_ext_start): New functions.
* src/engine-backend.h (delete): Change allow_secret argument to flags.
* src/engine.c (_gpgme_engine_op_delete): Likewise.
* src/engine.h (_gpgme_engine_op_delete): Likewise (for prototype).
* src/engine-gpgsm.c (gpgsm_delete): Likewise.
* src/engine-gpg.c (gpg_delete): Likewise.  Implement GPGME_DELETE_FORCE.
* src/gpgme.def (gpgme_op_delete_ext, gpgme_op_delete_ext_start): New.
* src/libgpgme.vers (gpgme_op_delete_ext, gpgme_op_delete_ext_start): New.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 2916

20 months agodoc: Clarify import keys operation.
Marcus Brinkmann [Thu, 10 Aug 2017 14:50:11 +0000 (16:50 +0200)]
doc: Clarify import keys operation.

* doc/gpgme.texi (gpgme_op_import_start): Fix grammar.
(gpgme_op_import_keys): Clarify some wording and fix result.
* src/import.c (gpgme_op_import_keys): Clarify comment.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 3215

20 months agodoc: Add more tofu documentation.
Marcus Brinkmann [Thu, 10 Aug 2017 14:10:40 +0000 (16:10 +0200)]
doc: Add more tofu documentation.

* doc/gpgme.texi (gpgme_tofu_info_t): Document structure.
(gpgme_sigsum_t): Document GPGME_SIGSUM_TOFU_CONFLICT.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 2816

20 months agocore: Fix status parsing for decrypt + verify
Andre Heinecke [Thu, 27 Jul 2017 12:20:58 +0000 (14:20 +0200)]
core: Fix status parsing for decrypt + verify

* src/decrypt.c (parse_status_error): Don't modify args.

--
Otherwise chained status handlers will not see the full args
which resulted in a parse error in the verify status handler.

GnuPG-Bug-Id: T3310

20 months agocpp: Fix Key::isDeVs for subkeys
Andre Heinecke [Wed, 26 Jul 2017 13:07:27 +0000 (15:07 +0200)]
cpp: Fix Key::isDeVs for subkeys

* lang/cpp/src/key.cpp (Key::isDeVs): Check all subkeys.

--
Previosly only the primary key was checked and not all subkeys.

21 months agotests: Fix distcheck.
Justus Winter [Thu, 13 Jul 2017 14:06:27 +0000 (16:06 +0200)]
tests: Fix distcheck.

* tests/start-stop-agent: Remove backup file.

Fixes-commit: 9cd2b58dfb2c21cce64520cf4c726859b583d14e
Signed-off-by: Justus Winter <justus@g10code.com>
21 months agotests: Fix blunder.
Justus Winter [Thu, 13 Jul 2017 14:04:07 +0000 (16:04 +0200)]
tests: Fix blunder.

--
Fixes-commit: 9cd2b58dfb2c21cce64520cf4c726859b583d14e
Signed-off-by: Justus Winter <justus@g10code.com>
21 months agotests: Make agent spawning more robust.
Justus Winter [Thu, 13 Jul 2017 13:41:11 +0000 (15:41 +0200)]
tests: Make agent spawning more robust.

* tests/gpgsm/Makefile.am (gpgsm.conf): Add agent-program directive.
* tests/start-stop-agent: Update agent-program directive.
--
Update the 'agent-program' configuration directive to point to the
same agent that we are starting.  Previously, it was possible that a
different agent was started if 'make check' was run with a different
PATH.

Signed-off-by: Justus Winter <justus@g10code.com>
21 months agoSync 'autogen.sh'.
Justus Winter [Thu, 13 Jul 2017 13:30:38 +0000 (15:30 +0200)]
Sync 'autogen.sh'.

--
Signed-off-by: Justus Winter <justus@g10code.com>
21 months agotests: Fix printf compiler warning for an error case.
Werner Koch [Wed, 12 Jul 2017 16:32:50 +0000 (18:32 +0200)]
tests: Fix printf compiler warning for an error case.

* tests/gpg/t-keylist.c (main): Cast DIM to int.

Signed-off-by: Werner Koch <wk@gnupg.org>
21 months agocore: Return NO_SECKEY error code on decryption
Werner Koch [Wed, 12 Jul 2017 16:30:49 +0000 (18:30 +0200)]
core: Return NO_SECKEY error code on decryption

* src/decrypt.c (op_data_t): Add flag any_no_seckey.
(_gpgme_decrypt_status_handler): Consult that flag.
(_gpgme_decrypt_status_handler): Set that flag.
--

The NO_SECKEY is emitted instead of an "S ERROR pkdecrypt_failed" if
gpg knowns that a key has been encrypted to that key (cf. "S ENC_TO").
it is not fool proffof but in the majority of cases we can provide a
better error message than just DECRYPTION_FAILED.

GnuPG-bug-id: 3270
Signed-off-by: Werner Koch <wk@gnupg.org>
21 months agocore: Return CANCELED and BAD_PASSPHRASE error code on decryption.
Werner Koch [Wed, 12 Jul 2017 15:55:43 +0000 (17:55 +0200)]
core: Return CANCELED and BAD_PASSPHRASE error code on decryption.

* src/decrypt.c (op_data_t): Add field pkdecrypt_failed.
(_gpgme_decrypt_status_handler): Consult new field.
(parse_status_error): Handle some error codes.
--

The idea is to return only a limited set of error codes because a user
won't be able to understand the more esoteric codes.

GnuPG-bug-id: 3270
Signed-off-by: Werner Koch <wk@gnupg.org>
21 months agocore: Simplify parsing of STATUS_ERROR in decrypt.c
Werner Koch [Wed, 12 Jul 2017 13:59:12 +0000 (15:59 +0200)]
core: Simplify parsing of STATUS_ERROR in decrypt.c

* src/decrypt.c (_gpgme_decrypt_status_handler): Factor some code out
to ...
(parse_status_error): new.  Modernize parsing.

Signed-off-by: Werner Koch <wk@gnupg.org>
21 months agodoc: Add list of copyright olders to AUTHORS.
Werner Koch [Wed, 12 Jul 2017 12:56:22 +0000 (14:56 +0200)]
doc: Add list of copyright olders to AUTHORS.

--