summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog353
-rw-r--r--NEWS35
-rw-r--r--THANKS6
-rw-r--r--VERSION2
-rwxr-xr-xconfigure52
-rw-r--r--configure.ac21
-rw-r--r--doc/ChangeLog-20112
-rw-r--r--doc/gpgme.info242
-rw-r--r--doc/gpgme.info-146
-rw-r--r--doc/gpgme.info-25
-rw-r--r--doc/gpgme.texi39
-rw-r--r--gpgme.spec2
-rw-r--r--lang/cl/gpgme.asd2
-rw-r--r--lang/cpp/src/GpgmeppConfig.cmake.in.in13
-rw-r--r--lang/cpp/src/Makefile.am10
-rw-r--r--lang/cpp/src/Makefile.in10
-rw-r--r--lang/cpp/src/callbacks.cpp4
-rw-r--r--lang/cpp/src/configuration.cpp4
-rw-r--r--lang/cpp/src/context.cpp10
-rw-r--r--lang/cpp/src/context.h4
-rw-r--r--lang/cpp/src/context_vanilla.cpp4
-rw-r--r--lang/cpp/src/data.cpp10
-rw-r--r--lang/cpp/src/data.h5
-rw-r--r--lang/cpp/src/decryptionresult.cpp4
-rw-r--r--lang/cpp/src/defaultassuantransaction.cpp4
-rw-r--r--lang/cpp/src/editinteractor.cpp4
-rw-r--r--lang/cpp/src/encryptionresult.cpp4
-rw-r--r--lang/cpp/src/engineinfo.cpp4
-rw-r--r--lang/cpp/src/eventloopinteractor.cpp4
-rw-r--r--lang/cpp/src/exception.cpp4
-rw-r--r--lang/cpp/src/gpgadduserideditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgagentgetinfoassuantransaction.cpp4
-rw-r--r--lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsetownertrusteditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsignkeyeditinteractor.cpp4
-rw-r--r--lang/cpp/src/importresult.cpp4
-rw-r--r--lang/cpp/src/key.cpp25
-rw-r--r--lang/cpp/src/key.h15
-rw-r--r--lang/cpp/src/keygenerationresult.cpp4
-rw-r--r--lang/cpp/src/keylistresult.cpp4
-rw-r--r--lang/cpp/src/scdgetinfoassuantransaction.cpp4
-rw-r--r--lang/cpp/src/signingresult.cpp4
-rw-r--r--lang/cpp/src/tofuinfo.cpp5
-rw-r--r--lang/cpp/src/trustitem.cpp4
-rw-r--r--lang/cpp/src/verificationresult.cpp38
-rw-r--r--lang/cpp/src/verificationresult.h21
-rw-r--r--lang/cpp/src/vfsmountresult.cpp4
-rw-r--r--lang/python/Makefile.am17
-rw-r--r--lang/python/Makefile.in17
-rw-r--r--lang/python/examples/inter-edit.py4
-rw-r--r--lang/python/examples/testCMSgetkey.py2
-rwxr-xr-xlang/python/examples/verifydetails.py2
-rw-r--r--lang/python/gpgme.i92
-rw-r--r--lang/python/helpers.c4
-rw-r--r--lang/python/helpers.h4
-rw-r--r--lang/python/pyme/core.py31
-rw-r--r--lang/python/pyme/errors.py22
-rw-r--r--lang/python/pyme/version.py2
-rwxr-xr-xlang/python/setup.py.in3
-rw-r--r--lang/python/tests/support.py1
-rwxr-xr-xlang/python/tests/t-keylist.py23
-rwxr-xr-xlang/python/tests/t-sig-notation.py1
-rw-r--r--lang/qt/src/AbstractImportJob1
-rw-r--r--lang/qt/src/Makefile.am18
-rw-r--r--lang/qt/src/Makefile.in41
-rw-r--r--lang/qt/src/QGpgmeConfig.cmake.in.in13
-rw-r--r--lang/qt/src/SpecialJob1
-rw-r--r--lang/qt/src/dataprovider.cpp6
-rw-r--r--lang/qt/src/defaultkeygenerationjob.cpp4
-rw-r--r--lang/qt/src/gpgme_backend_debug.cpp4
-rw-r--r--lang/qt/src/job.cpp4
-rw-r--r--lang/qt/src/multideletejob.cpp117
-rw-r--r--lang/qt/src/multideletejob.h2
-rw-r--r--lang/qt/src/protocol.h6
-rw-r--r--lang/qt/src/qgpgmeadduseridjob.cpp4
-rw-r--r--lang/qt/src/qgpgmebackend.cpp4
-rw-r--r--lang/qt/src/qgpgmechangeexpiryjob.cpp4
-rw-r--r--lang/qt/src/qgpgmechangeownertrustjob.cpp4
-rw-r--r--lang/qt/src/qgpgmechangepasswdjob.cpp4
-rw-r--r--lang/qt/src/qgpgmedecryptjob.cpp4
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.cpp4
-rw-r--r--lang/qt/src/qgpgmedeletejob.cpp4
-rw-r--r--lang/qt/src/qgpgmedownloadjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeencryptjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeexportjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeimportfromkeyserverjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeimportjob.cpp4
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.cpp4
-rw-r--r--lang/qt/src/qgpgmekeygenerationjob.cpp4
-rw-r--r--lang/qt/src/qgpgmekeylistjob.cpp4
-rw-r--r--lang/qt/src/qgpgmelistallkeysjob.cpp4
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.cpp6
-rw-r--r--lang/qt/src/qgpgmerefreshkeysjob.cpp6
-rw-r--r--lang/qt/src/qgpgmesecretkeyexportjob.cpp6
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.cpp4
-rw-r--r--lang/qt/src/qgpgmesignjob.cpp4
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.cpp4
-rw-r--r--lang/qt/src/qgpgmetofupolicyjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeverifydetachedjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeverifyopaquejob.cpp4
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.cpp10
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.h2
-rw-r--r--lang/qt/src/threadedjobmixin.cpp4
-rw-r--r--lang/qt/src/threadedjobmixin.h3
-rw-r--r--lang/qt/src/wkspublishjob.h4
-rw-r--r--lang/qt/tests/Makefile.am7
-rw-r--r--lang/qt/tests/Makefile.in23
-rw-r--r--lang/qt/tests/run-keyformailboxjob.cpp4
-rw-r--r--lang/qt/tests/t-encrypt.cpp36
-rw-r--r--lang/qt/tests/t-keylist.cpp4
-rw-r--r--lang/qt/tests/t-keylocate.cpp4
-rw-r--r--lang/qt/tests/t-ownertrust.cpp4
-rw-r--r--lang/qt/tests/t-support.cpp4
-rw-r--r--lang/qt/tests/t-support.h4
-rw-r--r--lang/qt/tests/t-tofuinfo.cpp4
-rw-r--r--lang/qt/tests/t-verify.cpp93
-rw-r--r--lang/qt/tests/t-wkspublish.cpp20
-rw-r--r--src/Makefile.in4
-rw-r--r--src/assuan-support.c14
-rw-r--r--src/b64dec.c2
-rw-r--r--src/conversion.c56
-rw-r--r--src/data-identify.c2
-rw-r--r--src/engine-gpg.c4
-rw-r--r--src/gpgme.def2
-rw-r--r--src/gpgme.h.in6
-rw-r--r--src/libgpgme.vers2
-rw-r--r--src/mbox-util.c20
-rw-r--r--src/mbox-util.h2
-rw-r--r--src/util.h10
-rw-r--r--src/w32-util.c39
-rw-r--r--tests/ChangeLog-20118
-rw-r--r--tests/gpg/Makefile.am12
-rw-r--r--tests/gpg/Makefile.in50
-rw-r--r--tests/gpg/geheim.txt2
-rw-r--r--tests/gpg/t-cancel.c272
-rw-r--r--tests/gpg/t-eventloop.c6
-rw-r--r--tests/gpg/t-sig-notation.c1
-rw-r--r--tests/gpgsm/t-decrypt.c14
138 files changed, 1986 insertions, 385 deletions
diff --git a/ChangeLog b/ChangeLog
index 239b3a3..1fefdbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,356 @@
+2016-10-18 Werner Koch <wk@gnupg.org>
+
+ 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.
+
+2016-10-14 Werner Koch <wk@gnupg.org>
+
+ tests: Make t-cancel more portable.
+ * tests/gpg/t-cancel.c: Include sys/time.h and protect sys/select.h.
+
+ python: Call ln(1) in a portable way.
+ * lang/python/Makefile.am: Specify target dir for ln.
+
+2016-10-14 Andre Heinecke <aheinecke@intevation.de>
+
+ cpp: Fix init of string from null.
+ * lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return
+ value before creating the string.
+
+2016-10-13 Justus Winter <justus@g10code.com>
+
+ 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.
+
+ 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
+
+ python: Fix example.
+ * lang/python/examples/inter-edit.py: Fix example.
+
+ Fixes-commit: a458e7fe
+
+2016-10-13 Andre Heinecke <aheinecke@intevation.de>
+
+ cpp: Fix version number.
+ * configure.ac (LIBGPGMEPP_LT_CURRENT): Bump.
+
+ qt, cpp: Fix permissions of Config files.
+ * lang/cpp/src/Makefile.am,
+ lang/qt/src/Makefile.am: Do not install config files as executable.
+
+ qt: Install SpecialJob.
+ * lang/qt/src/Makefile.am: Install SpecialJob
+ * NEWS: mention it.
+
+ 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-11 Daniel Vrátil <dvratil@kde.org>
+
+ 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.
+
+ qt: Install abstractimportjob.h.
+ * lang/cpp/src/Makefile.am: Install abstractimportjob.h since it's
+ included from importjob.h
+
+2016-10-11 Andre Heinecke <aheinecke@intevation.de>
+
+ 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-10 Andre Heinecke <aheinecke@intevation.de>
+
+ 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.
+
+ 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.
+
+ 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.
+
+ 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.
+
+ core: Fix w32 crash in find_program_in_dir.
+ * src/w32-util.c (find_program_in_dir): Fix call to _gpgme_strconcat.
+
+2016-10-08 Werner Koch <wk@gnupg.org>
+
+ 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.
+
+2016-10-06 Justus Winter <justus@g10code.com>
+
+ 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.
+
+2016-10-05 Andre Heinecke <aheinecke@intevation.de>
+
+ cpp: Bump Revision.
+ * configure.ac (LIBGPGMEPP_LT_REVISION): Bump revision.
+
+ 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.
+
+ 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.
+
+ Add warning flags for c++ compiler, too.
+ * configure.ac (CXXFLAGS): Add Wall and Wextra.
+
+ 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.
+
+ 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.
+
+ cpp: Fix gcc diagnostic push / pop.
+ * lang/cpp/src/context.cpp: Fix pragmas.
+
+ qt: Disable t-wkspublish test.
+ * lang/qt/tests/Makefile.am (TESTS): Remove t-wkspublish.
+
+2016-09-30 Alon Bar-Lev <alon.barlev@gmail.com>
+
+ 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.
+
+ python: Add 'prepare' target.
+ * lang/python/Makefile.am: Add 'prepare' target.
+
+2016-09-29 Andre Heinecke <aheinecke@intevation.de>
+
+ 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.
+
+2016-09-27 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+
+ 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.
+
+2016-09-27 Justus Winter <justus@g10code.com>
+
+ 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.
+
+2016-09-26 Justus Winter <justus@g10code.com>
+
+ python: Correctly translate to size_t.
+ * lang/python/gpgme.i: Correctly translate Python number to size_t.
+
+ python: Correctly translate off_t.
+ * lang/python/gpgme.i: Improve int/long translations, correctly handle
+ off_t with large file support.
+
+ 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.
+
+2016-09-23 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+
+ 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.
+
+ 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.
+
+2016-09-23 Andre Heinecke <aheinecke@intevation.de>
+
+ tests: Check data after decryption.
+ * tests/gpgsm/t-decrypt.c (main): Check data matches expected.
+ Only print result if it does not.
+
+ 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
+
+2016-09-22 Werner Koch <wk@gnupg.org>
+
+ w32: Silence some warnings about unused parameters.
+ * src/assuan-support.c (my_recvmsg, my_sendmsg, my_waitpid)
+ (my_socketpair) [W32]: Mark unused parameters.
+
+ core: Fix error checking in _gpgme_mkstemp.
+ * src/w32-util.c (_gpgme_mkstemp): Fix error checking.
+ (dlopen): Mark FLAGS as unused.
+
+ 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.
+
+2016-09-22 Daiki Ueno <ueno@gnu.org>
+
+ 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.
+
+ 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.
+
+ tests: Fix select usage in t-eventloop.
+ * tests/gpg/t-eventloop.c (do_select): Supply timeout value to select.
+
+ 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.
+
+2016-09-21 Andreas Stieger <astieger@suse.com>
+
+ 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
+
2016-09-21 Werner Koch <wk@gnupg.org>
Release 1.7.0.
diff --git a/NEWS b/NEWS
index e4966e8..e726c77 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,35 @@
-Noteworthy changes in version 1.7.0 (2016-09-21) [C26/A15/R0]
+Noteworthy changes in version 1.7.1 (2016-10-18)
+------------------------------------------------
+
+ * Fixed problems with the new language bindings.
+
+ * New helper function gpgme_addrspec_from_uid.
+
+ * Use option --exit-on-status-write-error with newer gpg versions.
+
+ * qt: Missed API from the Qt Binding inclusion has
+ been added again.
+
+ * qt: abstractimportjob.h is now installed to that
+ ImportJobs can be used again.
+
+ * qt: Fixed spelling error in API (startReceive).
+
+ * Interface changes relative to the 1.7.0 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_addrspec_from_uid NEW.
+ qt: WksPublishJob::startRecieve RENAMED to ::startReceive.
+ qt: MultiDeleteJob NEW.
+ qt: AbstractImportJob NEW.
+ qt: SpecialJob NEW.
+ cpp: Signature::key(bool, bool) NEW.
+ cpp: UserID::addrSpecFromString(const char*) NEW.
+ cpp: UserID::addrSpec() NEW.
+
+ [c=C27/A16/R0 cpp=C8/A2/R0 qt=C7/A0/R0]
+
+
+Noteworthy changes in version 1.7.0 (2016-09-21)
------------------------------------------------
* New language bindings for Python 2 and 3.
@@ -102,6 +133,8 @@ Noteworthy changes in version 1.7.0 (2016-09-21) [C26/A15/R0]
GPGME_KEYSIGN_LFSEP NEW.
GPGME_INTERACT_CARD NEW.
+ [c=C26/A15/R0 cpp=C6/A0/R1 qt=C6/A0/R1]
+
Noteworthy changes in version 1.6.0 (2015-08-26) [C25/A14/R0]
------------------------------------------------
diff --git a/THANKS b/THANKS
index 9d79004..e312775 100644
--- a/THANKS
+++ b/THANKS
@@ -5,7 +5,7 @@ want to thank them for their help. If we forgot you, please let us
know.
Adriaan de Groot adridg@cs.kun.nl
-Albrecht Dre albrecht.dress@arcor.de
+Albrecht Dreß albrecht.dress@arcor.de
Alfons Hoogervorst alfons@proteus.demon.nl
Daniel Mueller daniel@danm.de
Enno Cramer uebergeek@web.de
@@ -13,13 +13,13 @@ Frank Heckenbach frank@g-n-u.de
Igor Belyi gpgme@katehok.ac93.org
Jan-Oliver Wagner jan@intevation.de
Johannes Poehlmann jhp@caldera.de
-Jose C. Garca Sogo jose@jaimedelamo.eu.org
+Jose C. García Sogo jose@jaimedelamo.eu.org
Leo Gaspard ekleog@gmail.com
Mark Mutz mutz@kde.org
Miguel Coca mcoca@gnu.org
Noel Torres envite@rolamasao.org
Patrick Spendrin patrick.spendrin@kdab.com
-Stphane Corthsy stephane@sente.ch
+Stéphane Corthésy stephane@sente.ch
Timo Schulz twoaday@freakmail.de
Tommy Reynolds reynolds@redhat.com
W. Trevor King wking@tremily.us
diff --git a/VERSION b/VERSION
index bd8bf88..943f9cb 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.7.0
+1.7.1
diff --git a/configure b/configure
index bcfe006..c44a751 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gpgme 1.7.0.
+# Generated by GNU Autoconf 2.69 for gpgme 1.7.1.
#
# Report bugs to <http://bugs.gnupg.org>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gpgme'
PACKAGE_TARNAME='gpgme'
-PACKAGE_VERSION='1.7.0'
-PACKAGE_STRING='gpgme 1.7.0'
+PACKAGE_VERSION='1.7.1'
+PACKAGE_STRING='gpgme 1.7.1'
PACKAGE_BUGREPORT='http://bugs.gnupg.org'
PACKAGE_URL=''
@@ -1454,7 +1454,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gpgme 1.7.0 to adapt to many kinds of systems.
+\`configure' configures gpgme 1.7.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1524,7 +1524,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gpgme 1.7.0:";;
+ short | recursive ) echo "Configuration of gpgme 1.7.1:";;
esac
cat <<\_ACEOF
@@ -1672,7 +1672,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gpgme configure 1.7.0
+gpgme configure 1.7.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2502,7 +2502,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gpgme $as_me 1.7.0, which was
+It was created by gpgme $as_me 1.7.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2865,19 +2865,17 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=26
-# Subtract 2 from this value if you want to make the LFS transition an
-# ABI break. [Note to self: Remove this comment with the next regular break.]
-LIBGPGME_LT_AGE=15
+LIBGPGME_LT_CURRENT=27
+LIBGPGME_LT_AGE=16
LIBGPGME_LT_REVISION=0
-LIBGPGMEPP_LT_CURRENT=6
-LIBGPGMEPP_LT_AGE=0
-LIBGPGMEPP_LT_REVISION=1
+LIBGPGMEPP_LT_CURRENT=8
+LIBGPGMEPP_LT_AGE=2
+LIBGPGMEPP_LT_REVISION=0
-LIBQGPGME_LT_CURRENT=6
+LIBQGPGME_LT_CURRENT=7
LIBQGPGME_LT_AGE=0
-LIBQGPGME_LT_REVISION=1
+LIBQGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
@@ -3410,7 +3408,7 @@ fi
# Define the identity of the package.
PACKAGE='gpgme'
- VERSION='1.7.0'
+ VERSION='1.7.1'
cat >>confdefs.h <<_ACEOF
@@ -6320,7 +6318,7 @@ cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
-VERSION_NUMBER=0x010700
+VERSION_NUMBER=0x010701
# We need to compile and run a program on the build machine. A
@@ -20630,7 +20628,7 @@ ENABLED_LANGUAGES=$enabled_languages
#
# Provide information about the build.
#
-BUILD_REVISION="e7ab753"
+BUILD_REVISION="2c490cd"
cat >>confdefs.h <<_ACEOF
@@ -20639,7 +20637,7 @@ _ACEOF
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
-BUILD_FILEVERSION="${BUILD_FILEVERSION}59307"
+BUILD_FILEVERSION="${BUILD_FILEVERSION}11337"
# Check whether --enable-build-timestamp was given.
@@ -21167,6 +21165,7 @@ $as_echo "$_gcc_wopt" >&6; }
CFLAGS="$CFLAGS -Wno-missing-field-initializers"
CFLAGS="$CFLAGS -Wno-sign-compare"
fi
+ CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if gcc supports -Wpointer-arith" >&5
$as_echo_n "checking if gcc supports -Wpointer-arith... " >&6; }
@@ -22387,7 +22386,9 @@ if test -z "$HAVE_DOXYGEN_TRUE"; then :
fi
ac_config_files="$ac_config_files lang/qt/doc/Makefile"
-ac_config_files="$ac_config_files lang/python/Makefile lang/python/setup.py lang/python/pyme/version.py lang/python/tests/Makefile"
+ac_config_files="$ac_config_files lang/python/Makefile lang/python/pyme/version.py lang/python/tests/Makefile"
+
+ac_config_files="$ac_config_files lang/python/setup.py"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -22991,7 +22992,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gpgme $as_me 1.7.0, which was
+This file was extended by gpgme $as_me 1.7.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23057,7 +23058,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gpgme config.status 1.7.0
+gpgme config.status 1.7.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -23679,9 +23680,9 @@ do
"lang/qt/doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES lang/qt/doc/Doxyfile" ;;
"lang/qt/doc/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/doc/Makefile" ;;
"lang/python/Makefile") CONFIG_FILES="$CONFIG_FILES lang/python/Makefile" ;;
- "lang/python/setup.py") CONFIG_FILES="$CONFIG_FILES lang/python/setup.py" ;;
"lang/python/pyme/version.py") CONFIG_FILES="$CONFIG_FILES lang/python/pyme/version.py" ;;
"lang/python/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lang/python/tests/Makefile" ;;
+ "lang/python/setup.py") CONFIG_FILES="$CONFIG_FILES lang/python/setup.py" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -25324,6 +25325,7 @@ _LT_EOF
;;
"src/gpgme-config":F) chmod +x src/gpgme-config ;;
+ "lang/python/setup.py":F) chmod a+x lang/python/setup.py ;;
esac
done # for ac_tag
@@ -25366,7 +25368,7 @@ fi
echo "
GPGME v${VERSION} has been configured as follows:
- Revision: e7ab753 (59307)
+ Revision: 2c490cd (11337)
Platform: $host
UI Server: $uiserver
diff --git a/configure.ac b/configure.ac
index c9d16af..6580b7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ min_automake_version="1.14"
# for the LT versions.
m4_define(mym4_version_major, [1])
m4_define(mym4_version_minor, [7])
-m4_define(mym4_version_micro, [0])
+m4_define(mym4_version_micro, [1])
# Below is m4 magic to extract and compute the revision number, the
# decimalized short revision number, a beta version string, and a flag
@@ -55,19 +55,17 @@ AC_INIT([gpgme],[mym4_full_version],[http://bugs.gnupg.org])
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=26
-# Subtract 2 from this value if you want to make the LFS transition an
-# ABI break. [Note to self: Remove this comment with the next regular break.]
-LIBGPGME_LT_AGE=15
+LIBGPGME_LT_CURRENT=27
+LIBGPGME_LT_AGE=16
LIBGPGME_LT_REVISION=0
-LIBGPGMEPP_LT_CURRENT=6
-LIBGPGMEPP_LT_AGE=0
-LIBGPGMEPP_LT_REVISION=1
+LIBGPGMEPP_LT_CURRENT=8
+LIBGPGMEPP_LT_AGE=2
+LIBGPGMEPP_LT_REVISION=0
-LIBQGPGME_LT_CURRENT=6
+LIBQGPGME_LT_CURRENT=7
LIBQGPGME_LT_AGE=0
-LIBQGPGME_LT_REVISION=1
+LIBQGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
@@ -588,6 +586,7 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wno-missing-field-initializers"
CFLAGS="$CFLAGS -Wno-sign-compare"
fi
+ CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow"
AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
_gcc_cflags_save=$CFLAGS
@@ -886,9 +885,9 @@ AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])])
AC_CONFIG_FILES(lang/qt/doc/Makefile)
AC_CONFIG_FILES([lang/python/Makefile
- lang/python/setup.py
lang/python/pyme/version.py
lang/python/tests/Makefile])
+AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT
echo "
diff --git a/doc/ChangeLog-2011 b/doc/ChangeLog-2011
index d6ecca7..e270fae 100644
--- a/doc/ChangeLog-2011
+++ b/doc/ChangeLog-2011
@@ -397,7 +397,7 @@
(Listing Keys): Update examples.
(Decrypt): Result might also be available when operation failed.
(Verify): Result might also be available when operation failed.
- All spotted by Stphane Corthsy.
+ All spotted by Stéphane Corthésy.
2003-07-22 Marcus Brinkmann <marcus@g10code.de>
diff --git a/doc/gpgme.info b/doc/gpgme.info
index 2702f0a..8df2a71 100644
--- a/doc/gpgme.info
+++ b/doc/gpgme.info
@@ -19,8 +19,8 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.7.0-beta361, last updated 26 August 2015, of ‘The
-‘GnuPG Made Easy’ Reference Manual’, for Version 1.7.0-beta361.
+ This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.7.1.
Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
@@ -37,128 +37,128 @@ Public License for more details.

Indirect:
-gpgme.info-1: 1686
-gpgme.info-2: 304664
+gpgme.info-1: 1670
+gpgme.info-2: 305786

Tag Table:
(Indirect)
-Node: Top1686
-Node: Introduction9093
-Node: Getting Started9883
-Node: Features11344
-Node: Overview12656
-Node: Preparation13765
-Node: Header14762
-Node: Building the Source15509
-Node: Largefile Support (LFS)17919
-Node: Using Automake23333
-Node: Using Libtool25779
-Node: Library Version Check26141
-Node: Signal Handling32153
-Node: Multi Threading33423
-Ref: Multi Threading-Footnote-135657
-Node: Protocols and Engines36080
-Node: Engine Version Check38725
-Node: Engine Information41142
-Node: Engine Configuration45002
-Node: OpenPGP46286
-Node: Cryptographic Message Syntax46626
-Node: Assuan46939
-Node: Algorithms47313
-Ref: Algorithms-Footnote-147792
-Node: Public Key Algorithms47920
-Node: Hash Algorithms50407
-Node: Error Handling51597
-Node: Error Values53471
-Node: Error Sources58674
-Node: Error Codes61114
-Node: Error Strings65905
-Node: Exchanging Data67712
-Node: Creating Data Buffers69578
-Node: Memory Based Data Buffers70094
-Node: File Based Data Buffers73527
-Node: Callback Based Data Buffers75729
-Node: Destroying Data Buffers79920
-Node: Manipulating Data Buffers81408
-Node: Data Buffer I/O Operations81900
-Node: Data Buffer Meta-Data84273
-Node: Data Buffer Convenience88639
-Node: Contexts90616
-Node: Creating Contexts91802
-Node: Destroying Contexts92649
-Node: Result Management92988
-Node: Context Attributes94417
-Node: Protocol Selection95385
-Node: Crypto Engine96417
-Node: ASCII Armor98260
-Node: Text Mode98884
-Node: Offline Mode99818
-Node: Pinentry Mode100890
-Node: Included Certificates102575
-Node: Key Listing Mode103997
-Node: Passphrase Callback108089
-Node: Progress Meter Callback111474
-Node: Status Message Callback113459
-Node: Locale116077
-Node: Key Management117636
-Node: Key objects118864
-Node: Listing Keys129864
-Node: Information About Keys137310
-Node: Manipulating Keys138618
-Node: Generating Keys139188
-Node: Signing Keys154662
-Node: Exporting Keys158260
-Node: Importing Keys164953
-Ref: Importing Keys-Footnote-1171858
-Node: Deleting Keys171986
-Node: Changing Passphrases173431
-Node: Changing TOFU Data174720
-Node: Advanced Key Editing176771
-Node: Trust Item Management179420
-Node: Listing Trust Items180456
-Node: Manipulating Trust Items182817
-Node: Crypto Operations183460
-Node: Decrypt184724
-Node: Verify188594
-Node: Decrypt and Verify200554
-Node: Sign202622
-Node: Selecting Signers203186
-Node: Creating a Signature204573
-Node: Signature Notation Data209343
-Node: Encrypt211571
-Node: Encrypting a Plaintext211927
-Node: Miscellaneous218890
-Node: Running other Programs219236
-Node: Using the Assuan protocol221312
-Node: Run Control224005
-Node: Waiting For Completion224749
-Node: Using External Event Loops226867
-Node: I/O Callback Interface228839
-Node: Registering I/O Callbacks234077
-Node: I/O Callback Example236115
-Node: I/O Callback Example GTK+242332
-Node: I/O Callback Example GDK244121
-Node: I/O Callback Example Qt245763
-Node: Cancellation248051
-Node: UI Server Protocol250315
-Ref: UI Server Protocol-Footnote-1251750
-Node: UI Server Encrypt251869
-Node: UI Server Sign257014
-Node: UI Server Decrypt259367
-Node: UI Server Verify260833
-Node: UI Server Set Input Files264405
-Node: UI Server Sign/Encrypt Files265475
-Node: UI Server Verify/Decrypt Files267283
-Node: UI Server Import/Export Keys269159
-Node: UI Server Checksum Files270221
-Node: Miscellaneous UI Server Commands272437
-Ref: command SENDER274368
-Node: Debugging276070
-Node: Deprecated Functions277819
-Node: Library Copying304664
-Node: Copying332880
-Node: Concept Index370626
-Node: Function and Data Index385186
+Node: Top1670
+Node: Introduction9061
+Node: Getting Started9851
+Node: Features11312
+Node: Overview12624
+Node: Preparation13733
+Node: Header14730
+Node: Building the Source15477
+Node: Largefile Support (LFS)17887
+Node: Using Automake23301
+Node: Using Libtool25747
+Node: Library Version Check26109
+Node: Signal Handling32121
+Node: Multi Threading33391
+Ref: Multi Threading-Footnote-135625
+Node: Protocols and Engines36048
+Node: Engine Version Check38693
+Node: Engine Information41110
+Node: Engine Configuration44970
+Node: OpenPGP46254
+Node: Cryptographic Message Syntax46594
+Node: Assuan46907
+Node: Algorithms47281
+Ref: Algorithms-Footnote-147760
+Node: Public Key Algorithms47888
+Node: Hash Algorithms50375
+Node: Error Handling51565
+Node: Error Values53439
+Node: Error Sources58642
+Node: Error Codes61082
+Node: Error Strings65873
+Node: Exchanging Data67680
+Node: Creating Data Buffers69546
+Node: Memory Based Data Buffers70062
+Node: File Based Data Buffers73495
+Node: Callback Based Data Buffers75697
+Node: Destroying Data Buffers79888
+Node: Manipulating Data Buffers81376
+Node: Data Buffer I/O Operations81868
+Node: Data Buffer Meta-Data84241
+Node: Data Buffer Convenience88607
+Node: Contexts90584
+Node: Creating Contexts91770
+Node: Destroying Contexts92617
+Node: Result Management92956
+Node: Context Attributes94385
+Node: Protocol Selection95353
+Node: Crypto Engine96385
+Node: ASCII Armor98228
+Node: Text Mode98852
+Node: Offline Mode99786
+Node: Pinentry Mode100858
+Node: Included Certificates102543
+Node: Key Listing Mode103965
+Node: Passphrase Callback108057
+Node: Progress Meter Callback111442
+Node: Status Message Callback113427
+Node: Locale116045
+Node: Key Management117604
+Node: Key objects118832
+Node: Listing Keys129832
+Node: Information About Keys137278
+Node: Manipulating Keys138586
+Node: Generating Keys139156
+Node: Signing Keys154630
+Node: Exporting Keys158228
+Node: Importing Keys164921
+Ref: Importing Keys-Footnote-1171826
+Node: Deleting Keys171954
+Node: Changing Passphrases173399
+Node: Changing TOFU Data174688
+Node: Advanced Key Editing176739
+Node: Trust Item Management179388
+Node: Listing Trust Items180424
+Node: Manipulating Trust Items182785
+Node: Crypto Operations183428
+Node: Decrypt184692
+Node: Verify188562
+Node: Decrypt and Verify200522
+Node: Sign203352
+Node: Selecting Signers203916
+Node: Creating a Signature205303
+Node: Signature Notation Data210073
+Node: Encrypt212301
+Node: Encrypting a Plaintext212657
+Node: Miscellaneous219620
+Node: Running other Programs219966
+Node: Using the Assuan protocol222042
+Node: Run Control224735
+Node: Waiting For Completion225479
+Node: Using External Event Loops227597
+Node: I/O Callback Interface229569
+Node: Registering I/O Callbacks234807
+Node: I/O Callback Example236845
+Node: I/O Callback Example GTK+243470
+Node: I/O Callback Example GDK245259
+Node: I/O Callback Example Qt246901
+Node: Cancellation249189
+Node: UI Server Protocol251453
+Ref: UI Server Protocol-Footnote-1252888
+Node: UI Server Encrypt253007
+Node: UI Server Sign258152
+Node: UI Server Decrypt260505
+Node: UI Server Verify261971
+Node: UI Server Set Input Files265543
+Node: UI Server Sign/Encrypt Files266613
+Node: UI Server Verify/Decrypt Files268421
+Node: UI Server Import/Export Keys270297
+Node: UI Server Checksum Files271359
+Node: Miscellaneous UI Server Commands273575
+Ref: command SENDER275506
+Node: Debugging277208
+Node: Deprecated Functions278957
+Node: Library Copying305786
+Node: Copying334002
+Node: Concept Index371748
+Node: Function and Data Index386308

End Tag Table
diff --git a/doc/gpgme.info-1 b/doc/gpgme.info-1
index 839678b..f7503b3 100644
--- a/doc/gpgme.info-1
+++ b/doc/gpgme.info-1
@@ -19,8 +19,8 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.7.0-beta361, last updated 26 August 2015, of ‘The
-‘GnuPG Made Easy’ Reference Manual’, for Version 1.7.0-beta361.
+ This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.7.1.
Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
@@ -41,9 +41,8 @@ File: gpgme.info, Node: Top, Next: Introduction, Up: (dir)
Main Menu
*********
-This is Edition 1.7.0-beta361, last updated 26 August 2015, of ‘The
-‘GnuPG Made Easy’ Reference Manual’, for Version 1.7.0-beta361 of the
-GPGME library.
+This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG Made
+Easy’ Reference Manual’, for Version 1.7.1 of the GPGME library.
* Menu:
@@ -4694,6 +4693,21 @@ File: gpgme.info, Node: Decrypt and Verify, Next: Sign, Prev: Verify, Up: Cr
CTX, CIPHER, PLAIN or R_STAT is not a valid pointer, and
‘GPG_ERR_NO_DATA’ if CIPHER does not contain any data to decrypt.
+ When processing mails it is sometimes useful to extract the actual
+mail address (the “addr-spec”) from a string. GPGME provides this
+helper function which uses the same semantics as the internal functions
+in GPGME and GnuPG:
+
+ -- Function: char * gpgme_addrspec_from_uid (const char *UID)
+
+ Return the mail address (called “addr-spec” in RFC-5322) from the
+ string UID which is assumed to be a user id (called “address” in
+ RFC-5322). All plain ASCII characters (i.e. those with bit 7
+ cleared) in the result are converted to lowercase. Caller must
+ free the result using ‘gpgme_free’. Returns ‘NULL’ if no valid
+ address was found (in which case ‘ERRNO’ is set to ‘EINVAL’) or for
+ other errors.
+

File: gpgme.info, Node: Sign, Next: Encrypt, Prev: Decrypt and Verify, Up: Crypto Operations
@@ -5550,6 +5564,7 @@ next. We only support waiting for the success of a single operation.
fd_set wfds;
int i, n;
int any = 0;
+ struct timeval tv;
struct one_fd *fdlist = loop->fds;
pthread_mutex_lock (&loop->lock);
@@ -5558,11 +5573,14 @@ next. We only support waiting for the success of a single operation.
for (i = 0; i < MAX_FDS; i++)
if (fdlist[i].fd != -1)
FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds);
- pthread_mutex_unlock (&loop->unlock);
+ pthread_mutex_unlock (&loop->lock);
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000;
do
{
- n = select (FD_SETSIZE, &rfds, &wfds, NULL, 0);
+ n = select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
}
while (n < 0 && errno == EINTR);
@@ -5614,6 +5632,7 @@ next. We only support waiting for the success of a single operation.
gpgme_error_t err;
gpgme_data_t sig, text;
int i;
+ pthread_mutexattr_t attr;
struct gpgme_io_cbs io_cbs =
{
add_io_cb,
@@ -5623,12 +5642,19 @@ next. We only support waiting for the success of a single operation.
&result
};
- init_gpgme (void);
+ init_gpgme ();
/* Initialize the loop structure. */
- pthread_mutex_init (&loop.lock, NULL);
+
+ /* The mutex must be recursive, since remove_io_cb (which acquires a
+ lock) can be called while holding a lock acquired in do_select. */
+ pthread_mutexattr_init (&attr);
+ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init (&loop.lock, &attr);
+ pthread_mutexattr_destroy (&attr);
+
for (i = 0; i < MAX_FDS; i++)
- loop->fds[i].fd = -1;
+ loop.fds[i].fd = -1;
/* Initialize the result structure. */
result.done = 0;
diff --git a/doc/gpgme.info-2 b/doc/gpgme.info-2
index 1fdd935..23f874c 100644
--- a/doc/gpgme.info-2
+++ b/doc/gpgme.info-2
@@ -19,8 +19,8 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.7.0-beta361, last updated 26 August 2015, of ‘The
-‘GnuPG Made Easy’ Reference Manual’, for Version 1.7.0-beta361.
+ This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.7.1.
Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
@@ -1530,6 +1530,7 @@ Function and Data Index
(line 9)
* GETINFO: Miscellaneous UI Server Commands.
(line 9)
+* gpgme_addrspec_from_uid: Decrypt and Verify. (line 47)
* gpgme_attr_t: Deprecated Functions.
(line 136)
* gpgme_attr_t <1>: Deprecated Functions.
diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index ec7ebb7..cc59888 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -5109,6 +5109,23 @@ pointer, and @code{GPG_ERR_NO_DATA} if @var{cipher} does not contain
any data to decrypt.
@end deftypefun
+When processing mails it is sometimes useful to extract the actual
+mail address (the ``addr-spec'') from a string. GPGME provides this
+helper function which uses the same semantics as the internal
+functions in GPGME and GnuPG:
+
+@deftypefun @w{char *} gpgme_addrspec_from_uid (@w{const char *@var{uid}})
+
+Return the mail address (called ``addr-spec'' in RFC-5322) from the
+string @var{uid} which is assumed to be a user id (called ``address''
+in RFC-5322). All plain ASCII characters (i.e. those with bit 7
+cleared) in the result are converted to lowercase. Caller must free
+the result using @code{gpgme_free}. Returns @code{NULL} if no valid
+address was found (in which case @code{ERRNO} is set to @code{EINVAL})
+or for other errors.
+
+@end deftypefun
+
@node Sign
@subsection Sign
@@ -6016,6 +6033,7 @@ do_select (struct event_loop *loop)
fd_set wfds;
int i, n;
int any = 0;
+ struct timeval tv;
struct one_fd *fdlist = loop->fds;
pthread_mutex_lock (&loop->lock);
@@ -6024,11 +6042,14 @@ do_select (struct event_loop *loop)
for (i = 0; i < MAX_FDS; i++)
if (fdlist[i].fd != -1)
FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds);
- pthread_mutex_unlock (&loop->unlock);
+ pthread_mutex_unlock (&loop->lock);
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000;
do
@{
- n = select (FD_SETSIZE, &rfds, &wfds, NULL, 0);
+ n = select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
@}
while (n < 0 && errno == EINTR);
@@ -6082,6 +6103,7 @@ main (int argc, char *argv[])
gpgme_error_t err;
gpgme_data_t sig, text;
int i;
+ pthread_mutexattr_t attr;
struct gpgme_io_cbs io_cbs =
@{
add_io_cb,
@@ -6091,12 +6113,19 @@ main (int argc, char *argv[])
&result
@};
- init_gpgme (void);
+ init_gpgme ();
/* Initialize the loop structure. */
- pthread_mutex_init (&loop.lock, NULL);
+
+ /* The mutex must be recursive, since remove_io_cb (which acquires a
+ lock) can be called while holding a lock acquired in do_select. */
+ pthread_mutexattr_init (&attr);
+ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init (&loop.lock, &attr);
+ pthread_mutexattr_destroy (&attr);
+
for (i = 0; i < MAX_FDS; i++)
- loop->fds[i].fd = -1;
+ loop.fds[i].fd = -1;
/* Initialize the result structure. */
result.done = 0;
diff --git a/gpgme.spec b/gpgme.spec
index 7a269c6..e9e8c5f 100644
--- a/gpgme.spec
+++ b/gpgme.spec
@@ -1,7 +1,7 @@
# This is a template. The dist target uses it to create the real file.
Summary: GPGME - GnuPG Made Easy
Name: gpgme
-Version: 1.7.0
+Version: 1.7.1
Release: 1
URL: http://www.gnupg.org/gpgme.html
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
diff --git a/lang/cl/gpgme.asd b/lang/cl/gpgme.asd
index c192da7..bd195e5 100644
--- a/lang/cl/gpgme.asd
+++ b/lang/cl/gpgme.asd
@@ -27,7 +27,7 @@
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.7.0"
+ :version "1.7.1"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in
index d54011e..73f5eaa 100644
--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in
+++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in
@@ -37,7 +37,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
-foreach(_expectedTarget KF5::Gpgmepp Gpgmepp)
+foreach(_expectedTarget Gpgmepp)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
@@ -58,17 +58,11 @@ unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
-# Compute the installation prefix relative to this file.
-get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-
# Create imported target Gpgmepp
add_library(Gpgmepp SHARED IMPORTED)
set_target_properties(Gpgmepp PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/gpgme++"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@"
)
@@ -77,9 +71,6 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
endif()
-# Cleanup temporary variables.
-set(_IMPORT_PREFIX)
-
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am
index e65a875..342bdf8 100644
--- a/lang/cpp/src/Makefile.am
+++ b/lang/cpp/src/Makefile.am
@@ -76,15 +76,15 @@ libsuffix=.so
endif
GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) GpgmeppConfig.cmake \
+ $(INSTALL) -m 644 GpgmeppConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfig.cmake
- $(INSTALL) GpgmeppConfigVersion.cmake \
+ $(INSTALL) -m 644 GpgmeppConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/cpp/src/Makefile.in b/lang/cpp/src/Makefile.in
index 9237d27..6be45d1 100644
--- a/lang/cpp/src/Makefile.in
+++ b/lang/cpp/src/Makefile.in
@@ -930,15 +930,15 @@ uninstall-am: uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) GpgmeppConfig.cmake \
+ $(INSTALL) -m 644 GpgmeppConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfig.cmake
- $(INSTALL) GpgmeppConfigVersion.cmake \
+ $(INSTALL) -m 644 GpgmeppConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/cpp/src/callbacks.cpp b/lang/cpp/src/callbacks.cpp
index 4b4dd80..3631c53 100644
--- a/lang/cpp/src/callbacks.cpp
+++ b/lang/cpp/src/callbacks.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "callbacks.h"
#include "util.h"
diff --git a/lang/cpp/src/configuration.cpp b/lang/cpp/src/configuration.cpp
index 7ef2883..293746a 100644
--- a/lang/cpp/src/configuration.cpp
+++ b/lang/cpp/src/configuration.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "configuration.h"
#include "error.h"
#include "util.h"
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 00f397b..1121104 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <context.h>
#include <eventloopinteractor.h>
#include <trustitem.h>
@@ -695,7 +699,7 @@ Error Context::startPasswd(const Key &key)
}
-#pragma GCC push_diagnostics
+#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Error Context::edit(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
@@ -755,7 +759,7 @@ Error Context::startCardEditing(const Key &key, std::unique_ptr<EditInteractor>
dp ? dp->data : 0));
}
-#pragma GCC pop_diagnostics
+#pragma GCC diagnostic pop
EditInteractor *Context::lastCardEditInteractor() const
{
@@ -1051,6 +1055,7 @@ const char *Context::signaturePolicyURL() const
return n->value;
}
}
+ return nullptr;
}
Notation Context::signatureNotation(unsigned int idx) const
@@ -1344,6 +1349,7 @@ static gpgme_tofu_policy_t to_tofu_policy_t(unsigned int policy)
case TofuInfo::PolicyAsk:
return GPGME_TOFU_POLICY_ASK;
case TofuInfo::PolicyUnknown:
+ default:
return GPGME_TOFU_POLICY_UNKNOWN;
}
}
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index b1e4f5f..ab15a21 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -364,8 +364,8 @@ public:
* @param file The executable to start.
* @param argv list of arguments file should be argv[0].
* @param input The data to be sent through stdin.
- * @param output The data to be recieve the stdout.
- * @param err The data to recieve stderr.
+ * @param output The data to be receive the stdout.
+ * @param err The data to receive stderr.
* @param flags Additional flags.
*
* @returns An error or empty error.
diff --git a/lang/cpp/src/context_vanilla.cpp b/lang/cpp/src/context_vanilla.cpp
index 984d41b..77a488a 100644
--- a/lang/cpp/src/context_vanilla.cpp
+++ b/lang/cpp/src/context_vanilla.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <global.h>
GIOChannel *GpgME::getGIOChannel(int)
diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp
index 9527b2f..2cb4fa8 100644
--- a/lang/cpp/src/data.cpp
+++ b/lang/cpp/src/data.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "data_p.h"
#include <error.h>
#include <interfaces/dataprovider.h>
@@ -157,6 +161,9 @@ GpgME::Data::Encoding GpgME::Data::encoding() const
case GPGME_DATA_ENCODING_BASE64: return Base64Encoding;
case GPGME_DATA_ENCODING_ARMOR: return ArmorEncoding;
case GPGME_DATA_ENCODING_MIME: return MimeEncoding;
+ case GPGME_DATA_ENCODING_URL: return UrlEncoding;
+ case GPGME_DATA_ENCODING_URLESC: return UrlEscEncoding;
+ case GPGME_DATA_ENCODING_URL0: return Url0Encoding;
}
return AutoEncoding;
}
@@ -170,6 +177,9 @@ GpgME::Error GpgME::Data::setEncoding(Encoding enc)
case Base64Encoding: ge = GPGME_DATA_ENCODING_BASE64; break;
case ArmorEncoding: ge = GPGME_DATA_ENCODING_ARMOR; break;
case MimeEncoding: ge = GPGME_DATA_ENCODING_MIME; break;
+ case UrlEncoding: ge = GPGME_DATA_ENCODING_URL; break;
+ case UrlEscEncoding: ge = GPGME_DATA_ENCODING_URLESC; break;
+ case Url0Encoding: ge = GPGME_DATA_ENCODING_URL0; break;
}
return Error(gpgme_data_set_encoding(d->data, ge));
}
diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h
index b2f2173..50bdf62 100644
--- a/lang/cpp/src/data.h
+++ b/lang/cpp/src/data.h
@@ -78,7 +78,10 @@ public:
BinaryEncoding,
Base64Encoding,
ArmorEncoding,
- MimeEncoding
+ MimeEncoding,
+ UrlEncoding,
+ UrlEscEncoding,
+ Url0Encoding,
};
Encoding encoding() const;
Error setEncoding(Encoding encoding);
diff --git a/lang/cpp/src/decryptionresult.cpp b/lang/cpp/src/decryptionresult.cpp
index 78a2b1b..f59d24c 100644
--- a/lang/cpp/src/decryptionresult.cpp
+++ b/lang/cpp/src/decryptionresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <decryptionresult.h>
#include "result_p.h"
#include "util.h"
diff --git a/lang/cpp/src/defaultassuantransaction.cpp b/lang/cpp/src/defaultassuantransaction.cpp
index 5bcf970..549092d 100644
--- a/lang/cpp/src/defaultassuantransaction.cpp
+++ b/lang/cpp/src/defaultassuantransaction.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "defaultassuantransaction.h"
#include "error.h"
#include "data.h"
diff --git a/lang/cpp/src/editinteractor.cpp b/lang/cpp/src/editinteractor.cpp
index 07dc26d..31591fa 100644
--- a/lang/cpp/src/editinteractor.cpp
+++ b/lang/cpp/src/editinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "editinteractor.h"
#include "callbacks.h"
#include "error.h"
diff --git a/lang/cpp/src/encryptionresult.cpp b/lang/cpp/src/encryptionresult.cpp
index c4e7df5..b4298d7 100644
--- a/lang/cpp/src/encryptionresult.cpp
+++ b/lang/cpp/src/encryptionresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <encryptionresult.h>
#include "result_p.h"
#include "util.h"
diff --git a/lang/cpp/src/engineinfo.cpp b/lang/cpp/src/engineinfo.cpp
index c3b3e04..763aab9 100644
--- a/lang/cpp/src/engineinfo.cpp
+++ b/lang/cpp/src/engineinfo.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "engineinfo.h"
#include <gpgme.h>
diff --git a/lang/cpp/src/eventloopinteractor.cpp b/lang/cpp/src/eventloopinteractor.cpp
index 7ec258c..7faa50c 100644
--- a/lang/cpp/src/eventloopinteractor.cpp
+++ b/lang/cpp/src/eventloopinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <eventloopinteractor.h>
#include <context.h>
diff --git a/lang/cpp/src/exception.cpp b/lang/cpp/src/exception.cpp
index c687024..cf42f91 100644
--- a/lang/cpp/src/exception.cpp
+++ b/lang/cpp/src/exception.cpp
@@ -21,6 +21,10 @@
*/
// -*- c++ -*-
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "exception.h"
#include <gpgme.h>
diff --git a/lang/cpp/src/gpgadduserideditinteractor.cpp b/lang/cpp/src/gpgadduserideditinteractor.cpp
index 43c8592..f7851a5 100644
--- a/lang/cpp/src/gpgadduserideditinteractor.cpp
+++ b/lang/cpp/src/gpgadduserideditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgadduserideditinteractor.h"
#include "error.h"
diff --git a/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp b/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
index 4739aa2..4b30b31 100644
--- a/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
+++ b/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgagentgetinfoassuantransaction.h"
#include "error.h"
#include "data.h"
diff --git a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
index 8af897c..5e8ba80 100644
--- a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
+++ b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgsetexpirytimeeditinteractor.h"
#include "error.h"
diff --git a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
index 15b1269..581605f 100644
--- a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
+++ b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgsetownertrusteditinteractor.h"
#include "error.h"
diff --git a/lang/cpp/src/gpgsignkeyeditinteractor.cpp b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
index fded90f..7effc64 100644
--- a/lang/cpp/src/gpgsignkeyeditinteractor.cpp
+++ b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgsignkeyeditinteractor.h"
#include "error.h"
#include "key.h"
diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
index 97e8239..4329fc0 100644
--- a/lang/cpp/src/importresult.cpp
+++ b/lang/cpp/src/importresult.cpp
@@ -21,6 +21,10 @@
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <importresult.h>
#include "result_p.h"
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index cfa1ba3..235a3c8 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <key.h>
#include "util.h"
@@ -29,6 +33,7 @@
#include <gpgme.h>
#include <string.h>
+#include <strings.h>
#include <istream>
#include <iterator>
@@ -273,6 +278,7 @@ const char *Key::primaryFingerprint() const
/* Return the first subkeys fingerprint */
return key->subkeys->fpr;
}
+ return nullptr;
}
unsigned int Key::keyListMode() const
@@ -872,6 +878,25 @@ const char *UserID::Signature::policyURL() const
return 0;
}
+std::string UserID::addrSpecFromString(const char *userid)
+{
+ if (!userid) {
+ return std::string();
+ }
+ char *normalized = gpgme_addrspec_from_uid (userid);
+ if (normalized) {
+ std::string ret(normalized);
+ gpgme_free(normalized);
+ return ret;
+ }
+ return std::string();
+}
+
+std::string UserID::addrSpec() const
+{
+ return addrSpecFromString(email());
+}
+
std::ostream &operator<<(std::ostream &os, const UserID &uid)
{
os << "GpgME::UserID(";
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index f193093..3f596a8 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -320,6 +320,21 @@ public:
* @returns The TOFU stats or a null TofuInfo.
*/
GpgME::TofuInfo tofuInfo() const;
+
+ /*! Wrapper around gpgme_addrspec_from_uid.
+ *
+ * The input string should match the format of
+ * a user id string.
+ *
+ * @returns a normalized mail address if found
+ * or an empty string. */
+ static std::string addrSpecFromString(const char *uid);
+
+ /*! Wrapper around gpgme_addrspec_from_uid.
+ *
+ * @returns a normalized mail address for this userid
+ * or an empty string. */
+ std::string addrSpec() const;
private:
shared_gpgme_key_t key;
gpgme_user_id_t uid;
diff --git a/lang/cpp/src/keygenerationresult.cpp b/lang/cpp/src/keygenerationresult.cpp
index 7837e20..52d5222 100644
--- a/lang/cpp/src/keygenerationresult.cpp
+++ b/lang/cpp/src/keygenerationresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <keygenerationresult.h>
#include "result_p.h"
diff --git a/lang/cpp/src/keylistresult.cpp b/lang/cpp/src/keylistresult.cpp
index 4512d3b..e6fb77f 100644
--- a/lang/cpp/src/keylistresult.cpp
+++ b/lang/cpp/src/keylistresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <keylistresult.h>
#include "result_p.h"
diff --git a/lang/cpp/src/scdgetinfoassuantransaction.cpp b/lang/cpp/src/scdgetinfoassuantransaction.cpp
index 073d772..fb59bcc 100644
--- a/lang/cpp/src/scdgetinfoassuantransaction.cpp
+++ b/lang/cpp/src/scdgetinfoassuantransaction.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "scdgetinfoassuantransaction.h"
#include "error.h"
#include "data.h"
diff --git a/lang/cpp/src/signingresult.cpp b/lang/cpp/src/signingresult.cpp
index 4f2ef72..3252c03 100644
--- a/lang/cpp/src/signingresult.cpp
+++ b/lang/cpp/src/signingresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <signingresult.h>
#include "result_p.h"
#include "util.h"
diff --git a/lang/cpp/src/tofuinfo.cpp b/lang/cpp/src/tofuinfo.cpp
index bb67fc8..a10a3cb 100644
--- a/lang/cpp/src/tofuinfo.cpp
+++ b/lang/cpp/src/tofuinfo.cpp
@@ -19,6 +19,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "tofuinfo.h"
#include <istream>
@@ -109,6 +113,7 @@ GpgME::TofuInfo::Policy GpgME::TofuInfo::policy() const
case GPGME_TOFU_POLICY_ASK:
return PolicyAsk;
case GPGME_TOFU_POLICY_UNKNOWN:
+ default:
return PolicyUnknown;
}
}
diff --git a/lang/cpp/src/trustitem.cpp b/lang/cpp/src/trustitem.cpp
index fc7e4a6..0565030 100644
--- a/lang/cpp/src/trustitem.cpp
+++ b/lang/cpp/src/trustitem.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <trustitem.h>
#include <gpgme.h>
diff --git a/lang/cpp/src/verificationresult.cpp b/lang/cpp/src/verificationresult.cpp
index c62625d..23c458e 100644
--- a/lang/cpp/src/verificationresult.cpp
+++ b/lang/cpp/src/verificationresult.cpp
@@ -20,11 +20,16 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <verificationresult.h>
#include <notation.h>
#include "result_p.h"
#include "util.h"
#include "key.h"
+#include "context.h"
#include <gpgme.h>
@@ -68,6 +73,8 @@ public:
// copy keys
if (scopy->key) {
keys.push_back(Key(scopy->key, true));
+ } else {
+ keys.push_back(Key());
}
// copy notations:
nota.push_back(std::vector<Nota>());
@@ -115,6 +122,7 @@ public:
std::vector<GpgME::Key> keys;
std::vector<char *> purls;
std::string file_name;
+ Protocol proto;
};
GpgME::VerificationResult::VerificationResult(gpgme_ctx_t ctx, int error)
@@ -139,6 +147,10 @@ void GpgME::VerificationResult::init(gpgme_ctx_t ctx)
return;
}
d.reset(new Private(res));
+ gpgme_protocol_t proto = gpgme_get_protocol(ctx);
+ d->proto = proto == GPGME_PROTOCOL_OpenPGP ? OpenPGP :
+ proto == GPGME_PROTOCOL_CMS ? CMS :
+ UnknownProtocol;
}
make_standard_stuff(VerificationResult)
@@ -380,6 +392,32 @@ GpgME::Key GpgME::Signature::key() const
return d->keys[idx];
}
+GpgME::Key GpgME::Signature::key(bool search, bool update) const
+{
+ if (isNull()) {
+ return Key();
+ }
+
+ GpgME::Key ret = key();
+ if (ret.isNull() && search) {
+ auto ctx = Context::createForProtocol (d->proto);
+ if (ctx) {
+ ctx->setKeyListMode(KeyListMode::Local |
+ KeyListMode::Signatures |
+ KeyListMode::SignatureNotations |
+ KeyListMode::Validate |
+ KeyListMode::WithTofu);
+ Error e;
+ ret = d->keys[idx] = ctx->key(fingerprint(), e, false);
+ delete ctx;
+ }
+ }
+ if (update) {
+ ret.update();
+ }
+ return ret;
+}
+
class GpgME::Notation::Private
{
public:
diff --git a/lang/cpp/src/verificationresult.h b/lang/cpp/src/verificationresult.h
index 93288af..b6d1d8c 100644
--- a/lang/cpp/src/verificationresult.h
+++ b/lang/cpp/src/verificationresult.h
@@ -163,6 +163,27 @@ public:
* set or the associated TOFU Information if applicable. */
GpgME::Key key() const;
+ /* Search / Update the key of this signature.
+ *
+ * Same as above but if search is set to true this will
+ * either update the key provided by the engine or search
+ * the key in the engine. The key is cached.
+ *
+ * As this involves an engine call it might take some time
+ * to finish so it should be avoided to do this in a UI
+ * thread. The result will be cached and no engine call
+ * will be done if update is set to false and a key is
+ * already cached.
+ *
+ * If no key was provided by the engine this will look
+ * up the key so this call might block while the engine
+ * is called to obtain the key.
+ *
+ * If both search and update are false this is the same
+ * as calling key()
+ */
+ GpgME::Key key(bool search, bool update) const;
+
private:
std::shared_ptr<VerificationResult::Private> d;
unsigned int idx;
diff --git a/lang/cpp/src/vfsmountresult.cpp b/lang/cpp/src/vfsmountresult.cpp
index c9fdd5e..d3607d1 100644
--- a/lang/cpp/src/vfsmountresult.cpp
+++ b/lang/cpp/src/vfsmountresult.cpp
@@ -21,6 +21,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <vfsmountresult.h>
#include "result_p.h"
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 2271ce0..224a91a 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -46,24 +46,33 @@ COPY_FILES_PYME = \
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME)
+copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
cp -R $(COPY_FILES_PYME) pyme ; \
fi
touch $@
+data.h:
+ ln -s "$(top_srcdir)/src/data.h" .
+
+config.h:
+ ln -s "$(top_builddir)/config.h" .
+
all-local: copystamp
for PYTHON in $(PYTHONS); do \
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$$PYTHON setup.py build --verbose ; \
done
dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+.PHONY: prepare
+prepare: copystamp
+
.PHONY: sdist
sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
@@ -72,7 +81,7 @@ upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
twine upload $^
CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
- copystamp
+ data.h config.h copystamp
# Remove the rest.
#
diff --git a/lang/python/Makefile.in b/lang/python/Makefile.in
index 6e6cfe6..08b26e0 100644
--- a/lang/python/Makefile.in
+++ b/lang/python/Makefile.in
@@ -418,7 +418,7 @@ COPY_FILES_PYME = \
$(srcdir)/pyme/util.py
CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
- copystamp
+ data.h config.h copystamp
all: all-recursive
@@ -737,24 +737,33 @@ uninstall-am: uninstall-local
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME)
+copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
cp -R $(COPY_FILES_PYME) pyme ; \
fi
touch $@
+data.h:
+ ln -s "$(top_srcdir)/src/data.h" .
+
+config.h:
+ ln -s "$(top_builddir)/config.h" .
+
all-local: copystamp
for PYTHON in $(PYTHONS); do \
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$$PYTHON setup.py build --verbose ; \
done
dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+.PHONY: prepare
+prepare: copystamp
+
.PHONY: sdist
sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py
index 39d6f17..3c0f29b 100644
--- a/lang/python/examples/inter-edit.py
+++ b/lang/python/examples/inter-edit.py
@@ -40,8 +40,8 @@ with pyme.Context() as c:
print("Editing key {} ({}):".format(key.uids[0].uid, key.subkeys[0].fpr))
def edit_fnc(keyword, args):
- print("Status: {} ({}), args: {} > ".format(
- keyword, status, args), end='', flush=True)
+ print("Status: {}, args: {} > ".format(
+ keyword, args), end='', flush=True)
if not 'GET' in keyword:
# no prompt
diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py
index 4467b6c..62c35d2 100644
--- a/lang/python/examples/testCMSgetkey.py
+++ b/lang/python/examples/testCMSgetkey.py
@@ -28,7 +28,7 @@ if len(sys.argv) != 2:
sys.exit("fingerprint or unique key ID for gpgme_get_key()")
with pyme.Context(protocol=pyme.constants.PROTOCOL_CMS) as c:
- key = c.get_key(sys.argv[1], False)
+ key = c.get_key(sys.argv[1])
print("got key: ", key.subkeys[0].fpr)
for uid in key.uids:
diff --git a/lang/python/examples/verifydetails.py b/lang/python/examples/verifydetails.py
index fa34926..81f82e9 100755
--- a/lang/python/examples/verifydetails.py
+++ b/lang/python/examples/verifydetails.py
@@ -52,7 +52,7 @@ def verifyprintdetails(filename, detached_sig_filename=None):
print(" status: %#0x" % (sign.status))
print(" timestamp: ", sign.timestamp)
print(" fingerprint:", sign.fpr)
- print(" uid: ", c.get_key(sign.fpr, 0).uids[0].uid)
+ print(" uid: ", c.get_key(sign.fpr).uids[0].uid)
# Print "unsigned" text if inline signature
if data:
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 84addae..5d074aa 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -110,7 +110,7 @@
Py_XDECREF(pyVector$argnum[i]);
}
-// Release returned buffers as necessary.
+/* Release returned buffers as necessary. */
%typemap(newfree) char * "free($1);";
%newobject gpgme_data_release_and_get_mem;
@@ -133,7 +133,7 @@
/* input = $input, 1 = $1, 1_descriptor = $1_descriptor */
/* &1_descriptor = $&1_descriptor *1_descriptor = $*1_descriptor */
- // Following code is from swig's python.swg
+ /* Following code is from swig's python.swg. */
if ((SWIG_ConvertPtr(pypointer,(void **) &$1[i], $*1_descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) {
Py_DECREF(pypointer);
return NULL;
@@ -147,7 +147,7 @@
if ($1) free($1);
}
-// Special handling for references to our objects.
+/* Special handling for references to our objects. */
%typemap(in) gpgme_data_t DATAIN (gpgme_data_t wrapper = NULL,
PyObject *bytesio = NULL,
Py_buffer view, int have_view = 0) {
@@ -167,7 +167,7 @@
/* input = $input, 1 = $1, 1_descriptor = $1_descriptor */
- // Following code is from swig's python.swg
+ /* Following code is from swig's python.swg. */
if ((SWIG_ConvertPtr(pypointer,(void **) &$1, $1_descriptor,
SWIG_POINTER_EXCEPTION | $disown )) == -1) {
@@ -183,7 +183,7 @@
representation of struct gpgme_data for an very efficient check if
the buffer has been modified. */
%{
-#include "src/data.h" /* For struct gpgme_data. */
+#include "data.h" /* For struct gpgme_data. */
%}
#endif
@@ -291,23 +291,67 @@
/* SWIG has problems interpreting ssize_t, off_t or gpgme_error_t in
gpgme.h. */
-/* XXX: This is wrong at least for off_t if compiled with LFS. */
-%typemap(out) ssize_t, off_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
+%typemap(out) ssize_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
$result = PyLong_FromLong($1);
}
-/* XXX: This is wrong at least for off_t if compiled with LFS. */
-%typemap(in) ssize_t, off_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
- $1 = PyLong_AsLong($input);
+
+%typemap(in) ssize_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
+ if (PyLong_Check($input))
+ $1 = PyLong_AsLong($input);
+#if PY_MAJOR_VERSION < 3
+ else if (PyInt_Check($input))
+ $1 = PyInt_AsLong($input);
+#endif
+ else
+ PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
+}
+
+%typemap(out) off_t {
+#if _FILE_OFFSET_BITS == 64
+ $result = PyLong_FromLongLong($1);
+#else
+ $result = PyLong_FromLong($1);
+#endif
+}
+
+%typemap(in) off_t {
+ if (PyLong_Check($input))
+#if _FILE_OFFSET_BITS == 64
+ $1 = PyLong_AsLongLong($input);
+#else
+ $1 = PyLong_AsLong($input);
+#endif
+#if PY_MAJOR_VERSION < 3
+ else if (PyInt_Check($input))
+ $1 = PyInt_AsLong($input);
+#endif
+ else
+ PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
}
-// Those are for gpgme_data_read() and gpgme_strerror_r()
+/* Those are for gpgme_data_read() and gpgme_strerror_r(). */
%typemap(in) (void *buffer, size_t size), (char *buf, size_t buflen) {
- $2 = PyLong_AsLong($input);
- if ($2 < 0) {
- PyErr_SetString(PyExc_ValueError, "Positive integer expected");
- return NULL;
- }
- $1 = ($1_ltype) malloc($2+1);
+ {
+ long tmp$argnum;
+ if (PyLong_Check($input))
+ tmp$argnum = PyLong_AsLong($input);
+#if PY_MAJOR_VERSION < 3
+ else if (PyInt_Check($input))
+ tmp$argnum = PyInt_AsLong($input);
+#endif
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
+ return NULL;
+ }
+
+ if (tmp$argnum < 0) {
+ PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+ return NULL;
+ }
+ $2 = (size_t) tmp$argnum;
+ $1 = ($1_ltype) malloc($2+1);
+ }
}
%typemap(argout) (void *buffer, size_t size), (char *buf, size_t buflen) {
Py_XDECREF($result); /* Blow away any previous result */
@@ -357,7 +401,7 @@
Py_XDECREF(encodedInput$argnum);
}
-// Make types containing 'next' field to be lists
+/* Make types containing 'next' field to be lists. */
%ignore next;
%typemap(out) gpgme_sig_notation_t, gpgme_subkey_t,
gpgme_key_sig_t, gpgme_user_id_t, gpgme_invalid_key_t,
@@ -547,6 +591,10 @@
some structs, which we provide prior to including the version for
SWIG. */
%{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <gpgme.h>
%}
@@ -575,11 +623,15 @@ struct _gpgme_sig_notation
/* Now include our local modified version. Any structs defined above
are ignored. */
+#ifdef HAVE_CONFIG_H
+%include "config.h"
+#endif
+
%include "gpgme.h"
%include "errors.i"
-// Generating and handling pointers-to-pointers.
+/* Generating and handling pointers-to-pointers. */
%pointer_functions(gpgme_ctx_t, gpgme_ctx_t_p);
%pointer_functions(gpgme_data_t, gpgme_data_t_p);
@@ -588,7 +640,7 @@ struct _gpgme_sig_notation
%pointer_functions(gpgme_trust_item_t, gpgme_trust_item_t_p);
%pointer_functions(gpgme_engine_info_t, gpgme_engine_info_t_p);
-// Helper functions.
+/* Helper functions. */
%{
#include <stdio.h>
diff --git a/lang/python/helpers.c b/lang/python/helpers.c
index f9aec91..3724752 100644
--- a/lang/python/helpers.c
+++ b/lang/python/helpers.c
@@ -18,6 +18,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <assert.h>
#include <stdio.h>
#include <gpgme.h>
diff --git a/lang/python/helpers.h b/lang/python/helpers.h
index 9200f93..67d23b2 100644
--- a/lang/python/helpers.h
+++ b/lang/python/helpers.h
@@ -18,6 +18,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <gpgme.h>
#include "Python.h"
diff --git a/lang/python/pyme/core.py b/lang/python/pyme/core.py
index 88a086b..f0eab43 100644
--- a/lang/python/pyme/core.py
+++ b/lang/python/pyme/core.py
@@ -670,15 +670,34 @@ class Context(GpgmeWrapper):
key.__del__ = lambda self: gpgme.gpgme_key_unref(self)
return key
- def get_key(self, fpr, secret):
- """Return the key corresponding to the fingerprint 'fpr'"""
+ def get_key(self, fpr, secret=False):
+ """Get a key given a fingerprint
+
+ Keyword arguments:
+ secret -- to request a secret key
+
+ Returns:
+ -- the matching key
+
+ Raises:
+ KeyError -- if the key was not found
+ GPGMEError -- as signaled by the underlying library
+
+ """
ptr = gpgme.new_gpgme_key_t_p()
- errorcheck(gpgme.gpgme_get_key(self.wrapped, fpr, ptr, secret))
+
+ try:
+ errorcheck(gpgme.gpgme_get_key(self.wrapped, fpr, ptr, secret))
+ except errors.GPGMEError as e:
+ if e.getcode() == errors.EOF:
+ raise errors.KeyNotFound(fpr)
+ raise e
+
key = gpgme.gpgme_key_t_p_value(ptr)
gpgme.delete_gpgme_key_t_p(ptr)
- if key:
- key.__del__ = lambda self: gpgme.gpgme_key_unref(self)
- return key
+ assert key
+ key.__del__ = lambda self: gpgme.gpgme_key_unref(self)
+ return key
def op_trustlist_all(self, *args, **kwargs):
self.op_trustlist_start(*args, **kwargs)
diff --git a/lang/python/pyme/errors.py b/lang/python/pyme/errors.py
index e26c747..0fd85ef 100644
--- a/lang/python/pyme/errors.py
+++ b/lang/python/pyme/errors.py
@@ -21,10 +21,12 @@ del absolute_import, print_function, unicode_literals
from . import gpgme
from . import util
-util.process_constants('GPG_ERR_', globals())
+# To appease static analysis tools, we define some constants here.
+# They are overwritten with the proper values by process_constants.
+NO_ERROR = None
+EOF = None
-# To appease static analysis tools, we define some constants here:
-NO_ERROR = 0
+util.process_constants('GPG_ERR_', globals())
class PymeError(Exception):
pass
@@ -58,6 +60,20 @@ def errorcheck(retval, extradata = None):
if retval:
raise GPGMEError(retval, extradata)
+class KeyNotFound(GPGMEError, KeyError):
+ """Raised if a key was not found
+
+ GPGME indicates this condition with EOF, which is not very
+ idiomatic. We raise this error that is both a GPGMEError
+ indicating EOF, and a KeyError.
+
+ """
+ def __init__(self, keystr):
+ self.keystr = keystr
+ GPGMEError.__init__(self, EOF)
+ def __str__(self):
+ return self.keystr
+
# These errors are raised in the idiomatic interface code.
class EncryptionError(PymeError):
diff --git a/lang/python/pyme/version.py b/lang/python/pyme/version.py
index 21a0122..13c5129 100644
--- a/lang/python/pyme/version.py
+++ b/lang/python/pyme/version.py
@@ -22,7 +22,7 @@ del absolute_import, print_function
from . import gpgme
productname = 'pyme'
-versionstr = "1.7.0"
+versionstr = "1.7.1"
gpgme_versionstr = gpgme.GPGME_VERSION
in_tree_build = bool(gpgme.cvar.pyme_in_tree_build)
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 31892c1..4c41673 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -28,6 +28,7 @@ gpg_error_config = ["gpg-error-config"]
gpgme_config_flags = ["--thread=pthread"]
gpgme_config = ["gpgme-config"] + gpgme_config_flags
gpgme_h = ""
+include_dirs = [os.getcwd()]
library_dirs = []
in_tree = False
extra_swig_opts = []
@@ -40,6 +41,7 @@ if os.path.exists("../../src/gpgme-config"):
gpgme_h = "../../src/gpgme.h"
library_dirs = ["../../src/.libs"] # XXX uses libtool internals
extra_macros.update(
+ HAVE_CONFIG_H=1,
HAVE_DATA_H=1,
IN_TREE_BUILD=1,
)
@@ -94,7 +96,6 @@ subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h],
subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpg_error_h],
stdout=open("errors.i", "w"))
-include_dirs = [os.getcwd()]
define_macros = []
libs = getconfig('libs')
diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index 4d7135e..f1ffdc3 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -27,6 +27,7 @@ alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
bob = "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2"
encrypt_only = "F52770D5C4DB41408D918C9F920572769B9FE19C"
sign_only = "7CCA20CCDE5394CEE71C9F0BFED153F12F18F45D"
+no_such_key = "A" * 40
def make_filename(name):
return os.path.join(os.environ['top_srcdir'], 'tests', 'gpg', name)
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index 5e8b333..f7f6674 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -20,6 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
+import pyme
from pyme import core, constants
import support
@@ -244,3 +245,25 @@ for i, key in enumerate(c.keylist()):
if misc_check:
misc_check (uids[0][0], key)
+
+
+# check get_key()
+with pyme.Context() as c:
+ c.get_key(support.alpha)
+ c.get_key(support.alpha, secret=True)
+
+ c.get_key(support.bob)
+ try:
+ c.get_key(support.bob, secret=True)
+ except KeyError:
+ pass
+ else:
+ assert False, "Expected KeyError"
+
+ # Legacy error
+ try:
+ c.get_key(support.no_such_key)
+ except pyme.errors.GPGMEError:
+ pass
+ else:
+ assert False, "Expected GPGMEError"
diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py
index 777bc0b..eb5b111 100755
--- a/lang/python/tests/t-sig-notation.py
+++ b/lang/python/tests/t-sig-notation.py
@@ -36,6 +36,7 @@ expected_notations = {
with core.Context() as c:
version = c.engine_info.version
have_correct_sig_data = not (version.startswith("1.")
+ or version.startswith("2.0.")
or version == "2.1.1"
or (version.startswith("2.1.1")
and version[5] < '3'))
diff --git a/lang/qt/src/AbstractImportJob b/lang/qt/src/AbstractImportJob
new file mode 100644
index 0000000..4627c40
--- /dev/null
+++ b/lang/qt/src/AbstractImportJob
@@ -0,0 +1 @@
+#include "qgpgme/abstractimportjob.h"
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index c15da18..51fe314 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -22,7 +22,7 @@ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
gpgme_backend_debug.h qgpgme_version.h.in
qgpgme_sources = \
- dataprovider.cpp job.cpp qgpgmeadduseridjob.cpp \
+ dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \
qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \
qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \
@@ -39,6 +39,7 @@ qgpgme_sources = \
# If you add one here make sure that you also add one in camelcase
qgpgme_headers= \
+ abstractimportjob.h \
adduseridjob.h \
changeexpiryjob.h \
changeownertrustjob.h \
@@ -56,6 +57,7 @@ qgpgme_headers= \
protocol.h \
qgpgme_export.h \
qgpgmenewcryptoconfig.h \
+ specialjob.h \
signjob.h \
signkeyjob.h \
signencryptjob.h \
@@ -75,6 +77,7 @@ qgpgme_headers= \
camelcase_headers= \
AddUserIDJob \
+ AbstractImportJob \
ChangeExpiryJob \
ChangeOwnerTrustJob \
ChangePasswdJob \
@@ -89,6 +92,7 @@ camelcase_headers= \
MultiDeleteJob \
Protocol \
QGpgMENewCryptoConfig \
+ SpecialJob \
SignJob \
SignKeyJob \
SignEncryptJob \
@@ -109,7 +113,6 @@ camelcase_headers= \
private_qgpgme_headers = \
qgpgme_export.h \
- abstractimportjob.h \
protocol_p.h \
qgpgmeadduseridjob.h \
qgpgmebackend.h \
@@ -137,7 +140,6 @@ private_qgpgme_headers = \
qgpgmekeyformailboxjob.h \
qgpgmewkspublishjob.h \
qgpgmetofupolicyjob.h \
- specialjob.h \
threadedjobmixin.h
qgpgme_moc_sources = \
@@ -221,9 +223,9 @@ libsuffix=.so
endif
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
@@ -232,9 +234,9 @@ $(camelcase_headers): Makefile.am
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) QGpgmeConfig.cmake \
+ $(INSTALL) -m 644 QGpgmeConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- $(INSTALL) QGpgmeConfigVersion.cmake \
+ $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/qt/src/Makefile.in b/lang/qt/src/Makefile.in
index d10eca3..0aa0590 100644
--- a/lang/qt/src/Makefile.in
+++ b/lang/qt/src/Makefile.in
@@ -138,17 +138,17 @@ am__installdirs = "$(DESTDIR)$(libdir)" \
LTLIBRARIES = $(lib_LTLIBRARIES)
libqgpgme_la_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
../../../src/libgpgme.la
-am__objects_1 = dataprovider.lo job.lo qgpgmeadduseridjob.lo \
- qgpgmebackend.lo qgpgmechangeexpiryjob.lo \
- qgpgmechangeownertrustjob.lo qgpgmechangepasswdjob.lo \
- qgpgmedecryptjob.lo qgpgmedecryptverifyjob.lo \
- qgpgmedeletejob.lo qgpgmedownloadjob.lo qgpgmeencryptjob.lo \
- qgpgmeexportjob.lo qgpgmeimportfromkeyserverjob.lo \
- qgpgmeimportjob.lo qgpgmekeygenerationjob.lo \
- qgpgmekeylistjob.lo qgpgmelistallkeysjob.lo \
- qgpgmenewcryptoconfig.lo qgpgmerefreshkeysjob.lo \
- qgpgmesecretkeyexportjob.lo qgpgmesignencryptjob.lo \
- qgpgmesignjob.lo qgpgmesignkeyjob.lo \
+am__objects_1 = dataprovider.lo job.lo multideletejob.lo \
+ qgpgmeadduseridjob.lo qgpgmebackend.lo \
+ qgpgmechangeexpiryjob.lo qgpgmechangeownertrustjob.lo \
+ qgpgmechangepasswdjob.lo qgpgmedecryptjob.lo \
+ qgpgmedecryptverifyjob.lo qgpgmedeletejob.lo \
+ qgpgmedownloadjob.lo qgpgmeencryptjob.lo qgpgmeexportjob.lo \
+ qgpgmeimportfromkeyserverjob.lo qgpgmeimportjob.lo \
+ qgpgmekeygenerationjob.lo qgpgmekeylistjob.lo \
+ qgpgmelistallkeysjob.lo qgpgmenewcryptoconfig.lo \
+ qgpgmerefreshkeysjob.lo qgpgmesecretkeyexportjob.lo \
+ qgpgmesignencryptjob.lo qgpgmesignjob.lo qgpgmesignkeyjob.lo \
qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \
threadedjobmixin.lo qgpgmekeyformailboxjob.lo \
gpgme_backend_debug.lo qgpgmetofupolicyjob.lo \
@@ -464,7 +464,7 @@ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
gpgme_backend_debug.h qgpgme_version.h.in
qgpgme_sources = \
- dataprovider.cpp job.cpp qgpgmeadduseridjob.cpp \
+ dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \
qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \
qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \
@@ -482,6 +482,7 @@ qgpgme_sources = \
# If you add one here make sure that you also add one in camelcase
qgpgme_headers = \
+ abstractimportjob.h \
adduseridjob.h \
changeexpiryjob.h \
changeownertrustjob.h \
@@ -499,6 +500,7 @@ qgpgme_headers = \
protocol.h \
qgpgme_export.h \
qgpgmenewcryptoconfig.h \
+ specialjob.h \
signjob.h \
signkeyjob.h \
signencryptjob.h \
@@ -518,6 +520,7 @@ qgpgme_headers = \
camelcase_headers = \
AddUserIDJob \
+ AbstractImportJob \
ChangeExpiryJob \
ChangeOwnerTrustJob \
ChangePasswdJob \
@@ -532,6 +535,7 @@ camelcase_headers = \
MultiDeleteJob \
Protocol \
QGpgMENewCryptoConfig \
+ SpecialJob \
SignJob \
SignKeyJob \
SignEncryptJob \
@@ -552,7 +556,6 @@ camelcase_headers = \
private_qgpgme_headers = \
qgpgme_export.h \
- abstractimportjob.h \
protocol_p.h \
qgpgmeadduseridjob.h \
qgpgmebackend.h \
@@ -580,7 +583,6 @@ private_qgpgme_headers = \
qgpgmekeyformailboxjob.h \
qgpgmewkspublishjob.h \
qgpgmetofupolicyjob.h \
- specialjob.h \
threadedjobmixin.h
qgpgme_moc_sources = \
@@ -751,6 +753,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgme_backend_debug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multideletejob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmeadduseridjob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmebackend.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmechangeexpiryjob.Plo@am__quote@
@@ -1090,9 +1093,9 @@ uninstall-am: uninstall-camelcaseincludeHEADERS \
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
@@ -1101,9 +1104,9 @@ $(camelcase_headers): Makefile.am
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) QGpgmeConfig.cmake \
+ $(INSTALL) -m 644 QGpgmeConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- $(INSTALL) QGpgmeConfigVersion.cmake \
+ $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in
index 3d19696..5b6c188 100644
--- a/lang/qt/src/QGpgmeConfig.cmake.in.in
+++ b/lang/qt/src/QGpgmeConfig.cmake.in.in
@@ -37,7 +37,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
-foreach(_expectedTarget QGpgme KF5::QGpgme)
+foreach(_expectedTarget QGpgme)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
@@ -58,17 +58,11 @@ unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
-# Compute the installation prefix relative to this file.
-get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-
# Create imported target QGpgme
add_library(QGpgme SHARED IMPORTED)
set_target_properties(QGpgme PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/qgpgme"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@"
)
@@ -77,9 +71,6 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
endif()
-# Cleanup temporary variables.
-set(_IMPORT_PREFIX)
-
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
diff --git a/lang/qt/src/SpecialJob b/lang/qt/src/SpecialJob
new file mode 100644
index 0000000..e869ebb
--- /dev/null
+++ b/lang/qt/src/SpecialJob
@@ -0,0 +1 @@
+#include "qgpgme/specialjob.h"
diff --git a/lang/qt/src/dataprovider.cpp b/lang/qt/src/dataprovider.cpp
index 533b67d..8385686 100644
--- a/lang/qt/src/dataprovider.cpp
+++ b/lang/qt/src/dataprovider.cpp
@@ -1,5 +1,5 @@
/* dataprovider.cpp
- Copyright (C) 2004 Klar�vdalens Datakonsult AB
+ Copyright (C) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 Intevation GmbH
This file is part of QGPGME.
@@ -21,6 +21,10 @@
// -*- c++ -*-
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <dataprovider.h>
#include <error.h>
diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp
index 8257a72..d26e824 100644
--- a/lang/qt/src/defaultkeygenerationjob.cpp
+++ b/lang/qt/src/defaultkeygenerationjob.cpp
@@ -28,6 +28,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "defaultkeygenerationjob.h"
#include "protocol.h"
#include "keygenerationjob.h"
diff --git a/lang/qt/src/gpgme_backend_debug.cpp b/lang/qt/src/gpgme_backend_debug.cpp
index 6dfb313..6efe932 100644
--- a/lang/qt/src/gpgme_backend_debug.cpp
+++ b/lang/qt/src/gpgme_backend_debug.cpp
@@ -1,5 +1,9 @@
// This file is autogenerated by CMake: DO NOT EDIT
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgme_backend_debug.h"
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
index 8936ea5..38dbc99 100644
--- a/lang/qt/src/job.cpp
+++ b/lang/qt/src/job.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "job.h"
#include "keylistjob.h"
diff --git a/lang/qt/src/multideletejob.cpp b/lang/qt/src/multideletejob.cpp
new file mode 100644
index 0000000..67f2a78
--- /dev/null
+++ b/lang/qt/src/multideletejob.cpp
@@ -0,0 +1,117 @@
+/*
+ multideletejob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2004 Klarälvdalens Datakonsult AB
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "multideletejob.h"
+#include "protocol.h"
+#include "deletejob.h"
+
+#include <key.h>
+#include <context.h>
+#include <data.h>
+
+#include <iterator>
+
+#include <assert.h>
+
+QGpgME::MultiDeleteJob::MultiDeleteJob(const Protocol *protocol)
+ : Job(0),
+ mProtocol(protocol),
+ mJob(0)
+{
+ assert(protocol);
+}
+
+QGpgME::MultiDeleteJob::~MultiDeleteJob()
+{
+
+}
+
+GpgME::Error QGpgME::MultiDeleteJob::start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion)
+{
+ mKeys = keys;
+ mAllowSecretKeyDeletion = allowSecretKeyDeletion;
+ mIt = mKeys.begin();
+
+ const GpgME::Error err = startAJob();
+
+ if (err) {
+ deleteLater();
+ }
+ return err;
+}
+
+void QGpgME::MultiDeleteJob::slotCancel()
+{
+ if (mJob) {
+ mJob->slotCancel();
+ }
+ mIt = mKeys.end();
+}
+
+void QGpgME::MultiDeleteJob::slotResult(const GpgME::Error &err)
+{
+ mJob = 0;
+ GpgME::Error error = err;
+ if (error || // error in last op
+ mIt == mKeys.end() || // (shouldn't happen)
+ ++mIt == mKeys.end() || // was the last key
+ (error = startAJob())) { // error starting the job for the new key
+ Q_EMIT done();
+ Q_EMIT result(error, error && mIt != mKeys.end() ? *mIt : GpgME::Key::null);
+ deleteLater();
+ return;
+ }
+
+ const int current = mIt - mKeys.begin();
+ const int total = mKeys.size();
+ Q_EMIT progress(QStringLiteral("%1/%2").arg(current).arg(total), current, total);
+}
+
+GpgME::Error QGpgME::MultiDeleteJob::startAJob()
+{
+ if (mIt == mKeys.end()) {
+ return GpgME::Error(0);
+ }
+ mJob = mProtocol->deleteJob();
+ assert(mJob); // FIXME: we need a way to generate errors ourselves,
+ // but I don't like the dependency on gpg-error :/
+
+ connect(mJob.data(), &DeleteJob::result, this, &MultiDeleteJob::slotResult);
+
+ return mJob->start(*mIt, mAllowSecretKeyDeletion);
+}
+
+#include "multideletejob.moc"
diff --git a/lang/qt/src/multideletejob.h b/lang/qt/src/multideletejob.h
index 8915cd1..8e9eb14 100644
--- a/lang/qt/src/multideletejob.h
+++ b/lang/qt/src/multideletejob.h
@@ -36,7 +36,7 @@
#include "qgpgme_export.h"
#include "job.h"
-#include "cryptobackend.h"
+#include "protocol.h"
#include <QPointer>
diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h
index 40ddcb5..15d83e0 100644
--- a/lang/qt/src/protocol.h
+++ b/lang/qt/src/protocol.h
@@ -76,7 +76,7 @@ class TofuPolicyJob;
* two are always a QString for the auditlog and an GpgME::Error for
* an eventual error.
*
- * In case async API is used and the result signal is emited a
+ * In case async API is used and the result signal is emitted a
* job schedules its own deletion.
*
* Most jobs also provide a synchronous call exec in which case
@@ -161,14 +161,14 @@ public:
/** Obtain a reference to the OpenPGP Protocol.
*
* The reference is to a static object.
- * @returns Refrence to the OpenPGP Protocol.
+ * @returns Reference to the OpenPGP Protocol.
*/
QGPGME_EXPORT Protocol *openpgp();
/** Obtain a reference to the smime Protocol.
*
* The reference is to a static object.
- * @returns Refrence to the smime Protocol.
+ * @returns Reference to the smime Protocol.
*/
QGPGME_EXPORT Protocol *smime();
diff --git a/lang/qt/src/qgpgmeadduseridjob.cpp b/lang/qt/src/qgpgmeadduseridjob.cpp
index eb3bfab..4fc80d1 100644
--- a/lang/qt/src/qgpgmeadduseridjob.cpp
+++ b/lang/qt/src/qgpgmeadduseridjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeadduseridjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmebackend.cpp b/lang/qt/src/qgpgmebackend.cpp
index 797e58a..f06244b 100644
--- a/lang/qt/src/qgpgmebackend.cpp
+++ b/lang/qt/src/qgpgmebackend.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmebackend.h"
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp
index 43ceee3..cf417ab 100644
--- a/lang/qt/src/qgpgmechangeexpiryjob.cpp
+++ b/lang/qt/src/qgpgmechangeexpiryjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmechangeexpiryjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.cpp b/lang/qt/src/qgpgmechangeownertrustjob.cpp
index 55131d9..d9a613f 100644
--- a/lang/qt/src/qgpgmechangeownertrustjob.cpp
+++ b/lang/qt/src/qgpgmechangeownertrustjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmechangeownertrustjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmechangepasswdjob.cpp b/lang/qt/src/qgpgmechangepasswdjob.cpp
index 0aec927..b04273c 100644
--- a/lang/qt/src/qgpgmechangepasswdjob.cpp
+++ b/lang/qt/src/qgpgmechangepasswdjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmechangepasswdjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmedecryptjob.cpp b/lang/qt/src/qgpgmedecryptjob.cpp
index 7116449..449e9aa 100644
--- a/lang/qt/src/qgpgmedecryptjob.cpp
+++ b/lang/qt/src/qgpgmedecryptjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedecryptjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp
index d46a9b5..e6d3ff2 100644
--- a/lang/qt/src/qgpgmedecryptverifyjob.cpp
+++ b/lang/qt/src/qgpgmedecryptverifyjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedecryptverifyjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmedeletejob.cpp b/lang/qt/src/qgpgmedeletejob.cpp
index 323aec4..9145298 100644
--- a/lang/qt/src/qgpgmedeletejob.cpp
+++ b/lang/qt/src/qgpgmedeletejob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedeletejob.h"
#include "context.h"
diff --git a/lang/qt/src/qgpgmedownloadjob.cpp b/lang/qt/src/qgpgmedownloadjob.cpp
index 48cc907..b0dca56 100644
--- a/lang/qt/src/qgpgmedownloadjob.cpp
+++ b/lang/qt/src/qgpgmedownloadjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedownloadjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp
index 82c8ed8..d13acab 100644
--- a/lang/qt/src/qgpgmeencryptjob.cpp
+++ b/lang/qt/src/qgpgmeencryptjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeencryptjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeexportjob.cpp b/lang/qt/src/qgpgmeexportjob.cpp
index dfc5fc9..e6073f0 100644
--- a/lang/qt/src/qgpgmeexportjob.cpp
+++ b/lang/qt/src/qgpgmeexportjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeexportjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
index 0f19679..acefbb2 100644
--- a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
+++ b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeimportfromkeyserverjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeimportjob.cpp b/lang/qt/src/qgpgmeimportjob.cpp
index f125b12..dcabad3 100644
--- a/lang/qt/src/qgpgmeimportjob.cpp
+++ b/lang/qt/src/qgpgmeimportjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeimportjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp
index 803d0e6..7054c78 100644
--- a/lang/qt/src/qgpgmekeyformailboxjob.cpp
+++ b/lang/qt/src/qgpgmekeyformailboxjob.cpp
@@ -30,6 +30,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmekeyformailboxjob.h"
#include "qgpgmekeylistjob.h"
diff --git a/lang/qt/src/qgpgmekeygenerationjob.cpp b/lang/qt/src/qgpgmekeygenerationjob.cpp
index cba6b76..31f3342 100644
--- a/lang/qt/src/qgpgmekeygenerationjob.cpp
+++ b/lang/qt/src/qgpgmekeygenerationjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmekeygenerationjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp
index 1169c46..887a902 100644
--- a/lang/qt/src/qgpgmekeylistjob.cpp
+++ b/lang/qt/src/qgpgmekeylistjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmekeylistjob.h"
#include "key.h"
diff --git a/lang/qt/src/qgpgmelistallkeysjob.cpp b/lang/qt/src/qgpgmelistallkeysjob.cpp
index fd8bfc3..7ba8bc9 100644
--- a/lang/qt/src/qgpgmelistallkeysjob.cpp
+++ b/lang/qt/src/qgpgmelistallkeysjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmelistallkeysjob.h"
#include "key.h"
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp
index 7303f10..eb3af56 100644
--- a/lang/qt/src/qgpgmenewcryptoconfig.cpp
+++ b/lang/qt/src/qgpgmenewcryptoconfig.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmenewcryptoconfig.h"
#include <QDebug>
@@ -80,7 +84,7 @@ QGpgMENewCryptoConfig::~QGpgMENewCryptoConfig()
clear();
}
-void QGpgMENewCryptoConfig::reloadConfiguration(bool showErrors)
+void QGpgMENewCryptoConfig::reloadConfiguration(bool)
{
clear();
diff --git a/lang/qt/src/qgpgmerefreshkeysjob.cpp b/lang/qt/src/qgpgmerefreshkeysjob.cpp
index 3d221f6..493a010 100644
--- a/lang/qt/src/qgpgmerefreshkeysjob.cpp
+++ b/lang/qt/src/qgpgmerefreshkeysjob.cpp
@@ -2,7 +2,7 @@
qgpgmerefreshkeysjob.cpp
This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klar�vdalens Datakonsult AB
+ Copyright (c) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 Intevation GmbH
QGpgME is free software; you can redistribute it and/or
@@ -33,6 +33,10 @@
#define MAX_CMD_LENGTH 32768
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmerefreshkeysjob.h"
#include <QDebug>
diff --git a/lang/qt/src/qgpgmesecretkeyexportjob.cpp b/lang/qt/src/qgpgmesecretkeyexportjob.cpp
index f4ec698..75cd83a 100644
--- a/lang/qt/src/qgpgmesecretkeyexportjob.cpp
+++ b/lang/qt/src/qgpgmesecretkeyexportjob.cpp
@@ -2,7 +2,7 @@
qgpgmesecretexportjob.cpp
This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klar�vdalens Datakonsult AB
+ Copyright (c) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 Intevation GmbH
QGpgME is free software; you can redistribute it and/or
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesecretkeyexportjob.h"
#include <QDebug>
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp
index d2e45b1..9dcc619 100644
--- a/lang/qt/src/qgpgmesignencryptjob.cpp
+++ b/lang/qt/src/qgpgmesignencryptjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesignencryptjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmesignjob.cpp b/lang/qt/src/qgpgmesignjob.cpp
index 4e2312b..e165f52 100644
--- a/lang/qt/src/qgpgmesignjob.cpp
+++ b/lang/qt/src/qgpgmesignjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesignjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
index e6c1478..27aff5e 100644
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ b/lang/qt/src/qgpgmesignkeyjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesignkeyjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmetofupolicyjob.cpp b/lang/qt/src/qgpgmetofupolicyjob.cpp
index a24c946..34630a1 100644
--- a/lang/qt/src/qgpgmetofupolicyjob.cpp
+++ b/lang/qt/src/qgpgmetofupolicyjob.cpp
@@ -28,6 +28,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmetofupolicyjob.h"
#include "context.h"
diff --git a/lang/qt/src/qgpgmeverifydetachedjob.cpp b/lang/qt/src/qgpgmeverifydetachedjob.cpp
index 8efef05..ee74861 100644
--- a/lang/qt/src/qgpgmeverifydetachedjob.cpp
+++ b/lang/qt/src/qgpgmeverifydetachedjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeverifydetachedjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeverifyopaquejob.cpp b/lang/qt/src/qgpgmeverifyopaquejob.cpp
index b513f82..aea406a 100644
--- a/lang/qt/src/qgpgmeverifyopaquejob.cpp
+++ b/lang/qt/src/qgpgmeverifyopaquejob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeverifyopaquejob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmewkspublishjob.cpp b/lang/qt/src/qgpgmewkspublishjob.cpp
index 8f97cb5..9773893 100644
--- a/lang/qt/src/qgpgmewkspublishjob.cpp
+++ b/lang/qt/src/qgpgmewkspublishjob.cpp
@@ -28,6 +28,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmewkspublishjob.h"
#include "context.h"
@@ -137,7 +141,7 @@ static QGpgMEWKSPublishJob::result_type create_worker(const char *fpr, const QSt
proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error());
}
-static QGpgMEWKSPublishJob::result_type recieve_worker(const QByteArray &response)
+static QGpgMEWKSPublishJob::result_type receive_worker(const QByteArray &response)
{
if (response.isEmpty()) {
return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
@@ -181,9 +185,9 @@ void QGpgMEWKSPublishJob::startCreate(const char *fpr, const QString &mailbox) {
run(std::bind(&create_worker, fpr, mailbox));
}
-void QGpgMEWKSPublishJob::startRecieve(const QByteArray &response)
+void QGpgMEWKSPublishJob::startReceive(const QByteArray &response)
{
- run(std::bind(&recieve_worker, response));
+ run(std::bind(&receive_worker, response));
}
#include "qgpgmewkspublishjob.moc"
diff --git a/lang/qt/src/qgpgmewkspublishjob.h b/lang/qt/src/qgpgmewkspublishjob.h
index 1a31149..5fd3c03 100644
--- a/lang/qt/src/qgpgmewkspublishjob.h
+++ b/lang/qt/src/qgpgmewkspublishjob.h
@@ -62,7 +62,7 @@ public:
void startCheck(const QString &mailbox) Q_DECL_OVERRIDE;
void startCreate(const char *fpr, const QString &mailbox) Q_DECL_OVERRIDE;
- void startRecieve(const QByteArray &response) Q_DECL_OVERRIDE;
+ void startReceive(const QByteArray &response) Q_DECL_OVERRIDE;
};
}
diff --git a/lang/qt/src/threadedjobmixin.cpp b/lang/qt/src/threadedjobmixin.cpp
index cd6ab5f..66d21fb 100644
--- a/lang/qt/src/threadedjobmixin.cpp
+++ b/lang/qt/src/threadedjobmixin.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "threadedjobmixin.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h
index 62d7f1c..d1b1043 100644
--- a/lang/qt/src/threadedjobmixin.h
+++ b/lang/qt/src/threadedjobmixin.h
@@ -223,7 +223,8 @@ protected:
{
return m_auditLogError;
}
- void showProgress(const char *what, int type, int current, int total) Q_DECL_OVERRIDE {
+ void showProgress(const char * /*what*/,
+ int /*type*/, int current, int total) Q_DECL_OVERRIDE {
// will be called from the thread exec'ing the operation, so
// just bounce everything to the owning thread:
// ### hope this is thread-safe (meta obj is const, and
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
index 782112f..0cec630 100644
--- a/lang/qt/src/wkspublishjob.h
+++ b/lang/qt/src/wkspublishjob.h
@@ -45,7 +45,7 @@ namespace QGpgME {
* Handles Web Key Service Publishing. Needs WKS tools installed and
* server support.
*
- * Remember that after a result is emited the job is auto deleted
+ * Remember that after a result is emitted the job is auto deleted
* so you can only use it for a single action.
*/
class QGPGME_EXPORT WKSPublishJob: public Job
@@ -82,7 +82,7 @@ public:
*
* @param response The response of the server.
**/
- virtual void startRecieve(const QByteArray &response) = 0;
+ virtual void startReceive(const QByteArray &response) = 0;
Q_SIGNALS:
/* Result of the operation returned Data and returned Error are
diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
index f243a55..ad08ad4 100644
--- a/lang/qt/tests/Makefile.am
+++ b/lang/qt/tests/Makefile.am
@@ -25,10 +25,10 @@ TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
EXTRA_DIST = initial.test
TESTS = initial.test t-keylist t-keylocate t-ownertrust t-tofuinfo \
- t-encrypt t-wkspublish
+ t-encrypt t-verify
moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
- t-encrypt.moc t-support.hmoc t-wkspublish.moc
+ t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc
AM_LDFLAGS = -no-install
@@ -56,6 +56,7 @@ t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src)
t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src)
t_encrypt_SOURCES = t-encrypt.cpp $(support_src)
t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src)
+t_verify_SOURCES = t-verify.cpp $(support_src)
run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
nodist_t_keylist_SOURCES = $(moc_files)
@@ -63,7 +64,7 @@ nodist_t_keylist_SOURCES = $(moc_files)
BUILT_SOURCES = $(moc_files)
noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \
- run-keyformailboxjob t-wkspublish
+ run-keyformailboxjob t-wkspublish t-verify
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
diff --git a/lang/qt/tests/Makefile.in b/lang/qt/tests/Makefile.in
index 45d4c76..5149a08 100644
--- a/lang/qt/tests/Makefile.in
+++ b/lang/qt/tests/Makefile.in
@@ -98,10 +98,11 @@ build_triplet = @build@
host_triplet = @host@
TESTS = initial.test t-keylist$(EXEEXT) t-keylocate$(EXEEXT) \
t-ownertrust$(EXEEXT) t-tofuinfo$(EXEEXT) t-encrypt$(EXEEXT) \
- t-wkspublish$(EXEEXT)
+ t-verify$(EXEEXT)
noinst_PROGRAMS = t-keylist$(EXEEXT) t-keylocate$(EXEEXT) \
t-ownertrust$(EXEEXT) t-tofuinfo$(EXEEXT) t-encrypt$(EXEEXT) \
- run-keyformailboxjob$(EXEEXT) t-wkspublish$(EXEEXT)
+ run-keyformailboxjob$(EXEEXT) t-wkspublish$(EXEEXT) \
+ t-verify$(EXEEXT)
subdir = lang/qt/tests
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
@@ -163,6 +164,11 @@ t_tofuinfo_OBJECTS = $(am_t_tofuinfo_OBJECTS)
t_tofuinfo_LDADD = $(LDADD)
t_tofuinfo_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
../src/libqgpgme.la ../../../src/libgpgme.la
+am_t_verify_OBJECTS = t-verify.$(OBJEXT) $(am__objects_1)
+t_verify_OBJECTS = $(am_t_verify_OBJECTS)
+t_verify_LDADD = $(LDADD)
+t_verify_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
+ ../src/libqgpgme.la ../../../src/libgpgme.la
am_t_wkspublish_OBJECTS = t-wkspublish.$(OBJEXT) $(am__objects_1)
t_wkspublish_OBJECTS = $(am_t_wkspublish_OBJECTS)
t_wkspublish_LDADD = $(LDADD)
@@ -223,11 +229,12 @@ am__v_CCLD_1 =
SOURCES = $(run_keyformailboxjob_SOURCES) $(t_encrypt_SOURCES) \
$(t_keylist_SOURCES) $(nodist_t_keylist_SOURCES) \
$(t_keylocate_SOURCES) $(t_ownertrust_SOURCES) \
- $(t_tofuinfo_SOURCES) $(t_wkspublish_SOURCES)
+ $(t_tofuinfo_SOURCES) $(t_verify_SOURCES) \
+ $(t_wkspublish_SOURCES)
DIST_SOURCES = $(run_keyformailboxjob_SOURCES) $(t_encrypt_SOURCES) \
$(t_keylist_SOURCES) $(t_keylocate_SOURCES) \
$(t_ownertrust_SOURCES) $(t_tofuinfo_SOURCES) \
- $(t_wkspublish_SOURCES)
+ $(t_verify_SOURCES) $(t_wkspublish_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -471,7 +478,7 @@ GPG = gpg
TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
EXTRA_DIST = initial.test
moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
- t-encrypt.moc t-support.hmoc t-wkspublish.moc
+ t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc
AM_LDFLAGS = -no-install
LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \
@@ -491,6 +498,7 @@ t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src)
t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src)
t_encrypt_SOURCES = t-encrypt.cpp $(support_src)
t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src)
+t_verify_SOURCES = t-verify.cpp $(support_src)
run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
nodist_t_keylist_SOURCES = $(moc_files)
BUILT_SOURCES = $(moc_files)
@@ -568,6 +576,10 @@ t-tofuinfo$(EXEEXT): $(t_tofuinfo_OBJECTS) $(t_tofuinfo_DEPENDENCIES) $(EXTRA_t_
@rm -f t-tofuinfo$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_tofuinfo_OBJECTS) $(t_tofuinfo_LDADD) $(LIBS)
+t-verify$(EXEEXT): $(t_verify_OBJECTS) $(t_verify_DEPENDENCIES) $(EXTRA_t_verify_DEPENDENCIES)
+ @rm -f t-verify$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_verify_OBJECTS) $(t_verify_LDADD) $(LIBS)
+
t-wkspublish$(EXEEXT): $(t_wkspublish_OBJECTS) $(t_wkspublish_DEPENDENCIES) $(EXTRA_t_wkspublish_DEPENDENCIES)
@rm -f t-wkspublish$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_wkspublish_OBJECTS) $(t_wkspublish_LDADD) $(LIBS)
@@ -585,6 +597,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-ownertrust.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-support.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-tofuinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-wkspublish.Po@am__quote@
.cpp.o:
diff --git a/lang/qt/tests/run-keyformailboxjob.cpp b/lang/qt/tests/run-keyformailboxjob.cpp
index 9ac7668..73bedbd 100644
--- a/lang/qt/tests/run-keyformailboxjob.cpp
+++ b/lang/qt/tests/run-keyformailboxjob.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "keyformailboxjob.h"
#include "keylistjob.h"
#include "protocol.h"
diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp
index 3d4cfa9..4d65dc7 100644
--- a/lang/qt/tests/t-encrypt.cpp
+++ b/lang/qt/tests/t-encrypt.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QTemporaryDir>
@@ -49,6 +53,23 @@
using namespace QGpgME;
using namespace GpgME;
+static bool decryptSupported()
+{
+ /* With GnuPG 2.0.x (at least 2.0.26 by default on jessie)
+ * the passphrase_cb does not work. So the test popped up
+ * a pinentry. So tests requiring decryption don't work. */
+ static auto version = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
+ if (version < "2.0.0") {
+ /* With 1.4 it just works */
+ return true;
+ }
+ if (version < "2.1.0") {
+ /* With 2.1 it works with loopback mode */
+ return false;
+ }
+ return true;
+}
+
class EncryptionTest : public QGpgMETest
{
Q_OBJECT
@@ -78,6 +99,9 @@ private Q_SLOTS:
Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
/* Now decrypt */
+ if (!decryptSupported()) {
+ return;
+ }
auto ctx = Context::createForProtocol(OpenPGP);
TestPassphraseProvider provider;
ctx->setPassphraseProvider(&provider);
@@ -113,7 +137,7 @@ private Q_SLOTS:
bool initSeen = false;
bool finishSeen = false;
- connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString& what, int current, int total) {
+ connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, int current, int total) {
// We only check for progress 0 and max progress as the other progress
// lines depend on the system speed and are as such unreliable to test.
Q_ASSERT(total == PROGRESS_TEST_SIZE);
@@ -125,8 +149,8 @@ private Q_SLOTS:
}
Q_ASSERT(current >= 0 && current <= total);
});
- connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &result,
- const QByteArray &cipherText,
+ connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &,
+ const QByteArray &,
const QString,
const GpgME::Error) {
Q_ASSERT(initSeen);
@@ -146,6 +170,9 @@ private Q_SLOTS:
void testSymmetricEncryptDecrypt()
{
+ if (!decryptSupported()) {
+ return;
+ }
auto ctx = Context::createForProtocol(OpenPGP);
TestPassphraseProvider provider;
ctx->setPassphraseProvider(&provider);
@@ -178,6 +205,9 @@ private:
* So this test is disabled until gnupg(?) is fixed for this. */
void testMixedEncryptDecrypt()
{
+ if (!decryptSupported()) {
+ return;
+ }
auto listjob = openpgp()->keyListJob(false, false, false);
std::vector<Key> keys;
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"),
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
index 767c96b..2578576 100644
--- a/lang/qt/tests/t-keylist.cpp
+++ b/lang/qt/tests/t-keylist.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp
index e75f24d..63cb836 100644
--- a/lang/qt/tests/t-keylocate.cpp
+++ b/lang/qt/tests/t-keylocate.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
diff --git a/lang/qt/tests/t-ownertrust.cpp b/lang/qt/tests/t-ownertrust.cpp
index b9efffd..db863b2 100644
--- a/lang/qt/tests/t-ownertrust.cpp
+++ b/lang/qt/tests/t-ownertrust.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp
index 86372f7..857d0a3 100644
--- a/lang/qt/tests/t-support.cpp
+++ b/lang/qt/tests/t-support.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "t-support.h"
#include <QTest>
diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h
index 59d9a4d..704fab4 100644
--- a/lang/qt/tests/t-support.h
+++ b/lang/qt/tests/t-support.h
@@ -39,8 +39,8 @@ namespace GpgME
class TestPassphraseProvider : public PassphraseProvider
{
public:
- char *getPassphrase(const char *useridHint, const char *description,
- bool previousWasBad, bool &canceled) Q_DECL_OVERRIDE
+ char *getPassphrase(const char * /*useridHint*/, const char * /*description*/,
+ bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE
{
return strdup("abc");
}
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index d76ff7b..2c87e4a 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QTemporaryDir>
diff --git a/lang/qt/tests/t-verify.cpp b/lang/qt/tests/t-verify.cpp
new file mode 100644
index 0000000..aedfc19
--- /dev/null
+++ b/lang/qt/tests/t-verify.cpp
@@ -0,0 +1,93 @@
+/* t-verifiy.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2016 Intevation GmbH
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <QDebug>
+#include <QTest>
+
+
+#include "protocol.h"
+
+#include "verifyopaquejob.h"
+#include "verificationresult.h"
+#include "key.h"
+#include "t-support.h"
+
+using namespace QGpgME;
+using namespace GpgME;
+
+static const char testMsg1[] =
+"-----BEGIN PGP MESSAGE-----\n"
+"\n"
+"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n"
+"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n"
+"y1kvP4y+8D5a11ang0udywsA\n"
+"=Crq6\n"
+"-----END PGP MESSAGE-----\n";
+
+
+class VerifyTest: public QGpgMETest
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ /* Check that a signature always has a key. */
+ void testSignatureKey()
+ {
+ const QByteArray signedData(testMsg1);
+ auto verifyJob = openpgp()->verifyOpaqueJob(true);
+ QByteArray verified;
+
+ auto result = verifyJob->exec(signedData, verified);
+ Q_ASSERT(!result.error());
+ delete verifyJob;
+
+ Q_ASSERT(result.numSignatures() == 1);
+ auto sig = result.signatures()[0];
+
+ const auto key = sig.key(true, false);
+ Q_ASSERT(!key.isNull());
+
+ bool found = false;
+ for (const auto subkey: key.subkeys()) {
+ if (!strcmp (subkey.fingerprint(), sig.fingerprint())) {
+ found = true;
+ }
+ }
+ Q_ASSERT(found);
+ }
+};
+
+QTEST_MAIN(VerifyTest)
+#include "t-verify.moc"
diff --git a/lang/qt/tests/t-wkspublish.cpp b/lang/qt/tests/t-wkspublish.cpp
index 17d3447..326ecaa 100644
--- a/lang/qt/tests/t-wkspublish.cpp
+++ b/lang/qt/tests/t-wkspublish.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
@@ -122,7 +126,7 @@ private Q_SLOTS:
// First check if it is supported
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray, QByteArray, QString, Error) {
Q_ASSERT(err);
Q_EMIT asyncDone();
});
@@ -140,7 +144,7 @@ private:
// First check if it is supported
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray, QByteArray, QString, Error) {
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
std::cout << err;
Q_ASSERT(err);
@@ -161,7 +165,7 @@ private:
}
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray, QByteArray, QString, Error) {
Q_ASSERT(err);
Q_EMIT asyncDone();
});
@@ -193,7 +197,7 @@ private:
auto keygenjob = openpgp()->keyGenerationJob();
QByteArray fpr;
connect(keygenjob, &KeyGenerationJob::result, this,
- [this, &fpr](KeyGenerationResult result, QByteArray pubkeyData, QString, Error)
+ [this, &fpr](KeyGenerationResult result, QByteArray, QString, Error)
{
Q_ASSERT(!result.error());
fpr = QByteArray(result.fingerprint());
@@ -207,7 +211,7 @@ private:
/* Then try to create a request. */
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray out, QByteArray, QString, Error) {
Q_ASSERT(!err);
Q_EMIT asyncDone();
const QString outstr = QString(out);
@@ -222,7 +226,7 @@ private:
Q_ASSERT(spy.wait());
}
- void testWKSPublishRecieve() {
+ void testWKSPublishReceive() {
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
/* Not supported */
return;
@@ -243,7 +247,7 @@ private:
/* Get a response. */
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray out, QByteArray, QString, Error) {
Q_ASSERT(!err);
Q_EMIT asyncDone();
const QString outstr = QString(out);
@@ -254,7 +258,7 @@ private:
Q_ASSERT(outstr.contains(
QStringLiteral("From: " TEST_ADDRESS)));
});
- job->startRecieve(QByteArray(testResponse));
+ job->startReceive(QByteArray(testResponse));
Q_ASSERT(spy.wait());
}
diff --git a/src/Makefile.in b/src/Makefile.in
index 75d7659..d70de3b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -107,8 +107,8 @@ subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
$(srcdir)/versioninfo.rc.in $(srcdir)/gpgme.h.in \
- $(srcdir)/gpgme-config.in setenv.c stpcpy.c vasprintf.c \
- ttyname_r.c funopen.c $(top_srcdir)/build-aux/depcomp
+ $(srcdir)/gpgme-config.in vasprintf.c funopen.c stpcpy.c \
+ setenv.c ttyname_r.c $(top_srcdir)/build-aux/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
diff --git a/src/assuan-support.c b/src/assuan-support.c
index 2cfdc35..7fbd48a 100644
--- a/src/assuan-support.c
+++ b/src/assuan-support.c
@@ -97,6 +97,9 @@ my_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg,
{
(void)ctx;
#ifdef HAVE_W32_SYSTEM
+ (void)fd;
+ (void)msg;
+ (void)flags;
gpg_err_set_errno (ENOSYS);
return -1;
#else
@@ -112,6 +115,9 @@ my_sendmsg (assuan_context_t ctx, assuan_fd_t fd, const assuan_msghdr_t msg,
{
(void)ctx;
#ifdef HAVE_W32_SYSTEM
+ (void)fd;
+ (void)msg;
+ (void)flags;
gpg_err_set_errno (ENOSYS);
return -1;
#else
@@ -210,6 +216,9 @@ my_waitpid (assuan_context_t ctx, pid_t pid,
{
(void)ctx;
#ifdef HAVE_W32_SYSTEM
+ (void)nowait;
+ (void)status;
+ (void)options;
CloseHandle ((HANDLE) pid);
#else
/* We can't just release the PID, a waitpid is mandatory. But
@@ -229,6 +238,11 @@ my_socketpair (assuan_context_t ctx, int namespace, int style,
int protocol, assuan_fd_t filedes[2])
{
#ifdef HAVE_W32_SYSTEM
+ (void)ctx;
+ (void)namespace;
+ (void)style;
+ (void)protocol;
+ (void)filedes;
gpg_err_set_errno (ENOSYS);
return -1;
#else
diff --git a/src/b64dec.c b/src/b64dec.c
index 7965a30..9a7efca 100644
--- a/src/b64dec.c
+++ b/src/b64dec.c
@@ -12,7 +12,7 @@
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
diff --git a/src/conversion.c b/src/conversion.c
index 3df8fe5..6dfabe7 100644
--- a/src/conversion.c
+++ b/src/conversion.c
@@ -31,6 +31,7 @@
#endif
#include <time.h>
#include <errno.h>
+#include <stdarg.h>
#include "gpgme.h"
#include "util.h"
@@ -42,6 +43,61 @@
+static char *
+do_strconcat (const char *s1, va_list arg_ptr)
+{
+ const char *argv[16];
+ size_t argc;
+ size_t needed;
+ char *buffer, *p;
+
+ argc = 0;
+ argv[argc++] = s1;
+ needed = strlen (s1);
+ while (((argv[argc] = va_arg (arg_ptr, const char *))))
+ {
+ needed += strlen (argv[argc]);
+ if (argc >= DIM (argv)-1)
+ {
+ gpg_err_set_errno (EINVAL);
+ return NULL;
+ }
+ argc++;
+ }
+ needed++;
+ buffer = malloc (needed);
+ if (buffer)
+ {
+ for (p = buffer, argc=0; argv[argc]; argc++)
+ p = stpcpy (p, argv[argc]);
+ }
+ return buffer;
+}
+
+
+/* Concatenate the string S1 with all the following strings up to a
+ * NULL. Returns a malloced buffer with the new string or NULL on a
+ malloc error or if too many arguments are given. */
+char *
+_gpgme_strconcat (const char *s1, ...)
+{
+ va_list arg_ptr;
+ char *result;
+
+ if (!s1)
+ result = strdup ("");
+ else
+ {
+ va_start (arg_ptr, s1);
+ result = do_strconcat (s1, arg_ptr);
+ va_end (arg_ptr);
+ }
+ return result;
+}
+
+
+
+
/* Convert two hexadecimal digits from STR to the value they
represent. Returns -1 if one of the characters is not a
hexadecimal digit. */
diff --git a/src/data-identify.c b/src/data-identify.c
index a5da7f5..615a4f3 100644
--- a/src/data-identify.c
+++ b/src/data-identify.c
@@ -278,7 +278,7 @@ pgp_binary_detection (const void *image_arg, size_t imagelen)
/* This is probably an armored "PGP MESSAGE" which can encode
* different PGP data types. STRING is modified after a call to this
- * fucntion. */
+ * function. */
static gpgme_data_type_t
inspect_pgp_message (char *string)
{
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 8bb348f..4415c94 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -544,6 +544,8 @@ gpg_new (void **engine, const char *file_name, const char *home_dir,
rc = add_arg (gpg, "utf8");
if (!rc)
rc = add_arg (gpg, "--enable-progress-filter");
+ if (!rc && have_gpg_version (gpg, "2.1.11"))
+ rc = add_arg (gpg, "--exit-on-status-write-error");
if (rc)
goto leave;
@@ -2541,7 +2543,7 @@ gpg_keylist_build_options (engine_gpg_t gpg, int secret_only,
err = add_arg (gpg, "--with-colons");
/* Since gpg 2.1.15 fingerprints are always printed, thus there is
- * no more need to explictly request them. */
+ * no more need to explicitly request them. */
if (!have_gpg_version (gpg, "2.1.15"))
{
if (!err)
diff --git a/src/gpgme.def b/src/gpgme.def
index 9815a83..c94c960 100644
--- a/src/gpgme.def
+++ b/src/gpgme.def
@@ -244,5 +244,7 @@ EXPORTS
gpgme_op_interact_start @184
gpgme_op_interact @185
+ gpgme_addrspec_from_uid @186
+
; END
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 20654db..5c914ae 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -846,7 +846,7 @@ struct _gpgme_user_id
/* The mail address (addr-spec from RFC5322) of the UID string.
* This is general the same as the EMAIL part of this struct but
- * might be slightly different. IF no mail address is available
+ * might be slightly different. If no mail address is available
* NULL is stored. */
char *address;
@@ -2471,6 +2471,10 @@ const char *gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo);
algorithm ALGO, or NULL if that name is not known. */
const char *gpgme_hash_algo_name (gpgme_hash_algo_t algo);
+/* Return the addr-spec from a user id. Caller must free the result
+ * with gpgme_free. */
+char *gpgme_addrspec_from_uid (const char *uid);
+
/*
diff --git a/src/libgpgme.vers b/src/libgpgme.vers
index aec9090..d3962db 100644
--- a/src/libgpgme.vers
+++ b/src/libgpgme.vers
@@ -117,6 +117,8 @@ GPGME_1.1 {
gpgme_op_tofu_policy;
gpgme_op_interact_start;
gpgme_op_interact;
+
+ gpgme_addrspec_from_uid;
};
diff --git a/src/mbox-util.c b/src/mbox-util.c
index 83c8b5e..81e929b 100644
--- a/src/mbox-util.c
+++ b/src/mbox-util.c
@@ -12,7 +12,7 @@
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -255,3 +255,21 @@ _gpgme_mailbox_from_userid (const char *userid)
/* return 1; */
/* } */
+
+
+/*
+ * Exported public API
+ */
+
+
+/* Return the mail address ("addr-spec" as per RFC-5322) from a string
+ * which is assumed to be an user id ("address" in RFC-5322). All
+ * plain ASCII characters (those with bit 7 cleared) in the result
+ * are converted to lowercase. Caller must free the result using
+ * gpgme_free. Returns NULL if no valid address was found (in which
+ * case ERRNO is set to EINVAL) or for other errors. */
+char *
+gpgme_addrspec_from_uid (const char *uid)
+{
+ return _gpgme_mailbox_from_userid (uid);
+}
diff --git a/src/mbox-util.h b/src/mbox-util.h
index 3195a4d..c5747b6 100644
--- a/src/mbox-util.h
+++ b/src/mbox-util.h
@@ -11,7 +11,7 @@
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
diff --git a/src/util.h b/src/util.h
index 88e7750..1474b41 100644
--- a/src/util.h
+++ b/src/util.h
@@ -49,6 +49,10 @@
# define GPG_ERR_FALSE 256
#endif
+#ifndef GPGRT_ATTR_SENTINEL
+# define GPGRT_ATTR_SENTINEL(a) /* */
+#endif
+
/*-- {posix,w32}-util.c --*/
@@ -102,6 +106,12 @@ int _gpgme_ttyname_r (int fd, char *buf, size_t buflen);
/*-- conversion.c --*/
+
+/* Concatenate the string S1 with all the following strings up to a
+ NULL. Returns a malloced buffer with the new string or NULL on a
+ malloc error or if too many arguments are given. */
+char *_gpgme_strconcat (const char *s1, ...) GPGRT_ATTR_SENTINEL(0);
+
/* Convert two hexadecimal digits from STR to the value they
represent. Returns -1 if one of the characters is not a
hexadecimal digit. */
diff --git a/src/w32-util.c b/src/w32-util.c
index 0086fe3..21de6dc 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -98,6 +98,8 @@ static GPG_ERR_INLINE void *
dlopen (const char * name, int flag)
{
void * hd = LoadLibrary (name);
+
+ (void)flag;
return hd;
}
@@ -388,11 +390,10 @@ find_program_in_dir (const char *dir, const char *name)
{
char *result;
- result = malloc (strlen (dir) + 1 + strlen (name) + 1);
+ result = _gpgme_strconcat (dir, "\\", name, NULL);
if (!result)
return NULL;
- strcpy (stpcpy (stpcpy (result, dir), "\\"), name);
if (access (result, F_OK))
{
free (result);
@@ -417,15 +418,11 @@ find_program_at_standard_place (const char *name)
if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0)
|| SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0))
{
- result = malloc (strlen (path) + 1 + strlen (name) + 1);
- if (result)
+ result = _gpgme_strconcat (path, "\\", name, NULL);
+ if (result && access (result, F_OK))
{
- strcpy (stpcpy (stpcpy (result, path), "\\"), name);
- if (access (result, F_OK))
- {
- free (result);
- result = NULL;
- }
+ free (result);
+ result = NULL;
}
}
return result;
@@ -439,12 +436,9 @@ _gpgme_set_default_gpg_name (const char *name)
{
if (!default_gpg_name)
{
- default_gpg_name = malloc (strlen (name) + 5);
+ default_gpg_name = _gpgme_strconcat (name, ".exe", NULL);
if (default_gpg_name)
- {
- strcpy (stpcpy (default_gpg_name, name), ".exe");
- replace_slashes (default_gpg_name);
- }
+ replace_slashes (default_gpg_name);
}
return !default_gpg_name;
}
@@ -456,12 +450,9 @@ _gpgme_set_default_gpgconf_name (const char *name)
{
if (!default_gpgconf_name)
{
- default_gpgconf_name = malloc (strlen (name) + 5);
+ default_gpgconf_name = _gpgme_strconcat (name, ".exe", NULL);
if (default_gpgconf_name)
- {
- strcpy (stpcpy (default_gpgconf_name, name), ".exe");
- replace_slashes (default_gpgconf_name);
- }
+ replace_slashes (default_gpgconf_name);
}
return !default_gpgconf_name;
}
@@ -474,10 +465,9 @@ _gpgme_set_override_inst_dir (const char *dir)
{
if (!override_inst_dir)
{
- override_inst_dir = malloc (strlen (dir) + 1);
+ override_inst_dir = strdup (dir);
if (override_inst_dir)
{
- strcpy (override_inst_dir, dir);
replace_slashes (override_inst_dir);
/* Remove a trailing slash. */
if (*override_inst_dir
@@ -762,12 +752,11 @@ _gpgme_mkstemp (int *fd, char **name)
}
}
- tmpname = malloc (strlen (tmp) + 13 + 1);
+ tmpname = _gpgme_strconcat (tmp, "\\gpgme-XXXXXX", NULL);
if (!tmpname)
return -1;
- strcpy (stpcpy (tmpname, tmp), "\\gpgme-XXXXXX");
*fd = my_mkstemp (tmpname);
- if (fd < 0)
+ if (*fd < 0)
{
free (tmpname);
return -1;
diff --git a/tests/ChangeLog-2011 b/tests/ChangeLog-2011
index 596c2df..3ec0fb7 100644
--- a/tests/ChangeLog-2011
+++ b/tests/ChangeLog-2011
@@ -603,7 +603,7 @@
2002-09-28 Marcus Brinkmann <marcus@g10code.de>
- * t-version.c: Include <string.h>. Reported by Stphane Corthsy.
+ * t-version.c: Include <string.h>. Reported by Stéphane Corthésy.
2002-09-02 Marcus Brinkmann <marcus@g10code.de>
@@ -624,8 +624,8 @@
* gpg/t-encrypt-sym.c (main): Change type of I to size_t and
rename to LEN.
- * gpg/t-verify.c (main): Likewise. Submitted by Stphane
- Corthsy.
+ * gpg/t-verify.c (main): Likewise. Submitted by Stéphane
+ Corthésy.
2002-07-03 Marcus Brinkmann <marcus@g10code.de>
@@ -772,7 +772,7 @@
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-decrypt-verify.c: Don't include `mcheck.h'. Reported by
- Stphane Corthsy.
+ Stéphane Corthésy.
2001-12-19 Marcus Brinkmann <marcus@g10code.de>
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am
index 9877843..2538f63 100644
--- a/tests/gpg/Makefile.am
+++ b/tests/gpg/Makefile.am
@@ -62,9 +62,17 @@ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la
t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
+t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread
+
+# We don't run t-genkey and t-cancel in the test suite, because it
+# takes too long
+tests_skipped = t-genkey
+if !HAVE_W32_SYSTEM
+tests_skipped += t-cancel
+endif
+
+noinst_PROGRAMS = $(c_tests) $(tests_skipped)
-# We don't run t-genkey in the test suite, because it takes too long
-noinst_PROGRAMS = $(c_tests) t-genkey
clean-local:
-$(top_srcdir)/tests/start-stop-agent --stop
diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in
index 7886769..e1e943e 100644
--- a/tests/gpg/Makefile.in
+++ b/tests/gpg/Makefile.in
@@ -99,7 +99,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
TESTS = initial.test $(am__EXEEXT_2) final.test
-noinst_PROGRAMS = $(am__EXEEXT_2) t-genkey$(EXEEXT)
+@HAVE_W32_SYSTEM_FALSE@am__append_1 = t-cancel
+noinst_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_4)
subdir = tests/gpg
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
@@ -132,15 +133,20 @@ am__EXEEXT_2 = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \
t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \
t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \
t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1)
+@HAVE_W32_SYSTEM_FALSE@am__EXEEXT_3 = t-cancel$(EXEEXT)
+am__EXEEXT_4 = t-genkey$(EXEEXT) $(am__EXEEXT_3)
PROGRAMS = $(noinst_PROGRAMS)
-t_decrypt_SOURCES = t-decrypt.c
-t_decrypt_OBJECTS = t-decrypt.$(OBJEXT)
-t_decrypt_LDADD = $(LDADD)
-t_decrypt_DEPENDENCIES = ../../src/libgpgme.la
+t_cancel_SOURCES = t-cancel.c
+t_cancel_OBJECTS = t-cancel.$(OBJEXT)
+t_cancel_DEPENDENCIES = ../../src/libgpgme-pthread.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
+t_decrypt_SOURCES = t-decrypt.c
+t_decrypt_OBJECTS = t-decrypt.$(OBJEXT)
+t_decrypt_LDADD = $(LDADD)
+t_decrypt_DEPENDENCIES = ../../src/libgpgme.la
t_decrypt_verify_SOURCES = t-decrypt-verify.c
t_decrypt_verify_OBJECTS = t-decrypt-verify.$(OBJEXT)
t_decrypt_verify_LDADD = $(LDADD)
@@ -262,18 +268,18 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = t-decrypt.c t-decrypt-verify.c t-edit.c t-encrypt.c \
- t-encrypt-large.c t-encrypt-mixed.c t-encrypt-sign.c \
- t-encrypt-sym.c t-eventloop.c t-export.c t-file-name.c \
- t-genkey.c t-gpgconf.c t-import.c t-keylist.c t-keylist-sig.c \
- t-sig-notation.c t-sign.c t-signers.c t-thread1.c \
- t-trustlist.c t-verify.c t-wait.c
-DIST_SOURCES = t-decrypt.c t-decrypt-verify.c t-edit.c t-encrypt.c \
- t-encrypt-large.c t-encrypt-mixed.c t-encrypt-sign.c \
- t-encrypt-sym.c t-eventloop.c t-export.c t-file-name.c \
- t-genkey.c t-gpgconf.c t-import.c t-keylist.c t-keylist-sig.c \
- t-sig-notation.c t-sign.c t-signers.c t-thread1.c \
- t-trustlist.c t-verify.c t-wait.c
+SOURCES = t-cancel.c t-decrypt.c t-decrypt-verify.c t-edit.c \
+ t-encrypt.c t-encrypt-large.c t-encrypt-mixed.c \
+ t-encrypt-sign.c t-encrypt-sym.c t-eventloop.c t-export.c \
+ t-file-name.c t-genkey.c t-gpgconf.c t-import.c t-keylist.c \
+ t-keylist-sig.c t-sig-notation.c t-sign.c t-signers.c \
+ t-thread1.c t-trustlist.c t-verify.c t-wait.c
+DIST_SOURCES = t-cancel.c t-decrypt.c t-decrypt-verify.c t-edit.c \
+ t-encrypt.c t-encrypt-large.c t-encrypt-mixed.c \
+ t-encrypt-sign.c t-encrypt-sym.c t-eventloop.c t-export.c \
+ t-file-name.c t-genkey.c t-gpgconf.c t-import.c t-keylist.c \
+ t-keylist-sig.c t-sig-notation.c t-sign.c t-signers.c \
+ t-thread1.c t-trustlist.c t-verify.c t-wait.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -549,6 +555,11 @@ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la
t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
+t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread
+
+# We don't run t-genkey and t-cancel in the test suite, because it
+# takes too long
+tests_skipped = t-genkey $(am__append_1)
all: all-am
.SUFFIXES:
@@ -593,6 +604,10 @@ clean-noinstPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
+t-cancel$(EXEEXT): $(t_cancel_OBJECTS) $(t_cancel_DEPENDENCIES) $(EXTRA_t_cancel_DEPENDENCIES)
+ @rm -f t-cancel$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_cancel_OBJECTS) $(t_cancel_LDADD) $(LIBS)
+
t-decrypt$(EXEEXT): $(t_decrypt_OBJECTS) $(t_decrypt_DEPENDENCIES) $(EXTRA_t_decrypt_DEPENDENCIES)
@rm -f t-decrypt$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_decrypt_OBJECTS) $(t_decrypt_LDADD) $(LIBS)
@@ -691,6 +706,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-cancel.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt-verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-decrypt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-edit.Po@am__quote@
diff --git a/tests/gpg/geheim.txt b/tests/gpg/geheim.txt
index 99a5478..49d78a7 100644
--- a/tests/gpg/geheim.txt
+++ b/tests/gpg/geheim.txt
@@ -1,2 +1,2 @@
-Wenn Sie dies lesen knnen, ist es wohl nicht
+Wenn Sie dies lesen können, ist es wohl nicht
geheim genug.
diff --git a/tests/gpg/t-cancel.c b/tests/gpg/t-cancel.c
new file mode 100644
index 0000000..b5550d8
--- /dev/null
+++ b/tests/gpg/t-cancel.c
@@ -0,0 +1,272 @@
+/* t-thread-cancel.c - Regression test.
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2003, 2004 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <limits.h>
+#include <ctype.h>
+#include <errno.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/types.h>
+#include <unistd.h>
+#include <pthread.h>
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+
+#include <gpgme.h>
+
+#include "t-support.h"
+
+struct op_result
+{
+ int done;
+ gpgme_error_t err;
+};
+
+static struct op_result op_result;
+
+struct one_fd
+{
+ int fd;
+ int dir;
+ gpgme_io_cb_t fnc;
+ void *fnc_data;
+};
+
+#define FDLIST_MAX 32
+static struct one_fd fdlist[FDLIST_MAX];
+
+static pthread_mutex_t lock;
+
+static gpgme_error_t
+add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, void *fnc_data,
+ void **r_tag)
+{
+ struct one_fd *fds = data;
+ int i;
+
+ pthread_mutex_lock (&lock);
+ for (i = 0; i < FDLIST_MAX; i++)
+ {
+ if (fds[i].fd == -1)
+ {
+ fds[i].fd = fd;
+ fds[i].dir = dir;
+ fds[i].fnc = fnc;
+ fds[i].fnc_data = fnc_data;
+ break;
+ }
+ }
+ pthread_mutex_unlock (&lock);
+ if (i == FDLIST_MAX)
+ return gpgme_err_make (GPG_ERR_SOURCE_USER_1, GPG_ERR_GENERAL);
+ *r_tag = &fds[i];
+ return 0;
+}
+
+static void
+remove_io_cb (void *tag)
+{
+ struct one_fd *fd = tag;
+
+ pthread_mutex_lock (&lock);
+ fd->fd = -1;
+ pthread_mutex_unlock (&lock);
+}
+
+static void
+io_event (void *data, gpgme_event_io_t type, void *type_data)
+{
+ struct op_result *result = data;
+
+ if (type == GPGME_EVENT_DONE)
+ {
+ result->done = 1;
+ result->err = * (gpgme_error_t *) type_data;
+ }
+}
+
+
+static int
+do_select (void)
+{
+ fd_set rfds;
+ fd_set wfds;
+ int i, n;
+ int any = 0;
+ struct timeval tv;
+
+ pthread_mutex_lock (&lock);
+ FD_ZERO (&rfds);
+ FD_ZERO (&wfds);
+ for (i = 0; i < FDLIST_MAX; i++)
+ if (fdlist[i].fd != -1)
+ FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds);
+ pthread_mutex_unlock (&lock);
+
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000;
+
+ do
+ {
+ n = select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
+ }
+ while (n < 0 && errno == EINTR);
+
+ if (n < 0)
+ return n; /* Error or timeout. */
+
+ pthread_mutex_lock (&lock);
+ for (i = 0; i < FDLIST_MAX && n; i++)
+ {
+ if (fdlist[i].fd != -1)
+ {
+ if (FD_ISSET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds))
+ {
+ assert (n);
+ n--;
+ any = 1;
+ (*fdlist[i].fnc) (fdlist[i].fnc_data, fdlist[i].fd);
+ }
+ }
+ }
+ pthread_mutex_unlock (&lock);
+ return any;
+}
+
+static int
+my_wait (void)
+{
+ int n;
+
+ do
+ {
+ n = do_select ();
+ }
+ while (n >= 0 && !op_result.done);
+ return 0;
+}
+
+
+static struct gpgme_io_cbs io_cbs =
+ {
+ add_io_cb,
+ fdlist,
+ remove_io_cb,
+ io_event,
+ &op_result
+ };
+
+
+static void *
+thread_cancel (void *data)
+{
+ gpgme_ctx_t ctx = data;
+ gpgme_error_t err;
+
+ usleep (100000);
+ err = gpgme_cancel (ctx);
+ fail_if_err (err);
+
+ return NULL;
+}
+
+int
+main (void)
+{
+ gpgme_ctx_t ctx;
+ gpgme_error_t err;
+ gpgme_engine_info_t info;
+ int i;
+ pthread_mutexattr_t attr;
+ pthread_t tcancel;
+ const char *parms = "<GnupgKeyParms format=\"internal\">\n"
+ "Key-Type: RSA\n"
+ "Key-Length: 2048\n"
+ "Subkey-Type: RSA\n"
+ "Subkey-Length: 2048\n"
+ "Name-Real: Joe Tester\n"
+ "Name-Comment: (pp=abc)\n"
+ "Name-Email: joe@foo.bar\n"
+ "Expire-Date: 0\n"
+ "Passphrase: abc\n"
+ "</GnupgKeyParms>\n";
+
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ err = gpgme_get_engine_info (&info);
+ fail_if_err (err);
+
+ /* The mutex must be recursive, since remove_io_cb (which acquires a
+ lock) can be called while holding a lock acquired in do_select. */
+ pthread_mutexattr_init (&attr);
+ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init (&lock, &attr);
+ pthread_mutexattr_destroy (&attr);
+
+ for (i = 0; i < FDLIST_MAX; i++)
+ fdlist[i].fd = -1;
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_armor (ctx, 1);
+ gpgme_set_io_cbs (ctx, &io_cbs);
+ op_result.done = 0;
+
+ pthread_create (&tcancel, NULL, thread_cancel, ctx);
+
+ err = gpgme_op_genkey_start (ctx, parms, NULL, NULL);
+ fail_if_err (err);
+
+ my_wait ();
+
+ pthread_join (tcancel, NULL);
+
+ if (op_result.err)
+ {
+ if (gpgme_err_code (op_result.err) == GPG_ERR_CANCELED)
+ fputs ("Successfully cancelled\n", stdout);
+ else
+ {
+ fprintf (stderr,
+ "%s:%i: Operation finished with unexpected error: %s\n",
+ __FILE__, __LINE__, gpgme_strerror (op_result.err));
+ exit (1);
+ }
+ }
+ else
+ fputs ("Successfully finished before cancellation\n", stdout);
+
+ gpgme_release (ctx);
+
+ return 0;
+}
diff --git a/tests/gpg/t-eventloop.c b/tests/gpg/t-eventloop.c
index 74af35f..2d3df41 100644
--- a/tests/gpg/t-eventloop.c
+++ b/tests/gpg/t-eventloop.c
@@ -111,6 +111,7 @@ do_select (void)
fd_set wfds;
int i, n;
int any = 0;
+ struct timeval tv;
FD_ZERO (&rfds);
FD_ZERO (&wfds);
@@ -118,9 +119,12 @@ do_select (void)
if (fdlist[i].fd != -1)
FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds);
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000;
+
do
{
- n = select (FD_SETSIZE, &rfds, &wfds, NULL, 0);
+ n = select (FD_SETSIZE, &rfds, &wfds, NULL, &tv);
}
while (n < 0 && errno == EINTR);
diff --git a/tests/gpg/t-sig-notation.c b/tests/gpg/t-sig-notation.c
index aee7551..052e179 100644
--- a/tests/gpg/t-sig-notation.c
+++ b/tests/gpg/t-sig-notation.c
@@ -151,6 +151,7 @@ main (int argc, char *argv[])
correctly. */
have_correct_sig_data =
! (strncmp ("1.", engine_info->version, 2) == 0
+ || strncmp ("2.0.", engine_info->version, 4) == 0
|| (strncmp ("2.1.1", engine_info->version, 5) == 0
&& (engine_info->version[5] == 0
|| engine_info->version[5] < '3')));
diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c
index 658809c..81803af 100644
--- a/tests/gpgsm/t-decrypt.c
+++ b/tests/gpgsm/t-decrypt.c
@@ -54,6 +54,8 @@ main (void)
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t in, out;
+ size_t len;
+ char *test_text2;
gpgme_decrypt_result_t result;
init_gpgme (GPGME_PROTOCOL_CMS);
@@ -77,10 +79,18 @@ main (void)
__FILE__, __LINE__, result->unsupported_algorithm);
exit (1);
}
- print_data (out);
+ test_text2 = gpgme_data_release_and_get_mem (out, &len);
+ test_text2[len] = '\0';
+ if (strcmp (test_text1, test_text2))
+ {
+ fprintf (stderr, "%s:%i: data mismatch: expected: \n\"%s\"\n"
+ "got:\n\"%s\"",
+ __FILE__, __LINE__, test_text1, test_text2);
+ exit (1);
+ }
+ free (test_text2);
gpgme_data_release (in);
- gpgme_data_release (out);
gpgme_release (ctx);
return 0;
}