Commit Graph

2066 Commits

Author SHA1 Message Date
Andre Heinecke
1e8c34a919 cpp: Fix init of string from null
* lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return
value before creating the string.
2016-10-14 16:23:57 +02:00
Justus Winter
f526d0e22e
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>
2016-10-13 13:19:49 +02:00
Justus Winter
1e6073ffa9
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>
2016-10-13 13:19:47 +02:00
Justus Winter
cabd4c74e5
python: Fix example.
* lang/python/examples/inter-edit.py: Fix example.

Fixes-commit: a458e7fe
Signed-off-by: Justus Winter <justus@g10code.com>
2016-10-13 13:19:46 +02:00
Andre Heinecke
56302e7bb6 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.
2016-10-13 10:13:47 +02:00
Andre Heinecke
a274c7590a qt, cpp: Fix permissions of Config files
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Do not install config files as executable.
2016-10-13 09:35:30 +02:00
Andre Heinecke
2538c12fa0 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.
2016-10-13 09:13:50 +02:00
Andre Heinecke
a3cf30f894 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.
2016-10-13 09:13:40 +02:00
Andre Heinecke
5f64018af8 Mention Qt API fixes in news
--
2016-10-11 19:57:35 +02:00
Daniel Vrátil
e5a35af557 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.
2016-10-11 19:56:55 +02:00
Daniel Vrátil
ce7385caab 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.
2016-10-11 19:43:37 +02:00
Andre Heinecke
54f94b14e2 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.
2016-10-11 14:13:15 +02:00
Andre Heinecke
e7ceb83a59 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.
2016-10-10 17:42:10 +02:00
Andre Heinecke
b6b820bff1 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.
2016-10-10 17:38:43 +02:00
Andre Heinecke
34e9dfee81 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.
2016-10-10 17:36:41 +02:00
Andre Heinecke
f131a5e72b 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.
2016-10-10 17:34:52 +02:00
Andre Heinecke
098a2da15b 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.
2016-10-10 12:19:48 +02:00
Werner Koch
0ea2ff6790
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>
2016-10-08 21:17:48 +02:00
Justus Winter
857592041b 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>
2016-10-06 13:12:52 +02:00
Andre Heinecke
8033cff441 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.
2016-10-05 17:38:49 +02:00
Andre Heinecke
88c7e84ede 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.
2016-10-05 17:36:17 +02:00
Andre Heinecke
24779c9e23 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.
2016-10-05 17:19:20 +02:00
Andre Heinecke
4984cc93db Add warning flags for c++ compiler, too
* configure.ac (CXXFLAGS): Add Wall and Wextra.
2016-10-05 16:55:14 +02:00
Andre Heinecke
9d1df99038 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.
2016-10-05 16:44:53 +02:00
Andre Heinecke
370ee1aa80 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.
2016-10-05 16:43:16 +02:00
Andre Heinecke
39dd7585f5 cpp: Fix gcc diagnostic push / pop
* lang/cpp/src/context.cpp: Fix pragmas.

--
This fixes an error with -Werror=unknown-pragmas
2016-10-05 16:27:18 +02:00
Andre Heinecke
52a91ccc6a 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.
2016-10-05 16:01:20 +02:00
Alon Bar-Lev
453ab9d24c 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>
2016-09-30 14:47:26 +02:00
Alon Bar-Lev
68fb8371a1 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>
2016-09-30 14:46:28 +02:00
Alon Bar-Lev
d1509428f3 python: Make generated 'setup.py' executable.
--
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2016-09-30 14:46:02 +02:00
Andre Heinecke
7302791c0d 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.
2016-09-29 12:46:18 +02:00
Justus Winter
a6e9eefb23 tests: Fix blunder.
--
Fixes-commit: a423603f
Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-27 12:49:24 +02:00
Daniel Kahn Gillmor
145392f07f 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>
2016-09-27 12:41:38 +02:00
Justus Winter
a423603f80 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>
2016-09-27 12:31:18 +02:00
Justus Winter
c9934bb1ee python: Get rid of the last C++-style comments.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-26 16:54:58 +02:00
Justus Winter
c38fabfea0 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>
2016-09-26 16:54:58 +02:00
Justus Winter
1d80e7374a 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>
2016-09-26 16:54:58 +02:00
Justus Winter
3703a47238 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>
2016-09-26 16:54:57 +02:00
Daniel Kahn Gillmor
95f38652f6 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>
2016-09-23 16:09:27 +02:00
Daniel Kahn Gillmor
a11450eb04 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>
2016-09-23 16:08:33 +02:00
Andre Heinecke
9b38817968 tests: Check data after decryption
* tests/gpgsm/t-decrypt.c (main): Check data matches expected.
Only print result if it does not.
2016-09-23 16:04:33 +02:00
Andre Heinecke
a142f187b7 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.
2016-09-23 15:25:51 +02:00
Werner Koch
583aafdd68
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>
2016-09-22 12:58:23 +02:00
Werner Koch
c447b64d59
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>
2016-09-22 12:46:06 +02:00
Werner Koch
dc39552d01
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>
2016-09-22 12:42:10 +02:00
Daiki Ueno
7a6543c2df
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>
2016-09-22 09:12:43 +02:00
Daiki Ueno
dee56820ca
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>
2016-09-22 09:12:43 +02:00
Daiki Ueno
d0cf6b1512
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>
2016-09-22 09:12:43 +02:00
Daiki Ueno
0aaf1dedd6
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>
2016-09-22 09:12:43 +02:00
Andreas Stieger
ae324b51ff 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>
2016-09-21 16:46:06 +02:00