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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* configure.ac (LIBGPGMEPP_LT_REVISION): Bump revision.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Fix select usage in t-eventloop
Daiki Ueno [Tue, 9 Feb 2016 08:03:51 +0000 (17:03 +0900)]
tests: Fix select usage in t-eventloop

* tests/gpg/t-eventloop.c (do_select): Supply timeout value to select.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agodoc: Fix minor errors in I/O callback example
Daiki Ueno [Tue, 9 Feb 2016 08:03:50 +0000 (17:03 +0900)]
doc: Fix minor errors in I/O callback example

* gpgme.texi (I/O Callback Example): Fix typos, add timeout to select,
and initialize mutex as recursive.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agocpp: Avoid missing returns in non-void functions
Andreas Stieger [Wed, 21 Sep 2016 12:28:23 +0000 (14:28 +0200)]
cpp: Avoid missing returns in non-void functions

* lang/cpp/src/context.cpp
  (Context::signaturePolicyURL): return nullptr on default
  (to_tofu_policy_t): add default case for unknown
* lang/cpp/src/key.cpp
  (Key::primaryFingerprint): return nullptr on default
* lang/cpp/src/tofuinfo.cpp
  (GpgME::TofuInfo::policy): add default case for unknown

Signed-off-by: Andreas Stieger <astieger@suse.com>
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2 years agoPost release updates
Werner Koch [Wed, 21 Sep 2016 07:40:02 +0000 (09:40 +0200)]
Post release updates

--

2 years agoRelease 1.7.0 gpgme-1.7.0
Werner Koch [Wed, 21 Sep 2016 06:57:07 +0000 (08:57 +0200)]
Release 1.7.0

* configure.ac: Bump LT vesion to C26/A15/R0.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Create install dir.
Werner Koch [Wed, 21 Sep 2016 07:17:23 +0000 (09:17 +0200)]
python: Create install dir.

* lang/python/Makefile.am (install-exec-local): Create dir.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Make "make -j distcheck" work in Python.
Werner Koch [Tue, 20 Sep 2016 17:58:00 +0000 (19:58 +0200)]
tests: Make "make -j distcheck" work in Python.

* lang/python/Makefile.am (SUBDIRS): Make current dir fist.
* lang/python/tests/Makefile.am (xcheck): Depend on pubring-stamp.
(CLEANFILES): Remove private-keys-v1.d/gpg-sample.stamp.
(check-local): Remove.
(initial.py): Remove dependency.
(./pubring-stamp): Depend on conf files and the
private-keys-v1.d/gpg-sample.stamp file.  Also replace use of
basename.

--

This addresses the problem that two rules might run the private keys
copy rule and due to the files being chmod -w during make discheck the
second process running that rule's cp would get a permission error.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Use --batch for gpg import.
Werner Koch [Tue, 20 Sep 2016 17:51:02 +0000 (19:51 +0200)]
tests: Use --batch for gpg import.

* lang/python/tests/Makefile.am (./pubring-stamp): Use --batch with
GPG to avoid Pinentries during import when using GnuPG >= 2.1.
Replace touch by echo.
* tests/gpg/Makefile.am (./pubring-stamp): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Improve portability.
Werner Koch [Tue, 20 Sep 2016 17:46:04 +0000 (19:46 +0200)]
tests: Improve portability.

* lang/qt/tests/Makefile.am (clean-local): Avoid non-portable "--"
* lang/python/Makefile.am (copystamp): Use well defined cp -R instead
of cp -r.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agobuild: Create swdb file.
Werner Koch [Tue, 20 Sep 2016 17:43:49 +0000 (19:43 +0200)]
build: Create swdb file.

* Makefile.am (distcheck-hook): New.
(dist-hook): s/VERSION/PACKAGE_VERSION/ for future compatibility.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Fix detection of Python available versions.
Justus Winter [Tue, 20 Sep 2016 09:10:10 +0000 (11:10 +0200)]
python: Fix detection of Python available versions.

* configure.ac: Test for 'PYTHON_VERSION' as 'AX_PYTHON_DEVEL' sets
'PYTHON' but clears the former.

Fixes-commit: 99db3512
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: Remove moc artifact
Andre Heinecke [Mon, 19 Sep 2016 12:29:03 +0000 (14:29 +0200)]
core: Remove moc artifact

* src/moc_kdpipeiodevice.cpp: Removed.
* src/Makefile.am (EXTRA_DIST): Remove moc_kdpipeiodevice.cpp.

--
This file was overlooked in 58ed9c17 which removed the unused
and obsolete w32-qt code. See lang/qt QIODeviceDataProvider which
replaced kdpipeiodevice.

2 years agoAdd NEWS entry for qt/cpp
Andre Heinecke [Mon, 19 Sep 2016 12:21:45 +0000 (14:21 +0200)]
Add NEWS entry for qt/cpp

--

2 years agoqt: Improve README
Andre Heinecke [Mon, 19 Sep 2016 12:09:44 +0000 (14:09 +0200)]
qt: Improve README

* lang/qt/README: Add more content. Clearly note license difference.

2 years agocpp: Improve README
Andre Heinecke [Mon, 19 Sep 2016 12:09:19 +0000 (14:09 +0200)]
cpp: Improve README

* lang/cpp/README: Add more content, move license to bottom.

2 years agopython: Improve metadata and READMEs.
Justus Winter [Mon, 19 Sep 2016 10:49:14 +0000 (12:49 +0200)]
python: Improve metadata and READMEs.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoqt: Add debug output for testTofuPolicy
Andre Heinecke [Mon, 19 Sep 2016 08:01:19 +0000 (10:01 +0200)]
qt: Add debug output for testTofuPolicy

* lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): Add
debug output.

--
The debug output is only emitted before a failure of the
test in case a keylisting of bravo@example.net fails which
it should never do.

2 years agodoc: Mention language bindings in the manual.
Werner Koch [Mon, 19 Sep 2016 07:06:24 +0000 (09:06 +0200)]
doc: Mention language bindings in the manual.

--

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Check for GPG_TTY as well as DISPLAY.
Ben Kibbey [Sat, 3 Sep 2016 23:06:36 +0000 (19:06 -0400)]
core: Check for GPG_TTY as well as DISPLAY.

* src/engine-assuan.c (llass_new): Update --ttyname from GPG_TTY.
* src/engine-g13.c (g13_new): Ditto.
* src/engine-gpg.c (gpg_new): Ditto.
* src/engine-uiserver.c (uiserver_new): Ditto.
* src/engine-gpgsm.c (gpgsm_new): Ditto.

--
Useful when no DISPLAY is set and there is no attached terminal to the
current process.

Signed-off-by: Ben Kibbey <bjk@luxsci.net>
2 years agoqt: Add test for setting tofu policy
Andre Heinecke [Fri, 16 Sep 2016 14:58:00 +0000 (16:58 +0200)]
qt: Add test for setting tofu policy

* lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): New.

2 years agoqt: Add job for tofupolicy
Andre Heinecke [Fri, 16 Sep 2016 14:55:25 +0000 (16:55 +0200)]
qt: Add job for tofupolicy

* lang/qt/src/job.cpp, lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h: Register job.
* lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.h,
lang/qt/src/tofupolicyjob.h: New.
* lang/qt/src/Makefile.am: Update accordingly.

2 years agocpp: Add support for gpgme_op_tofu_policy
Andre Heinecke [Fri, 16 Sep 2016 14:54:07 +0000 (16:54 +0200)]
cpp: Add support for gpgme_op_tofu_policy

* src/context.cpp, src/context.h (setTofuPolicy, setTofuPolicyStart):
New.

2 years agocpp: Declare sizes of tofu-info enums
Andre Heinecke [Fri, 16 Sep 2016 14:52:03 +0000 (16:52 +0200)]
cpp: Declare sizes of tofu-info enums

* lang/cpp/src/tofuinfo.h (Policy, Validity): Declare sizes.

--
This is a quick ABI break before the release so that we can
easier extend them in the future. All new enums in public API
should be declared with a size from now on.

2 years agocpp: Silence use of deprecated function warning.
Werner Koch [Fri, 16 Sep 2016 13:59:54 +0000 (15:59 +0200)]
cpp: Silence use of deprecated function warning.

* lang/cpp/src/context.cpp (GpgME): Use pragma to silence wardning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Document the version a function has been deprecated.
Werner Koch [Fri, 16 Sep 2016 13:59:07 +0000 (15:59 +0200)]
core: Document the version a function has been deprecated.

* src/gpgme.h.in (_GPGME_DEPRECATED): Change to take versio numbers
for documentation.  Change all places.
(_GPGME_DEPRECATED_OUTSIDE_GPGME): Ditto.
* lang/python/gpgme-h-clean.py: Adjust RE.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Map GPGME_STATUS_EOF to the empty string.
Werner Koch [Fri, 16 Sep 2016 13:06:26 +0000 (15:06 +0200)]
core: Map GPGME_STATUS_EOF to the empty string.

* src/status-table.c (_gpgme_status_to_string): Return "" for EOF.
* src/engine-gpg.c (read_status): Ditto.  The old code accidently used
GPGME_STATUS_EOF which is the integer 0 and neiteyr NULL nor a string.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Release the GIL during calls into GPGME.
Justus Winter [Fri, 16 Sep 2016 10:32:24 +0000 (12:32 +0200)]
python: Release the GIL during calls into GPGME.

* lang/python/helpers.c (pyme_raise_callback_exception): Re-acquire
the Global Interpreter Lock.
(pyPassphraseCb, pyme_set_passphrase_cb, pyProgressCb,
pyme_set_progress_cb, pyStatusCb, pyme_set_status_cb,
_pyme_interact_cb, pyDataReadCb, pyDataWriteCb, pyDataSeekCb,
pyDataReleaseCb, pyme_data_new_from_cbs, _pyme_assuan_data_cb,
_pyme_assuan_inquire_cb, _pyme_assuan_status_cb): Likewise.
* lang/python/setup.py.in: Make 'gpgme-config' emit the correct
cflags, and SWIG generate code to release the GIL before calling us.

Co-authored-by: Kai Michaelis <kai@gnupg.org>
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Adapt to 'gpgme_op_interact'.
Justus Winter [Fri, 16 Sep 2016 12:56:29 +0000 (14:56 +0200)]
python: Adapt to 'gpgme_op_interact'.

* lang/python/examples/inter-edit.py: Update example.
* lang/python/gpgme.i (gpgme_edit_cb_t): Turn into
'gpgme_interact_cb_t'.
* lang/python/helpers.c (_pyme_edit_cb): Turn into
'_pyme_interact_cb_t'.
* lang/python/private.h (_pyme_edit_cb): Likewise.
* lang/python/pyme/constants/__init__.py: Replace numeric status codes
with the keywords.
* lang/python/pyme/constants/status.py: Likewise.
* lang/python/pyme/core.py (Context.interact): New method.
(Context.op_edit): Deprecate, update docstring, implement using
Context.interact.
* lang/python/tests/t-edit.py: Test both interfaces.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: Fix typos.
Justus Winter [Fri, 16 Sep 2016 11:02:55 +0000 (13:02 +0200)]
core: Fix typos.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agodoc: Move description of most deprecated functions to a new appendix.
Werner Koch [Fri, 16 Sep 2016 10:20:33 +0000 (12:20 +0200)]
doc: Move description of most deprecated functions to a new appendix.

--
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agodoc: Document the recently added --quick-foo related functions.
Werner Koch [Fri, 16 Sep 2016 09:48:29 +0000 (11:48 +0200)]
doc: Document the recently added --quick-foo related functions.

--

2 years agocore: Remove stub to try implementing gpg < 2.1 support for createkey.
Werner Koch [Fri, 16 Sep 2016 09:45:07 +0000 (11:45 +0200)]
core: Remove stub to try implementing gpg < 2.1 support for createkey.

* src/engine-gpg.c (gpg_createkey_legacy): Remove.
(gpg_genkey): Remove call.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Fix setting og the verification result.
Werner Koch [Fri, 16 Sep 2016 09:43:32 +0000 (11:43 +0200)]
core: Fix setting og the verification result.

* src/verify.c (parse_new_sig): Proberly handle the RC in an ERRSIG
status.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_interact, deprecate gpgme_op_edit.
Werner Koch [Thu, 15 Sep 2016 08:45:04 +0000 (10:45 +0200)]
core: New function gpgme_op_interact, deprecate gpgme_op_edit.

* src/gpgme.h.in (gpgme_interact_cb_t): New.
(GPGME_INTERACT_CARD): New.
(gpgme_op_interact_start, gpgme_op_interact): New.
* src/libgpgme.vers, src/gpgme.def: Add new functions.
* src/edit.c (op_data_t): Rename fnc to fnc_old and change users.  Add
fnc.
(edit_status_handler): Call old or new callback.
(command_handler): Ditto.
(interact_start): New.
(gpgme_op_interact_start, gpgme_op_interact_start): New.
* src/status-table.c (_gpgme_status_to_string): New.

* tests/gpg/t-edit.c (edit_fnc): Rename to interact_fnc and change
type of STATUS.  Use gpgme_io_writen.
(main): s/gpgme_op_edit/gpgme_op_interact/.
--

This change will eventually allow us to remove all those status codes
from gpgme.h.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Minor change of the gpgme_op_edit semantics.
Werner Koch [Thu, 15 Sep 2016 07:24:29 +0000 (09:24 +0200)]
core: Minor change of the gpgme_op_edit semantics.

* src/edit.c (command_handler): Handle special error code.
* src/engine-gpg.c (read_status): Ditto.
* src/engine-gpgsm.c (status_handler): Ditto.
* src/engine-uiserver.c (status_handler): Ditto.
* src/util.h (GPG_ERR_FALSE): Define for older libgpg-error versions.
--

An edit callback may now simply return GPG_ERR_FALSE to indicate that
it did not handled the status code.  GPGME will the do the appropriate
action, which is to send an empty line.

Note that it is highly unlikely that GPG_ERR_FALSE has ever been used
by an application as return value from an edit interactor.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_tofu_policy
Werner Koch [Wed, 14 Sep 2016 18:21:19 +0000 (20:21 +0200)]
core: New function gpgme_op_tofu_policy

* src/gpgme.h.in (gpgme_op_tofu_policy_start): New function.
(gpgme_op_tofu_policy): New function.
* src/libgpgme.vers, src/gpgme.def: Add new functions.
* src/tofupolicy.c: New.
* src/Makefile.am (main_sources): Add that file.
* src/context.h (ctx_op_data_id_t): Add OPDATA_TOFU_POLICY.
* src/engine.c (_gpgme_engine_op_tofu_policy): New.
* src/engine-backend.h (engine_ops): Add funcptr 'tofu_policy'.
Adjust all engine initializations.
* src/engine-gpg.c (gpg_tofu_policy): New.
(_gpgme_engine_ops_gpg): Register this function.

* tests/run-tofu.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add it.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Defer implementation of gpgme_op_createkey with gpg < 2.1
Werner Koch [Wed, 14 Sep 2016 17:02:40 +0000 (19:02 +0200)]
core: Defer implementation of gpgme_op_createkey with gpg < 2.1

* src/engine-gpg.c (gpg_createkey_legacy): Mark unused variables.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_keysign.
Werner Koch [Wed, 14 Sep 2016 16:44:33 +0000 (18:44 +0200)]
core: New function gpgme_op_keysign.

* src/gpgme.h.in (gpgme_op_keysign_start, gpgme_op_keysign): New.
(GPGME_KEYSIGN_LOCAL): New.
(GPGME_KEYSIGN_LFSEP): New.
(GPGME_KEYSIGN_NOEXPIRE): New.
* src/context.h (ctx_op_data_id_t): Add OPDATA_KEYSIGN.
* src/keysign.c: New.
* src/Makefile.am (main_sources): Add keysig.
* src/libgpgme.vers, src/gpgme.def: Add gpgme_op_keysign_start.
* src/engine.c (_gpgme_engine_op_keysign): New.
* src/engine-backend.h (engine_ops): Add 'keysign' and adjust all
engine initializers.
* src/engine-gpg.c (_add_arg): Add args PREFIX and ARGLEN and change
callers to set them.
(add_arg_pfx): New.
(add_arg_len): New.
(gpg_keysign): New.
(_gpgme_engine_ops_gpg): Set keysign to gpg_keysign.
* tests/run-keysign.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add run-keysign.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Clarify that we support Python 2.7 too.
Justus Winter [Wed, 14 Sep 2016 12:36:29 +0000 (14:36 +0200)]
python: Clarify that we support Python 2.7 too.

* lang/python/README: Use 'Python' instead of 'Python 3'.
* lang/python/pyme/version.py.in: Likewise.
* lang/python/setup.py.in: Add classifier for 2.7, drop 3 only.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Trim imports.
Justus Winter [Wed, 14 Sep 2016 12:35:00 +0000 (14:35 +0200)]
python: Trim imports.

* lang/python/examples/encrypt-to-all.py: Drop unused import of 'os'.
* lang/python/examples/signverify.py: Likewise.
* lang/python/examples/simple.py: Likewise.
* lang/python/examples/verifydetails.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Improve error handling.
Justus Winter [Wed, 14 Sep 2016 12:34:14 +0000 (14:34 +0200)]
python: Improve error handling.

* lang/python/gpgme.i (gpgme_engine_info_t): Improve error handling.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Adapt to TOFU changes.
Justus Winter [Wed, 14 Sep 2016 12:32:48 +0000 (14:32 +0200)]
python: Adapt to TOFU changes.

* lang/python/pyme/results.py (TofuInfo): Drop.
(Signature): The TOFU information moved to the key.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Improve build system integration.
Justus Winter [Wed, 14 Sep 2016 11:00:20 +0000 (13:00 +0200)]
python: Improve build system integration.

* configure.ac: Try to compile a Python module for each version.
* m4/m4_ax_swig_python.m4: Drop unused file.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: New function gpgme_op_revuid.
Werner Koch [Wed, 14 Sep 2016 10:41:16 +0000 (12:41 +0200)]
core: New function gpgme_op_revuid.

* src/engine.h (GENKEY_EXTRAFLAG_REVOKE): New.
* src/genkey.c (adduid_start): Rename to addrevuid_start.  Add arg
REVOKE and pass it as extraflags.  Remove useless ARMOR extraflag.
Adjust callers.
(gpgme_op_revuid_start, gpgme_op_revuid): New.
* src/gpgme.def, src/libgpgme.vers: Add them.

* tests/run-genkey.c: Add option --revuid.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Change a parameter for the engine's genkey function.
Werner Koch [Wed, 14 Sep 2016 10:15:35 +0000 (12:15 +0200)]
core: Change a parameter for the engine's genkey function.

* src/engine.h (GENKEY_EXTRAFLAG_ARMOR): New.
* src/engine-backend.h (engine_ops): Rename USE_ARMOR in genkey to
EXTRAFLAGS.
* src/engine.c (_gpgme_engine_op_genkey): Ditto.
* src/engine-gpg.c (gpg_createkey_from_param): Ditto and test the
flags.
(gpg_createkey_legacy): Ditto.
(gpg_createkey): Ditto.
(gpg_addkey): Ditto.
(gpg_genkey): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Build for both Python2 and Python3.
Justus Winter [Wed, 14 Sep 2016 08:22:07 +0000 (10:22 +0200)]
python: Build for both Python2 and Python3.

* NEWS: Update.
* configure.ac: Check for multiple Python versions.
* lang/python/Makefile.am: Build and install for both Python versions.
* lang/python/tests/Makefile.am: Test both versions.
* lang/python/tests/run-tests.py: New test runner.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Import from __future__ to align behavior of Python 2.7.
Justus Winter [Wed, 14 Sep 2016 09:39:00 +0000 (11:39 +0200)]
python: Import from __future__ to align behavior of Python 2.7.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Use more generic shebang.
Justus Winter [Wed, 14 Sep 2016 08:51:49 +0000 (10:51 +0200)]
python: Use more generic shebang.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore: New function gpgme_op_adduid.
Werner Koch [Wed, 14 Sep 2016 09:40:34 +0000 (11:40 +0200)]
core: New function gpgme_op_adduid.

* src/genkey.c: Replace most error codes GPG_ERR_INV_VALUE by
GPG_ERR_INV_ARG.
(struct op_data_t): Add field UIDMODE.
(genkey_status_handler): Use UIDMODE.
(adduid_start): New.
(gpgme_op_adduid_start, gpgme_op_adduid): New.
* src/gpgme.def, src/libgpgme.vers: Add them.
* tests/run-genkey.c: Add option --adduid.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_createsubkey.
Werner Koch [Wed, 14 Sep 2016 07:51:16 +0000 (09:51 +0200)]
core: New function gpgme_op_createsubkey.

* src/genkey.c (createsubkey_start): New.
(gpgme_op_createsubkey_start, gpgme_op_createsubkey): New.
* src/gpgme.def, src/libgpgme.vers: Add them.
* src/engine-gpg.c (gpg_createkey): Factor some code out to ...
(gpg_add_algo_usage_expire): new.
(gpg_addkey): Implement.
* tests/run-genkey.c: Add option --addkey.

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