diff -Nru gpgme1.0-1.7.0/autogen.sh gpgme1.0-1.8.0/autogen.sh --- gpgme1.0-1.7.0/autogen.sh 2016-06-01 09:11:04.000000000 +0000 +++ gpgme1.0-1.8.0/autogen.sh 2016-11-16 12:20:17.000000000 +0000 @@ -347,7 +347,7 @@ [ -z "${SILENT}" ] && cat < + + Release 1.8.0. + * configure.ac: Set version to 1.8.0. Set LT version C28/A17/RO. + Set CPP LT version to C9/A3/R0. Set Qt LT version to C8/A1/R0. + + core: Do not leak the override session key to ps(1). + * src/engine-gpg.c (struct engine_gpg): New field + override_session_key. + (gpg_release): Free that field. + (gpg_decrypt): With gnupg 2.1.16 use --override-session-key-fd. + + * tests/run-decrypt.c (main): Fix setting over the override key. + +2016-11-16 Daniel Kahn Gillmor + + doc,tests: Require use of ctx_flag before use of session_key. + * doc/gpgme.texi: Document requirements of verifying that it is OK to + use session_key. + * tests/run-decrypt.c: Ensure that we fail if we're unable to access + the session key, so that we do not violate the guidance above. + + + Changed the description + + -@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns + -@code{GPG_ERR_NO_ERROR} or @code{gpgme_get_ctx_flag (ctx, + -"export-session-key")} returns @code{"1"}. + +@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success + +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true + +(non-empty string). + + to get gpgme_get_ctx_flag for boolean values in sync with its own + description. + + Note that I don't agree with the above suggestion but it does not + really harm to have it in the man page. + +2016-11-15 Andre Heinecke + + qt, cpp: Add cmake config files for w32. + * lang/cpp/src/GpgmeppConfig-w32.cmake.in.in + lang/qt/src/QGpgmeConfig-w32.cmake.in.in: New. + * lang/cpp/src/GpgmeppConfig.cmake.in.in, + lang/qt/src/QGpgmeConfig.cmake.in.in: Remove libsuffix handling. + * lang/cpp/src/Makefile.am, + lang/qt/src/Makefile.am: Create / install w32 config files. + * configure.ac: Configure them. + + qt: Use new style connect in th..mixin. + * lang/qt/src/threadedjobmixin.h + (ThreadedJobMixin::lateInitialization): Use new style connect. + +2016-11-15 Werner Koch + + core: Implement context flag "override-session-key". + * src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and + "override-session-key". + (gpgme_get_ctx_flag): Ditto. + (gpgme_set_export_session_keys): Remove. + (gpgme_get_export_session_keys): Remove. + * src/gpgme.def, src/libgpgme.vers: Remove them. + * src/context.h (struct gpgme_context): Add field + override_session_key. + * src/decrypt-verify.c (decrypt_verify_start): Pass + override_session_key value to the engine. + * src/decrypt.c (decrypt_start): Ditto. + * src/engine.c (_gpgme_engine_op_decrypt): Ditto. + (_gpgme_engine_op_decrypt_verify): Ditto. + * src/engine-backend.h (struct engine_ops): Extend DECRYPT and + DECRYPT_VERIFY_START with override_session_key. + * src/engine-uiserver.c (_uiserver_decrypt): Add stub arg + override_session_key. + (uiserver_decrypt): Ditto. + (uiserver_decrypt_verify): Ditto. + * src/engine-gpgsm.c (gpgsm_decrypt): Ditto. + * src/engine-gpg.c (gpg_decrypt): Add arg override_session_key and set + corresponding gpg option. + + * tests/run-decrypt.c (print_result): Print the session key if + available. + (main): Add options --export-session-key and --override-session-key. + + core: Add public function gpgme_get_ctx_flag. + * src/gpgme.h.in (gpgme_get_ctx_flag): New. + * src/gpgme.c (gpgme_set_ctx_flag): Move down the file and add a trace + statement. + (gpgme_get_ctx_flag): New. + * src/gpgme.def, src/libgpgme.vers: Add new interface. + +2016-11-15 Daniel Kahn Gillmor + + core: Enable extraction of session keys. + * src/gpgme.c (gpgme_set_export_session_keys): New function. + (gpgme_get_export_session_keys): New function. + * src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key + member. + (gpgme_{set,get}_export_session_keys): Declare new functions. + * src/libgpgme.vers, src/gpgme.def: Export new functions in shared + object. + * src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key + parameter. + (_gpgme_engine_op_decrypt_verify): Add export_session_key parameter. + * src/engine-backend.h: (struct engine_ops): Change function + pointer declarations to match. + * src/context.h (struct gpgme_context): Add export_session_keys member. + * src/decrypt.c (release_op_data): Free result.session_key. + (_gpgme_decrypt_status_handler): Store a copy of the exported session + key. + (decrypt_start): Pass export_session_keys from the context. + * src/decrypt-verify.c (decrypt_verify_start): Pass + export_session_keys from context. + * src/engine.c (_gpgme_engine_op_decrypt): Pass through + export_session_key flag. + (_gpgme_engine_op_decrypt_verify): Pass through export_session_key + flag. + * src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add + --export-session-key to argument list. + * src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for + now, since gpgsm offers no such mechanism. + * src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is + set, add --export-session-key flag to cmd. + * doc/gpgme.texi: Document new functions and session_key member of + decrypt_result_t. + * doc/uiserver.texi: Add --export-session-key flag to DECRYPT command. + +2016-11-14 Andre Heinecke + + qt: Add API to get the context for a Job. + * lang/qt/src/job.cpp, + lang/qt/src/job.h (Job::context): New. + * lang/qt/src/threadedjobmixin.cpp + (ThreadedJobMixin::~ThreadedJobMixin): New. Unregister context. + (ThreadedJobMixin::lateInitialization): Register context. + * NEWS: Update for cpp and qt. + + cpp: Add get / set Sender API. + * cpp/src/context.cpp, cpp/src/context.h (Context::setSender), + (Context::getSender): Add simple wrappers. + + qt, cpp: Enable dll build for windows. + * lang/cpp/src/Makefile.am, + lang/qt/src/Makefile.am: Add -no-undefined to LDFLAGS. + + w32: Fix build of w32-glib. + * src/Makefile.am (main_sources): Remove system_components_not_extra. + (libgpgme_la_SOURCES): Add system_components_not_extra. + (libgpgme_glib_la_SOURCES): Remove duplicated ath files. + +2016-11-11 Daniel Kahn Gillmor + + doc: Correct deftypefun for gpgme_op_decrypt_verify_start. + * doc/gpgme.texi: Documentationabout gpgme_op_decrypt_verify_start was + stored under the name gpgme_op_decrypt_verify instead. + + doc: Correct text about gpgme_cancel_async. + * doc/gpgme.texi: Documentation about gpgme_cancel_async should refer + to the correct name. + + core: Non-zero values should set _armor, _textmode, and _online. + * src/gpgme.c (gpgme_set_armor, gpgme_set_textmode, + gpgme_set_offline): Ensure that non-zero values actually set the + appropriate internal bit. + +2016-11-11 Alon Bar-Lev + + tests,python: Atomic directory creation. + * lang/python/tests/Makefile.am: Use MIDIR_P. + * tests/gpg/Makefile.am: Ditto. + * tests/gpgsm/Makefile.am: Ditto. + +2016-11-10 Werner Koch + + core: Use better error code when using select with a too high fd. + * src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF. + +2016-11-10 Andre Heinecke + + tests: Reduce thread count in new thread tests. + * gpg/t-thread-keylist-verify.c, + gpg/t-thread-keylist.c: Reduce threads to 100 + +2016-11-10 Werner Koch + + core: Detect unreadable keyrings. + * src/keylist.c (op_data_t): Add field keydb_search_err. + (keylist_status_handler): Parse STATUS_ERROR into that var. + (gpgme_op_keylist_next): Use that err instead of GPG_ERR_EOF. + +2016-11-10 Andre Heinecke + + tests: Fix additional memleaks in thread tests. + * tests/gpg/t-thread-keylist-verify.c (start_verify): Release + data. + (start_keylist): Unref keys. + * tests/gpg/t-thread-keylist.c (start_keylist): Unref keys. + + tests: Improve new thread tests. + * tests/gpg/t-thread-keylist-verify.c (start_keylist): Mark + arg as unused. Release context. + (start_verify): Ditto. + (main): Mark args as unused. + * tests/gpg/t-thread-keylist.c (start_keylist): Mark + arg as unused. Release context. + (main): Mark args as unused. + + core: Use gpgrt locking for thread safeness. + * configure.ac: Require libgpg-error 1.17. No longer + check for pthread. + * doc/gpgme.texi: Document removed neccessity for thread + safe gpgme flavours. + * src/sema.h (DEFINE_GLOBAL_LOCK), + (DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK) + (DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents. + * src/posix-sema.c, src/w32-sema.c: Removed. + * src/Makefile.am: Remove libpthread and + Update accordingly. + * src/ath.c, src/ath.h (ath_mutex_init) + (ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed. + * src/ath.h (ATH_MUTEX_INITIALIZER): Removed. + * src/version.c (do_subsystem_inits): sema_subsystem_init is + no longer required. + * tests/gpg/Makefile.am: Add new threading tests. + (t_thread1_LDADD, t_cancel_LDADD): + Use just gpgme. + * tests/gpg/t-thread-keylist-verify.c, + tests/gpg/t-thread-keylist.c: New. + * src/gpgme-config.in: Use -lgpgme for thread-model pthread. + +2016-11-09 Justus Winter + + python: Require at least GPGME 1.7 for out-of-tree builds. + * lang/python/setup.py.in: Bump required version to 1.7. + +2016-11-09 Werner Koch + + w32: Better protect the IO-system's fd_table. + * src/w32-io.c (fd_table_lock): New. + (new_fd): Lock allocation of a new slot. + (release_fd): Lock deallocation of a slot. + +2016-11-04 Andre Heinecke + + cpp: Add API for swdb queries. + * lang/cpp/src/swdbresult.cpp, + lang/cpp/src/swdbresult.h (SwdbResult): New. + * lang/cpp/src/Makefile.am: Update accordingly. + + cpp: Add more EngineInfo::Version ctors. + * lang/cpp/src/engineinfo.h + (EngineInfo::Version::Version(const char*)), + (EngineInfo::Version::Version()): New. + + cpp: Don't include gpgme.h in tofuinfo header. + * lang/cpp/src/tofuinfo.h: Don't include gpgme.h + + cpp: Extend gpgmefw for tofuinfo and swdb query. + * lang/cpp/src/gpgmefw.h (gpgme_tofu_info_t) + (gpgme_query_swdb_result_t): New forwards. + +2016-11-04 Werner Koch + + w32: Fix locating gpgconf on 64 bit systems. + * src/w32-util.c (find_program_at_standard_place): Use access to check + whether the binary is at CSIDL_PROGRAM_FILES before testing + CSIDL_PROGRAM_FILESX86. + +2016-11-03 Werner Koch + + core: Add gpgme_op_query_swdb and helper. + * src/gpgme.h.in (gpgme_query_swdb_result_t): New. + (gpgme_op_query_swdb): New. + (gpgme_op_query_swdb_result): New. + * src/libgpgme.vers, src/gpgme.def: Add the two new functions. + * src/queryswdb.c: New. + * src/Makefile.am (main_sources): Add new file. + * src/context.h (OPDATA_QUERY_SWDB): New. + * src/engine-backend.h (struct engine_ops): Add field 'query_swdb'. + Adjust all initializer. + * src/engine.c (_gpgme_engine_op_query_swdb): New. + * src/engine-gpgconf.c (parse_swdb_line): New. + (gpgconf_query_swdb): New. + (_gpgme_engine_ops_gpgconf): Register that function. + + * src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error. + (GPG_ERR_ENGINE_TOO_OLD): Ditto. + + * tests/run-swdb.c: New. + * tests/Makefile.am (noinst_PROGRAMS): Add new debug tool. + +2016-11-03 Andre Heinecke + + qt: Change license of export / version header. + * lang/qt/src/qgpgme_export.h, + lang/qt/src/qgpgme_version.h: Change license to GPLv2+ + +2016-11-03 Werner Koch + + core: Make use of --homedir in gpgconf. + * src/engine-gpgconf.c (struct engine_gpgconf): Add field 'version'. + (have_gpgconf_version): New. + (gpgconf_release): Free VERSION. + (gpgconf_new): Set VERSION. + (gpgconf_read, gpgconf_write): Use --homedir with recent gnupg. + +2016-11-02 Andras Mantia + + qt: Fix build with g++ 4.8.x. + * lang/qt/src/defaultkeygenerationjob.cpp + (DefaultKeyGenerationJob::start): Explicitly connect pointer + in the QPointer. + +2016-11-02 Andre Heinecke + + qt, cpp: Fix versioning in cmake config and header. + * configure.ac (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO): New + subst variables for the version header. + * lang/cpp/src/GpgmeppConfigVersion.cmake.in, + lang/cpp/src/gpgmepp_version.h.in, + lang/qt/src/QGpgmeConfigVersion.cmake.in, + lang/qt/src/qgpgme_version.h.in: Use new variables. + + qt: Install cmake config into qgpgme subdir. + * lang/qt/src/Makefile.am: Install cmake config file in qgpgme subdir. + + qt: Require gpgmepp from cmake config script. + * lang/qt/src/QGpgmeConfig.cmake.in.in: Require cpp. + + qt, cpp: Add all generated files to cleanfiles. + * cpp/src/Makefile.am (CLEANFILES), + qt/src/Makefile.am (CLEANFILES): Add all generated files + to cleanfiles. + +2016-11-01 Andre Heinecke + + qt: Add Distinguished Name parser from libkleo. + * lang/qt/src/dn.cpp (DN, DN::Attribute): New public API. + * lang/qt/src/dn.h: New. + * lang/qt/src/Makefile.am: Update accordingly. + + qt, cpp: Install version headers in subdirs. + * lang/cpp/src/Makefile.am, + lang/qt/src/Makefile.am: Install version headers in include + subdirs. + +2016-10-31 Justus Winter + + python: Use vanity modules for constants in tests and examples. + * lang/python/gpg/constants/sig/notation.py: New file. + * lang/python/gpg/constants/sig/__init__.py: Import new module. + + * lang/python/examples/assuan.py: Use more specific module for + constants, e.g. 'protocol.ASSUAN' instead of 'PROTOCOL_ASSUAN'. + * lang/python/examples/testCMSgetkey.py: Likewise. + * lang/python/tests/initial.py: Likewise. + * lang/python/tests/t-callbacks.py: Likewise. + * lang/python/tests/t-decrypt-verify.py: Likewise. + * lang/python/tests/t-decrypt.py: Likewise. + * lang/python/tests/t-edit.py: Likewise. + * lang/python/tests/t-encrypt-large.py: Likewise. + * lang/python/tests/t-encrypt-sign.py: Likewise. + * lang/python/tests/t-encrypt-sym.py: Likewise. + * lang/python/tests/t-encrypt.py: Likewise. + * lang/python/tests/t-export.py: Likewise. + * lang/python/tests/t-file-name.py: Likewise. + * lang/python/tests/t-idiomatic.py: Likewise. + * lang/python/tests/t-import.py: Likewise. + * lang/python/tests/t-keylist.py: Likewise. + * lang/python/tests/t-protocol-assuan.py: Likewise. + * lang/python/tests/t-sig-notation.py: Likewise. + * lang/python/tests/t-sign.py: Likewise. + * lang/python/tests/t-signers.py: Likewise. + * lang/python/tests/t-trustlist.py: Likewise. + * lang/python/tests/t-verify.py: Likewise. + * lang/python/tests/t-wait.py: Likewise. + + python: Import the topmost module in tests and examples. + * examples/verifydetails.py: Only import the topmost module 'gpg' and + update the code accordingly. + * tests/support.py: Likewise. + * tests/t-callbacks.py: Likewise. + * tests/t-data.py: Likewise. + * tests/t-decrypt-verify.py: Likewise. + * tests/t-decrypt.py: Likewise. + * tests/t-edit.py: Likewise. + * tests/t-encrypt-large.py: Likewise. + * tests/t-encrypt-sign.py: Likewise. + * tests/t-encrypt-sym.py: Likewise. + * tests/t-encrypt.py: Likewise. + * tests/t-export.py: Likewise. + * tests/t-file-name.py: Likewise. + * tests/t-import.py: Likewise. + * tests/t-keylist.py: Likewise. + * tests/t-sig-notation.py: Likewise. + * tests/t-sign.py: Likewise. + * tests/t-signers.py: Likewise. + * tests/t-trustlist.py: Likewise. + * tests/t-verify.py: Likewise. + * tests/t-wait.py: Likewise. + * tests/t-wrapper.py: Likewise. + + python: Improve constants module. + * lang/python/gpg/constants/__init__.py: Import all modules below + 'constants/'. Interface hygiene: delete 'util'. + * lang/python/gpg/constants/data/encoding.py: Delete 'util'. + * lang/python/gpg/constants/event.py: Likewise. + * lang/python/gpg/constants/import.py: Likewise. + * lang/python/gpg/constants/keylist/mode.py: Likewise. + * lang/python/gpg/constants/md.py: Likewise. + * lang/python/gpg/constants/pk.py: Likewise. + * lang/python/gpg/constants/protocol.py: Likewise. + * lang/python/gpg/constants/sig/mode.py: Likewise. + * lang/python/gpg/constants/sigsum.py: Likewise. + * lang/python/gpg/constants/validity.py: Likewise. + * lang/python/gpg/errors.py: Likewise. + +2016-10-31 Daniel Kahn Gillmor + + python: Rename Python module from PyME to gpg. + This follows weeks of discussion on the gnupg-devel mailing list. + Hopefully it will make it easier for people using Python to use GnuPG + in the future. + +2016-10-25 Werner Koch + + core: New API functions gpgme_set_sender, gpgme_get_sender. + * src/context.h (struct gpgme_context): Add field 'sender'. + * src/gpgme.c: Include mbox-util.h. + (gpgme_release): Free SENDER. + (gpgme_set_sender): New. + (gpgme_get_sender): New. + * src/gpgme.def, src/libgpgme.vers: Add new functions. + + * src/engine-gpg.c (append_args_from_sender): New. + (gpg_encrypt_sign, gpg_sign): Call append_args_from_sender. + (gpg_verify): Add arg CTX. Call append_args_from_sender/ + * src/engine-gpgsm.c (gpgsm_verify): Add dummy arg CTX. + * src/engine-uiserver.c (uiserver_verify): Ditto. + * src/engine.c (_gpgme_engine_op_verify): Add arg CTX. + * src/verify.c (verify_start): Pass CTX to engine function. + + * tests/gpg/t-verify.c (main): Add some checks for new functions. + * tests/run-sign.c (main): Add option --sender. + * tests/run-verify.c (main): Ditto. + +2016-10-19 Andre Heinecke + + qt: Improve WKSPublishJob apidoc. + * lang/qt/src/wkspublishjob.h: Improve doc. + +2016-10-18 Werner Koch + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + Add missing includes. + * lang/cpp/src/key.cpp: Include for 'strcasecmp'. + * tests/gpg/t-cancel.c: Include for 'fd_set' and + friends. + +2016-10-05 Andre Heinecke + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 + + 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 Release 1.7.0. diff -Nru gpgme1.0-1.7.0/config.h.in gpgme1.0-1.8.0/config.h.in --- gpgme1.0-1.7.0/config.h.in 2016-09-21 07:20:05.000000000 +0000 +++ gpgme1.0-1.8.0/config.h.in 2016-11-16 12:29:36.000000000 +0000 @@ -74,9 +74,6 @@ /* Define if the ttyname_r function has a POSIX compliant declaration. */ #undef HAVE_POSIXDECL_TTYNAME_R -/* Define if we have pthread. */ -#undef HAVE_PTHREAD - /* If available, contains the Python version number currently in use. */ #undef HAVE_PYTHON diff -Nru gpgme1.0-1.7.0/configure gpgme1.0-1.8.0/configure --- gpgme1.0-1.7.0/configure 2016-09-21 07:19:28.000000000 +0000 +++ gpgme1.0-1.8.0/configure 2016-11-16 12:46:37.000000000 +0000 @@ -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.8.0. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='gpgme' PACKAGE_TARNAME='gpgme' -PACKAGE_VERSION='1.7.0' -PACKAGE_STRING='gpgme 1.7.0' +PACKAGE_VERSION='1.8.0' +PACKAGE_STRING='gpgme 1.8.0' PACKAGE_BUGREPORT='http://bugs.gnupg.org' PACKAGE_URL='' @@ -705,8 +705,6 @@ GPGME_QT_LIBS GPGME_QT_CFLAGS HAVE_CXX11 -HAVE_PTHREAD_FALSE -HAVE_PTHREAD_TRUE BUILD_W32_GLIB_FALSE BUILD_W32_GLIB_TRUE HAVE_ANDROID_SYSTEM_FALSE @@ -751,6 +749,9 @@ AS CC_FOR_BUILD VERSION_NUMBER +VERSION_MICRO +VERSION_MINOR +VERSION_MAJOR LIBQGPGME_LT_REVISION LIBQGPGME_LT_AGE LIBQGPGME_LT_CURRENT @@ -1454,7 +1455,7 @@ # 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.8.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1524,7 +1525,7 @@ 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.8.0:";; esac cat <<\_ACEOF @@ -1672,7 +1673,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gpgme configure 1.7.0 +gpgme configure 1.8.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2502,7 +2503,7 @@ 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.8.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2865,25 +2866,26 @@ # (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=28 +LIBGPGME_LT_AGE=17 LIBGPGME_LT_REVISION=0 -LIBGPGMEPP_LT_CURRENT=6 -LIBGPGMEPP_LT_AGE=0 -LIBGPGMEPP_LT_REVISION=1 - -LIBQGPGME_LT_CURRENT=6 -LIBQGPGME_LT_AGE=0 -LIBQGPGME_LT_REVISION=1 +# If there is an ABI break in gpgmepp or qgpgme also bump the +# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in + +LIBGPGMEPP_LT_CURRENT=9 +LIBGPGMEPP_LT_AGE=3 +LIBGPGMEPP_LT_REVISION=0 + +LIBQGPGME_LT_CURRENT=8 +LIBQGPGME_LT_AGE=1 +LIBQGPGME_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 ############################################## -NEED_GPG_ERROR_VERSION=1.11 +NEED_GPG_ERROR_VERSION=1.17 NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_VERSION=2.0.2 @@ -2891,6 +2893,10 @@ PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION +VERSION_MAJOR=1 +VERSION_MINOR=8 +VERSION_MICRO=0 + ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then @@ -3410,7 +3416,7 @@ # Define the identity of the package. PACKAGE='gpgme' - VERSION='1.7.0' + VERSION='1.8.0' cat >>confdefs.h <<_ACEOF @@ -6311,6 +6317,9 @@ + + + cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF @@ -6320,7 +6329,7 @@ #define VERSION "$VERSION" _ACEOF -VERSION_NUMBER=0x010700 +VERSION_NUMBER=0x010800 # We need to compile and run a program on the build machine. A @@ -17435,7 +17444,7 @@ $as_echo "no" >&6; } if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" + echo "*** See https://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : @@ -17501,52 +17510,6 @@ ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_create (); -int -main () -{ -return pthread_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes -else - ac_cv_lib_pthread_pthread_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : - have_pthread=yes -fi - - if test "$have_pthread" = yes; then - -$as_echo "#define HAVE_PTHREAD /**/" >>confdefs.h - - fi - # XXX: Probably use exec-prefix here? # GPG_DEFAULT='/usr/bin/gpg' # GPGSM_DEFAULT='/usr/bin/gpgsm' @@ -17634,15 +17597,6 @@ fi - if test "$have_pthread" = "yes"; then - HAVE_PTHREAD_TRUE= - HAVE_PTHREAD_FALSE='#' -else - HAVE_PTHREAD_TRUE='#' - HAVE_PTHREAD_FALSE= -fi - - # Check whether --enable-fixed-path was given. if test "${enable_fixed_path+set}" = set; then : @@ -20630,7 +20584,7 @@ # # Provide information about the build. # -BUILD_REVISION="e7ab753" +BUILD_REVISION="f06220b" cat >>confdefs.h <<_ACEOF @@ -20639,7 +20593,7 @@ BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` -BUILD_FILEVERSION="${BUILD_FILEVERSION}59307" +BUILD_FILEVERSION="${BUILD_FILEVERSION}61538" # Check whether --enable-build-timestamp was given. @@ -21167,6 +21121,7 @@ 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; } @@ -22363,6 +22318,8 @@ ac_config_files="$ac_config_files lang/cpp/Makefile lang/cpp/src/Makefile" +ac_config_files="$ac_config_files lang/cpp/src/GpgmeppConfig-w32.cmake.in" + ac_config_files="$ac_config_files lang/cpp/src/GpgmeppConfig.cmake.in" ac_config_files="$ac_config_files lang/cpp/src/GpgmeppConfigVersion.cmake" @@ -22371,6 +22328,8 @@ ac_config_files="$ac_config_files lang/qt/Makefile lang/qt/src/Makefile" +ac_config_files="$ac_config_files lang/qt/src/QGpgmeConfig-w32.cmake.in" + ac_config_files="$ac_config_files lang/qt/src/QGpgmeConfig.cmake.in" ac_config_files="$ac_config_files lang/qt/src/QGpgmeConfigVersion.cmake" @@ -22387,7 +22346,9 @@ 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/gpg/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 @@ -22562,10 +22523,6 @@ as_fn_error $? "conditional \"BUILD_W32_GLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_PTHREAD_TRUE}" && test -z "${HAVE_PTHREAD_FALSE}"; then - as_fn_error $? "conditional \"HAVE_PTHREAD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${HAVE_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -22991,7 +22948,7 @@ # 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.8.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23057,7 +23014,7 @@ 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.8.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -23664,11 +23621,13 @@ "src/gpgme-config") CONFIG_FILES="$CONFIG_FILES src/gpgme-config" ;; "lang/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES lang/cpp/Makefile" ;; "lang/cpp/src/Makefile") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/Makefile" ;; + "lang/cpp/src/GpgmeppConfig-w32.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/GpgmeppConfig-w32.cmake.in" ;; "lang/cpp/src/GpgmeppConfig.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/GpgmeppConfig.cmake.in" ;; "lang/cpp/src/GpgmeppConfigVersion.cmake") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/GpgmeppConfigVersion.cmake" ;; "lang/cpp/src/gpgmepp_version.h") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/gpgmepp_version.h" ;; "lang/qt/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/Makefile" ;; "lang/qt/src/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/src/Makefile" ;; + "lang/qt/src/QGpgmeConfig-w32.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/qt/src/QGpgmeConfig-w32.cmake.in" ;; "lang/qt/src/QGpgmeConfig.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/qt/src/QGpgmeConfig.cmake.in" ;; "lang/qt/src/QGpgmeConfigVersion.cmake") CONFIG_FILES="$CONFIG_FILES lang/qt/src/QGpgmeConfigVersion.cmake" ;; "lang/qt/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/tests/Makefile" ;; @@ -23679,9 +23638,9 @@ "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/gpg/version.py") CONFIG_FILES="$CONFIG_FILES lang/python/gpg/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 @@ -24414,7 +24373,7 @@ # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# can be downloaded from https://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -25324,6 +25283,7 @@ ;; "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,12 +25326,11 @@ echo " GPGME v${VERSION} has been configured as follows: - Revision: e7ab753 (59307) + Revision: f06220b (61538) Platform: $host UI Server: $uiserver FD Passing: $use_descriptor_passing - GPGME Pthread: $have_pthread Language bindings: ${enabled_languages_v:-$enabled_languages} " diff -Nru gpgme1.0-1.7.0/configure.ac gpgme1.0-1.8.0/configure.ac --- gpgme1.0-1.7.0/configure.ac 2016-09-21 07:18:01.000000000 +0000 +++ gpgme1.0-1.8.0/configure.ac 2016-11-16 12:24:52.000000000 +0000 @@ -16,7 +16,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # (Process this file with autoconf to produce a configure script.) AC_PREREQ(2.59) @@ -28,7 +28,7 @@ # commit and push so that the git magic is able to work. See below # for the LT versions. m4_define(mym4_version_major, [1]) -m4_define(mym4_version_minor, [7]) +m4_define(mym4_version_minor, [8]) m4_define(mym4_version_micro, [0]) # Below is m4 magic to extract and compute the revision number, the @@ -55,25 +55,26 @@ # (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=28 +LIBGPGME_LT_AGE=17 LIBGPGME_LT_REVISION=0 -LIBGPGMEPP_LT_CURRENT=6 -LIBGPGMEPP_LT_AGE=0 -LIBGPGMEPP_LT_REVISION=1 - -LIBQGPGME_LT_CURRENT=6 -LIBQGPGME_LT_AGE=0 -LIBQGPGME_LT_REVISION=1 +# If there is an ABI break in gpgmepp or qgpgme also bump the +# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in + +LIBGPGMEPP_LT_CURRENT=9 +LIBGPGMEPP_LT_AGE=3 +LIBGPGMEPP_LT_REVISION=0 + +LIBQGPGME_LT_CURRENT=8 +LIBQGPGME_LT_AGE=1 +LIBQGPGME_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 ############################################## -NEED_GPG_ERROR_VERSION=1.11 +NEED_GPG_ERROR_VERSION=1.17 NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_VERSION=2.0.2 @@ -81,6 +82,10 @@ PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION +VERSION_MAJOR=mym4_version_major +VERSION_MINOR=mym4_version_minor +VERSION_MICRO=mym4_version_micro + AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(src/gpgme.h.in) @@ -121,6 +126,9 @@ AC_SUBST(PACKAGE) AC_SUBST(VERSION) +AC_SUBST(VERSION_MAJOR) +AC_SUBST(VERSION_MINOR) +AC_SUBST(VERSION_MICRO) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package]) VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \ @@ -206,11 +214,6 @@ ;; *) - AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes) - if test "$have_pthread" = yes; then - AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.]) - fi - # XXX: Probably use exec-prefix here? # GPG_DEFAULT='/usr/bin/gpg' # GPGSM_DEFAULT='/usr/bin/gpgsm' @@ -252,8 +255,6 @@ AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes) -AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes") - AC_ARG_ENABLE([fixed-path], AC_HELP_STRING([--enable-fixed-path=PATH], @@ -588,6 +589,7 @@ 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 @@ -874,10 +876,12 @@ src/gpgme.h) AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config) AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile) +AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in) AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in) AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake) AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h) AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile) +AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in) AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in) AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake) AC_CONFIG_FILES(lang/qt/tests/Makefile) @@ -886,9 +890,9 @@ 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/gpg/version.py lang/python/tests/Makefile]) +AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py]) AC_OUTPUT echo " @@ -899,7 +903,6 @@ UI Server: $uiserver FD Passing: $use_descriptor_passing - GPGME Pthread: $have_pthread Language bindings: ${enabled_languages_v:-$enabled_languages} " diff -Nru gpgme1.0-1.7.0/debian/changelog gpgme1.0-1.8.0/debian/changelog --- gpgme1.0-1.7.0/debian/changelog 2016-09-22 21:18:21.000000000 +0000 +++ gpgme1.0-1.8.0/debian/changelog 2016-11-23 06:39:59.000000000 +0000 @@ -1,3 +1,96 @@ +gpgme1.0 (1.8.0-2) unstable; urgency=medium + + * pull a cleanup patch from upstream + * move to unstable + + -- Daniel Kahn Gillmor Wed, 23 Nov 2016 01:39:59 -0500 + +gpgme1.0 (1.8.0-1) experimental; urgency=medium + + * new upstream release + - drops gpgme-pthread variant (we replace .so with symlink) + - moves python binding name from "pyme" to "gpg" + * no need for pasv in debian/watch + * filter another auto-generated file at import-orig + * re-enable pie, it is needed to build Qt properly now + * avoid installing python bytecode and unnecessary package metadata + * update build-dep gpg-error version requirements to track configure.ac + * add new symbols + * drop C++ and QT .symbols files, do only strict versioning. + + -- Daniel Kahn Gillmor Fri, 18 Nov 2016 19:15:37 -0500 + +gpgme1.0 (1.7.1-3) experimental; urgency=medium + + [ Sandro Knauß ] + * Add pkgkde-symbolshelper to handle c++ bindings + * consolidate main dh rule + + [ Daniel Kahn Gillmor ] + * libgpgmepp-dev Breaks+Replaces: kdepimlibs5 (Closes: #842061) + * convert C++ symbols files to something readable + + -- Daniel Kahn Gillmor Tue, 01 Nov 2016 04:24:29 -0400 + +gpgme1.0 (1.7.1-2) experimental; urgency=medium + + * more general cleanup of upstream tarball in debian/gbp.conf + * ensure that source version makes it through to python-pyme-dbgsym + + -- Daniel Kahn Gillmor Tue, 25 Oct 2016 12:21:41 -0400 + +gpgme1.0 (1.7.1-1) experimental; urgency=medium + + * new upstream release. + - change from libqgpgme6 to libqgpgme7 + + -- Daniel Kahn Gillmor Thu, 20 Oct 2016 00:06:13 -0400 + +gpgme1.0 (1.7.0-5) experimental; urgency=medium + + * apply debian patches ahead of upstream patches. + * more fixes from upstream for 32-bit platforms + + -- Daniel Kahn Gillmor Fri, 14 Oct 2016 21:36:25 -0400 + +gpgme1.0 (1.7.0-4) experimental; urgency=medium + + * avoid failures on 32-bit platforms (along with more + upsteam python fixes) + * avoid shipping unready pdf documentation + * ensure that python-pyme-dbgsym has the right versioning + + -- Daniel Kahn Gillmor Fri, 14 Oct 2016 16:28:30 -0400 + +gpgme1.0 (1.7.0-3) experimental; urgency=medium + + * improve dependencies for libgpgmepp-dev package + * fix Vcs-Browser link + * fix debian/watch + * Add an epoch to python-pyme + * ship documentation as well in an arch:all package + * avoid irreproducible documentation + + -- Daniel Kahn Gillmor Wed, 12 Oct 2016 18:46:16 -0400 + +gpgme1.0 (1.7.0-2) experimental; urgency=medium + + [ Daniel Kahn Gillmor ] + * avoid -pie since it conflicts with -fpic when building + * add python3-pyme and python-pyme binary packages + * clean up autogenerated files + * bump to debhelper 10 + * rename binary package from libgpgme11-dev to libgpgme-dev + + [ Sandro Knauß ] + * Enable cpp and qt lang support + + [ Daniel Kahn Gillmor ] + * avoid lintian warnings about executable cmake files + * prepare new libgpgmepp-dev package + + -- Daniel Kahn Gillmor Wed, 12 Oct 2016 07:28:59 -0400 + gpgme1.0 (1.7.0-1) unstable; urgency=medium * new upstream release diff -Nru gpgme1.0-1.7.0/debian/clean gpgme1.0-1.8.0/debian/clean --- gpgme1.0-1.7.0/debian/clean 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/clean 2016-11-23 06:38:41.000000000 +0000 @@ -1,6 +1,14 @@ +aclocal.m4 +config.h.in +configure +doc/gpgme.info* +lang/python/tests/__pycache__/ +lang/python/tests/S.* +lang/python/tests/support.pyc +*/*/*/Makefile.in +*/*/Makefile.in +*/Makefile.in +Makefile.in tests/gpg/*.gpg tests/gpg/S.gpg-agent tests/gpgsm/S.gpg-agent -lang/python/tests/support.pyc -lang/python/tests/__pycache__/ -doc/gpgme.info* diff -Nru gpgme1.0-1.7.0/debian/compat gpgme1.0-1.8.0/debian/compat --- gpgme1.0-1.7.0/debian/compat 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/compat 2016-11-23 06:38:41.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru gpgme1.0-1.7.0/debian/control gpgme1.0-1.8.0/debian/control --- gpgme1.0-1.7.0/debian/control 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/control 2016-11-23 06:38:41.000000000 +0000 @@ -7,21 +7,31 @@ Daniel Kahn Gillmor , Build-Depends: automake (>= 1.14), - debhelper (>> 9~), + debhelper (>= 10~), dh-autoreconf, + dh-exec, + dh-python, gnupg-agent, gnupg2 | gnupg (>= 2), gpgsm, libassuan-dev (>> 2.0.2), - libgpg-error-dev (>> 1.8), + libgpg-error-dev (>> 1.17), + pkg-config, + python-all-dev, + python3-all-dev, + qtbase5-dev, scdaemon, + swig, texinfo, +Build-Depends-Indep: + doxygen, + graphviz, Standards-Version: 3.9.8 Homepage: https://www.gnupg.org/related_software/gpgme/ Vcs-Git: https://anonscm.debian.org/git/pkg-gnupg/gpgme.git -Vcs-Browser: https://anonscm.debian.org/git/kg-gnupg/gpgme.git +Vcs-Browser: https://anonscm.debian.org/git/pkg-gnupg/gpgme.git -Package: libgpgme11-dev +Package: libgpgme-dev Section: libdevel Architecture: any Depends: @@ -30,9 +40,13 @@ libgpg-error-dev, libgpgme11 (= ${binary:Version}), ${misc:Depends}, -Conflicts: - libgpgme-dev, - libgpgme10-dev, + ${shlibs:Depends}, +Breaks: + libgpgme11-dev, +Replaces: + libgpgme11-dev, +Provides: + libgpgme11-dev, Description: GPGME - GnuPG Made Easy (development files) GPGME is a wrapper library which provides a C API to access some of the GnuPG functions, such as encrypt, decrypt, sign, verify, ... @@ -56,3 +70,121 @@ GnuPG functions, such as encrypt, decrypt, sign, verify, ... . This package contains the library. + +Package: python3-gpg +Architecture: any +Section: python +Provides: + ${python3:Provides}, +Depends: + ${misc:Depends}, + ${python3:Depends}, + ${shlibs:Depends}, +Description: Python interface to the GPGME GnuPG encryption library (Python 3) + The "gpg" Python module is, for the most part, a direct interface to + the C GPGME library. However, it is re-packaged in a more Pythonic + way -- object-oriented with classes and modules. Take a look at the + classes defined here -- they correspond directly to certain object + types in GPGME for C. + . + Features: + * Feature-rich, full implementation of the GPGME library. Supports + all GPGME features except interactive editing (coming soon). + Callback functions may be written in pure Python. + * Ability to sign, encrypt, decrypt, and verify data. + * Ability to list keys, export and import keys, and manage the keyring. + * Fully object-oriented with convenient classes and modules. + . + This is the official upstream Python 3 binding for GPGME. + +Package: python-gpg +Architecture: any +Section: python +Provides: + ${python:Provides}, +Depends: + ${misc:Depends}, + ${python:Depends}, + ${shlibs:Depends}, +Description: Python interface to the GPGME GnuPG encryption library (Python 2) + The "gpg" Python module is, for the most part, a direct interface to + the C GPGME library. However, it is re-packaged in a more Pythonic + way -- object-oriented with classes and modules. Take a look at the + classes defined here -- they correspond directly to certain object + types in GPGME for C. + . + Features: + * Feature-rich, full implementation of the GPGME library. Supports + all GPGME features except interactive editing (coming soon). + Callback functions may be written in pure Python. + * Ability to sign, encrypt, decrypt, and verify data. + * Ability to list keys, export and import keys, and manage the keyring. + * Fully object-oriented with convenient classes and modules. + . + This is the official upstream Python 2 binding for GPGME. + +Package: libqgpgme7 +Architecture: any +Multi-Arch: same +Depends: + ${misc:Depends}, + ${shlibs:Depends}, +Description: library for GPGME integration with Qt + QGpgME is a library that provides GPGME integration with QEventLoop + and some Qt datatypes (e.g. QByteArray). + . + This is the official upstream Qt binding for GPGME. + +Package: libgpgmepp6 +Architecture: any +Multi-Arch: same +Depends: + ${misc:Depends}, + ${shlibs:Depends}, +Description: C++ wrapper library for GPGME + GpgME++ (aka GpgMEpp) is a C++ wrapper (or C++ bindings) for the + GnuPG project's GPGME (GnuPG Made Easy) library. + . + This is the official upstream C++ binding for GPGME. + +Package: libgpgmepp-dev +Section: libdevel +Architecture: any +Depends: + libgpgmepp6 (= ${binary:Version}), + libqgpgme7 (= ${binary:Version}), + qtbase5-dev, + ${misc:Depends}, + ${shlibs:Depends}, +Recommends: + libgpgmepp-doc (= ${binary:Version}), +Breaks: + kdepimlibs5-dev +Replaces: + kdepimlibs5-dev +Description: C++ and Qt bindings for GPGME (development files) + GpgME++ (aka GpgMEpp) is a C++ wrapper (or C++ bindings) for the + GnuPG project's GPGME (GnuPG Made Easy) library. + . + QGpgME is a library that provides GPGME integration with QEventLoop + and some Qt datatypes (e.g. QByteArray). + . + This package contains the headers and other files needed to compile + against either of these libraries. + +Package: libgpgmepp-doc +Section: doc +Architecture: all +Depends: + ${misc:Depends}, +Suggests: + libgpgmepp-dev, +Description: C++ and Qt bindings for GPGME (documentation for developers) + GpgME++ (aka GpgMEpp) is a C++ wrapper (or C++ bindings) for the + GnuPG project's GPGME (GnuPG Made Easy) library. + . + QGpgME is a library that provides GPGME integration with QEventLoop + and some Qt datatypes (e.g. QByteArray). + . + This package contains documentation for developers describing how to + use these packages. diff -Nru gpgme1.0-1.7.0/debian/copyright gpgme1.0-1.8.0/debian/copyright --- gpgme1.0-1.7.0/debian/copyright 2016-09-22 21:01:54.000000000 +0000 +++ gpgme1.0-1.8.0/debian/copyright 2016-11-23 06:38:41.000000000 +0000 @@ -25,7 +25,7 @@ Copyright: 2003, 2006, 2008 g10 Code GmbH License: GPL-2+ -Files: lang/python/* lang/python/*/* lang/python/pyme/constants/* lang/python/pyme/constants/*/* +Files: lang/python/* lang/python/*/* lang/python/gpg/constants/* lang/python/gpg/constants/*/* Copyright: 2002 John Goerzen, 2004-2008 Igor Belyi, diff -Nru gpgme1.0-1.7.0/debian/gbp.conf gpgme1.0-1.8.0/debian/gbp.conf --- gpgme1.0-1.7.0/debian/gbp.conf 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/gbp.conf 2016-11-23 06:38:41.000000000 +0000 @@ -26,40 +26,14 @@ 'm4/ltsugar.m4', 'm4/ltversion.m4', 'm4/lt~obsolete.m4', - 'lang/python/pyme/gpgme.py', - 'lang/python/pyme/version.py', - 'lang/python/pyme/__pycache__/*', - 'lang/qt/src/AddUserIDJob', - 'lang/qt/src/ChangeExpiryJob', - 'lang/qt/src/ChangeOwnerTrustJob', - 'lang/qt/src/ChangePasswdJob', + 'lang/python/gpg/gpgme.py', + 'lang/python/gpg/version.py', + 'lang/python/gpg/__pycache__/*', + 'lang/qt/src/*Job', 'lang/qt/src/CryptoConfig', 'lang/qt/src/DataProvider', - 'lang/qt/src/DecryptJob', - 'lang/qt/src/DecryptVerifyJob', - 'lang/qt/src/DefaultKeyGenerationJob', - 'lang/qt/src/DeleteJob', - 'lang/qt/src/DownloadJob', - 'lang/qt/src/EncryptJob', - 'lang/qt/src/ExportJob', - 'lang/qt/src/HierarchicalKeyKistJob', - 'lang/qt/src/ImportFromKeyserverJob', - 'lang/qt/src/ImportJob', - 'lang/qt/src/Job', - 'lang/qt/src/KeyForMailboxJob', - 'lang/qt/src/KeyGenerationJob', - 'lang/qt/src/KeyListJob', - 'lang/qt/src/ListAllKeysJob', - 'lang/qt/src/MultiDeleteJob', + 'lang/qt/src/DN', 'lang/qt/src/Protocol', 'lang/qt/src/QGpgMENewCryptoConfig', - 'lang/qt/src/RefreshKeysJob', - 'lang/qt/src/SignEncryptJob', - 'lang/qt/src/SignJob', - 'lang/qt/src/SignKeyJob', - 'lang/qt/src/TofuPolicyJob', - 'lang/qt/src/VerifyDetachedJob', - 'lang/qt/src/VerifyOpaqueJob', - 'lang/qt/src/WKSPublishJob', ] filter-pristine-tar = False diff -Nru gpgme1.0-1.7.0/debian/libgpgme11-dev.doc-base gpgme1.0-1.8.0/debian/libgpgme11-dev.doc-base --- gpgme1.0-1.7.0/debian/libgpgme11-dev.doc-base 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme11-dev.doc-base 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Document: gpgme -Title: gpgme -Abstract: GPGME is a wrapper library which provides a C API to access some of the - GnuPG functions, such as encrypt, decrypt, sign, verify, ... - . - This package contains the headers and other files needed to compile - against this library. -Section: Programming/C - -Format: info -Index: /usr/share/info/gpgme.info.gz -Files: /usr/share/info/gpgme.info* diff -Nru gpgme1.0-1.7.0/debian/libgpgme11-dev.install gpgme1.0-1.8.0/debian/libgpgme11-dev.install --- gpgme1.0-1.7.0/debian/libgpgme11-dev.install 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme11-dev.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -usr/bin/gpgme-config -usr/bin/gpgme-tool -usr/include/ -usr/lib/*/lib*.a -usr/lib/*/lib*.so -usr/share/aclocal/ -usr/share/info/*info* diff -Nru gpgme1.0-1.7.0/debian/libgpgme11-dev.manpages gpgme1.0-1.8.0/debian/libgpgme11-dev.manpages --- gpgme1.0-1.7.0/debian/libgpgme11-dev.manpages 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme11-dev.manpages 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -debian/gpgme-config.1 -debian/gpgme-tool.1 diff -Nru gpgme1.0-1.7.0/debian/libgpgme11.install gpgme1.0-1.8.0/debian/libgpgme11.install --- gpgme1.0-1.7.0/debian/libgpgme11.install 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme11.install 2016-11-23 06:38:41.000000000 +0000 @@ -1 +1 @@ -usr/lib/*/lib*.so.* +usr/lib/*/libgpgme.so.* diff -Nru gpgme1.0-1.7.0/debian/libgpgme11.links gpgme1.0-1.8.0/debian/libgpgme11.links --- gpgme1.0-1.7.0/debian/libgpgme11.links 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme11.links 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,2 @@ +#! /usr/bin/dh-exec +usr/lib/${DEB_HOST_MULTIARCH}/libgpgme.so.11 usr/lib/${DEB_HOST_MULTIARCH}/libgpgme-pthread.so.11 diff -Nru gpgme1.0-1.7.0/debian/libgpgme11.symbols gpgme1.0-1.8.0/debian/libgpgme11.symbols --- gpgme1.0-1.7.0/debian/libgpgme11.symbols 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme11.symbols 2016-11-23 06:38:41.000000000 +0000 @@ -1,192 +1,7 @@ -libgpgme-pthread.so.11 libgpgme11 #MINVER# - GPGME_1.0@GPGME_1.0 1.1.2 - GPGME_1.1@GPGME_1.1 1.1.2 - gpgme_cancel@GPGME_1.0 1.1.2 - gpgme_cancel_async@GPGME_1.1 1.1.8 - gpgme_check_version@GPGME_1.0 1.1.2 - gpgme_check_version_internal@GPGME_1.1 1.2.0 - gpgme_conf_arg_new@GPGME_1.1 1.1.8 - gpgme_conf_arg_release@GPGME_1.1 1.1.8 - gpgme_conf_opt_change@GPGME_1.1 1.1.8 - gpgme_conf_release@GPGME_1.1 1.1.6 - gpgme_ctx_get_engine_info@GPGME_1.1 1.1.2 - gpgme_ctx_set_engine_info@GPGME_1.1 1.1.6 - gpgme_data_get_encoding@GPGME_1.0 1.1.2 - gpgme_data_get_file_name@GPGME_1.1 1.1.2 - gpgme_data_identify@GPGME_1.1 1.4.3 - gpgme_data_new@GPGME_1.0 1.1.2 - gpgme_data_new_from_cbs@GPGME_1.0 1.1.2 - gpgme_data_new_from_fd@GPGME_1.0 1.1.2 - gpgme_data_new_from_file@GPGME_1.0 1.1.2 - gpgme_data_new_from_filepart@GPGME_1.0 1.1.2 - gpgme_data_new_from_mem@GPGME_1.0 1.1.2 - gpgme_data_new_from_stream@GPGME_1.0 1.1.2 - gpgme_data_new_with_read_cb@GPGME_1.0 1.1.2 - gpgme_data_read@GPGME_1.0 1.1.2 - gpgme_data_release@GPGME_1.0 1.1.2 - gpgme_data_release_and_get_mem@GPGME_1.0 1.1.2 - gpgme_data_rewind@GPGME_1.0 1.1.2 - gpgme_data_seek@GPGME_1.0 1.1.2 - gpgme_data_set_encoding@GPGME_1.0 1.1.2 - gpgme_data_set_file_name@GPGME_1.1 1.1.2 - gpgme_data_set_flag@GPGME_1.1 1.7.0 - gpgme_data_write@GPGME_1.0 1.1.2 - gpgme_engine_check_version@GPGME_1.0 1.1.2 - gpgme_err_code_from_errno@GPGME_1.0 1.1.2 - gpgme_err_code_from_syserror@GPGME_1.0 1.3.2 - gpgme_err_code_to_errno@GPGME_1.0 1.1.2 - gpgme_err_make_from_errno@GPGME_1.0 1.1.2 - gpgme_err_set_errno@GPGME_1.0 1.3.2 - gpgme_error_from_errno@GPGME_1.0 1.1.2 - gpgme_free@GPGME_1.1 1.1.2 - gpgme_get_armor@GPGME_1.0 1.1.2 - gpgme_get_dirinfo@GPGME_1.1 1.5.0 - gpgme_get_engine_info@GPGME_1.0 1.1.2 - gpgme_get_include_certs@GPGME_1.0 1.1.2 - gpgme_get_io_cbs@GPGME_1.0 1.1.2 - gpgme_get_key@GPGME_1.0 1.1.2 - gpgme_get_keylist_mode@GPGME_1.0 1.1.2 - gpgme_get_offline@GPGME_1.1 1.6.0 - gpgme_get_passphrase_cb@GPGME_1.0 1.1.2 - gpgme_get_pinentry_mode@GPGME_1.1 1.4.1 - gpgme_get_progress_cb@GPGME_1.0 1.1.2 - gpgme_get_protocol@GPGME_1.0 1.1.2 - gpgme_get_protocol_name@GPGME_1.0 1.1.6 - gpgme_get_sig_key@GPGME_1.0 1.1.2 - gpgme_get_sig_status@GPGME_1.0 1.1.2 - gpgme_get_sig_string_attr@GPGME_1.0 1.1.2 - gpgme_get_sig_ulong_attr@GPGME_1.0 1.1.2 - gpgme_get_status_cb@GPGME_1.1 1.6.0 - gpgme_get_sub_protocol@GPGME_1.1 1.3.2 - gpgme_get_textmode@GPGME_1.0 1.1.2 - gpgme_hash_algo_name@GPGME_1.0 1.1.2 - gpgme_io_read@GPGME_1.1 1.2.0 - gpgme_io_write@GPGME_1.1 1.2.0 - gpgme_io_writen@GPGME_1.1 1.4.1 - gpgme_key_from_uid@GPGME_1.1 1.3.2 - gpgme_key_get_string_attr@GPGME_1.0 1.1.2 - gpgme_key_get_ulong_attr@GPGME_1.0 1.1.2 - gpgme_key_ref@GPGME_1.0 1.1.2 - gpgme_key_release@GPGME_1.0 1.1.2 - gpgme_key_sig_get_string_attr@GPGME_1.0 1.1.2 - gpgme_key_sig_get_ulong_attr@GPGME_1.0 1.1.2 - gpgme_key_unref@GPGME_1.0 1.1.2 - gpgme_new@GPGME_1.0 1.1.2 - gpgme_op_adduid@GPGME_1.1 1.7.0 - gpgme_op_adduid_start@GPGME_1.1 1.7.0 - gpgme_op_assuan_result@GPGME_1.1 1.2.0 - gpgme_op_assuan_transact@GPGME_1.1 1.2.0 - gpgme_op_assuan_transact_ext@GPGME_1.1 1.3.2 - gpgme_op_assuan_transact_start@GPGME_1.1 1.2.0 - gpgme_op_card_edit@GPGME_1.0 1.1.2 - gpgme_op_card_edit_start@GPGME_1.0 1.1.2 - gpgme_op_conf_load@GPGME_1.1 1.1.6 - gpgme_op_conf_save@GPGME_1.1 1.1.6 - gpgme_op_createkey@GPGME_1.1 1.7.0 - gpgme_op_createkey_start@GPGME_1.1 1.7.0 - gpgme_op_createsubkey@GPGME_1.1 1.7.0 - gpgme_op_createsubkey_start@GPGME_1.1 1.7.0 - gpgme_op_decrypt@GPGME_1.0 1.1.2 - gpgme_op_decrypt_result@GPGME_1.0 1.1.2 - gpgme_op_decrypt_start@GPGME_1.0 1.1.2 - gpgme_op_decrypt_verify@GPGME_1.0 1.1.2 - gpgme_op_decrypt_verify_start@GPGME_1.0 1.1.2 - gpgme_op_delete@GPGME_1.0 1.1.2 - gpgme_op_delete_start@GPGME_1.0 1.1.2 - gpgme_op_edit@GPGME_1.0 1.1.2 - gpgme_op_edit_start@GPGME_1.0 1.1.2 - gpgme_op_encrypt@GPGME_1.0 1.1.2 - gpgme_op_encrypt_result@GPGME_1.0 1.1.2 - gpgme_op_encrypt_sign@GPGME_1.0 1.1.2 - gpgme_op_encrypt_sign_start@GPGME_1.0 1.1.2 - gpgme_op_encrypt_start@GPGME_1.0 1.1.2 - gpgme_op_export@GPGME_1.0 1.1.2 - gpgme_op_export_ext@GPGME_1.0 1.1.2 - gpgme_op_export_ext_start@GPGME_1.0 1.1.2 - gpgme_op_export_keys@GPGME_1.1 1.2.0 - gpgme_op_export_keys_start@GPGME_1.1 1.2.0 - gpgme_op_export_start@GPGME_1.0 1.1.2 - gpgme_op_genkey@GPGME_1.0 1.1.2 - gpgme_op_genkey_result@GPGME_1.0 1.1.2 - gpgme_op_genkey_start@GPGME_1.0 1.1.2 - gpgme_op_getauditlog@GPGME_1.1 1.1.6 - gpgme_op_getauditlog_start@GPGME_1.1 1.1.6 - gpgme_op_import@GPGME_1.0 1.1.2 - gpgme_op_import_ext@GPGME_1.0 1.1.2 - gpgme_op_import_keys@GPGME_1.1 1.2.0 - gpgme_op_import_keys_start@GPGME_1.1 1.2.0 - gpgme_op_import_result@GPGME_1.0 1.1.2 - gpgme_op_import_start@GPGME_1.0 1.1.2 - gpgme_op_interact@GPGME_1.1 1.7.0 - gpgme_op_interact_start@GPGME_1.1 1.7.0 - gpgme_op_keylist_end@GPGME_1.0 1.1.2 - gpgme_op_keylist_ext_start@GPGME_1.0 1.1.2 - gpgme_op_keylist_next@GPGME_1.0 1.1.2 - gpgme_op_keylist_result@GPGME_1.0 1.1.2 - gpgme_op_keylist_start@GPGME_1.0 1.1.2 - gpgme_op_keysign@GPGME_1.1 1.7.0 - gpgme_op_keysign_start@GPGME_1.1 1.7.0 - gpgme_op_passwd@GPGME_1.1 1.3.2 - gpgme_op_passwd_start@GPGME_1.1 1.3.2 - gpgme_op_revuid@GPGME_1.1 1.7.0 - gpgme_op_revuid_start@GPGME_1.1 1.7.0 - gpgme_op_sign@GPGME_1.0 1.1.2 - gpgme_op_sign_result@GPGME_1.0 1.1.2 - gpgme_op_sign_start@GPGME_1.0 1.1.2 - gpgme_op_spawn@GPGME_1.1 1.5.0 - gpgme_op_spawn_start@GPGME_1.1 1.5.0 - gpgme_op_tofu_policy@GPGME_1.1 1.7.0 - gpgme_op_tofu_policy_start@GPGME_1.1 1.7.0 - gpgme_op_trustlist_end@GPGME_1.0 1.1.2 - gpgme_op_trustlist_next@GPGME_1.0 1.1.2 - gpgme_op_trustlist_start@GPGME_1.0 1.1.2 - gpgme_op_verify@GPGME_1.0 1.1.2 - gpgme_op_verify_result@GPGME_1.0 1.1.2 - gpgme_op_verify_start@GPGME_1.0 1.1.2 - gpgme_op_vfs_create@GPGME_1.1 1.3.2 - gpgme_op_vfs_mount@GPGME_1.1 1.3.2 - gpgme_op_vfs_mount_result@GPGME_1.1 1.3.2 - gpgme_pubkey_algo_name@GPGME_1.0 1.1.2 - gpgme_pubkey_algo_string@GPGME_1.1 1.7.0 - gpgme_release@GPGME_1.0 1.1.2 - gpgme_result_ref@GPGME_1.1 1.2.0 - gpgme_result_unref@GPGME_1.1 1.2.0 - gpgme_set_armor@GPGME_1.0 1.1.2 - gpgme_set_ctx_flag@GPGME_1.1 1.7.0 - gpgme_set_engine_info@GPGME_1.1 1.1.6 - gpgme_set_global_flag@GPGME_1.1 1.4.1 - gpgme_set_include_certs@GPGME_1.0 1.1.2 - gpgme_set_io_cbs@GPGME_1.0 1.1.2 - gpgme_set_keylist_mode@GPGME_1.0 1.1.2 - gpgme_set_locale@GPGME_1.0 1.1.2 - gpgme_set_offline@GPGME_1.1 1.6.0 - gpgme_set_passphrase_cb@GPGME_1.0 1.1.2 - gpgme_set_pinentry_mode@GPGME_1.1 1.4.1 - gpgme_set_progress_cb@GPGME_1.0 1.1.2 - gpgme_set_protocol@GPGME_1.0 1.1.6 - gpgme_set_status_cb@GPGME_1.1 1.6.0 - gpgme_set_sub_protocol@GPGME_1.1 1.3.2 - gpgme_set_textmode@GPGME_1.0 1.1.2 - gpgme_sig_notation_add@GPGME_1.1 1.1.2 - gpgme_sig_notation_clear@GPGME_1.1 1.1.2 - gpgme_sig_notation_get@GPGME_1.1 1.1.2 - gpgme_signers_add@GPGME_1.0 1.1.2 - gpgme_signers_clear@GPGME_1.0 1.1.2 - gpgme_signers_count@GPGME_1.0 1.4.3 - gpgme_signers_enum@GPGME_1.0 1.1.2 - gpgme_strerror@GPGME_1.0 1.1.2 - gpgme_strerror_r@GPGME_1.0 1.1.2 - gpgme_strsource@GPGME_1.0 1.1.2 - gpgme_trust_item_get_int_attr@GPGME_1.0 1.1.2 - gpgme_trust_item_get_string_attr@GPGME_1.0 1.1.2 - gpgme_trust_item_ref@GPGME_1.0 1.1.2 - gpgme_trust_item_release@GPGME_1.0 1.1.2 - gpgme_trust_item_unref@GPGME_1.0 1.1.2 - gpgme_wait@GPGME_1.0 1.1.2 - gpgme_wait_ext@GPGME_1.1 1.3.2 libgpgme.so.11 libgpgme11 #MINVER# GPGME_1.0@GPGME_1.0 1.1.2 GPGME_1.1@GPGME_1.1 1.1.2 + gpgme_addrspec_from_uid@GPGME_1.1 1.7.1 gpgme_cancel@GPGME_1.0 1.1.2 gpgme_cancel_async@GPGME_1.1 1.1.8 gpgme_check_version@GPGME_1.0 1.1.2 @@ -226,6 +41,7 @@ gpgme_error_from_errno@GPGME_1.0 1.1.2 gpgme_free@GPGME_1.1 1.1.2 gpgme_get_armor@GPGME_1.0 1.1.2 + gpgme_get_ctx_flag@GPGME_1.1 1.8.0 gpgme_get_dirinfo@GPGME_1.1 1.5.0 gpgme_get_engine_info@GPGME_1.0 1.1.2 gpgme_get_include_certs@GPGME_1.0 1.1.2 @@ -238,6 +54,7 @@ gpgme_get_progress_cb@GPGME_1.0 1.1.2 gpgme_get_protocol@GPGME_1.0 1.1.2 gpgme_get_protocol_name@GPGME_1.0 1.1.6 + gpgme_get_sender@GPGME_1.1 1.8.0 gpgme_get_sig_key@GPGME_1.0 1.1.2 gpgme_get_sig_status@GPGME_1.0 1.1.2 gpgme_get_sig_string_attr@GPGME_1.0 1.1.2 @@ -314,6 +131,8 @@ gpgme_op_keysign_start@GPGME_1.1 1.7.0 gpgme_op_passwd@GPGME_1.1 1.3.2 gpgme_op_passwd_start@GPGME_1.1 1.3.2 + gpgme_op_query_swdb@GPGME_1.1 1.8.0 + gpgme_op_query_swdb_result@GPGME_1.1 1.8.0 gpgme_op_revuid@GPGME_1.1 1.7.0 gpgme_op_revuid_start@GPGME_1.1 1.7.0 gpgme_op_sign@GPGME_1.0 1.1.2 @@ -350,6 +169,7 @@ gpgme_set_pinentry_mode@GPGME_1.1 1.4.1 gpgme_set_progress_cb@GPGME_1.0 1.1.2 gpgme_set_protocol@GPGME_1.0 1.1.6 + gpgme_set_sender@GPGME_1.1 1.8.0 gpgme_set_status_cb@GPGME_1.1 1.6.0 gpgme_set_sub_protocol@GPGME_1.1 1.3.2 gpgme_set_textmode@GPGME_1.0 1.1.2 diff -Nru gpgme1.0-1.7.0/debian/libgpgme-dev.doc-base gpgme1.0-1.8.0/debian/libgpgme-dev.doc-base --- gpgme1.0-1.7.0/debian/libgpgme-dev.doc-base 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme-dev.doc-base 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,12 @@ +Document: gpgme +Title: gpgme +Abstract: GPGME is a wrapper library which provides a C API to access some of the + GnuPG functions, such as encrypt, decrypt, sign, verify, ... + . + This package contains the headers and other files needed to compile + against this library. +Section: Programming/C + +Format: info +Index: /usr/share/info/gpgme.info.gz +Files: /usr/share/info/gpgme.info* diff -Nru gpgme1.0-1.7.0/debian/libgpgme-dev.install gpgme1.0-1.8.0/debian/libgpgme-dev.install --- gpgme1.0-1.7.0/debian/libgpgme-dev.install 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme-dev.install 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,7 @@ +usr/bin/gpgme-config +usr/bin/gpgme-tool +usr/include/gpgme.h +usr/lib/*/libgpgme.a +usr/lib/*/libgpgme.so +usr/share/aclocal/ +usr/share/info/*info* diff -Nru gpgme1.0-1.7.0/debian/libgpgme-dev.manpages gpgme1.0-1.8.0/debian/libgpgme-dev.manpages --- gpgme1.0-1.7.0/debian/libgpgme-dev.manpages 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgme-dev.manpages 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,2 @@ +debian/gpgme-config.1 +debian/gpgme-tool.1 diff -Nru gpgme1.0-1.7.0/debian/libgpgmepp6.docs gpgme1.0-1.8.0/debian/libgpgmepp6.docs --- gpgme1.0-1.7.0/debian/libgpgmepp6.docs 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgmepp6.docs 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +lang/cpp/README diff -Nru gpgme1.0-1.7.0/debian/libgpgmepp6.install gpgme1.0-1.8.0/debian/libgpgmepp6.install --- gpgme1.0-1.7.0/debian/libgpgmepp6.install 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgmepp6.install 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/libgpgmepp.so.* diff -Nru gpgme1.0-1.7.0/debian/libgpgmepp-dev.install gpgme1.0-1.8.0/debian/libgpgmepp-dev.install --- gpgme1.0-1.7.0/debian/libgpgmepp-dev.install 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgmepp-dev.install 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,8 @@ +usr/include/QGpgME +usr/include/gpgme++ +usr/include/qgpgme +usr/lib/*/cmake +usr/lib/*/libgpgmepp.a +usr/lib/*/libgpgmepp.so +usr/lib/*/libqgpgme.a +usr/lib/*/libqgpgme.so diff -Nru gpgme1.0-1.7.0/debian/libgpgmepp-dev.links gpgme1.0-1.8.0/debian/libgpgmepp-dev.links --- gpgme1.0-1.7.0/debian/libgpgmepp-dev.links 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgmepp-dev.links 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,2 @@ +usr/share/doc/libgpgmepp6/README usr/share/doc/libgpgmepp-dev/README.gpgmepp +usr/share/doc/libqgpgme/README usr/share/doc/libgpgmepp-dev/README.qgpgme diff -Nru gpgme1.0-1.7.0/debian/libgpgmepp-doc.doc-base gpgme1.0-1.8.0/debian/libgpgmepp-doc.doc-base --- gpgme1.0-1.7.0/debian/libgpgmepp-doc.doc-base 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgmepp-doc.doc-base 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,15 @@ +Document: libgpgmepp-qgpgme +Title: Programmer documentation for GpgMEpp and QGpgME +Abstract: + GpgMEpp is the canonical C++ binding for GPGME, "GnuPG Made Easy". + QGpgME is a binding to Qt on top of GpgMEpp, and is integrated into + the Qt event model. + . + This is documentation designed to help programmers and system + designers make use of these higher-level bindings to use GnuPG in an + automated fashion. +Section: Programming/C++ + +Format: html +Index: /usr/share/doc/libgpgmepp-doc/html/index.html +Files: /usr/share/doc/libgpgmepp-doc/html/* /usr/share/doc/libgpgmepp-doc/html/*/* diff -Nru gpgme1.0-1.7.0/debian/libgpgmepp-doc.docs gpgme1.0-1.8.0/debian/libgpgmepp-doc.docs --- gpgme1.0-1.7.0/debian/libgpgmepp-doc.docs 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libgpgmepp-doc.docs 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +lang/qt/doc/generated/html/ diff -Nru gpgme1.0-1.7.0/debian/libqgpgme7.docs gpgme1.0-1.8.0/debian/libqgpgme7.docs --- gpgme1.0-1.7.0/debian/libqgpgme7.docs 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libqgpgme7.docs 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +lang/qt/README diff -Nru gpgme1.0-1.7.0/debian/libqgpgme7.install gpgme1.0-1.8.0/debian/libqgpgme7.install --- gpgme1.0-1.7.0/debian/libqgpgme7.install 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/libqgpgme7.install 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/*/libqgpgme.so.* diff -Nru gpgme1.0-1.7.0/debian/patches/0001-avoid-identifying-as-beta.patch gpgme1.0-1.8.0/debian/patches/0001-avoid-identifying-as-beta.patch --- gpgme1.0-1.7.0/debian/patches/0001-avoid-identifying-as-beta.patch 2016-09-22 21:18:21.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/0001-avoid-identifying-as-beta.patch 2016-11-23 06:39:10.000000000 +0000 @@ -11,7 +11,7 @@ 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac -index c9d16af..1a8d33a 100644 +index 0a67b48..9a5372e 100644 --- a/configure.ac +++ b/configure.ac @@ -37,13 +37,10 @@ m4_define(mym4_version_micro, [0]) diff -Nru gpgme1.0-1.7.0/debian/patches/0002-doc-Fix-minor-errors-in-I-O-callback-example.patch gpgme1.0-1.8.0/debian/patches/0002-doc-Fix-minor-errors-in-I-O-callback-example.patch --- gpgme1.0-1.7.0/debian/patches/0002-doc-Fix-minor-errors-in-I-O-callback-example.patch 2016-09-22 21:13:08.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/0002-doc-Fix-minor-errors-in-I-O-callback-example.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -From: Daiki Ueno -Date: Tue, 9 Feb 2016 17:03:50 +0900 -Subject: doc: Fix minor errors in I/O callback example - -* gpgme.texi (I/O Callback Example): Fix typos, add timeout to select, -and initialize mutex as recursive. - -Signed-off-by: Daiki Ueno ---- - doc/gpgme.texi | 22 +++++++++++++++++----- - 1 file changed, 17 insertions(+), 5 deletions(-) - -diff --git a/doc/gpgme.texi b/doc/gpgme.texi -index ec7ebb7..6d6d692 100644 ---- a/doc/gpgme.texi -+++ b/doc/gpgme.texi -@@ -6016,6 +6016,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 +6025,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 +6086,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 +6096,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 -Nru gpgme1.0-1.7.0/debian/patches/0002-Remove-a-forgotten-instance-of-libsuffix.patch gpgme1.0-1.8.0/debian/patches/0002-Remove-a-forgotten-instance-of-libsuffix.patch --- gpgme1.0-1.7.0/debian/patches/0002-Remove-a-forgotten-instance-of-libsuffix.patch 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/0002-Remove-a-forgotten-instance-of-libsuffix.patch 2016-11-23 06:39:10.000000000 +0000 @@ -0,0 +1,29 @@ +From: Heiko Becker +Date: Wed, 16 Nov 2016 23:09:45 +0100 +Subject: Remove a forgotten instance of @libsuffix@ + +* lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove a forgotten +instance of @libsuffix@. +-- + +b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a removed @libsuffix@ from +cmake config files, but missed one instance. + +Signed-off-by: Heiko Becker +--- + lang/cpp/src/GpgmeppConfig.cmake.in.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in +index 928d19f..cbe9713 100644 +--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in ++++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in +@@ -63,7 +63,7 @@ add_library(Gpgmepp SHARED IMPORTED) + + set_target_properties(Gpgmepp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@" +- INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@" ++ INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.so;@LIBASSUAN_LIBS@" + IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so" + ) + diff -Nru gpgme1.0-1.7.0/debian/patches/0003-tests-Fix-select-usage-in-t-eventloop.patch gpgme1.0-1.8.0/debian/patches/0003-tests-Fix-select-usage-in-t-eventloop.patch --- gpgme1.0-1.7.0/debian/patches/0003-tests-Fix-select-usage-in-t-eventloop.patch 2016-09-22 21:13:08.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/0003-tests-Fix-select-usage-in-t-eventloop.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -From: Daiki Ueno -Date: Tue, 9 Feb 2016 17:03:51 +0900 -Subject: tests: Fix select usage in t-eventloop - -* tests/gpg/t-eventloop.c (do_select): Supply timeout value to select. - -Signed-off-by: Daiki Ueno ---- - tests/gpg/t-eventloop.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -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 -Nru gpgme1.0-1.7.0/debian/patches/0004-gpg-Add-option-exit-on-status-write-error.patch gpgme1.0-1.8.0/debian/patches/0004-gpg-Add-option-exit-on-status-write-error.patch --- gpgme1.0-1.7.0/debian/patches/0004-gpg-Add-option-exit-on-status-write-error.patch 2016-09-22 21:13:08.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/0004-gpg-Add-option-exit-on-status-write-error.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -From: Daiki Ueno -Date: Tue, 9 Feb 2016 17:03:53 +0900 -Subject: gpg: Add option --exit-on-status-write-error - -* src/engine-gpg.c (gpg_new): Add --exit-on-status-write-error if the -engine version is latest enough to expect progress output from gpg. - --- -GnuPG-bug-id: 1415 -Signed-off-by: Daiki Ueno - -Changed the version test from the patch to use the newer -have_gpg_version. - -Signed-off-by: Werner Koch ---- - src/engine-gpg.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/engine-gpg.c b/src/engine-gpg.c -index 8bb348f..3f1d34d 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; - diff -Nru gpgme1.0-1.7.0/debian/patches/0005-tests-Add-test-for-cancellation.patch gpgme1.0-1.8.0/debian/patches/0005-tests-Add-test-for-cancellation.patch --- gpgme1.0-1.7.0/debian/patches/0005-tests-Add-test-for-cancellation.patch 2016-09-22 21:13:08.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/0005-tests-Add-test-for-cancellation.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,312 +0,0 @@ -From: Daiki Ueno -Date: Tue, 9 Feb 2016 17:03:54 +0900 -Subject: tests: Add test for cancellation - -* tests/gpg/t-cancel.c: New file. -* tests/gpg/Makefile.am (tests_skipped): New variable, default to -t-genkey and t-cancel. -(noinst_PROGRAMS): Add $(tests_skipped). -* tests/gpg/.gitignore: Add t-cancel. - -Signed-off-by: Daiki Ueno ---- - tests/gpg/Makefile.am | 12 ++- - tests/gpg/t-cancel.c | 265 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 275 insertions(+), 2 deletions(-) - create mode 100644 tests/gpg/t-cancel.c - -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/t-cancel.c b/tests/gpg/t-cancel.c -new file mode 100644 -index 0000000..af98af9 ---- /dev/null -+++ b/tests/gpg/t-cancel.c -@@ -0,0 +1,265 @@ -+/* 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 -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#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 = "\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" -+ "\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 -Nru gpgme1.0-1.7.0/debian/patches/series gpgme1.0-1.8.0/debian/patches/series --- gpgme1.0-1.7.0/debian/patches/series 2016-09-22 21:13:08.000000000 +0000 +++ gpgme1.0-1.8.0/debian/patches/series 2016-11-23 06:39:10.000000000 +0000 @@ -1,5 +1,2 @@ 0001-avoid-identifying-as-beta.patch -0002-doc-Fix-minor-errors-in-I-O-callback-example.patch -0003-tests-Fix-select-usage-in-t-eventloop.patch -0004-gpg-Add-option-exit-on-status-write-error.patch -0005-tests-Add-test-for-cancellation.patch +0002-Remove-a-forgotten-instance-of-libsuffix.patch diff -Nru gpgme1.0-1.7.0/debian/python3-gpg.install gpgme1.0-1.8.0/debian/python3-gpg.install --- gpgme1.0-1.7.0/debian/python3-gpg.install 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/python3-gpg.install 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,7 @@ +debian/tmp/usr/lib/python3*/site-packages/gpg*.egg-info usr/lib/python3/dist-packages +debian/tmp/usr/lib/python3*/site-packages/gpg/*.py usr/lib/python3/dist-packages/gpg +debian/tmp/usr/lib/python3*/site-packages/gpg/_gpgme*.so usr/lib/python3/dist-packages/gpg +debian/tmp/usr/lib/python3*/site-packages/gpg/constants/*.py usr/lib/python3/dist-packages/gpg/constants +debian/tmp/usr/lib/python3*/site-packages/gpg/constants/data/*.py usr/lib/python3/dist-packages/gpg/constants/data +debian/tmp/usr/lib/python3*/site-packages/gpg/constants/keylist/*.py usr/lib/python3/dist-packages/gpg/constants/keylist +debian/tmp/usr/lib/python3*/site-packages/gpg/constants/sig/*.py usr/lib/python3/dist-packages/gpg/constants/sig diff -Nru gpgme1.0-1.7.0/debian/python3-pyme.examples gpgme1.0-1.8.0/debian/python3-pyme.examples --- gpgme1.0-1.7.0/debian/python3-pyme.examples 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/python3-pyme.examples 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +lang/python/examples/*.py diff -Nru gpgme1.0-1.7.0/debian/python-gpg.install gpgme1.0-1.8.0/debian/python-gpg.install --- gpgme1.0-1.7.0/debian/python-gpg.install 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/python-gpg.install 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1,7 @@ +debian/tmp/usr/lib/python2.7/site-packages/gpg*.egg-info usr/lib/python2.7/dist-packages +debian/tmp/usr/lib/python2.7/site-packages/gpg/*.py usr/lib/python2.7/dist-packages/gpg +debian/tmp/usr/lib/python2.7/site-packages/gpg/_gpgme*.so usr/lib/python2.7/dist-packages/gpg +debian/tmp/usr/lib/python2.7/site-packages/gpg/constants/*.py usr/lib/python2.7/dist-packages/gpg/constants +debian/tmp/usr/lib/python2.7/site-packages/gpg/constants/data/*.py usr/lib/python2.7/dist-packages/gpg/constants/data +debian/tmp/usr/lib/python2.7/site-packages/gpg/constants/keylist/*.py usr/lib/python2.7/dist-packages/gpg/constants/keylist +debian/tmp/usr/lib/python2.7/site-packages/gpg/constants/sig/*.py usr/lib/python2.7/dist-packages/gpg/constants/sig diff -Nru gpgme1.0-1.7.0/debian/python-pyme.examples gpgme1.0-1.8.0/debian/python-pyme.examples --- gpgme1.0-1.7.0/debian/python-pyme.examples 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/debian/python-pyme.examples 2016-11-23 06:38:41.000000000 +0000 @@ -0,0 +1 @@ +lang/python/examples/*.py diff -Nru gpgme1.0-1.7.0/debian/rules gpgme1.0-1.8.0/debian/rules --- gpgme1.0-1.7.0/debian/rules 2016-09-22 21:05:54.000000000 +0000 +++ gpgme1.0-1.8.0/debian/rules 2016-11-23 06:38:41.000000000 +0000 @@ -1,18 +1,23 @@ #!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export QT_SELECT := qt5 +export DEBIAN_VERSION = $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/.*: //p') %: - dh $@ --with autoreconf --parallel + dh $@ --with autoreconf,python2,python3 override_dh_auto_configure: dh_auto_configure -- \ --enable-static \ - --enable-languages=no \ + --enable-languages="python cpp qt" \ --infodir=/usr/share/info override_dh_install: - dh_install --list-missing -X.la -Xinfo/dir + dh_install --list-missing -X.la -Xinfo/dir -X.pyc -Xinstall_files.txt -X__pycache__ override_dh_makeshlibs: dh_makeshlibs -V + +override_dh_installdocs: + dh_installdocs -X.md5 diff -Nru gpgme1.0-1.7.0/debian/watch gpgme1.0-1.8.0/debian/watch --- gpgme1.0-1.7.0/debian/watch 2016-09-22 18:44:24.000000000 +0000 +++ gpgme1.0-1.8.0/debian/watch 2016-11-23 06:38:41.000000000 +0000 @@ -1,2 +1,2 @@ version=4 -opts=pasv,pgpsigurlmangle=s/$/.sig/ https://gnupg.org/ftp/gcrypt/gpgme/@ANY_VERSION@@ARCHIVE_EXT@ +opts=pgpsigurlmangle=s/$/.sig/ https://gnupg.org/ftp/gcrypt/gpgme/gpgme@ANY_VERSION@@ARCHIVE_EXT@ diff -Nru gpgme1.0-1.7.0/doc/ChangeLog-2011 gpgme1.0-1.8.0/doc/ChangeLog-2011 --- gpgme1.0-1.7.0/doc/ChangeLog-2011 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/doc/ChangeLog-2011 2016-10-18 17:22:02.000000000 +0000 @@ -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 diff -Nru gpgme1.0-1.7.0/doc/defsincdate gpgme1.0-1.8.0/doc/defsincdate --- gpgme1.0-1.7.0/doc/defsincdate 2016-08-10 14:05:36.000000000 +0000 +++ gpgme1.0-1.8.0/doc/defsincdate 2016-11-16 12:29:37.000000000 +0000 @@ -1 +1 @@ -1440576360 +1479299220 diff -Nru gpgme1.0-1.7.0/doc/gpgme.info gpgme1.0-1.8.0/doc/gpgme.info --- gpgme1.0-1.7.0/doc/gpgme.info 2016-09-19 07:05:56.000000000 +0000 +++ gpgme1.0-1.8.0/doc/gpgme.info 2016-11-16 12:29:43.000000000 +0000 @@ -19,8 +19,8 @@ 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.8.0-beta50, last updated 16 November 2016, of ‘The +‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50. Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH. @@ -38,127 +38,129 @@  Indirect: gpgme.info-1: 1686 -gpgme.info-2: 304664 +gpgme.info-2: 314031  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: Introduction9293 +Node: Getting Started10083 +Node: Features11544 +Node: Overview12856 +Node: Preparation13965 +Node: Header14962 +Node: Building the Source15709 +Node: Largefile Support (LFS)17853 +Node: Using Automake23267 +Node: Using Libtool25820 +Node: Library Version Check26182 +Node: Signal Handling32194 +Node: Multi-Threading33464 +Ref: Multi-Threading-Footnote-134880 +Node: Protocols and Engines35303 +Node: Engine Version Check37948 +Node: Engine Information40365 +Node: Engine Configuration44225 +Node: OpenPGP45509 +Node: Cryptographic Message Syntax45849 +Node: Assuan46162 +Node: Algorithms46536 +Ref: Algorithms-Footnote-147015 +Node: Public Key Algorithms47143 +Node: Hash Algorithms49630 +Node: Error Handling50820 +Node: Error Values52694 +Node: Error Sources57897 +Node: Error Codes60337 +Node: Error Strings65128 +Node: Exchanging Data66935 +Node: Creating Data Buffers68801 +Node: Memory Based Data Buffers69317 +Node: File Based Data Buffers72750 +Node: Callback Based Data Buffers74952 +Node: Destroying Data Buffers79143 +Node: Manipulating Data Buffers80631 +Node: Data Buffer I/O Operations81123 +Node: Data Buffer Meta-Data83496 +Node: Data Buffer Convenience87862 +Node: Contexts89839 +Node: Creating Contexts91025 +Node: Destroying Contexts91872 +Node: Result Management92211 +Node: Context Attributes93754 +Node: Protocol Selection94791 +Node: Crypto Engine95823 +Node: Setting the Sender97673 +Node: ASCII Armor99148 +Node: Text Mode99777 +Node: Offline Mode100711 +Node: Pinentry Mode101783 +Node: Included Certificates103468 +Node: Key Listing Mode104890 +Node: Passphrase Callback108982 +Node: Progress Meter Callback112369 +Node: Status Message Callback114354 +Node: Locale118175 +Node: Key Management119734 +Node: Key objects120962 +Node: Listing Keys131962 +Node: Information About Keys139408 +Node: Manipulating Keys140716 +Node: Generating Keys141286 +Node: Signing Keys156760 +Node: Exporting Keys160358 +Node: Importing Keys167051 +Ref: Importing Keys-Footnote-1173956 +Node: Deleting Keys174084 +Node: Changing Passphrases175529 +Node: Changing TOFU Data176818 +Node: Advanced Key Editing178869 +Node: Trust Item Management181518 +Node: Listing Trust Items182554 +Node: Manipulating Trust Items184915 +Node: Crypto Operations185558 +Node: Decrypt186822 +Node: Verify191524 +Node: Decrypt and Verify203484 +Node: Sign206320 +Node: Selecting Signers206884 +Node: Creating a Signature208271 +Node: Signature Notation Data213041 +Node: Encrypt215269 +Node: Encrypting a Plaintext215625 +Node: Miscellaneous222588 +Node: Running other Programs223000 +Node: Using the Assuan protocol225076 +Node: Checking for updates227798 +Node: Run Control232556 +Node: Waiting For Completion233300 +Node: Using External Event Loops235418 +Node: I/O Callback Interface237390 +Node: Registering I/O Callbacks242628 +Node: I/O Callback Example244666 +Node: I/O Callback Example GTK+251291 +Node: I/O Callback Example GDK253080 +Node: I/O Callback Example Qt254722 +Node: Cancellation257010 +Node: UI Server Protocol259280 +Ref: UI Server Protocol-Footnote-1260715 +Node: UI Server Encrypt260834 +Node: UI Server Sign266192 +Node: UI Server Decrypt268545 +Node: UI Server Verify270200 +Node: UI Server Set Input Files273772 +Node: UI Server Sign/Encrypt Files274842 +Node: UI Server Verify/Decrypt Files276650 +Node: UI Server Import/Export Keys278526 +Node: UI Server Checksum Files279588 +Node: Miscellaneous UI Server Commands281804 +Ref: command SENDER283735 +Node: Debugging285437 +Node: Deprecated Functions287186 +Node: Library Copying314031 +Node: Copying342247 +Node: Concept Index379997 +Node: Function and Data Index394776  End Tag Table diff -Nru gpgme1.0-1.7.0/doc/gpgme.info-1 gpgme1.0-1.8.0/doc/gpgme.info-1 --- gpgme1.0-1.7.0/doc/gpgme.info-1 2016-09-19 07:05:55.000000000 +0000 +++ gpgme1.0-1.8.0/doc/gpgme.info-1 2016-11-16 12:29:43.000000000 +0000 @@ -19,8 +19,8 @@ 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.8.0-beta50, last updated 16 November 2016, of ‘The +‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50. Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH. @@ -41,8 +41,8 @@ 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 +This is Edition 1.8.0-beta50, last updated 16 November 2016, of ‘The +‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50 of the GPGME library. * Menu: @@ -88,7 +88,7 @@ * Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Signal Handling:: How GPGME affects signal handling. -* Multi Threading:: How GPGME can be used in an MT environment. +* Multi-Threading:: How GPGME can be used in an MT environment. Protocols and Engines @@ -144,6 +144,7 @@ * Protocol Selection:: Selecting the protocol used by a context. * Crypto Engine:: Configuring the crypto engine. +* Setting the Sender:: How to tell the engine the sender. * ASCII Armor:: Requesting ASCII armored output. * Text Mode:: Choosing canonical text mode. * Offline Mode:: Choosing offline mode. @@ -194,7 +195,9 @@ Miscellaneous -* Running other Programs:: Running other Programs +* Running other Programs:: Running other Programs. +* Using the Assuan protocol:: Using the Assuan protocol. +* Checking for updates:: How to check for software updates. Run Control @@ -343,7 +346,7 @@ * Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Signal Handling:: How GPGME affects signal handling. -* Multi Threading:: How GPGME can be used in an MT environment. +* Multi-Threading:: How GPGME can be used in an MT environment.  File: gpgme.info, Node: Header, Next: Building the Source, Up: Preparation @@ -407,11 +410,6 @@ gcc -o foo foo.c `gpgme-config --cflags --libs` - If you want to link to one of the thread-safe versions of GPGME, you -must specify the ‘--thread’ option before any other option to select the -thread package you want to link with. Supported thread packages are -‘--thread=pth’ and ‘--thread=pthread’. - If you need to detect the installed language bindings you can use list them using: @@ -552,7 +550,9 @@ ‘AM_PATH_GPGME_PTHREAD’ checks for the version of GPGME that can be used with the native pthread implementation, and defines - ‘GPGME_PTHREAD_CFLAGS’ and ‘GPGME_PTHREAD_LIBS’. + ‘GPGME_PTHREAD_CFLAGS’ and ‘GPGME_PTHREAD_LIBS’. Since version + 1.8.0 this is no longer required to GPGME_PTHREAD as GPGME itself + is thread safe. This macro searches for ‘gpgme-config’ along the PATH. If you are cross-compiling, it is useful to set the environment variable @@ -707,7 +707,7 @@ portability to W32 systems.  -File: gpgme.info, Node: Signal Handling, Next: Multi Threading, Prev: Library Version Check, Up: Preparation +File: gpgme.info, Node: Signal Handling, Next: Multi-Threading, Prev: Library Version Check, Up: Preparation 2.7 Signal Handling =================== @@ -732,28 +732,14 @@ either before ‘gpgme_check_version’ is called or afterwards.  -File: gpgme.info, Node: Multi Threading, Prev: Signal Handling, Up: Preparation +File: gpgme.info, Node: Multi-Threading, Prev: Signal Handling, Up: Preparation -2.8 Multi Threading +2.8 Multi-Threading =================== -The GPGME library is not entirely thread-safe, but it can still be used -in a multi-threaded environment if some care is taken. If the following -requirements are met, there should be no race conditions to worry about: - - • GPGME supports the thread libraries pthread and GNU Pth. The - support for this has to be enabled at compile time. GPGME will - automatically detect the location in which the thread libraries are - installed and activate the support for them at build time. - - Support for other thread libraries is very easy to add. Please - contact us if you have the need. - - • If you want to use GPGME with threads, you must link to the right - version of the library. The name of the right library is - ‘libgpgme-’ followed by the name of the thread package you use. - For example, if you use GNU Pth, the right name is ‘libgpgme-pth’. - Use the Automake macros or ‘gpgme-config’ program for simplicity. +The GPGME library is mostly thread-safe, and can be used in a +multi-threaded environment but there are some requirements for +multi-threaded use: • The function ‘gpgme_check_version’ must be called before any other function in the library, because it initializes the thread support @@ -2167,10 +2153,11 @@ The detailed result of an operation is returned in operation-specific structures such as ‘gpgme_decrypt_result_t’. The corresponding retrieval functions such as ‘gpgme_op_decrypt_result’ provide static -access to the results after an operation completes. The following -interfaces make it possible to detach a result structure from its -associated context and give it a lifetime beyond that of the current -operation or context. +access to the results after an operation completes. Those structures +shall be considered read-only and an application must not allocate such +a structure on its own. The following interfaces make it possible to +detach a result structure from its associated context and give it a +lifetime beyond that of the current operation or context. -- Function: void gpgme_result_ref (void *RESULT) The function ‘gpgme_result_ref’ acquires an additional reference @@ -2199,6 +2186,7 @@ * Protocol Selection:: Selecting the protocol used by a context. * Crypto Engine:: Configuring the crypto engine. +* Setting the Sender:: How to tell the engine the sender. * ASCII Armor:: Requesting ASCII armored output. * Text Mode:: Choosing canonical text mode. * Offline Mode:: Choosing offline mode. @@ -2236,7 +2224,7 @@ use with the context CTX.  -File: gpgme.info, Node: Crypto Engine, Next: ASCII Armor, Prev: Protocol Selection, Up: Context Attributes +File: gpgme.info, Node: Crypto Engine, Next: Setting the Sender, Prev: Protocol Selection, Up: Context Attributes 7.4.2 Crypto Engine ------------------- @@ -2280,9 +2268,42 @@ successful, or an eror code on failure.  -File: gpgme.info, Node: ASCII Armor, Next: Text Mode, Prev: Crypto Engine, Up: Context Attributes +File: gpgme.info, Node: Setting the Sender, Next: ASCII Armor, Prev: Crypto Engine, Up: Context Attributes + +7.4.3 How to tell the engine the sender. +---------------------------------------- + +Some engines can make use of the sender’s address, for example to figure +out the best user id in certain trust models. For verification and +signing of mails, it is thus suggested to let the engine know the sender +("From:") address. GPGME provides two functions to accomplish that. +Note that the esoteric use of multiple "From:" addresses is not +supported. + + -- Function: gpgme_error_t gpgme_set_sender (gpgme_ctx_t CTX, + int ADDRESS) + + The function ‘gpgme_set_sender’ specifies the sender address for + use in sign and verify operations. ADDRESS is expected to be the + “addr-spec” part of an address but my also be a complete mailbox + address, in which case this function extracts the “addr-spec” from + it. Using ‘NULL’ for ADDRESS clears the sender address. -7.4.3 ASCII Armor + The function returns 0 on success or an error code on failure. The + most likely failure is that no valid “addr-spec” was found in + ADDRESS. + + -- Function: const char * gpgme_get_sender (gpgme_ctx_t CTX) + + The function ‘gpgme_get_sender’ returns the current sender address + from the context, or NULL if none was set. The returned value is + valid as long as the CTX is valid and ‘gpgme_set_sender’ has not + been called again. + + +File: gpgme.info, Node: ASCII Armor, Next: Text Mode, Prev: Setting the Sender, Up: Context Attributes + +7.4.4 ASCII Armor ----------------- -- Function: void gpgme_set_armor (gpgme_ctx_t CTX, int YES) @@ -2299,7 +2320,7 @@  File: gpgme.info, Node: Text Mode, Next: Offline Mode, Prev: ASCII Armor, Up: Context Attributes -7.4.4 Text Mode +7.4.5 Text Mode --------------- -- Function: void gpgme_set_textmode (gpgme_ctx_t CTX, int YES) @@ -2323,7 +2344,7 @@  File: gpgme.info, Node: Offline Mode, Next: Pinentry Mode, Prev: Text Mode, Up: Context Attributes -7.4.5 Offline Mode +7.4.6 Offline Mode ------------------ -- Function: void gpgme_set_offline (gpgme_ctx_t CTX, int YES) @@ -2350,7 +2371,7 @@  File: gpgme.info, Node: Pinentry Mode, Next: Included Certificates, Prev: Offline Mode, Up: Context Attributes -7.4.6 Pinentry Mode +7.4.7 Pinentry Mode ------------------- -- Function: gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t CTX, @@ -2395,7 +2416,7 @@  File: gpgme.info, Node: Included Certificates, Next: Key Listing Mode, Prev: Pinentry Mode, Up: Context Attributes -7.4.7 Included Certificates +7.4.8 Included Certificates --------------------------- -- Function: void gpgme_set_include_certs (gpgme_ctx_t CTX, @@ -2433,7 +2454,7 @@  File: gpgme.info, Node: Key Listing Mode, Next: Passphrase Callback, Prev: Included Certificates, Up: Context Attributes -7.4.8 Key Listing Mode +7.4.9 Key Listing Mode ---------------------- -- Function: gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t CTX, @@ -2516,8 +2537,8 @@  File: gpgme.info, Node: Passphrase Callback, Next: Progress Meter Callback, Prev: Key Listing Mode, Up: Context Attributes -7.4.9 Passphrase Callback -------------------------- +7.4.10 Passphrase Callback +-------------------------- -- Data type: gpgme_error_t (*gpgme_passphrase_cb_t)(void *HOOK, const char *UID_HINT, const char *PASSPHRASE_INFO, int PREV_WAS_BAD, @@ -2585,7 +2606,7 @@  File: gpgme.info, Node: Progress Meter Callback, Next: Status Message Callback, Prev: Passphrase Callback, Up: Context Attributes -7.4.10 Progress Meter Callback +7.4.11 Progress Meter Callback ------------------------------ -- Data type: void (*gpgme_progress_cb_t)(void *HOOK, const char *WHAT, @@ -2627,7 +2648,7 @@  File: gpgme.info, Node: Status Message Callback, Next: Locale, Prev: Progress Meter Callback, Up: Context Attributes -7.4.11 Status Message Callback +7.4.12 Status Message Callback ------------------------------ -- Data type: gpgme_error_t (*gpgme_status_cb_t)(void *HOOK, const char @@ -2680,12 +2701,36 @@ ("~") will not be removed from the ‘description’ field of the ‘gpgme_tofu_info_t’ object. + ‘"export-session-key"’ + Using a VALUE of "1" specifies that the context should try to + export the symmetric session key when decrypting data. By + default, or when using an empty string or "0" for VALUE, + session keys are not exported. + + ‘"override-session-key"’ + The string given in VALUE is passed to the GnuPG engine to + override the session key for decryption. The format of that + session key is specific to GnuPG and can be retrieved during a + decrypt operation when the context flag "export-session-key" + is enabled. Please be aware that using this feature with + GnuPG < 2.1.16 will leak the session key on many platforms via + ps(1). + This function returns ‘0’ on success. + -- Function: const char * gpgme_get_ctx_flag (gpgme_ctx_t CTX, + const char *NAME) + + The value of flags settable by ‘gpgme_set_ctx_flag’ can be + retrieved by this function. If NAME is unknown the function + returns ‘NULL’. For boolean flags an empty string is returned for + False and the string "1" is returned for True; either atoi(3) or a + test for an empty string can be used to get the boolean value. +  File: gpgme.info, Node: Locale, Prev: Status Message Callback, Up: Context Attributes -7.4.12 Locale +7.4.13 Locale ------------- A locale setting can be associated with a context. This locale is @@ -4349,8 +4394,10 @@ This is a pointer to a structure used to store the result of a ‘gpgme_op_decrypt’ operation. After successfully decrypting data, you can retrieve the pointer to the result with - ‘gpgme_op_decrypt_result’. The structure contains the following - members: + ‘gpgme_op_decrypt_result’. As with all result structures, it this + structure shall be considered read-only and an application must not + allocated such a strucure on its own. The structure contains the + following members: ‘char *unsupported_algorithm’ If an unsupported algorithm was encountered, this string @@ -4367,6 +4414,19 @@ This is the filename of the original plaintext message file if it is known, otherwise this is a null pointer. + ‘char *session_key’ + A textual representation (nul-terminated string) of the + session key used in symmetric encryption of the message, if + the context has been set to export session keys (see + ‘gpgme_set_ctx_flag, "export-session-key"’), and a session key + was available for the most recent decryption operation. + Otherwise, this is a null pointer. + + You must not try to access this member of the struct unless + ‘gpgme_set_ctx_flag (ctx, "export-session-key")’ returns + success or ‘gpgme_get_ctx_flag (ctx, "export-session-key")’ + returns true (non-empty string). + -- Function: gpgme_decrypt_result_t gpgme_op_decrypt_result (gpgme_ctx_t CTX) The function ‘gpgme_op_decrypt_result’ returns a @@ -4682,8 +4742,8 @@ not be retrieved, and passes through any errors that are reported by the crypto engine support routines. - -- Function: gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t CTX, - gpgme_data_t CIPHER, gpgme_data_t PLAIN) + -- Function: gpgme_error_t gpgme_op_decrypt_verify_start + (gpgme_ctx_t CTX, gpgme_data_t CIPHER, gpgme_data_t PLAIN) The function ‘gpgme_op_decrypt_verify_start’ initiates a ‘gpgme_op_decrypt_verify’ operation. It can be completed by calling ‘gpgme_wait’ on the context. *Note Waiting For @@ -4694,6 +4754,21 @@ 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 @@ -5069,6 +5144,7 @@ * Running other Programs:: Running other Programs * Using the Assuan protocol:: Using the Assuan protocol +* Checking for updates:: How to check for software updates  File: gpgme.info, Node: Running other Programs, Next: Using the Assuan protocol, Up: Miscellaneous @@ -5116,7 +5192,7 @@ This is the asynchronous variant of ‘gpgme_op_spawn’.  -File: gpgme.info, Node: Using the Assuan protocol, Prev: Running other Programs, Up: Miscellaneous +File: gpgme.info, Node: Using the Assuan protocol, Next: Checking for updates, Prev: Running other Programs, Up: Miscellaneous 7.8.2 Using the Assuan protocol ------------------------------- @@ -5180,6 +5256,134 @@ Synchronous variant.  +File: gpgme.info, Node: Checking for updates, Prev: Using the Assuan protocol, Up: Miscellaneous + +7.8.3 How to check for software updates +--------------------------------------- + +The GnuPG Project operates a server to query the current versions of +software packages related to GnuPG. GPGME can be used to access this +online database and check whether a new version of a software package is +available. + + -- Data type: gpgme_query_swdb_result_t + This is a pointer to a structure used to store the result of a + ‘gpgme_op_query_swdb’ operation. After success full call to that + function, you can retrieve the pointer to the result with + ‘gpgme_op_query_swdb_result’. The structure contains the following + member: + + ‘name’ + This is the name of the package. + + ‘iversion’ + The currently installed version or an empty string. This + value is either a copy of the argument given to + ‘gpgme_op_query_swdb’ or the version of the installed software + as figured out by GPGME or GnuPG. + + ‘created’ + This gives the date the file with the list of version numbers + has originally be created by the GnuPG project. + + ‘retrieved’ + This gives the date the file was downloaded. + + ‘warning’ + If this flag is set either an error has occurred or some of + the information in this structure are not properly set. For + example if the version number of the installed software could + not be figured out, the ‘update’ flag may not reflect a + required update status. + + ‘update’ + If this flag is set an update of the software is available. + + ‘urgent’ + If this flag is set an available update is important. + + ‘noinfo’ + If this flag is set, no valid information could be retrieved. + + ‘unknown’ + If this flag is set the given ‘name’ is not known. + + ‘tooold’ + If this flag is set the available information is not fresh + enough. + + ‘error’ + If this flag is set some other error has occured. + + ‘version’ + The version string of the latest released version. + + ‘reldate’ + The release date of the latest released version. + + -- Function: gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t CTX, + const char *NAME, const char *IVERSION, gpgme_data_t RESERVED) + + Query the software version database for software package NAME and + check against the installed version given by IVERSION. If IVERSION + is given as ‘NULL’ a check is only done if GPGME can figure out the + version by itself (for example when using "gpgme" or "gnupg"). If + ‘NULL’ is used for NAME the current gpgme version is checked. + RESERVED must be set to 0. + + -- Function: gpgme_query_swdb_result_t gpgme_op_query_swdb_result + (gpgme_ctx_t CTX) + + The function ‘gpgme_op_query_swdb_result’ returns a + ‘gpgme_query_swdb_result_t’ pointer to a structure holding the + result of a ‘gpgme_op_query_swdb’ operation. The pointer is only + valid if the last operation on the context was a sucessful call to + ‘gpgme_op_query_swdb’. If that call failed, the result might be a + ‘NULL’ pointer. The returned pointer is only valid until the next + operation is started on the context CTX. + +Here is an example on how to check whether GnuPG is current: + + #include + + int + main (void) + { + gpg_error_t err; + gpgme_ctx_t ctx; + gpgme_query_swdb_result_t result; + + gpgme_check_version (NULL); + err = gpgme_new (&ctx); + if (err) + fprintf (stderr, "error creating context: %s\n", gpg_strerror (err)); + else + { + gpgme_set_protocol (ctx, GPGME_PROTOCOL_GPGCONF); + + err = gpgme_op_query_swdb (ctx, "gnupg", NULL, 0); + if (err) + fprintf (stderr, "error querying swdb: %s\n", gpg_strerror (err)); + else + { + result = gpgme_op_query_swdb_result (ctx); + if (!result) + fprintf (stderr, "error querying swdb\n"); + if (!result->warning && !result->update) + printf ("GnuPG version %s is current\n", + result->iversion); + else if (!result->warning && result->update) + printf ("GnuPG version %s can be updated to %s\n", + result->iversion, result->version); + else + fprintf (stderr, "error finding the update status\n"); + } + gpgme_release (ctx); + } + return 0; + } + + File: gpgme.info, Node: Run Control, Prev: Miscellaneous, Up: Contexts 7.9 Run Control @@ -5550,6 +5754,7 @@ 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 +5763,14 @@ 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 +5822,7 @@ 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 +5832,19 @@ &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; @@ -5874,11 +6090,11 @@ this case the state of CTX is not modified). -- Function: gpgme_ctx_t gpgme_cancel_async (gpgme_ctx_t CTX) - The function ‘gpgme_cancel’ attempts to cancel a pending operation - in the context CTX. This can be called by any thread at any time - after starting an operation on the context, but will not take - effect immediately. The actual cancellation happens at the next - time GPGME processes I/O in that context. + The function ‘gpgme_cancel_async’ attempts to cancel a pending + operation in the context CTX. This can be called by any thread at + any time after starting an operation on the context, but will not + take effect immediately. The actual cancellation happens at the + next time GPGME processes I/O in that context. The function returns an error code if the cancellation failed (in this case the state of CTX is not modified). @@ -6025,7 +6241,21 @@ Here is an example of a complete encryption sequence; client lines are indicated by a C:, server responses by C:: - C: S: C: S: C: S: C: S: S: C: S: C: S: C: S: + C: RESET + S: OK + C: RECIPIENT foo@example.net + S: OK + C: RECIPIENT bar@example.com + S: OK + C: PREP_ENCRYPT + S: S PROTOCOL OpenPGP + S: OK + C: INPUT FD=17 + S: OK + C: OUTPUT FD=18 + S: OK + C: ENCRYPT + S: OK  File: gpgme.info, Node: UI Server Sign, Next: UI Server Decrypt, Prev: UI Server Encrypt, Up: UI Server Protocol @@ -6105,11 +6335,14 @@ The decryption is started with the command: -- Command: DECRYPT --protocol=NAME [--no-verify] + [--export-session-key] NAME is the encryption protocol used for the message. For a description of the allowed protocols see the ‘ENCRYPT’ command. This argument is mandatory. If the option ‘--no-verify’ is given, the server should not try to verify a signature, in case the input - data is an OpenPGP combined message. + data is an OpenPGP combined message. If the option + ‘--export-session-key’ is given and the underlying engine knows how + to export the session key, it will appear on a status line  File: gpgme.info, Node: UI Server Verify, Next: UI Server Set Input Files, Prev: UI Server Decrypt, Up: UI Server Protocol diff -Nru gpgme1.0-1.7.0/doc/gpgme.info-2 gpgme1.0-1.8.0/doc/gpgme.info-2 --- gpgme1.0-1.7.0/doc/gpgme.info-2 2016-09-19 07:05:56.000000000 +0000 +++ gpgme1.0-1.8.0/doc/gpgme.info-2 2016-11-16 12:29:43.000000000 +0000 @@ -19,8 +19,8 @@ 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.8.0-beta50, last updated 16 November 2016, of ‘The +‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50. Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH. @@ -567,7 +567,7 @@ Version 3, 29 June 2007 - Copyright © 2007 Free Software Foundation, Inc. + Copyright © 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -1243,7 +1243,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -1264,14 +1264,14 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow -the GNU GPL, see . +the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, -please read . +please read .  File: gpgme.info, Node: Concept Index, Next: Function and Data Index, Prev: Copying, Up: Top @@ -1318,6 +1318,7 @@ * context, pinentry mode: Pinentry Mode. (line 6) * context, result of operation: Result Management. (line 6) * context, selecting protocol: Protocol Selection. (line 6) +* context, sender: Setting the Sender. (line 6) * context, text mode: Text Mode. (line 6) * crypto backend: Protocols and Engines. (line 6) * crypto engine: Protocols and Engines. (line 6) @@ -1380,6 +1381,7 @@ * error values, printing of: Error Strings. (line 6) * event loop, external: Using External Event Loops. (line 6) +* From:: Setting the Sender. (line 6) * GDK, using GPGME with: I/O Callback Example GDK. (line 6) * GnuPG: OpenPGP. (line 6) @@ -1425,7 +1427,7 @@ * locale, default: Locale. (line 6) * locale, of a context: Locale. (line 6) * message digest algorithms: Hash Algorithms. (line 6) -* multi-threading: Multi Threading. (line 6) +* multi-threading: Multi-Threading. (line 6) * notation data: Verify. (line 6) * notation data <1>: Signature Notation Data. (line 6) @@ -1452,6 +1454,7 @@ * run control: Run Control. (line 6) * S/MIME: Cryptographic Message Syntax. (line 6) +* sender: Setting the Sender. (line 6) * sign: Sign. (line 6) * signal handling: Signal Handling. (line 6) * signals: Signal Handling. (line 6) @@ -1466,7 +1469,7 @@ * status message callback: Status Message Callback. (line 6) * text mode: Text Mode. (line 6) -* thread-safeness: Multi Threading. (line 6) +* thread-safeness: Multi-Threading. (line 6) * trust item: Trust Item Management. (line 6) * trust item list: Listing Trust Items. (line 6) * trust item, manipulation: Manipulating Trust Items. @@ -1530,6 +1533,7 @@ (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. @@ -1639,6 +1643,8 @@ (line 25) * gpgme_genkey_result_t: Generating Keys. (line 295) * gpgme_get_armor: ASCII Armor. (line 13) +* gpgme_get_ctx_flag: Status Message Callback. + (line 73) * gpgme_get_dirinfo: Engine Version Check. (line 6) * gpgme_get_engine_info: Engine Information. (line 46) @@ -1656,6 +1662,7 @@ * gpgme_get_protocol: Protocol Selection. (line 21) * gpgme_get_protocol_name: Protocols and Engines. (line 51) +* gpgme_get_sender: Setting the Sender. (line 26) * gpgme_get_sig_key: Deprecated Functions. (line 626) * gpgme_get_sig_status: Deprecated Functions. @@ -1710,10 +1717,10 @@ * gpgme_op_createsubkey: Generating Keys. (line 109) * gpgme_op_createsubkey_start: Generating Keys. (line 151) * gpgme_op_decrypt: Decrypt. (line 6) -* gpgme_op_decrypt_result: Decrypt. (line 76) +* gpgme_op_decrypt_result: Decrypt. (line 91) * gpgme_op_decrypt_start: Decrypt. (line 20) * gpgme_op_decrypt_verify: Decrypt and Verify. (line 6) -* gpgme_op_decrypt_verify <1>: Decrypt and Verify. (line 30) +* gpgme_op_decrypt_verify_start: Decrypt and Verify. (line 30) * gpgme_op_delete: Deleting Keys. (line 6) * gpgme_op_delete_start: Deleting Keys. (line 20) * gpgme_op_edit: Deprecated Functions. @@ -1761,6 +1768,10 @@ (line 6) * gpgme_op_passwd_start: Changing Passphrases. (line 19) +* gpgme_op_query_swdb: Checking for updates. + (line 66) +* gpgme_op_query_swdb_result: Checking for updates. + (line 76) * gpgme_op_revuid: Generating Keys. (line 192) * gpgme_op_revuid_start: Generating Keys. (line 218) * gpgme_op_sign: Creating a Signature. @@ -1794,12 +1805,14 @@ (line 59) * gpgme_pubkey_algo_t: Public Key Algorithms. (line 10) +* gpgme_query_swdb_result_t: Checking for updates. + (line 11) * gpgme_recipient_t: Decrypt. (line 30) * gpgme_register_io_cb_t: I/O Callback Interface. (line 23) * gpgme_release: Destroying Contexts. (line 6) -* gpgme_result_ref: Result Management. (line 14) -* gpgme_result_unref: Result Management. (line 20) +* gpgme_result_ref: Result Management. (line 15) +* gpgme_result_unref: Result Management. (line 21) * gpgme_set_armor: ASCII Armor. (line 6) * gpgme_set_ctx_flag: Status Message Callback. (line 37) @@ -1819,6 +1832,7 @@ * gpgme_set_progress_cb: Progress Meter Callback. (line 16) * gpgme_set_protocol: Protocol Selection. (line 6) +* gpgme_set_sender: Setting the Sender. (line 13) * gpgme_set_status_cb: Status Message Callback. (line 17) * gpgme_set_textmode: Text Mode. (line 6) diff -Nru gpgme1.0-1.7.0/doc/gpgme.texi gpgme1.0-1.8.0/doc/gpgme.texi --- gpgme1.0-1.7.0/doc/gpgme.texi 2016-09-19 07:05:46.000000000 +0000 +++ gpgme1.0-1.8.0/doc/gpgme.texi 2016-11-16 09:17:20.000000000 +0000 @@ -31,11 +31,11 @@ @end copying @c Macros used by the description of the UI server protocol -@macro clnt - @sc{c:} @c +@macro clnt{string} + @sc{c:} \string\ @end macro -@macro srvr - @sc{s:} @c +@macro srvr{string} + @sc{s:} \string\ @end macro @@ -130,7 +130,7 @@ * Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Signal Handling:: How @acronym{GPGME} affects signal handling. -* Multi Threading:: How @acronym{GPGME} can be used in an MT environment. +* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment. Protocols and Engines @@ -186,6 +186,7 @@ * Protocol Selection:: Selecting the protocol used by a context. * Crypto Engine:: Configuring the crypto engine. +* Setting the Sender:: How to tell the engine the sender. * ASCII Armor:: Requesting @acronym{ASCII} armored output. * Text Mode:: Choosing canonical text mode. * Offline Mode:: Choosing offline mode. @@ -236,7 +237,9 @@ Miscellaneous -* Running other Programs:: Running other Programs +* Running other Programs:: Running other Programs. +* Using the Assuan protocol:: Using the Assuan protocol. +* Checking for updates:: How to check for software updates. Run Control @@ -379,7 +382,7 @@ * Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Signal Handling:: How @acronym{GPGME} affects signal handling. -* Multi Threading:: How @acronym{GPGME} can be used in an MT environment. +* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment. @end menu @@ -455,12 +458,6 @@ gcc -o foo foo.c `gpgme-config --cflags --libs` @end example -If you want to link to one of the thread-safe versions of -@acronym{GPGME}, you must specify the @option{--thread} option before -any other option to select the thread package you want to link with. -Supported thread packages are @option{--thread=pth} and -@option{--thread=pthread}. - If you need to detect the installed language bindings you can use list them using: @@ -611,7 +608,9 @@ @code{AM_PATH_GPGME_PTHREAD} checks for the version of @acronym{GPGME} that can be used with the native pthread implementation, and defines -@code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. +@code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. Since +version 1.8.0 this is no longer required to GPGME_PTHREAD as +@acronym{GPGME} itself is thread safe. This macro searches for @command{gpgme-config} along the PATH. If you are cross-compiling, it is useful to set the environment variable @@ -806,37 +805,17 @@ @code{gpgme_check_version} is called or afterwards. -@node Multi Threading -@section Multi Threading +@node Multi-Threading +@section Multi-Threading @cindex thread-safeness @cindex multi-threading -The @acronym{GPGME} library is not entirely thread-safe, but it can -still be used in a multi-threaded environment if some care is taken. -If the following requirements are met, there should be no race -conditions to worry about: +The @acronym{GPGME} library is mostly thread-safe, and can be used +in a multi-threaded environment but there are some requirements +for multi-threaded use: @itemize @bullet @item -@acronym{GPGME} supports the thread libraries pthread and GNU Pth. -The support for this has to be enabled at compile time. -@acronym{GPGME} will automatically detect the location in which the -thread libraries are installed and activate the support for them at -build time. - -Support for other thread libraries is very easy to add. Please -contact us if you have the need. - -@item -If you want to use @acronym{GPGME} with threads, you must link to the -right version of the library. The name of the right library is -@code{libgpgme-} followed by the name of the thread package you use. -For example, if you use GNU Pth, the right name is -@code{libgpgme-pth}. Use the Automake macros or -@command{gpgme-config} program for simplicity. - - -@item The function @code{gpgme_check_version} must be called before any other function in the library, because it initializes the thread support subsystem in @acronym{GPGME}. To achieve this in @@ -2334,10 +2313,12 @@ The detailed result of an operation is returned in operation-specific structures such as @code{gpgme_decrypt_result_t}. The corresponding retrieval functions such as @code{gpgme_op_decrypt_result} provide -static access to the results after an operation completes. The -following interfaces make it possible to detach a result structure -from its associated context and give it a lifetime beyond that of the -current operation or context. +static access to the results after an operation completes. Those +structures shall be considered read-only and an application must not +allocate such a structure on its own. The following interfaces make +it possible to detach a result structure from its associated context +and give it a lifetime beyond that of the current operation or +context. @deftypefun void gpgme_result_ref (@w{void *@var{result}}) The function @code{gpgme_result_ref} acquires an additional reference @@ -2366,6 +2347,7 @@ @menu * Protocol Selection:: Selecting the protocol used by a context. * Crypto Engine:: Configuring the crypto engine. +* Setting the Sender:: How to tell the engine the sender. * ASCII Armor:: Requesting @acronym{ASCII} armored output. * Text Mode:: Choosing canonical text mode. * Offline Mode:: Choosing offline mode. @@ -2448,6 +2430,47 @@ @end deftypefun +@node Setting the Sender +@subsection How to tell the engine the sender. +@cindex context, sender +@cindex sender +@cindex From: + +Some engines can make use of the sender’s address, for example to +figure out the best user id in certain trust models. For verification +and signing of mails, it is thus suggested to let the engine know the +sender ("From:") address. @acronym{GPGME} provides two functions to +accomplish that. Note that the esoteric use of multiple "From:" +addresses is not supported. + +@deftypefun gpgme_error_t gpgme_set_sender @ + (@w{gpgme_ctx_t @var{ctx}}, @ + @w{int @var{address}}) + +The function @code{gpgme_set_sender} specifies the sender address for +use in sign and verify operations. @var{address} is expected to be +the ``addr-spec'' part of an address but my also be a complete mailbox +address, in which case this function extracts the ``addr-spec'' from +it. Using @code{NULL} for @var{address} clears the sender address. + +The function returns 0 on success or an error code on failure. The +most likely failure is that no valid ``addr-spec'' was found in +@var{address}. + +@end deftypefun + +@deftypefun @w{const char *} gpgme_get_sender @ + (@w{gpgme_ctx_t @var{ctx}}) + +The function @code{gpgme_get_sender} returns the current sender +address from the context, or NULL if none was set. The returned +value is valid as long as the @var{ctx} is valid and +@code{gpgme_set_sender} has not been called again. + +@end deftypefun + + + @c FIXME: Unfortunately, using @acronym here breaks texi2dvi. @node ASCII Armor @subsection @acronym{ASCII} Armor @@ -2877,12 +2900,39 @@ be removed from the @code{description} field of the @code{gpgme_tofu_info_t} object. +@item "export-session-key" +Using a @var{value} of "1" specifies that the context should try to +export the symmetric session key when decrypting data. By default, or +when using an empty string or "0" for @var{value}, session keys are +not exported. + +@item "override-session-key" +The string given in @var{value} is passed to the GnuPG engine to override +the session key for decryption. The format of that session key is +specific to GnuPG and can be retrieved during a decrypt operation when +the context flag "export-session-key" is enabled. Please be aware that +using this feature with GnuPG < 2.1.16 will leak the session key on +many platforms via ps(1). + @end table This function returns @code{0} on success. @end deftypefun +@deftypefun {const char *} gpgme_get_ctx_flag @ + (@w{gpgme_ctx_t @var{ctx}}, @ + @w{const char *@var{name}}) + +The value of flags settable by @code{gpgme_set_ctx_flag} can be +retrieved by this function. If @var{name} is unknown the function +returns @code{NULL}. For boolean flags an empty string is returned +for False and the string "1" is returned for True; either atoi(3) or a +test for an empty string can be used to get the boolean value. + +@end deftypefun + + @node Locale @subsection Locale @cindex locale, default @@ -4739,8 +4789,10 @@ This is a pointer to a structure used to store the result of a @code{gpgme_op_decrypt} operation. After successfully decrypting data, you can retrieve the pointer to the result with -@code{gpgme_op_decrypt_result}. The structure contains the following -members: +@code{gpgme_op_decrypt_result}. As with all result structures, it +this structure shall be considered read-only and an application must +not allocated such a strucure on its own. The structure contains the +following members: @table @code @item char *unsupported_algorithm @@ -4756,6 +4808,19 @@ @item char *file_name This is the filename of the original plaintext message file if it is known, otherwise this is a null pointer. + +@item char *session_key +A textual representation (nul-terminated string) of the session key +used in symmetric encryption of the message, if the context has been +set to export session keys (see @code{gpgme_set_ctx_flag, +"export-session-key"}), and a session key was available for the most +recent decryption operation. Otherwise, this is a null pointer. + +You must not try to access this member of the struct unless +@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true +(non-empty string). + @end table @end deftp @@ -5096,7 +5161,7 @@ are reported by the crypto engine support routines. @end deftypefun -@deftypefun gpgme_error_t gpgme_op_decrypt_verify (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}}) +@deftypefun gpgme_error_t gpgme_op_decrypt_verify_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}}) The function @code{gpgme_op_decrypt_verify_start} initiates a @code{gpgme_op_decrypt_verify} operation. It can be completed by calling @code{gpgme_wait} on the context. @xref{Waiting For @@ -5109,6 +5174,23 @@ 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 @@ -5501,6 +5583,7 @@ @menu * Running other Programs:: Running other Programs * Using the Assuan protocol:: Using the Assuan protocol +* Checking for updates:: How to check for software updates @end menu @@ -5632,6 +5715,142 @@ @end deftypefun +@node Checking for updates +@subsection How to check for software updates + +The GnuPG Project operates a server to query the current versions of +software packages related to GnuPG. GPGME can be used to +access this online database and check whether a new version of a +software package is available. + +@deftp {Data type} {gpgme_query_swdb_result_t} +This is a pointer to a structure used to store the result of a +@code{gpgme_op_query_swdb} operation. After success full call to that +function, you can retrieve the pointer to the result with +@code{gpgme_op_query_swdb_result}. The structure contains the +following member: + +@table @code +@item name +This is the name of the package. + +@item iversion +The currently installed version or an empty string. This value is +either a copy of the argument given to @code{gpgme_op_query_swdb} or +the version of the installed software as figured out by GPGME or GnuPG. + +@item created +This gives the date the file with the list of version numbers has +originally be created by the GnuPG project. + +@item retrieved +This gives the date the file was downloaded. + +@item warning +If this flag is set either an error has occurred or some of the +information in this structure are not properly set. For example if +the version number of the installed software could not be figured out, +the @code{update} flag may not reflect a required update status. + +@item update +If this flag is set an update of the software is available. + +@item urgent +If this flag is set an available update is important. + +@item noinfo +If this flag is set, no valid information could be retrieved. + +@item unknown +If this flag is set the given @code{name} is not known. + +@item tooold +If this flag is set the available information is not fresh enough. + +@item error +If this flag is set some other error has occured. + +@item version +The version string of the latest released version. + +@item reldate +The release date of the latest released version. + +@end table +@end deftp + +@deftypefun gpgme_error_t gpgme_op_query_swdb @ + (@w{gpgme_ctx_t @var{ctx}}, @ + @w{const char *@var{name}}, @ + @w{const char *@var{iversion}}, @ + @w{gpgme_data_t @var{reserved}}) + +Query the software version database for software package @var{name} +and check against the installed version given by @var{iversion}. If +@var{iversion} is given as @code{NULL} a check is only done if GPGME +can figure out the version by itself (for example when using +"gpgme" or "gnupg"). If @code{NULL} is used for @var{name} the +current gpgme version is checked. @var{reserved} must be set to 0. + +@end deftypefun + +@deftypefun gpgme_query_swdb_result_t gpgme_op_query_swdb_result @ + (@w{gpgme_ctx_t @var{ctx}}) + +The function @code{gpgme_op_query_swdb_result} returns a +@code{gpgme_query_swdb_result_t} pointer to a structure holding the +result of a @code{gpgme_op_query_swdb} operation. The pointer is only +valid if the last operation on the context was a sucessful call to +@code{gpgme_op_query_swdb}. If that call failed, the result might +be a @code{NULL} pointer. The returned pointer is only valid until +the next operation is started on the context @var{ctx}. +@end deftypefun + +@noindent +Here is an example on how to check whether GnuPG is current: + +@example +#include + +int +main (void) +@{ + gpg_error_t err; + gpgme_ctx_t ctx; + gpgme_query_swdb_result_t result; + + gpgme_check_version (NULL); + err = gpgme_new (&ctx); + if (err) + fprintf (stderr, "error creating context: %s\n", gpg_strerror (err)); + else + @{ + gpgme_set_protocol (ctx, GPGME_PROTOCOL_GPGCONF); + + err = gpgme_op_query_swdb (ctx, "gnupg", NULL, 0); + if (err) + fprintf (stderr, "error querying swdb: %s\n", gpg_strerror (err)); + else + @{ + result = gpgme_op_query_swdb_result (ctx); + if (!result) + fprintf (stderr, "error querying swdb\n"); + if (!result->warning && !result->update) + printf ("GnuPG version %s is current\n", + result->iversion); + else if (!result->warning && result->update) + printf ("GnuPG version %s can be updated to %s\n", + result->iversion, result->version); + else + fprintf (stderr, "error finding the update status\n"); + @} + gpgme_release (ctx); + @} + return 0; +@} +@end example + + @node Run Control @section Run Control @cindex run control @@ -6016,6 +6235,7 @@ 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 +6244,14 @@ 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 +6305,7 @@ 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 +6315,19 @@ &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; @@ -6350,7 +6581,7 @@ @deftypefun gpgme_ctx_t gpgme_cancel_async (@w{gpgme_ctx_t @var{ctx}}) -The function @code{gpgme_cancel} attempts to cancel a pending +The function @code{gpgme_cancel_async} attempts to cancel a pending operation in the context @var{ctx}. This can be called by any thread at any time after starting an operation on the context, but will not take effect immediately. The actual cancellation happens at the next diff -Nru gpgme1.0-1.7.0/doc/gpl.texi gpgme1.0-1.8.0/doc/gpl.texi --- gpgme1.0-1.7.0/doc/gpl.texi 2014-12-15 10:53:19.000000000 +0000 +++ gpgme1.0-1.8.0/doc/gpl.texi 2016-11-16 12:18:38.000000000 +0000 @@ -6,7 +6,7 @@ @c This file is intended to be included in another file. @display -Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/} +Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{https://fsf.org/} Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -696,7 +696,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see @url{http://www.gnu.org/licenses/}. +along with this program. If not, see @url{https://www.gnu.org/licenses/}. @end example @noindent @@ -722,11 +722,11 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -@url{http://www.gnu.org/licenses/}. +@url{https://www.gnu.org/licenses/}. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But -first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}. +first, please read @url{https://www.gnu.org/philosophy/why-not-lgpl.html}. diff -Nru gpgme1.0-1.7.0/doc/Makefile.in gpgme1.0-1.8.0/doc/Makefile.in --- gpgme1.0-1.7.0/doc/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/doc/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -339,6 +339,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/doc/texinfo.tex gpgme1.0-1.8.0/doc/texinfo.tex --- gpgme1.0-1.7.0/doc/texinfo.tex 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/doc/texinfo.tex 2016-11-16 12:20:17.000000000 +0000 @@ -20,7 +20,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this program. If not, see . +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -28,7 +28,7 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% https://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org). % The texinfo.tex in any given distribution could well be out @@ -54,7 +54,7 @@ % extent. You can get the existing language-specific files from the % full Texinfo distribution. % -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% The GNU Texinfo home page is https://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} @@ -354,7 +354,7 @@ % We don't want .vr (or whatever) entries like this: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; - % it needs to be + % it needs to be % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. @@ -705,7 +705,7 @@ \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. -% +% \def\onword{on} \def\offword{off} % @@ -1260,7 +1260,7 @@ % that's what we do). % double active backslashes. -% +% {\catcode`\@=0 \catcode`\\=\active @gdef@activebackslashdouble{% @catcode`@\=@active @@ -1272,11 +1272,11 @@ % us) handles it with this amazing macro to replace tokens, with minor % changes for Texinfo. It is included here under the GPL by permission % from the author, Heiko Oberdiek. -% +% % #1 is the tokens to replace. % #2 is the replacement. % #3 is the control sequence with the string. -% +% \def\HyPsdSubst#1#2#3{% \def\HyPsdReplace##1#1##2\END{% ##1% @@ -1542,7 +1542,7 @@ % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. - % + % \normalturnoffactive \def\@{@}% \let\/=\empty @@ -1941,7 +1941,7 @@ % Definitions for a main text size of 11pt. This is the default in % Texinfo. -% +% \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} @@ -2074,7 +2074,7 @@ % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. -% +% \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} @@ -2165,7 +2165,7 @@ \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} -\font\seci=cmmi12 +\font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} @@ -2209,7 +2209,7 @@ % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. -% +% \def\xword{10} \def\xiword{11} % @@ -2219,7 +2219,7 @@ % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. - % + % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi @@ -2505,7 +2505,7 @@ % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. -% +% \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} @@ -2636,7 +2636,7 @@ % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. -% +% \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% @@ -2648,7 +2648,7 @@ % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. -% +% \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% @@ -2667,43 +2667,43 @@ % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% +% % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. -% +% % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted -% +% % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. -% +% % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. -% -% +% +% \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. - % + % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. - % + % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. - % + % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % - \ifx\curfontstyle\bfstylename + \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else + \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi @@ -2756,7 +2756,7 @@ % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. -% +% \ifx\Orb\undefined \def\Orb{\mathhexbox20D} \fi @@ -3105,7 +3105,7 @@ % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. - % + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -3901,7 +3901,7 @@ % processing continues to some further point. On the other hand, it % seems \endinput does not hurt in the printed index arg, since that % is still getting written without apparent harm. - % + % % Sample source (mac-idx3.tex, reported by Graham Percival to % help-texinfo, 22may06): % @macro funindex {WORD} @@ -3909,12 +3909,12 @@ % @end macro % ... % @funindex commtest - % + % % The above is not enough to reproduce the bug, but it gives the flavor. - % + % % Sample whatsit resulting: % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} - % + % % So: \let\endinput = \empty % @@ -4170,11 +4170,11 @@ % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. - % + % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. - % + % \macrolist } @@ -4302,7 +4302,7 @@ % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: - % + % % @deffn deffn-whatever % @vindex index-whatever % Description. @@ -5368,11 +5368,11 @@ % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) \vskip-\parskip - % + % % This is purely so the last item on the list is a known \penalty > % 10000. This is so \startdefun can avoid allowing breakpoints after % section headings. Otherwise, it would insert a valid breakpoint between: - % + % % @section sec-whatever % @deffn def-whatever \penalty 10001 @@ -5430,7 +5430,7 @@ % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. -% +% \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active @@ -5480,7 +5480,7 @@ % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. -% +% \def\tocreadfilename{\jobname.toc} % Normal (long) toc. @@ -6035,8 +6035,8 @@ % from cmtt (char 0x0d). The undirected quote is ugly, so don't make it % the default, but it works for pasting with more pdf viewers (at least % evince), the lilypond developers report. xpdf does work with the -% regular 0x27. -% +% regular 0x27. +% \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax @@ -6048,7 +6048,7 @@ % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. -% +% \def\codequoteleft{% \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax @@ -6579,7 +6579,7 @@ % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). -% +% \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname @@ -7737,7 +7737,7 @@ % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. -% +% \def\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 @@ -7793,7 +7793,7 @@ \setnonasciicharscatcode\active \lattwochardefs % - \else \ifx \declaredencoding \latone + \else \ifx \declaredencoding \latone \setnonasciicharscatcode\active \latonechardefs % @@ -7805,7 +7805,7 @@ \setnonasciicharscatcode\active \utfeightchardefs % - \else + \else \message{Unknown document encoding #1, ignoring.}% % \fi % utfeight @@ -7817,7 +7817,7 @@ % A message to be logged when using a character that isn't available % the default font encoding (OT1). -% +% \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. @@ -7830,21 +7830,21 @@ % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% - \gdef^^a0{~} + \gdef^^a0{~} \gdef^^a1{\exclamdown} - \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\missingcharmsg{YEN SIGN}} - \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} - \gdef^^a8{\"{}} - \gdef^^a9{\copyright} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} \gdef^^aa{\ordf} - \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} + \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} \gdef^^ac{$\lnot$} - \gdef^^ad{\-} - \gdef^^ae{\registeredsymbol} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} % \gdef^^b0{\textdegree} @@ -7871,7 +7871,7 @@ \gdef^^c2{\^A} \gdef^^c3{\~A} \gdef^^c4{\"A} - \gdef^^c5{\ringaccent A} + \gdef^^c5{\ringaccent A} \gdef^^c6{\AE} \gdef^^c7{\cedilla C} \gdef^^c8{\`E} @@ -8012,7 +8012,7 @@ \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\v R} - \gdef^^d9{\ringaccent U} + \gdef^^d9{\ringaccent U} \gdef^^da{\'U} \gdef^^db{\H U} \gdef^^dc{\"U} @@ -8056,11 +8056,11 @@ } % UTF-8 character definitions. -% +% % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. -% +% \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz @@ -8900,7 +8900,7 @@ % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. -% +% @def@normalturnoffactive{% @let\=@normalbackslash @let"=@normaldoublequote diff -Nru gpgme1.0-1.7.0/doc/uiserver.texi gpgme1.0-1.8.0/doc/uiserver.texi --- gpgme1.0-1.7.0/doc/uiserver.texi 2014-11-19 10:52:18.000000000 +0000 +++ gpgme1.0-1.8.0/doc/uiserver.texi 2016-11-15 09:35:05.000000000 +0000 @@ -158,21 +158,21 @@ @smallexample @group - @clnt RESET - @srvr OK - @clnt RECIPIENT foo@@example.net - @srvr OK - @clnt RECIPIENT bar@@example.com - @srvr OK - @clnt PREP_ENCRYPT - @srvr S PROTOCOL OpenPGP - @srvr OK - @clnt INPUT FD=17 - @srvr OK - @clnt OUTPUT FD=18 - @srvr OK - @clnt ENCRYPT - @srvr OK + @clnt{RESET} + @srvr{OK} + @clnt{RECIPIENT foo@@example.net} + @srvr{OK} + @clnt{RECIPIENT bar@@example.com} + @srvr{OK} + @clnt{PREP_ENCRYPT} + @srvr{S PROTOCOL OpenPGP} + @srvr{OK} + @clnt{INPUT FD=17} + @srvr{OK} + @clnt{OUTPUT FD=18} + @srvr{OK} + @clnt{ENCRYPT} + @srvr{OK} @end group @end smallexample @@ -260,12 +260,14 @@ @noindent The decryption is started with the command: -@deffn Command DECRYPT -@w{}-protocol=@var{name} [-@w{}-no-verify] +@deffn Command DECRYPT -@w{}-protocol=@var{name} [-@w{}-no-verify] [-@w{}-export-session-key] @var{name} is the encryption protocol used for the message. For a description of the allowed protocols see the @code{ENCRYPT} command. -This argument is mandatory. If the option @option{--no-verify} is given, -the server should not try to verify a signature, in case the input data -is an OpenPGP combined message. +This argument is mandatory. If the option @option{--no-verify} is +given, the server should not try to verify a signature, in case the +input data is an OpenPGP combined message. If the option +@option{--export-session-key} is given and the underlying engine knows +how to export the session key, it will appear on a status line @end deffn diff -Nru gpgme1.0-1.7.0/gpgme.spec gpgme1.0-1.8.0/gpgme.spec --- gpgme1.0-1.7.0/gpgme.spec 2016-09-21 07:20:07.000000000 +0000 +++ gpgme1.0-1.8.0/gpgme.spec 2016-11-16 12:47:28.000000000 +0000 @@ -1,9 +1,9 @@ # 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.8.0 Release: 1 -URL: http://www.gnupg.org/gpgme.html +URL: https://gnupg.org/gpgme.html Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz Group: Development/Libraries Copyright: GPL diff -Nru gpgme1.0-1.7.0/gpgme.spec.in gpgme1.0-1.8.0/gpgme.spec.in --- gpgme1.0-1.7.0/gpgme.spec.in 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/gpgme.spec.in 2016-11-16 12:17:36.000000000 +0000 @@ -3,7 +3,7 @@ Name: gpgme Version: @pkg_version@ Release: 1 -URL: http://www.gnupg.org/gpgme.html +URL: https://gnupg.org/gpgme.html Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz Group: Development/Libraries Copyright: GPL diff -Nru gpgme1.0-1.7.0/lang/cl/gpgme.asd gpgme1.0-1.8.0/lang/cl/gpgme.asd --- gpgme1.0-1.7.0/lang/cl/gpgme.asd 2016-09-21 07:19:58.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cl/gpgme.asd 2016-11-16 12:47:17.000000000 +0000 @@ -27,7 +27,7 @@ (defsystem gpgme :description "GnuPG Made Easy." :author "g10 Code GmbH" - :version "1.7.0" + :version "1.8.0" :licence "GPL" :depends-on ("cffi" "gpg-error") :components ((:file "gpgme-package") diff -Nru gpgme1.0-1.7.0/lang/cl/Makefile.in gpgme1.0-1.8.0/lang/cl/Makefile.in --- gpgme1.0-1.7.0/lang/cl/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cl/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -301,6 +301,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/lang/cpp/Makefile.in gpgme1.0-1.8.0/lang/cpp/Makefile.in --- gpgme1.0-1.7.0/lang/cpp/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -330,6 +330,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/lang/cpp/src/callbacks.cpp gpgme1.0-1.8.0/lang/cpp/src/callbacks.cpp --- gpgme1.0-1.7.0/lang/cpp/src/callbacks.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/callbacks.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "callbacks.h" #include "util.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/configuration.cpp gpgme1.0-1.8.0/lang/cpp/src/configuration.cpp --- gpgme1.0-1.7.0/lang/cpp/src/configuration.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/configuration.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/cpp/src/context.cpp gpgme1.0-1.8.0/lang/cpp/src/context.cpp --- gpgme1.0-1.7.0/lang/cpp/src/context.cpp 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/context.cpp 2016-11-15 07:35:40.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include #include @@ -462,6 +466,16 @@ return Error(gpgme_ctx_set_engine_info(d->ctx, gpgme_get_protocol(d->ctx), filename, home_dir)); } +Error Context::setSender (const char *sender) +{ + return Error(gpgme_set_sender(d->ctx, sender)); +} + +const char *Context::getSender () +{ + return gpgme_get_sender(d->ctx); +} + // // // Key Management @@ -695,7 +709,7 @@ } -#pragma GCC push_diagnostics +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" Error Context::edit(const Key &key, std::unique_ptr func, Data &data) @@ -755,7 +769,7 @@ dp ? dp->data : 0)); } -#pragma GCC pop_diagnostics +#pragma GCC diagnostic pop EditInteractor *Context::lastCardEditInteractor() const { @@ -1051,6 +1065,7 @@ return n->value; } } + return nullptr; } Notation Context::signatureNotation(unsigned int idx) const @@ -1344,6 +1359,7 @@ case TofuInfo::PolicyAsk: return GPGME_TOFU_POLICY_ASK; case TofuInfo::PolicyUnknown: + default: return GPGME_TOFU_POLICY_UNKNOWN; } } diff -Nru gpgme1.0-1.7.0/lang/cpp/src/context.h gpgme1.0-1.8.0/lang/cpp/src/context.h --- gpgme1.0-1.7.0/lang/cpp/src/context.h 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/context.h 2016-11-15 07:35:40.000000000 +0000 @@ -304,6 +304,10 @@ GpgME::Error startSigning(const Data &plainText, Data &signature, SignatureMode mode); SigningResult signingResult() const; + // wrapper for gpgme_set_sender + const char *getSender(); + GpgME::Error setSender(const char *sender); + // // Encryption // @@ -364,8 +368,8 @@ * @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 -Nru gpgme1.0-1.7.0/lang/cpp/src/context_vanilla.cpp gpgme1.0-1.8.0/lang/cpp/src/context_vanilla.cpp --- gpgme1.0-1.7.0/lang/cpp/src/context_vanilla.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/context_vanilla.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include GIOChannel *GpgME::getGIOChannel(int) diff -Nru gpgme1.0-1.7.0/lang/cpp/src/data.cpp gpgme1.0-1.8.0/lang/cpp/src/data.cpp --- gpgme1.0-1.7.0/lang/cpp/src/data.cpp 2016-08-21 12:29:55.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/data.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "data_p.h" #include #include @@ -157,6 +161,9 @@ 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 @@ 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 -Nru gpgme1.0-1.7.0/lang/cpp/src/data.h gpgme1.0-1.8.0/lang/cpp/src/data.h --- gpgme1.0-1.7.0/lang/cpp/src/data.h 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/data.h 2016-10-18 17:22:02.000000000 +0000 @@ -78,7 +78,10 @@ BinaryEncoding, Base64Encoding, ArmorEncoding, - MimeEncoding + MimeEncoding, + UrlEncoding, + UrlEscEncoding, + Url0Encoding, }; Encoding encoding() const; Error setEncoding(Encoding encoding); diff -Nru gpgme1.0-1.7.0/lang/cpp/src/decryptionresult.cpp gpgme1.0-1.8.0/lang/cpp/src/decryptionresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/decryptionresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/decryptionresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" #include "util.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/defaultassuantransaction.cpp gpgme1.0-1.8.0/lang/cpp/src/defaultassuantransaction.cpp --- gpgme1.0-1.7.0/lang/cpp/src/defaultassuantransaction.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/defaultassuantransaction.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/cpp/src/editinteractor.cpp gpgme1.0-1.8.0/lang/cpp/src/editinteractor.cpp --- gpgme1.0-1.7.0/lang/cpp/src/editinteractor.cpp 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/editinteractor.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/cpp/src/encryptionresult.cpp gpgme1.0-1.8.0/lang/cpp/src/encryptionresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/encryptionresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/encryptionresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" #include "util.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/engineinfo.cpp gpgme1.0-1.8.0/lang/cpp/src/engineinfo.cpp --- gpgme1.0-1.7.0/lang/cpp/src/engineinfo.cpp 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/engineinfo.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "engineinfo.h" #include diff -Nru gpgme1.0-1.7.0/lang/cpp/src/engineinfo.h gpgme1.0-1.8.0/lang/cpp/src/engineinfo.h --- gpgme1.0-1.7.0/lang/cpp/src/engineinfo.h 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/engineinfo.h 2016-11-09 07:34:15.000000000 +0000 @@ -40,6 +40,12 @@ struct Version { int major, minor, patch; + Version() + { + major = 0; + minor = 0; + patch = 0; + } Version(const std::string& version) { @@ -48,6 +54,16 @@ major = 0; minor = 0; patch = 0; + } + } + + Version(const char *version) + { + if (!version || + std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) { + major = 0; + minor = 0; + patch = 0; } } diff -Nru gpgme1.0-1.7.0/lang/cpp/src/eventloopinteractor.cpp gpgme1.0-1.8.0/lang/cpp/src/eventloopinteractor.cpp --- gpgme1.0-1.7.0/lang/cpp/src/eventloopinteractor.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/eventloopinteractor.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include diff -Nru gpgme1.0-1.7.0/lang/cpp/src/exception.cpp gpgme1.0-1.8.0/lang/cpp/src/exception.cpp --- gpgme1.0-1.7.0/lang/cpp/src/exception.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/exception.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -21,6 +21,10 @@ */ // -*- c++ -*- +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "exception.h" #include diff -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgadduserideditinteractor.cpp gpgme1.0-1.8.0/lang/cpp/src/gpgadduserideditinteractor.cpp --- gpgme1.0-1.7.0/lang/cpp/src/gpgadduserideditinteractor.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgadduserideditinteractor.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "gpgadduserideditinteractor.h" #include "error.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp gpgme1.0-1.8.0/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp --- gpgme1.0-1.7.0/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgmefw.h gpgme1.0-1.8.0/lang/cpp/src/gpgmefw.h --- gpgme1.0-1.7.0/lang/cpp/src/gpgmefw.h 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgmefw.h 2016-11-09 07:34:15.000000000 +0000 @@ -67,4 +67,10 @@ struct gpgme_conf_arg; typedef struct gpgme_conf_arg *gpgme_conf_arg_t; +struct _gpgme_tofu_info; +typedef struct _gpgme_tofu_info *gpgme_tofu_info_t; + +struct _gpgme_op_query_swdb_result; +typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t; + #endif // __GPGMEPP_GPGMEFW_H__ diff -Nru gpgme1.0-1.7.0/lang/cpp/src/GpgmeppConfig.cmake.in.in gpgme1.0-1.8.0/lang/cpp/src/GpgmeppConfig.cmake.in.in --- gpgme1.0-1.7.0/lang/cpp/src/GpgmeppConfig.cmake.in.in 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/GpgmeppConfig.cmake.in.in 2016-11-16 09:17:20.000000000 +0000 @@ -37,7 +37,7 @@ 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,28 +58,19 @@ 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@" + IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so" ) 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 -Nru gpgme1.0-1.7.0/lang/cpp/src/GpgmeppConfigVersion.cmake.in gpgme1.0-1.8.0/lang/cpp/src/GpgmeppConfigVersion.cmake.in --- gpgme1.0-1.7.0/lang/cpp/src/GpgmeppConfigVersion.cmake.in 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/GpgmeppConfigVersion.cmake.in 2016-11-03 07:55:36.000000000 +0000 @@ -19,7 +19,7 @@ # 02111-1307, USA # based on a generated file from cmake. -set(PACKAGE_VERSION "@LIBGPGMEPP_LT_CURRENT@.@LIBGPGMEPP_LT_AGE@.@LIBGPGMEPP_LT_REVISION@.@BUILD_REVISION@") +set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) diff -Nru gpgme1.0-1.7.0/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in gpgme1.0-1.8.0/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in --- gpgme1.0-1.7.0/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in 2016-11-16 09:17:20.000000000 +0000 @@ -0,0 +1,103 @@ +# CMake Config file for GPGMEPP. +# Copyright (C) 2016 Intevation GmbH +# +# This file is part of GPGMEPP. +# +# GPGME-CL 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. +# +# GPGME-CL 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 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 + +# based on a generated file from cmake. +# Generated by CMake 3.0.2 + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget Gpgmepp) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + +# Create imported target Gpgmepp +add_library(Gpgmepp SHARED IMPORTED) + +set_target_properties(Gpgmepp PROPERTIES + IMPORTED_IMPLIB "@resolved_libdir@/libgpgmepp.dll.a" + INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@" + INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.dll.a;@LIBASSUAN_LIBS@" + IMPORTED_LOCATION "@resolved_bindir@/libgpgmepp-6.dll" +) +list(APPEND _IMPORT_CHECK_TARGETS Gpgmepp ) +list(APPEND _IMPORT_CHECK_FILES_FOR_Gpgmepp "@resolved_libdir@/libgpgmepp.dll.a" "@resolved_bindir@/libgpgmepp-6.dll" ) + + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) + +get_filename_component(QGpgme_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +# Pull in QGpgme for compatibility with KF5 variant. +find_package(QGpgme CONFIG) diff -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgmepp_version.h.in gpgme1.0-1.8.0/lang/cpp/src/gpgmepp_version.h.in --- gpgme1.0-1.7.0/lang/cpp/src/gpgmepp_version.h.in 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgmepp_version.h.in 2016-11-03 07:55:36.000000000 +0000 @@ -23,10 +23,9 @@ #ifndef GPGMEPP_VERSION_H #define GPGMEPP_VERSION_H -#define GPGMEPP_VERSION_STRING "@LIBGPGMEPP_LT_CURRENT@.@LIBGPGMEPP_LT_AGE@.@LIBGPGMEPP_LT_REVISION@" -#define GPGMEPP_VERSION_MAJOR @LIBGPGMEPP_LT_CURRENT@ -#define GPGMEPP_VERSION_MINOR @LIBGPGMEPP_LT_AGE@ -#define GPGMEPP_VERSION_PATCH @LIBGPGMEPP_LT_REVISION@ -#define GPGMEPP_VERSION ((@LIBGPGMEPP_LT_CURRENT@<<16)|(@LIBGPGMEPP_LT_AGE@<<8)|(@LIBGPGMEPP_LT_REVISION@)) - +#define GPGMEPP_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@" +#define GPGMEPP_VERSION_MAJOR @VERSION_MAJOR@ +#define GPGMEPP_VERSION_MINOR @VERSION_MINOR@ +#define GPGMEPP_VERSION_PATCH @VERSION_MICRO@ +#define GPGMEPP_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@)) #endif diff -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp gpgme1.0-1.8.0/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp --- gpgme1.0-1.7.0/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "gpgsetexpirytimeeditinteractor.h" #include "error.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgsetownertrusteditinteractor.cpp gpgme1.0-1.8.0/lang/cpp/src/gpgsetownertrusteditinteractor.cpp --- gpgme1.0-1.7.0/lang/cpp/src/gpgsetownertrusteditinteractor.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgsetownertrusteditinteractor.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "gpgsetownertrusteditinteractor.h" #include "error.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/gpgsignkeyeditinteractor.cpp gpgme1.0-1.8.0/lang/cpp/src/gpgsignkeyeditinteractor.cpp --- gpgme1.0-1.7.0/lang/cpp/src/gpgsignkeyeditinteractor.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/gpgsignkeyeditinteractor.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/cpp/src/importresult.cpp gpgme1.0-1.8.0/lang/cpp/src/importresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/importresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/importresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -21,6 +21,10 @@ */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/key.cpp gpgme1.0-1.8.0/lang/cpp/src/key.cpp --- gpgme1.0-1.7.0/lang/cpp/src/key.cpp 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/key.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "util.h" @@ -29,6 +33,7 @@ #include #include +#include #include #include @@ -273,6 +278,7 @@ /* Return the first subkeys fingerprint */ return key->subkeys->fpr; } + return nullptr; } unsigned int Key::keyListMode() const @@ -872,6 +878,25 @@ 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 -Nru gpgme1.0-1.7.0/lang/cpp/src/keygenerationresult.cpp gpgme1.0-1.8.0/lang/cpp/src/keygenerationresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/keygenerationresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/keygenerationresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/key.h gpgme1.0-1.8.0/lang/cpp/src/key.h --- gpgme1.0-1.7.0/lang/cpp/src/key.h 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/key.h 2016-10-18 17:22:02.000000000 +0000 @@ -320,6 +320,21 @@ * @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 -Nru gpgme1.0-1.7.0/lang/cpp/src/keylistresult.cpp gpgme1.0-1.8.0/lang/cpp/src/keylistresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/keylistresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/keylistresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/Makefile.am gpgme1.0-1.8.0/lang/cpp/src/Makefile.am --- gpgme1.0-1.7.0/lang/cpp/src/Makefile.am 2016-08-24 13:59:45.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/Makefile.am 2016-11-16 09:17:20.000000000 +0000 @@ -19,7 +19,7 @@ # 02111-1307, USA EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \ - gpgmepp_version.h.in + gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in lib_LTLIBRARIES = libgpgmepp.la @@ -33,7 +33,7 @@ gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \ gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \ scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \ - vfsmountresult.cpp configuration.cpp tofuinfo.cpp + vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp gpgmepp_headers = \ configuration.h context.h data.h decryptionresult.h \ @@ -45,7 +45,7 @@ importresult.h keygenerationresult.h key.h keylistresult.h \ notation.h result.h scdgetinfoassuantransaction.h signingresult.h \ trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \ - tofuinfo.h + tofuinfo.h swdbresult.h private_gpgmepp_headers = \ result_p.h context_p.h util.h callbacks.h data_p.h @@ -57,7 +57,7 @@ gpgmeppincludedir = $(includedir)/gpgme++ gpgmeppinclude_HEADERS = $(gpgmepp_headers) nobase_gpgmeppinclude_HEADERS = $(interface_headers) -nodist_include_HEADERS = gpgmepp_version.h +nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \ $(interface_headers) $(private_gpgmepp_headers) @@ -66,25 +66,24 @@ -DBUILDING_GPGMEPP libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@ -libgpgmepp_la_LDFLAGS = -version-info \ +libgpgmepp_la_LDFLAGS = -no-undefined -version-info \ @LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@ if HAVE_W32_SYSTEM -libsuffix=.dll.a +GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in + sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ + sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ + sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ else -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|[@]resolved_includedir@|$(includedir)|g' > $@ +endif 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: @@ -96,4 +95,5 @@ uninstall-local: uninstall-cmake-files -CLEANFILES = GpgmeppConfig.cmake +CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \ + gpgmepp_version.h GpgmeppConfig.cmake.in diff -Nru gpgme1.0-1.7.0/lang/cpp/src/Makefile.in gpgme1.0-1.8.0/lang/cpp/src/Makefile.in --- gpgme1.0-1.7.0/lang/cpp/src/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -102,6 +102,7 @@ subdir = lang/cpp/src DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/mkinstalldirs \ + $(srcdir)/GpgmeppConfig-w32.cmake.in.in \ $(srcdir)/GpgmeppConfig.cmake.in.in \ $(srcdir)/GpgmeppConfigVersion.cmake.in \ $(srcdir)/gpgmepp_version.h.in $(top_srcdir)/build-aux/depcomp \ @@ -122,8 +123,8 @@ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = GpgmeppConfig.cmake.in GpgmeppConfigVersion.cmake \ - gpgmepp_version.h +CONFIG_CLEAN_FILES = GpgmeppConfig-w32.cmake.in GpgmeppConfig.cmake.in \ + GpgmeppConfigVersion.cmake gpgmepp_version.h CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -154,7 +155,8 @@ } am__installdirs = "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(gpgmeppincludedir)" \ - "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(includedir)" + "$(DESTDIR)$(gpgmeppincludedir)" \ + "$(DESTDIR)$(gpgmeppincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libgpgmepp_la_DEPENDENCIES = ../../../src/libgpgme.la am__objects_1 = exception.lo context.lo key.lo trustitem.lo data.lo \ @@ -167,7 +169,7 @@ gpgadduserideditinteractor.lo defaultassuantransaction.lo \ scdgetinfoassuantransaction.lo \ gpgagentgetinfoassuantransaction.lo vfsmountresult.lo \ - configuration.lo tofuinfo.lo + configuration.lo tofuinfo.lo swdbresult.lo am__objects_2 = am_libgpgmepp_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ context_vanilla.lo $(am__objects_2) $(am__objects_2) @@ -240,7 +242,7 @@ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(gpgmeppinclude_HEADERS) $(nobase_gpgmeppinclude_HEADERS) \ - $(nodist_include_HEADERS) + $(nodist_gpgmeppinclude_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -392,6 +394,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -454,7 +459,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \ - gpgmepp_version.h.in + gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in lib_LTLIBRARIES = libgpgmepp.la main_sources = \ @@ -467,7 +472,7 @@ gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \ gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \ scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \ - vfsmountresult.cpp configuration.cpp tofuinfo.cpp + vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp gpgmepp_headers = \ configuration.h context.h data.h decryptionresult.h \ @@ -479,7 +484,7 @@ importresult.h keygenerationresult.h key.h keylistresult.h \ notation.h result.h scdgetinfoassuantransaction.h signingresult.h \ trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \ - tofuinfo.h + tofuinfo.h swdbresult.h private_gpgmepp_headers = \ result_p.h context_p.h util.h callbacks.h data_p.h @@ -491,7 +496,7 @@ gpgmeppincludedir = $(includedir)/gpgme++ gpgmeppinclude_HEADERS = $(gpgmepp_headers) nobase_gpgmeppinclude_HEADERS = $(interface_headers) -nodist_include_HEADERS = gpgmepp_version.h +nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \ $(interface_headers) $(private_gpgmepp_headers) @@ -499,12 +504,12 @@ -DBUILDING_GPGMEPP libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@ -libgpgmepp_la_LDFLAGS = -version-info \ +libgpgmepp_la_LDFLAGS = -no-undefined -version-info \ @LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@ -@HAVE_W32_SYSTEM_FALSE@libsuffix = .so -@HAVE_W32_SYSTEM_TRUE@libsuffix = .dll.a -CLEANFILES = GpgmeppConfig.cmake +CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \ + gpgmepp_version.h GpgmeppConfig.cmake.in + all: all-am .SUFFIXES: @@ -539,6 +544,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +GpgmeppConfig-w32.cmake.in: $(top_builddir)/config.status $(srcdir)/GpgmeppConfig-w32.cmake.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ GpgmeppConfig.cmake.in: $(top_builddir)/config.status $(srcdir)/GpgmeppConfig.cmake.in.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ GpgmeppConfigVersion.cmake: $(top_builddir)/config.status $(srcdir)/GpgmeppConfigVersion.cmake.in @@ -613,6 +620,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylistresult.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scdgetinfoassuantransaction.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signingresult.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swdbresult.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tofuinfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trustitem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verificationresult.Plo@am__quote@ @@ -689,27 +697,27 @@ @list='$(nobase_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ dir='$(DESTDIR)$(gpgmeppincludedir)'; $(am__uninstall_files_from_dir) -install-nodist_includeHEADERS: $(nodist_include_HEADERS) +install-nodist_gpgmeppincludeHEADERS: $(nodist_gpgmeppinclude_HEADERS) @$(NORMAL_INSTALL) - @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ + @list='$(nodist_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \ if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + echo " $(MKDIR_P) '$(DESTDIR)$(gpgmeppincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(gpgmeppincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(gpgmeppincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(gpgmeppincludedir)" || exit $$?; \ done -uninstall-nodist_includeHEADERS: +uninstall-nodist_gpgmeppincludeHEADERS: @$(NORMAL_UNINSTALL) - @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ + @list='$(nodist_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + dir='$(DESTDIR)$(gpgmeppincludedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique @@ -797,7 +805,7 @@ check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -856,7 +864,7 @@ install-data-am: install-data-local install-gpgmeppincludeHEADERS \ install-nobase_gpgmeppincludeHEADERS \ - install-nodist_includeHEADERS + install-nodist_gpgmeppincludeHEADERS install-dvi: install-dvi-am @@ -904,7 +912,7 @@ uninstall-am: uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \ uninstall-local uninstall-nobase_gpgmeppincludeHEADERS \ - uninstall-nodist_includeHEADERS + uninstall-nodist_gpgmeppincludeHEADERS .MAKE: install-am install-strip @@ -918,27 +926,29 @@ install-html install-html-am install-info install-info-am \ install-libLTLIBRARIES install-man \ install-nobase_gpgmeppincludeHEADERS \ - install-nodist_includeHEADERS install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + install-nodist_gpgmeppincludeHEADERS install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am \ uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \ uninstall-local uninstall-nobase_gpgmeppincludeHEADERS \ - uninstall-nodist_includeHEADERS - + uninstall-nodist_gpgmeppincludeHEADERS -GpgmeppConfig.cmake: GpgmeppConfig.cmake.in - sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@" - sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2 - mv "$@".2 "$@" +@HAVE_W32_SYSTEM_TRUE@GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in +@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ +@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ +@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ +@HAVE_W32_SYSTEM_FALSE@GpgmeppConfig.cmake: GpgmeppConfig.cmake.in +@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ +@HAVE_W32_SYSTEM_FALSE@ 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 -Nru gpgme1.0-1.7.0/lang/cpp/src/scdgetinfoassuantransaction.cpp gpgme1.0-1.8.0/lang/cpp/src/scdgetinfoassuantransaction.cpp --- gpgme1.0-1.7.0/lang/cpp/src/scdgetinfoassuantransaction.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/scdgetinfoassuantransaction.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/cpp/src/signingresult.cpp gpgme1.0-1.8.0/lang/cpp/src/signingresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/signingresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/signingresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" #include "util.h" diff -Nru gpgme1.0-1.7.0/lang/cpp/src/swdbresult.cpp gpgme1.0-1.8.0/lang/cpp/src/swdbresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/swdbresult.cpp 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/swdbresult.cpp 2016-11-09 07:34:15.000000000 +0000 @@ -0,0 +1,231 @@ +/* swdbresult.cpp - wraps gpgme swdb result / query + Copyright (C) 2016 Intevation 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 Library General Public + License as published by the Free Software Foundation; either + version 2 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 Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with GPGME++; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "swdbresult.h" + +#include + +#include "error.h" + +#include "gpgme.h" + +class GpgME::SwdbResult::Private +{ +public: + Private() {} + Private(gpgme_query_swdb_result_t result) + : mResult(result ? new _gpgme_op_query_swdb_result (*result) : nullptr) + { + if (!result) { + mResult->name = nullptr; + return; + } + if (result->name) { + mResult->name = strdup(result->name); + } + if (result->version) { + mVersion = result->version; + } + if (result->iversion) { + mIVersion = result->iversion; + } + } + + Private(const Private &other) + : mResult(other.mResult) + { + if (mResult && mResult->name) { + mResult->name = strdup(mResult->name); + } + mVersion = other.mVersion; + mIVersion = other.mIVersion; + } + + ~Private() + { + if (mResult) { + std::free(mResult->name); + delete mResult; + } + } + + GpgME::EngineInfo::Version mVersion; + GpgME::EngineInfo::Version mIVersion; + gpgme_query_swdb_result_t mResult; +}; + +GpgME::SwdbResult::SwdbResult(gpgme_query_swdb_result_t result) + : d(new Private(result)) +{ +} + +GpgME::SwdbResult::SwdbResult() : d() +{ +} + +bool GpgME::SwdbResult::isNull() const +{ + return !d || !d->mResult; +} + +std::string GpgME::SwdbResult::name() const +{ + if (isNull() || !d->mResult->name) { + return std::string(); + } + return d->mResult->name; +} + +GpgME::EngineInfo::Version GpgME::SwdbResult::version() const +{ + if (isNull()) { + return GpgME::EngineInfo::Version(); + } + return d->mVersion; +} + +GpgME::EngineInfo::Version GpgME::SwdbResult::installedVersion() const +{ + if (isNull()) { + return GpgME::EngineInfo::Version(); + } + return d->mIVersion; +} + +unsigned long GpgME::SwdbResult::created() const +{ + return isNull() ? 0 : d->mResult->created; +} + +unsigned long GpgME::SwdbResult::retrieved() const +{ + return isNull() ? 0 : d->mResult->retrieved; +} + +unsigned long GpgME::SwdbResult::releaseDate() const +{ + return isNull() ? 0 : d->mResult->reldate; +} + +bool GpgME::SwdbResult::warning() const +{ + return isNull() ? 0 : d->mResult->warning; +} + +bool GpgME::SwdbResult::update() const +{ + return isNull() ? 0 : d->mResult->update; +} + +bool GpgME::SwdbResult::noinfo() const +{ + return isNull() ? 0 : d->mResult->noinfo; +} + +bool GpgME::SwdbResult::unknown() const +{ + return isNull() ? 0 : d->mResult->unknown; +} + +bool GpgME::SwdbResult::error() const +{ + return isNull() ? 0 : d->mResult->error; +} + +bool GpgME::SwdbResult::tooOld() const +{ + return isNull() ? 0 : d->mResult->tooold; +} + +bool GpgME::SwdbResult::urgent() const +{ + return isNull() ? 0 : d->mResult->urgent; +} + +std::vector GpgME::SwdbResult::query(const char *name, + const char *iversion, + Error *err) +{ + std::vector ret; + gpgme_ctx_t ctx; + gpgme_error_t gpgerr = gpgme_new(&ctx); + + if (gpgerr) { + if (err) { + *err = Error (gpgerr); + } + return ret; + } + + gpgerr = gpgme_set_protocol(ctx, GPGME_PROTOCOL_GPGCONF); + + if (gpgerr) { + if (err) { + *err = Error(gpgerr); + } + gpgme_release(ctx); + return ret; + } + + gpgerr = gpgme_op_query_swdb(ctx, name, iversion, 0); + + if (gpgerr) { + if (err) { + *err = Error(gpgerr); + } + gpgme_release(ctx); + return ret; + } + gpgme_query_swdb_result_t result = gpgme_op_query_swdb_result(ctx); + while (result) { + ret.push_back(SwdbResult(result)); + result = result->next; + } + + gpgme_release(ctx); + return ret; +} + +std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::SwdbResult &result) +{ + os << "GpgME::SwdbResult("; + if (!result.isNull()) { + os << "\n name: " << result.name() + << "\n version: " << result.version() + << "\n installed: "<< result.installedVersion() + << "\n created: " << result.created() + << "\n retrieved: "<< result.retrieved() + << "\n warning: " << result.warning() + << "\n update: " << result.update() + << "\n urgent: " << result.urgent() + << "\n noinfo: " << result.noinfo() + << "\n unknown: " << result.unknown() + << "\n tooOld: " << result.tooOld() + << "\n error: " << result.error() + << "\n reldate: " << result.releaseDate() + << '\n'; + } + return os << ")\n"; +} diff -Nru gpgme1.0-1.7.0/lang/cpp/src/swdbresult.h gpgme1.0-1.8.0/lang/cpp/src/swdbresult.h --- gpgme1.0-1.7.0/lang/cpp/src/swdbresult.h 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/swdbresult.h 2016-11-09 07:34:15.000000000 +0000 @@ -0,0 +1,128 @@ +/* + swdbresult.h - wraps a gpgme swdb query / rsult + Copyright (C) 2016 Intevation 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 Library General Public + License as published by the Free Software Foundation; either + version 2 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 Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with GPGME++; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef __GPGMEPP_SWDB_H__ +#define __GPGMEPP_SWDB_H__ + +#include "gpgmepp_export.h" + +#include "global.h" +#include "engineinfo.h" + +#include +#include +#include +#include + +namespace GpgME +{ + +class GPGMEPP_EXPORT SwdbResult +{ +public: + /* Obtain swdb results through query() */ + SwdbResult(); + explicit SwdbResult(gpgme_query_swdb_result_t result); + + /** Query the swdb to get information about updates. + * + * Runs gpgconf --query-swdb through gpgme and + * returns a list of results. + * If iversion is given as NULL a check is only done if GPGME + * can figure out the version by itself (for example when using + * "gpgme" or "gnupg"). + * + * If NULL is used for name the current gpgme version is + * checked. + * + * @param name: Name of the component to query. + * @param iversion: Optionally the installed version. + * @param err: Optional error. + */ + static std::vector query(const char *name, + const char *iversion = NULL, + Error *err = NULL); + + const SwdbResult &operator=(SwdbResult other) + { + swap(other); + return *this; + } + + void swap(SwdbResult &other) + { + using std::swap; + swap(this->d, other.d); + } + bool isNull() const; + + /* The name of the package (e.g. "gpgme", "gnupg") */ + std::string name() const; + + /* The version of the installed version. */ + EngineInfo::Version installedVersion() const; + + /* The time the online info was created. */ + unsigned long created() const; + + /* The time the online info was retrieved. */ + unsigned long retrieved() const; + + /* This bit is set if an error occured or some of the information + * in this structure may not be set. */ + bool warning() const; + + /* An update is available. */ + bool update() const; + + /* The update is important. */ + bool urgent() const; + + /* No information at all available. */ + bool noinfo() const; + + /* The package name is not known. */ + bool unknown() const; + + /* The information here is too old. */ + bool tooOld() const; + + /* Other error. */ + bool error() const; + + /* The version of the latest released version. */ + EngineInfo::Version version() const; + + /* The release date of that version. */ + unsigned long releaseDate() const; + +private: + class Private; + std::shared_ptr d; +}; + +GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SwdbResult &info); + +} // namespace GpgME + +GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SwdbResult) + +#endif diff -Nru gpgme1.0-1.7.0/lang/cpp/src/tofuinfo.cpp gpgme1.0-1.8.0/lang/cpp/src/tofuinfo.cpp --- gpgme1.0-1.7.0/lang/cpp/src/tofuinfo.cpp 2016-09-07 07:03:36.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/tofuinfo.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -19,6 +19,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "tofuinfo.h" #include @@ -109,6 +113,7 @@ case GPGME_TOFU_POLICY_ASK: return PolicyAsk; case GPGME_TOFU_POLICY_UNKNOWN: + default: return PolicyUnknown; } } diff -Nru gpgme1.0-1.7.0/lang/cpp/src/tofuinfo.h gpgme1.0-1.8.0/lang/cpp/src/tofuinfo.h --- gpgme1.0-1.7.0/lang/cpp/src/tofuinfo.h 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/tofuinfo.h 2016-11-09 07:34:15.000000000 +0000 @@ -25,8 +25,6 @@ #include "gpgmepp_export.h" -#include "gpgme.h" - #include "global.h" #include diff -Nru gpgme1.0-1.7.0/lang/cpp/src/trustitem.cpp gpgme1.0-1.8.0/lang/cpp/src/trustitem.cpp --- gpgme1.0-1.7.0/lang/cpp/src/trustitem.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/trustitem.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,6 +20,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include diff -Nru gpgme1.0-1.7.0/lang/cpp/src/verificationresult.cpp gpgme1.0-1.8.0/lang/cpp/src/verificationresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/verificationresult.cpp 2016-08-24 13:59:45.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/verificationresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -20,11 +20,16 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include #include "result_p.h" #include "util.h" #include "key.h" +#include "context.h" #include @@ -68,6 +73,8 @@ // copy keys if (scopy->key) { keys.push_back(Key(scopy->key, true)); + } else { + keys.push_back(Key()); } // copy notations: nota.push_back(std::vector()); @@ -115,6 +122,7 @@ std::vector keys; std::vector purls; std::string file_name; + Protocol proto; }; GpgME::VerificationResult::VerificationResult(gpgme_ctx_t ctx, int error) @@ -139,6 +147,10 @@ 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 @@ 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 -Nru gpgme1.0-1.7.0/lang/cpp/src/verificationresult.h gpgme1.0-1.8.0/lang/cpp/src/verificationresult.h --- gpgme1.0-1.7.0/lang/cpp/src/verificationresult.h 2016-08-24 13:59:45.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/verificationresult.h 2016-10-18 17:22:02.000000000 +0000 @@ -163,6 +163,27 @@ * 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 d; unsigned int idx; diff -Nru gpgme1.0-1.7.0/lang/cpp/src/vfsmountresult.cpp gpgme1.0-1.8.0/lang/cpp/src/vfsmountresult.cpp --- gpgme1.0-1.7.0/lang/cpp/src/vfsmountresult.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/cpp/src/vfsmountresult.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -21,6 +21,10 @@ Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include "result_p.h" diff -Nru gpgme1.0-1.7.0/lang/Makefile.in gpgme1.0-1.8.0/lang/Makefile.in --- gpgme1.0-1.7.0/lang/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -328,6 +328,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/lang/python/examples/assuan.py gpgme1.0-1.8.0/lang/python/examples/assuan.py --- gpgme1.0-1.7.0/lang/python/examples/assuan.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/assuan.py 2016-11-16 09:18:20.000000000 +0000 @@ -20,9 +20,9 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import pyme +import gpg -with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c: +with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: # Invoke the pinentry to get a confirmation. err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there']) print("You chose {}.".format("cancel" if err else "ok")) diff -Nru gpgme1.0-1.7.0/lang/python/examples/decryption-filter.py gpgme1.0-1.8.0/lang/python/examples/decryption-filter.py --- gpgme1.0-1.7.0/lang/python/examples/decryption-filter.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/decryption-filter.py 2016-11-16 09:18:20.000000000 +0000 @@ -17,7 +17,7 @@ """A decryption filter -This demonstrates decryption using pyme3 in three lines of code. To +This demonstrates decryption using gpg3 in three lines of code. To be used like this: ./decryption-filter.py message.plain @@ -28,5 +28,5 @@ del absolute_import, print_function, unicode_literals import sys -import pyme -pyme.Context().decrypt(sys.stdin, sink=sys.stdout) +import gpg +gpg.Context().decrypt(sys.stdin, sink=sys.stdout) diff -Nru gpgme1.0-1.7.0/lang/python/examples/delkey.py gpgme1.0-1.8.0/lang/python/examples/delkey.py --- gpgme1.0-1.7.0/lang/python/examples/delkey.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/delkey.py 2016-11-16 09:18:20.000000000 +0000 @@ -22,12 +22,12 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import pyme +import gpg -with pyme.Context() as c: +with gpg.Context() as c: # Note: We must not modify the key store during iteration, # therefore, we explicitly make a list. - keys = list(c.keylist("joe+pyme@example.org")) + keys = list(c.keylist("joe+gpg@example.org")) for k in keys: c.op_delete(k, True) diff -Nru gpgme1.0-1.7.0/lang/python/examples/encrypt-to-all.py gpgme1.0-1.8.0/lang/python/examples/encrypt-to-all.py --- gpgme1.0-1.7.0/lang/python/examples/encrypt-to-all.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/encrypt-to-all.py 2016-11-16 09:18:20.000000000 +0000 @@ -26,9 +26,9 @@ del absolute_import, print_function, unicode_literals import sys -import pyme +import gpg -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c: recipients = list() for key in c.keylist(): valid = 0 @@ -42,7 +42,7 @@ try: ciphertext, _, _ = c.encrypt(b'This is my message.', recipients=recipients) - except pyme.errors.InvalidRecipients as e: + except gpg.errors.InvalidRecipients as e: print("Encryption failed for these keys:\n{0!s}".format(e)) # filter out the bad keys diff -Nru gpgme1.0-1.7.0/lang/python/examples/exportimport.py gpgme1.0-1.8.0/lang/python/examples/exportimport.py --- gpgme1.0-1.7.0/lang/python/examples/exportimport.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/exportimport.py 2016-11-16 09:18:20.000000000 +0000 @@ -17,18 +17,18 @@ # along with this program; if not, see . # Sample of export and import of keys -# It uses keys for joe+pyme@example.org generated by genkey.py script +# It uses keys for joe+gpg@example.org generated by genkey.py script from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals import sys import os -import pyme +import gpg -user = "joe+pyme@example.org" +user = "joe+gpg@example.org" -with pyme.Context(armor=True) as c, pyme.Data() as expkey: +with gpg.Context(armor=True) as c, gpg.Data() as expkey: print(" - Export %s's public keys - " % user) c.op_export(user, 0, expkey) @@ -43,7 +43,7 @@ # delete keys to ensure that they came from our imported data. Note # that if joe's key has private part as well we can only delete both # of them. -with pyme.Context() as c: +with gpg.Context() as c: # Note: We must not modify the key store during iteration, # therfore, we explicitly make a list. keys = list(c.keylist(user)) @@ -51,7 +51,7 @@ for k in keys: c.op_delete(k, True) -with pyme.Context() as c: +with gpg.Context() as c: print(" - Import exported keys - ") c.op_import(expstring) result = c.op_import_result() diff -Nru gpgme1.0-1.7.0/lang/python/examples/genkey.py gpgme1.0-1.8.0/lang/python/examples/genkey.py --- gpgme1.0-1.7.0/lang/python/examples/genkey.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/genkey.py 2016-11-16 09:18:20.000000000 +0000 @@ -20,7 +20,7 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import pyme +import gpg # This is the example from the GPGME manual. @@ -31,14 +31,14 @@ Subkey-Length: 2048 Name-Real: Joe Tester Name-Comment: with stupid passphrase -Name-Email: joe+pyme@example.org +Name-Email: joe+gpg@example.org Passphrase: Crypt0R0cks Expire-Date: 2020-12-31 """ -with pyme.Context() as c: - c.set_progress_cb(pyme.callbacks.progress_stdout) +with gpg.Context() as c: + c.set_progress_cb(gpg.callbacks.progress_stdout) c.op_genkey(parms, None, None) print("Generated key with fingerprint {0}.".format( c.op_genkey_result().fpr)) diff -Nru gpgme1.0-1.7.0/lang/python/examples/inter-edit.py gpgme1.0-1.8.0/lang/python/examples/inter-edit.py --- gpgme1.0-1.7.0/lang/python/examples/inter-edit.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/inter-edit.py 2016-11-16 09:18:20.000000000 +0000 @@ -22,14 +22,14 @@ del absolute_import, print_function, unicode_literals import sys -import pyme +import gpg if len(sys.argv) != 2: sys.exit("Usage: %s \n" % sys.argv[0]) name = sys.argv[1] -with pyme.Context() as c: +with gpg.Context() as c: keys = list(c.keylist(name)) if len(keys) == 0: sys.exit("No key matching {}.".format(name)) @@ -40,8 +40,8 @@ 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 -Nru gpgme1.0-1.7.0/lang/python/examples/sign.py gpgme1.0-1.8.0/lang/python/examples/sign.py --- gpgme1.0-1.7.0/lang/python/examples/sign.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/sign.py 2016-11-16 09:18:20.000000000 +0000 @@ -20,9 +20,9 @@ del absolute_import, print_function, unicode_literals import sys -import pyme -from pyme.constants.sig import mode +import gpg +from gpg.constants.sig import mode -with pyme.Context() as c: +with gpg.Context() as c: signed, _ = c.sign(b"Test message", mode=mode.CLEAR) sys.stdout.buffer.write(signed) diff -Nru gpgme1.0-1.7.0/lang/python/examples/signverify.py gpgme1.0-1.8.0/lang/python/examples/signverify.py --- gpgme1.0-1.7.0/lang/python/examples/signverify.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/signverify.py 2016-11-16 09:18:20.000000000 +0000 @@ -17,18 +17,18 @@ # along with this program; if not, see . # Sample of unattended signing/verifying of a message. -# It uses keys for joe+pyme@example.org generated by genkey.py script +# It uses keys for joe+gpg@example.org generated by genkey.py script from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals import sys -import pyme -from pyme.constants.sig import mode +import gpg +from gpg.constants.sig import mode -user = "joe+pyme" +user = "joe+gpg" -with pyme.Context(pinentry_mode=pyme.constants.PINENTRY_MODE_LOOPBACK) as c: +with gpg.Context(pinentry_mode=gpg.constants.PINENTRY_MODE_LOOPBACK) as c: keys = list(c.keylist(user)) if len(keys) == 0: sys.exit("No key matching {}.".format(user)) diff -Nru gpgme1.0-1.7.0/lang/python/examples/simple.py gpgme1.0-1.8.0/lang/python/examples/simple.py --- gpgme1.0-1.7.0/lang/python/examples/simple.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/simple.py 2016-11-16 09:18:20.000000000 +0000 @@ -21,9 +21,9 @@ del absolute_import, print_function, unicode_literals import sys -import pyme +import gpg -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c: recipients = [] print("Enter name of your recipient(s), end with a blank line.") while True: diff -Nru gpgme1.0-1.7.0/lang/python/examples/testCMSgetkey.py gpgme1.0-1.8.0/lang/python/examples/testCMSgetkey.py --- gpgme1.0-1.7.0/lang/python/examples/testCMSgetkey.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/testCMSgetkey.py 2016-11-16 09:18:20.000000000 +0000 @@ -22,13 +22,13 @@ del absolute_import, print_function, unicode_literals import sys -import pyme +import gpg 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) +with gpg.Context(protocol=gpg.constants.protocol.CMS) as c: + key = c.get_key(sys.argv[1]) print("got key: ", key.subkeys[0].fpr) for uid in key.uids: diff -Nru gpgme1.0-1.7.0/lang/python/examples/verifydetails.py gpgme1.0-1.8.0/lang/python/examples/verifydetails.py --- gpgme1.0-1.7.0/lang/python/examples/verifydetails.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/examples/verifydetails.py 2016-11-16 09:18:20.000000000 +0000 @@ -21,24 +21,23 @@ del absolute_import, print_function, unicode_literals import sys -from pyme import core -from pyme.constants import protocol +import gpg def print_engine_infos(): - print("gpgme version:", core.check_version(None)) + print("gpgme version:", gpg.core.check_version(None)) print("engines:") - for engine in core.get_engine_info(): + for engine in gpg.core.get_engine_info(): print(engine.file_name, engine.version) - for proto in [protocol.OpenPGP, protocol.CMS]: - print("Have {}? {}".format(core.get_protocol_name(proto), - core.engine_check_version(proto))) + for proto in [gpg.constants.protocol.OpenPGP, gpg.constants.protocol.CMS]: + print("Have {}? {}".format(gpg.core.get_protocol_name(proto), + gpg.core.engine_check_version(proto))) def verifyprintdetails(filename, detached_sig_filename=None): """Verify a signature, print a lot of details.""" - with core.Context() as c: + with gpg.Context() as c: # Verify. data, result = c.verify(open(filename), @@ -52,7 +51,7 @@ 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 -Nru gpgme1.0-1.7.0/lang/python/gpg/callbacks.py gpgme1.0-1.8.0/lang/python/gpg/callbacks.py --- gpgme1.0-1.7.0/lang/python/gpg/callbacks.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/callbacks.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,49 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from getpass import getpass + +def passphrase_stdin(hint, desc, prev_bad, hook=None): + """This is a sample callback that will read a passphrase from + the terminal. The hook here, if present, will be used to describe + why the passphrase is needed.""" + why = '' + if hook != None: + why = ' ' + hook + if prev_bad: + why += ' (again)' + print("Please supply %s' password%s:" % (hint, why)) + return getpass() + +def progress_stdout(what, type, current, total, hook=None): + print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %\ + (what, type, current, total)) + +def readcb_fh(count, hook): + """A callback for data. hook should be a Python file-like object.""" + if count: + # Should return '' on EOF + return hook.read(count) + else: + # Wants to rewind. + if not hasattr(hook, 'seek'): + return None + hook.seek(0, 0) + return None diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/data/encoding.py gpgme1.0-1.8.0/lang/python/gpg/constants/data/encoding.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/data/encoding.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/data/encoding.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_DATA_ENCODING_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/data/__init__.py gpgme1.0-1.8.0/lang/python/gpg/constants/data/__init__.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/data/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/data/__init__.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,6 @@ + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from . import encoding +__all__ = ['encoding'] diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/event.py gpgme1.0-1.8.0/lang/python/gpg/constants/event.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/event.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/event.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_EVENT_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/import.py gpgme1.0-1.8.0/lang/python/gpg/constants/import.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/import.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/import.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_IMPORT_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/__init__.py gpgme1.0-1.8.0/lang/python/gpg/constants/__init__.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/__init__.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,142 @@ +# Constants. +# +# Copyright (C) 2016 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, see . + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_', globals()) +del util + +# For convenience, we import the modules here. +from . import data, event, keylist, md, pk +from . import protocol, sig, sigsum, status, validity + +# A complication arises because 'import' is a reserved keyword. +# Import it as 'Import' instead. +globals()['Import'] = getattr(__import__('', globals(), locals(), + [str('import')], 1), "import") + +__all__ = ['data', 'event', 'import', 'keylist', 'md', 'pk', + 'protocol', 'sig', 'sigsum', 'status', 'validity'] + +# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We +# implement gpg.Context.op_edit using gpgme_op_interact, so the +# callbacks will be called with string keywords instead of numeric +# status messages. Code that is using these constants will continue +# to work. + +STATUS_ABORT = "ABORT" +STATUS_ALREADY_SIGNED = "ALREADY_SIGNED" +STATUS_ATTRIBUTE = "ATTRIBUTE" +STATUS_BACKUP_KEY_CREATED = "BACKUP_KEY_CREATED" +STATUS_BAD_PASSPHRASE = "BAD_PASSPHRASE" +STATUS_BADARMOR = "BADARMOR" +STATUS_BADMDC = "BADMDC" +STATUS_BADSIG = "BADSIG" +STATUS_BEGIN_DECRYPTION = "BEGIN_DECRYPTION" +STATUS_BEGIN_ENCRYPTION = "BEGIN_ENCRYPTION" +STATUS_BEGIN_SIGNING = "BEGIN_SIGNING" +STATUS_BEGIN_STREAM = "BEGIN_STREAM" +STATUS_CARDCTRL = "CARDCTRL" +STATUS_DECRYPTION_FAILED = "DECRYPTION_FAILED" +STATUS_DECRYPTION_INFO = "DECRYPTION_INFO" +STATUS_DECRYPTION_OKAY = "DECRYPTION_OKAY" +STATUS_DELETE_PROBLEM = "DELETE_PROBLEM" +STATUS_ENC_TO = "ENC_TO" +STATUS_END_DECRYPTION = "END_DECRYPTION" +STATUS_END_ENCRYPTION = "END_ENCRYPTION" +STATUS_END_STREAM = "END_STREAM" +STATUS_ENTER = "ENTER" +STATUS_ERRMDC = "ERRMDC" +STATUS_ERROR = "ERROR" +STATUS_ERRSIG = "ERRSIG" +STATUS_EXPKEYSIG = "EXPKEYSIG" +STATUS_EXPSIG = "EXPSIG" +STATUS_FAILURE = "FAILURE" +STATUS_FILE_DONE = "FILE_DONE" +STATUS_FILE_ERROR = "FILE_ERROR" +STATUS_FILE_START = "FILE_START" +STATUS_GET_BOOL = "GET_BOOL" +STATUS_GET_HIDDEN = "GET_HIDDEN" +STATUS_GET_LINE = "GET_LINE" +STATUS_GOOD_PASSPHRASE = "GOOD_PASSPHRASE" +STATUS_GOODMDC = "GOODMDC" +STATUS_GOODSIG = "GOODSIG" +STATUS_GOT_IT = "GOT_IT" +STATUS_IMPORT_OK = "IMPORT_OK" +STATUS_IMPORT_PROBLEM = "IMPORT_PROBLEM" +STATUS_IMPORT_RES = "IMPORT_RES" +STATUS_IMPORTED = "IMPORTED" +STATUS_INQUIRE_MAXLEN = "INQUIRE_MAXLEN" +STATUS_INV_RECP = "INV_RECP" +STATUS_INV_SGNR = "INV_SGNR" +STATUS_KEY_CONSIDERED = "KEY_CONSIDERED" +STATUS_KEY_CREATED = "KEY_CREATED" +STATUS_KEY_NOT_CREATED = "KEY_NOT_CREATED" +STATUS_KEYEXPIRED = "KEYEXPIRED" +STATUS_KEYREVOKED = "KEYREVOKED" +STATUS_LEAVE = "LEAVE" +STATUS_MISSING_PASSPHRASE = "MISSING_PASSPHRASE" +STATUS_MOUNTPOINT = "MOUNTPOINT" +STATUS_NEED_PASSPHRASE = "NEED_PASSPHRASE" +STATUS_NEED_PASSPHRASE_PIN = "NEED_PASSPHRASE_PIN" +STATUS_NEED_PASSPHRASE_SYM = "NEED_PASSPHRASE_SYM" +STATUS_NEWSIG = "NEWSIG" +STATUS_NO_PUBKEY = "NO_PUBKEY" +STATUS_NO_RECP = "NO_RECP" +STATUS_NO_SECKEY = "NO_SECKEY" +STATUS_NO_SGNR = "NO_SGNR" +STATUS_NODATA = "NODATA" +STATUS_NOTATION_DATA = "NOTATION_DATA" +STATUS_NOTATION_FLAGS = "NOTATION_FLAGS" +STATUS_NOTATION_NAME = "NOTATION_NAME" +STATUS_PINENTRY_LAUNCHED = "PINENTRY_LAUNCHED" +STATUS_PKA_TRUST_BAD = "PKA_TRUST_BAD" +STATUS_PKA_TRUST_GOOD = "PKA_TRUST_GOOD" +STATUS_PLAINTEXT = "PLAINTEXT" +STATUS_PLAINTEXT_LENGTH = "PLAINTEXT_LENGTH" +STATUS_POLICY_URL = "POLICY_URL" +STATUS_PROGRESS = "PROGRESS" +STATUS_REVKEYSIG = "REVKEYSIG" +STATUS_RSA_OR_IDEA = "RSA_OR_IDEA" +STATUS_SC_OP_FAILURE = "SC_OP_FAILURE" +STATUS_SC_OP_SUCCESS = "SC_OP_SUCCESS" +STATUS_SESSION_KEY = "SESSION_KEY" +STATUS_SHM_GET = "SHM_GET" +STATUS_SHM_GET_BOOL = "SHM_GET_BOOL" +STATUS_SHM_GET_HIDDEN = "SHM_GET_HIDDEN" +STATUS_SHM_INFO = "SHM_INFO" +STATUS_SIG_CREATED = "SIG_CREATED" +STATUS_SIG_ID = "SIG_ID" +STATUS_SIG_SUBPACKET = "SIG_SUBPACKET" +STATUS_SIGEXPIRED = "SIGEXPIRED" +STATUS_SUCCESS = "SUCCESS" +STATUS_TOFU_STATS = "TOFU_STATS" +STATUS_TOFU_STATS_LONG = "TOFU_STATS_LONG" +STATUS_TOFU_USER = "TOFU_USER" +STATUS_TRUNCATED = "TRUNCATED" +STATUS_TRUST_FULLY = "TRUST_FULLY" +STATUS_TRUST_MARGINAL = "TRUST_MARGINAL" +STATUS_TRUST_NEVER = "TRUST_NEVER" +STATUS_TRUST_ULTIMATE = "TRUST_ULTIMATE" +STATUS_TRUST_UNDEFINED = "TRUST_UNDEFINED" +STATUS_UNEXPECTED = "UNEXPECTED" +STATUS_USERID_HINT = "USERID_HINT" +STATUS_VALIDSIG = "VALIDSIG" diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/keylist/__init__.py gpgme1.0-1.8.0/lang/python/gpg/constants/keylist/__init__.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/keylist/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/keylist/__init__.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,6 @@ + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from . import mode +__all__ = ['mode'] diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/keylist/mode.py gpgme1.0-1.8.0/lang/python/gpg/constants/keylist/mode.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/keylist/mode.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/keylist/mode.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_KEYLIST_MODE_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/md.py gpgme1.0-1.8.0/lang/python/gpg/constants/md.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/md.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/md.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_MD_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/pk.py gpgme1.0-1.8.0/lang/python/gpg/constants/pk.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/pk.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/pk.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_PK_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/protocol.py gpgme1.0-1.8.0/lang/python/gpg/constants/protocol.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/protocol.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/protocol.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_PROTOCOL_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/sig/__init__.py gpgme1.0-1.8.0/lang/python/gpg/constants/sig/__init__.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/sig/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/sig/__init__.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,6 @@ + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from . import mode, notation +__all__ = ['mode', 'notation'] diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/sig/mode.py gpgme1.0-1.8.0/lang/python/gpg/constants/sig/mode.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/sig/mode.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/sig/mode.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_SIG_MODE_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/sig/notation.py gpgme1.0-1.8.0/lang/python/gpg/constants/sig/notation.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/sig/notation.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/sig/notation.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,25 @@ +# Constants for signature notation data. +# +# Copyright (C) 2016 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, see . + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_SIG_NOTATION_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/sigsum.py gpgme1.0-1.8.0/lang/python/gpg/constants/sigsum.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/sigsum.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/sigsum.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_SIGSUM_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/status.py gpgme1.0-1.8.0/lang/python/gpg/constants/status.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/status.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/status.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,124 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We +# implement gpg.Context.op_edit using gpgme_op_interact, so the +# callbacks will be called with string keywords instead of numeric +# status messages. Code that is using these constants will continue +# to work. + +ABORT = "ABORT" +ALREADY_SIGNED = "ALREADY_SIGNED" +ATTRIBUTE = "ATTRIBUTE" +BACKUP_KEY_CREATED = "BACKUP_KEY_CREATED" +BAD_PASSPHRASE = "BAD_PASSPHRASE" +BADARMOR = "BADARMOR" +BADMDC = "BADMDC" +BADSIG = "BADSIG" +BEGIN_DECRYPTION = "BEGIN_DECRYPTION" +BEGIN_ENCRYPTION = "BEGIN_ENCRYPTION" +BEGIN_SIGNING = "BEGIN_SIGNING" +BEGIN_STREAM = "BEGIN_STREAM" +CARDCTRL = "CARDCTRL" +DECRYPTION_FAILED = "DECRYPTION_FAILED" +DECRYPTION_INFO = "DECRYPTION_INFO" +DECRYPTION_OKAY = "DECRYPTION_OKAY" +DELETE_PROBLEM = "DELETE_PROBLEM" +ENC_TO = "ENC_TO" +END_DECRYPTION = "END_DECRYPTION" +END_ENCRYPTION = "END_ENCRYPTION" +END_STREAM = "END_STREAM" +ENTER = "ENTER" +ERRMDC = "ERRMDC" +ERROR = "ERROR" +ERRSIG = "ERRSIG" +EXPKEYSIG = "EXPKEYSIG" +EXPSIG = "EXPSIG" +FAILURE = "FAILURE" +FILE_DONE = "FILE_DONE" +FILE_ERROR = "FILE_ERROR" +FILE_START = "FILE_START" +GET_BOOL = "GET_BOOL" +GET_HIDDEN = "GET_HIDDEN" +GET_LINE = "GET_LINE" +GOOD_PASSPHRASE = "GOOD_PASSPHRASE" +GOODMDC = "GOODMDC" +GOODSIG = "GOODSIG" +GOT_IT = "GOT_IT" +IMPORT_OK = "IMPORT_OK" +IMPORT_PROBLEM = "IMPORT_PROBLEM" +IMPORT_RES = "IMPORT_RES" +IMPORTED = "IMPORTED" +INQUIRE_MAXLEN = "INQUIRE_MAXLEN" +INV_RECP = "INV_RECP" +INV_SGNR = "INV_SGNR" +KEY_CONSIDERED = "KEY_CONSIDERED" +KEY_CREATED = "KEY_CREATED" +KEY_NOT_CREATED = "KEY_NOT_CREATED" +KEYEXPIRED = "KEYEXPIRED" +KEYREVOKED = "KEYREVOKED" +LEAVE = "LEAVE" +MISSING_PASSPHRASE = "MISSING_PASSPHRASE" +MOUNTPOINT = "MOUNTPOINT" +NEED_PASSPHRASE = "NEED_PASSPHRASE" +NEED_PASSPHRASE_PIN = "NEED_PASSPHRASE_PIN" +NEED_PASSPHRASE_SYM = "NEED_PASSPHRASE_SYM" +NEWSIG = "NEWSIG" +NO_PUBKEY = "NO_PUBKEY" +NO_RECP = "NO_RECP" +NO_SECKEY = "NO_SECKEY" +NO_SGNR = "NO_SGNR" +NODATA = "NODATA" +NOTATION_DATA = "NOTATION_DATA" +NOTATION_FLAGS = "NOTATION_FLAGS" +NOTATION_NAME = "NOTATION_NAME" +PINENTRY_LAUNCHED = "PINENTRY_LAUNCHED" +PKA_TRUST_BAD = "PKA_TRUST_BAD" +PKA_TRUST_GOOD = "PKA_TRUST_GOOD" +PLAINTEXT = "PLAINTEXT" +PLAINTEXT_LENGTH = "PLAINTEXT_LENGTH" +POLICY_URL = "POLICY_URL" +PROGRESS = "PROGRESS" +REVKEYSIG = "REVKEYSIG" +RSA_OR_IDEA = "RSA_OR_IDEA" +SC_OP_FAILURE = "SC_OP_FAILURE" +SC_OP_SUCCESS = "SC_OP_SUCCESS" +SESSION_KEY = "SESSION_KEY" +SHM_GET = "SHM_GET" +SHM_GET_BOOL = "SHM_GET_BOOL" +SHM_GET_HIDDEN = "SHM_GET_HIDDEN" +SHM_INFO = "SHM_INFO" +SIG_CREATED = "SIG_CREATED" +SIG_ID = "SIG_ID" +SIG_SUBPACKET = "SIG_SUBPACKET" +SIGEXPIRED = "SIGEXPIRED" +SUCCESS = "SUCCESS" +TOFU_STATS = "TOFU_STATS" +TOFU_STATS_LONG = "TOFU_STATS_LONG" +TOFU_USER = "TOFU_USER" +TRUNCATED = "TRUNCATED" +TRUST_FULLY = "TRUST_FULLY" +TRUST_MARGINAL = "TRUST_MARGINAL" +TRUST_NEVER = "TRUST_NEVER" +TRUST_ULTIMATE = "TRUST_ULTIMATE" +TRUST_UNDEFINED = "TRUST_UNDEFINED" +UNEXPECTED = "UNEXPECTED" +USERID_HINT = "USERID_HINT" +VALIDSIG = "VALIDSIG" diff -Nru gpgme1.0-1.7.0/lang/python/gpg/constants/validity.py gpgme1.0-1.8.0/lang/python/gpg/constants/validity.py --- gpgme1.0-1.7.0/lang/python/gpg/constants/validity.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/constants/validity.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from gpg import util +util.process_constants('GPGME_VALIDITY_', globals()) +del util diff -Nru gpgme1.0-1.7.0/lang/python/gpg/core.py gpgme1.0-1.8.0/lang/python/gpg/core.py --- gpgme1.0-1.7.0/lang/python/gpg/core.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/core.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,1164 @@ +# Copyright (C) 2016 g10 Code GmbH +# Copyright (C) 2004,2008 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +"""Core functionality + +Core functionality of GPGME wrapped in a object-oriented fashion. +Provides the 'Context' class for performing cryptographic operations, +and the 'Data' class describing buffers of data. + +""" + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +import re +import os +import warnings +import weakref +from . import gpgme +from .errors import errorcheck, GPGMEError +from . import constants +from . import errors +from . import util + +class GpgmeWrapper(object): + """Base wrapper class + + Not to be instantiated directly. + + """ + + def __init__(self, wrapped): + self._callback_excinfo = None + self.wrapped = wrapped + + def __repr__(self): + return '<{}/{!r}>'.format(super(GpgmeWrapper, self).__repr__(), + self.wrapped) + + def __str__(self): + acc = ['{}.{}'.format(__name__, self.__class__.__name__)] + flags = [f for f in self._boolean_properties if getattr(self, f)] + if flags: + acc.append('({})'.format(' '.join(flags))) + + return '<{}>'.format(' '.join(acc)) + + def __hash__(self): + return hash(repr(self.wrapped)) + + def __eq__(self, other): + if other == None: + return False + else: + return repr(self.wrapped) == repr(other.wrapped) + + @property + def _ctype(self): + """The name of the c type wrapped by this class + + Must be set by child classes. + + """ + raise NotImplementedError() + + @property + def _cprefix(self): + """The common prefix of c functions wrapped by this class + + Must be set by child classes. + + """ + raise NotImplementedError() + + def _errorcheck(self, name): + """Must be implemented by child classes. + + This function must return a trueish value for all c functions + returning gpgme_error_t.""" + raise NotImplementedError() + + """The set of all boolean properties""" + _boolean_properties = set() + + def __wrap_boolean_property(self, key, do_set=False, value=None): + get_func = getattr(gpgme, + "{}get_{}".format(self._cprefix, key)) + set_func = getattr(gpgme, + "{}set_{}".format(self._cprefix, key)) + def get(slf): + return bool(get_func(slf.wrapped)) + def set_(slf, value): + set_func(slf.wrapped, bool(value)) + + p = property(get, set_, doc="{} flag".format(key)) + setattr(self.__class__, key, p) + + if do_set: + set_(self, bool(value)) + else: + return get(self) + + _munge_docstring = re.compile(r'gpgme_([^(]*)\(([^,]*), (.*\) -> .*)') + def __getattr__(self, key): + """On-the-fly generation of wrapper methods and properties""" + if key[0] == '_' or self._cprefix == None: + return None + + if key in self._boolean_properties: + return self.__wrap_boolean_property(key) + + name = self._cprefix + key + func = getattr(gpgme, name) + + if self._errorcheck(name): + def _funcwrap(slf, *args): + result = func(slf.wrapped, *args) + if slf._callback_excinfo: + gpgme.gpg_raise_callback_exception(slf) + return errorcheck(result, "Invocation of " + name) + else: + def _funcwrap(slf, *args): + result = func(slf.wrapped, *args) + if slf._callback_excinfo: + gpgme.gpg_raise_callback_exception(slf) + return result + + doc = self._munge_docstring.sub(r'\2.\1(\3', getattr(func, "__doc__")) + _funcwrap.__doc__ = doc + + # Monkey-patch the class. + setattr(self.__class__, key, _funcwrap) + + # Bind the method to 'self'. + def wrapper(*args): + return _funcwrap(self, *args) + wrapper.__doc__ = doc + + return wrapper + + def __setattr__(self, key, value): + """On-the-fly generation of properties""" + if key in self._boolean_properties: + self.__wrap_boolean_property(key, True, value) + else: + super(GpgmeWrapper, self).__setattr__(key, value) + +class Context(GpgmeWrapper): + """Context for cryptographic operations + + All cryptographic operations in GPGME are performed within a + context, which contains the internal state of the operation as + well as configuration parameters. By using several contexts you + can run several cryptographic operations in parallel, with + different configuration. + + Access to a context must be synchronized. + + """ + + def __init__(self, armor=False, textmode=False, offline=False, + signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT, + protocol=constants.PROTOCOL_OpenPGP, + wrapped=None): + """Construct a context object + + Keyword arguments: + armor -- enable ASCII armoring (default False) + textmode -- enable canonical text mode (default False) + offline -- do not contact external key sources (default False) + signers -- list of keys used for signing (default []) + pinentry_mode -- pinentry mode (default PINENTRY_MODE_DEFAULT) + protocol -- protocol to use (default PROTOCOL_OpenPGP) + + """ + if wrapped: + self.own = False + else: + tmp = gpgme.new_gpgme_ctx_t_p() + errorcheck(gpgme.gpgme_new(tmp)) + wrapped = gpgme.gpgme_ctx_t_p_value(tmp) + gpgme.delete_gpgme_ctx_t_p(tmp) + self.own = True + super(Context, self).__init__(wrapped) + self.armor = armor + self.textmode = textmode + self.offline = offline + self.signers = signers + self.pinentry_mode = pinentry_mode + self.protocol = protocol + + def encrypt(self, plaintext, recipients=[], sign=True, sink=None, + passphrase=None, always_trust=False, add_encrypt_to=False, + prepare=False, expect_sign=False, compress=True): + """Encrypt data + + Encrypt the given plaintext for the given recipients. If the + list of recipients is empty, the data is encrypted + symmetrically with a passphrase. + + The passphrase can be given as parameter, using a callback + registered at the context, or out-of-band via pinentry. + + Keyword arguments: + recipients -- list of keys to encrypt to + sign -- sign plaintext (default True) + sink -- write result to sink instead of returning it + passphrase -- for symmetric encryption + always_trust -- always trust the keys (default False) + add_encrypt_to -- encrypt to configured additional keys (default False) + prepare -- (ui) prepare for encryption (default False) + expect_sign -- (ui) prepare for signing (default False) + compress -- compress plaintext (default True) + + Returns: + ciphertext -- the encrypted data (or None if sink is given) + result -- additional information about the encryption + sign_result -- additional information about the signature(s) + + Raises: + InvalidRecipients -- if encryption using a particular key failed + InvalidSigners -- if signing using a particular key failed + GPGMEError -- as signaled by the underlying library + + """ + ciphertext = sink if sink else Data() + flags = 0 + flags |= always_trust * constants.ENCRYPT_ALWAYS_TRUST + flags |= (not add_encrypt_to) * constants.ENCRYPT_NO_ENCRYPT_TO + flags |= prepare * constants.ENCRYPT_PREPARE + flags |= expect_sign * constants.ENCRYPT_EXPECT_SIGN + flags |= (not compress) * constants.ENCRYPT_NO_COMPRESS + + if passphrase != None: + old_pinentry_mode = self.pinentry_mode + old_passphrase_cb = getattr(self, '_passphrase_cb', None) + self.pinentry_mode = constants.PINENTRY_MODE_LOOPBACK + def passphrase_cb(hint, desc, prev_bad, hook=None): + return passphrase + self.set_passphrase_cb(passphrase_cb) + + try: + if sign: + self.op_encrypt_sign(recipients, flags, plaintext, ciphertext) + else: + self.op_encrypt(recipients, flags, plaintext, ciphertext) + except errors.GPGMEError as e: + if e.getcode() == errors.UNUSABLE_PUBKEY: + result = self.op_encrypt_result() + if result.invalid_recipients: + raise errors.InvalidRecipients(result.invalid_recipients) + if e.getcode() == errors.UNUSABLE_SECKEY: + sig_result = self.op_sign_result() + if sig_result.invalid_signers: + raise errors.InvalidSigners(sig_result.invalid_signers) + raise + finally: + if passphrase != None: + self.pinentry_mode = old_pinentry_mode + if old_passphrase_cb: + self.set_passphrase_cb(*old_passphrase_cb[1:]) + + result = self.op_encrypt_result() + assert not result.invalid_recipients + sig_result = self.op_sign_result() if sign else None + assert not sig_result or not sig_result.invalid_signers + + cipherbytes = None + if not sink: + ciphertext.seek(0, os.SEEK_SET) + cipherbytes = ciphertext.read() + return cipherbytes, result, sig_result + + def decrypt(self, ciphertext, sink=None, passphrase=None, verify=True): + """Decrypt data + + Decrypt the given ciphertext and verify any signatures. If + VERIFY is an iterable of keys, the ciphertext must be signed + by all those keys, otherwise an error is raised. + + If the ciphertext is symmetrically encrypted using a + passphrase, that passphrase can be given as parameter, using a + callback registered at the context, or out-of-band via + pinentry. + + Keyword arguments: + sink -- write result to sink instead of returning it + passphrase -- for symmetric decryption + verify -- check signatures (default True) + + Returns: + plaintext -- the decrypted data (or None if sink is given) + result -- additional information about the decryption + verify_result -- additional information about the signature(s) + + Raises: + UnsupportedAlgorithm -- if an unsupported algorithm was used + BadSignatures -- if a bad signature is encountered + MissingSignatures -- if expected signatures are missing or bad + GPGMEError -- as signaled by the underlying library + + """ + plaintext = sink if sink else Data() + + if passphrase != None: + old_pinentry_mode = self.pinentry_mode + old_passphrase_cb = getattr(self, '_passphrase_cb', None) + self.pinentry_mode = constants.PINENTRY_MODE_LOOPBACK + def passphrase_cb(hint, desc, prev_bad, hook=None): + return passphrase + self.set_passphrase_cb(passphrase_cb) + + try: + if verify: + self.op_decrypt_verify(ciphertext, plaintext) + else: + self.op_decrypt(ciphertext, plaintext) + finally: + if passphrase != None: + self.pinentry_mode = old_pinentry_mode + if old_passphrase_cb: + self.set_passphrase_cb(*old_passphrase_cb[1:]) + + result = self.op_decrypt_result() + verify_result = self.op_verify_result() if verify else None + if result.unsupported_algorithm: + raise errors.UnsupportedAlgorithm(result.unsupported_algorithm) + + if verify: + if any(s.status != errors.NO_ERROR + for s in verify_result.signatures): + raise errors.BadSignatures(verify_result) + + if verify and verify != True: + missing = list() + for key in verify: + ok = False + for subkey in key.subkeys: + for sig in verify_result.signatures: + if sig.summary & constants.SIGSUM_VALID == 0: + continue + if subkey.can_sign and subkey.fpr == sig.fpr: + ok = True + break + if ok: + break + if not ok: + missing.append(key) + if missing: + raise errors.MissingSignatures(verify_result, missing) + + plainbytes = None + if not sink: + plaintext.seek(0, os.SEEK_SET) + plainbytes = plaintext.read() + return plainbytes, result, verify_result + + def sign(self, data, sink=None, mode=constants.SIG_MODE_NORMAL): + """Sign data + + Sign the given data with either the configured default local + key, or the 'signers' keys of this context. + + Keyword arguments: + mode -- signature mode (default: normal, see below) + sink -- write result to sink instead of returning it + + Returns: + either + signed_data -- encoded data and signature (normal mode) + signature -- only the signature data (detached mode) + cleartext -- data and signature as text (cleartext mode) + (or None if sink is given) + result -- additional information about the signature(s) + + Raises: + InvalidSigners -- if signing using a particular key failed + GPGMEError -- as signaled by the underlying library + + """ + signeddata = sink if sink else Data() + + try: + self.op_sign(data, signeddata, mode) + except errors.GPGMEError as e: + if e.getcode() == errors.UNUSABLE_SECKEY: + result = self.op_sign_result() + if result.invalid_signers: + raise errors.InvalidSigners(result.invalid_signers) + raise + + result = self.op_sign_result() + assert not result.invalid_signers + + signedbytes = None + if not sink: + signeddata.seek(0, os.SEEK_SET) + signedbytes = signeddata.read() + return signedbytes, result + + def verify(self, signed_data, signature=None, sink=None, verify=[]): + """Verify signatures + + Verify signatures over data. If VERIFY is an iterable of + keys, the ciphertext must be signed by all those keys, + otherwise an error is raised. + + Keyword arguments: + signature -- detached signature data + sink -- write result to sink instead of returning it + + Returns: + data -- the plain data + (or None if sink is given, or we verified a detached signature) + result -- additional information about the signature(s) + + Raises: + BadSignatures -- if a bad signature is encountered + MissingSignatures -- if expected signatures are missing or bad + GPGMEError -- as signaled by the underlying library + + """ + if signature: + # Detached signature, we don't return the plain text. + data = None + else: + data = sink if sink else Data() + + if signature: + self.op_verify(signature, signed_data, None) + else: + self.op_verify(signed_data, None, data) + + result = self.op_verify_result() + if any(s.status != errors.NO_ERROR for s in result.signatures): + raise errors.BadSignatures(result) + + missing = list() + for key in verify: + ok = False + for subkey in key.subkeys: + for sig in result.signatures: + if sig.summary & constants.SIGSUM_VALID == 0: + continue + if subkey.can_sign and subkey.fpr == sig.fpr: + ok = True + break + if ok: + break + if not ok: + missing.append(key) + if missing: + raise errors.MissingSignatures(result, missing) + + plainbytes = None + if data and not sink: + data.seek(0, os.SEEK_SET) + plainbytes = data.read() + return plainbytes, result + + def keylist(self, pattern=None, secret=False): + """List keys + + Keyword arguments: + pattern -- return keys matching pattern (default: all keys) + secret -- return only secret keys + + Returns: + -- an iterator returning key objects + + Raises: + GPGMEError -- as signaled by the underlying library + """ + return self.op_keylist_all(pattern, secret) + + def assuan_transact(self, command, + data_cb=None, inquire_cb=None, status_cb=None): + """Issue a raw assuan command + + This function can be used to issue a raw assuan command to the + engine. + + If command is a string or bytes, it will be used as-is. If it + is an iterable of strings, it will be properly escaped and + joined into an well-formed assuan command. + + Keyword arguments: + data_cb -- a callback receiving data lines + inquire_cb -- a callback providing more information + status_cb -- a callback receiving status lines + + Returns: + result -- the result of command as GPGMEError + + Raises: + GPGMEError -- as signaled by the underlying library + + """ + + if isinstance(command, (str, bytes)): + cmd = command + else: + cmd = " ".join(util.percent_escape(f) for f in command) + + errptr = gpgme.new_gpgme_error_t_p() + + err = gpgme.gpgme_op_assuan_transact_ext( + self.wrapped, + cmd, + (weakref.ref(self), data_cb) if data_cb else None, + (weakref.ref(self), inquire_cb) if inquire_cb else None, + (weakref.ref(self), status_cb) if status_cb else None, + errptr) + + if self._callback_excinfo: + gpgme.gpg_raise_callback_exception(self) + + errorcheck(err) + + status = gpgme.gpgme_error_t_p_value(errptr) + gpgme.delete_gpgme_error_t_p(errptr) + + return GPGMEError(status) if status != 0 else None + + def interact(self, key, func, sink=None, flags=0, fnc_value=None): + """Interact with the engine + + This method can be used to edit keys and cards interactively. + KEY is the key to edit, FUNC is called repeatedly with two + unicode arguments, 'keyword' and 'args'. See the GPGME manual + for details. + + Keyword arguments: + sink -- if given, additional output is written here + flags -- use constants.INTERACT_CARD to edit a card + + Raises: + GPGMEError -- as signaled by the underlying library + + """ + if key == None: + raise ValueError("First argument cannot be None") + + if sink == None: + sink = Data() + + if fnc_value: + opaquedata = (weakref.ref(self), func, fnc_value) + else: + opaquedata = (weakref.ref(self), func) + + result = gpgme.gpgme_op_interact(self.wrapped, key, flags, + opaquedata, sink) + if self._callback_excinfo: + gpgme.gpg_raise_callback_exception(self) + errorcheck(result) + + @property + def signers(self): + """Keys used for signing""" + return [self.signers_enum(i) for i in range(self.signers_count())] + @signers.setter + def signers(self, signers): + old = self.signers + self.signers_clear() + try: + for key in signers: + self.signers_add(key) + except: + self.signers = old + raise + + @property + def pinentry_mode(self): + """Pinentry mode""" + return self.get_pinentry_mode() + @pinentry_mode.setter + def pinentry_mode(self, value): + self.set_pinentry_mode(value) + + @property + def protocol(self): + """Protocol to use""" + return self.get_protocol() + @protocol.setter + def protocol(self, value): + errorcheck(gpgme.gpgme_engine_check_version(value)) + self.set_protocol(value) + + _ctype = 'gpgme_ctx_t' + _cprefix = 'gpgme_' + + def _errorcheck(self, name): + """This function should list all functions returning gpgme_error_t""" + return ((name.startswith('gpgme_op_') + and not name.endswith('_result')) + or name in { + 'gpgme_set_ctx_flag', + 'gpgme_set_protocol', + 'gpgme_set_sub_protocol', + 'gpgme_set_keylist_mode', + 'gpgme_set_pinentry_mode', + 'gpgme_set_locale', + 'gpgme_set_engine_info', + 'gpgme_signers_add', + 'gpgme_get_sig_key', + 'gpgme_sig_notation_add', + 'gpgme_cancel', + 'gpgme_cancel_async', + 'gpgme_cancel_get_key', + }) + + _boolean_properties = {'armor', 'textmode', 'offline'} + + def __del__(self): + if not gpgme: + # At interpreter shutdown, gpgme is set to NONE. + return + + self._free_passcb() + self._free_progresscb() + self._free_statuscb() + if self.own and self.wrapped and gpgme.gpgme_release: + gpgme.gpgme_release(self.wrapped) + self.wrapped = None + + # Implement the context manager protocol. + def __enter__(self): + return self + def __exit__(self, type, value, tb): + self.__del__() + + def op_keylist_all(self, *args, **kwargs): + self.op_keylist_start(*args, **kwargs) + key = self.op_keylist_next() + while key: + yield key + key = self.op_keylist_next() + self.op_keylist_end() + + def op_keylist_next(self): + """Returns the next key in the list created + by a call to op_keylist_start(). The object returned + is of type Key.""" + ptr = gpgme.new_gpgme_key_t_p() + try: + errorcheck(gpgme.gpgme_op_keylist_next(self.wrapped, ptr)) + key = gpgme.gpgme_key_t_p_value(ptr) + except errors.GPGMEError as excp: + key = None + if excp.getcode() != errors.EOF: + raise excp + gpgme.delete_gpgme_key_t_p(ptr) + if key: + key.__del__ = lambda self: gpgme.gpgme_key_unref(self) + return key + + 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() + + 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) + 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) + trust = self.op_trustlist_next() + while trust: + yield trust + trust = self.op_trustlist_next() + self.op_trustlist_end() + + def op_trustlist_next(self): + """Returns the next trust item in the list created + by a call to op_trustlist_start(). The object returned + is of type TrustItem.""" + ptr = gpgme.new_gpgme_trust_item_t_p() + try: + errorcheck(gpgme.gpgme_op_trustlist_next(self.wrapped, ptr)) + trust = gpgme.gpgme_trust_item_t_p_value(ptr) + except errors.GPGMEError as excp: + trust = None + if excp.getcode() != errors.EOF: + raise + gpgme.delete_gpgme_trust_item_t_p(ptr) + return trust + + def set_passphrase_cb(self, func, hook=None): + """Sets the passphrase callback to the function specified by func. + + When the system needs a passphrase, it will call func with three args: + hint, a string describing the key it needs the passphrase for; + desc, a string describing the passphrase it needs; + prev_bad, a boolean equal True if this is a call made after + unsuccessful previous attempt. + + If hook has a value other than None it will be passed into the func + as a forth argument. + + Please see the GPGME manual for more information. + """ + if func == None: + hookdata = None + else: + if hook == None: + hookdata = (weakref.ref(self), func) + else: + hookdata = (weakref.ref(self), func, hook) + gpgme.gpg_set_passphrase_cb(self, hookdata) + + def _free_passcb(self): + if gpgme.gpg_set_passphrase_cb: + self.set_passphrase_cb(None) + + def set_progress_cb(self, func, hook=None): + """Sets the progress meter callback to the function specified by FUNC. + If FUNC is None, the callback will be cleared. + + This function will be called to provide an interactive update + of the system's progress. The function will be called with + three arguments, type, total, and current. If HOOK is not + None, it will be supplied as fourth argument. + + Please see the GPGME manual for more information. + + """ + if func == None: + hookdata = None + else: + if hook == None: + hookdata = (weakref.ref(self), func) + else: + hookdata = (weakref.ref(self), func, hook) + gpgme.gpg_set_progress_cb(self, hookdata) + + def _free_progresscb(self): + if gpgme.gpg_set_progress_cb: + self.set_progress_cb(None) + + def set_status_cb(self, func, hook=None): + """Sets the status callback to the function specified by FUNC. If + FUNC is None, the callback will be cleared. + + The function will be called with two arguments, keyword and + args. If HOOK is not None, it will be supplied as third + argument. + + Please see the GPGME manual for more information. + + """ + if func == None: + hookdata = None + else: + if hook == None: + hookdata = (weakref.ref(self), func) + else: + hookdata = (weakref.ref(self), func, hook) + gpgme.gpg_set_status_cb(self, hookdata) + + def _free_statuscb(self): + if gpgme.gpg_set_status_cb: + self.set_status_cb(None) + + @property + def engine_info(self): + """Configuration of the engine currently in use""" + p = self.protocol + infos = [i for i in self.get_engine_info() if i.protocol == p] + assert len(infos) == 1 + return infos[0] + + def get_engine_info(self): + """Get engine configuration + + Returns information about all configured and installed + engines. + + Returns: + infos -- a list of engine infos + + """ + return gpgme.gpgme_ctx_get_engine_info(self.wrapped) + + def set_engine_info(self, proto, file_name=None, home_dir=None): + """Change engine configuration + + Changes the configuration of the crypto engine implementing + the protocol 'proto' for the context. + + Keyword arguments: + file_name -- engine program file name (unchanged if None) + home_dir -- configuration directory (unchanged if None) + + """ + errorcheck(gpgme.gpgme_ctx_set_engine_info( + self.wrapped, proto, file_name, home_dir)) + + def wait(self, hang): + """Wait for asynchronous call to finish. Wait forever if hang is True. + Raises an exception on errors. + + Please read the GPGME manual for more information. + + """ + ptr = gpgme.new_gpgme_error_t_p() + gpgme.gpgme_wait(self.wrapped, ptr, hang) + status = gpgme.gpgme_error_t_p_value(ptr) + gpgme.delete_gpgme_error_t_p(ptr) + errorcheck(status) + + def op_edit(self, key, func, fnc_value, out): + """Start key editing using supplied callback function + + Note: This interface is deprecated and will be removed with + GPGME 1.8. Please use .interact instead. Furthermore, we + implement this using gpgme_op_interact, so callbacks will get + called with string keywords instead of numeric status + messages. Code that is using constants.STATUS_X or + constants.status.X will continue to work, whereas code using + magic numbers will break as a result. + + """ + warnings.warn("Call to deprecated method op_edit.", + category=DeprecationWarning) + return self.interact(key, func, sink=out, fnc_value=fnc_value) + + +class Data(GpgmeWrapper): + """Data buffer + + A lot of data has to be exchanged between the user and the crypto + engine, like plaintext messages, ciphertext, signatures and + information about the keys. The technical details about + exchanging the data information are completely abstracted by + GPGME. The user provides and receives the data via `gpgme_data_t' + objects, regardless of the communication protocol between GPGME + and the crypto engine in use. + + This Data class is the implementation of the GpgmeData objects. + + Please see the information about __init__ for instantiation. + + """ + + _ctype = 'gpgme_data_t' + _cprefix = 'gpgme_data_' + + def _errorcheck(self, name): + """This function should list all functions returning gpgme_error_t""" + return name not in { + 'gpgme_data_release_and_get_mem', + 'gpgme_data_get_encoding', + 'gpgme_data_seek', + 'gpgme_data_get_file_name', + } + + def __init__(self, string=None, file=None, offset=None, + length=None, cbs=None, copy=True): + """Initialize a new gpgme_data_t object. + + If no args are specified, make it an empty object. + + If string alone is specified, initialize it with the data + contained there. + + If file, offset, and length are all specified, file must + be either a filename or a file-like object, and the object + will be initialized by reading the specified chunk from the file. + + If cbs is specified, it MUST be a tuple of the form: + + (read_cb, write_cb, seek_cb, release_cb[, hook]) + + where the first four items are functions implementing reading, + writing, seeking the data, and releasing any resources once + the data object is deallocated. The functions must match the + following prototypes: + + def read(amount, hook=None): + return + + def write(data, hook=None): + return + + def seek(offset, whence, hook=None): + return + + def release(hook=None): + + + The functions may be bound methods. In that case, you can + simply use the 'self' reference instead of using a hook. + + If file is specified without any other arguments, then + it must be a filename, and the object will be initialized from + that file. + + """ + super(Data, self).__init__(None) + self.data_cbs = None + + if cbs != None: + self.new_from_cbs(*cbs) + elif string != None: + self.new_from_mem(string, copy) + elif file != None and offset != None and length != None: + self.new_from_filepart(file, offset, length) + elif file != None: + if util.is_a_string(file): + self.new_from_file(file, copy) + else: + self.new_from_fd(file) + else: + self.new() + + def __del__(self): + if not gpgme: + # At interpreter shutdown, gpgme is set to NONE. + return + + if self.wrapped != None and gpgme.gpgme_data_release: + gpgme.gpgme_data_release(self.wrapped) + if self._callback_excinfo: + gpgme.gpg_raise_callback_exception(self) + self.wrapped = None + self._free_datacbs() + + # Implement the context manager protocol. + def __enter__(self): + return self + def __exit__(self, type, value, tb): + self.__del__() + + def _free_datacbs(self): + self._data_cbs = None + + def new(self): + tmp = gpgme.new_gpgme_data_t_p() + errorcheck(gpgme.gpgme_data_new(tmp)) + self.wrapped = gpgme.gpgme_data_t_p_value(tmp) + gpgme.delete_gpgme_data_t_p(tmp) + + def new_from_mem(self, string, copy=True): + tmp = gpgme.new_gpgme_data_t_p() + errorcheck(gpgme.gpgme_data_new_from_mem(tmp,string,len(string),copy)) + self.wrapped = gpgme.gpgme_data_t_p_value(tmp) + gpgme.delete_gpgme_data_t_p(tmp) + + def new_from_file(self, filename, copy=True): + tmp = gpgme.new_gpgme_data_t_p() + try: + errorcheck(gpgme.gpgme_data_new_from_file(tmp, filename, copy)) + except errors.GPGMEError as e: + if e.getcode() == errors.INV_VALUE and not copy: + raise ValueError("delayed reads are not yet supported") + else: + raise e + self.wrapped = gpgme.gpgme_data_t_p_value(tmp) + gpgme.delete_gpgme_data_t_p(tmp) + + def new_from_cbs(self, read_cb, write_cb, seek_cb, release_cb, hook=None): + tmp = gpgme.new_gpgme_data_t_p() + if hook != None: + hookdata = (weakref.ref(self), + read_cb, write_cb, seek_cb, release_cb, hook) + else: + hookdata = (weakref.ref(self), + read_cb, write_cb, seek_cb, release_cb) + gpgme.gpg_data_new_from_cbs(self, hookdata, tmp) + self.wrapped = gpgme.gpgme_data_t_p_value(tmp) + gpgme.delete_gpgme_data_t_p(tmp) + + def new_from_filepart(self, file, offset, length): + """This wraps the GPGME gpgme_data_new_from_filepart() function. + The argument "file" may be: + + * a string specifying a file name, or + * a file-like object supporting the fileno() and the mode attribute. + + """ + + tmp = gpgme.new_gpgme_data_t_p() + filename = None + fp = None + + if util.is_a_string(file): + filename = file + else: + fp = gpgme.fdopen(file.fileno(), file.mode) + if fp == None: + raise ValueError("Failed to open file from %s arg %s" % \ + (str(type(file)), str(file))) + + errorcheck(gpgme.gpgme_data_new_from_filepart(tmp, filename, fp, + offset, length)) + self.wrapped = gpgme.gpgme_data_t_p_value(tmp) + gpgme.delete_gpgme_data_t_p(tmp) + + def new_from_fd(self, file): + """This wraps the GPGME gpgme_data_new_from_fd() function. The + argument "file" must be a file-like object, supporting the + fileno() method. + + """ + tmp = gpgme.new_gpgme_data_t_p() + errorcheck(gpgme.gpgme_data_new_from_fd(tmp, file.fileno())) + self.wrapped = gpgme.gpgme_data_t_p_value(tmp) + gpgme.delete_gpgme_data_t_p(tmp) + + def new_from_stream(self, file): + """This wrap around gpgme_data_new_from_stream is an alias for + new_from_fd() method since in python there's not difference + between file stream and file descriptor""" + self.new_from_fd(file) + + def write(self, buffer): + """Write buffer given as string or bytes. + + If a string is given, it is implicitly encoded using UTF-8.""" + written = gpgme.gpgme_data_write(self.wrapped, buffer) + if written < 0: + if self._callback_excinfo: + gpgme.gpg_raise_callback_exception(self) + else: + raise GPGMEError.fromSyserror() + return written + + def read(self, size = -1): + """Read at most size bytes, returned as bytes. + + If the size argument is negative or omitted, read until EOF is reached. + + Returns the data read, or the empty string if there was no data + to read before EOF was reached.""" + + if size == 0: + return '' + + if size > 0: + try: + result = gpgme.gpgme_data_read(self.wrapped, size) + except: + if self._callback_excinfo: + gpgme.gpg_raise_callback_exception(self) + else: + raise + return result + else: + chunks = [] + while True: + try: + result = gpgme.gpgme_data_read(self.wrapped, 4096) + except: + if self._callback_excinfo: + gpgme.gpg_raise_callback_exception(self) + else: + raise + if len(result) == 0: + break + chunks.append(result) + return b''.join(chunks) + +def pubkey_algo_name(algo): + return gpgme.gpgme_pubkey_algo_name(algo) + +def hash_algo_name(algo): + return gpgme.gpgme_hash_algo_name(algo) + +def get_protocol_name(proto): + return gpgme.gpgme_get_protocol_name(proto) + +def check_version(version=None): + return gpgme.gpgme_check_version(version) + +# check_version also makes sure that several subsystems are properly +# initialized, and it must be run at least once before invoking any +# other function. We do it here so that the user does not have to do +# it unless she really wants to check for a certain version. +check_version() + +def engine_check_version (proto): + try: + errorcheck(gpgme.gpgme_engine_check_version(proto)) + return True + except errors.GPGMEError: + return False + +def get_engine_info(): + ptr = gpgme.new_gpgme_engine_info_t_p() + try: + errorcheck(gpgme.gpgme_get_engine_info(ptr)) + info = gpgme.gpgme_engine_info_t_p_value(ptr) + except errors.GPGMEError: + info = None + gpgme.delete_gpgme_engine_info_t_p(ptr) + return info + +def set_engine_info(proto, file_name, home_dir=None): + """Changes the default configuration of the crypto engine implementing + the protocol 'proto'. 'file_name' is the file name of + the executable program implementing this protocol. 'home_dir' is the + directory name of the configuration directory (engine's default is + used if omitted).""" + errorcheck(gpgme.gpgme_set_engine_info(proto, file_name, home_dir)) + +def set_locale(category, value): + """Sets the default locale used by contexts""" + errorcheck(gpgme.gpgme_set_locale(None, category, value)) + +def wait(hang): + """Wait for asynchronous call on any Context to finish. + Wait forever if hang is True. + + For finished anynch calls it returns a tuple (status, context): + status - status return by asnynchronous call. + context - context which caused this call to return. + + Please read the GPGME manual of more information.""" + ptr = gpgme.new_gpgme_error_t_p() + context = gpgme.gpgme_wait(None, ptr, hang) + status = gpgme.gpgme_error_t_p_value(ptr) + gpgme.delete_gpgme_error_t_p(ptr) + if context == None: + errorcheck(status) + else: + context = Context(context) + return (status, context) diff -Nru gpgme1.0-1.7.0/lang/python/gpg/errors.py gpgme1.0-1.8.0/lang/python/gpg/errors.py --- gpgme1.0-1.7.0/lang/python/gpg/errors.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/errors.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,128 @@ +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from . import gpgme +from . import util + +# 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 + +util.process_constants('GPG_ERR_', globals()) +del util + +class GpgError(Exception): + pass + +class GPGMEError(GpgError): + def __init__(self, error = None, message = None): + self.error = error + self.message = message + + @classmethod + def fromSyserror(cls): + return cls(gpgme.gpgme_err_code_from_syserror()) + + def getstring(self): + message = "%s: %s" % (gpgme.gpgme_strsource(self.error), + gpgme.gpgme_strerror(self.error)) + if self.message != None: + message = "%s: %s" % (self.message, message) + return message + + def getcode(self): + return gpgme.gpgme_err_code(self.error) + + def getsource(self): + return gpgme.gpgme_err_source(self.error) + + def __str__(self): + return self.getstring() + +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(GpgError): + pass + +class InvalidRecipients(EncryptionError): + def __init__(self, recipients): + self.recipients = recipients + def __str__(self): + return ", ".join("{}: {}".format(r.fpr, + gpgme.gpgme_strerror(r.reason)) + for r in self.recipients) + +class DeryptionError(GpgError): + pass + +class UnsupportedAlgorithm(DeryptionError): + def __init__(self, algorithm): + self.algorithm = algorithm + def __str__(self): + return self.algorithm + +class SigningError(GpgError): + pass + +class InvalidSigners(SigningError): + def __init__(self, signers): + self.signers = signers + def __str__(self): + return ", ".join("{}: {}".format(s.fpr, + gpgme.gpgme_strerror(s.reason)) + for s in self.signers) + +class VerificationError(GpgError): + pass + +class BadSignatures(VerificationError): + def __init__(self, result): + self.result = result + def __str__(self): + return ", ".join("{}: {}".format(s.fpr, + gpgme.gpgme_strerror(s.status)) + for s in self.result.signatures + if s.status != NO_ERROR) + +class MissingSignatures(VerificationError): + def __init__(self, result, missing): + self.result = result + self.missing = missing + def __str__(self): + return ", ".join(k.subkeys[0].fpr for k in self.missing) diff -Nru gpgme1.0-1.7.0/lang/python/gpg/gpgme.py gpgme1.0-1.8.0/lang/python/gpg/gpgme.py --- gpgme1.0-1.7.0/lang/python/gpg/gpgme.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/gpgme.py 2016-11-16 09:18:41.000000000 +0000 @@ -0,0 +1,126 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 3.0.7 +# +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. + + + + + +from sys import version_info +if version_info >= (2, 6, 0): + def swig_import_helper(): + from os.path import dirname + import imp + fp = None + try: + fp, pathname, description = imp.find_module('_gpgme', [dirname(__file__)]) + except ImportError: + import _gpgme + return _gpgme + if fp is not None: + try: + _mod = imp.load_module('_gpgme', fp, pathname, description) + finally: + fp.close() + return _mod + _gpgme = swig_import_helper() + del swig_import_helper +else: + import _gpgme +del version_info +from _gpgme import * +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. + + +def _swig_setattr_nondynamic(self, class_type, name, value, static=1): + if (name == "thisown"): + return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'SwigPyObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name, None) + if method: + return method(self, value) + if (not static): + if _newclass: + object.__setattr__(self, name, value) + else: + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + + +def _swig_setattr(self, class_type, name, value): + return _swig_setattr_nondynamic(self, class_type, name, value, 0) + + +def _swig_getattr_nondynamic(self, class_type, name, static=1): + if (name == "thisown"): + return self.this.own() + method = class_type.__swig_getmethods__.get(name, None) + if method: + return method(self) + if (not static): + return object.__getattr__(self, name) + else: + raise AttributeError(name) + +def _swig_getattr(self, class_type, name): + return _swig_getattr_nondynamic(self, class_type, name, 0) + + +def _swig_repr(self): + try: + strthis = "proxy of " + self.this.__repr__() + except: + strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +try: + _object = object + _newclass = 1 +except AttributeError: + class _object: + pass + _newclass = 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# This file is compatible with both classic and new-style classes. + + diff -Nru gpgme1.0-1.7.0/lang/python/gpg/__init__.py gpgme1.0-1.8.0/lang/python/gpg/__init__.py --- gpgme1.0-1.7.0/lang/python/gpg/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/__init__.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,121 @@ +# Copyright (C) 2016 g10 Code GmbH +# Copyright (C) 2004 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +"""gpg: GnuPG Interface for Python (GPGME bindings) + +Welcome to gpg, the GnuPG Interface for Python. + +The latest release of this package may be obtained from +https://www.gnupg.org + +FEATURES +-------- + + * Feature-rich, full implementation of the GPGME library. Supports + all GPGME features. Callback functions may be written in pure + Python. Exceptions raised in callbacks are properly propagated. + + * Ability to sign, encrypt, decrypt, and verify data. + + * Ability to list keys, export and import keys, and manage the keyring. + + * Fully object-oriented with convenient classes and modules. + +QUICK EXAMPLE +------------- + + >>> import gpg + >>> with gpg.Context() as c: + >>> with gpg.Context() as c: + ... cipher, _, _ = c.encrypt("Hello world :)".encode(), + ... passphrase="abc") + ... c.decrypt(cipher, passphrase="abc") + ... + (b'Hello world :)', + , + ) + +GENERAL OVERVIEW +---------------- + +For those of you familiar with GPGME, you will be right at home here. + +The python gpg module is, for the most part, a direct interface to the C GPGME +library. However, it is re-packaged in a more Pythonic way -- +object-oriented with classes and modules. Take a look at the classes +defined here -- they correspond directly to certain object types in GPGME +for C. For instance, the following C code: + +gpgme_ctx_t context; +gpgme_new(&context); +... +gpgme_op_encrypt(context, recp, 1, plain, cipher); + +Translates into the following Python code: + +context = core.Context() +... +context.op_encrypt(recp, 1, plain, cipher) + +The Python module automatically does error-checking and raises Python +exception gpg.errors.GPGMEError when GPGME signals an error. getcode() +and getsource() of this exception return code and source of the error. + +IMPORTANT NOTE +-------------- +This documentation only covers a small subset of available GPGME functions and +methods. Please consult the documentation for the C library +for comprehensive coverage. + +This library uses Python's reflection to automatically detect the methods +that are available for each class, and as such, most of those methods +do not appear explicitly anywhere. You can use dir() python built-in command +on an object to see what methods and fields it has but their meaning can +be found only in GPGME documentation. + +FOR MORE INFORMATION +-------------------- +GnuPG homepage: https://www.gnupg.org/ +GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/ + +""" + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +from . import core +from . import errors +from . import constants +from . import util +from . import callbacks +from . import version +from .core import Context +from .core import Data + +# Interface hygiene. + +# Drop the low-level gpgme that creeps in for some reason. +gpgme = None +del gpgme + +# This is a white-list of symbols. Any other will alert pyflakes. +_ = [Context, Data, core, errors, constants, util, callbacks, version] +del _ + +__all__ = ["Context", "Data", + "core", "errors", "constants", "util", "callbacks", "version"] diff -Nru gpgme1.0-1.7.0/lang/python/gpg/results.py gpgme1.0-1.8.0/lang/python/gpg/results.py --- gpgme1.0-1.7.0/lang/python/gpg/results.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/results.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,118 @@ +# Robust result objects +# +# Copyright (C) 2016 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, see . + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +"""Robust result objects + +Results returned by the underlying library are fragile, i.e. they are +only valid until the next operation is performed in the context. + +We cannot arbitrarily constrain the lifetime of Python objects, we +therefore create deep copies of the results. + +""" + +class Result(object): + """Result object + + Describes the result of an operation. + + """ + + """Convert to types""" + _type = {} + + """Map functions over list attributes""" + _map = {} + + """Automatically copy unless blacklisted""" + _blacklist = { + 'acquire', 'append', 'disown', 'next', 'own', 'this', 'thisown', + } + def __init__(self, fragile): + for key, func in self._type.items(): + if hasattr(fragile, key): + setattr(self, key, func(getattr(fragile, key))) + + for key, func in self._map.items(): + if hasattr(fragile, key): + setattr(self, key, list(map(func, getattr(fragile, key)))) + + for key in dir(fragile): + if key.startswith('_') or key in self._blacklist: + continue + if hasattr(self, key): + continue + + setattr(self, key, getattr(fragile, key)) + + def __str__(self): + return '<{} {}>'.format( + self.__class__.__name__, + ', '.join('{}: {}'.format(k, getattr(self, k)) + for k in dir(self) if not k.startswith('_'))) + +class InvalidKey(Result): + pass + +class EncryptResult(Result): + _map = dict(invalid_recipients=InvalidKey) + +class Recipient(Result): + pass + +class DecryptResult(Result): + _type = dict(wrong_key_usage=bool) + _map = dict(recipients=Recipient) + +class NewSignature(Result): + pass + +class SignResult(Result): + _map = dict(invalid_signers=InvalidKey, signatures=NewSignature) + +class Notation(Result): + pass + +class Signature(Result): + _type = dict(wrong_key_usage=bool, chain_model=bool) + _map = dict(notations=Notation) + +class VerifyResult(Result): + _map = dict(signatures=Signature) + +class ImportStatus(Result): + pass + +class ImportResult(Result): + _map = dict(imports=ImportStatus) + +class GenkeyResult(Result): + _type = dict(primary=bool, sub=bool) + +class KeylistResult(Result): + _type = dict(truncated=bool) + +class VFSMountResult(Result): + pass + +class EngineInfo(Result): + pass diff -Nru gpgme1.0-1.7.0/lang/python/gpg/util.py gpgme1.0-1.8.0/lang/python/gpg/util.py --- gpgme1.0-1.7.0/lang/python/gpg/util.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/util.py 2016-11-16 09:18:20.000000000 +0000 @@ -0,0 +1,53 @@ +# Copyright (C) 2016 g10 Code GmbH +# Copyright (C) 2004,2008 Igor Belyi +# Copyright (C) 2002 John Goerzen +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function, unicode_literals +del absolute_import, print_function, unicode_literals + +import sys + +def process_constants(prefix, scope): + """Called by the constant modules to load up the constants from the C + library starting with PREFIX. Matching constants will be inserted + into SCOPE with PREFIX stripped from the names. Returns the names + of inserted constants. + + """ + from . import gpgme + index = len(prefix) + constants = {identifier[index:]: getattr(gpgme, identifier) + for identifier in dir(gpgme) + if identifier.startswith(prefix)} + scope.update(constants) + return list(constants.keys()) + +def percent_escape(s): + return ''.join( + '%{0:2x}'.format(ord(c)) + if c == '+' or c == '"' or c == '%' or ord(c) <= 0x20 else c + for c in s) + +# Python2/3 compatibility +if sys.version_info[0] == 3: + # Python3 + def is_a_string(x): + return isinstance(x, str) +else: + # Python2 + def is_a_string(x): + return isinstance(x, basestring) diff -Nru gpgme1.0-1.7.0/lang/python/gpg/version.py gpgme1.0-1.8.0/lang/python/gpg/version.py --- gpgme1.0-1.7.0/lang/python/gpg/version.py 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/version.py 2016-11-16 12:47:17.000000000 +0000 @@ -0,0 +1,68 @@ +# Copyright (C) 2016 g10 Code GmbH +# Copyright (C) 2015 Ben McGinnes +# Copyright (C) 2004 Igor Belyi +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function +del absolute_import, print_function + +from . import gpgme + +productname = 'gpg' +versionstr = "1.8.0" +gpgme_versionstr = gpgme.GPGME_VERSION +in_tree_build = bool(gpgme.cvar.gpg_in_tree_build) + +versionlist = versionstr.split(".") +major = versionlist[0] +minor = versionlist[1] +patch = versionlist[2] + +copyright = """\ +Copyright (C) 2016 g10 Code GmbH +Copyright (C) 2015 Ben McGinnes +Copyright (C) 2014-2015 Martin Albrecht +Copyright (C) 2004-2008 Igor Belyi +Copyright (C) 2002 John Goerzen""" + +author = "The GnuPG hackers" +author_email = "gnupg-devel@gnupg.org" + +description = "Python support for GPGME GnuPG cryptography library" +homepage = "https://gnupg.org" + +license = """Copyright (C) 2016 g10 Code GmbH +Copyright (C) 2015 Ben McGinnes +Copyright (C) 2014, 2015 Martin Albrecht +Copyright (C) 2004, 2008 Igor Belyi +Copyright (C) 2002 John Goerzen + +This library 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. + +This library 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 library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA""" + +# Interface hygiene. Keep this at the end. +del gpgme diff -Nru gpgme1.0-1.7.0/lang/python/gpg/version.py.in gpgme1.0-1.8.0/lang/python/gpg/version.py.in --- gpgme1.0-1.7.0/lang/python/gpg/version.py.in 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpg/version.py.in 2016-11-03 07:55:36.000000000 +0000 @@ -0,0 +1,68 @@ +# Copyright (C) 2016 g10 Code GmbH +# Copyright (C) 2015 Ben McGinnes +# Copyright (C) 2004 Igor Belyi +# +# This library 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. +# +# This library 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 library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +from __future__ import absolute_import, print_function +del absolute_import, print_function + +from . import gpgme + +productname = 'gpg' +versionstr = "@VERSION@" +gpgme_versionstr = gpgme.GPGME_VERSION +in_tree_build = bool(gpgme.cvar.gpg_in_tree_build) + +versionlist = versionstr.split(".") +major = versionlist[0] +minor = versionlist[1] +patch = versionlist[2] + +copyright = """\ +Copyright (C) 2016 g10 Code GmbH +Copyright (C) 2015 Ben McGinnes +Copyright (C) 2014-2015 Martin Albrecht +Copyright (C) 2004-2008 Igor Belyi +Copyright (C) 2002 John Goerzen""" + +author = "The GnuPG hackers" +author_email = "gnupg-devel@gnupg.org" + +description = "Python support for GPGME GnuPG cryptography library" +homepage = "https://gnupg.org" + +license = """Copyright (C) 2016 g10 Code GmbH +Copyright (C) 2015 Ben McGinnes +Copyright (C) 2014, 2015 Martin Albrecht +Copyright (C) 2004, 2008 Igor Belyi +Copyright (C) 2002 John Goerzen + +This library 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. + +This library 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 library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA""" + +# Interface hygiene. Keep this at the end. +del gpgme diff -Nru gpgme1.0-1.7.0/lang/python/gpgme.i gpgme1.0-1.8.0/lang/python/gpgme.i --- gpgme1.0-1.7.0/lang/python/gpgme.i 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/gpgme.i 2016-11-16 09:18:20.000000000 +0000 @@ -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) { @@ -159,7 +159,7 @@ $1 = NULL; else { PyObject *pypointer; - pypointer = _pyme_obj2gpgme_data_t($input, $argnum, &wrapper, + pypointer = _gpg_obj2gpgme_data_t($input, $argnum, &wrapper, &bytesio, &view); if (pypointer == NULL) return NULL; @@ -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, @@ -384,7 +428,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "EncryptResult"); + $result = _gpg_wrap_result(fragile, "EncryptResult"); Py_DECREF(fragile); } @@ -392,7 +436,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "DecryptResult"); + $result = _gpg_wrap_result(fragile, "DecryptResult"); Py_DECREF(fragile); } @@ -400,7 +444,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "SignResult"); + $result = _gpg_wrap_result(fragile, "SignResult"); Py_DECREF(fragile); } @@ -408,7 +452,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "VerifyResult"); + $result = _gpg_wrap_result(fragile, "VerifyResult"); Py_DECREF(fragile); } @@ -416,7 +460,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "ImportResult"); + $result = _gpg_wrap_result(fragile, "ImportResult"); Py_DECREF(fragile); } @@ -424,7 +468,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "GenkeyResult"); + $result = _gpg_wrap_result(fragile, "GenkeyResult"); Py_DECREF(fragile); } @@ -432,7 +476,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "KeylistResult"); + $result = _gpg_wrap_result(fragile, "KeylistResult"); Py_DECREF(fragile); } @@ -440,7 +484,7 @@ PyObject *fragile; fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor, %newpointer_flags); - $result = _pyme_wrap_result(fragile, "VFSMountResult"); + $result = _gpg_wrap_result(fragile, "VFSMountResult"); Py_DECREF(fragile); } @@ -463,7 +507,7 @@ Py_DECREF($result); return NULL; /* raise */ } - o = _pyme_wrap_result(fragile, "EngineInfo"); + o = _gpg_wrap_result(fragile, "EngineInfo"); Py_DECREF(fragile); if (o == NULL) { @@ -484,7 +528,7 @@ return PyErr_Format(PyExc_TypeError, "interact callback must be a tuple of size 2 or 3"); - $1 = (gpgme_interact_cb_t) _pyme_interact_cb; + $1 = (gpgme_interact_cb_t) _gpg_interact_cb; $2 = $input; } @@ -503,7 +547,7 @@ "callback must be a tuple of size 2"); if (! PyCallable_Check(PyTuple_GetItem($input, 1))) return PyErr_Format(PyExc_TypeError, "second item must be callable"); - $1 = _pyme_assuan_data_cb; + $1 = _gpg_assuan_data_cb; $2 = $input; } } @@ -520,7 +564,7 @@ "callback must be a tuple of size 2"); if (! PyCallable_Check(PyTuple_GetItem($input, 1))) return PyErr_Format(PyExc_TypeError, "second item must be callable"); - $1 = _pyme_assuan_inquire_cb; + $1 = _gpg_assuan_inquire_cb; $2 = $input; } } @@ -537,7 +581,7 @@ "callback must be a tuple of size 2"); if (! PyCallable_Check(PyTuple_GetItem($input, 1))) return PyErr_Format(PyExc_TypeError, "second item must be callable"); - $1 = _pyme_assuan_status_cb; + $1 = _gpg_assuan_status_cb; $2 = $input; } } @@ -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 %} @@ -575,11 +623,15 @@ /* 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 @@ %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 @@ -602,13 +654,13 @@ /* SWIG runtime support for helpers.c */ PyObject * -_pyme_wrap_gpgme_data_t(gpgme_data_t data) +_gpg_wrap_gpgme_data_t(gpgme_data_t data) { return SWIG_Python_NewPointerObj(NULL, data, SWIGTYPE_p_gpgme_data, 0); } gpgme_ctx_t -_pyme_unwrap_gpgme_ctx_t(PyObject *wrapped) +_gpg_unwrap_gpgme_ctx_t(PyObject *wrapped) { gpgme_ctx_t result; if (SWIG_ConvertPtr(wrapped, diff -Nru gpgme1.0-1.7.0/lang/python/helpers.c gpgme1.0-1.8.0/lang/python/helpers.c --- gpgme1.0-1.7.0/lang/python/helpers.c 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/helpers.c 2016-11-16 09:18:20.000000000 +0000 @@ -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 #include #include @@ -29,7 +33,7 @@ #include "private.h" /* Flag specifying whether this is an in-tree build. */ -int pyme_in_tree_build = +int gpg_in_tree_build = #if IN_TREE_BUILD 1 #else @@ -39,7 +43,7 @@ static PyObject *GPGMEError = NULL; -void _pyme_exception_init(void) { +void _gpg_exception_init(void) { if (GPGMEError == NULL) { PyObject *errors; PyObject *from_list = PyList_New(0); @@ -54,11 +58,11 @@ } static PyObject * -_pyme_raise_exception(gpgme_error_t err) +_gpg_raise_exception(gpgme_error_t err) { PyObject *e; - _pyme_exception_init(); + _gpg_exception_init(); if (GPGMEError == NULL) return PyErr_Format(PyExc_RuntimeError, "Got gpgme_error_t %d", err); @@ -72,7 +76,7 @@ return NULL; /* raise */ } -gpgme_error_t _pyme_exception2code(void) { +gpgme_error_t _gpg_exception2code(void) { gpgme_error_t err_status = gpg_error(GPG_ERR_GENERAL); if (GPGMEError && PyErr_ExceptionMatches(GPGMEError)) { PyObject *type = 0, *value = 0, *traceback = 0; @@ -90,7 +94,7 @@ /* Exception support for callbacks. */ #define EXCINFO "_callback_excinfo" -static void _pyme_stash_callback_exception(PyObject *weak_self) +static void _gpg_stash_callback_exception(PyObject *weak_self) { PyObject *self, *ptype, *pvalue, *ptraceback, *excinfo; @@ -132,7 +136,7 @@ Py_DECREF(excinfo); } -PyObject *pyme_raise_callback_exception(PyObject *self) +PyObject *gpg_raise_callback_exception(PyObject *self) { PyGILState_STATE state = PyGILState_Ensure(); PyObject *ptype, *pvalue, *ptraceback, *excinfo; @@ -188,7 +192,7 @@ /* Convert object to a pointer to gpgme type, generic version. */ PyObject * -_pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum) +_gpg_obj2gpgme_t(PyObject *input, const char *objtype, int argnum) { PyObject *pyname = NULL, *pypointer = NULL; pyname = PyObject_GetAttrString(input, "_ctype"); @@ -225,7 +229,7 @@ objects with a fileno method, returning it in WRAPPER. This object must be de-referenced when no longer needed. */ PyObject * -_pyme_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper, +_gpg_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper, PyObject **bytesio, Py_buffer *view) { gpgme_error_t err; @@ -238,9 +242,9 @@ err = gpgme_data_new_from_fd(wrapper, (int) PyLong_AsLong(fd)); Py_DECREF(fd); if (err) - return _pyme_raise_exception (err); + return _gpg_raise_exception (err); - return _pyme_wrap_gpgme_data_t(*wrapper); + return _gpg_wrap_gpgme_data_t(*wrapper); } else PyErr_Clear(); @@ -279,17 +283,17 @@ err = gpgme_data_new_from_mem(wrapper, view->buf, (size_t) view->len, 0); if (err) - return _pyme_raise_exception (err); + return _gpg_raise_exception (err); - return _pyme_wrap_gpgme_data_t(*wrapper); + return _gpg_wrap_gpgme_data_t(*wrapper); } /* As last resort we assume it is a wrapped data object. */ if (PyObject_HasAttrString(data, "_ctype")) - return _pyme_obj2gpgme_t(data, "gpgme_data_t", argnum); + return _gpg_obj2gpgme_t(data, "gpgme_data_t", argnum); return PyErr_Format(PyExc_TypeError, - "arg %d: expected pyme.Data, file, or an object " + "arg %d: expected gpg.Data, file, or an object " "implementing the buffer protocol, got %s", argnum, data->ob_type->tp_name); } @@ -297,7 +301,7 @@ PyObject * -_pyme_wrap_result(PyObject *fragile, const char *classname) +_gpg_wrap_result(PyObject *fragile, const char *classname) { static PyObject *results; PyObject *class; @@ -344,7 +348,7 @@ PyObject *encoded = NULL; gpgme_error_t err_status = 0; - _pyme_exception_init(); + _gpg_exception_init(); assert (PyTuple_Check(pyhook)); assert (PyTuple_Size(pyhook) == 2 || PyTuple_Size(pyhook) == 3); @@ -381,12 +385,12 @@ retval = PyObject_CallObject(func, args); Py_DECREF(args); if (PyErr_Occurred()) { - err_status = _pyme_exception2code(); + err_status = _gpg_exception2code(); } else { if (!retval) { if (write(fd, "\n", 1) < 0) { err_status = gpgme_error_from_syserror (); - _pyme_raise_exception (err_status); + _gpg_raise_exception (err_status); } } else { char *buf; @@ -421,11 +425,11 @@ if (write(fd, buf, len) < 0) { err_status = gpgme_error_from_syserror (); - _pyme_raise_exception (err_status); + _gpg_raise_exception (err_status); } if (! err_status && write(fd, "\n", 1) < 0) { err_status = gpgme_error_from_syserror (); - _pyme_raise_exception (err_status); + _gpg_raise_exception (err_status); } Py_DECREF(retval); @@ -434,7 +438,7 @@ leave: if (err_status) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); Py_XDECREF(encoded); PyGILState_Release(state); @@ -442,7 +446,7 @@ } PyObject * -pyme_set_passphrase_cb(PyObject *self, PyObject *cb) { +gpg_set_passphrase_cb(PyObject *self, PyObject *cb) { PyGILState_STATE state = PyGILState_Ensure(); PyObject *wrapped; gpgme_ctx_t ctx; @@ -455,7 +459,7 @@ return NULL; } - ctx = _pyme_unwrap_gpgme_ctx_t(wrapped); + ctx = _gpg_unwrap_gpgme_ctx_t(wrapped); Py_DECREF(wrapped); if (ctx == NULL) { @@ -508,7 +512,7 @@ PyTuple_SetItem(args, 0, PyUnicode_DecodeUTF8(what, strlen (what), "strict")); if (PyErr_Occurred()) { - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); Py_DECREF(args); PyGILState_Release(state); return; @@ -523,14 +527,14 @@ retval = PyObject_CallObject(func, args); if (PyErr_Occurred()) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); Py_DECREF(args); Py_XDECREF(retval); PyGILState_Release(state); } PyObject * -pyme_set_progress_cb(PyObject *self, PyObject *cb) { +gpg_set_progress_cb(PyObject *self, PyObject *cb) { PyGILState_STATE state = PyGILState_Ensure(); PyObject *wrapped; gpgme_ctx_t ctx; @@ -543,7 +547,7 @@ return NULL; } - ctx = _pyme_unwrap_gpgme_ctx_t(wrapped); + ctx = _gpg_unwrap_gpgme_ctx_t(wrapped); Py_DECREF(wrapped); if (ctx == NULL) { @@ -620,19 +624,19 @@ retval = PyObject_CallObject(func, pyargs); if (PyErr_Occurred()) - err = _pyme_exception2code(); + err = _gpg_exception2code(); Py_DECREF(pyargs); Py_XDECREF(retval); leave: if (err) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); PyGILState_Release(state); return err; } PyObject * -pyme_set_status_cb(PyObject *self, PyObject *cb) { +gpg_set_status_cb(PyObject *self, PyObject *cb) { PyGILState_STATE state = PyGILState_Ensure(); PyObject *wrapped; gpgme_ctx_t ctx; @@ -645,7 +649,7 @@ return NULL; } - ctx = _pyme_unwrap_gpgme_ctx_t(wrapped); + ctx = _gpg_unwrap_gpgme_ctx_t(wrapped); Py_DECREF(wrapped); if (ctx == NULL) { @@ -680,7 +684,7 @@ /* Interact callbacks. */ gpgme_error_t -_pyme_interact_cb(void *opaque, const char *keyword, +_gpg_interact_cb(void *opaque, const char *keyword, const char *args, int fd) { PyGILState_STATE state = PyGILState_Ensure(); @@ -690,7 +694,7 @@ gpgme_error_t err_status = 0; PyObject *self = NULL; - _pyme_exception_init(); + _gpg_exception_init(); assert (PyTuple_Check(pyopaque)); assert (PyTuple_Size(pyopaque) == 2 || PyTuple_Size(pyopaque) == 3); @@ -721,7 +725,7 @@ retval = PyObject_CallObject(func, pyargs); Py_DECREF(pyargs); if (PyErr_Occurred()) { - err_status = _pyme_exception2code(); + err_status = _gpg_exception2code(); } else { if (fd>=0 && retval && PyUnicode_Check(retval)) { PyObject *encoded = NULL; @@ -743,18 +747,18 @@ if (write(fd, buffer, size) < 0) { err_status = gpgme_error_from_syserror (); - _pyme_raise_exception (err_status); + _gpg_raise_exception (err_status); } if (! err_status && write(fd, "\n", 1) < 0) { err_status = gpgme_error_from_syserror (); - _pyme_raise_exception (err_status); + _gpg_raise_exception (err_status); } Py_DECREF(encoded); } } leave: if (err_status) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); Py_XDECREF(retval); PyGILState_Release(state); @@ -800,7 +804,7 @@ retval = PyObject_CallObject(func, pyargs); Py_DECREF(pyargs); if (PyErr_Occurred()) { - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; goto leave; } @@ -809,7 +813,7 @@ PyErr_Format(PyExc_TypeError, "expected bytes from read callback, got %s", retval->ob_type->tp_name); - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; goto leave; } @@ -818,7 +822,7 @@ PyErr_Format(PyExc_TypeError, "expected %zu bytes from read callback, got %zu", size, PyBytes_Size(retval)); - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; goto leave; } @@ -867,7 +871,7 @@ retval = PyObject_CallObject(func, pyargs); Py_DECREF(pyargs); if (PyErr_Occurred()) { - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; goto leave; } @@ -883,7 +887,7 @@ PyErr_Format(PyExc_TypeError, "expected int from write callback, got %s", retval->ob_type->tp_name); - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; } @@ -934,7 +938,7 @@ retval = PyObject_CallObject(func, pyargs); Py_DECREF(pyargs); if (PyErr_Occurred()) { - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; goto leave; } @@ -954,7 +958,7 @@ PyErr_Format(PyExc_TypeError, "expected int from seek callback, got %s", retval->ob_type->tp_name); - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); result = -1; } @@ -996,12 +1000,12 @@ Py_XDECREF(retval); Py_DECREF(pyargs); if (PyErr_Occurred()) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); PyGILState_Release(state); } PyObject * -pyme_data_new_from_cbs(PyObject *self, +gpg_data_new_from_cbs(PyObject *self, PyObject *pycbs, gpgme_data_t *r_data) { @@ -1022,7 +1026,7 @@ err = gpgme_data_new_from_cbs(r_data, &cbs, (void *) pycbs); if (err) - return _pyme_raise_exception(err); + return _gpg_raise_exception(err); PyObject_SetAttrString(self, "_data_cbs", pycbs); @@ -1036,7 +1040,7 @@ /* The assuan callbacks. */ gpgme_error_t -_pyme_assuan_data_cb (void *hook, const void *data, size_t datalen) +_gpg_assuan_data_cb (void *hook, const void *data, size_t datalen) { PyGILState_STATE state = PyGILState_Ensure(); gpgme_error_t err = 0; @@ -1055,25 +1059,25 @@ py_data = PyBytes_FromStringAndSize(data, datalen); if (py_data == NULL) { - err = _pyme_exception2code(); + err = _gpg_exception2code(); goto leave; } retval = PyObject_CallFunctionObjArgs(func, py_data, NULL); if (PyErr_Occurred()) - err = _pyme_exception2code(); + err = _gpg_exception2code(); Py_DECREF(py_data); Py_XDECREF(retval); leave: if (err) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); PyGILState_Release(state); return err; } gpgme_error_t -_pyme_assuan_inquire_cb (void *hook, const char *name, const char *args, +_gpg_assuan_inquire_cb (void *hook, const char *name, const char *args, gpgme_data_t *r_data) { PyGILState_STATE state = PyGILState_Ensure(); @@ -1094,20 +1098,20 @@ py_name = PyUnicode_FromString(name); if (py_name == NULL) { - err = _pyme_exception2code(); + err = _gpg_exception2code(); goto leave; } py_args = PyUnicode_FromString(args); if (py_args == NULL) { - err = _pyme_exception2code(); + err = _gpg_exception2code(); goto leave; } retval = PyObject_CallFunctionObjArgs(func, py_name, py_args, NULL); if (PyErr_Occurred()) - err = _pyme_exception2code(); + err = _gpg_exception2code(); Py_XDECREF(retval); /* FIXME: Returning data is not yet implemented. */ @@ -1117,13 +1121,13 @@ Py_XDECREF(py_name); Py_XDECREF(py_args); if (err) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); PyGILState_Release(state); return err; } gpgme_error_t -_pyme_assuan_status_cb (void *hook, const char *status, const char *args) +_gpg_assuan_status_cb (void *hook, const char *status, const char *args) { PyGILState_STATE state = PyGILState_Ensure(); gpgme_error_t err = 0; @@ -1143,27 +1147,27 @@ py_status = PyUnicode_FromString(status); if (py_status == NULL) { - err = _pyme_exception2code(); + err = _gpg_exception2code(); goto leave; } py_args = PyUnicode_FromString(args); if (py_args == NULL) { - err = _pyme_exception2code(); + err = _gpg_exception2code(); goto leave; } retval = PyObject_CallFunctionObjArgs(func, py_status, py_args, NULL); if (PyErr_Occurred()) - err = _pyme_exception2code(); + err = _gpg_exception2code(); Py_XDECREF(retval); leave: Py_XDECREF(py_status); Py_XDECREF(py_args); if (err) - _pyme_stash_callback_exception(self); + _gpg_stash_callback_exception(self); PyGILState_Release(state); return err; } diff -Nru gpgme1.0-1.7.0/lang/python/helpers.h gpgme1.0-1.8.0/lang/python/helpers.h --- gpgme1.0-1.7.0/lang/python/helpers.h 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/helpers.h 2016-11-16 09:18:20.000000000 +0000 @@ -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 #include "Python.h" @@ -27,13 +31,13 @@ #endif /* Flag specifying whether this is an in-tree build. */ -extern int pyme_in_tree_build; +extern int gpg_in_tree_build; -PyObject *pyme_raise_callback_exception(PyObject *self); +PyObject *gpg_raise_callback_exception(PyObject *self); -PyObject *pyme_set_passphrase_cb(PyObject *self, PyObject *cb); -PyObject *pyme_set_progress_cb(PyObject *self, PyObject *cb); -PyObject *pyme_set_status_cb(PyObject *self, PyObject *cb); +PyObject *gpg_set_passphrase_cb(PyObject *self, PyObject *cb); +PyObject *gpg_set_progress_cb(PyObject *self, PyObject *cb); +PyObject *gpg_set_status_cb(PyObject *self, PyObject *cb); -PyObject *pyme_data_new_from_cbs(PyObject *self, PyObject *pycbs, +PyObject *gpg_data_new_from_cbs(PyObject *self, PyObject *pycbs, gpgme_data_t *r_data); diff -Nru gpgme1.0-1.7.0/lang/python/Makefile.am gpgme1.0-1.8.0/lang/python/Makefile.am --- gpgme1.0-1.7.0/lang/python/Makefile.am 2016-09-21 07:18:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/Makefile.am 2016-11-03 07:55:36.000000000 +0000 @@ -23,7 +23,7 @@ helpers.c helpers.h private.h \ gpgme-h-clean.py \ examples \ - pyme + gpg SUBDIRS = . tests @@ -35,44 +35,53 @@ $(srcdir)/examples \ $(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h -COPY_FILES_PYME = \ - $(srcdir)/pyme/callbacks.py \ - $(srcdir)/pyme/constants \ - $(srcdir)/pyme/core.py \ - $(srcdir)/pyme/errors.py \ - $(srcdir)/pyme/__init__.py \ - $(srcdir)/pyme/results.py \ - $(srcdir)/pyme/util.py +COPY_FILES_GPG = \ + $(srcdir)/gpg/callbacks.py \ + $(srcdir)/gpg/constants \ + $(srcdir)/gpg/core.py \ + $(srcdir)/gpg/errors.py \ + $(srcdir)/gpg/__init__.py \ + $(srcdir)/gpg/results.py \ + $(srcdir)/gpg/util.py # 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_GPG) data.h config.h if test "$(srcdir)" != "$(builddir)" ; then \ cp -R $(COPY_FILES) . ; \ - cp -R $(COPY_FILES_PYME) pyme ; \ + cp -R $(COPY_FILES_GPG) gpg ; \ 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)" \ +dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp + CFLAGS="$(CFLAGS)" \ $(PYTHON) setup.py sdist --verbose - gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz + gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz + +.PHONY: prepare +prepare: copystamp .PHONY: sdist -sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc +sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc .PHONY: upload -upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc +upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc twine upload $^ -CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \ - copystamp +CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ + data.h config.h copystamp # Remove the rest. # @@ -83,8 +92,8 @@ if test "$(srcdir)" != "$(builddir)" ; then \ find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \ for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \ - for F in $(COPY_FILES_PYME); do \ - rm -rf -- pyme/`basename $$F` ; \ + for F in $(COPY_FILES_GPG); do \ + rm -rf -- gpg/`basename $$F` ; \ done ; \ fi @@ -98,9 +107,9 @@ cat files.txt >> install_files.txt ; \ rm files.txt ; \ done - $(MKDIR_P) $(DESTDIR)$(pythondir)/pyme - mv install_files.txt $(DESTDIR)$(pythondir)/pyme + $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg + mv install_files.txt $(DESTDIR)$(pythondir)/gpg uninstall-local: - xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf -- - rm -rf -- $(DESTDIR)$(pythondir)/pyme + xargs <$(DESTDIR)$(pythondir)/gpg/install_files.txt -- rm -rf -- + rm -rf -- $(DESTDIR)$(pythondir)/gpg diff -Nru gpgme1.0-1.7.0/lang/python/Makefile.in gpgme1.0-1.8.0/lang/python/Makefile.in --- gpgme1.0-1.7.0/lang/python/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -329,6 +329,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -397,7 +400,7 @@ helpers.c helpers.h private.h \ gpgme-h-clean.py \ examples \ - pyme + gpg SUBDIRS = . tests COPY_FILES = \ @@ -408,17 +411,17 @@ $(srcdir)/examples \ $(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h -COPY_FILES_PYME = \ - $(srcdir)/pyme/callbacks.py \ - $(srcdir)/pyme/constants \ - $(srcdir)/pyme/core.py \ - $(srcdir)/pyme/errors.py \ - $(srcdir)/pyme/__init__.py \ - $(srcdir)/pyme/results.py \ - $(srcdir)/pyme/util.py +COPY_FILES_GPG = \ + $(srcdir)/gpg/callbacks.py \ + $(srcdir)/gpg/constants \ + $(srcdir)/gpg/core.py \ + $(srcdir)/gpg/errors.py \ + $(srcdir)/gpg/__init__.py \ + $(srcdir)/gpg/results.py \ + $(srcdir)/gpg/util.py -CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \ - copystamp +CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ + data.h config.h copystamp all: all-recursive @@ -737,29 +740,38 @@ # 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_GPG) data.h config.h if test "$(srcdir)" != "$(builddir)" ; then \ cp -R $(COPY_FILES) . ; \ - cp -R $(COPY_FILES_PYME) pyme ; \ + cp -R $(COPY_FILES_GPG) gpg ; \ 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)" \ +dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp + CFLAGS="$(CFLAGS)" \ $(PYTHON) setup.py sdist --verbose - gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz + gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz + +.PHONY: prepare +prepare: copystamp .PHONY: sdist -sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc +sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc .PHONY: upload -upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc +upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc twine upload $^ # Remove the rest. @@ -771,8 +783,8 @@ if test "$(srcdir)" != "$(builddir)" ; then \ find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \ for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \ - for F in $(COPY_FILES_PYME); do \ - rm -rf -- pyme/`basename $$F` ; \ + for F in $(COPY_FILES_GPG); do \ + rm -rf -- gpg/`basename $$F` ; \ done ; \ fi @@ -786,12 +798,12 @@ cat files.txt >> install_files.txt ; \ rm files.txt ; \ done - $(MKDIR_P) $(DESTDIR)$(pythondir)/pyme - mv install_files.txt $(DESTDIR)$(pythondir)/pyme + $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg + mv install_files.txt $(DESTDIR)$(pythondir)/gpg uninstall-local: - xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf -- - rm -rf -- $(DESTDIR)$(pythondir)/pyme + xargs <$(DESTDIR)$(pythondir)/gpg/install_files.txt -- rm -rf -- + rm -rf -- $(DESTDIR)$(pythondir)/gpg # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru gpgme1.0-1.7.0/lang/python/MANIFEST.in gpgme1.0-1.8.0/lang/python/MANIFEST.in --- gpgme1.0-1.7.0/lang/python/MANIFEST.in 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/MANIFEST.in 2016-11-16 09:18:20.000000000 +0000 @@ -1,4 +1,4 @@ recursive-include examples *.py include gpgme-h-clean.py gpgme.i include helpers.c helpers.h private.h -recursive-include pyme *.py +recursive-include gpg *.py diff -Nru gpgme1.0-1.7.0/lang/python/private.h gpgme1.0-1.8.0/lang/python/private.h --- gpgme1.0-1.7.0/lang/python/private.h 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/private.h 2016-11-16 09:18:20.000000000 +0000 @@ -19,36 +19,36 @@ #include -#ifndef _PYME_PRIVATE_H_ -#define _PYME_PRIVATE_H_ +#ifndef _GPG_PRIVATE_H_ +#define _GPG_PRIVATE_H_ /* GPGME glue. Implemented in helpers.c. */ -void _pyme_exception_init(void); -gpgme_error_t _pyme_exception2code(void); +void _gpg_exception_init(void); +gpgme_error_t _gpg_exception2code(void); -PyObject *_pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum); -PyObject *_pyme_obj2gpgme_data_t(PyObject *input, int argnum, +PyObject *_gpg_obj2gpgme_t(PyObject *input, const char *objtype, int argnum); +PyObject *_gpg_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper, PyObject **bytesio, Py_buffer *view); -PyObject *_pyme_wrap_result(PyObject *fragile, const char *classname); +PyObject *_gpg_wrap_result(PyObject *fragile, const char *classname); -gpgme_error_t _pyme_interact_cb(void *opaque, const char *keyword, +gpgme_error_t _gpg_interact_cb(void *opaque, const char *keyword, const char *args, int fd); -gpgme_error_t _pyme_assuan_data_cb (void *hook, +gpgme_error_t _gpg_assuan_data_cb (void *hook, const void *data, size_t datalen); -gpgme_error_t _pyme_assuan_inquire_cb (void *hook, +gpgme_error_t _gpg_assuan_inquire_cb (void *hook, const char *name, const char *args, gpgme_data_t *r_data); -gpgme_error_t _pyme_assuan_status_cb (void *hook, +gpgme_error_t _gpg_assuan_status_cb (void *hook, const char *status, const char *args); /* SWIG runtime support. Implemented in gpgme.i. */ -PyObject *_pyme_wrap_gpgme_data_t(gpgme_data_t data); -gpgme_ctx_t _pyme_unwrap_gpgme_ctx_t(PyObject *wrapped); +PyObject *_gpg_wrap_gpgme_data_t(gpgme_data_t data); +gpgme_ctx_t _gpg_unwrap_gpgme_ctx_t(PyObject *wrapped); -#endif /* _PYME_PRIVATE_H_ */ +#endif /* _GPG_PRIVATE_H_ */ diff -Nru gpgme1.0-1.7.0/lang/python/pyme/callbacks.py gpgme1.0-1.8.0/lang/python/pyme/callbacks.py --- gpgme1.0-1.7.0/lang/python/pyme/callbacks.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/callbacks.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from getpass import getpass - -def passphrase_stdin(hint, desc, prev_bad, hook=None): - """This is a sample callback that will read a passphrase from - the terminal. The hook here, if present, will be used to describe - why the passphrase is needed.""" - why = '' - if hook != None: - why = ' ' + hook - if prev_bad: - why += ' (again)' - print("Please supply %s' password%s:" % (hint, why)) - return getpass() - -def progress_stdout(what, type, current, total, hook=None): - print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" %\ - (what, type, current, total)) - -def readcb_fh(count, hook): - """A callback for data. hook should be a Python file-like object.""" - if count: - # Should return '' on EOF - return hook.read(count) - else: - # Wants to rewind. - if not hasattr(hook, 'seek'): - return None - hook.seek(0, 0) - return None diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/data/encoding.py gpgme1.0-1.8.0/lang/python/pyme/constants/data/encoding.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/data/encoding.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/data/encoding.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_DATA_ENCODING_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/data/__init__.py gpgme1.0-1.8.0/lang/python/pyme/constants/data/__init__.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/data/__init__.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/data/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from . import encoding -__all__ = ['encoding'] diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/event.py gpgme1.0-1.8.0/lang/python/pyme/constants/event.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/event.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/event.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_EVENT_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/import.py gpgme1.0-1.8.0/lang/python/pyme/constants/import.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/import.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/import.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_IMPORT_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/__init__.py gpgme1.0-1.8.0/lang/python/pyme/constants/__init__.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/__init__.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_', globals()) - -__all__ = ['data', 'event', 'import', 'keylist', 'md', 'pk', - 'protocol', 'sig', 'sigsum', 'status', 'validity'] - -# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We -# implement pyme.Context.op_edit using gpgme_op_interact, so the -# callbacks will be called with string keywords instead of numeric -# status messages. Code that is using these constants will continue -# to work. - -STATUS_ABORT = "ABORT" -STATUS_ALREADY_SIGNED = "ALREADY_SIGNED" -STATUS_ATTRIBUTE = "ATTRIBUTE" -STATUS_BACKUP_KEY_CREATED = "BACKUP_KEY_CREATED" -STATUS_BAD_PASSPHRASE = "BAD_PASSPHRASE" -STATUS_BADARMOR = "BADARMOR" -STATUS_BADMDC = "BADMDC" -STATUS_BADSIG = "BADSIG" -STATUS_BEGIN_DECRYPTION = "BEGIN_DECRYPTION" -STATUS_BEGIN_ENCRYPTION = "BEGIN_ENCRYPTION" -STATUS_BEGIN_SIGNING = "BEGIN_SIGNING" -STATUS_BEGIN_STREAM = "BEGIN_STREAM" -STATUS_CARDCTRL = "CARDCTRL" -STATUS_DECRYPTION_FAILED = "DECRYPTION_FAILED" -STATUS_DECRYPTION_INFO = "DECRYPTION_INFO" -STATUS_DECRYPTION_OKAY = "DECRYPTION_OKAY" -STATUS_DELETE_PROBLEM = "DELETE_PROBLEM" -STATUS_ENC_TO = "ENC_TO" -STATUS_END_DECRYPTION = "END_DECRYPTION" -STATUS_END_ENCRYPTION = "END_ENCRYPTION" -STATUS_END_STREAM = "END_STREAM" -STATUS_ENTER = "ENTER" -STATUS_ERRMDC = "ERRMDC" -STATUS_ERROR = "ERROR" -STATUS_ERRSIG = "ERRSIG" -STATUS_EXPKEYSIG = "EXPKEYSIG" -STATUS_EXPSIG = "EXPSIG" -STATUS_FAILURE = "FAILURE" -STATUS_FILE_DONE = "FILE_DONE" -STATUS_FILE_ERROR = "FILE_ERROR" -STATUS_FILE_START = "FILE_START" -STATUS_GET_BOOL = "GET_BOOL" -STATUS_GET_HIDDEN = "GET_HIDDEN" -STATUS_GET_LINE = "GET_LINE" -STATUS_GOOD_PASSPHRASE = "GOOD_PASSPHRASE" -STATUS_GOODMDC = "GOODMDC" -STATUS_GOODSIG = "GOODSIG" -STATUS_GOT_IT = "GOT_IT" -STATUS_IMPORT_OK = "IMPORT_OK" -STATUS_IMPORT_PROBLEM = "IMPORT_PROBLEM" -STATUS_IMPORT_RES = "IMPORT_RES" -STATUS_IMPORTED = "IMPORTED" -STATUS_INQUIRE_MAXLEN = "INQUIRE_MAXLEN" -STATUS_INV_RECP = "INV_RECP" -STATUS_INV_SGNR = "INV_SGNR" -STATUS_KEY_CONSIDERED = "KEY_CONSIDERED" -STATUS_KEY_CREATED = "KEY_CREATED" -STATUS_KEY_NOT_CREATED = "KEY_NOT_CREATED" -STATUS_KEYEXPIRED = "KEYEXPIRED" -STATUS_KEYREVOKED = "KEYREVOKED" -STATUS_LEAVE = "LEAVE" -STATUS_MISSING_PASSPHRASE = "MISSING_PASSPHRASE" -STATUS_MOUNTPOINT = "MOUNTPOINT" -STATUS_NEED_PASSPHRASE = "NEED_PASSPHRASE" -STATUS_NEED_PASSPHRASE_PIN = "NEED_PASSPHRASE_PIN" -STATUS_NEED_PASSPHRASE_SYM = "NEED_PASSPHRASE_SYM" -STATUS_NEWSIG = "NEWSIG" -STATUS_NO_PUBKEY = "NO_PUBKEY" -STATUS_NO_RECP = "NO_RECP" -STATUS_NO_SECKEY = "NO_SECKEY" -STATUS_NO_SGNR = "NO_SGNR" -STATUS_NODATA = "NODATA" -STATUS_NOTATION_DATA = "NOTATION_DATA" -STATUS_NOTATION_FLAGS = "NOTATION_FLAGS" -STATUS_NOTATION_NAME = "NOTATION_NAME" -STATUS_PINENTRY_LAUNCHED = "PINENTRY_LAUNCHED" -STATUS_PKA_TRUST_BAD = "PKA_TRUST_BAD" -STATUS_PKA_TRUST_GOOD = "PKA_TRUST_GOOD" -STATUS_PLAINTEXT = "PLAINTEXT" -STATUS_PLAINTEXT_LENGTH = "PLAINTEXT_LENGTH" -STATUS_POLICY_URL = "POLICY_URL" -STATUS_PROGRESS = "PROGRESS" -STATUS_REVKEYSIG = "REVKEYSIG" -STATUS_RSA_OR_IDEA = "RSA_OR_IDEA" -STATUS_SC_OP_FAILURE = "SC_OP_FAILURE" -STATUS_SC_OP_SUCCESS = "SC_OP_SUCCESS" -STATUS_SESSION_KEY = "SESSION_KEY" -STATUS_SHM_GET = "SHM_GET" -STATUS_SHM_GET_BOOL = "SHM_GET_BOOL" -STATUS_SHM_GET_HIDDEN = "SHM_GET_HIDDEN" -STATUS_SHM_INFO = "SHM_INFO" -STATUS_SIG_CREATED = "SIG_CREATED" -STATUS_SIG_ID = "SIG_ID" -STATUS_SIG_SUBPACKET = "SIG_SUBPACKET" -STATUS_SIGEXPIRED = "SIGEXPIRED" -STATUS_SUCCESS = "SUCCESS" -STATUS_TOFU_STATS = "TOFU_STATS" -STATUS_TOFU_STATS_LONG = "TOFU_STATS_LONG" -STATUS_TOFU_USER = "TOFU_USER" -STATUS_TRUNCATED = "TRUNCATED" -STATUS_TRUST_FULLY = "TRUST_FULLY" -STATUS_TRUST_MARGINAL = "TRUST_MARGINAL" -STATUS_TRUST_NEVER = "TRUST_NEVER" -STATUS_TRUST_ULTIMATE = "TRUST_ULTIMATE" -STATUS_TRUST_UNDEFINED = "TRUST_UNDEFINED" -STATUS_UNEXPECTED = "UNEXPECTED" -STATUS_USERID_HINT = "USERID_HINT" -STATUS_VALIDSIG = "VALIDSIG" diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/keylist/__init__.py gpgme1.0-1.8.0/lang/python/pyme/constants/keylist/__init__.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/keylist/__init__.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/keylist/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from . import mode -__all__ = ['mode'] diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/keylist/mode.py gpgme1.0-1.8.0/lang/python/pyme/constants/keylist/mode.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/keylist/mode.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/keylist/mode.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_KEYLIST_MODE_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/md.py gpgme1.0-1.8.0/lang/python/pyme/constants/md.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/md.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/md.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_MD_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/pk.py gpgme1.0-1.8.0/lang/python/pyme/constants/pk.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/pk.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/pk.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_PK_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/protocol.py gpgme1.0-1.8.0/lang/python/pyme/constants/protocol.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/protocol.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/protocol.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_PROTOCOL_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/sig/__init__.py gpgme1.0-1.8.0/lang/python/pyme/constants/sig/__init__.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/sig/__init__.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/sig/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from . import mode -__all__ = ['mode'] diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/sig/mode.py gpgme1.0-1.8.0/lang/python/pyme/constants/sig/mode.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/sig/mode.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/sig/mode.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_SIG_MODE_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/sigsum.py gpgme1.0-1.8.0/lang/python/pyme/constants/sigsum.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/sigsum.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/sigsum.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_SIGSUM_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/status.py gpgme1.0-1.8.0/lang/python/pyme/constants/status.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/status.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/status.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We -# implement pyme.Context.op_edit using gpgme_op_interact, so the -# callbacks will be called with string keywords instead of numeric -# status messages. Code that is using these constants will continue -# to work. - -ABORT = "ABORT" -ALREADY_SIGNED = "ALREADY_SIGNED" -ATTRIBUTE = "ATTRIBUTE" -BACKUP_KEY_CREATED = "BACKUP_KEY_CREATED" -BAD_PASSPHRASE = "BAD_PASSPHRASE" -BADARMOR = "BADARMOR" -BADMDC = "BADMDC" -BADSIG = "BADSIG" -BEGIN_DECRYPTION = "BEGIN_DECRYPTION" -BEGIN_ENCRYPTION = "BEGIN_ENCRYPTION" -BEGIN_SIGNING = "BEGIN_SIGNING" -BEGIN_STREAM = "BEGIN_STREAM" -CARDCTRL = "CARDCTRL" -DECRYPTION_FAILED = "DECRYPTION_FAILED" -DECRYPTION_INFO = "DECRYPTION_INFO" -DECRYPTION_OKAY = "DECRYPTION_OKAY" -DELETE_PROBLEM = "DELETE_PROBLEM" -ENC_TO = "ENC_TO" -END_DECRYPTION = "END_DECRYPTION" -END_ENCRYPTION = "END_ENCRYPTION" -END_STREAM = "END_STREAM" -ENTER = "ENTER" -ERRMDC = "ERRMDC" -ERROR = "ERROR" -ERRSIG = "ERRSIG" -EXPKEYSIG = "EXPKEYSIG" -EXPSIG = "EXPSIG" -FAILURE = "FAILURE" -FILE_DONE = "FILE_DONE" -FILE_ERROR = "FILE_ERROR" -FILE_START = "FILE_START" -GET_BOOL = "GET_BOOL" -GET_HIDDEN = "GET_HIDDEN" -GET_LINE = "GET_LINE" -GOOD_PASSPHRASE = "GOOD_PASSPHRASE" -GOODMDC = "GOODMDC" -GOODSIG = "GOODSIG" -GOT_IT = "GOT_IT" -IMPORT_OK = "IMPORT_OK" -IMPORT_PROBLEM = "IMPORT_PROBLEM" -IMPORT_RES = "IMPORT_RES" -IMPORTED = "IMPORTED" -INQUIRE_MAXLEN = "INQUIRE_MAXLEN" -INV_RECP = "INV_RECP" -INV_SGNR = "INV_SGNR" -KEY_CONSIDERED = "KEY_CONSIDERED" -KEY_CREATED = "KEY_CREATED" -KEY_NOT_CREATED = "KEY_NOT_CREATED" -KEYEXPIRED = "KEYEXPIRED" -KEYREVOKED = "KEYREVOKED" -LEAVE = "LEAVE" -MISSING_PASSPHRASE = "MISSING_PASSPHRASE" -MOUNTPOINT = "MOUNTPOINT" -NEED_PASSPHRASE = "NEED_PASSPHRASE" -NEED_PASSPHRASE_PIN = "NEED_PASSPHRASE_PIN" -NEED_PASSPHRASE_SYM = "NEED_PASSPHRASE_SYM" -NEWSIG = "NEWSIG" -NO_PUBKEY = "NO_PUBKEY" -NO_RECP = "NO_RECP" -NO_SECKEY = "NO_SECKEY" -NO_SGNR = "NO_SGNR" -NODATA = "NODATA" -NOTATION_DATA = "NOTATION_DATA" -NOTATION_FLAGS = "NOTATION_FLAGS" -NOTATION_NAME = "NOTATION_NAME" -PINENTRY_LAUNCHED = "PINENTRY_LAUNCHED" -PKA_TRUST_BAD = "PKA_TRUST_BAD" -PKA_TRUST_GOOD = "PKA_TRUST_GOOD" -PLAINTEXT = "PLAINTEXT" -PLAINTEXT_LENGTH = "PLAINTEXT_LENGTH" -POLICY_URL = "POLICY_URL" -PROGRESS = "PROGRESS" -REVKEYSIG = "REVKEYSIG" -RSA_OR_IDEA = "RSA_OR_IDEA" -SC_OP_FAILURE = "SC_OP_FAILURE" -SC_OP_SUCCESS = "SC_OP_SUCCESS" -SESSION_KEY = "SESSION_KEY" -SHM_GET = "SHM_GET" -SHM_GET_BOOL = "SHM_GET_BOOL" -SHM_GET_HIDDEN = "SHM_GET_HIDDEN" -SHM_INFO = "SHM_INFO" -SIG_CREATED = "SIG_CREATED" -SIG_ID = "SIG_ID" -SIG_SUBPACKET = "SIG_SUBPACKET" -SIGEXPIRED = "SIGEXPIRED" -SUCCESS = "SUCCESS" -TOFU_STATS = "TOFU_STATS" -TOFU_STATS_LONG = "TOFU_STATS_LONG" -TOFU_USER = "TOFU_USER" -TRUNCATED = "TRUNCATED" -TRUST_FULLY = "TRUST_FULLY" -TRUST_MARGINAL = "TRUST_MARGINAL" -TRUST_NEVER = "TRUST_NEVER" -TRUST_ULTIMATE = "TRUST_ULTIMATE" -TRUST_UNDEFINED = "TRUST_UNDEFINED" -UNEXPECTED = "UNEXPECTED" -USERID_HINT = "USERID_HINT" -VALIDSIG = "VALIDSIG" diff -Nru gpgme1.0-1.7.0/lang/python/pyme/constants/validity.py gpgme1.0-1.8.0/lang/python/pyme/constants/validity.py --- gpgme1.0-1.7.0/lang/python/pyme/constants/validity.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/constants/validity.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from pyme import util -util.process_constants('GPGME_VALIDITY_', globals()) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/core.py gpgme1.0-1.8.0/lang/python/pyme/core.py --- gpgme1.0-1.7.0/lang/python/pyme/core.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/core.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1145 +0,0 @@ -# Copyright (C) 2016 g10 Code GmbH -# Copyright (C) 2004,2008 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -"""Core functionality - -Core functionality of GPGME wrapped in a object-oriented fashion. -Provides the 'Context' class for performing cryptographic operations, -and the 'Data' class describing buffers of data. - -""" - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -import re -import os -import warnings -import weakref -from . import gpgme -from .errors import errorcheck, GPGMEError -from . import constants -from . import errors -from . import util - -class GpgmeWrapper(object): - """Base wrapper class - - Not to be instantiated directly. - - """ - - def __init__(self, wrapped): - self._callback_excinfo = None - self.wrapped = wrapped - - def __repr__(self): - return '<{}/{!r}>'.format(super(GpgmeWrapper, self).__repr__(), - self.wrapped) - - def __str__(self): - acc = ['{}.{}'.format(__name__, self.__class__.__name__)] - flags = [f for f in self._boolean_properties if getattr(self, f)] - if flags: - acc.append('({})'.format(' '.join(flags))) - - return '<{}>'.format(' '.join(acc)) - - def __hash__(self): - return hash(repr(self.wrapped)) - - def __eq__(self, other): - if other == None: - return False - else: - return repr(self.wrapped) == repr(other.wrapped) - - @property - def _ctype(self): - """The name of the c type wrapped by this class - - Must be set by child classes. - - """ - raise NotImplementedError() - - @property - def _cprefix(self): - """The common prefix of c functions wrapped by this class - - Must be set by child classes. - - """ - raise NotImplementedError() - - def _errorcheck(self, name): - """Must be implemented by child classes. - - This function must return a trueish value for all c functions - returning gpgme_error_t.""" - raise NotImplementedError() - - """The set of all boolean properties""" - _boolean_properties = set() - - def __wrap_boolean_property(self, key, do_set=False, value=None): - get_func = getattr(gpgme, - "{}get_{}".format(self._cprefix, key)) - set_func = getattr(gpgme, - "{}set_{}".format(self._cprefix, key)) - def get(slf): - return bool(get_func(slf.wrapped)) - def set_(slf, value): - set_func(slf.wrapped, bool(value)) - - p = property(get, set_, doc="{} flag".format(key)) - setattr(self.__class__, key, p) - - if do_set: - set_(self, bool(value)) - else: - return get(self) - - _munge_docstring = re.compile(r'gpgme_([^(]*)\(([^,]*), (.*\) -> .*)') - def __getattr__(self, key): - """On-the-fly generation of wrapper methods and properties""" - if key[0] == '_' or self._cprefix == None: - return None - - if key in self._boolean_properties: - return self.__wrap_boolean_property(key) - - name = self._cprefix + key - func = getattr(gpgme, name) - - if self._errorcheck(name): - def _funcwrap(slf, *args): - result = func(slf.wrapped, *args) - if slf._callback_excinfo: - gpgme.pyme_raise_callback_exception(slf) - return errorcheck(result, "Invocation of " + name) - else: - def _funcwrap(slf, *args): - result = func(slf.wrapped, *args) - if slf._callback_excinfo: - gpgme.pyme_raise_callback_exception(slf) - return result - - doc = self._munge_docstring.sub(r'\2.\1(\3', getattr(func, "__doc__")) - _funcwrap.__doc__ = doc - - # Monkey-patch the class. - setattr(self.__class__, key, _funcwrap) - - # Bind the method to 'self'. - def wrapper(*args): - return _funcwrap(self, *args) - wrapper.__doc__ = doc - - return wrapper - - def __setattr__(self, key, value): - """On-the-fly generation of properties""" - if key in self._boolean_properties: - self.__wrap_boolean_property(key, True, value) - else: - super(GpgmeWrapper, self).__setattr__(key, value) - -class Context(GpgmeWrapper): - """Context for cryptographic operations - - All cryptographic operations in GPGME are performed within a - context, which contains the internal state of the operation as - well as configuration parameters. By using several contexts you - can run several cryptographic operations in parallel, with - different configuration. - - Access to a context must be synchronized. - - """ - - def __init__(self, armor=False, textmode=False, offline=False, - signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT, - protocol=constants.PROTOCOL_OpenPGP, - wrapped=None): - """Construct a context object - - Keyword arguments: - armor -- enable ASCII armoring (default False) - textmode -- enable canonical text mode (default False) - offline -- do not contact external key sources (default False) - signers -- list of keys used for signing (default []) - pinentry_mode -- pinentry mode (default PINENTRY_MODE_DEFAULT) - protocol -- protocol to use (default PROTOCOL_OpenPGP) - - """ - if wrapped: - self.own = False - else: - tmp = gpgme.new_gpgme_ctx_t_p() - errorcheck(gpgme.gpgme_new(tmp)) - wrapped = gpgme.gpgme_ctx_t_p_value(tmp) - gpgme.delete_gpgme_ctx_t_p(tmp) - self.own = True - super(Context, self).__init__(wrapped) - self.armor = armor - self.textmode = textmode - self.offline = offline - self.signers = signers - self.pinentry_mode = pinentry_mode - self.protocol = protocol - - def encrypt(self, plaintext, recipients=[], sign=True, sink=None, - passphrase=None, always_trust=False, add_encrypt_to=False, - prepare=False, expect_sign=False, compress=True): - """Encrypt data - - Encrypt the given plaintext for the given recipients. If the - list of recipients is empty, the data is encrypted - symmetrically with a passphrase. - - The passphrase can be given as parameter, using a callback - registered at the context, or out-of-band via pinentry. - - Keyword arguments: - recipients -- list of keys to encrypt to - sign -- sign plaintext (default True) - sink -- write result to sink instead of returning it - passphrase -- for symmetric encryption - always_trust -- always trust the keys (default False) - add_encrypt_to -- encrypt to configured additional keys (default False) - prepare -- (ui) prepare for encryption (default False) - expect_sign -- (ui) prepare for signing (default False) - compress -- compress plaintext (default True) - - Returns: - ciphertext -- the encrypted data (or None if sink is given) - result -- additional information about the encryption - sign_result -- additional information about the signature(s) - - Raises: - InvalidRecipients -- if encryption using a particular key failed - InvalidSigners -- if signing using a particular key failed - GPGMEError -- as signaled by the underlying library - - """ - ciphertext = sink if sink else Data() - flags = 0 - flags |= always_trust * constants.ENCRYPT_ALWAYS_TRUST - flags |= (not add_encrypt_to) * constants.ENCRYPT_NO_ENCRYPT_TO - flags |= prepare * constants.ENCRYPT_PREPARE - flags |= expect_sign * constants.ENCRYPT_EXPECT_SIGN - flags |= (not compress) * constants.ENCRYPT_NO_COMPRESS - - if passphrase != None: - old_pinentry_mode = self.pinentry_mode - old_passphrase_cb = getattr(self, '_passphrase_cb', None) - self.pinentry_mode = constants.PINENTRY_MODE_LOOPBACK - def passphrase_cb(hint, desc, prev_bad, hook=None): - return passphrase - self.set_passphrase_cb(passphrase_cb) - - try: - if sign: - self.op_encrypt_sign(recipients, flags, plaintext, ciphertext) - else: - self.op_encrypt(recipients, flags, plaintext, ciphertext) - except errors.GPGMEError as e: - if e.getcode() == errors.UNUSABLE_PUBKEY: - result = self.op_encrypt_result() - if result.invalid_recipients: - raise errors.InvalidRecipients(result.invalid_recipients) - if e.getcode() == errors.UNUSABLE_SECKEY: - sig_result = self.op_sign_result() - if sig_result.invalid_signers: - raise errors.InvalidSigners(sig_result.invalid_signers) - raise - finally: - if passphrase != None: - self.pinentry_mode = old_pinentry_mode - if old_passphrase_cb: - self.set_passphrase_cb(*old_passphrase_cb[1:]) - - result = self.op_encrypt_result() - assert not result.invalid_recipients - sig_result = self.op_sign_result() if sign else None - assert not sig_result or not sig_result.invalid_signers - - cipherbytes = None - if not sink: - ciphertext.seek(0, os.SEEK_SET) - cipherbytes = ciphertext.read() - return cipherbytes, result, sig_result - - def decrypt(self, ciphertext, sink=None, passphrase=None, verify=True): - """Decrypt data - - Decrypt the given ciphertext and verify any signatures. If - VERIFY is an iterable of keys, the ciphertext must be signed - by all those keys, otherwise an error is raised. - - If the ciphertext is symmetrically encrypted using a - passphrase, that passphrase can be given as parameter, using a - callback registered at the context, or out-of-band via - pinentry. - - Keyword arguments: - sink -- write result to sink instead of returning it - passphrase -- for symmetric decryption - verify -- check signatures (default True) - - Returns: - plaintext -- the decrypted data (or None if sink is given) - result -- additional information about the decryption - verify_result -- additional information about the signature(s) - - Raises: - UnsupportedAlgorithm -- if an unsupported algorithm was used - BadSignatures -- if a bad signature is encountered - MissingSignatures -- if expected signatures are missing or bad - GPGMEError -- as signaled by the underlying library - - """ - plaintext = sink if sink else Data() - - if passphrase != None: - old_pinentry_mode = self.pinentry_mode - old_passphrase_cb = getattr(self, '_passphrase_cb', None) - self.pinentry_mode = constants.PINENTRY_MODE_LOOPBACK - def passphrase_cb(hint, desc, prev_bad, hook=None): - return passphrase - self.set_passphrase_cb(passphrase_cb) - - try: - if verify: - self.op_decrypt_verify(ciphertext, plaintext) - else: - self.op_decrypt(ciphertext, plaintext) - finally: - if passphrase != None: - self.pinentry_mode = old_pinentry_mode - if old_passphrase_cb: - self.set_passphrase_cb(*old_passphrase_cb[1:]) - - result = self.op_decrypt_result() - verify_result = self.op_verify_result() if verify else None - if result.unsupported_algorithm: - raise errors.UnsupportedAlgorithm(result.unsupported_algorithm) - - if verify: - if any(s.status != errors.NO_ERROR - for s in verify_result.signatures): - raise errors.BadSignatures(verify_result) - - if verify and verify != True: - missing = list() - for key in verify: - ok = False - for subkey in key.subkeys: - for sig in verify_result.signatures: - if sig.summary & constants.SIGSUM_VALID == 0: - continue - if subkey.can_sign and subkey.fpr == sig.fpr: - ok = True - break - if ok: - break - if not ok: - missing.append(key) - if missing: - raise errors.MissingSignatures(verify_result, missing) - - plainbytes = None - if not sink: - plaintext.seek(0, os.SEEK_SET) - plainbytes = plaintext.read() - return plainbytes, result, verify_result - - def sign(self, data, sink=None, mode=constants.SIG_MODE_NORMAL): - """Sign data - - Sign the given data with either the configured default local - key, or the 'signers' keys of this context. - - Keyword arguments: - mode -- signature mode (default: normal, see below) - sink -- write result to sink instead of returning it - - Returns: - either - signed_data -- encoded data and signature (normal mode) - signature -- only the signature data (detached mode) - cleartext -- data and signature as text (cleartext mode) - (or None if sink is given) - result -- additional information about the signature(s) - - Raises: - InvalidSigners -- if signing using a particular key failed - GPGMEError -- as signaled by the underlying library - - """ - signeddata = sink if sink else Data() - - try: - self.op_sign(data, signeddata, mode) - except errors.GPGMEError as e: - if e.getcode() == errors.UNUSABLE_SECKEY: - result = self.op_sign_result() - if result.invalid_signers: - raise errors.InvalidSigners(result.invalid_signers) - raise - - result = self.op_sign_result() - assert not result.invalid_signers - - signedbytes = None - if not sink: - signeddata.seek(0, os.SEEK_SET) - signedbytes = signeddata.read() - return signedbytes, result - - def verify(self, signed_data, signature=None, sink=None, verify=[]): - """Verify signatures - - Verify signatures over data. If VERIFY is an iterable of - keys, the ciphertext must be signed by all those keys, - otherwise an error is raised. - - Keyword arguments: - signature -- detached signature data - sink -- write result to sink instead of returning it - - Returns: - data -- the plain data - (or None if sink is given, or we verified a detached signature) - result -- additional information about the signature(s) - - Raises: - BadSignatures -- if a bad signature is encountered - MissingSignatures -- if expected signatures are missing or bad - GPGMEError -- as signaled by the underlying library - - """ - if signature: - # Detached signature, we don't return the plain text. - data = None - else: - data = sink if sink else Data() - - if signature: - self.op_verify(signature, signed_data, None) - else: - self.op_verify(signed_data, None, data) - - result = self.op_verify_result() - if any(s.status != errors.NO_ERROR for s in result.signatures): - raise errors.BadSignatures(result) - - missing = list() - for key in verify: - ok = False - for subkey in key.subkeys: - for sig in result.signatures: - if sig.summary & constants.SIGSUM_VALID == 0: - continue - if subkey.can_sign and subkey.fpr == sig.fpr: - ok = True - break - if ok: - break - if not ok: - missing.append(key) - if missing: - raise errors.MissingSignatures(result, missing) - - plainbytes = None - if data and not sink: - data.seek(0, os.SEEK_SET) - plainbytes = data.read() - return plainbytes, result - - def keylist(self, pattern=None, secret=False): - """List keys - - Keyword arguments: - pattern -- return keys matching pattern (default: all keys) - secret -- return only secret keys - - Returns: - -- an iterator returning key objects - - Raises: - GPGMEError -- as signaled by the underlying library - """ - return self.op_keylist_all(pattern, secret) - - def assuan_transact(self, command, - data_cb=None, inquire_cb=None, status_cb=None): - """Issue a raw assuan command - - This function can be used to issue a raw assuan command to the - engine. - - If command is a string or bytes, it will be used as-is. If it - is an iterable of strings, it will be properly escaped and - joined into an well-formed assuan command. - - Keyword arguments: - data_cb -- a callback receiving data lines - inquire_cb -- a callback providing more information - status_cb -- a callback receiving status lines - - Returns: - result -- the result of command as GPGMEError - - Raises: - GPGMEError -- as signaled by the underlying library - - """ - - if isinstance(command, (str, bytes)): - cmd = command - else: - cmd = " ".join(util.percent_escape(f) for f in command) - - errptr = gpgme.new_gpgme_error_t_p() - - err = gpgme.gpgme_op_assuan_transact_ext( - self.wrapped, - cmd, - (weakref.ref(self), data_cb) if data_cb else None, - (weakref.ref(self), inquire_cb) if inquire_cb else None, - (weakref.ref(self), status_cb) if status_cb else None, - errptr) - - if self._callback_excinfo: - gpgme.pyme_raise_callback_exception(self) - - errorcheck(err) - - status = gpgme.gpgme_error_t_p_value(errptr) - gpgme.delete_gpgme_error_t_p(errptr) - - return GPGMEError(status) if status != 0 else None - - def interact(self, key, func, sink=None, flags=0, fnc_value=None): - """Interact with the engine - - This method can be used to edit keys and cards interactively. - KEY is the key to edit, FUNC is called repeatedly with two - unicode arguments, 'keyword' and 'args'. See the GPGME manual - for details. - - Keyword arguments: - sink -- if given, additional output is written here - flags -- use constants.INTERACT_CARD to edit a card - - Raises: - GPGMEError -- as signaled by the underlying library - - """ - if key == None: - raise ValueError("First argument cannot be None") - - if sink == None: - sink = Data() - - if fnc_value: - opaquedata = (weakref.ref(self), func, fnc_value) - else: - opaquedata = (weakref.ref(self), func) - - result = gpgme.gpgme_op_interact(self.wrapped, key, flags, - opaquedata, sink) - if self._callback_excinfo: - gpgme.pyme_raise_callback_exception(self) - errorcheck(result) - - @property - def signers(self): - """Keys used for signing""" - return [self.signers_enum(i) for i in range(self.signers_count())] - @signers.setter - def signers(self, signers): - old = self.signers - self.signers_clear() - try: - for key in signers: - self.signers_add(key) - except: - self.signers = old - raise - - @property - def pinentry_mode(self): - """Pinentry mode""" - return self.get_pinentry_mode() - @pinentry_mode.setter - def pinentry_mode(self, value): - self.set_pinentry_mode(value) - - @property - def protocol(self): - """Protocol to use""" - return self.get_protocol() - @protocol.setter - def protocol(self, value): - errorcheck(gpgme.gpgme_engine_check_version(value)) - self.set_protocol(value) - - _ctype = 'gpgme_ctx_t' - _cprefix = 'gpgme_' - - def _errorcheck(self, name): - """This function should list all functions returning gpgme_error_t""" - return ((name.startswith('gpgme_op_') - and not name.endswith('_result')) - or name in { - 'gpgme_set_ctx_flag', - 'gpgme_set_protocol', - 'gpgme_set_sub_protocol', - 'gpgme_set_keylist_mode', - 'gpgme_set_pinentry_mode', - 'gpgme_set_locale', - 'gpgme_set_engine_info', - 'gpgme_signers_add', - 'gpgme_get_sig_key', - 'gpgme_sig_notation_add', - 'gpgme_cancel', - 'gpgme_cancel_async', - 'gpgme_cancel_get_key', - }) - - _boolean_properties = {'armor', 'textmode', 'offline'} - - def __del__(self): - if not gpgme: - # At interpreter shutdown, gpgme is set to NONE. - return - - self._free_passcb() - self._free_progresscb() - self._free_statuscb() - if self.own and self.wrapped and gpgme.gpgme_release: - gpgme.gpgme_release(self.wrapped) - self.wrapped = None - - # Implement the context manager protocol. - def __enter__(self): - return self - def __exit__(self, type, value, tb): - self.__del__() - - def op_keylist_all(self, *args, **kwargs): - self.op_keylist_start(*args, **kwargs) - key = self.op_keylist_next() - while key: - yield key - key = self.op_keylist_next() - self.op_keylist_end() - - def op_keylist_next(self): - """Returns the next key in the list created - by a call to op_keylist_start(). The object returned - is of type Key.""" - ptr = gpgme.new_gpgme_key_t_p() - try: - errorcheck(gpgme.gpgme_op_keylist_next(self.wrapped, ptr)) - key = gpgme.gpgme_key_t_p_value(ptr) - except errors.GPGMEError as excp: - key = None - if excp.getcode() != errors.EOF: - raise excp - gpgme.delete_gpgme_key_t_p(ptr) - if key: - 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'""" - ptr = gpgme.new_gpgme_key_t_p() - errorcheck(gpgme.gpgme_get_key(self.wrapped, fpr, ptr, secret)) - 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 - - def op_trustlist_all(self, *args, **kwargs): - self.op_trustlist_start(*args, **kwargs) - trust = self.op_trustlist_next() - while trust: - yield trust - trust = self.op_trustlist_next() - self.op_trustlist_end() - - def op_trustlist_next(self): - """Returns the next trust item in the list created - by a call to op_trustlist_start(). The object returned - is of type TrustItem.""" - ptr = gpgme.new_gpgme_trust_item_t_p() - try: - errorcheck(gpgme.gpgme_op_trustlist_next(self.wrapped, ptr)) - trust = gpgme.gpgme_trust_item_t_p_value(ptr) - except errors.GPGMEError as excp: - trust = None - if excp.getcode() != errors.EOF: - raise - gpgme.delete_gpgme_trust_item_t_p(ptr) - return trust - - def set_passphrase_cb(self, func, hook=None): - """Sets the passphrase callback to the function specified by func. - - When the system needs a passphrase, it will call func with three args: - hint, a string describing the key it needs the passphrase for; - desc, a string describing the passphrase it needs; - prev_bad, a boolean equal True if this is a call made after - unsuccessful previous attempt. - - If hook has a value other than None it will be passed into the func - as a forth argument. - - Please see the GPGME manual for more information. - """ - if func == None: - hookdata = None - else: - if hook == None: - hookdata = (weakref.ref(self), func) - else: - hookdata = (weakref.ref(self), func, hook) - gpgme.pyme_set_passphrase_cb(self, hookdata) - - def _free_passcb(self): - if gpgme.pyme_set_passphrase_cb: - self.set_passphrase_cb(None) - - def set_progress_cb(self, func, hook=None): - """Sets the progress meter callback to the function specified by FUNC. - If FUNC is None, the callback will be cleared. - - This function will be called to provide an interactive update - of the system's progress. The function will be called with - three arguments, type, total, and current. If HOOK is not - None, it will be supplied as fourth argument. - - Please see the GPGME manual for more information. - - """ - if func == None: - hookdata = None - else: - if hook == None: - hookdata = (weakref.ref(self), func) - else: - hookdata = (weakref.ref(self), func, hook) - gpgme.pyme_set_progress_cb(self, hookdata) - - def _free_progresscb(self): - if gpgme.pyme_set_progress_cb: - self.set_progress_cb(None) - - def set_status_cb(self, func, hook=None): - """Sets the status callback to the function specified by FUNC. If - FUNC is None, the callback will be cleared. - - The function will be called with two arguments, keyword and - args. If HOOK is not None, it will be supplied as third - argument. - - Please see the GPGME manual for more information. - - """ - if func == None: - hookdata = None - else: - if hook == None: - hookdata = (weakref.ref(self), func) - else: - hookdata = (weakref.ref(self), func, hook) - gpgme.pyme_set_status_cb(self, hookdata) - - def _free_statuscb(self): - if gpgme.pyme_set_status_cb: - self.set_status_cb(None) - - @property - def engine_info(self): - """Configuration of the engine currently in use""" - p = self.protocol - infos = [i for i in self.get_engine_info() if i.protocol == p] - assert len(infos) == 1 - return infos[0] - - def get_engine_info(self): - """Get engine configuration - - Returns information about all configured and installed - engines. - - Returns: - infos -- a list of engine infos - - """ - return gpgme.gpgme_ctx_get_engine_info(self.wrapped) - - def set_engine_info(self, proto, file_name=None, home_dir=None): - """Change engine configuration - - Changes the configuration of the crypto engine implementing - the protocol 'proto' for the context. - - Keyword arguments: - file_name -- engine program file name (unchanged if None) - home_dir -- configuration directory (unchanged if None) - - """ - errorcheck(gpgme.gpgme_ctx_set_engine_info( - self.wrapped, proto, file_name, home_dir)) - - def wait(self, hang): - """Wait for asynchronous call to finish. Wait forever if hang is True. - Raises an exception on errors. - - Please read the GPGME manual for more information. - - """ - ptr = gpgme.new_gpgme_error_t_p() - gpgme.gpgme_wait(self.wrapped, ptr, hang) - status = gpgme.gpgme_error_t_p_value(ptr) - gpgme.delete_gpgme_error_t_p(ptr) - errorcheck(status) - - def op_edit(self, key, func, fnc_value, out): - """Start key editing using supplied callback function - - Note: This interface is deprecated and will be removed with - GPGME 1.8. Please use .interact instead. Furthermore, we - implement this using gpgme_op_interact, so callbacks will get - called with string keywords instead of numeric status - messages. Code that is using constants.STATUS_X or - constants.status.X will continue to work, whereas code using - magic numbers will break as a result. - - """ - warnings.warn("Call to deprecated method op_edit.", - category=DeprecationWarning) - return self.interact(key, func, sink=out, fnc_value=fnc_value) - - -class Data(GpgmeWrapper): - """Data buffer - - A lot of data has to be exchanged between the user and the crypto - engine, like plaintext messages, ciphertext, signatures and - information about the keys. The technical details about - exchanging the data information are completely abstracted by - GPGME. The user provides and receives the data via `gpgme_data_t' - objects, regardless of the communication protocol between GPGME - and the crypto engine in use. - - This Data class is the implementation of the GpgmeData objects. - - Please see the information about __init__ for instantiation. - - """ - - _ctype = 'gpgme_data_t' - _cprefix = 'gpgme_data_' - - def _errorcheck(self, name): - """This function should list all functions returning gpgme_error_t""" - return name not in { - 'gpgme_data_release_and_get_mem', - 'gpgme_data_get_encoding', - 'gpgme_data_seek', - 'gpgme_data_get_file_name', - } - - def __init__(self, string=None, file=None, offset=None, - length=None, cbs=None, copy=True): - """Initialize a new gpgme_data_t object. - - If no args are specified, make it an empty object. - - If string alone is specified, initialize it with the data - contained there. - - If file, offset, and length are all specified, file must - be either a filename or a file-like object, and the object - will be initialized by reading the specified chunk from the file. - - If cbs is specified, it MUST be a tuple of the form: - - (read_cb, write_cb, seek_cb, release_cb[, hook]) - - where the first four items are functions implementing reading, - writing, seeking the data, and releasing any resources once - the data object is deallocated. The functions must match the - following prototypes: - - def read(amount, hook=None): - return - - def write(data, hook=None): - return - - def seek(offset, whence, hook=None): - return - - def release(hook=None): - - - The functions may be bound methods. In that case, you can - simply use the 'self' reference instead of using a hook. - - If file is specified without any other arguments, then - it must be a filename, and the object will be initialized from - that file. - - """ - super(Data, self).__init__(None) - self.data_cbs = None - - if cbs != None: - self.new_from_cbs(*cbs) - elif string != None: - self.new_from_mem(string, copy) - elif file != None and offset != None and length != None: - self.new_from_filepart(file, offset, length) - elif file != None: - if util.is_a_string(file): - self.new_from_file(file, copy) - else: - self.new_from_fd(file) - else: - self.new() - - def __del__(self): - if not gpgme: - # At interpreter shutdown, gpgme is set to NONE. - return - - if self.wrapped != None and gpgme.gpgme_data_release: - gpgme.gpgme_data_release(self.wrapped) - if self._callback_excinfo: - gpgme.pyme_raise_callback_exception(self) - self.wrapped = None - self._free_datacbs() - - # Implement the context manager protocol. - def __enter__(self): - return self - def __exit__(self, type, value, tb): - self.__del__() - - def _free_datacbs(self): - self._data_cbs = None - - def new(self): - tmp = gpgme.new_gpgme_data_t_p() - errorcheck(gpgme.gpgme_data_new(tmp)) - self.wrapped = gpgme.gpgme_data_t_p_value(tmp) - gpgme.delete_gpgme_data_t_p(tmp) - - def new_from_mem(self, string, copy=True): - tmp = gpgme.new_gpgme_data_t_p() - errorcheck(gpgme.gpgme_data_new_from_mem(tmp,string,len(string),copy)) - self.wrapped = gpgme.gpgme_data_t_p_value(tmp) - gpgme.delete_gpgme_data_t_p(tmp) - - def new_from_file(self, filename, copy=True): - tmp = gpgme.new_gpgme_data_t_p() - try: - errorcheck(gpgme.gpgme_data_new_from_file(tmp, filename, copy)) - except errors.GPGMEError as e: - if e.getcode() == errors.INV_VALUE and not copy: - raise ValueError("delayed reads are not yet supported") - else: - raise e - self.wrapped = gpgme.gpgme_data_t_p_value(tmp) - gpgme.delete_gpgme_data_t_p(tmp) - - def new_from_cbs(self, read_cb, write_cb, seek_cb, release_cb, hook=None): - tmp = gpgme.new_gpgme_data_t_p() - if hook != None: - hookdata = (weakref.ref(self), - read_cb, write_cb, seek_cb, release_cb, hook) - else: - hookdata = (weakref.ref(self), - read_cb, write_cb, seek_cb, release_cb) - gpgme.pyme_data_new_from_cbs(self, hookdata, tmp) - self.wrapped = gpgme.gpgme_data_t_p_value(tmp) - gpgme.delete_gpgme_data_t_p(tmp) - - def new_from_filepart(self, file, offset, length): - """This wraps the GPGME gpgme_data_new_from_filepart() function. - The argument "file" may be: - - * a string specifying a file name, or - * a file-like object supporting the fileno() and the mode attribute. - - """ - - tmp = gpgme.new_gpgme_data_t_p() - filename = None - fp = None - - if util.is_a_string(file): - filename = file - else: - fp = gpgme.fdopen(file.fileno(), file.mode) - if fp == None: - raise ValueError("Failed to open file from %s arg %s" % \ - (str(type(file)), str(file))) - - errorcheck(gpgme.gpgme_data_new_from_filepart(tmp, filename, fp, - offset, length)) - self.wrapped = gpgme.gpgme_data_t_p_value(tmp) - gpgme.delete_gpgme_data_t_p(tmp) - - def new_from_fd(self, file): - """This wraps the GPGME gpgme_data_new_from_fd() function. The - argument "file" must be a file-like object, supporting the - fileno() method. - - """ - tmp = gpgme.new_gpgme_data_t_p() - errorcheck(gpgme.gpgme_data_new_from_fd(tmp, file.fileno())) - self.wrapped = gpgme.gpgme_data_t_p_value(tmp) - gpgme.delete_gpgme_data_t_p(tmp) - - def new_from_stream(self, file): - """This wrap around gpgme_data_new_from_stream is an alias for - new_from_fd() method since in python there's not difference - between file stream and file descriptor""" - self.new_from_fd(file) - - def write(self, buffer): - """Write buffer given as string or bytes. - - If a string is given, it is implicitly encoded using UTF-8.""" - written = gpgme.gpgme_data_write(self.wrapped, buffer) - if written < 0: - if self._callback_excinfo: - gpgme.pyme_raise_callback_exception(self) - else: - raise GPGMEError.fromSyserror() - return written - - def read(self, size = -1): - """Read at most size bytes, returned as bytes. - - If the size argument is negative or omitted, read until EOF is reached. - - Returns the data read, or the empty string if there was no data - to read before EOF was reached.""" - - if size == 0: - return '' - - if size > 0: - try: - result = gpgme.gpgme_data_read(self.wrapped, size) - except: - if self._callback_excinfo: - gpgme.pyme_raise_callback_exception(self) - else: - raise - return result - else: - chunks = [] - while True: - try: - result = gpgme.gpgme_data_read(self.wrapped, 4096) - except: - if self._callback_excinfo: - gpgme.pyme_raise_callback_exception(self) - else: - raise - if len(result) == 0: - break - chunks.append(result) - return b''.join(chunks) - -def pubkey_algo_name(algo): - return gpgme.gpgme_pubkey_algo_name(algo) - -def hash_algo_name(algo): - return gpgme.gpgme_hash_algo_name(algo) - -def get_protocol_name(proto): - return gpgme.gpgme_get_protocol_name(proto) - -def check_version(version=None): - return gpgme.gpgme_check_version(version) - -# check_version also makes sure that several subsystems are properly -# initialized, and it must be run at least once before invoking any -# other function. We do it here so that the user does not have to do -# it unless she really wants to check for a certain version. -check_version() - -def engine_check_version (proto): - try: - errorcheck(gpgme.gpgme_engine_check_version(proto)) - return True - except errors.GPGMEError: - return False - -def get_engine_info(): - ptr = gpgme.new_gpgme_engine_info_t_p() - try: - errorcheck(gpgme.gpgme_get_engine_info(ptr)) - info = gpgme.gpgme_engine_info_t_p_value(ptr) - except errors.GPGMEError: - info = None - gpgme.delete_gpgme_engine_info_t_p(ptr) - return info - -def set_engine_info(proto, file_name, home_dir=None): - """Changes the default configuration of the crypto engine implementing - the protocol 'proto'. 'file_name' is the file name of - the executable program implementing this protocol. 'home_dir' is the - directory name of the configuration directory (engine's default is - used if omitted).""" - errorcheck(gpgme.gpgme_set_engine_info(proto, file_name, home_dir)) - -def set_locale(category, value): - """Sets the default locale used by contexts""" - errorcheck(gpgme.gpgme_set_locale(None, category, value)) - -def wait(hang): - """Wait for asynchronous call on any Context to finish. - Wait forever if hang is True. - - For finished anynch calls it returns a tuple (status, context): - status - status return by asnynchronous call. - context - context which caused this call to return. - - Please read the GPGME manual of more information.""" - ptr = gpgme.new_gpgme_error_t_p() - context = gpgme.gpgme_wait(None, ptr, hang) - status = gpgme.gpgme_error_t_p_value(ptr) - gpgme.delete_gpgme_error_t_p(ptr) - if context == None: - errorcheck(status) - else: - context = Context(context) - return (status, context) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/errors.py gpgme1.0-1.8.0/lang/python/pyme/errors.py --- gpgme1.0-1.7.0/lang/python/pyme/errors.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/errors.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -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: -NO_ERROR = 0 - -class PymeError(Exception): - pass - -class GPGMEError(PymeError): - def __init__(self, error = None, message = None): - self.error = error - self.message = message - - @classmethod - def fromSyserror(cls): - return cls(gpgme.gpgme_err_code_from_syserror()) - - def getstring(self): - message = "%s: %s" % (gpgme.gpgme_strsource(self.error), - gpgme.gpgme_strerror(self.error)) - if self.message != None: - message = "%s: %s" % (self.message, message) - return message - - def getcode(self): - return gpgme.gpgme_err_code(self.error) - - def getsource(self): - return gpgme.gpgme_err_source(self.error) - - def __str__(self): - return self.getstring() - -def errorcheck(retval, extradata = None): - if retval: - raise GPGMEError(retval, extradata) - -# These errors are raised in the idiomatic interface code. - -class EncryptionError(PymeError): - pass - -class InvalidRecipients(EncryptionError): - def __init__(self, recipients): - self.recipients = recipients - def __str__(self): - return ", ".join("{}: {}".format(r.fpr, - gpgme.gpgme_strerror(r.reason)) - for r in self.recipients) - -class DeryptionError(PymeError): - pass - -class UnsupportedAlgorithm(DeryptionError): - def __init__(self, algorithm): - self.algorithm = algorithm - def __str__(self): - return self.algorithm - -class SigningError(PymeError): - pass - -class InvalidSigners(SigningError): - def __init__(self, signers): - self.signers = signers - def __str__(self): - return ", ".join("{}: {}".format(s.fpr, - gpgme.gpgme_strerror(s.reason)) - for s in self.signers) - -class VerificationError(PymeError): - pass - -class BadSignatures(VerificationError): - def __init__(self, result): - self.result = result - def __str__(self): - return ", ".join("{}: {}".format(s.fpr, - gpgme.gpgme_strerror(s.status)) - for s in self.result.signatures - if s.status != NO_ERROR) - -class MissingSignatures(VerificationError): - def __init__(self, result, missing): - self.result = result - self.missing = missing - def __str__(self): - return ", ".join(k.subkeys[0].fpr for k in self.missing) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/gpgme.py gpgme1.0-1.8.0/lang/python/pyme/gpgme.py --- gpgme1.0-1.7.0/lang/python/pyme/gpgme.py 2016-09-20 14:03:07.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/gpgme.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 3.0.7 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - - - - - -from sys import version_info -if version_info >= (2, 6, 0): - def swig_import_helper(): - from os.path import dirname - import imp - fp = None - try: - fp, pathname, description = imp.find_module('_gpgme', [dirname(__file__)]) - except ImportError: - import _gpgme - return _gpgme - if fp is not None: - try: - _mod = imp.load_module('_gpgme', fp, pathname, description) - finally: - fp.close() - return _mod - _gpgme = swig_import_helper() - del swig_import_helper -else: - import _gpgme -del version_info -from _gpgme import * -try: - _swig_property = property -except NameError: - pass # Python < 2.2 doesn't have 'property'. - - -def _swig_setattr_nondynamic(self, class_type, name, value, static=1): - if (name == "thisown"): - return self.this.own(value) - if (name == "this"): - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name, None) - if method: - return method(self, value) - if (not static): - if _newclass: - object.__setattr__(self, name, value) - else: - self.__dict__[name] = value - else: - raise AttributeError("You cannot add attributes to %s" % self) - - -def _swig_setattr(self, class_type, name, value): - return _swig_setattr_nondynamic(self, class_type, name, value, 0) - - -def _swig_getattr_nondynamic(self, class_type, name, static=1): - if (name == "thisown"): - return self.this.own() - method = class_type.__swig_getmethods__.get(name, None) - if method: - return method(self) - if (not static): - return object.__getattr__(self, name) - else: - raise AttributeError(name) - -def _swig_getattr(self, class_type, name): - return _swig_getattr_nondynamic(self, class_type, name, 0) - - -def _swig_repr(self): - try: - strthis = "proxy of " + self.this.__repr__() - except: - strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - -try: - _object = object - _newclass = 1 -except AttributeError: - class _object: - pass - _newclass = 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# This file is compatible with both classic and new-style classes. - - diff -Nru gpgme1.0-1.7.0/lang/python/pyme/__init__.py gpgme1.0-1.8.0/lang/python/pyme/__init__.py --- gpgme1.0-1.7.0/lang/python/pyme/__init__.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -# Copyright (C) 2016 g10 Code GmbH -# Copyright (C) 2004 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -"""Pyme: GPGME Interface for Python - -Welcome to PyME, the GPGME Interface for Python. "Pyme", when prounced, -rhymes with "Pine". - -The latest release of this package may be obtained from -https://www.gnupg.org - -Previous releases of this package for Python 2 can be obtained from -http://pyme.sourceforge.net - -FEATURES --------- - - * Feature-rich, full implementation of the GPGME library. Supports - all GPGME features. Callback functions may be written in pure - Python. Exceptions raised in callbacks are properly propagated. - - * Ability to sign, encrypt, decrypt, and verify data. - - * Ability to list keys, export and import keys, and manage the keyring. - - * Fully object-oriented with convenient classes and modules. - -QUICK EXAMPLE -------------- - - >>> import pyme - >>> with pyme.Context() as c: - >>> with pyme.Context() as c: - ... cipher, _, _ = c.encrypt("Hello world :)".encode(), - ... passphrase="abc") - ... c.decrypt(cipher, passphrase="abc") - ... - (b'Hello world :)', - , - ) - -GENERAL OVERVIEW ----------------- - -For those of you familiar with GPGME, you will be right at home here. - -Pyme is, for the most part, a direct interface to the C GPGME -library. However, it is re-packaged in a more Pythonic way -- -object-oriented with classes and modules. Take a look at the classes -defined here -- they correspond directly to certain object types in GPGME -for C. For instance, the following C code: - -gpgme_ctx_t context; -gpgme_new(&context); -... -gpgme_op_encrypt(context, recp, 1, plain, cipher); - -Translates into the following Python code: - -context = core.Context() -... -context.op_encrypt(recp, 1, plain, cipher) - -The Python module automatically does error-checking and raises Python -exception pyme.errors.GPGMEError when GPGME signals an error. getcode() -and getsource() of this exception return code and source of the error. - -IMPORTANT NOTE --------------- -This documentation only covers a small subset of available GPGME functions and -methods. Please consult the documentation for the C library -for comprehensive coverage. - -This library uses Python's reflection to automatically detect the methods -that are available for each class, and as such, most of those methods -do not appear explicitly anywhere. You can use dir() python built-in command -on an object to see what methods and fields it has but their meaning can -be found only in GPGME documentation. - -FOR MORE INFORMATION --------------------- -PYME3 homepage: https://www.gnupg.org/ -GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/ - -""" - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -from . import core -from . import errors -from . import constants -from . import util -from . import callbacks -from . import version -from .core import Context -from .core import Data - -# Interface hygiene. - -# Drop the low-level gpgme that creeps in for some reason. -gpgme = None -del gpgme - -# This is a white-list of symbols. Any other will alert pyflakes. -_ = [Context, Data, core, errors, constants, util, callbacks, version] -del _ - -__all__ = ["Context", "Data", - "core", "errors", "constants", "util", "callbacks", "version"] Binary files /tmp/tmpkO10q8/qX03w4hxAJ/gpgme1.0-1.7.0/lang/python/pyme/__pycache__/__init__.cpython-34.pyc and /tmp/tmpkO10q8/4K67owcsfS/gpgme1.0-1.8.0/lang/python/pyme/__pycache__/__init__.cpython-34.pyc differ Binary files /tmp/tmpkO10q8/qX03w4hxAJ/gpgme1.0-1.7.0/lang/python/pyme/__pycache__/version.cpython-34.pyc and /tmp/tmpkO10q8/4K67owcsfS/gpgme1.0-1.8.0/lang/python/pyme/__pycache__/version.cpython-34.pyc differ diff -Nru gpgme1.0-1.7.0/lang/python/pyme/results.py gpgme1.0-1.8.0/lang/python/pyme/results.py --- gpgme1.0-1.7.0/lang/python/pyme/results.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/results.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -# Robust result objects -# -# Copyright (C) 2016 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, see . - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -"""Robust result objects - -Results returned by the underlying library are fragile, i.e. they are -only valid until the next operation is performed in the context. - -We cannot arbitrarily constrain the lifetime of Python objects, we -therefore create deep copies of the results. - -""" - -class Result(object): - """Result object - - Describes the result of an operation. - - """ - - """Convert to types""" - _type = {} - - """Map functions over list attributes""" - _map = {} - - """Automatically copy unless blacklisted""" - _blacklist = { - 'acquire', 'append', 'disown', 'next', 'own', 'this', 'thisown', - } - def __init__(self, fragile): - for key, func in self._type.items(): - if hasattr(fragile, key): - setattr(self, key, func(getattr(fragile, key))) - - for key, func in self._map.items(): - if hasattr(fragile, key): - setattr(self, key, list(map(func, getattr(fragile, key)))) - - for key in dir(fragile): - if key.startswith('_') or key in self._blacklist: - continue - if hasattr(self, key): - continue - - setattr(self, key, getattr(fragile, key)) - - def __str__(self): - return '<{} {}>'.format( - self.__class__.__name__, - ', '.join('{}: {}'.format(k, getattr(self, k)) - for k in dir(self) if not k.startswith('_'))) - -class InvalidKey(Result): - pass - -class EncryptResult(Result): - _map = dict(invalid_recipients=InvalidKey) - -class Recipient(Result): - pass - -class DecryptResult(Result): - _type = dict(wrong_key_usage=bool) - _map = dict(recipients=Recipient) - -class NewSignature(Result): - pass - -class SignResult(Result): - _map = dict(invalid_signers=InvalidKey, signatures=NewSignature) - -class Notation(Result): - pass - -class Signature(Result): - _type = dict(wrong_key_usage=bool, chain_model=bool) - _map = dict(notations=Notation) - -class VerifyResult(Result): - _map = dict(signatures=Signature) - -class ImportStatus(Result): - pass - -class ImportResult(Result): - _map = dict(imports=ImportStatus) - -class GenkeyResult(Result): - _type = dict(primary=bool, sub=bool) - -class KeylistResult(Result): - _type = dict(truncated=bool) - -class VFSMountResult(Result): - pass - -class EngineInfo(Result): - pass diff -Nru gpgme1.0-1.7.0/lang/python/pyme/util.py gpgme1.0-1.8.0/lang/python/pyme/util.py --- gpgme1.0-1.7.0/lang/python/pyme/util.py 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/util.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -# Copyright (C) 2016 g10 Code GmbH -# Copyright (C) 2004,2008 Igor Belyi -# Copyright (C) 2002 John Goerzen -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals - -import sys - -def process_constants(prefix, scope): - """Called by the constant modules to load up the constants from the C - library starting with PREFIX. Matching constants will be inserted - into SCOPE with PREFIX stripped from the names. Returns the names - of inserted constants. - - """ - from . import gpgme - index = len(prefix) - constants = {identifier[index:]: getattr(gpgme, identifier) - for identifier in dir(gpgme) - if identifier.startswith(prefix)} - scope.update(constants) - return list(constants.keys()) - -def percent_escape(s): - return ''.join( - '%{0:2x}'.format(ord(c)) - if c == '+' or c == '"' or c == '%' or ord(c) <= 0x20 else c - for c in s) - -# Python2/3 compatibility -if sys.version_info[0] == 3: - # Python3 - def is_a_string(x): - return isinstance(x, str) -else: - # Python2 - def is_a_string(x): - return isinstance(x, basestring) diff -Nru gpgme1.0-1.7.0/lang/python/pyme/version.py gpgme1.0-1.8.0/lang/python/pyme/version.py --- gpgme1.0-1.7.0/lang/python/pyme/version.py 2016-09-21 07:19:58.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/version.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -# Copyright (C) 2016 g10 Code GmbH -# Copyright (C) 2015 Ben McGinnes -# Copyright (C) 2004 Igor Belyi -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function -del absolute_import, print_function - -from . import gpgme - -productname = 'pyme' -versionstr = "1.7.0" -gpgme_versionstr = gpgme.GPGME_VERSION -in_tree_build = bool(gpgme.cvar.pyme_in_tree_build) - -versionlist = versionstr.split(".") -major = versionlist[0] -minor = versionlist[1] -patch = versionlist[2] - -copyright = """\ -Copyright (C) 2016 g10 Code GmbH -Copyright (C) 2015 Ben McGinnes -Copyright (C) 2014-2015 Martin Albrecht -Copyright (C) 2004-2008 Igor Belyi -Copyright (C) 2002 John Goerzen""" - -author = "The GnuPG hackers" -author_email = "gnupg-devel@gnupg.org" - -description = "Python support for GPGME GnuPG cryptography library" -homepage = "https://gnupg.org" - -license = """Copyright (C) 2016 g10 Code GmbH -Copyright (C) 2015 Ben McGinnes -Copyright (C) 2014, 2015 Martin Albrecht -Copyright (C) 2004, 2008 Igor Belyi -Copyright (C) 2002 John Goerzen - -This library 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. - -This library 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 library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA""" - -# Interface hygiene. Keep this at the end. -del gpgme diff -Nru gpgme1.0-1.7.0/lang/python/pyme/version.py.in gpgme1.0-1.8.0/lang/python/pyme/version.py.in --- gpgme1.0-1.7.0/lang/python/pyme/version.py.in 2016-09-14 16:59:55.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/pyme/version.py.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -# Copyright (C) 2016 g10 Code GmbH -# Copyright (C) 2015 Ben McGinnes -# Copyright (C) 2004 Igor Belyi -# -# This library 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. -# -# This library 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 library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from __future__ import absolute_import, print_function -del absolute_import, print_function - -from . import gpgme - -productname = 'pyme' -versionstr = "@VERSION@" -gpgme_versionstr = gpgme.GPGME_VERSION -in_tree_build = bool(gpgme.cvar.pyme_in_tree_build) - -versionlist = versionstr.split(".") -major = versionlist[0] -minor = versionlist[1] -patch = versionlist[2] - -copyright = """\ -Copyright (C) 2016 g10 Code GmbH -Copyright (C) 2015 Ben McGinnes -Copyright (C) 2014-2015 Martin Albrecht -Copyright (C) 2004-2008 Igor Belyi -Copyright (C) 2002 John Goerzen""" - -author = "The GnuPG hackers" -author_email = "gnupg-devel@gnupg.org" - -description = "Python support for GPGME GnuPG cryptography library" -homepage = "https://gnupg.org" - -license = """Copyright (C) 2016 g10 Code GmbH -Copyright (C) 2015 Ben McGinnes -Copyright (C) 2014, 2015 Martin Albrecht -Copyright (C) 2004, 2008 Igor Belyi -Copyright (C) 2002 John Goerzen - -This library 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. - -This library 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 library; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA""" - -# Interface hygiene. Keep this at the end. -del gpgme diff -Nru gpgme1.0-1.7.0/lang/python/README gpgme1.0-1.8.0/lang/python/README --- gpgme1.0-1.7.0/lang/python/README 2016-09-20 14:02:51.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/README 2016-11-16 09:18:20.000000000 +0000 @@ -1,10 +1,10 @@ -PyME - GPGME for Python -*- org -*- +gpg - GPGME bindings for Python -*- org -*- ======================= -PyME is a python interface to the GPGME library: +The "gpg" module is a python interface to the GPGME library: https://www.gnupg.org/related_software/gpgme/ -PyME offers two interfaces, one is a high-level, curated, and +"gpg" offers two interfaces, one is a high-level, curated, and idiomatic interface that is implemented as a shim on top of the low-level interface automatically created using SWIG. @@ -27,20 +27,22 @@ * Authors -PyME has been created by John Goerzen, and maintained, developed, and +PyME was created by John Goerzen, and maintained, developed, and cherished by Igor Belyi, Martin Albrecht, Ben McGinnes, and everyone who contributed to it in any way. In 2016 we merged a port of PyME to into the GPGME repository, and development will continue there. Please see the VCS history for the list of contributors, and if you do find bugs, or want to contribute, -please get in touch and help maintain PyME. +please get in touch and help maintain the python gpg bindings. Please see the section 'History' further down this document for references to previous versions. * History + - The python bindings were renamed from PyME to "gpg" in 2016. + - The bindings have been merged into the GPGME repository in 2016. - The latest version of PyME for Python 3.2 and above (as of diff -Nru gpgme1.0-1.7.0/lang/python/setup.py.in gpgme1.0-1.8.0/lang/python/setup.py.in --- gpgme1.0-1.7.0/lang/python/setup.py.in 2016-09-20 08:48:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/setup.py.in 2016-11-10 08:56:39.000000000 +0000 @@ -23,11 +23,12 @@ import glob import subprocess -# Out-of-tree build of the pyme3 bindings. +# Out-of-tree build of the gpg bindings. 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 @@ 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, ) @@ -73,8 +75,8 @@ version = version.split('-')[0] major, minor, patch = map(int, version.split('.')) -if not (major > 1 or (major == 1 and minor >= 6)): - sys.exit('Need at least GPGME version 1.6, found {}.'.format(version_raw)) +if not (major > 1 or (major == 1 and minor >= 7)): + sys.exit('Need at least GPGME version 1.7, found {}.'.format(version_raw)) if not gpgme_h: gpgme_h = os.path.join(getconfig("prefix")[0], "include", "gpgme.h") @@ -86,7 +88,7 @@ glob.glob(os.path.join(gpg_error_prefix, "include", "*", "gpg-error.h"))[0] -print("Building pyme3 using {} and {}.".format(gpgme_h, gpg_error_h)) +print("Building python gpg module using {} and {}.".format(gpgme_h, gpg_error_h)) # Cleanup gpgme.h from deprecated functions and typedefs. subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h], @@ -94,7 +96,6 @@ 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') @@ -151,15 +152,15 @@ self.run_command('build_ext') build.run(self) -swige = Extension("pyme._gpgme", ["gpgme.i", "helpers.c"], +swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"], swig_opts = ['-py3', '-builtin', '-threads', - '-outdir', 'pyme'] + extra_swig_opts, + '-outdir', 'gpg'] + extra_swig_opts, include_dirs = include_dirs, define_macros = define_macros, library_dirs = library_dirs, extra_link_args = libs) -setup(name="pyme3", +setup(name="gpg", cmdclass={'build': BuildExtFirstHack}, version="@VERSION@", description='Python bindings for GPGME GnuPG cryptography library', @@ -169,8 +170,8 @@ author_email='gnupg-devel@gnupg.org', url='https://www.gnupg.org', ext_modules=[swige], - packages = ['pyme', 'pyme.constants', 'pyme.constants.data', - 'pyme.constants.keylist', 'pyme.constants.sig'], + packages = ['gpg', 'gpg.constants', 'gpg.constants.data', + 'gpg.constants.keylist', 'gpg.constants.sig'], license="LGPL2.1+ (the library), GPL2+ (tests and examples)", classifiers=[ 'Development Status :: 4 - Beta', diff -Nru gpgme1.0-1.7.0/lang/python/tests/initial.py gpgme1.0-1.8.0/lang/python/tests/initial.py --- gpgme1.0-1.7.0/lang/python/tests/initial.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/initial.py 2016-11-03 07:55:36.000000000 +0000 @@ -22,14 +22,14 @@ import os import subprocess -import pyme +import gpg import support -support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) subprocess.check_call([os.path.join(os.getenv('top_srcdir'), "tests", "start-stop-agent"), "--start"]) -with pyme.Context() as c: +with gpg.Context() as c: alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False) bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False) diff -Nru gpgme1.0-1.7.0/lang/python/tests/Makefile.am gpgme1.0-1.8.0/lang/python/tests/Makefile.am --- gpgme1.0-1.7.0/lang/python/tests/Makefile.am 2016-09-20 17:56:27.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/Makefile.am 2016-11-11 09:34:15.000000000 +0000 @@ -89,7 +89,7 @@ ./private-keys-v1.d/gpg-sample.stamp: $(private_keys) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d for k in $(private_keys); do \ cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \ done diff -Nru gpgme1.0-1.7.0/lang/python/tests/Makefile.in gpgme1.0-1.8.0/lang/python/tests/Makefile.in --- gpgme1.0-1.7.0/lang/python/tests/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -268,6 +268,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -591,7 +594,7 @@ -rm -fR -- private-keys-v1.d openpgp-revocs.d S.gpg-agent sshcontrol ./private-keys-v1.d/gpg-sample.stamp: $(private_keys) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d for k in $(private_keys); do \ cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \ done diff -Nru gpgme1.0-1.7.0/lang/python/tests/support.py gpgme1.0-1.8.0/lang/python/tests/support.py --- gpgme1.0-1.7.0/lang/python/tests/support.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/support.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,13 +20,14 @@ import sys import os -from pyme import core +import gpg # known keys 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) @@ -35,7 +36,7 @@ return os.path.join(os.environ['srcdir'], name) def init_gpgme(proto): - core.engine_check_version(proto) + gpg.core.engine_check_version(proto) verbose = int(os.environ.get('verbose', 0)) > 1 def print_data(data): @@ -65,5 +66,5 @@ else: result = None return result - with core.Data() as sink: + with gpg.Data() as sink: ctx.op_edit(key, Editor().edit, sink, sink) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-callbacks.py gpgme1.0-1.8.0/lang/python/tests/t-callbacks.py --- gpgme1.0-1.7.0/lang/python/tests/t-callbacks.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-callbacks.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,16 +21,16 @@ del absolute_import, print_function, unicode_literals import os -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) -c = core.Context() -c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) +c = gpg.Context() +c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) -source = core.Data("Hallo Leute\n") -sink = core.Data() +source = gpg.Data("Hallo Leute\n") +sink = gpg.Data() # Valid passphrases, both as string and bytes. for passphrase in ('foo', b'foo'): @@ -87,7 +87,7 @@ Key-Length: 1024 Name-Real: Joe Tester Name-Comment: with stupid passphrase -Name-Email: joe+pyme@example.org +Name-Email: joe+gpg@example.org Passphrase: Crypt0R0cks Expire-Date: 2020-12-31 @@ -100,7 +100,7 @@ "PROGRESS UPDATE: what = {}, type = {}, current = {}, total = {}" .format(what, typ, current, total)) -c = core.Context() +c = gpg.Context() c.set_progress_cb(progress_cb, messages) c.op_genkey(parms, None, None) assert len(messages) > 0 @@ -109,7 +109,7 @@ def progress_cb(what, typ, current, total, hook=None): raise myException -c = core.Context() +c = gpg.Context() c.set_progress_cb(progress_cb, None) try: c.op_genkey(parms, None, None) @@ -120,10 +120,10 @@ # Test the edit callback. -c = core.Context() -c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) +c = gpg.Context() +c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(lambda *args: "abc") -sink = core.Data() +sink = gpg.Data() alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False) cookie = object() @@ -137,10 +137,10 @@ assert edit_cb_called # Test exceptions. -c = core.Context() -c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) +c = gpg.Context() +c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(lambda *args: "abc") -sink = core.Data() +sink = gpg.Data() def edit_cb(status, args): raise myException @@ -154,8 +154,8 @@ # Test the status callback. -source = core.Data("Hallo Leute\n") -sink = core.Data() +source = gpg.Data("Hallo Leute\n") +sink = gpg.Data() status_cb_called = False def status_cb(keyword, args, hook=None): @@ -163,24 +163,24 @@ status_cb_called = True assert hook == cookie -c = core.Context() +c = gpg.Context() c.set_status_cb(status_cb, cookie) c.set_ctx_flag("full-status", "1") -c.op_encrypt([alpha], constants.ENCRYPT_ALWAYS_TRUST, source, sink) +c.op_encrypt([alpha], gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink) assert status_cb_called # Test exceptions. -source = core.Data("Hallo Leute\n") -sink = core.Data() +source = gpg.Data("Hallo Leute\n") +sink = gpg.Data() def status_cb(keyword, args): raise myException -c = core.Context() +c = gpg.Context() c.set_status_cb(status_cb, None) c.set_ctx_flag("full-status", "1") try: - c.op_encrypt([alpha], constants.ENCRYPT_ALWAYS_TRUST, source, sink) + c.op_encrypt([alpha], gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink) except Exception as e: assert e == myException else: @@ -194,7 +194,7 @@ return 0 def release_cb(hook=None): assert hook == cookie -data = core.Data(cbs=(read_cb, None, None, release_cb, cookie)) +data = gpg.Data(cbs=(read_cb, None, None, release_cb, cookie)) try: data.read() except Exception as e: @@ -204,7 +204,7 @@ def read_cb(amount): raise myException -data = core.Data(cbs=(read_cb, None, None, lambda: None)) +data = gpg.Data(cbs=(read_cb, None, None, lambda: None)) try: data.read() except Exception as e: @@ -216,7 +216,7 @@ def write_cb(what, hook=None): assert hook == cookie return "wrong type" -data = core.Data(cbs=(None, write_cb, None, release_cb, cookie)) +data = gpg.Data(cbs=(None, write_cb, None, release_cb, cookie)) try: data.write(b'stuff') except Exception as e: @@ -226,7 +226,7 @@ def write_cb(what): raise myException -data = core.Data(cbs=(None, write_cb, None, lambda: None)) +data = gpg.Data(cbs=(None, write_cb, None, lambda: None)) try: data.write(b'stuff') except Exception as e: @@ -238,7 +238,7 @@ def seek_cb(offset, whence, hook=None): assert hook == cookie return "wrong type" -data = core.Data(cbs=(None, None, seek_cb, release_cb, cookie)) +data = gpg.Data(cbs=(None, None, seek_cb, release_cb, cookie)) try: data.seek(0, os.SEEK_SET) except Exception as e: @@ -248,7 +248,7 @@ def seek_cb(offset, whence): raise myException -data = core.Data(cbs=(None, None, seek_cb, lambda: None)) +data = gpg.Data(cbs=(None, None, seek_cb, lambda: None)) try: data.seek(0, os.SEEK_SET) except Exception as e: diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-data.py gpgme1.0-1.8.0/lang/python/tests/t-data.py --- gpgme1.0-1.7.0/lang/python/tests/t-data.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-data.py 2016-11-03 07:55:36.000000000 +0000 @@ -23,9 +23,9 @@ import io import os import tempfile -from pyme import core +import gpg -data = core.Data('Hello world!') +data = gpg.Data('Hello world!') assert data.read() == b'Hello world!' assert data.read() == b'' @@ -33,29 +33,29 @@ assert data.read() == b'Hello world!' assert data.read() == b'' -data = core.Data(b'Hello world!') +data = gpg.Data(b'Hello world!') assert data.read() == b'Hello world!' -data = core.Data(b'Hello world!', copy=False) +data = gpg.Data(b'Hello world!', copy=False) assert data.read() == b'Hello world!' -data = core.Data() +data = gpg.Data() data.write('Hello world!') data.seek(0, os.SEEK_SET) assert data.read() == b'Hello world!' -data = core.Data() +data = gpg.Data() data.write(b'Hello world!') data.seek(0, os.SEEK_SET) assert data.read() == b'Hello world!' binjunk = bytes(range(256)) -data = core.Data() +data = gpg.Data() data.write(binjunk) data.seek(0, os.SEEK_SET) assert data.read() == binjunk -data = core.Data() +data = gpg.Data() data.set_file_name("foobar") assert data.get_file_name() == "foobar" @@ -66,26 +66,26 @@ tmp.seek(0) # Open using name. - data = core.Data(file=tmp.name) + data = gpg.Data(file=tmp.name) assert data.read() == binjunk # Open using name, without copying. if False: # delayed reads are not yet supported - data = core.Data(file=tmp.name, copy=False) + data = gpg.Data(file=tmp.name, copy=False) assert data.read() == binjunk # Open using stream. tmp.seek(0) - data = core.Data(file=tmp) + data = gpg.Data(file=tmp) assert data.read() == binjunk # Open using stream, offset, and length. - data = core.Data(file=tmp, offset=0, length=42) + data = gpg.Data(file=tmp, offset=0, length=42) assert data.read() == binjunk[:42] # Open using name, offset, and length. - data = core.Data(file=tmp.name, offset=23, length=42) + data = gpg.Data(file=tmp.name, offset=23, length=42) assert data.read() == binjunk[23:23+42] # Test callbacks. @@ -112,7 +112,7 @@ do = DataObject() cookie = object() -data = core.Data(cbs=(do.read, do.write, do.seek, do.release, cookie)) +data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release, cookie)) data.write('Hello world!') data.seek(0, os.SEEK_SET) assert data.read() == b'Hello world!' @@ -121,7 +121,7 @@ # Again, without the cookie. do = DataObject() -data = core.Data(cbs=(do.read, do.write, do.seek, do.release)) +data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release)) data.write('Hello world!') data.seek(0, os.SEEK_SET) assert data.read() == b'Hello world!' diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-decrypt.py gpgme1.0-1.8.0/lang/python/tests/t-decrypt.py --- gpgme1.0-1.7.0/lang/python/tests/t-decrypt.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-decrypt.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,15 +20,14 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import pyme -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() -source = core.Data(file=support.make_filename("cipher-1.asc")) -sink = core.Data() +source = gpg.Data(file=support.make_filename("cipher-1.asc")) +sink = gpg.Data() c.op_decrypt(source, sink) result = c.op_decrypt_result() @@ -38,7 +37,7 @@ support.print_data(sink) # Idiomatic interface. -with pyme.Context() as c: +with gpg.Context() as c: plaintext, _, _ = c.decrypt(open(support.make_filename("cipher-1.asc"))) assert len(plaintext) > 0 assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \ diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-decrypt-verify.py gpgme1.0-1.8.0/lang/python/tests/t-decrypt-verify.py --- gpgme1.0-1.7.0/lang/python/tests/t-decrypt-verify.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-decrypt-verify.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,8 +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, errors +import gpg import support def check_verify_result(result, summary, fpr, status): @@ -29,17 +28,17 @@ sig = result.signatures[0] assert sig.summary == summary, "Unexpected signature summary" assert sig.fpr == fpr - assert errors.GPGMEError(sig.status).getcode() == status + assert gpg.errors.GPGMEError(sig.status).getcode() == status assert len(sig.notations) == 0 assert not sig.wrong_key_usage - assert sig.validity == constants.VALIDITY_FULL - assert errors.GPGMEError(sig.validity_reason).getcode() == errors.NO_ERROR + assert sig.validity == gpg.constants.validity.FULL + assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() -source = core.Data(file=support.make_filename("cipher-2.asc")) -sink = core.Data() +source = gpg.Data(file=support.make_filename("cipher-2.asc")) +sink = gpg.Data() c.op_decrypt_verify(source, sink) result = c.op_decrypt_result() @@ -50,12 +49,12 @@ verify_result = c.op_verify_result() check_verify_result(verify_result, - constants.SIGSUM_VALID | constants.SIGSUM_GREEN, + gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, "A0FF4590BB6122EDEF6E3C542D727CC768697734", - errors.NO_ERROR) + gpg.errors.NO_ERROR) # Idiomatic interface. -with pyme.Context() as c: +with gpg.Context() as c: alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False) bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False) plaintext, _, verify_result = \ @@ -63,14 +62,14 @@ assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \ 'Plaintext not found' check_verify_result(verify_result, - constants.SIGSUM_VALID | constants.SIGSUM_GREEN, + gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, "A0FF4590BB6122EDEF6E3C542D727CC768697734", - errors.NO_ERROR) + gpg.errors.NO_ERROR) try: c.decrypt(open(support.make_filename("cipher-2.asc")), verify=[alpha, bob]) - except errors.MissingSignatures as e: + except gpg.errors.MissingSignatures as e: assert len(e.missing) == 1 assert e.missing[0] == bob else: diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-edit.py gpgme1.0-1.8.0/lang/python/tests/t-edit.py --- gpgme1.0-1.7.0/lang/python/tests/t-edit.py 2016-09-16 13:08:05.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-edit.py 2016-11-03 07:55:36.000000000 +0000 @@ -23,7 +23,7 @@ import sys import os -from pyme import core, constants +import gpg import support class KeyEditor(object): @@ -51,10 +51,10 @@ return result -support.init_gpgme(constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) -c = core.Context() -c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) +c = gpg.Context() +c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(lambda *args: "abc") c.set_armor(True) @@ -65,7 +65,7 @@ assert editor.done # The deprecated interface. -sink = core.Data() +sink = gpg.Data() editor = KeyEditor() c.op_edit(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False), editor.edit_fnc, sink, sink) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-encrypt-large.py gpgme1.0-1.8.0/lang/python/tests/t-encrypt-large.py --- gpgme1.0-1.7.0/lang/python/tests/t-encrypt-large.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-encrypt-large.py 2016-11-03 07:55:36.000000000 +0000 @@ -22,7 +22,7 @@ import sys import random -from pyme import core, constants +import gpg import support if len(sys.argv) == 2: @@ -30,8 +30,8 @@ else: nbytes = 100000 -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() ntoread = nbytes def read_cb(amount): @@ -48,14 +48,14 @@ nwritten += len(data) return len(data) -source = core.Data(cbs=(read_cb, None, None, lambda: None)) -sink = core.Data(cbs=(None, write_cb, None, lambda: None)) +source = gpg.Data(cbs=(read_cb, None, None, lambda: None)) +sink = gpg.Data(cbs=(None, write_cb, None, lambda: None)) keys = [] keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)) keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)) -c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink) +c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink) result = c.op_encrypt_result() assert not result.invalid_recipients, \ "Invalid recipient encountered: {}".format(result.invalid_recipients.fpr) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-encrypt.py gpgme1.0-1.8.0/lang/python/tests/t-encrypt.py --- gpgme1.0-1.7.0/lang/python/tests/t-encrypt.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-encrypt.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,29 +20,28 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import pyme -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_armor(True) -source = core.Data("Hallo Leute\n") -sink = core.Data() +source = gpg.Data("Hallo Leute\n") +sink = gpg.Data() keys = [] keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)) keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)) -c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink) +c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink) result = c.op_encrypt_result() assert not result.invalid_recipients, \ "Invalid recipients: {}".format(", ".join(r.fpr for r in result.recipients)) support.print_data(sink) # Idiomatic interface. -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c: ciphertext, _, _ = c.encrypt("Hallo Leute\n".encode(), recipients=keys, sign=False, @@ -58,7 +57,7 @@ c.encrypt("Hallo Leute\n".encode(), recipients=[c.get_key(support.sign_only, False)], sign=False, always_trust=True) - except pyme.errors.InvalidRecipients as e: + except gpg.errors.InvalidRecipients as e: assert len(e.recipients) == 1 assert support.sign_only.endswith(e.recipients[0].fpr) else: diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-encrypt-sign.py gpgme1.0-1.8.0/lang/python/tests/t-encrypt-sign.py --- gpgme1.0-1.7.0/lang/python/tests/t-encrypt-sign.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-encrypt-sign.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,12 +21,11 @@ del absolute_import, print_function, unicode_literals import sys -import pyme -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_armor(True) def check_result(r, typ): @@ -40,11 +39,11 @@ if signature.type != typ: sys.exit("Wrong type of signature created") - if signature.pubkey_algo != constants.PK_DSA: + if signature.pubkey_algo != gpg.constants.pk.DSA: sys.exit("Wrong pubkey algorithm reported: {}".format( signature.pubkey_algo)) - if signature.hash_algo not in (constants.MD_SHA1, constants.MD_RMD160): + if signature.hash_algo not in (gpg.constants.md.SHA1, gpg.constants.md.RMD160): sys.exit("Wrong hash algorithm reported: {}".format( signature.hash_algo)) @@ -60,30 +59,30 @@ keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)) for recipients in (keys, []): - source = core.Data("Hallo Leute\n") - sink = core.Data() + source = gpg.Data("Hallo Leute\n") + sink = gpg.Data() - c.op_encrypt_sign(recipients, constants.ENCRYPT_ALWAYS_TRUST, source, sink) + c.op_encrypt_sign(recipients, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink) result = c.op_encrypt_result() assert not result.invalid_recipients, \ "Invalid recipient encountered: {}".format( result.invalid_recipients.fpr) result = c.op_sign_result() - check_result(result, constants.SIG_MODE_NORMAL) + check_result(result, gpg.constants.sig.mode.NORMAL) support.print_data(sink) # Idiomatic interface. -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c: message = "Hallo Leute\n".encode() ciphertext, _, sig_result = c.encrypt(message, recipients=keys, always_trust=True) assert len(ciphertext) > 0 assert ciphertext.find(b'BEGIN PGP MESSAGE') > 0, 'Marker not found' - check_result(sig_result, constants.SIG_MODE_NORMAL) + check_result(sig_result, gpg.constants.sig.mode.NORMAL) c.signers = [c.get_key(support.sign_only, True)] c.encrypt(message, recipients=keys, always_trust=True) @@ -91,7 +90,7 @@ c.signers = [c.get_key(support.encrypt_only, True)] try: c.encrypt(message, recipients=keys, always_trust=True) - except pyme.errors.InvalidSigners as e: + except gpg.errors.InvalidSigners as e: assert len(e.signers) == 1 assert support.encrypt_only.endswith(e.signers[0].fpr) else: diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-encrypt-sym.py gpgme1.0-1.8.0/lang/python/tests/t-encrypt-sym.py --- gpgme1.0-1.7.0/lang/python/tests/t-encrypt-sym.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-encrypt-sym.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,19 +21,18 @@ del absolute_import, print_function, unicode_literals import os -import pyme -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) for passphrase in ("abc", b"abc"): - c = core.Context() + c = gpg.Context() c.set_armor(True) - c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) + c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) - source = core.Data("Hallo Leute\n") - cipher = core.Data() + source = gpg.Data("Hallo Leute\n") + cipher = gpg.Data() passphrase_cb_called = 0 def passphrase_cb(hint, desc, prev_bad, hook=None): @@ -48,11 +47,11 @@ "Callback called {} times".format(passphrase_cb_called) support.print_data(cipher) - c = core.Context() + c = gpg.Context() c.set_armor(True) - c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK) + c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_passphrase_cb(passphrase_cb, None) - plain = core.Data() + plain = gpg.Data() cipher.seek(0, os.SEEK_SET) c.op_decrypt(cipher, plain) @@ -68,7 +67,7 @@ # Idiomatic interface. for passphrase in ("abc", b"abc"): - with pyme.Context(armor=True) as c: + with gpg.Context(armor=True) as c: # Check that the passphrase callback is not altered. def f(*args): assert False diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-export.py gpgme1.0-1.8.0/lang/python/tests/t-export.py --- gpgme1.0-1.7.0/lang/python/tests/t-export.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-export.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,14 +20,14 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_armor(True) -sink = core.Data() +sink = gpg.Data() c.op_export_ext(['Alpha', 'Bob'], 0, sink) support.print_data(sink) @@ -35,6 +35,6 @@ keys = [] keys.append(c.get_key("0x68697734", False)) # Alpha keys.append(c.get_key("0xA9E3B0B2", False)) # Bob -sink = core.Data() +sink = gpg.Data() c.op_export_keys(keys, 0, sink) support.print_data(sink) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-file-name.py gpgme1.0-1.8.0/lang/python/tests/t-file-name.py --- gpgme1.0-1.7.0/lang/python/tests/t-file-name.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-file-name.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,24 +21,24 @@ del absolute_import, print_function, unicode_literals import os -from pyme import core, constants +import gpg import support testname = "abcde12345" -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_armor(True) -source = core.Data("Hallo Leute\n") +source = gpg.Data("Hallo Leute\n") source.set_file_name(testname) -cipher = core.Data() -plain = core.Data() +cipher = gpg.Data() +plain = gpg.Data() keys = [] keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)) -c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, cipher) +c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, cipher) cipher.seek(0, os.SEEK_SET) c.op_decrypt(cipher, plain) result = c.op_decrypt_result() diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-idiomatic.py gpgme1.0-1.8.0/lang/python/tests/t-idiomatic.py --- gpgme1.0-1.7.0/lang/python/tests/t-idiomatic.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-idiomatic.py 2016-11-03 07:55:36.000000000 +0000 @@ -24,13 +24,13 @@ import io import os import tempfile -import pyme +import gpg import support -support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) # Both Context and Data can be used as context manager: -with pyme.Context() as c, pyme.Data() as d: +with gpg.Context() as c, gpg.Data() as d: c.get_engine_info() d.write(b"Halloechen") leak_c = c @@ -39,17 +39,17 @@ assert leak_d.wrapped == None def sign_and_verify(source, signed, sink): - with pyme.Context() as c: - c.op_sign(source, signed, pyme.constants.SIG_MODE_NORMAL) + with gpg.Context() as c: + c.op_sign(source, signed, gpg.constants.sig.mode.NORMAL) signed.seek(0, os.SEEK_SET) c.op_verify(signed, None, sink) result = c.op_verify_result() assert len(result.signatures) == 1, "Unexpected number of signatures" sig = result.signatures[0] - assert sig.summary == (pyme.constants.SIGSUM_VALID | - pyme.constants.SIGSUM_GREEN) - assert pyme.errors.GPGMEError(sig.status).getcode() == pyme.errors.NO_ERROR + assert sig.summary == (gpg.constants.sigsum.VALID | + gpg.constants.sigsum.GREEN) + assert gpg.errors.GPGMEError(sig.status).getcode() == gpg.errors.NO_ERROR sink.seek(0, os.SEEK_SET) assert sink.read() == b"Hallo Leute\n" @@ -80,5 +80,5 @@ # Demonstrate automatic wrapping of objects implementing the buffer # interface, and the use of data objects with the 'with' statement. - with io.BytesIO(preallocate) as signed, pyme.Data() as sink: + with io.BytesIO(preallocate) as signed, gpg.Data() as sink: sign_and_verify(b"Hallo Leute\n", signed, sink) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-import.py gpgme1.0-1.8.0/lang/python/tests/t-import.py --- gpgme1.0-1.7.0/lang/python/tests/t-import.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-import.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,7 +20,7 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -from pyme import core, constants +import gpg import support def check_result(result, fpr, secret): @@ -67,13 +67,13 @@ assert len(result.imports) == 1 or fpr == result.imports[1].fpr assert result.imports[0].result == 0 -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() -c.op_import(core.Data(file=support.make_filename("pubkey-1.asc"))) +c.op_import(gpg.Data(file=support.make_filename("pubkey-1.asc"))) result = c.op_import_result() check_result(result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", False) -c.op_import(core.Data(file=support.make_filename("seckey-1.asc"))) +c.op_import(gpg.Data(file=support.make_filename("seckey-1.asc"))) result = c.op_import_result() check_result(result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", True) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-keylist.py gpgme1.0-1.8.0/lang/python/tests/t-keylist.py --- gpgme1.0-1.7.0/lang/python/tests/t-keylist.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-keylist.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,11 +20,11 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() # Check expration of keys. This test assumes three subkeys of which # 2 are expired; it is used with the "Whisky" test key. It has @@ -108,7 +108,7 @@ assert key.can_sign, "Key unexpectedly unusable for signing" assert key.can_certify, "Key unexpectedly unusable for certifications" assert not key.secret, "Key unexpectedly secret" - assert not key.protocol != constants.PROTOCOL_OpenPGP, \ + assert not key.protocol != gpg.constants.protocol.OpenPGP, \ "Key has unexpected protocol: {}".format(key.protocol) assert not key.issuer_serial, \ "Key unexpectedly carries issuer serial: {}".format(key.issuer_serial) @@ -119,10 +119,10 @@ # Only key Alfa is trusted assert key.uids[0].name == 'Alfa Test' \ - or key.owner_trust == constants.VALIDITY_UNKNOWN, \ + or key.owner_trust == gpg.constants.validity.UNKNOWN, \ "Key has unexpected owner trust: {}".format(key.owner_trust) assert key.uids[0].name != 'Alfa Test' \ - or key.owner_trust == constants.VALIDITY_ULTIMATE, \ + or key.owner_trust == gpg.constants.validity.ULTIMATE, \ "Key has unexpected owner trust: {}".format(key.owner_trust) assert len(key.subkeys) - 1 == n_subkeys, \ @@ -153,8 +153,8 @@ assert not subkey.secret, which + " key unexpectedly secret" assert not subkey.is_cardkey, "Public key marked as card key" assert not subkey.card_number, "Public key with card number set" - assert not subkey.pubkey_algo != (constants.PK_DSA if which == "Primary" - else constants.PK_ELG_E), \ + assert not subkey.pubkey_algo != (gpg.constants.pk.DSA if which == "Primary" + else gpg.constants.pk.ELG_E), \ which + " key has unexpected public key algo: {}".\ format(subkey.pubkey_algo) assert subkey.length == 1024, \ @@ -169,10 +169,10 @@ def check_uid(which, ref, uid): assert not uid.revoked, which + " user ID unexpectedly revoked" assert not uid.invalid, which + " user ID unexpectedly invalid" - assert uid.validity == (constants.VALIDITY_UNKNOWN + assert uid.validity == (gpg.constants.validity.UNKNOWN if uid.name.split()[0] not in {'Alfa', 'Alpha', 'Alice'} else - constants.VALIDITY_ULTIMATE), \ + gpg.constants.validity.ULTIMATE), \ which + " user ID has unexpectedly validity: {}".format(uid.validity) assert not uid.signatures, which + " user ID unexpectedly signed" assert uid.name == ref[0], \ @@ -244,3 +244,25 @@ if misc_check: misc_check (uids[0][0], key) + + +# check get_key() +with gpg.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 gpg.errors.GPGMEError: + pass + else: + assert False, "Expected GPGMEError" diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-protocol-assuan.py gpgme1.0-1.8.0/lang/python/tests/t-protocol-assuan.py --- gpgme1.0-1.7.0/lang/python/tests/t-protocol-assuan.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-protocol-assuan.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,17 +20,17 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import pyme +import gpg -with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c: +with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: # Do nothing. c.assuan_transact('nop') c.assuan_transact('NOP') c.assuan_transact(['NOP']) err = c.assuan_transact('idontexist') - assert err.getsource() == pyme.errors.SOURCE_GPGAGENT - assert err.getcode() == pyme.errors.ASS_UNKNOWN_CMD + assert err.getsource() == gpg.errors.SOURCE_GPGAGENT + assert err.getcode() == gpg.errors.ASS_UNKNOWN_CMD # Invoke the pinentry to get a confirmation. c.assuan_transact(['GET_CONFIRMATION', 'Hello there']) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-signers.py gpgme1.0-1.8.0/lang/python/tests/t-signers.py --- gpgme1.0-1.7.0/lang/python/tests/t-signers.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-signers.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,8 +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 gpg import support def fail(msg): @@ -38,11 +37,11 @@ if signature.type != typ: fail("Wrong type of signature created") - if signature.pubkey_algo != constants.PK_DSA: + if signature.pubkey_algo != gpg.constants.pk.DSA: fail("Wrong pubkey algorithm reported: {}".format( signature.pubkey_algo)) - if signature.hash_algo != constants.MD_SHA1: + if signature.hash_algo != gpg.constants.md.SHA1: fail("Wrong hash algorithm reported: {}".format( signature.hash_algo)) @@ -55,8 +54,8 @@ fail("Wrong fingerprint reported: {}".format(signature.fpr)) -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_textmode(True) c.set_armor(True) @@ -69,10 +68,10 @@ c.signers_add(keys[0]) c.signers_add(keys[1]) -for mode in (constants.SIG_MODE_NORMAL, constants.SIG_MODE_DETACH, - constants.SIG_MODE_CLEAR): - source = core.Data("Hallo Leute\n") - sink = core.Data() +for mode in (gpg.constants.sig.mode.NORMAL, gpg.constants.sig.mode.DETACH, + gpg.constants.sig.mode.CLEAR): + source = gpg.Data("Hallo Leute\n") + sink = gpg.Data() c.op_sign(source, sink, mode) @@ -81,18 +80,18 @@ support.print_data(sink) # Idiomatic interface. -with pyme.Context(armor=True, textmode=True, signers=keys) as c: +with gpg.Context(armor=True, textmode=True, signers=keys) as c: message = "Hallo Leute\n".encode() signed, result = c.sign(message) - check_result(result, constants.SIG_MODE_NORMAL) + check_result(result, gpg.constants.sig.mode.NORMAL) assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found' - signed, result = c.sign(message, mode=constants.SIG_MODE_DETACH) - check_result(result, constants.SIG_MODE_DETACH) + signed, result = c.sign(message, mode=gpg.constants.sig.mode.DETACH) + check_result(result, gpg.constants.sig.mode.DETACH) assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found' - signed, result = c.sign(message, mode=constants.SIG_MODE_CLEAR) - check_result(result, constants.SIG_MODE_CLEAR) + signed, result = c.sign(message, mode=gpg.constants.sig.mode.CLEAR) + check_result(result, gpg.constants.sig.mode.CLEAR) assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found' assert signed.find(message) > 0, 'Message content not found' assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found' diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-sig-notation.py gpgme1.0-1.8.0/lang/python/tests/t-sig-notation.py --- gpgme1.0-1.7.0/lang/python/tests/t-sig-notation.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-sig-notation.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,21 +21,22 @@ del absolute_import, print_function, unicode_literals import os -from pyme import core, constants +import gpg import support expected_notations = { - "laughing@me": ("Just Squeeze Me", constants.SIG_NOTATION_HUMAN_READABLE), + "laughing@me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE), "preferred-email-encoding@pgp.com": ("pgpmime", - constants.SIG_NOTATION_HUMAN_READABLE - | constants.SIG_NOTATION_CRITICAL), + gpg.constants.sig.notation.HUMAN_READABLE + | gpg.constants.sig.notation.CRITICAL), None: ("http://www.gnu.org/policy/", 0), } # GnuPG prior to 2.1.13 did not report the critical flag correctly. -with core.Context() as c: +with gpg.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')) @@ -54,26 +55,26 @@ assert r.value == value, \ "Expected {!r}, got {!r}".format(value, r.value) assert r.human_readable \ - == bool(flags&constants.SIG_NOTATION_HUMAN_READABLE) + == bool(flags & gpg.constants.sig.notation.HUMAN_READABLE) assert r.critical \ - == (bool(flags&constants.SIG_NOTATION_CRITICAL) + == (bool(flags & gpg.constants.sig.notation.CRITICAL) if have_correct_sig_data else False) assert len(expected_notations) == 0 -support.init_gpgme(constants.PROTOCOL_OpenPGP) +support.init_gpgme(gpg.constants.protocol.OpenPGP) -source = core.Data("Hallo Leute\n") -signed = core.Data() +source = gpg.Data("Hallo Leute\n") +signed = gpg.Data() -c = core.Context() +c = gpg.Context() for name, (value, flags) in expected_notations.items(): c.sig_notation_add(name, value, flags) -c.op_sign(source, signed, constants.SIG_MODE_NORMAL) +c.op_sign(source, signed, gpg.constants.sig.mode.NORMAL) signed.seek(0, os.SEEK_SET) -sink = core.Data() +sink = gpg.Data() c.op_verify(signed, None, sink) result = c.op_verify_result() check_result(result) diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-sign.py gpgme1.0-1.8.0/lang/python/tests/t-sign.py --- gpgme1.0-1.7.0/lang/python/tests/t-sign.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-sign.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,8 +21,7 @@ del absolute_import, print_function, unicode_literals import os -import pyme -from pyme import core, constants +import gpg import support def fail(msg): @@ -39,11 +38,11 @@ if signature.type != typ: fail("Wrong type of signature created") - if signature.pubkey_algo != constants.PK_DSA: + if signature.pubkey_algo != gpg.constants.pk.DSA: fail("Wrong pubkey algorithm reported: {}".format( signature.pubkey_algo)) - if signature.hash_algo != constants.MD_SHA1: + if signature.hash_algo != gpg.constants.md.SHA1: fail("Wrong hash algorithm reported: {}".format( signature.hash_algo)) @@ -55,58 +54,58 @@ fail("Wrong fingerprint reported: {}".format(signature.fpr)) -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_textmode(True) c.set_armor(True) -source = core.Data("Hallo Leute\n") -sink = core.Data() +source = gpg.Data("Hallo Leute\n") +sink = gpg.Data() -c.op_sign(source, sink, constants.SIG_MODE_NORMAL) +c.op_sign(source, sink, gpg.constants.sig.mode.NORMAL) result = c.op_sign_result() -check_result(result, constants.SIG_MODE_NORMAL) +check_result(result, gpg.constants.sig.mode.NORMAL) support.print_data(sink) # Now a detached signature. source.seek(0, os.SEEK_SET) -sink = core.Data() +sink = gpg.Data() -c.op_sign(source, sink, constants.SIG_MODE_DETACH) +c.op_sign(source, sink, gpg.constants.sig.mode.DETACH) result = c.op_sign_result() -check_result(result, constants.SIG_MODE_DETACH) +check_result(result, gpg.constants.sig.mode.DETACH) support.print_data(sink) # And finally a cleartext signature. */ source.seek(0, os.SEEK_SET) -sink = core.Data() +sink = gpg.Data() -c.op_sign(source, sink, constants.SIG_MODE_CLEAR) +c.op_sign(source, sink, gpg.constants.sig.mode.CLEAR) result = c.op_sign_result() -check_result(result, constants.SIG_MODE_CLEAR) +check_result(result, gpg.constants.sig.mode.CLEAR) support.print_data(sink) # Idiomatic interface. -with pyme.Context(armor=True, textmode=True) as c: +with gpg.Context(armor=True, textmode=True) as c: message = "Hallo Leute\n".encode() signed, _ = c.sign(message) assert len(signed) > 0 assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found' - signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_DETACH) + signed, _ = c.sign(message, mode=gpg.constants.sig.mode.DETACH) assert len(signed) > 0 assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found' - signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_CLEAR) + signed, _ = c.sign(message, mode=gpg.constants.sig.mode.CLEAR) assert len(signed) > 0 assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found' assert signed.find(message) > 0, 'Message content not found' assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found' -with pyme.Context() as c: +with gpg.Context() as c: message = "Hallo Leute\n".encode() c.signers = [c.get_key(support.sign_only, True)] @@ -115,7 +114,7 @@ c.signers = [c.get_key(support.encrypt_only, True)] try: c.sign(message) - except pyme.errors.InvalidSigners as e: + except gpg.errors.InvalidSigners as e: assert len(e.signers) == 1 assert support.encrypt_only.endswith(e.signers[0].fpr) else: diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-trustlist.py gpgme1.0-1.8.0/lang/python/tests/t-trustlist.py --- gpgme1.0-1.7.0/lang/python/tests/t-trustlist.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-trustlist.py 2016-11-03 07:55:36.000000000 +0000 @@ -20,11 +20,11 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -from pyme import core, constants +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() def dump_item(item): print("l={} k={} t={} o={} v={} u={}".format( diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-verify.py gpgme1.0-1.8.0/lang/python/tests/t-verify.py --- gpgme1.0-1.7.0/lang/python/tests/t-verify.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-verify.py 2016-11-03 07:55:36.000000000 +0000 @@ -22,8 +22,7 @@ import sys import os -import pyme -from pyme import core, constants, errors +import gpg import support test_text1 = b"Just GNU it!\n" @@ -67,7 +66,7 @@ "Unexpected signature summary: {}, want: {}".format(sig.summary, summary) assert sig.fpr == fpr - assert errors.GPGMEError(sig.status).getcode() == status + assert gpg.errors.GPGMEError(sig.status).getcode() == status if notation: expected_notations = { @@ -96,87 +95,87 @@ assert sig.validity == validity, \ "Unexpected signature validity: {}, want: {}".format( sig.validity, validity) - assert errors.GPGMEError(sig.validity_reason).getcode() == errors.NO_ERROR + assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_armor(True) # Checking a valid message. -text = core.Data(test_text1) -sig = core.Data(test_sig1) +text = gpg.Data(test_text1) +sig = gpg.Data(test_sig1) c.op_verify(sig, text, None) result = c.op_verify_result() -check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN, - constants.VALIDITY_FULL, +check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + gpg.constants.validity.FULL, "A0FF4590BB6122EDEF6E3C542D727CC768697734", - errors.NO_ERROR, True) + gpg.errors.NO_ERROR, True) # Checking a manipulated message. -text = core.Data(test_text1f) +text = gpg.Data(test_text1f) sig.seek(0, os.SEEK_SET) c.op_verify(sig, text, None) result = c.op_verify_result() -check_result(result, constants.SIGSUM_RED, constants.VALIDITY_UNKNOWN, - "2D727CC768697734", errors.BAD_SIGNATURE, False) +check_result(result, gpg.constants.sigsum.RED, gpg.constants.validity.UNKNOWN, + "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False) # Checking a normal signature. -text = core.Data() -sig = core.Data(test_sig2) +text = gpg.Data() +sig = gpg.Data(test_sig2) c.op_verify(sig, None, text) result = c.op_verify_result() -check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN, - constants.VALIDITY_FULL, +check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + gpg.constants.validity.FULL, "A0FF4590BB6122EDEF6E3C542D727CC768697734", - errors.NO_ERROR, False) + gpg.errors.NO_ERROR, False) # Checking an invalid message. -text = core.Data() -sig = core.Data(double_plaintext_sig) +text = gpg.Data() +sig = gpg.Data(double_plaintext_sig) try: c.op_verify(sig, None, text) except Exception as e: - assert type(e) == errors.GPGMEError - assert e.getcode() == errors.BAD_DATA + assert type(e) == gpg.errors.GPGMEError + assert e.getcode() == gpg.errors.BAD_DATA else: assert False, "Expected an error but got none." # Idiomatic interface. -with pyme.Context(armor=True) as c: +with gpg.Context(armor=True) as c: # Checking a valid message. _, result = c.verify(test_text1, test_sig1) - check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN, - constants.VALIDITY_FULL, + check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + gpg.constants.validity.FULL, "A0FF4590BB6122EDEF6E3C542D727CC768697734", - errors.NO_ERROR, True) + gpg.errors.NO_ERROR, True) # Checking a manipulated message. try: c.verify(test_text1f, test_sig1) - except errors.BadSignatures as e: - check_result(e.result, constants.SIGSUM_RED, - constants.VALIDITY_UNKNOWN, - "2D727CC768697734", errors.BAD_SIGNATURE, False) + except gpg.errors.BadSignatures as e: + check_result(e.result, gpg.constants.sigsum.RED, + gpg.constants.validity.UNKNOWN, + "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False) else: assert False, "Expected an error but got none." # Checking a normal signature. - sig = core.Data(test_sig2) + sig = gpg.Data(test_sig2) data, result = c.verify(test_sig2) - check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN, - constants.VALIDITY_FULL, + check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN, + gpg.constants.validity.FULL, "A0FF4590BB6122EDEF6E3C542D727CC768697734", - errors.NO_ERROR, False) + gpg.errors.NO_ERROR, False) assert data == test_text1 # Checking an invalid message. try: c.verify(double_plaintext_sig) - except errors.GPGMEError as e: - assert e.getcode() == errors.BAD_DATA + except gpg.errors.GPGMEError as e: + assert e.getcode() == gpg.errors.BAD_DATA else: assert False, "Expected an error but got none." @@ -188,7 +187,7 @@ try: c.verify(test_text1, test_sig1, verify=[alpha, bob]) - except errors.MissingSignatures as e: + except gpg.errors.MissingSignatures as e: assert len(e.missing) == 1 assert e.missing[0] == bob else: diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-wait.py gpgme1.0-1.8.0/lang/python/tests/t-wait.py --- gpgme1.0-1.7.0/lang/python/tests/t-wait.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-wait.py 2016-11-03 07:55:36.000000000 +0000 @@ -21,16 +21,16 @@ del absolute_import, print_function, unicode_literals import time -from pyme import core, constants, errors +import gpg import support -support.init_gpgme(constants.PROTOCOL_OpenPGP) -c = core.Context() +support.init_gpgme(gpg.constants.protocol.OpenPGP) +c = gpg.Context() c.set_armor(True) # Checking a message without a signature. -sig = core.Data("foo\n") -text = core.Data() +sig = gpg.Data("foo\n") +text = gpg.Data() c.op_verify_start(sig, None, text) try: @@ -40,6 +40,6 @@ break time.sleep(0.1) except Exception as e: - assert e.getcode() == errors.NO_DATA + assert e.getcode() == gpg.errors.NO_DATA else: assert False, "Expected an error, got none" diff -Nru gpgme1.0-1.7.0/lang/python/tests/t-wrapper.py gpgme1.0-1.8.0/lang/python/tests/t-wrapper.py --- gpgme1.0-1.7.0/lang/python/tests/t-wrapper.py 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/python/tests/t-wrapper.py 2016-11-03 07:55:36.000000000 +0000 @@ -17,9 +17,9 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, see . -from pyme import core +import gpg -d0 = core.Data() +d0 = gpg.Data() d0.seek # trigger on-demand-wrapping assert d0.seek == d0.seek, "Generated wrapper functions are not cached" -assert hasattr(core.Data, 'seek'), "Generated wrapper functions are not shared" +assert hasattr(gpg.Data, 'seek'), "Generated wrapper functions are not shared" diff -Nru gpgme1.0-1.7.0/lang/qt/doc/Makefile.in gpgme1.0-1.8.0/lang/qt/doc/Makefile.in --- gpgme1.0-1.7.0/lang/qt/doc/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/doc/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -268,6 +268,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/lang/qt/Makefile.in gpgme1.0-1.8.0/lang/qt/Makefile.in --- gpgme1.0-1.7.0/lang/qt/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -330,6 +330,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/lang/qt/src/AbstractImportJob gpgme1.0-1.8.0/lang/qt/src/AbstractImportJob --- gpgme1.0-1.7.0/lang/qt/src/AbstractImportJob 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/AbstractImportJob 2016-11-16 09:18:52.000000000 +0000 @@ -0,0 +1 @@ +#include "qgpgme/abstractimportjob.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/dataprovider.cpp gpgme1.0-1.8.0/lang/qt/src/dataprovider.cpp --- gpgme1.0-1.7.0/lang/qt/src/dataprovider.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/dataprovider.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 #include diff -Nru gpgme1.0-1.7.0/lang/qt/src/defaultkeygenerationjob.cpp gpgme1.0-1.8.0/lang/qt/src/defaultkeygenerationjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/defaultkeygenerationjob.cpp 2016-08-21 12:29:55.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/defaultkeygenerationjob.cpp 2016-11-03 07:55:36.000000000 +0000 @@ -28,6 +28,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "defaultkeygenerationjob.h" #include "protocol.h" #include "keygenerationjob.h" @@ -101,11 +105,11 @@ d->job = openpgp()->keyGenerationJob(); d->job->installEventFilter(this); - connect(d->job, &KeyGenerationJob::result, + connect(d->job.data(), &KeyGenerationJob::result, this, &DefaultKeyGenerationJob::result); - connect(d->job, &KeyGenerationJob::done, + connect(d->job.data(), &KeyGenerationJob::done, this, &DefaultKeyGenerationJob::done); - connect(d->job, &KeyGenerationJob::done, + connect(d->job.data(), &KeyGenerationJob::done, this, &QObject::deleteLater); return d->job->start(args); } diff -Nru gpgme1.0-1.7.0/lang/qt/src/DN gpgme1.0-1.8.0/lang/qt/src/DN --- gpgme1.0-1.7.0/lang/qt/src/DN 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/DN 2016-11-16 09:18:52.000000000 +0000 @@ -0,0 +1 @@ +#include "qgpgme/dn.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/dn.cpp gpgme1.0-1.8.0/lang/qt/src/dn.cpp --- gpgme1.0-1.7.0/lang/qt/src/dn.cpp 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/dn.cpp 2016-11-03 07:55:36.000000000 +0000 @@ -0,0 +1,495 @@ +/* + dn.cpp + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2004 Klarälvdalens Datakonsult AB + 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 "dn.h" + +static const struct { + const char *name; + const char *oid; +} oidmap[] = { + // keep them ordered by oid: + { "SP", "ST" }, // hack to show the Sphinx-required/desired SP for + // StateOrProvince, otherwise known as ST or even S + { "NameDistinguisher", "0.2.262.1.10.7.20" }, + { "EMAIL", "1.2.840.113549.1.9.1" }, + { "SN", "2.5.4.4" }, + { "SerialNumber", "2.5.4.5" }, + { "T", "2.5.4.12" }, + { "D", "2.5.4.13" }, + { "BC", "2.5.4.15" }, + { "ADDR", "2.5.4.16" }, + { "PC", "2.5.4.17" }, + { "GN", "2.5.4.42" }, + { "Pseudo", "2.5.4.65" }, +}; +static const unsigned int numOidMaps = sizeof oidmap / sizeof * oidmap; + +class QGpgME::DN::Private +{ +public: + Private() : mRefCount(0) {} + Private(const Private &other) + : attributes(other.attributes), + reorderedAttributes(other.reorderedAttributes), + order{"CN", "L", "_X_", "OU", "O", "C"}, + mRefCount(0) + { + } + + int ref() + { + return ++mRefCount; + } + + int unref() + { + if (--mRefCount <= 0) { + delete this; + return 0; + } else { + return mRefCount; + } + } + + int refCount() const + { + return mRefCount; + } + + DN::Attribute::List attributes; + DN::Attribute::List reorderedAttributes; + QStringList order; +private: + int mRefCount; +}; + +namespace +{ +struct DnPair { + char *key; + char *value; +}; +} + +// copied from CryptPlug and adapted to work on DN::Attribute::List: + +#define digitp(p) (*(p) >= '0' && *(p) <= '9') +#define hexdigitp(a) (digitp (a) \ + || (*(a) >= 'A' && *(a) <= 'F') \ + || (*(a) >= 'a' && *(a) <= 'f')) +#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \ + *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10)) +#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1)) + +static char * +trim_trailing_spaces(char *string) +{ + char *p, *mark; + + for (mark = NULL, p = string; *p; p++) { + if (isspace(*p)) { + if (!mark) { + mark = p; + } + } else { + mark = NULL; + } + } + if (mark) { + *mark = '\0'; + } + + return string; +} + +/* Parse a DN and return an array-ized one. This is not a validating + parser and it does not support any old-stylish syntax; gpgme is + expected to return only rfc2253 compatible strings. */ +static const unsigned char * +parse_dn_part(DnPair *array, const unsigned char *string) +{ + const unsigned char *s, *s1; + size_t n; + char *p; + + /* parse attributeType */ + for (s = string + 1; *s && *s != '='; s++) + ; + if (!*s) { + return NULL; /* error */ + } + n = s - string; + if (!n) { + return NULL; /* empty key */ + } + p = (char *)malloc(n + 1); + + memcpy(p, string, n); + p[n] = 0; + trim_trailing_spaces((char *)p); + // map OIDs to their names: + for (unsigned int i = 0; i < numOidMaps; ++i) + if (!strcasecmp((char *)p, oidmap[i].oid)) { + free(p); + p = strdup(oidmap[i].name); + break; + } + array->key = p; + string = s + 1; + + if (*string == '#') { + /* hexstring */ + string++; + for (s = string; hexdigitp(s); s++) { + s++; + } + n = s - string; + if (!n || (n & 1)) { + return NULL; /* empty or odd number of digits */ + } + n /= 2; + array->value = p = (char *)malloc(n + 1); + + for (s1 = string; n; s1 += 2, n--) { + *p++ = xtoi_2(s1); + } + *p = 0; + } else { + /* regular v3 quoted string */ + for (n = 0, s = string; *s; s++) { + if (*s == '\\') { + /* pair */ + s++; + if (*s == ',' || *s == '=' || *s == '+' + || *s == '<' || *s == '>' || *s == '#' || *s == ';' + || *s == '\\' || *s == '\"' || *s == ' ') { + n++; + } else if (hexdigitp(s) && hexdigitp(s + 1)) { + s++; + n++; + } else { + return NULL; /* invalid escape sequence */ + } + } else if (*s == '\"') { + return NULL; /* invalid encoding */ + } else if (*s == ',' || *s == '=' || *s == '+' + || *s == '<' || *s == '>' || *s == '#' || *s == ';') { + break; + } else { + n++; + } + } + + array->value = p = (char *)malloc(n + 1); + + for (s = string; n; s++, n--) { + if (*s == '\\') { + s++; + if (hexdigitp(s)) { + *p++ = xtoi_2(s); + s++; + } else { + *p++ = *s; + } + } else { + *p++ = *s; + } + } + *p = 0; + } + return s; +} + +/* Parse a DN and return an array-ized one. This is not a validating + parser and it does not support any old-stylish syntax; gpgme is + expected to return only rfc2253 compatible strings. */ +static QGpgME::DN::Attribute::List +parse_dn(const unsigned char *string) +{ + if (!string) { + return QVector(); + } + + QVector result; + while (*string) { + while (*string == ' ') { + string++; + } + if (!*string) { + break; /* ready */ + } + + DnPair pair = { 0, 0 }; + string = parse_dn_part(&pair, string); + if (!string) { + goto failure; + } + if (pair.key && pair.value) + result.push_back(QGpgME::DN::Attribute(QString::fromUtf8(pair.key), + QString::fromUtf8(pair.value))); + free(pair.key); + free(pair.value); + + while (*string == ' ') { + string++; + } + if (*string && *string != ',' && *string != ';' && *string != '+') { + goto failure; /* invalid delimiter */ + } + if (*string) { + string++; + } + } + return result; + +failure: + return QVector(); +} + +static QVector +parse_dn(const QString &dn) +{ + return parse_dn((const unsigned char *)dn.toUtf8().data()); +} + +static QString dn_escape(const QString &s) +{ + QString result; + for (unsigned int i = 0, end = s.length(); i != end; ++i) { + const QChar ch = s[i]; + switch (ch.unicode()) { + case ',': + case '+': + case '"': + case '\\': + case '<': + case '>': + case ';': + result += QLatin1Char('\\'); + // fall through + default: + result += ch; + } + } + return result; +} + +static QString +serialise(const QVector &dn, const QString &sep) +{ + QStringList result; + for (QVector::const_iterator it = dn.begin(); it != dn.end(); ++it) + if (!(*it).name().isEmpty() && !(*it).value().isEmpty()) { + result.push_back((*it).name().trimmed() + QLatin1Char('=') + dn_escape((*it).value().trimmed())); + } + return result.join(sep); +} + +static QGpgME::DN::Attribute::List +reorder_dn(const QGpgME::DN::Attribute::List &dn, const QStringList &attrOrder) +{ + QGpgME::DN::Attribute::List unknownEntries; + QGpgME::DN::Attribute::List result; + unknownEntries.reserve(dn.size()); + result.reserve(dn.size()); + + // find all unknown entries in their order of appearance + for (QGpgME::DN::const_iterator it = dn.begin(); it != dn.end(); ++it) + if (!attrOrder.contains((*it).name())) { + unknownEntries.push_back(*it); + } + + // process the known attrs in the desired order + for (QStringList::const_iterator oit = attrOrder.begin(); oit != attrOrder.end(); ++oit) + if (*oit == QLatin1String("_X_")) { + // insert the unknown attrs + std::copy(unknownEntries.begin(), unknownEntries.end(), + std::back_inserter(result)); + unknownEntries.clear(); // don't produce dup's + } else { + for (QGpgME::DN::const_iterator dnit = dn.begin(); dnit != dn.end(); ++dnit) + if ((*dnit).name() == *oit) { + result.push_back(*dnit); + } + } + + return result; +} + +// +// +// class DN +// +// + +QGpgME::DN::DN() +{ + d = new Private(); + d->ref(); +} + +QGpgME::DN::DN(const QString &dn) +{ + d = new Private(); + d->ref(); + d->attributes = parse_dn(dn); +} + +QGpgME::DN::DN(const char *utf8DN) +{ + d = new Private(); + d->ref(); + if (utf8DN) { + d->attributes = parse_dn((const unsigned char *)utf8DN); + } +} + +QGpgME::DN::DN(const DN &other) + : d(other.d) +{ + if (d) { + d->ref(); + } +} + +QGpgME::DN::~DN() +{ + if (d) { + d->unref(); + } +} + +const QGpgME::DN &QGpgME::DN::operator=(const DN &that) +{ + if (this->d == that.d) { + return *this; + } + + if (that.d) { + that.d->ref(); + } + if (this->d) { + this->d->unref(); + } + + this->d = that.d; + + return *this; +} + +QString QGpgME::DN::prettyDN() const +{ + if (!d) { + return QString(); + } + if (d->reorderedAttributes.empty()) { + d->reorderedAttributes = reorder_dn(d->attributes, d->order); + } + return serialise(d->reorderedAttributes, QStringLiteral(",")); +} + +QString QGpgME::DN::dn() const +{ + return d ? serialise(d->attributes, QStringLiteral(",")) : QString(); +} + +QString QGpgME::DN::dn(const QString &sep) const +{ + return d ? serialise(d->attributes, sep) : QString(); +} + +// static +QString QGpgME::DN::escape(const QString &value) +{ + return dn_escape(value); +} + +void QGpgME::DN::detach() +{ + if (!d) { + d = new QGpgME::DN::Private(); + d->ref(); + } else if (d->refCount() > 1) { + QGpgME::DN::Private *d_save = d; + d = new QGpgME::DN::Private(*d); + d->ref(); + d_save->unref(); + } +} + +void QGpgME::DN::append(const Attribute &attr) +{ + detach(); + d->attributes.push_back(attr); + d->reorderedAttributes.clear(); +} + +QString QGpgME::DN::operator[](const QString &attr) const +{ + if (!d) { + return QString(); + } + const QString attrUpper = attr.toUpper(); + for (QVector::const_iterator it = d->attributes.constBegin(); + it != d->attributes.constEnd(); ++it) + if ((*it).name() == attrUpper) { + return (*it).value(); + } + return QString(); +} + +static QVector empty; + +QGpgME::DN::const_iterator QGpgME::DN::begin() const +{ + return d ? d->attributes.constBegin() : empty.constBegin(); +} + +QGpgME::DN::const_iterator QGpgME::DN::end() const +{ + return d ? d->attributes.constEnd() : empty.constEnd(); +} + +void QGpgME::DN::setAttributeOrder (const QStringList &order) const +{ + d->order = order; +} + +const QStringList & QGpgME::DN::attributeOrder () const +{ + return d->order; +} diff -Nru gpgme1.0-1.7.0/lang/qt/src/dn.h gpgme1.0-1.8.0/lang/qt/src/dn.h --- gpgme1.0-1.7.0/lang/qt/src/dn.h 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/dn.h 2016-11-03 07:55:36.000000000 +0000 @@ -0,0 +1,136 @@ +/* + dn.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2004 Klarälvdalens Datakonsult AB + 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. +*/ +#ifndef QGPGME_DN_H +#define QGPGME_DN_H + +#include "qgpgme_export.h" + +#include +#include + +#include + +namespace QGpgME +{ + +/** + @short DN parser and reorderer +*/ +class QGPGME_EXPORT DN +{ +public: + class Attribute; + typedef QVector AttributeList; + typedef AttributeList::const_iterator const_iterator; + + DN(); + explicit DN(const QString &dn); + explicit DN(const char *utf8DN); + DN(const DN &other); + ~DN(); + + const DN &operator=(const DN &other); + + /** @return the value in rfc-2253-escaped form */ + static QString escape(const QString &value); + + /** @return the DN in a reordered form, according to the settings in + the [DN] group of the application's config file */ + QString prettyDN() const; + /** @return the DN in the original form */ + QString dn() const; + /** + \overload + Uses \a sep as separator (default: ,) + */ + QString dn(const QString &sep) const; + + QString operator[](const QString &attr) const; + + void append(const Attribute &attr); + + const_iterator begin() const; + const_iterator end() const; + + /** Set the order in which prettyDN will reorder the Attirbutes. */ + void setAttributeOrder(const QStringList &order) const; + + /** Get the used attribute order. */ + const QStringList & attributeOrder() const; + +private: + void detach(); +private: + class Private; + Private *d; +}; + +class QGPGME_EXPORT DN::Attribute +{ +public: + typedef DN::AttributeList List; + + explicit Attribute(const QString &name = QString(), const QString &value = QString()) + : mName(name.toUpper()), mValue(value) {} + Attribute(const Attribute &other) + : mName(other.name()), mValue(other.value()) {} + + const Attribute &operator=(const Attribute &other) + { + if (this != &other) { + mName = other.name(); + mValue = other.value(); + } + return *this; + } + + const QString &name() const + { + return mName; + } + const QString &value() const + { + return mValue; + } + + void setValue(const QString &value) + { + mValue = value; + } + +private: + QString mName; + QString mValue; +}; +} // namespace QGpgME +#endif // QGPGME_DN_H diff -Nru gpgme1.0-1.7.0/lang/qt/src/gpgme_backend_debug.cpp gpgme1.0-1.8.0/lang/qt/src/gpgme_backend_debug.cpp --- gpgme1.0-1.7.0/lang/qt/src/gpgme_backend_debug.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/gpgme_backend_debug.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/lang/qt/src/job.cpp gpgme1.0-1.8.0/lang/qt/src/job.cpp --- gpgme1.0-1.7.0/lang/qt/src/job.cpp 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/job.cpp 2016-11-15 07:35:40.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "job.h" #include "keylistjob.h" @@ -58,6 +62,7 @@ #include "keyformailboxjob.h" #include "wkspublishjob.h" #include "tofupolicyjob.h" +#include "threadedjobmixin.h" #include #include @@ -74,7 +79,6 @@ QGpgME::Job::~Job() { - } QString QGpgME::Job::auditLogAsHtml() const @@ -94,6 +98,14 @@ return auditLogError().code() != GPG_ERR_NOT_IMPLEMENTED; } +QMap QGpgME::g_context_map; + +/* static */ +GpgME::Context *QGpgME::Job::context(QGpgME::Job *job) +{ + return QGpgME::g_context_map.value (job, nullptr); +} + #define make_job_subclass_ext(x,y) \ QGpgME::x::x( QObject * parent ) : y( parent ) {} \ QGpgME::x::~x() {} diff -Nru gpgme1.0-1.7.0/lang/qt/src/job.h gpgme1.0-1.8.0/lang/qt/src/job.h --- gpgme1.0-1.7.0/lang/qt/src/job.h 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/job.h 2016-11-15 07:35:40.000000000 +0000 @@ -38,6 +38,7 @@ #include #include +#include #ifdef BUILDING_QGPGME # include "error.h" @@ -79,6 +80,20 @@ virtual GpgME::Error auditLogError() const; bool isAuditLogSupported() const; + /** Get the underlying context to set some additional options for a job. + * + * This is intended to provide more flexibility on configuring jobs before + * they are started. + * The context is still owned by the thread, do not delete it. + * + * This is a static method that takes the job as argument. + * + * This function may not be called for running jobs. + * + * @returns the context used by the job job or null. + */ + static GpgME::Context *context(Job *job); + public Q_SLOTS: virtual void slotCancel() = 0; @@ -87,6 +102,7 @@ void done(); }; +extern QMap g_context_map; } #endif // __KLEO_JOB_H__ diff -Nru gpgme1.0-1.7.0/lang/qt/src/Makefile.am gpgme1.0-1.8.0/lang/qt/src/Makefile.am --- gpgme1.0-1.7.0/lang/qt/src/Makefile.am 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/Makefile.am 2016-11-16 09:17:20.000000000 +0000 @@ -19,10 +19,11 @@ # 02111-1307, USA lib_LTLIBRARIES = libqgpgme.la EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \ - gpgme_backend_debug.h qgpgme_version.h.in + gpgme_backend_debug.h qgpgme_version.h.in \ + QGpgmeConfig.cmake.in.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 \ @@ -35,10 +36,12 @@ qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \ qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \ qgpgmetofupolicyjob.cpp \ - defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp + defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \ + dn.cpp # 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 +59,7 @@ protocol.h \ qgpgme_export.h \ qgpgmenewcryptoconfig.h \ + specialjob.h \ signjob.h \ signkeyjob.h \ signencryptjob.h \ @@ -71,16 +75,19 @@ verifydetachedjob.h \ defaultkeygenerationjob.h \ tofupolicyjob.h \ - wkspublishjob.h + wkspublishjob.h \ + dn.h camelcase_headers= \ AddUserIDJob \ + AbstractImportJob \ ChangeExpiryJob \ ChangeOwnerTrustJob \ ChangePasswdJob \ DataProvider \ DecryptJob \ DecryptVerifyJob \ + DN \ DownloadJob \ EncryptJob \ ExportJob \ @@ -89,6 +96,7 @@ MultiDeleteJob \ Protocol \ QGpgMENewCryptoConfig \ + SpecialJob \ SignJob \ SignKeyJob \ SignEncryptJob \ @@ -109,7 +117,6 @@ private_qgpgme_headers = \ qgpgme_export.h \ - abstractimportjob.h \ protocol_p.h \ qgpgmeadduseridjob.h \ qgpgmebackend.h \ @@ -137,7 +144,6 @@ qgpgmekeyformailboxjob.h \ qgpgmewkspublishjob.h \ qgpgmetofupolicyjob.h \ - specialjob.h \ threadedjobmixin.h qgpgme_moc_sources = \ @@ -201,7 +207,7 @@ qgpgmeinclude_HEADERS = $(qgpgme_headers) camelcaseincludedir = $(includedir)/QGpgME camelcaseinclude_HEADERS = $(camelcase_headers) -nodist_include_HEADERS = qgpgme_version.h +nodist_qgpgmeinclude_HEADERS = qgpgme_version.h libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers) @@ -211,19 +217,19 @@ libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \ @LIBASSUAN_LIBS@ @GPGME_QT_LIBS@ -libqgpgme_la_LDFLAGS = -version-info \ +libqgpgme_la_LDFLAGS = -no-undefined -version-info \ @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@ if HAVE_W32_SYSTEM -libsuffix=.dll.a +QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in + sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ + sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ + sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ else -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|[@]resolved_includedir@|$(includedir)|g' > $@ +endif $(camelcase_headers): Makefile.am echo -n "#include \"qgpgme/" > "$@" @@ -231,16 +237,16 @@ echo ".h\"" >> "$@" install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake - -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp - $(INSTALL) QGpgmeConfig.cmake \ - $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - $(INSTALL) QGpgmeConfigVersion.cmake \ - $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake + -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme + $(INSTALL) -m 644 QGpgmeConfig.cmake \ + $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake + $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \ + $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake uninstall-cmake-files: - -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake - -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/ + -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake + -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake + -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/ install-data-local: install-cmake-files @@ -248,7 +254,9 @@ BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers) -CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake +CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \ + qgpgme_version.h QGpgmeConfig.cmake.in \ + QGpgmeConfigVersion.cmake nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources) diff -Nru gpgme1.0-1.7.0/lang/qt/src/Makefile.in gpgme1.0-1.8.0/lang/qt/src/Makefile.in --- gpgme1.0-1.7.0/lang/qt/src/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -82,6 +82,7 @@ subdir = lang/qt/src DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/mkinstalldirs \ + $(srcdir)/QGpgmeConfig-w32.cmake.in.in \ $(srcdir)/QGpgmeConfig.cmake.in.in \ $(srcdir)/QGpgmeConfigVersion.cmake.in \ $(srcdir)/qgpgme_version.h.in $(top_srcdir)/build-aux/depcomp \ @@ -102,8 +103,8 @@ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = QGpgmeConfig.cmake.in QGpgmeConfigVersion.cmake \ - qgpgme_version.h +CONFIG_CLEAN_FILES = QGpgmeConfig-w32.cmake.in QGpgmeConfig.cmake.in \ + QGpgmeConfigVersion.cmake qgpgme_version.h CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -133,26 +134,27 @@ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(includedir)" \ + "$(DESTDIR)$(camelcaseincludedir)" \ + "$(DESTDIR)$(qgpgmeincludedir)" \ "$(DESTDIR)$(qgpgmeincludedir)" 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 \ - defaultkeygenerationjob.lo qgpgmewkspublishjob.lo + defaultkeygenerationjob.lo qgpgmewkspublishjob.lo dn.lo am__objects_2 = am_libqgpgme_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_2) @@ -225,7 +227,7 @@ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -HEADERS = $(camelcaseinclude_HEADERS) $(nodist_include_HEADERS) \ +HEADERS = $(camelcaseinclude_HEADERS) $(nodist_qgpgmeinclude_HEADERS) \ $(qgpgmeinclude_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, @@ -378,6 +380,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -461,10 +466,11 @@ # 02111-1307, USA lib_LTLIBRARIES = libqgpgme.la EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \ - gpgme_backend_debug.h qgpgme_version.h.in + gpgme_backend_debug.h qgpgme_version.h.in \ + QGpgmeConfig.cmake.in.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 \ @@ -477,11 +483,13 @@ qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \ qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \ qgpgmetofupolicyjob.cpp \ - defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp + defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \ + dn.cpp # 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 +507,7 @@ protocol.h \ qgpgme_export.h \ qgpgmenewcryptoconfig.h \ + specialjob.h \ signjob.h \ signkeyjob.h \ signencryptjob.h \ @@ -514,16 +523,19 @@ verifydetachedjob.h \ defaultkeygenerationjob.h \ tofupolicyjob.h \ - wkspublishjob.h + wkspublishjob.h \ + dn.h camelcase_headers = \ AddUserIDJob \ + AbstractImportJob \ ChangeExpiryJob \ ChangeOwnerTrustJob \ ChangePasswdJob \ DataProvider \ DecryptJob \ DecryptVerifyJob \ + DN \ DownloadJob \ EncryptJob \ ExportJob \ @@ -532,6 +544,7 @@ MultiDeleteJob \ Protocol \ QGpgMENewCryptoConfig \ + SpecialJob \ SignJob \ SignKeyJob \ SignEncryptJob \ @@ -552,7 +565,6 @@ private_qgpgme_headers = \ qgpgme_export.h \ - abstractimportjob.h \ protocol_p.h \ qgpgmeadduseridjob.h \ qgpgmebackend.h \ @@ -580,7 +592,6 @@ qgpgmekeyformailboxjob.h \ qgpgmewkspublishjob.h \ qgpgmetofupolicyjob.h \ - specialjob.h \ threadedjobmixin.h qgpgme_moc_sources = \ @@ -644,7 +655,7 @@ qgpgmeinclude_HEADERS = $(qgpgme_headers) camelcaseincludedir = $(includedir)/QGpgME camelcaseinclude_HEADERS = $(camelcase_headers) -nodist_include_HEADERS = qgpgme_version.h +nodist_qgpgmeinclude_HEADERS = qgpgme_version.h libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers) AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \ @GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \ @@ -653,13 +664,14 @@ libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \ @LIBASSUAN_LIBS@ @GPGME_QT_LIBS@ -libqgpgme_la_LDFLAGS = -version-info \ +libqgpgme_la_LDFLAGS = -no-undefined -version-info \ @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@ -@HAVE_W32_SYSTEM_FALSE@libsuffix = .so -@HAVE_W32_SYSTEM_TRUE@libsuffix = .dll.a BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers) -CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake +CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \ + qgpgme_version.h QGpgmeConfig.cmake.in \ + QGpgmeConfigVersion.cmake + nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -696,6 +708,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +QGpgmeConfig-w32.cmake.in: $(top_builddir)/config.status $(srcdir)/QGpgmeConfig-w32.cmake.in.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ QGpgmeConfig.cmake.in: $(top_builddir)/config.status $(srcdir)/QGpgmeConfig.cmake.in.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ QGpgmeConfigVersion.cmake: $(top_builddir)/config.status $(srcdir)/QGpgmeConfigVersion.cmake.in @@ -749,8 +763,10 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dataprovider.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dn.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@ @@ -827,27 +843,27 @@ @list='$(camelcaseinclude_HEADERS)'; test -n "$(camelcaseincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(camelcaseincludedir)'; $(am__uninstall_files_from_dir) -install-nodist_includeHEADERS: $(nodist_include_HEADERS) +install-nodist_qgpgmeincludeHEADERS: $(nodist_qgpgmeinclude_HEADERS) @$(NORMAL_INSTALL) - @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ + @list='$(nodist_qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \ if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + echo " $(MKDIR_P) '$(DESTDIR)$(qgpgmeincludedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(qgpgmeincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(qgpgmeincludedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(qgpgmeincludedir)" || exit $$?; \ done -uninstall-nodist_includeHEADERS: +uninstall-nodist_qgpgmeincludeHEADERS: @$(NORMAL_UNINSTALL) - @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ + @list='$(nodist_qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + dir='$(DESTDIR)$(qgpgmeincludedir)'; $(am__uninstall_files_from_dir) install-qgpgmeincludeHEADERS: $(qgpgmeinclude_HEADERS) @$(NORMAL_INSTALL) @list='$(qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \ @@ -957,7 +973,7 @@ $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(qgpgmeincludedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(qgpgmeincludedir)" "$(DESTDIR)$(qgpgmeincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -1017,7 +1033,8 @@ info-am: install-data-am: install-camelcaseincludeHEADERS install-data-local \ - install-nodist_includeHEADERS install-qgpgmeincludeHEADERS + install-nodist_qgpgmeincludeHEADERS \ + install-qgpgmeincludeHEADERS install-dvi: install-dvi-am @@ -1065,7 +1082,8 @@ uninstall-am: uninstall-camelcaseincludeHEADERS \ uninstall-libLTLIBRARIES uninstall-local \ - uninstall-nodist_includeHEADERS uninstall-qgpgmeincludeHEADERS + uninstall-nodist_qgpgmeincludeHEADERS \ + uninstall-qgpgmeincludeHEADERS .MAKE: all check install install-am install-strip @@ -1078,21 +1096,24 @@ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man \ - install-nodist_includeHEADERS install-pdf install-pdf-am \ + install-nodist_qgpgmeincludeHEADERS install-pdf install-pdf-am \ install-ps install-ps-am install-qgpgmeincludeHEADERS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-camelcaseincludeHEADERS uninstall-libLTLIBRARIES \ - uninstall-local uninstall-nodist_includeHEADERS \ + uninstall-local uninstall-nodist_qgpgmeincludeHEADERS \ uninstall-qgpgmeincludeHEADERS -QGpgmeConfig.cmake: QGpgmeConfig.cmake.in - sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@" - sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2 - mv "$@".2 "$@" +@HAVE_W32_SYSTEM_TRUE@QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in +@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ +@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ +@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ +@HAVE_W32_SYSTEM_FALSE@QGpgmeConfig.cmake: QGpgmeConfig.cmake.in +@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ +@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ $(camelcase_headers): Makefile.am echo -n "#include \"qgpgme/" > "$@" @@ -1100,16 +1121,16 @@ echo ".h\"" >> "$@" install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake - -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp - $(INSTALL) QGpgmeConfig.cmake \ - $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - $(INSTALL) QGpgmeConfigVersion.cmake \ - $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake + -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme + $(INSTALL) -m 644 QGpgmeConfig.cmake \ + $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake + $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \ + $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake uninstall-cmake-files: - -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake - -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/ + -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake + -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake + -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/ install-data-local: install-cmake-files diff -Nru gpgme1.0-1.7.0/lang/qt/src/multideletejob.cpp gpgme1.0-1.8.0/lang/qt/src/multideletejob.cpp --- gpgme1.0-1.7.0/lang/qt/src/multideletejob.cpp 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/multideletejob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 +#include +#include + +#include + +#include + +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 &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 -Nru gpgme1.0-1.7.0/lang/qt/src/multideletejob.h gpgme1.0-1.8.0/lang/qt/src/multideletejob.h --- gpgme1.0-1.7.0/lang/qt/src/multideletejob.h 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/multideletejob.h 2016-10-18 17:22:02.000000000 +0000 @@ -36,7 +36,7 @@ #include "qgpgme_export.h" #include "job.h" -#include "cryptobackend.h" +#include "protocol.h" #include diff -Nru gpgme1.0-1.7.0/lang/qt/src/protocol.h gpgme1.0-1.8.0/lang/qt/src/protocol.h --- gpgme1.0-1.7.0/lang/qt/src/protocol.h 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/protocol.h 2016-10-18 17:22:02.000000000 +0000 @@ -76,7 +76,7 @@ * 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 @@ /** 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 -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeadduseridjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeadduseridjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeadduseridjob.cpp 2016-05-17 18:23:28.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeadduseridjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeadduseridjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmebackend.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmebackend.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmebackend.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmebackend.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmebackend.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmechangeexpiryjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmechangeexpiryjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmechangeexpiryjob.cpp 2016-05-17 18:23:28.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmechangeexpiryjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmechangeexpiryjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmechangeownertrustjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmechangeownertrustjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmechangeownertrustjob.cpp 2016-05-17 18:23:28.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmechangeownertrustjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmechangeownertrustjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmechangepasswdjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmechangepasswdjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmechangepasswdjob.cpp 2016-05-17 18:23:28.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmechangepasswdjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmechangepasswdjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/QGpgmeConfig.cmake.in.in gpgme1.0-1.8.0/lang/qt/src/QGpgmeConfig.cmake.in.in --- gpgme1.0-1.7.0/lang/qt/src/QGpgmeConfig.cmake.in.in 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/QGpgmeConfig.cmake.in.in 2016-11-16 09:17:20.000000000 +0000 @@ -37,7 +37,7 @@ 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,28 +58,19 @@ 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@" + IMPORTED_LOCATION "@resolved_libdir@/libqgpgme.so" ) 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}} ) @@ -105,3 +96,6 @@ # Commands beyond this point should not need to know the version. set(CMAKE_IMPORT_FILE_VERSION) cmake_policy(POP) + +# Gpgmepp is a requirement for qgpgme +find_package(Gpgmepp CONFIG REQUIRED) diff -Nru gpgme1.0-1.7.0/lang/qt/src/QGpgmeConfigVersion.cmake.in gpgme1.0-1.8.0/lang/qt/src/QGpgmeConfigVersion.cmake.in --- gpgme1.0-1.7.0/lang/qt/src/QGpgmeConfigVersion.cmake.in 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/QGpgmeConfigVersion.cmake.in 2016-11-03 07:55:36.000000000 +0000 @@ -19,7 +19,7 @@ # 02111-1307, USA # based on a generated file from cmake. -set(PACKAGE_VERSION "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@.@BUILD_REVISION@") +set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) diff -Nru gpgme1.0-1.7.0/lang/qt/src/QGpgmeConfig-w32.cmake.in.in gpgme1.0-1.8.0/lang/qt/src/QGpgmeConfig-w32.cmake.in.in --- gpgme1.0-1.7.0/lang/qt/src/QGpgmeConfig-w32.cmake.in.in 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/QGpgmeConfig-w32.cmake.in.in 2016-11-16 09:17:20.000000000 +0000 @@ -0,0 +1,105 @@ +# CMake Config file for QGPGME. +# Copyright (C) 2016 Intevation GmbH +# +# This file is part of GPGME. +# +# GPGME-CL 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. +# +# GPGME-CL 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 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 + +# based on a generated file from cmake. +# Generated by CMake 3.0.2 + +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) + message(FATAL_ERROR "CMake >= 2.6.0 required") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) +#---------------------------------------------------------------- +# Generated CMake target import file. +#---------------------------------------------------------------- + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget QGpgme) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + +# Create imported target QGpgme +add_library(QGpgme SHARED IMPORTED) + +set_target_properties(QGpgme PROPERTIES + IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgme.dll.a" + INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@" + INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core" + IMPORTED_LOCATION "@resolved_libdir@/libqgpgme-7.dll" +) + +list(APPEND _IMPORT_CHECK_TARGETS QGgpme ) +list(APPEND _IMPORT_CHECK_FILES_FOR_Qgpgme "@resolved_libdir@/libqgpgme.dll.a" "@resolved_bindir@/libqgpgme-7.dll" ) + +if(CMAKE_VERSION VERSION_LESS 2.8.12) + message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") +endif() + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# This file does not depend on other imported targets which have +# been exported from the same project but in a separate export set. + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) + +# Gpgmepp is a requirement for qgpgme +find_package(Gpgmepp CONFIG REQUIRED) diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmedecryptjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmedecryptjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmedecryptjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmedecryptjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedecryptjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmedecryptverifyjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmedecryptverifyjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmedecryptverifyjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmedecryptverifyjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedecryptverifyjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmedeletejob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmedeletejob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmedeletejob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmedeletejob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedeletejob.h" #include "context.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmedownloadjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmedownloadjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmedownloadjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmedownloadjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedownloadjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeencryptjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeencryptjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeencryptjob.cpp 2016-08-09 13:40:40.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeencryptjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeencryptjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgme_export.h gpgme1.0-1.8.0/lang/qt/src/qgpgme_export.h --- gpgme1.0-1.7.0/lang/qt/src/qgpgme_export.h 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgme_export.h 2016-11-03 16:32:30.000000000 +0000 @@ -1,22 +1,32 @@ -/*qgpgme_export.h - Export macros for qgpgme - Copyright (C) 2016, Intevation GmbH +/* qgpgme_export.h - Export macros for qgpgme - This file is part of GPGME++. + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2016 Intevation GmbH - GPGME++ is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with GPGME++; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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. */ #ifndef QGPGME_EXPORT_H diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeexportjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeexportjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeexportjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeexportjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeexportjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeimportfromkeyserverjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeimportjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeimportjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeimportjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeimportjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeimportjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmekeyformailboxjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmekeyformailboxjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmekeyformailboxjob.cpp 2016-09-13 16:59:10.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmekeyformailboxjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -30,6 +30,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmekeyformailboxjob.h" #include "qgpgmekeylistjob.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmekeygenerationjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmekeygenerationjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmekeygenerationjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmekeygenerationjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmekeygenerationjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmekeylistjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmekeylistjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmekeylistjob.cpp 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmekeylistjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmekeylistjob.h" #include "key.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmelistallkeysjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmelistallkeysjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmelistallkeysjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmelistallkeysjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmelistallkeysjob.h" #include "key.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmenewcryptoconfig.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmenewcryptoconfig.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmenewcryptoconfig.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmenewcryptoconfig.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmenewcryptoconfig.h" #include @@ -80,7 +84,7 @@ clear(); } -void QGpgMENewCryptoConfig::reloadConfiguration(bool showErrors) +void QGpgMENewCryptoConfig::reloadConfiguration(bool) { clear(); diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmerefreshkeysjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmerefreshkeysjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmerefreshkeysjob.cpp 2016-08-10 13:35:52.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmerefreshkeysjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmesecretkeyexportjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmesecretkeyexportjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmesecretkeyexportjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmesecretkeyexportjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmesignencryptjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmesignencryptjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmesignencryptjob.cpp 2016-08-09 13:40:40.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmesignencryptjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesignencryptjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmesignjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmesignjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmesignjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmesignjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesignjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmesignkeyjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmesignkeyjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmesignkeyjob.cpp 2016-05-17 18:23:28.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmesignkeyjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesignkeyjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmetofupolicyjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmetofupolicyjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmetofupolicyjob.cpp 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmetofupolicyjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -28,6 +28,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmetofupolicyjob.h" #include "context.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeverifydetachedjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeverifydetachedjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeverifydetachedjob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeverifydetachedjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeverifydetachedjob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmeverifyopaquejob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmeverifyopaquejob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmeverifyopaquejob.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmeverifyopaquejob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeverifyopaquejob.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgme_version.h.in gpgme1.0-1.8.0/lang/qt/src/qgpgme_version.h.in --- gpgme1.0-1.7.0/lang/qt/src/qgpgme_version.h.in 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgme_version.h.in 2016-11-03 16:32:30.000000000 +0000 @@ -1,32 +1,42 @@ -/*qgpgme_version.h - Version macros for qgpgme - Copyright (C) 2016, Intevation GmbH +/* qgpgme_version.h - Version macros for qgpgme - This file is part of GPGME++. + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2016 Intevation GmbH - GPGME++ is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with GPGME++; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + 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. */ #ifndef QGPGME_VERSION_H #define QGPGME_VERSION_H -#define QGPGME_VERSION_STRING "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@" -#define QGPGME_VERSION_MAJOR @LIBQGPGME_LT_CURRENT@ -#define QGPGME_VERSION_MINOR @LIBQGPGME_LT_AGE@ -#define QGPGME_VERSION_PATCH @LIBQGPGME_LT_REVISION@ -#define QGPGME_VERSION ((@LIBQGPGME_LT_CURRENT@<<16)|(@LIBQGPGME_LT_AGE@<<8)|(@LIBQGPGME_LT_REVISION@)) +#define QGPGME_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@" +#define QGPGME_VERSION_MAJOR @VERSION_MAJOR@ +#define QGPGME_VERSION_MINOR @VERSION_MINOR@ +#define QGPGME_VERSION_PATCH @VERSION_MICRO@ +#define QGPGME_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@)) #endif diff -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmewkspublishjob.cpp gpgme1.0-1.8.0/lang/qt/src/qgpgmewkspublishjob.cpp --- gpgme1.0-1.7.0/lang/qt/src/qgpgmewkspublishjob.cpp 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmewkspublishjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -28,6 +28,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmewkspublishjob.h" #include "context.h" @@ -137,7 +141,7 @@ 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 @@ 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 -Nru gpgme1.0-1.7.0/lang/qt/src/qgpgmewkspublishjob.h gpgme1.0-1.8.0/lang/qt/src/qgpgmewkspublishjob.h --- gpgme1.0-1.7.0/lang/qt/src/qgpgmewkspublishjob.h 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/qgpgmewkspublishjob.h 2016-10-18 17:22:02.000000000 +0000 @@ -62,7 +62,7 @@ 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 -Nru gpgme1.0-1.7.0/lang/qt/src/SpecialJob gpgme1.0-1.8.0/lang/qt/src/SpecialJob --- gpgme1.0-1.7.0/lang/qt/src/SpecialJob 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/SpecialJob 2016-11-16 09:18:53.000000000 +0000 @@ -0,0 +1 @@ +#include "qgpgme/specialjob.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/threadedjobmixin.cpp gpgme1.0-1.8.0/lang/qt/src/threadedjobmixin.cpp --- gpgme1.0-1.7.0/lang/qt/src/threadedjobmixin.cpp 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/threadedjobmixin.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "threadedjobmixin.h" #include "dataprovider.h" diff -Nru gpgme1.0-1.7.0/lang/qt/src/threadedjobmixin.h gpgme1.0-1.8.0/lang/qt/src/threadedjobmixin.h --- gpgme1.0-1.7.0/lang/qt/src/threadedjobmixin.h 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/threadedjobmixin.h 2016-11-16 09:17:20.000000000 +0000 @@ -48,6 +48,7 @@ # include #endif +#include "job.h" #include @@ -147,14 +148,20 @@ explicit ThreadedJobMixin(GpgME::Context *ctx) : T_base(0), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError() { - } void lateInitialization() { assert(m_ctx); - QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(slotFinished())); + QObject::connect(&m_thread, &QThread::finished, this, + &mixin_type::slotFinished); m_ctx->setProgressProvider(this); + QGpgME::g_context_map.insert(this, m_ctx.get()); + } + + ~ThreadedJobMixin() + { + QGpgME::g_context_map.remove(this); } template @@ -223,7 +230,8 @@ { 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 -Nru gpgme1.0-1.7.0/lang/qt/src/wkspublishjob.h gpgme1.0-1.8.0/lang/qt/src/wkspublishjob.h --- gpgme1.0-1.7.0/lang/qt/src/wkspublishjob.h 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/src/wkspublishjob.h 2016-10-25 13:25:45.000000000 +0000 @@ -45,8 +45,17 @@ * 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. + * + * The workflow is to call startCreate, check for errors and then + * send the RFC822 mail returned in returnedData. + * + * When the response is received start a startRecieve with the + * RFC822 mail received as paramater response. Check for errors + * and then send again send the result from returnedData back to + * the server. + * */ class QGPGME_EXPORT WKSPublishJob: public Job { @@ -69,20 +78,20 @@ virtual void startCheck(const QString &mailbox) = 0; /** Create a publish request. - * The returned Data from the result will contain - * the full Mail as returned by gpg-wks-client --create + * The returnedData from the result signal will contain + * the full Request as returned by gpg-wks-client --create * * @param fpr the fingerprint of the key to create the request for. * @param mailbox A simple mail address without a Name. */ virtual void startCreate(const char *fpr, const QString &mailbox) = 0; - /** Handle a submisson response. The returned Data will contain - * the full Mail as returned by gpg-wks-client --create + /** Handle a submisson response. The returnedData in the result singnal + * will contain the confirmation response as returned by gpg-wks-client --receive * * @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 -Nru gpgme1.0-1.7.0/lang/qt/tests/Makefile.am gpgme1.0-1.8.0/lang/qt/tests/Makefile.am --- gpgme1.0-1.7.0/lang/qt/tests/Makefile.am 2016-09-20 17:09:38.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/Makefile.am 2016-10-18 17:22:02.000000000 +0000 @@ -25,10 +25,10 @@ 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_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 @@ 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 -Nru gpgme1.0-1.7.0/lang/qt/tests/Makefile.in gpgme1.0-1.8.0/lang/qt/tests/Makefile.in --- gpgme1.0-1.7.0/lang/qt/tests/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -98,10 +98,11 @@ 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_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 @@ 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;; \ @@ -406,6 +413,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -471,7 +481,7 @@ 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 +501,7 @@ 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 +579,10 @@ @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 +600,7 @@ @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 -Nru gpgme1.0-1.7.0/lang/qt/tests/run-keyformailboxjob.cpp gpgme1.0-1.8.0/lang/qt/tests/run-keyformailboxjob.cpp --- gpgme1.0-1.7.0/lang/qt/tests/run-keyformailboxjob.cpp 2016-08-21 12:29:55.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/run-keyformailboxjob.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "keyformailboxjob.h" #include "keylistjob.h" #include "protocol.h" diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-encrypt.cpp gpgme1.0-1.8.0/lang/qt/tests/t-encrypt.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-encrypt.cpp 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-encrypt.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 #include #include @@ -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 @@ 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 @@ 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 @@ } 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 @@ void testSymmetricEncryptDecrypt() { + if (!decryptSupported()) { + return; + } auto ctx = Context::createForProtocol(OpenPGP); TestPassphraseProvider provider; ctx->setPassphraseProvider(&provider); @@ -178,6 +205,9 @@ * 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 keys; auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-keylist.cpp gpgme1.0-1.8.0/lang/qt/tests/t-keylist.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-keylist.cpp 2016-08-10 13:35:52.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-keylist.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include #include diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-keylocate.cpp gpgme1.0-1.8.0/lang/qt/tests/t-keylocate.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-keylocate.cpp 2016-08-09 13:40:40.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-keylocate.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 #include #include diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-ownertrust.cpp gpgme1.0-1.8.0/lang/qt/tests/t-ownertrust.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-ownertrust.cpp 2016-08-09 13:40:40.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-ownertrust.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include #include #include diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-support.cpp gpgme1.0-1.8.0/lang/qt/tests/t-support.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-support.cpp 2016-09-13 16:59:10.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-support.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "t-support.h" #include diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-support.h gpgme1.0-1.8.0/lang/qt/tests/t-support.h --- gpgme1.0-1.7.0/lang/qt/tests/t-support.h 2016-09-13 16:59:10.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-support.h 2016-10-18 17:22:02.000000000 +0000 @@ -39,8 +39,8 @@ 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 -Nru gpgme1.0-1.7.0/lang/qt/tests/t-tofuinfo.cpp gpgme1.0-1.8.0/lang/qt/tests/t-tofuinfo.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-tofuinfo.cpp 2016-09-20 08:48:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-tofuinfo.cpp 2016-11-15 07:35:40.000000000 +0000 @@ -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 #include #include @@ -148,6 +152,10 @@ const QByteArray data1(testMsg1); QByteArray plaintext; + auto ctx = Job::context(job); + Q_ASSERT(ctx); + ctx->setSender("alfa@example.net"); + auto result = job->exec(data1, plaintext); delete job; diff -Nru gpgme1.0-1.7.0/lang/qt/tests/t-verify.cpp gpgme1.0-1.8.0/lang/qt/tests/t-verify.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-verify.cpp 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-verify.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 +#include + + +#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 -Nru gpgme1.0-1.7.0/lang/qt/tests/t-wkspublish.cpp gpgme1.0-1.8.0/lang/qt/tests/t-wkspublish.cpp --- gpgme1.0-1.7.0/lang/qt/tests/t-wkspublish.cpp 2016-09-07 06:48:44.000000000 +0000 +++ gpgme1.0-1.8.0/lang/qt/tests/t-wkspublish.cpp 2016-10-18 17:22:02.000000000 +0000 @@ -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 #include #include @@ -122,7 +126,7 @@ // 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 @@ // 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 @@ } 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 @@ 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 @@ /* 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 @@ Q_ASSERT(spy.wait()); } - void testWKSPublishRecieve() { + void testWKSPublishReceive() { if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") { /* Not supported */ return; @@ -243,7 +247,7 @@ /* 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 @@ Q_ASSERT(outstr.contains( QStringLiteral("From: " TEST_ADDRESS))); }); - job->startRecieve(QByteArray(testResponse)); + job->startReceive(QByteArray(testResponse)); Q_ASSERT(spy.wait()); } diff -Nru gpgme1.0-1.7.0/lang/README gpgme1.0-1.8.0/lang/README --- gpgme1.0-1.7.0/lang/README 2016-09-20 08:48:12.000000000 +0000 +++ gpgme1.0-1.8.0/lang/README 2016-11-03 07:55:36.000000000 +0000 @@ -12,4 +12,4 @@ cl Common Lisp cpp C++ qt Qt-Framework API -python Python 2 and 3 (port of PyME 0.9.0) +python Python 2 and 3 (module name: gpg) diff -Nru gpgme1.0-1.7.0/m4/glib-2.0.m4 gpgme1.0-1.8.0/m4/glib-2.0.m4 --- gpgme1.0-1.7.0/m4/glib-2.0.m4 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/m4/glib-2.0.m4 2016-11-16 12:20:17.000000000 +0000 @@ -2,11 +2,11 @@ # Owen Taylor 1997-2001 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or dnl gthread is specified in MODULES, pass to pkg-config dnl AC_DEFUN([AM_PATH_GLIB_2_0], -[dnl +[dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], @@ -16,16 +16,16 @@ for module in . $4 do case "$module" in - gmodule) + gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; - gmodule-no-export) + gmodule-no-export) pkg_config_args="$pkg_config_args gmodule-no-export-2.0" ;; - gobject) + gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; - gthread) + gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac @@ -92,7 +92,7 @@ #include #include -int +int main () { int major, minor, micro; @@ -111,7 +111,7 @@ (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); @@ -121,7 +121,7 @@ printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); - } + } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) @@ -165,12 +165,12 @@ fi if test "x$no_glib" = x ; then AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" + echo "*** See https://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : diff -Nru gpgme1.0-1.7.0/m4/libtool.m4 gpgme1.0-1.8.0/m4/libtool.m4 --- gpgme1.0-1.7.0/m4/libtool.m4 2013-05-31 11:37:05.000000000 +0000 +++ gpgme1.0-1.8.0/m4/libtool.m4 2016-11-16 12:20:16.000000000 +0000 @@ -34,7 +34,7 @@ # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# can be downloaded from https://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) diff -Nru gpgme1.0-1.7.0/m4/pkg.m4 gpgme1.0-1.8.0/m4/pkg.m4 --- gpgme1.0-1.7.0/m4/pkg.m4 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/m4/pkg.m4 2016-11-16 12:20:16.000000000 +0000 @@ -1,5 +1,5 @@ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# +# # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ AC_MSG_RESULT([no]) PKG_CONFIG="" fi - + fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -120,7 +120,7 @@ _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs @@ -146,7 +146,7 @@ _PKG_TEXT -To get pkg-config, see .])], +To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS diff -Nru gpgme1.0-1.7.0/Makefile.am gpgme1.0-1.8.0/Makefile.am --- gpgme1.0-1.7.0/Makefile.am 2016-09-20 12:53:31.000000000 +0000 +++ gpgme1.0-1.8.0/Makefile.am 2016-11-16 12:20:18.000000000 +0000 @@ -15,7 +15,7 @@ # 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 . +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in diff -Nru gpgme1.0-1.7.0/Makefile.in gpgme1.0-1.8.0/Makefile.in --- gpgme1.0-1.7.0/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -31,7 +31,7 @@ # 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 . +# License along with this program; if not, see . VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ @@ -101,7 +101,7 @@ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in $(top_srcdir)/build-aux/mkinstalldirs \ - $(top_srcdir)/lang/python/pyme/version.py.in COPYING \ + $(top_srcdir)/lang/python/gpg/version.py.in COPYING \ COPYING.LESSER THANKS TODO build-aux/compile \ build-aux/config.guess build-aux/config.sub build-aux/depcomp \ build-aux/install-sh build-aux/mdate-sh missing \ @@ -131,7 +131,7 @@ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = lang/python/pyme/version.py +CONFIG_CLEAN_FILES = lang/python/gpg/version.py CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -363,6 +363,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -486,7 +489,7 @@ distclean-hdr: -rm -f config.h stamp-h1 -lang/python/pyme/version.py: $(top_builddir)/config.status $(top_srcdir)/lang/python/pyme/version.py.in +lang/python/gpg/version.py: $(top_builddir)/config.status $(top_srcdir)/lang/python/gpg/version.py.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: diff -Nru gpgme1.0-1.7.0/NEWS gpgme1.0-1.8.0/NEWS --- gpgme1.0-1.7.0/NEWS 2016-09-21 07:18:01.000000000 +0000 +++ gpgme1.0-1.8.0/NEWS 2016-11-16 12:15:47.000000000 +0000 @@ -1,4 +1,76 @@ -Noteworthy changes in version 1.7.0 (2016-09-21) [C26/A15/R0] +Noteworthy changes in version 1.8.0 (2016-11-16) +------------------------------------------------ + + * The module of the Python bindings has been renamed to 'gpg'. + + * New interface to query current software versions. + + * New feature to use gpg's --{show,override}session-key options. + + * New interface to set the sender of a mail. + + * qt: Added Distinguished Name parser from libkleo + + * The --homedir option is now used with recent gpgconf versions. + + * On 64 bit Windows systems gpgconf is now properly located. + + * The internal locking functions have been replaced by libgpg-error + locking functions. + + * Interface changes relative to the 1.7.1 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + gpgme_set_sender NEW. + gpgme_get_sender NEW. + gpgme_op_query_swdb NEW. + gpgme_op_query_swdb_result NEW. + gpgme_query_swdb_result_t NEW. + gpgme_get_ctx_flag NEW. + gpgme_decrypt_result_t EXTENDED: New field session_key. + qt: DN NEW. + qt: DN::Attribute NEW. + qt: Job::context(Job*) NEW. + cpp: EngineInfo::Version::Version(const char*) NEW. + cpp: EngineInfo::Version::Version() NEW. + cpp: SwdbResult NEW. + cpp: Context::setSender(const char*) NEW. + cpp: Context::getSender() NEW. + + [c=C28/A17/R0 cpp=C9/A3/R0 qt=C8/A1/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 +174,8 @@ 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 -Nru gpgme1.0-1.7.0/README gpgme1.0-1.8.0/README --- gpgme1.0-1.7.0/README 2016-09-21 07:18:01.000000000 +0000 +++ gpgme1.0-1.8.0/README 2016-11-16 12:16:52.000000000 +0000 @@ -64,7 +64,7 @@ a) If you have a trusted Version of GnuPG installed, you can simply check the supplied signature: - $ gpg --verify gpgme-x.y.z.tar.gz.sig + $ gpg --verify gpgme-x.y.z.tar.gz.sig gpgme-x.y.z.tar.gz This checks that the detached signature gpgme-x.y.z.tar.gz.sig is indeed a a signature of gpgme-x.y.z.tar.gz. The key used to create diff -Nru gpgme1.0-1.7.0/src/argparse.c gpgme1.0-1.8.0/src/argparse.c --- gpgme1.0-1.7.0/src/argparse.c 2016-09-13 18:15:38.000000000 +0000 +++ gpgme1.0-1.8.0/src/argparse.c 2016-11-16 12:22:41.000000000 +0000 @@ -26,7 +26,7 @@ * * You should have received a copies of the GNU General Public License * and the GNU Lesser General Public License along with this program; - * if not, see . + * if not, see . */ /* This file may be used as part of GnuPG or standalone. A GnuPG @@ -1518,7 +1518,7 @@ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n\n" "You should have received a copy of the GNU General Public License\n" -"along with this software. If not, see .\n"; +"along with this software. If not, see .\n"; break; case 40: /* short and long usage */ case 41: p = ""; break; diff -Nru gpgme1.0-1.7.0/src/argparse.h gpgme1.0-1.8.0/src/argparse.h --- gpgme1.0-1.7.0/src/argparse.h 2016-04-18 15:35:08.000000000 +0000 +++ gpgme1.0-1.8.0/src/argparse.h 2016-11-16 12:23:14.000000000 +0000 @@ -25,7 +25,7 @@ * * You should have received a copies of the GNU General Public License * and the GNU Lesser General Public License along with this program; - * if not, see . + * if not, see . */ #ifndef GNUPG_COMMON_ARGPARSE_H diff -Nru gpgme1.0-1.7.0/src/assuan-support.c gpgme1.0-1.8.0/src/assuan-support.c --- gpgme1.0-1.7.0/src/assuan-support.c 2016-09-13 17:23:34.000000000 +0000 +++ gpgme1.0-1.8.0/src/assuan-support.c 2016-11-16 12:22:41.000000000 +0000 @@ -97,6 +97,9 @@ { (void)ctx; #ifdef HAVE_W32_SYSTEM + (void)fd; + (void)msg; + (void)flags; gpg_err_set_errno (ENOSYS); return -1; #else @@ -112,6 +115,9 @@ { (void)ctx; #ifdef HAVE_W32_SYSTEM + (void)fd; + (void)msg; + (void)flags; gpg_err_set_errno (ENOSYS); return -1; #else @@ -210,6 +216,9 @@ { (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 @@ 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 -Nru gpgme1.0-1.7.0/src/ath.c gpgme1.0-1.8.0/src/ath.c --- gpgme1.0-1.7.0/src/ath.c 2013-05-31 11:37:05.000000000 +0000 +++ gpgme1.0-1.8.0/src/ath.c 2016-11-16 12:22:41.000000000 +0000 @@ -49,11 +49,6 @@ #include "ath.h" -#define MUTEX_UNLOCKED ((ath_mutex_t) 0) -#define MUTEX_LOCKED ((ath_mutex_t) 1) -#define MUTEX_DESTROYED ((ath_mutex_t) 2) - - #ifdef HAVE_W32_SYSTEM #include uintptr_t @@ -80,52 +75,6 @@ #endif -int -ath_mutex_init (ath_mutex_t *lock) -{ -#ifndef NDEBUG - *lock = MUTEX_UNLOCKED; -#endif - return 0; -} - - -int -ath_mutex_destroy (ath_mutex_t *lock) -{ -#ifndef NDEBUG - assert (*lock == MUTEX_UNLOCKED); - - *lock = MUTEX_DESTROYED; -#endif - return 0; -} - - -int -ath_mutex_lock (ath_mutex_t *lock) -{ -#ifndef NDEBUG - assert (*lock == MUTEX_UNLOCKED); - - *lock = MUTEX_LOCKED; -#endif - return 0; -} - - -int -ath_mutex_unlock (ath_mutex_t *lock) -{ -#ifndef NDEBUG - assert (*lock == MUTEX_LOCKED); - - *lock = MUTEX_UNLOCKED; -#endif - return 0; -} - - gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes) { diff -Nru gpgme1.0-1.7.0/src/ath.h gpgme1.0-1.8.0/src/ath.h --- gpgme1.0-1.7.0/src/ath.h 2013-05-31 11:37:05.000000000 +0000 +++ gpgme1.0-1.8.0/src/ath.h 2016-11-16 12:23:14.000000000 +0000 @@ -60,10 +60,6 @@ #define _ATH_PREFIX1(x,y) x ## y #define _ATH_PREFIX2(x,y) _ATH_PREFIX1(x,y) #define _ATH_PREFIX(x) _ATH_PREFIX2(_ATH_EXT_SYM_PREFIX,x) -#define ath_mutex_init _ATH_PREFIX(ath_mutex_init) -#define ath_mutex_destroy _ATH_PREFIX(ath_mutex_destroy) -#define ath_mutex_lock _ATH_PREFIX(ath_mutex_lock) -#define ath_mutex_unlock _ATH_PREFIX(ath_mutex_unlock) #define ath_read _ATH_PREFIX(ath_read) #define ath_write _ATH_PREFIX(ath_write) #define ath_select _ATH_PREFIX(ath_select) @@ -75,17 +71,8 @@ #endif -typedef void *ath_mutex_t; -#define ATH_MUTEX_INITIALIZER 0; - uintptr_t ath_self (void); -/* Functions for mutual exclusion. */ -int ath_mutex_init (ath_mutex_t *mutex); -int ath_mutex_destroy (ath_mutex_t *mutex); -int ath_mutex_lock (ath_mutex_t *mutex); -int ath_mutex_unlock (ath_mutex_t *mutex); - /* Replacement for the POSIX functions, which can be used to allow other (user-level) threads to run. */ gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes); diff -Nru gpgme1.0-1.7.0/src/ath-pthread.c gpgme1.0-1.8.0/src/ath-pthread.c --- gpgme1.0-1.7.0/src/ath-pthread.c 2013-05-31 11:37:05.000000000 +0000 +++ gpgme1.0-1.8.0/src/ath-pthread.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -/* ath-pthread.c - pthread module for self-adapting thread-safeness library - Copyright (C) 2002, 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. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_SYS_SELECT_H -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# endif -#endif -#include -#include - -#include - -#include "gpgme.h" - -#include "ath.h" - - -/* The lock we take while checking for lazy lock initialization. */ -static pthread_mutex_t check_init_lock = PTHREAD_MUTEX_INITIALIZER; - -/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if - it is not already initialized. */ -static int -mutex_pthread_init (ath_mutex_t *priv, int just_check) -{ - int err = 0; - - if (just_check) - pthread_mutex_lock (&check_init_lock); - if (!*priv || !just_check) - { - pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t)); - if (!lock) - err = ENOMEM; - if (!err) - { - err = pthread_mutex_init (lock, NULL); - if (err) - free (lock); - else - *priv = (ath_mutex_t) lock; - } - } - if (just_check) - pthread_mutex_unlock (&check_init_lock); - return err; -} - - -void -ath_init (void) -{ - /* Nothing to do. */ -} - - -uintptr_t -ath_self (void) -{ - return (uintptr_t) pthread_self (); -} - - -int -ath_mutex_init (ath_mutex_t *lock) -{ - return mutex_pthread_init (lock, 0); -} - - -int -ath_mutex_destroy (ath_mutex_t *lock) -{ - int err = mutex_pthread_init (lock, 1); - if (!err) - { - err = pthread_mutex_destroy ((pthread_mutex_t *) *lock); - free (*lock); - } - return err; -} - - -int -ath_mutex_lock (ath_mutex_t *lock) -{ - int ret = mutex_pthread_init (lock, 1); - if (ret) - return ret; - - return pthread_mutex_lock ((pthread_mutex_t *) *lock); -} - - -int -ath_mutex_unlock (ath_mutex_t *lock) -{ - int ret = mutex_pthread_init (lock, 1); - if (ret) - return ret; - - return pthread_mutex_unlock ((pthread_mutex_t *) *lock); -} - - -gpgme_ssize_t -ath_read (int fd, void *buf, size_t nbytes) -{ - return read (fd, buf, nbytes); -} - - -gpgme_ssize_t -ath_write (int fd, const void *buf, size_t nbytes) -{ - return write (fd, buf, nbytes); -} - - -gpgme_ssize_t -ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, - struct timeval *timeout) -{ - return select (nfd, rset, wset, eset, timeout); -} - - -gpgme_ssize_t -ath_waitpid (pid_t pid, int *status, int options) -{ - return waitpid (pid, status, options); -} - - -int -ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr) -{ - return accept (s, addr, length_ptr); -} - - -int -ath_connect (int s, const struct sockaddr *addr, socklen_t length) -{ - return connect (s, addr, length); -} - -int -ath_sendmsg (int s, const struct msghdr *msg, int flags) -{ - return sendmsg (s, msg, flags); -} - - -int -ath_recvmsg (int s, struct msghdr *msg, int flags) -{ - return recvmsg (s, msg, flags); -} diff -Nru gpgme1.0-1.7.0/src/b64dec.c gpgme1.0-1.8.0/src/b64dec.c --- gpgme1.0-1.7.0/src/b64dec.c 2016-06-23 08:15:23.000000000 +0000 +++ gpgme1.0-1.8.0/src/b64dec.c 2016-11-16 12:22:41.000000000 +0000 @@ -12,10 +12,10 @@ * 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 . + * along with this program; if not, see . */ #include diff -Nru gpgme1.0-1.7.0/src/context.h gpgme1.0-1.8.0/src/context.h --- gpgme1.0-1.7.0/src/context.h 2016-09-14 17:41:56.000000000 +0000 +++ gpgme1.0-1.8.0/src/context.h 2016-11-16 12:23:14.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifndef CONTEXT_H @@ -38,7 +38,8 @@ OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE, OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT, OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN, OPDATA_VFS_MOUNT, - OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY + OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY, + OPDATA_QUERY_SWDB } ctx_op_data_id_t; @@ -110,6 +111,9 @@ * unmodified string, as received form gpg, will be returned. */ unsigned int raw_description : 1; + /* True if session keys should be exported upon decryption. */ + unsigned int export_session_keys : 1; + /* Flags for keylist mode. */ gpgme_keylist_mode_t keylist_mode; @@ -119,16 +123,21 @@ /* Number of certs to be included. */ unsigned int include_certs; - /* The number of keys in signers. */ + /* The actual number of keys in SIGNERS, the allocated size of the + * array, and the array with the signing keys. */ unsigned int signers_len; - - /* Size of the following array. */ unsigned int signers_size; gpgme_key_t *signers; /* The signature notations for this context. */ gpgme_sig_notation_t sig_notations; + /* The sender's addr-spec or NULL. */ + char *sender; + + /* The gpg specific override session key or NULL. */ + char *override_session_key; + /* The locale for the pinentry. */ char *lc_ctype; char *lc_messages; diff -Nru gpgme1.0-1.7.0/src/conversion.c gpgme1.0-1.8.0/src/conversion.c --- gpgme1.0-1.7.0/src/conversion.c 2016-08-23 04:25:17.000000000 +0000 +++ gpgme1.0-1.8.0/src/conversion.c 2016-11-16 12:22:41.000000000 +0000 @@ -31,6 +31,7 @@ #endif #include #include +#include #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 -Nru gpgme1.0-1.7.0/src/data-identify.c gpgme1.0-1.8.0/src/data-identify.c --- gpgme1.0-1.7.0/src/data-identify.c 2016-09-13 17:23:35.000000000 +0000 +++ gpgme1.0-1.8.0/src/data-identify.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H @@ -278,7 +278,7 @@ /* 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 -Nru gpgme1.0-1.7.0/src/decrypt.c gpgme1.0-1.8.0/src/decrypt.c --- gpgme1.0-1.7.0/src/decrypt.c 2016-07-13 12:32:38.000000000 +0000 +++ gpgme1.0-1.8.0/src/decrypt.c 2016-11-16 12:22:41.000000000 +0000 @@ -63,6 +63,9 @@ if (opd->result.file_name) free (opd->result.file_name); + if (opd->result.session_key) + free (opd->result.session_key); + while (recipient) { gpgme_recipient_t next = recipient->next; @@ -277,6 +280,12 @@ opd->last_recipient_p = &(*opd->last_recipient_p)->next; break; + case GPGME_STATUS_SESSION_KEY: + if (opd->result.session_key) + free (opd->result.session_key); + opd->result.session_key = strdup(args); + break; + case GPGME_STATUS_NO_SECKEY: { gpgme_recipient_t rec = opd->result.recipients; @@ -351,7 +360,7 @@ static gpgme_error_t decrypt_start (gpgme_ctx_t ctx, int synchronous, - gpgme_data_t cipher, gpgme_data_t plain) + gpgme_data_t cipher, gpgme_data_t plain) { gpgme_error_t err; @@ -381,7 +390,9 @@ _gpgme_engine_set_status_handler (ctx->engine, decrypt_status_handler, ctx); - return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain); + return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain, + ctx->export_session_keys, + ctx->override_session_key); } diff -Nru gpgme1.0-1.7.0/src/decrypt-verify.c gpgme1.0-1.8.0/src/decrypt-verify.c --- gpgme1.0-1.7.0/src/decrypt-verify.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/src/decrypt-verify.c 2016-11-16 12:22:41.000000000 +0000 @@ -77,7 +77,9 @@ _gpgme_engine_set_status_handler (ctx->engine, decrypt_verify_status_handler, ctx); - return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain); + return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain, + ctx->export_session_keys, + ctx->override_session_key); } diff -Nru gpgme1.0-1.7.0/src/dirinfo.c gpgme1.0-1.8.0/src/dirinfo.c --- gpgme1.0-1.7.0/src/dirinfo.c 2016-09-13 17:51:39.000000000 +0000 +++ gpgme1.0-1.8.0/src/dirinfo.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/engine-assuan.c gpgme1.0-1.8.0/src/engine-assuan.c --- gpgme1.0-1.7.0/src/engine-assuan.c 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-assuan.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* @@ -796,6 +796,7 @@ llass_transact, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ llass_set_io_cbs, llass_io_event, llass_cancel, diff -Nru gpgme1.0-1.7.0/src/engine-backend.h gpgme1.0-1.8.0/src/engine-backend.h --- gpgme1.0-1.7.0/src/engine-backend.h 2016-09-14 17:50:06.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-backend.h 2016-11-16 12:23:14.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #ifndef ENGINE_BACKEND_H @@ -62,9 +62,11 @@ gpgme_error_t (*set_locale) (void *engine, int category, const char *value); gpgme_error_t (*set_protocol) (void *engine, gpgme_protocol_t protocol); gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, int export_session_key, + const char *override_session_key); gpgme_error_t (*decrypt_verify) (void *engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, int export_session_key, + const char *override_session_key); gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret); gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key, gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */); @@ -111,7 +113,8 @@ gpgme_ctx_t ctx /* FIXME */); gpgme_error_t (*trustlist) (void *engine, const char *pattern); gpgme_error_t (*verify) (void *engine, gpgme_data_t sig, - gpgme_data_t signed_text, gpgme_data_t plaintext); + gpgme_data_t signed_text, gpgme_data_t plaintext, + gpgme_ctx_t ctx); gpgme_error_t (*getauditlog) (void *engine, gpgme_data_t output, unsigned int flags); gpgme_error_t (*opassuan_transact) (void *engine, @@ -126,6 +129,10 @@ gpgme_error_t (*conf_load) (void *engine, gpgme_conf_comp_t *conf_p); gpgme_error_t (*conf_save) (void *engine, gpgme_conf_comp_t conf); + gpgme_error_t (*query_swdb) (void *engine, + const char *name, const char *iversion, + gpgme_query_swdb_result_t result); + void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs); void (*io_event) (void *engine, gpgme_event_io_t type, void *type_data); diff -Nru gpgme1.0-1.7.0/src/engine.c gpgme1.0-1.8.0/src/engine.c --- gpgme1.0-1.7.0/src/engine.c 2016-09-14 17:50:28.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine.c 2016-11-16 12:22:41.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H @@ -653,7 +653,8 @@ gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain) + gpgme_data_t plain, int export_session_key, + const char *override_session_key) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -661,13 +662,15 @@ if (!engine->ops->decrypt) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->decrypt) (engine->engine, ciph, plain); + return (*engine->ops->decrypt) (engine->engine, ciph, plain, + export_session_key, override_session_key); } gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain) + gpgme_data_t plain, int export_session_key, + const char *override_session_key) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -675,7 +678,9 @@ if (!engine->ops->decrypt_verify) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain); + return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain, + export_session_key, + override_session_key); } @@ -902,7 +907,8 @@ gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig, - gpgme_data_t signed_text, gpgme_data_t plaintext) + gpgme_data_t signed_text, gpgme_data_t plaintext, + gpgme_ctx_t ctx) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -910,7 +916,8 @@ if (!engine->ops->verify) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->verify) (engine->engine, sig, signed_text, plaintext); + return (*engine->ops->verify) (engine->engine, sig, signed_text, plaintext, + ctx); } @@ -978,6 +985,21 @@ } +gpgme_error_t +_gpgme_engine_op_query_swdb (engine_t engine, + const char *name, const char *iversion, + gpgme_query_swdb_result_t result) +{ + if (!engine) + return gpg_error (GPG_ERR_INV_VALUE); + + if (!engine->ops->query_swdb) + return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + + return (*engine->ops->query_swdb) (engine->engine, name, iversion, result); +} + + void _gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs) { diff -Nru gpgme1.0-1.7.0/src/engine-g13.c gpgme1.0-1.8.0/src/engine-g13.c --- gpgme1.0-1.7.0/src/engine-g13.c 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-g13.c 2016-11-16 12:22:41.000000000 +0000 @@ -811,6 +811,7 @@ g13_transact, NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ g13_set_io_cbs, g13_io_event, g13_cancel, diff -Nru gpgme1.0-1.7.0/src/engine-gpg.c gpgme1.0-1.8.0/src/engine-gpg.c --- gpgme1.0-1.7.0/src/engine-gpg.c 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-gpg.c 2016-11-16 12:22:41.000000000 +0000 @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H @@ -139,6 +139,9 @@ struct gpgme_io_cbs io_cbs; gpgme_pinentry_mode_t pinentry_mode; + + /* NULL or the data object fed to --override_session_key-fd. */ + gpgme_data_t override_session_key; }; typedef struct engine_gpg *engine_gpg_t; @@ -441,6 +444,8 @@ if (gpg->cmd.keyword) free (gpg->cmd.keyword); + gpgme_data_release (gpg->override_session_key); + free (gpg); } @@ -544,6 +549,8 @@ 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; @@ -1548,13 +1555,45 @@ static gpgme_error_t -gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { engine_gpg_t gpg = engine; gpgme_error_t err; err = add_arg (gpg, "--decrypt"); + if (!err && export_session_key) + err = add_arg (gpg, "--show-session-key"); + + if (!err && override_session_key && *override_session_key) + { + if (have_gpg_version (gpg, "2.1.16")) + { + gpgme_data_release (gpg->override_session_key); + TRACE2 (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n", + override_session_key, + strlen (override_session_key)); + + err = gpgme_data_new_from_mem (&gpg->override_session_key, + override_session_key, + strlen (override_session_key), 1); + if (!err) + { + err = add_arg (gpg, "--override-session-key-fd"); + if (!err) + err = add_data (gpg, gpg->override_session_key, -2, 0); + } + } + else + { + /* Using that option may leak the session key via ps(1). */ + err = add_arg (gpg, "--override-session-key"); + if (!err) + err = add_arg (gpg, override_session_key); + } + } + /* Tell the gpg object about the data. */ if (!err) err = add_arg (gpg, "--output"); @@ -1644,6 +1683,23 @@ static gpgme_error_t +append_args_from_sender (engine_gpg_t gpg, gpgme_ctx_t ctx) +{ + gpgme_error_t err; + + if (ctx->sender && have_gpg_version (gpg, "2.1.15")) + { + err = add_arg (gpg, "--sender"); + if (!err) + err = add_arg (gpg, ctx->sender); + } + else + err = 0; + return err; +} + + +static gpgme_error_t append_args_from_sig_notations (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */) { gpgme_error_t err = 0; @@ -1891,6 +1947,9 @@ err = append_args_from_signers (gpg, ctx); if (!err) + err = append_args_from_sender (gpg, ctx); + + if (!err) err = append_args_from_sig_notations (gpg, ctx); /* Tell the gpg object about the data. */ @@ -2541,7 +2600,7 @@ 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) @@ -2792,6 +2851,8 @@ if (!err) err = append_args_from_signers (gpg, ctx); if (!err) + err = append_args_from_sender (gpg, ctx); + if (!err) err = append_args_from_sig_notations (gpg, ctx); if (gpgme_data_get_file_name (in)) @@ -2843,12 +2904,15 @@ static gpgme_error_t gpg_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text, - gpgme_data_t plaintext) + gpgme_data_t plaintext, gpgme_ctx_t ctx) { engine_gpg_t gpg = engine; - gpgme_error_t err = 0; + gpgme_error_t err; - if (plaintext) + err = append_args_from_sender (gpg, ctx); + if (err) + ; + else if (plaintext) { /* Normal or cleartext signature. */ err = add_arg (gpg, "--output"); @@ -2942,6 +3006,7 @@ NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ gpg_set_io_cbs, gpg_io_event, gpg_cancel, diff -Nru gpgme1.0-1.7.0/src/engine-gpgconf.c gpgme1.0-1.8.0/src/engine-gpgconf.c --- gpgme1.0-1.7.0/src/engine-gpgconf.c 2016-09-14 17:51:21.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-gpgconf.c 2016-11-16 12:22:41.000000000 +0000 @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H @@ -47,16 +47,26 @@ #include "engine-backend.h" + struct engine_gpgconf { char *file_name; char *home_dir; + char *version; }; typedef struct engine_gpgconf *engine_gpgconf_t; +/* Return true if the engine's version is at least VERSION. */ +static int +have_gpgconf_version (engine_gpgconf_t gpgconf, const char *version) +{ + return _gpgme_compare_versions (gpgconf->version, version); +} + + static char * gpgconf_get_version (const char *file_name) { @@ -84,6 +94,8 @@ free (gpgconf->file_name); if (gpgconf->home_dir) free (gpgconf->home_dir); + if (gpgconf->version) + free (gpgconf->version); free (gpgconf); } @@ -96,8 +108,6 @@ gpgme_error_t err = 0; engine_gpgconf_t gpgconf; - (void)version; /* Not yet used. */ - gpgconf = calloc (1, sizeof *gpgconf); if (!gpgconf) return gpg_error_from_syserror (); @@ -114,6 +124,13 @@ err = gpg_error_from_syserror (); } + if (!err && version) + { + gpgconf->version = strdup (version); + if (!gpgconf->version) + err = gpg_error_from_syserror (); + } + if (err) gpgconf_release (gpgconf); else @@ -209,7 +226,8 @@ char *linebuf; size_t linebufsize; int linelen; - char *argv[4] = { NULL /* file_name */, NULL, NULL, NULL }; + char *argv[6]; + int argc = 0; int rp[2]; struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0}, {-1, -1} }; @@ -217,14 +235,19 @@ int nread; char *mark = NULL; - argv[1] = (char*)arg1; - argv[2] = arg2; - + /* _gpgme_engine_new guarantees that this is not NULL. */ + argv[argc++] = gpgconf->file_name; - /* FIXME: Deal with engine->home_dir. */ + if (gpgconf->home_dir && have_gpgconf_version (gpgconf, "2.1.13")) + { + argv[argc++] = (char*)"--homedir"; + argv[argc++] = gpgconf->home_dir; + } - /* _gpgme_engine_new guarantees that this is not NULL. */ - argv[0] = gpgconf->file_name; + argv[argc++] = (char*)arg1; + argv[argc++] = arg2; + argv[argc] = NULL; + assert (argc < DIM (argv)); if (_gpgme_io_pipe (rp, 1) < 0) return gpg_error_from_syserror (); @@ -685,16 +708,26 @@ #define BUFLEN 1024 char buf[BUFLEN]; int buflen = 0; - char *argv[] = { NULL /* file_name */, (char*)arg1, arg2, 0 }; + char *argv[6]; + int argc = 0; int rp[2]; struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, {-1, -1} }; int status; int nwrite; - /* FIXME: Deal with engine->home_dir. */ - /* _gpgme_engine_new guarantees that this is not NULL. */ - argv[0] = gpgconf->file_name; + argv[argc++] = gpgconf->file_name; + + if (gpgconf->home_dir && have_gpgconf_version (gpgconf, "2.1.13")) + { + argv[argc++] = (char*)"--homedir"; + argv[argc++] = gpgconf->home_dir; + } + + argv[argc++] = (char*)arg1; + argv[argc++] = arg2; + argv[argc] = NULL; + assert (argc < DIM (argv)); if (_gpgme_io_pipe (rp, 0) < 0) return gpg_error_from_syserror (); @@ -909,6 +942,217 @@ } +/* Parse a line received from gpgconf --query-swdb. This function may + * modify LINE. The result is stored at RESUL. */ +static gpg_error_t +parse_swdb_line (char *line, gpgme_query_swdb_result_t result) +{ + char *field[9]; + int fields = 0; + gpg_err_code_t ec; + + while (line && fields < DIM (field)) + { + field[fields++] = line; + line = strchr (line, ':'); + if (line) + *line++ = 0; + } + /* We require that all fields exists - gpgme emits all these fields + * even on error. They might be empty, though. */ + if (fields < 9) + return gpg_error (GPG_ERR_INV_ENGINE); + + free (result->name); + result->name = strdup (field[0]); + if (!result->name) + return gpg_error_from_syserror (); + + free (result->iversion); + result->iversion = strdup (field[1]); + if (!result->iversion) + return gpg_error_from_syserror (); + + result->urgent = (strtol (field[3], NULL, 10) > 0); + + ec = gpg_err_code (strtoul (field[4], NULL, 10)); + + result->created = _gpgme_parse_timestamp (field[5], NULL); + result->retrieved= _gpgme_parse_timestamp (field[6], NULL); + + free (result->version); + result->version = strdup (field[7]); + if (!result->version) + return gpg_error_from_syserror (); + + result->reldate = _gpgme_parse_timestamp (field[8], NULL); + + /* Set other flags. */ + result->warning = !!ec; + result->update = 0; + result->noinfo = 0; + result->unknown = 0; + result->tooold = 0; + result->error = 0; + + switch (*field[2]) + { + case '-': result->warning = 1; break; + case '?': result->unknown = result->warning = 1; break; + case 'u': result->update = 1; break; + case 'c': break; + case 'n': break; + default: + result->warning = 1; + if (!ec) + ec = GPG_ERR_INV_ENGINE; + break; + } + + if (ec == GPG_ERR_TOO_OLD) + result->tooold = 1; + else if (ec == GPG_ERR_ENOENT) + result->noinfo = 1; + else if (ec) + result->error = 1; + + + return 0; +} + + +static gpgme_error_t +gpgconf_query_swdb (void *engine, + const char *name, const char *iversion, + gpgme_query_swdb_result_t result) +{ + struct engine_gpgconf *gpgconf = engine; + gpgme_error_t err = 0; + char *linebuf; + size_t linebufsize; + int linelen; + char *argv[7]; + int argc = 0; + int rp[2]; + struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0}, + {-1, -1} }; + int status; + int nread; + char *mark = NULL; + + if (!have_gpgconf_version (gpgconf, "2.1.16")) + return gpg_error (GPG_ERR_ENGINE_TOO_OLD); + + /* _gpgme_engine_new guarantees that this is not NULL. */ + argv[argc++] = gpgconf->file_name; + + if (gpgconf->home_dir) + { + argv[argc++] = (char*)"--homedir"; + argv[argc++] = gpgconf->home_dir; + } + + argv[argc++] = (char*)"--query-swdb"; + argv[argc++] = (char*)name; + argv[argc++] = (char*)iversion; + argv[argc] = NULL; + assert (argc < DIM (argv)); + + if (_gpgme_io_pipe (rp, 1) < 0) + return gpg_error_from_syserror (); + + cfd[0].fd = rp[1]; + + status = _gpgme_io_spawn (gpgconf->file_name, argv, + IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL); + if (status < 0) + { + _gpgme_io_close (rp[0]); + _gpgme_io_close (rp[1]); + return gpg_error_from_syserror (); + } + + linebufsize = 2048; /* Same as used by gpgconf. */ + linebuf = malloc (linebufsize); + if (!linebuf) + { + err = gpg_error_from_syserror (); + goto leave; + } + linelen = 0; + + while ((nread = _gpgme_io_read (rp[0], linebuf + linelen, + linebufsize - linelen - 1))) + { + char *line; + const char *lastmark = NULL; + size_t nused; + + if (nread < 0) + { + err = gpg_error_from_syserror (); + goto leave; + } + + linelen += nread; + linebuf[linelen] = '\0'; + + for (line=linebuf; (mark = strchr (line, '\n')); line = mark+1 ) + { + lastmark = mark; + if (mark > line && mark[-1] == '\r') + mark[-1] = '\0'; + else + mark[0] = '\0'; + + /* Got a full line. Due to the CR removal code (which + occurs only on Windows) we might be one-off and thus + would see empty lines. */ + if (*line) + { + err = parse_swdb_line (line, result); + goto leave; /* Ready. */ + } + else /* empty line. */ + err = 0; + } + + nused = lastmark? (lastmark + 1 - linebuf) : 0; + memmove (linebuf, linebuf + nused, linelen - nused); + linelen -= nused; + + if (!(linelen < linebufsize - 1)) + { + char *newlinebuf; + + if (linelen < 8 * 1024 - 1) + linebufsize = 8 * 1024; + else if (linelen < 64 * 1024 - 1) + linebufsize = 64 * 1024; + else + { + /* We reached our limit - give up. */ + err = gpg_error (GPG_ERR_LINE_TOO_LONG); + goto leave; + } + + newlinebuf = realloc (linebuf, linebufsize); + if (!newlinebuf) + { + err = gpg_error_from_syserror (); + goto leave; + } + linebuf = newlinebuf; + } + } + + leave: + free (linebuf); + _gpgme_io_close (rp[0]); + return err; +} + + static void gpgconf_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs) { @@ -966,6 +1210,7 @@ NULL, /* opassuan_transact */ gpgconf_conf_load, gpgconf_conf_save, + gpgconf_query_swdb, gpgconf_set_io_cbs, NULL, /* io_event */ NULL, /* cancel */ diff -Nru gpgme1.0-1.7.0/src/engine-gpgsm.c gpgme1.0-1.8.0/src/engine-gpgsm.c --- gpgme1.0-1.7.0/src/engine-gpgsm.c 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-gpgsm.c 2016-11-16 12:22:41.000000000 +0000 @@ -1120,11 +1120,17 @@ static gpgme_error_t -gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err; + /* gpgsm is not capable of exporting session keys right now, so we + * will ignore this if requested. */ + (void)export_session_key; + (void)override_session_key; + if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); @@ -1901,11 +1907,13 @@ static gpgme_error_t gpgsm_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text, - gpgme_data_t plaintext) + gpgme_data_t plaintext, gpgme_ctx_t ctx) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err; + (void)ctx; + if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); @@ -2099,6 +2107,7 @@ NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ gpgsm_set_io_cbs, gpgsm_io_event, gpgsm_cancel, diff -Nru gpgme1.0-1.7.0/src/engine.h gpgme1.0-1.8.0/src/engine.h --- gpgme1.0-1.7.0/src/engine.h 2016-09-14 17:49:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine.h 2016-11-16 12:23:14.000000000 +0000 @@ -83,10 +83,15 @@ engine_colon_line_handler_t fnc, void *fnc_value); gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, + int export_session_key, + const char *override_session_key); gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, + int export_session_key, + const char *override_session_key + ); gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key, int allow_secret); gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type, @@ -152,7 +157,8 @@ const char *pattern); gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig, gpgme_data_t signed_text, - gpgme_data_t plaintext); + gpgme_data_t plaintext, + gpgme_ctx_t ctx); gpgme_error_t _gpgme_engine_op_getauditlog (engine_t engine, gpgme_data_t output, @@ -172,6 +178,12 @@ gpgme_error_t _gpgme_engine_op_conf_save (engine_t engine, gpgme_conf_comp_t conf); +gpgme_error_t _gpgme_engine_op_query_swdb (engine_t engine, + const char *name, + const char *iversion, + gpgme_query_swdb_result_t result); + + void _gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs); void _gpgme_engine_io_event (engine_t engine, diff -Nru gpgme1.0-1.7.0/src/engine-spawn.c gpgme1.0-1.8.0/src/engine-spawn.c --- gpgme1.0-1.7.0/src/engine-spawn.c 2016-09-14 17:51:37.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-spawn.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H @@ -469,6 +469,7 @@ NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ engspawn_set_io_cbs, engspawn_io_event, /* io_event */ engspawn_cancel, /* cancel */ diff -Nru gpgme1.0-1.7.0/src/engine-uiserver.c gpgme1.0-1.8.0/src/engine-uiserver.c --- gpgme1.0-1.7.0/src/engine-uiserver.c 2016-09-19 06:35:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/engine-uiserver.c 2016-11-16 12:22:41.000000000 +0000 @@ -960,13 +960,17 @@ static gpgme_error_t _uiserver_decrypt (void *engine, int verify, - gpgme_data_t ciph, gpgme_data_t plain) + gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { engine_uiserver_t uiserver = engine; gpgme_error_t err; const char *protocol; char *cmd; + (void)override_session_key; /* Fixme: We need to see now to add this + * to the UI server protocol */ + if (!uiserver) return gpg_error (GPG_ERR_INV_VALUE); if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT) @@ -978,8 +982,9 @@ else return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); - if (asprintf (&cmd, "DECRYPT%s%s", protocol, - verify ? "" : " --no-verify") < 0) + if (asprintf (&cmd, "DECRYPT%s%s%s", protocol, + verify ? "" : " --no-verify", + export_session_key ? " --export-session-key" : "") < 0) return gpg_error_from_syserror (); uiserver->input_cb.data = ciph; @@ -1006,16 +1011,21 @@ static gpgme_error_t -uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { - return _uiserver_decrypt (engine, 0, ciph, plain); + return _uiserver_decrypt (engine, 0, ciph, plain, + export_session_key, override_session_key); } static gpgme_error_t -uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, + const char *override_session_key) { - return _uiserver_decrypt (engine, 1, ciph, plain); + return _uiserver_decrypt (engine, 1, ciph, plain, + export_session_key, override_session_key); } @@ -1243,13 +1253,16 @@ /* FIXME: Missing a way to specify --silent. */ static gpgme_error_t uiserver_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text, - gpgme_data_t plaintext) + gpgme_data_t plaintext, gpgme_ctx_t ctx) { engine_uiserver_t uiserver = engine; gpgme_error_t err; const char *protocol; char *cmd; + (void)ctx; /* FIXME: We should to add a --sender option to the + * UISever protocol. */ + if (!uiserver) return gpg_error (GPG_ERR_INV_VALUE); if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT) @@ -1390,11 +1403,12 @@ NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ uiserver_set_io_cbs, uiserver_io_event, uiserver_cancel, NULL, /* cancel_op */ NULL, /* passwd */ - NULL, /* set_pinentry_mode */ + NULL, /* set_pinentry_mode */ NULL /* opspawn */ }; diff -Nru gpgme1.0-1.7.0/src/export.c gpgme1.0-1.8.0/src/export.c --- gpgme1.0-1.7.0/src/export.c 2016-09-13 16:59:10.000000000 +0000 +++ gpgme1.0-1.8.0/src/export.c 2016-11-16 12:22:41.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/genkey.c gpgme1.0-1.8.0/src/genkey.c --- gpgme1.0-1.7.0/src/genkey.c 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/src/genkey.c 2016-11-16 12:22:41.000000000 +0000 @@ -15,7 +15,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/getauditlog.c gpgme1.0-1.8.0/src/getauditlog.c --- gpgme1.0-1.7.0/src/getauditlog.c 2016-09-13 17:23:35.000000000 +0000 +++ gpgme1.0-1.8.0/src/getauditlog.c 2016-11-16 12:22:41.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/gpgconf.c gpgme1.0-1.8.0/src/gpgconf.c --- gpgme1.0-1.7.0/src/gpgconf.c 2014-07-30 09:40:16.000000000 +0000 +++ gpgme1.0-1.8.0/src/gpgconf.c 2016-11-16 12:22:41.000000000 +0000 @@ -65,7 +65,7 @@ } -/* Public function to release load a configuration list. No +/* Public function to load a configuration list. No asynchronous interface for now. */ gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p) @@ -108,5 +108,3 @@ ctx->protocol = proto; return err; } - - diff -Nru gpgme1.0-1.7.0/src/gpgme.c gpgme1.0-1.8.0/src/gpgme.c --- gpgme1.0-1.7.0/src/gpgme.c 2016-08-21 12:29:55.000000000 +0000 +++ gpgme1.0-1.8.0/src/gpgme.c 2016-11-16 12:22:41.000000000 +0000 @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H @@ -38,6 +38,7 @@ #include "debug.h" #include "priv-io.h" #include "sys-util.h" +#include "mbox-util.h" /* The default locale. */ @@ -84,39 +85,6 @@ } -/* Set the flag NAME for CTX to VALUE. The supported flags are: - * - * - full-status :: With a value of "1" the status callback set by - * gpgme_set_status_cb returns all status lines - * except for PROGRESS lines. With the default of - * "0" the status callback is only called in certain - * situations. - */ -gpgme_error_t -gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) -{ - int abool; - - if (!ctx || !name || !value) - return gpg_error (GPG_ERR_INV_VALUE); - - abool = *value? !!atoi (value) : 0; - - if (!strcmp (name, "full-status")) - { - ctx->full_status = abool; - } - else if (!strcmp (name, "raw-description")) - { - ctx->raw_description = abool; - } - else - return gpg_error (GPG_ERR_UNKNOWN_NAME); - - return 0; -} - - /* Create a new context as an environment for GPGME crypto operations. */ @@ -275,12 +243,11 @@ _gpgme_release_result (ctx); _gpgme_signers_clear (ctx); _gpgme_sig_notation_clear (ctx); - if (ctx->signers) - free (ctx->signers); - if (ctx->lc_ctype) - free (ctx->lc_ctype); - if (ctx->lc_messages) - free (ctx->lc_messages); + free (ctx->sender); + free (ctx->signers); + free (ctx->lc_ctype); + free (ctx->lc_messages); + free (ctx->override_session_key); _gpgme_engine_info_release (ctx->engine_info); ctx->engine_info = NULL; DESTROY_LOCK (ctx->lock); @@ -459,6 +426,42 @@ } } + +/* Store the sender's address in the context. ADDRESS is addr-spec of + * mailbox but my also be a complete mailbox, in which case this + * function extracts the addr-spec from it. Returns 0 on success or + * an error code if no valid addr-spec could be extracted from + * ADDRESS. */ +gpgme_error_t +gpgme_set_sender (gpgme_ctx_t ctx, const char *address) +{ + char *p = NULL; + + TRACE_BEG1 (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'", + address?address:"(null)"); + + if (!ctx || (address && !(p = _gpgme_mailbox_from_userid (address)))) + return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); + + free (ctx->sender); + ctx->sender = p; + return TRACE_ERR (0); +} + + +/* Return the sender's address (addr-spec part) from the context or + * NULL if none was set. The returned value is valid as long as the + * CTX is valid and gpgme_set_sender has not been used. */ +const char * +gpgme_get_sender (gpgme_ctx_t ctx) +{ + TRACE1 (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'", + ctx?ctx->sender:""); + + return ctx->sender; +} + + /* Enable or disable the use of an ascii armor for all output. */ void gpgme_set_armor (gpgme_ctx_t ctx, int use_armor) @@ -469,7 +472,7 @@ if (!ctx) return; - ctx->use_armor = use_armor; + ctx->use_armor = !!use_armor; } @@ -483,6 +486,85 @@ } +/* Set the flag NAME for CTX to VALUE. The supported flags are: + * + * - full-status :: With a value of "1" the status callback set by + * gpgme_set_status_cb returns all status lines + * except for PROGRESS lines. With the default of + * "0" the status callback is only called in certain + * situations. + */ +gpgme_error_t +gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) +{ + gpgme_error_t err = 0; + int abool; + + TRACE2 (DEBUG_CTX, "gpgme_set_ctx_flag", ctx, + "name='%s' value='%s'", + name? name:"(null)", value?value:"(null)"); + + abool = (value && *value)? !!atoi (value) : 0; + + if (!ctx || !name || !value) + err = gpg_error (GPG_ERR_INV_VALUE); + else if (!strcmp (name, "full-status")) + { + ctx->full_status = abool; + } + else if (!strcmp (name, "raw-description")) + { + ctx->raw_description = abool; + } + else if (!strcmp (name, "export-session-key")) + { + ctx->export_session_keys = abool; + } + else if (!strcmp (name, "override-session-key")) + { + free (ctx->override_session_key); + ctx->override_session_key = strdup (value); + if (!ctx->override_session_key) + err = gpg_error_from_syserror (); + } + else + err = gpg_error (GPG_ERR_UNKNOWN_NAME); + + return err; +} + + +/* Get the context flag named NAME. See gpgme_set_ctx_flag for a list + * of valid names. If the NAME is unknown NULL is returned. For a + * boolean flag an empty string is returned for False and the string + * "1" for True; thus either atoi or a simple string test can be + * used. */ +const char * +gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) +{ + if (!ctx || !name) + return NULL; + else if (!strcmp (name, "full-status")) + { + return ctx->full_status? "1":""; + } + else if (!strcmp (name, "raw-description")) + { + return ctx->raw_description? "1":""; + } + else if (!strcmp (name, "export-session-key")) + { + return ctx->export_session_keys? "1":""; + } + else if (!strcmp (name, "override-session-key")) + { + return ctx->override_session_key? ctx->override_session_key : ""; + } + else + return NULL; +} + + /* Enable or disable the use of the special textmode. Textmode is for example used for the RFC2015 signatures; note that the updated RFC 3156 mandates that the MUA does some preparations so that textmode @@ -496,7 +578,7 @@ if (!ctx) return; - ctx->use_textmode = use_textmode; + ctx->use_textmode = !!use_textmode; } /* Return the state of the textmode flag. */ @@ -520,7 +602,7 @@ if (!ctx) return; - ctx->offline = offline; + ctx->offline = !!offline; } /* Return the state of the offline flag. */ diff -Nru gpgme1.0-1.7.0/src/gpgme-config.in gpgme1.0-1.8.0/src/gpgme-config.in --- gpgme1.0-1.7.0/src/gpgme-config.in 2016-08-21 13:56:00.000000000 +0000 +++ gpgme1.0-1.8.0/src/gpgme-config.in 2016-11-10 16:13:34.000000000 +0000 @@ -32,7 +32,9 @@ # Configure thread packages. thread_modules="" -@HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread" +# For compatibility we keep proving the +# thread modules variable. +thread_modules="$thread_modules pthread" libs_pthread="-lpthread" cflags_pthread="" @@ -50,7 +52,6 @@ cat <. + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/gpgme-w32spawn.c gpgme1.0-1.8.0/src/gpgme-w32spawn.c --- gpgme1.0-1.7.0/src/gpgme-w32spawn.c 2014-07-30 09:40:16.000000000 +0000 +++ gpgme1.0-1.8.0/src/gpgme-w32spawn.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ diff -Nru gpgme1.0-1.7.0/src/keylist.c gpgme1.0-1.8.0/src/keylist.c --- gpgme1.0-1.7.0/src/keylist.c 2016-09-15 08:37:20.000000000 +0000 +++ gpgme1.0-1.8.0/src/keylist.c 2016-11-16 12:22:41.000000000 +0000 @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H @@ -54,6 +54,9 @@ { struct _gpgme_op_keylist_result result; + /* The error code from ERROR keydb_search. */ + gpgme_error_t keydb_search_err; + gpgme_key_t tmp_key; /* This points to the last uid in tmp_key. */ @@ -135,10 +138,17 @@ opd->result.truncated = 1; break; + case GPGME_STATUS_ERROR: + err = _gpgme_parse_failure (args); + if (!opd->keydb_search_err && !strcmp (args, "keydb_search")) + opd->keydb_search_err = err; + err = 0; + break; + default: break; } - return 0; + return err; } @@ -1138,7 +1148,8 @@ return TRACE_ERR (err); if (!opd->key_cond) - return TRACE_ERR (gpg_error (GPG_ERR_EOF)); + return TRACE_ERR (opd->keydb_search_err? opd->keydb_search_err + /**/ : gpg_error (GPG_ERR_EOF)); opd->key_cond = 0; assert (opd->key_queue); diff -Nru gpgme1.0-1.7.0/src/keysign.c gpgme1.0-1.8.0/src/keysign.c --- gpgme1.0-1.7.0/src/keysign.c 2016-09-14 16:59:55.000000000 +0000 +++ gpgme1.0-1.8.0/src/keysign.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/libgpgme.vers gpgme1.0-1.8.0/src/libgpgme.vers --- gpgme1.0-1.7.0/src/libgpgme.vers 2016-09-15 09:40:05.000000000 +0000 +++ gpgme1.0-1.8.0/src/libgpgme.vers 2016-11-15 09:35:05.000000000 +0000 @@ -101,6 +101,7 @@ gpgme_pubkey_algo_string; gpgme_set_ctx_flag; + gpgme_get_ctx_flag; gpgme_data_set_flag; gpgme_op_createkey_start; @@ -117,6 +118,14 @@ gpgme_op_tofu_policy; gpgme_op_interact_start; gpgme_op_interact; + + gpgme_addrspec_from_uid; + + gpgme_set_sender; + gpgme_get_sender; + + gpgme_op_query_swdb; + gpgme_op_query_swdb_result; }; diff -Nru gpgme1.0-1.7.0/src/Makefile.am gpgme1.0-1.8.0/src/Makefile.am --- gpgme1.0-1.7.0/src/Makefile.am 2016-09-20 08:48:12.000000000 +0000 +++ gpgme1.0-1.8.0/src/Makefile.am 2016-11-16 12:20:15.000000000 +0000 @@ -14,7 +14,7 @@ # 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 . +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in @@ -28,20 +28,13 @@ bin_PROGRAMS = gpgme-tool -if HAVE_PTHREAD -ltlib_gpgme_pthread = libgpgme-pthread.la -else -ltlib_gpgme_pthread = -endif - if BUILD_W32_GLIB ltlib_gpgme_glib = libgpgme-glib.la else ltlib_gpgme_glib = endif -lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \ - $(ltlib_gpgme_pthread) +lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) if HAVE_LD_VERSION_SCRIPT libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers @@ -50,10 +43,10 @@ endif if HAVE_DOSISH_SYSTEM -system_components = w32-util.c w32-sema.c +system_components = w32-util.c system_components_not_extra = w32-io.c else -system_components = ath.h posix-util.c posix-sema.c posix-io.c +system_components = ath.h posix-util.c posix-io.c system_components_not_extra = endif @@ -91,17 +84,15 @@ $(uiserver_components) \ engine-g13.c vfs-mount.c vfs-create.c \ engine-spawn.c \ - gpgconf.c \ + gpgconf.c queryswdb.c \ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \ - debug.c debug.h gpgme.c version.c error.c + debug.c debug.h gpgme.c version.c error.c \ + ath.h ath.c -libgpgme_la_SOURCES = $(main_sources) \ - ath.h ath.c $(system_components_not_extra) -libgpgme_pthread_la_SOURCES = $(main_sources) \ - ath.h ath-pthread.c $(system_components_not_extra) +libgpgme_la_SOURCES = $(main_sources) $(system_components_not_extra) if BUILD_W32_GLIB -libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c +libgpgme_glib_la_SOURCES = $(main_sources) w32-glib-io.c endif # We use a global CFLAGS setting for all library @@ -163,14 +154,6 @@ libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ @GPG_ERROR_LIBS@ -libgpgme_pthread_la_LDFLAGS = \ - $(no_undefined) $(export_symbols) $(extra_ltoptions) \ - $(libgpgme_version_script_cmd) -version-info \ - @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ -libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ - -lpthread @GPG_ERROR_LIBS@ - if BUILD_W32_GLIB libgpgme_glib_la_LDFLAGS = \ $(no_undefined) $(export_symbols) $(extra_ltoptions) \ diff -Nru gpgme1.0-1.7.0/src/Makefile.in gpgme1.0-1.8.0/src/Makefile.in --- gpgme1.0-1.7.0/src/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/src/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -30,7 +30,7 @@ # 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 . +# License along with this program; if not, see . @@ -107,8 +107,8 @@ 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 stpcpy.c funopen.c ttyname_r.c \ + vasprintf.c setenv.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 \ @@ -172,16 +172,15 @@ engine-backend.h engine.c engine-gpg.c status-table.c \ engine-gpgsm.c engine-assuan.c engine-gpgconf.c \ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \ - engine-spawn.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \ - posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \ - w32-sema.c sys-util.h dirinfo.c debug.c debug.h gpgme.c \ - version.c error.c ath.c w32-glib-io.c + engine-spawn.c gpgconf.c queryswdb.c sema.h priv-io.h ath.h \ + posix-util.c posix-io.c w32-ce.h w32-ce.c w32-util.c \ + sys-util.h dirinfo.c debug.c debug.h gpgme.c version.c error.c \ + ath.c w32-glib-io.c @HAVE_UISERVER_TRUE@am__objects_1 = engine-uiserver.lo @HAVE_W32CE_SYSTEM_TRUE@am__objects_2 = w32-ce.lo -@HAVE_DOSISH_SYSTEM_FALSE@am__objects_3 = posix-util.lo posix-sema.lo \ -@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo $(am__objects_2) -@HAVE_DOSISH_SYSTEM_TRUE@am__objects_3 = w32-util.lo w32-sema.lo \ -@HAVE_DOSISH_SYSTEM_TRUE@ $(am__objects_2) +@HAVE_DOSISH_SYSTEM_FALSE@am__objects_3 = posix-util.lo posix-io.lo \ +@HAVE_DOSISH_SYSTEM_FALSE@ $(am__objects_2) +@HAVE_DOSISH_SYSTEM_TRUE@am__objects_3 = w32-util.lo $(am__objects_2) am__objects_4 = conversion.lo b64dec.lo get-env.lo parsetlv.lo \ mbox-util.lo data.lo data-fd.lo data-stream.lo data-mem.lo \ data-user.lo data-compat.lo data-identify.lo signers.lo \ @@ -194,10 +193,11 @@ spawn.lo assuan-support.lo engine.lo engine-gpg.lo \ status-table.lo engine-gpgsm.lo engine-assuan.lo \ engine-gpgconf.lo $(am__objects_1) engine-g13.lo vfs-mount.lo \ - vfs-create.lo engine-spawn.lo gpgconf.lo $(am__objects_3) \ - dirinfo.lo debug.lo gpgme.lo version.lo error.lo + vfs-create.lo engine-spawn.lo gpgconf.lo queryswdb.lo \ + $(am__objects_3) dirinfo.lo debug.lo gpgme.lo version.lo \ + error.lo ath.lo @BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = $(am__objects_4) \ -@BUILD_W32_GLIB_TRUE@ ath.lo w32-glib-io.lo +@BUILD_W32_GLIB_TRUE@ w32-glib-io.lo libgpgme_glib_la_OBJECTS = $(am_libgpgme_glib_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -208,32 +208,6 @@ $(AM_CFLAGS) $(CFLAGS) $(libgpgme_glib_la_LDFLAGS) $(LDFLAGS) \ -o $@ @BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_rpath = -rpath $(libdir) -am__libgpgme_pthread_la_SOURCES_DIST = util.h conversion.c b64dec.c \ - get-env.c context.h ops.h parsetlv.c parsetlv.h mbox-util.c \ - mbox-util.h data.h data.c data-fd.c data-stream.c data-mem.c \ - data-user.c data-compat.c data-identify.c signers.c \ - sig-notation.c wait.c wait-global.c wait-private.c wait-user.c \ - wait.h op-support.c encrypt.c encrypt-sign.c decrypt.c \ - decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \ - keylist.c keysign.c trust-item.c trustlist.c tofupolicy.c \ - import.c export.c genkey.c delete.c edit.c getauditlog.c \ - opassuan.c passwd.c spawn.c assuan-support.c engine.h \ - engine-backend.h engine.c engine-gpg.c status-table.c \ - engine-gpgsm.c engine-assuan.c engine-gpgconf.c \ - engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \ - engine-spawn.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \ - posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \ - w32-sema.c sys-util.h dirinfo.c debug.c debug.h gpgme.c \ - version.c error.c ath-pthread.c w32-io.c -@HAVE_DOSISH_SYSTEM_TRUE@am__objects_5 = w32-io.lo -am_libgpgme_pthread_la_OBJECTS = $(am__objects_4) ath-pthread.lo \ - $(am__objects_5) -libgpgme_pthread_la_OBJECTS = $(am_libgpgme_pthread_la_OBJECTS) -libgpgme_pthread_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(AM_CFLAGS) $(CFLAGS) $(libgpgme_pthread_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -@HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir) am__libgpgme_la_SOURCES_DIST = util.h conversion.c b64dec.c get-env.c \ context.h ops.h parsetlv.c parsetlv.h mbox-util.c mbox-util.h \ data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \ @@ -246,11 +220,12 @@ spawn.c assuan-support.c engine.h engine-backend.h engine.c \ engine-gpg.c status-table.c engine-gpgsm.c engine-assuan.c \ engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \ - vfs-create.c engine-spawn.c gpgconf.c sema.h priv-io.h ath.h \ - posix-util.c posix-sema.c posix-io.c w32-ce.h w32-ce.c \ - w32-util.c w32-sema.c sys-util.h dirinfo.c debug.c debug.h \ - gpgme.c version.c error.c ath.c w32-io.c -am_libgpgme_la_OBJECTS = $(am__objects_4) ath.lo $(am__objects_5) + vfs-create.c engine-spawn.c gpgconf.c queryswdb.c sema.h \ + priv-io.h ath.h posix-util.c posix-io.c w32-ce.h w32-ce.c \ + w32-util.c sys-util.h dirinfo.c debug.c debug.h gpgme.c \ + version.c error.c ath.c w32-io.c +@HAVE_DOSISH_SYSTEM_TRUE@am__objects_5 = w32-io.lo +am_libgpgme_la_OBJECTS = $(am__objects_4) $(am__objects_5) libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS) libgpgme_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -297,10 +272,9 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libgpgme_glib_la_SOURCES) $(libgpgme_pthread_la_SOURCES) \ - $(libgpgme_la_SOURCES) $(gpgme_tool_SOURCES) gpgme-w32spawn.c +SOURCES = $(libgpgme_glib_la_SOURCES) $(libgpgme_la_SOURCES) \ + $(gpgme_tool_SOURCES) gpgme-w32spawn.c DIST_SOURCES = $(am__libgpgme_glib_la_SOURCES_DIST) \ - $(am__libgpgme_pthread_la_SOURCES_DIST) \ $(am__libgpgme_la_SOURCES_DIST) $(gpgme_tool_SOURCES) \ gpgme-w32spawn.c am__can_run_installinfo = \ @@ -461,6 +435,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -529,19 +506,14 @@ m4datadir = $(datadir)/aclocal m4data_DATA = gpgme.m4 nodist_include_HEADERS = gpgme.h -@HAVE_PTHREAD_FALSE@ltlib_gpgme_pthread = -@HAVE_PTHREAD_TRUE@ltlib_gpgme_pthread = libgpgme-pthread.la @BUILD_W32_GLIB_FALSE@ltlib_gpgme_glib = @BUILD_W32_GLIB_TRUE@ltlib_gpgme_glib = libgpgme-glib.la -lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \ - $(ltlib_gpgme_pthread) - +lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) @HAVE_LD_VERSION_SCRIPT_FALSE@libgpgme_version_script_cmd = @HAVE_LD_VERSION_SCRIPT_TRUE@libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers @HAVE_DOSISH_SYSTEM_FALSE@system_components = ath.h posix-util.c \ -@HAVE_DOSISH_SYSTEM_FALSE@ posix-sema.c posix-io.c \ -@HAVE_DOSISH_SYSTEM_FALSE@ $(am__append_1) -@HAVE_DOSISH_SYSTEM_TRUE@system_components = w32-util.c w32-sema.c \ +@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.c $(am__append_1) +@HAVE_DOSISH_SYSTEM_TRUE@system_components = w32-util.c \ @HAVE_DOSISH_SYSTEM_TRUE@ $(am__append_1) @HAVE_DOSISH_SYSTEM_FALSE@system_components_not_extra = @HAVE_DOSISH_SYSTEM_TRUE@system_components_not_extra = w32-io.c @@ -572,17 +544,13 @@ $(uiserver_components) \ engine-g13.c vfs-mount.c vfs-create.c \ engine-spawn.c \ - gpgconf.c \ + gpgconf.c queryswdb.c \ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \ - debug.c debug.h gpgme.c version.c error.c - -libgpgme_la_SOURCES = $(main_sources) \ - ath.h ath.c $(system_components_not_extra) - -libgpgme_pthread_la_SOURCES = $(main_sources) \ - ath.h ath-pthread.c $(system_components_not_extra) + debug.c debug.h gpgme.c version.c error.c \ + ath.h ath.c -@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c +libgpgme_la_SOURCES = $(main_sources) $(system_components_not_extra) +@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_SOURCES = $(main_sources) w32-glib-io.c # We use a global CFLAGS setting for all library # versions, because then every object file is only compiled once. @@ -610,15 +578,6 @@ libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ @GPG_ERROR_LIBS@ -libgpgme_pthread_la_LDFLAGS = \ - $(no_undefined) $(export_symbols) $(extra_ltoptions) \ - $(libgpgme_version_script_cmd) -version-info \ - @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ - -libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ - -lpthread @GPG_ERROR_LIBS@ - @BUILD_W32_GLIB_TRUE@libgpgme_glib_la_LDFLAGS = \ @BUILD_W32_GLIB_TRUE@ $(no_undefined) $(export_symbols) $(extra_ltoptions) \ @BUILD_W32_GLIB_TRUE@ $(libgpgme_version_script_cmd) -version-info \ @@ -709,9 +668,6 @@ libgpgme-glib.la: $(libgpgme_glib_la_OBJECTS) $(libgpgme_glib_la_DEPENDENCIES) $(EXTRA_libgpgme_glib_la_DEPENDENCIES) $(AM_V_CCLD)$(libgpgme_glib_la_LINK) $(am_libgpgme_glib_la_rpath) $(libgpgme_glib_la_OBJECTS) $(libgpgme_glib_la_LIBADD) $(LIBS) -libgpgme-pthread.la: $(libgpgme_pthread_la_OBJECTS) $(libgpgme_pthread_la_DEPENDENCIES) $(EXTRA_libgpgme_pthread_la_DEPENDENCIES) - $(AM_V_CCLD)$(libgpgme_pthread_la_LINK) $(am_libgpgme_pthread_la_rpath) $(libgpgme_pthread_la_OBJECTS) $(libgpgme_pthread_la_LIBADD) $(LIBS) - libgpgme.la: $(libgpgme_la_OBJECTS) $(libgpgme_la_DEPENDENCIES) $(EXTRA_libgpgme_la_DEPENDENCIES) $(AM_V_CCLD)$(libgpgme_la_LINK) -rpath $(libdir) $(libgpgme_la_OBJECTS) $(libgpgme_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @@ -869,7 +825,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argparse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath-pthread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b64dec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversion.Plo@am__quote@ @@ -916,9 +871,9 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passphrase.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-io.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-sema.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progress.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queryswdb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig-notation.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sign.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signers.Plo@am__quote@ @@ -934,7 +889,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-ce.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-glib-io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-io.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-sema.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wait-global.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wait-private.Plo@am__quote@ diff -Nru gpgme1.0-1.7.0/src/mbox-util.c gpgme1.0-1.8.0/src/mbox-util.c --- gpgme1.0-1.7.0/src/mbox-util.c 2016-08-23 04:35:57.000000000 +0000 +++ gpgme1.0-1.8.0/src/mbox-util.c 2016-11-16 12:22:41.000000000 +0000 @@ -12,10 +12,10 @@ * 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 . + * along with this program; if not, see . */ /* NB: This code has been taken from GnuPG. Please keep it in sync @@ -255,3 +255,21 @@ /* 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 -Nru gpgme1.0-1.7.0/src/mbox-util.h gpgme1.0-1.8.0/src/mbox-util.h --- gpgme1.0-1.7.0/src/mbox-util.h 2016-08-23 04:23:08.000000000 +0000 +++ gpgme1.0-1.8.0/src/mbox-util.h 2016-11-16 12:23:14.000000000 +0000 @@ -11,10 +11,10 @@ * 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 . + * along with this program; if not, see . */ #ifndef GNUPG_COMMON_MBOX_UTIL_H #define GNUPG_COMMON_MBOX_UTIL_H diff -Nru gpgme1.0-1.7.0/src/opassuan.c gpgme1.0-1.8.0/src/opassuan.c --- gpgme1.0-1.7.0/src/opassuan.c 2016-09-15 08:37:25.000000000 +0000 +++ gpgme1.0-1.8.0/src/opassuan.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/op-support.c gpgme1.0-1.8.0/src/op-support.c --- gpgme1.0-1.7.0/src/op-support.c 2016-09-13 17:07:25.000000000 +0000 +++ gpgme1.0-1.8.0/src/op-support.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/parsetlv.c gpgme1.0-1.8.0/src/parsetlv.c --- gpgme1.0-1.7.0/src/parsetlv.c 2014-07-30 09:09:03.000000000 +0000 +++ gpgme1.0-1.8.0/src/parsetlv.c 2016-11-16 12:22:41.000000000 +0000 @@ -12,7 +12,7 @@ * 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 . + * along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/parsetlv.h gpgme1.0-1.8.0/src/parsetlv.h --- gpgme1.0-1.7.0/src/parsetlv.h 2014-07-30 09:09:03.000000000 +0000 +++ gpgme1.0-1.8.0/src/parsetlv.h 2016-11-16 12:23:14.000000000 +0000 @@ -12,7 +12,7 @@ * 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 . + * along with this program; if not, see . */ #ifndef PARSETLV_H diff -Nru gpgme1.0-1.7.0/src/passwd.c gpgme1.0-1.8.0/src/passwd.c --- gpgme1.0-1.7.0/src/passwd.c 2016-05-17 12:32:37.000000000 +0000 +++ gpgme1.0-1.8.0/src/passwd.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/posix-io.c gpgme1.0-1.8.0/src/posix-io.c --- gpgme1.0-1.7.0/src/posix-io.c 2016-09-13 17:51:18.000000000 +0000 +++ gpgme1.0-1.8.0/src/posix-io.c 2016-11-16 12:22:41.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H @@ -607,7 +607,7 @@ if (fds[i].fd >= FD_SETSIZE) { TRACE_END (dbg_help, " -BAD- ]"); - gpg_err_set_errno (EBADF); + gpg_err_set_errno (EMFILE); return TRACE_SYSRES (-1); } assert (!FD_ISSET (fds[i].fd, &readfds)); @@ -622,7 +622,7 @@ if (fds[i].fd >= FD_SETSIZE) { TRACE_END (dbg_help, " -BAD- ]"); - gpg_err_set_errno (EBADF); + gpg_err_set_errno (EMFILE); return TRACE_SYSRES (-1); } assert (!FD_ISSET (fds[i].fd, &writefds)); diff -Nru gpgme1.0-1.7.0/src/posix-sema.c gpgme1.0-1.8.0/src/posix-sema.c --- gpgme1.0-1.7.0/src/posix-sema.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/src/posix-sema.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/* posix-sema.c - Copyright (C) 2001 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2004, 2007 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. */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#include "util.h" -#include "sema.h" -#include "ath.h" - -void -_gpgme_sema_subsystem_init () -{ -} - -void -_gpgme_sema_cs_enter (struct critsect_s *s) -{ - _gpgme_ath_mutex_lock (&s->priv); -} - -void -_gpgme_sema_cs_leave (struct critsect_s *s) -{ - _gpgme_ath_mutex_unlock (&s->priv); -} - -void -_gpgme_sema_cs_destroy (struct critsect_s *s) -{ - _gpgme_ath_mutex_destroy (&s->priv); - s->priv = NULL; -} diff -Nru gpgme1.0-1.7.0/src/queryswdb.c gpgme1.0-1.8.0/src/queryswdb.c --- gpgme1.0-1.7.0/src/queryswdb.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/src/queryswdb.c 2016-11-16 12:22:41.000000000 +0000 @@ -0,0 +1,121 @@ +/* queryswdb.c - Access to the SWDB file + * Copyright (C) 2016 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, see . + */ + +#if HAVE_CONFIG_H +#include +#endif +#include +#include + +#include "gpgme.h" +#include "debug.h" +#include "context.h" +#include "ops.h" + + +typedef struct +{ + struct _gpgme_op_query_swdb_result result; + +} *op_data_t; + + + +static void +release_op_data (void *hook) +{ + op_data_t opd = (op_data_t) hook; + gpgme_query_swdb_result_t result = &opd->result; + + assert (!result->next); + free (result->name); + free (result->iversion); + free (result->version); +} + + +gpgme_query_swdb_result_t +gpgme_op_query_swdb_result (gpgme_ctx_t ctx) +{ + void *hook; + op_data_t opd; + gpgme_error_t err; + + TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx); + + err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, -1, NULL); + opd = hook; + + if (err || !opd) + { + TRACE_SUC0 ("result=(null)"); + return NULL; + } + + TRACE_SUC1 ("result=%p", &opd->result); + return &opd->result; +} + + + +/* Query the swdb for software package NAME and check against the + * installed version given by IVERSION. If IVERSION is NULL a check + * is only done if GPGME can figure out the version by itself + * (e.g. for "gpgme" or "gnupg"). RESERVED should be 0. + * + * Note that we only implemented the synchronous variant of this + * function but the API is prepared for an asynchronous variant. + */ +gpgme_error_t +gpgme_op_query_swdb (gpgme_ctx_t ctx, const char *name, const char *iversion, + unsigned int reserved) +{ + gpgme_error_t err; + void *hook; + op_data_t opd; + + TRACE_BEG2 (DEBUG_CTX, "gpgme_op_query_swdb", ctx, + "name=%s, iversion=%a", name, iversion); + + if (!ctx || reserved) + return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); + + if (ctx->protocol != GPGME_PROTOCOL_GPGCONF) + return TRACE_ERR (gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL)); + + if (!name) + name = "gpgme"; + + if (!iversion && !strcmp (name, "gpgme")) + iversion = VERSION; + + err = _gpgme_op_reset (ctx, 1); + if (err) + return err; + + err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, + sizeof (*opd), release_op_data); + opd = hook; + if (err) + return TRACE_ERR (err); + + err = _gpgme_engine_op_query_swdb (ctx->engine, name, iversion, + &opd->result); + return TRACE_ERR (err); +} diff -Nru gpgme1.0-1.7.0/src/sema.h gpgme1.0-1.8.0/src/sema.h --- gpgme1.0-1.7.0/src/sema.h 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/src/sema.h 2016-11-16 12:23:14.000000000 +0000 @@ -22,46 +22,23 @@ #ifndef SEMA_H #define SEMA_H -struct critsect_s -{ - const char *name; - void *priv; -}; +#include #define DEFINE_GLOBAL_LOCK(name) \ - struct critsect_s name = { #name, NULL } + gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER + #define DEFINE_STATIC_LOCK(name) \ - static struct critsect_s name = { #name, NULL } + static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER + +#define INIT_LOCK(name) \ + name = (gpgrt_lock_t) GPGRT_LOCK_INITIALIZER + +#define DECLARE_LOCK(name) gpgrt_lock_t name + +#define DESTROY_LOCK(name) gpgrt_lock_destroy(&name) + +#define LOCK(name) gpgrt_lock_lock(&name) -#define DECLARE_LOCK(name) \ - struct critsect_s name -#define INIT_LOCK(a) \ - do \ - { \ - (a).name = #a; \ - (a).priv = NULL; \ - } \ - while (0) -#define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name)) - - -#define LOCK(name) \ - do \ - { \ - _gpgme_sema_cs_enter (&(name)); \ - } \ - while (0) - -#define UNLOCK(name) \ - do \ - { \ - _gpgme_sema_cs_leave (&(name)); \ - } \ - while (0) - -void _gpgme_sema_subsystem_init (void); -void _gpgme_sema_cs_enter (struct critsect_s *s); -void _gpgme_sema_cs_leave (struct critsect_s *s); -void _gpgme_sema_cs_destroy (struct critsect_s *s); +#define UNLOCK(name) gpgrt_lock_unlock(&name) #endif /* SEMA_H */ diff -Nru gpgme1.0-1.7.0/src/sys-util.h gpgme1.0-1.8.0/src/sys-util.h --- gpgme1.0-1.7.0/src/sys-util.h 2016-04-18 15:35:08.000000000 +0000 +++ gpgme1.0-1.8.0/src/sys-util.h 2016-11-16 12:23:14.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #ifndef SYS_UTIL_H diff -Nru gpgme1.0-1.7.0/src/tofupolicy.c gpgme1.0-1.8.0/src/tofupolicy.c --- gpgme1.0-1.7.0/src/tofupolicy.c 2016-09-14 18:03:59.000000000 +0000 +++ gpgme1.0-1.8.0/src/tofupolicy.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/ttyname_r.c gpgme1.0-1.8.0/src/ttyname_r.c --- gpgme1.0-1.7.0/src/ttyname_r.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/src/ttyname_r.c 2016-11-16 12:22:41.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/util.h gpgme1.0-1.8.0/src/util.h --- gpgme1.0-1.7.0/src/util.h 2016-09-15 09:40:05.000000000 +0000 +++ gpgme1.0-1.8.0/src/util.h 2016-11-16 12:23:14.000000000 +0000 @@ -49,6 +49,15 @@ # define GPG_ERR_FALSE 256 #endif +#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */ +# define GPG_ERR_ENGINE_TOO_OLD 300 +# define GPG_ERR_TOO_OLD 308 +#endif + +#ifndef GPGRT_ATTR_SENTINEL +# define GPGRT_ATTR_SENTINEL(a) /* */ +#endif + /*-- {posix,w32}-util.c --*/ @@ -102,6 +111,12 @@ /*-- 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 -Nru gpgme1.0-1.7.0/src/verify.c gpgme1.0-1.8.0/src/verify.c --- gpgme1.0-1.7.0/src/verify.c 2016-09-16 09:45:27.000000000 +0000 +++ gpgme1.0-1.8.0/src/verify.c 2016-11-16 12:22:41.000000000 +0000 @@ -1104,7 +1104,8 @@ if (!sig) return gpg_error (GPG_ERR_NO_DATA); - return _gpgme_engine_op_verify (ctx->engine, sig, signed_text, plaintext); + return _gpgme_engine_op_verify (ctx->engine, sig, signed_text, plaintext, + ctx); } diff -Nru gpgme1.0-1.7.0/src/version.c gpgme1.0-1.8.0/src/version.c --- gpgme1.0-1.7.0/src/version.c 2016-09-13 18:53:55.000000000 +0000 +++ gpgme1.0-1.8.0/src/version.c 2016-11-16 12:22:41.000000000 +0000 @@ -74,7 +74,6 @@ } #endif - _gpgme_sema_subsystem_init (); _gpgme_debug_subsystem_init (); _gpgme_io_subsystem_init (); _gpgme_status_init (); diff -Nru gpgme1.0-1.7.0/src/w32-ce.c gpgme1.0-1.8.0/src/w32-ce.c --- gpgme1.0-1.7.0/src/w32-ce.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/src/w32-ce.c 2016-11-16 12:22:41.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/src/w32-io.c gpgme1.0-1.8.0/src/w32-io.c --- gpgme1.0-1.7.0/src/w32-io.c 2016-08-21 12:29:55.000000000 +0000 +++ gpgme1.0-1.8.0/src/w32-io.c 2016-11-16 12:22:41.000000000 +0000 @@ -84,6 +84,7 @@ duplicates works just fine. */ int dup_from; } fd_table[MAX_SLAFD]; +DEFINE_STATIC_LOCK (fd_table_lock); /* Returns the FD or -1 on resource limit. */ @@ -92,6 +93,8 @@ { int idx; + LOCK (fd_table_lock); + for (idx = 0; idx < MAX_SLAFD; idx++) if (! fd_table[idx].used) break; @@ -99,14 +102,18 @@ if (idx == MAX_SLAFD) { gpg_err_set_errno (EIO); - return -1; + idx = -1; + } + else + { + fd_table[idx].used = 1; + fd_table[idx].handle = INVALID_HANDLE_VALUE; + fd_table[idx].socket = INVALID_SOCKET; + fd_table[idx].rvid = 0; + fd_table[idx].dup_from = -1; } - fd_table[idx].used = 1; - fd_table[idx].handle = INVALID_HANDLE_VALUE; - fd_table[idx].socket = INVALID_SOCKET; - fd_table[idx].rvid = 0; - fd_table[idx].dup_from = -1; + UNLOCK (fd_table_lock); return idx; } @@ -115,14 +122,21 @@ void release_fd (int fd) { - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) + if (fd < 0 || fd >= MAX_SLAFD) return; - fd_table[fd].used = 0; - fd_table[fd].handle = INVALID_HANDLE_VALUE; - fd_table[fd].socket = INVALID_SOCKET; - fd_table[fd].rvid = 0; - fd_table[fd].dup_from = -1; + LOCK (fd_table_lock); + + if (fd_table[fd].used) + { + fd_table[fd].used = 0; + fd_table[fd].handle = INVALID_HANDLE_VALUE; + fd_table[fd].socket = INVALID_SOCKET; + fd_table[fd].rvid = 0; + fd_table[fd].dup_from = -1; + } + + UNLOCK (fd_table_lock); } diff -Nru gpgme1.0-1.7.0/src/w32-sema.c gpgme1.0-1.8.0/src/w32-sema.c --- gpgme1.0-1.7.0/src/w32-sema.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/src/w32-sema.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* w32-sema.c - Copyright (C) 2001 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2004, 2007 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. */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#include - -#include "util.h" -#include "sema.h" -#include "debug.h" - -static void -sema_fatal (const char *text) -{ - fprintf (stderr, "sema.c: %s\n", text); - abort (); -} - - -static void -critsect_init (struct critsect_s *s) -{ - CRITICAL_SECTION *mp; - static CRITICAL_SECTION init_lock; - static int initialized; - - if (!initialized) { - /* The very first time we call this function, we assume that - only one thread is running, so that we can bootstrap the - semaphore code. */ - InitializeCriticalSection (&init_lock); - initialized = 1; - } - if (!s) - return; /* we just want to initialize ourself */ - - /* first test whether it is really not initialized */ - EnterCriticalSection (&init_lock); - if ( s->priv ) { - LeaveCriticalSection (&init_lock); - return; - } - /* now init it */ - mp = malloc ( sizeof *mp ); - if (!mp) { - LeaveCriticalSection (&init_lock); - sema_fatal ("out of core while creating critical section lock"); - } - InitializeCriticalSection (mp); - s->priv = mp; - LeaveCriticalSection (&init_lock); -} - -void -_gpgme_sema_subsystem_init () -{ - /* fixme: we should check that there is only one thread running */ - critsect_init (NULL); -} - - -void -_gpgme_sema_cs_enter ( struct critsect_s *s ) -{ - if (!s->priv) - critsect_init (s); - EnterCriticalSection ( (CRITICAL_SECTION*)s->priv ); -} - -void -_gpgme_sema_cs_leave (struct critsect_s *s) -{ - if (!s->priv) - critsect_init (s); - LeaveCriticalSection ((CRITICAL_SECTION*)s->priv); -} - -void -_gpgme_sema_cs_destroy ( struct critsect_s *s ) -{ - if (s && s->priv) { - DeleteCriticalSection ((CRITICAL_SECTION*)s->priv); - free (s->priv); - s->priv = NULL; - } -} diff -Nru gpgme1.0-1.7.0/src/w32-util.c gpgme1.0-1.8.0/src/w32-util.c --- gpgme1.0-1.7.0/src/w32-util.c 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/src/w32-util.c 2016-11-16 12:22:41.000000000 +0000 @@ -16,7 +16,7 @@ * 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 . + * License along with this program; if not, see . **/ #ifdef HAVE_CONFIG_H @@ -98,6 +98,8 @@ dlopen (const char * name, int flag) { void * hd = LoadLibrary (name); + + (void)flag; return hd; } @@ -388,11 +390,10 @@ { 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); @@ -414,18 +415,23 @@ We First try the generic place and then fallback to the x86 (i.e. 32 bit) place. This will prefer a 64 bit of the program over a 32 bit version on 64 bit Windows if installed. */ - if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0) - || SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0)) + if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 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; + } + } + if (!result + && SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0)) + { + result = _gpgme_strconcat (path, "\\", name, NULL); + if (result && access (result, F_OK)) + { + free (result); + result = NULL; } } return result; @@ -439,12 +445,9 @@ { 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 +459,9 @@ { 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 +474,9 @@ { 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 +761,11 @@ } } - 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 -Nru gpgme1.0-1.7.0/tests/ChangeLog-2011 gpgme1.0-1.8.0/tests/ChangeLog-2011 --- gpgme1.0-1.7.0/tests/ChangeLog-2011 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/tests/ChangeLog-2011 2016-10-18 17:22:02.000000000 +0000 @@ -603,7 +603,7 @@ 2002-09-28 Marcus Brinkmann - * t-version.c: Include . Reported by Stphane Corthsy. + * t-version.c: Include . Reported by Stéphane Corthésy. 2002-09-02 Marcus Brinkmann @@ -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 @@ -772,7 +772,7 @@ 2001-12-19 Marcus Brinkmann * gpg/t-decrypt-verify.c: Don't include `mcheck.h'. Reported by - Stphane Corthsy. + Stéphane Corthésy. 2001-12-19 Marcus Brinkmann diff -Nru gpgme1.0-1.7.0/tests/gpg/geheim.txt gpgme1.0-1.8.0/tests/gpg/geheim.txt --- gpgme1.0-1.7.0/tests/gpg/geheim.txt 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/geheim.txt 2016-10-18 17:22:02.000000000 +0000 @@ -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 -Nru gpgme1.0-1.7.0/tests/gpg/Makefile.am gpgme1.0-1.8.0/tests/gpg/Makefile.am --- gpgme1.0-1.7.0/tests/gpg/Makefile.am 2016-09-20 16:17:23.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/Makefile.am 2016-11-11 08:08:15.000000000 +0000 @@ -38,7 +38,8 @@ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \ t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \ t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \ - t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) + t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \ + t-thread-keylist t-thread-keylist-verify TESTS = initial.test $(c_tests) final.test @@ -61,10 +62,20 @@ 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_thread1_LDADD = ../../src/libgpgme.la -lpthread +t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread +t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread +t_cancel_LDADD = ../../src/libgpgme.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 @@ -82,7 +93,7 @@ export GPG_AGENT_INFO := ./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d for k in $(private_keys); do \ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \ done diff -Nru gpgme1.0-1.7.0/tests/gpg/Makefile.in gpgme1.0-1.8.0/tests/gpg/Makefile.in --- gpgme1.0-1.7.0/tests/gpg/Makefile.in 2016-09-21 07:19:27.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -99,7 +99,8 @@ 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 \ @@ -131,16 +132,22 @@ t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(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) + t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1) \ + t-thread-keylist$(EXEEXT) t-thread-keylist-verify$(EXEEXT) +@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.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) @@ -213,9 +220,15 @@ t_signers_OBJECTS = t-signers.$(OBJEXT) t_signers_LDADD = $(LDADD) t_signers_DEPENDENCIES = ../../src/libgpgme.la +t_thread_keylist_SOURCES = t-thread-keylist.c +t_thread_keylist_OBJECTS = t-thread-keylist.$(OBJEXT) +t_thread_keylist_DEPENDENCIES = ../../src/libgpgme.la +t_thread_keylist_verify_SOURCES = t-thread-keylist-verify.c +t_thread_keylist_verify_OBJECTS = t-thread-keylist-verify.$(OBJEXT) +t_thread_keylist_verify_DEPENDENCIES = ../../src/libgpgme.la t_thread1_SOURCES = t-thread1.c t_thread1_OBJECTS = t-thread1.$(OBJEXT) -t_thread1_DEPENDENCIES = ../../src/libgpgme-pthread.la +t_thread1_DEPENDENCIES = ../../src/libgpgme.la t_trustlist_SOURCES = t-trustlist.c t_trustlist_OBJECTS = t-trustlist.$(OBJEXT) t_trustlist_LDADD = $(LDADD) @@ -262,17 +275,19 @@ 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 \ +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-thread-keylist.c t-thread-keylist-verify.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 \ +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-thread-keylist.c t-thread-keylist-verify.c t-thread1.c \ t-trustlist.c t-verify.c t-wait.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -453,6 +468,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -528,7 +546,8 @@ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \ t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \ t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \ - t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) + t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \ + t-thread-keylist t-thread-keylist-verify CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ @@ -548,7 +567,14 @@ 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_thread1_LDADD = ../../src/libgpgme.la -lpthread +t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread +t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread +t_cancel_LDADD = ../../src/libgpgme.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 +619,10 @@ 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) @@ -669,6 +699,14 @@ @rm -f t-signers$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_signers_OBJECTS) $(t_signers_LDADD) $(LIBS) +t-thread-keylist$(EXEEXT): $(t_thread_keylist_OBJECTS) $(t_thread_keylist_DEPENDENCIES) $(EXTRA_t_thread_keylist_DEPENDENCIES) + @rm -f t-thread-keylist$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_thread_keylist_OBJECTS) $(t_thread_keylist_LDADD) $(LIBS) + +t-thread-keylist-verify$(EXEEXT): $(t_thread_keylist_verify_OBJECTS) $(t_thread_keylist_verify_DEPENDENCIES) $(EXTRA_t_thread_keylist_verify_DEPENDENCIES) + @rm -f t-thread-keylist-verify$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(t_thread_keylist_verify_OBJECTS) $(t_thread_keylist_verify_LDADD) $(LIBS) + t-thread1$(EXEEXT): $(t_thread1_OBJECTS) $(t_thread1_DEPENDENCIES) $(EXTRA_t_thread1_DEPENDENCIES) @rm -f t-thread1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t_thread1_OBJECTS) $(t_thread1_LDADD) $(LIBS) @@ -691,6 +729,7 @@ 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@ @@ -710,6 +749,8 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sig-notation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-signers.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist-verify.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-trustlist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@ @@ -1057,7 +1098,7 @@ export GPG_AGENT_INFO := ./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d for k in $(private_keys); do \ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \ done diff -Nru gpgme1.0-1.7.0/tests/gpg/t-cancel.c gpgme1.0-1.8.0/tests/gpg/t-cancel.c --- gpgme1.0-1.7.0/tests/gpg/t-cancel.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-cancel.c 2016-11-16 12:23:31.000000000 +0000 @@ -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 +#endif + +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include +#include +#include +#ifdef HAVE_SYS_SELECT_H +# include +#endif + +#include + +#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 = "\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" + "\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 -Nru gpgme1.0-1.7.0/tests/gpg/t-decrypt-verify.c gpgme1.0-1.8.0/tests/gpg/t-decrypt-verify.c --- gpgme1.0-1.7.0/tests/gpg/t-decrypt-verify.c 2016-09-13 18:16:01.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-decrypt-verify.c 2016-11-16 12:23:31.000000000 +0000 @@ -15,7 +15,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/gpg/t-eventloop.c gpgme1.0-1.8.0/tests/gpg/t-eventloop.c --- gpgme1.0-1.7.0/tests/gpg/t-eventloop.c 2016-09-13 18:21:15.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-eventloop.c 2016-11-16 12:23:31.000000000 +0000 @@ -111,6 +111,7 @@ fd_set wfds; int i, n; int any = 0; + struct timeval tv; FD_ZERO (&rfds); FD_ZERO (&wfds); @@ -118,9 +119,12 @@ 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 -Nru gpgme1.0-1.7.0/tests/gpg/t-sig-notation.c gpgme1.0-1.8.0/tests/gpg/t-sig-notation.c --- gpgme1.0-1.7.0/tests/gpg/t-sig-notation.c 2016-09-13 18:01:50.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-sig-notation.c 2016-11-16 12:23:31.000000000 +0000 @@ -151,6 +151,7 @@ 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 -Nru gpgme1.0-1.7.0/tests/gpg/t-thread-keylist.c gpgme1.0-1.8.0/tests/gpg/t-thread-keylist.c --- gpgme1.0-1.7.0/tests/gpg/t-thread-keylist.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-thread-keylist.c 2016-11-16 12:23:31.000000000 +0000 @@ -0,0 +1,85 @@ +/* t-thread-verify.c - Regression test. + Copyright (C) 2015 Intevation 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. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#include + +#include "t-support.h" + +#define THREAD_COUNT 100 + +void * +start_keylist (void *arg) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + + (void) arg; + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_key_unref (key); + } + + gpgme_release (ctx); + + return NULL; +} + +int +main (int argc, char *argv[]) +{ + int i; + pthread_t keylist_threads[THREAD_COUNT]; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + (void)argc; + (void)argv; + + for (i = 0; i < THREAD_COUNT; i++) + { + if (pthread_create(&keylist_threads[i], NULL, start_keylist, NULL)) + { + fprintf(stderr, "%s:%i: failed to create threads \n", + __FILE__, __LINE__); + exit(1); + } + } + for (i = 0; i < THREAD_COUNT; i++) + { + pthread_join (keylist_threads[i], NULL); + } + return 0; +} diff -Nru gpgme1.0-1.7.0/tests/gpg/t-thread-keylist-verify.c gpgme1.0-1.8.0/tests/gpg/t-thread-keylist-verify.c --- gpgme1.0-1.7.0/tests/gpg/t-thread-keylist-verify.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-thread-keylist-verify.c 2016-11-16 12:23:31.000000000 +0000 @@ -0,0 +1,142 @@ +/* t-thread-verify.c - Regression test. + Copyright (C) 2015 Intevation 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. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#include + +#include "t-support.h" + +#define THREAD_COUNT 100 + +static const char test_text1[] = "Just GNU it!\n"; +static const char test_sig1[] = +"-----BEGIN PGP SIGNATURE-----\n" +"\n" +"iN0EABECAJ0FAjoS+i9FFIAAAAAAAwA5YmFyw7bDpMO8w58gZGFzIHdhcmVuIFVt\n" +"bGF1dGUgdW5kIGpldHp0IGVpbiBwcm96ZW50JS1aZWljaGVuNRSAAAAAAAgAJGZv\n" +"b2Jhci4xdGhpcyBpcyBhIG5vdGF0aW9uIGRhdGEgd2l0aCAyIGxpbmVzGhpodHRw\n" +"Oi8vd3d3Lmd1Lm9yZy9wb2xpY3kvAAoJEC1yfMdoaXc0JBIAoIiLlUsvpMDOyGEc\n" +"dADGKXF/Hcb+AKCJWPphZCphduxSvrzH0hgzHdeQaA==\n" +"=nts1\n" +"-----END PGP SIGNATURE-----\n"; + +void * +start_keylist (void *arg) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + + (void)arg; + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_key_unref (key); + } + + gpgme_release (ctx); + return NULL; +} + +void * +start_verify (void *arg) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t sig, text; + gpgme_verify_result_t result; + gpgme_signature_t signature; + + (void)arg; + + err = gpgme_new (&ctx); + fail_if_err (err); + + /* Checking a valid message. */ + err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0); + fail_if_err (err); + err = gpgme_data_new_from_mem (&sig, test_sig1, strlen (test_sig1), 0); + fail_if_err (err); + err = gpgme_op_verify (ctx, sig, text, NULL); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + + signature = result->signatures; + + if (strcmp (signature->fpr, "A0FF4590BB6122EDEF6E3C542D727CC768697734")) + { + fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n", + __FILE__, __LINE__, signature->fpr); + exit (1); + } + if (gpgme_err_code (signature->status) != GPG_ERR_NO_ERROR) + { + fprintf (stderr, "%s:%i: Unexpected signature status: %s\n", + __FILE__, __LINE__, gpgme_strerror (signature->status)); + exit (1); + } + gpgme_free (text); + gpgme_free (sig); + gpgme_release (ctx); + return NULL; +} + +int +main (int argc, char *argv[]) +{ + int i; + pthread_t verify_threads[THREAD_COUNT]; + pthread_t keylist_threads[THREAD_COUNT]; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + (void)argc; + (void)argv; + + for (i = 0; i < THREAD_COUNT; i++) + { + if (pthread_create(&verify_threads[i], NULL, start_verify, NULL) || + pthread_create(&keylist_threads[i], NULL, start_keylist, NULL)) + { + fprintf(stderr, "%s:%i: failed to create threads \n", + __FILE__, __LINE__); + exit(1); + } + } + for (i = 0; i < THREAD_COUNT; i++) + { + pthread_join (verify_threads[i], NULL); + pthread_join (keylist_threads[i], NULL); + } + return 0; +} diff -Nru gpgme1.0-1.7.0/tests/gpg/t-verify.c gpgme1.0-1.8.0/tests/gpg/t-verify.c --- gpgme1.0-1.7.0/tests/gpg/t-verify.c 2016-09-13 18:09:01.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpg/t-verify.c 2016-11-16 12:23:31.000000000 +0000 @@ -209,6 +209,7 @@ gpgme_error_t err; gpgme_data_t sig, text; gpgme_verify_result_t result; + const char *s; (void)argc; (void)argv; @@ -270,6 +271,54 @@ exit (1); } + /* Checking that set/get_sernder works. */ + err = gpgme_set_sender (ctx, "foo@example.org"); + fail_if_err (err); + s = gpgme_get_sender (ctx); + if (!s || strcmp (s, "foo@example.org")) + { + fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n", + __FILE__, __LINE__); + exit (1); + } + + err = gpgme_set_sender (ctx, ""); + fail_if_err (err); + s = gpgme_get_sender (ctx); + if (!s || strcmp (s, "bar@example.org")) + { + fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n", + __FILE__, __LINE__); + exit (1); + } + + err = gpgme_set_sender (ctx, "Foo bar (comment) "); + fail_if_err (err); + s = gpgme_get_sender (ctx); + if (!s || strcmp (s, "foo@example.org")) + { + fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n", + __FILE__, __LINE__); + exit (1); + } + + err = gpgme_set_sender (ctx, "foo"); + if (gpgme_err_code (err) != GPG_ERR_INV_VALUE) + { + fprintf (stderr, "%s:%i: gpgme_set_sender didn't detect bogus address\n", + __FILE__, __LINE__); + exit (1); + } + /* (the former address should still be there.) */ + s = gpgme_get_sender (ctx); + if (!s || strcmp (s, "foo@example.org")) + { + fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n", + __FILE__, __LINE__); + exit (1); + } + + gpgme_data_release (sig); gpgme_data_release (text); gpgme_release (ctx); diff -Nru gpgme1.0-1.7.0/tests/gpgsm/cms-decrypt.c gpgme1.0-1.8.0/tests/gpgsm/cms-decrypt.c --- gpgme1.0-1.7.0/tests/gpgsm/cms-decrypt.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpgsm/cms-decrypt.c 2016-11-16 12:23:31.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/gpgsm/cms-keylist.c gpgme1.0-1.8.0/tests/gpgsm/cms-keylist.c --- gpgme1.0-1.7.0/tests/gpgsm/cms-keylist.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpgsm/cms-keylist.c 2016-11-16 12:23:31.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/gpgsm/Makefile.am gpgme1.0-1.8.0/tests/gpgsm/Makefile.am --- gpgme1.0-1.7.0/tests/gpgsm/Makefile.am 2015-06-08 12:54:24.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpgsm/Makefile.am 2016-11-11 08:08:15.000000000 +0000 @@ -70,7 +70,7 @@ echo faked-system-time 1008241200 >> ./gpgsm.conf ./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key ./trustlist.txt: diff -Nru gpgme1.0-1.7.0/tests/gpgsm/Makefile.in gpgme1.0-1.8.0/tests/gpgsm/Makefile.in --- gpgme1.0-1.7.0/tests/gpgsm/Makefile.in 2016-09-21 07:19:27.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpgsm/Makefile.in 2016-11-16 12:46:36.000000000 +0000 @@ -390,6 +390,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -917,7 +920,7 @@ echo faked-system-time 1008241200 >> ./gpgsm.conf ./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key ./trustlist.txt: diff -Nru gpgme1.0-1.7.0/tests/gpgsm/t-decrypt.c gpgme1.0-1.8.0/tests/gpgsm/t-decrypt.c --- gpgme1.0-1.7.0/tests/gpgsm/t-decrypt.c 2016-09-13 18:23:14.000000000 +0000 +++ gpgme1.0-1.8.0/tests/gpgsm/t-decrypt.c 2016-11-16 12:23:31.000000000 +0000 @@ -54,6 +54,8 @@ 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 @@ __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; } diff -Nru gpgme1.0-1.7.0/tests/Makefile.am gpgme1.0-1.8.0/tests/Makefile.am --- gpgme1.0-1.7.0/tests/Makefile.am 2016-09-14 18:13:23.000000000 +0000 +++ gpgme1.0-1.8.0/tests/Makefile.am 2016-11-16 12:25:09.000000000 +0000 @@ -15,7 +15,7 @@ # 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 . +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in @@ -33,7 +33,7 @@ noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \ run-verify run-encrypt run-identify run-decrypt run-genkey \ - run-keysign run-tofu + run-keysign run-tofu run-swdb if RUN_GPG_TESTS diff -Nru gpgme1.0-1.7.0/tests/Makefile.in gpgme1.0-1.8.0/tests/Makefile.in --- gpgme1.0-1.7.0/tests/Makefile.in 2016-09-21 07:19:26.000000000 +0000 +++ gpgme1.0-1.8.0/tests/Makefile.in 2016-11-16 12:46:35.000000000 +0000 @@ -31,7 +31,7 @@ # 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 . +# License along with this program; if not, see . VPATH = @srcdir@ @@ -103,7 +103,7 @@ run-export$(EXEEXT) run-import$(EXEEXT) run-sign$(EXEEXT) \ run-verify$(EXEEXT) run-encrypt$(EXEEXT) run-identify$(EXEEXT) \ run-decrypt$(EXEEXT) run-genkey$(EXEEXT) run-keysign$(EXEEXT) \ - run-tofu$(EXEEXT) + run-tofu$(EXEEXT) run-swdb$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/mkinstalldirs \ @@ -169,6 +169,10 @@ run_sign_OBJECTS = run-sign.$(OBJEXT) run_sign_LDADD = $(LDADD) run_sign_DEPENDENCIES = ../src/libgpgme.la +run_swdb_SOURCES = run-swdb.c +run_swdb_OBJECTS = run-swdb.$(OBJEXT) +run_swdb_LDADD = $(LDADD) +run_swdb_DEPENDENCIES = ../src/libgpgme.la run_tofu_SOURCES = run-tofu.c run_tofu_OBJECTS = run-tofu.$(OBJEXT) run_tofu_LDADD = $(LDADD) @@ -225,12 +229,12 @@ am__v_CCLD_1 = SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \ run-identify.c run-import.c run-keylist.c run-keysign.c \ - run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \ - t-version.c + run-sign.c run-swdb.c run-tofu.c run-verify.c t-data.c \ + t-engine-info.c t-version.c DIST_SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \ run-identify.c run-import.c run-keylist.c run-keysign.c \ - run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \ - t-version.c + run-sign.c run-swdb.c run-tofu.c run-verify.c t-data.c \ + t-engine-info.c t-version.c RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ @@ -452,6 +456,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -604,6 +611,10 @@ @rm -f run-sign$(EXEEXT) $(AM_V_CCLD)$(LINK) $(run_sign_OBJECTS) $(run_sign_LDADD) $(LIBS) +run-swdb$(EXEEXT): $(run_swdb_OBJECTS) $(run_swdb_DEPENDENCIES) $(EXTRA_run_swdb_DEPENDENCIES) + @rm -f run-swdb$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(run_swdb_OBJECTS) $(run_swdb_LDADD) $(LIBS) + run-tofu$(EXEEXT): $(run_tofu_OBJECTS) $(run_tofu_DEPENDENCIES) $(EXTRA_run_tofu_DEPENDENCIES) @rm -f run-tofu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(run_tofu_OBJECTS) $(run_tofu_LDADD) $(LIBS) @@ -639,6 +650,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keylist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keysign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-sign.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-swdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tofu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-verify.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-data.Po@am__quote@ diff -Nru gpgme1.0-1.7.0/tests/opassuan/Makefile.in gpgme1.0-1.8.0/tests/opassuan/Makefile.in --- gpgme1.0-1.7.0/tests/opassuan/Makefile.in 2016-09-21 07:19:27.000000000 +0000 +++ gpgme1.0-1.8.0/tests/opassuan/Makefile.in 2016-11-16 12:46:36.000000000 +0000 @@ -345,6 +345,9 @@ SWIG_LIB = @SWIG_LIB@ SYSROOT = @SYSROOT@ VERSION = @VERSION@ +VERSION_MAJOR = @VERSION_MAJOR@ +VERSION_MICRO = @VERSION_MICRO@ +VERSION_MINOR = @VERSION_MINOR@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru gpgme1.0-1.7.0/tests/opassuan/t-command.c gpgme1.0-1.8.0/tests/opassuan/t-command.c --- gpgme1.0-1.7.0/tests/opassuan/t-command.c 2016-09-13 18:34:47.000000000 +0000 +++ gpgme1.0-1.8.0/tests/opassuan/t-command.c 2016-11-16 12:23:31.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff -Nru gpgme1.0-1.7.0/tests/run-decrypt.c gpgme1.0-1.8.0/tests/run-decrypt.c --- gpgme1.0-1.7.0/tests/run-decrypt.c 2016-08-04 13:03:09.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-decrypt.c 2016-11-16 12:23:22.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building @@ -51,9 +51,13 @@ { gpgme_recipient_t recp; int count = 0; + printf ("Original file name: %s\n", nonnull(result->file_name)); printf ("Wrong key usage: %i\n", result->wrong_key_usage); - printf ("Unsupported algorithm: %s\n ", nonnull(result->unsupported_algorithm)); + printf ("Unsupported algorithm: %s\n", + nonnull(result->unsupported_algorithm)); + if (result->session_key) + printf ("Session key: %s\n", result->session_key); for (recp = result->recipients; recp->next; recp = recp->next) { @@ -74,6 +78,8 @@ " --status print status lines from the backend\n" " --openpgp use the OpenPGP protocol (default)\n" " --cms use the CMS protocol\n" + " --export-session-key show the session key\n" + " --override-session-key STRING use STRING as session key\n" , stderr); exit (ex); } @@ -91,6 +97,8 @@ gpgme_data_t out = NULL; gpgme_decrypt_result_t result; int print_status = 0; + int export_session_key = 0; + const char *override_session_key = NULL; if (argc) { argc--; argv++; } @@ -125,6 +133,19 @@ protocol = GPGME_PROTOCOL_CMS; argc--; argv++; } + else if (!strcmp (*argv, "--export-session-key")) + { + export_session_key = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--override-session-key")) + { + argc--; argv++; + if (!argc) + show_usage (1); + override_session_key = *argv; + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) show_usage (1); @@ -152,6 +173,27 @@ gpgme_set_status_cb (ctx, status_cb, NULL); gpgme_set_ctx_flag (ctx, "full-status", "1"); } + if (export_session_key) + { + err = gpgme_set_ctx_flag (ctx, "export-session-key", "1"); + if (err) + { + fprintf (stderr, PGM ": error requesting exported session key: %s\n", + gpgme_strerror (err)); + exit (1); + } + } + if (override_session_key) + { + err = gpgme_set_ctx_flag (ctx, "override-session-key", + override_session_key); + if (err) + { + fprintf (stderr, PGM ": error overriding session key: %s\n", + gpgme_strerror (err)); + exit (1); + } + } err = gpgme_data_new_from_stream (&in, fp_in); if (err) @@ -176,10 +218,11 @@ fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err)); exit (1); } - if (result) { - print_result (result); - print_data (out); - } + if (result) + { + print_result (result); + print_data (out); + } gpgme_data_release (out); gpgme_data_release (in); diff -Nru gpgme1.0-1.7.0/tests/run-encrypt.c gpgme1.0-1.8.0/tests/run-encrypt.c --- gpgme1.0-1.7.0/tests/run-encrypt.c 2016-08-21 12:29:55.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-encrypt.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-export.c gpgme1.0-1.8.0/tests/run-export.c --- gpgme1.0-1.7.0/tests/run-export.c 2016-04-18 15:35:08.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-export.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-genkey.c gpgme1.0-1.8.0/tests/run-genkey.c --- gpgme1.0-1.7.0/tests/run-genkey.c 2016-09-14 10:42:12.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-genkey.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-identify.c gpgme1.0-1.8.0/tests/run-identify.c --- gpgme1.0-1.7.0/tests/run-identify.c 2016-06-22 16:15:03.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-identify.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-import.c gpgme1.0-1.8.0/tests/run-import.c --- gpgme1.0-1.7.0/tests/run-import.c 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-import.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-keylist.c gpgme1.0-1.8.0/tests/run-keylist.c --- gpgme1.0-1.7.0/tests/run-keylist.c 2016-09-07 07:04:18.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-keylist.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-keysign.c gpgme1.0-1.8.0/tests/run-keysign.c --- gpgme1.0-1.7.0/tests/run-keysign.c 2016-09-14 16:59:55.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-keysign.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff -Nru gpgme1.0-1.7.0/tests/run-sign.c gpgme1.0-1.8.0/tests/run-sign.c --- gpgme1.0-1.7.0/tests/run-sign.c 2016-09-13 18:36:37.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-sign.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building @@ -83,6 +83,7 @@ " --uiserver use the UI server\n" " --loopback use a loopback pinentry\n" " --key NAME use key NAME for signing\n" + " --sender MBOX use MBOX as sender address\n" , stderr); exit (ex); } @@ -101,6 +102,7 @@ gpgme_sign_result_t result; int print_status = 0; int use_loopback = 0; + const char *sender = NULL; if (argc) { argc--; argv++; } @@ -148,6 +150,14 @@ key_string = *argv; argc--; argv++; } + else if (!strcmp (*argv, "--sender")) + { + argc--; argv++; + if (!argc) + show_usage (1); + sender = *argv; + argc--; argv++; + } else if (!strcmp (*argv, "--loopback")) { use_loopback = 1; @@ -192,6 +202,12 @@ gpgme_key_unref (akey); } + if (sender) + { + err = gpgme_set_sender (ctx, sender); + fail_if_err (err); + } + err = gpgme_data_new_from_file (&in, *argv, 1); if (err) { diff -Nru gpgme1.0-1.7.0/tests/run-support.h gpgme1.0-1.8.0/tests/run-support.h --- gpgme1.0-1.7.0/tests/run-support.h 2016-09-13 18:36:16.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-support.h 2016-11-16 12:23:21.000000000 +0000 @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #include diff -Nru gpgme1.0-1.7.0/tests/run-swdb.c gpgme1.0-1.8.0/tests/run-swdb.c --- gpgme1.0-1.7.0/tests/run-swdb.c 1970-01-01 00:00:00.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-swdb.c 2016-11-16 12:23:22.000000000 +0000 @@ -0,0 +1,151 @@ +/* run-swdb.c - Test tool for SWDB function + * Copyright (C) 2016 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, see . + */ + +/* 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 +#endif + +#include +#include +#include +#include + +#include + +#define PGM "run-swdb" + +#include "run-support.h" + + +static int verbose; + + +static const char * +isotimestr (unsigned long value) +{ + time_t t; + static char buffer[25+5]; + struct tm *tp; + + if (!value) + return "none"; + t = value; + + tp = gmtime (&t); + snprintf (buffer, sizeof buffer, "%04d-%02d-%02d %02d:%02d:%02d", + 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec); + return buffer; +} + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] NAME [VERSION]\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --status print status lines from the backend\n" + , stderr); + exit (ex); +} + + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_protocol_t protocol = GPGME_PROTOCOL_GPGCONF; + const char *name; + const char *iversion; + gpgme_query_swdb_result_t result; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + } + + if (argc < 1 || argc > 2) + show_usage (1); + name = argv[0]; + iversion = argc > 1? argv[1] : NULL; + + init_gpgme (protocol); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, protocol); + + err = gpgme_op_query_swdb (ctx, name, iversion, 0); + if (err) + { + fprintf (stderr, PGM ": error querying swdb: %s\n", gpg_strerror (err)); + exit (1); + } + + result = gpgme_op_query_swdb_result (ctx); + if (!result) + { + fprintf (stderr, PGM ": error querying swdb: %s\n", "no result"); + exit (1); + } + + printf ("package ...: %s\n" + "iversion ..: %s\n" + "version ...: %s\n", + nonnull (result->name), + nonnull (result->iversion), + nonnull (result->version)); + printf ("reldate ...: %s\n", isotimestr (result->reldate)); + printf ("created ...: %s\n", isotimestr (result->created)); + printf ("retrieved .: %s\n", isotimestr (result->retrieved)); + printf ("flags .....:%s%s%s%s%s%s%s\n", + result->warning? " warning" : "", + result->update? " update" : "", + result->urgent? " urgent" : "", + result->unknown? " unknown" : "", + result->tooold? " tooold" : "", + result->noinfo? " noinfo" : "", + result->error? " error" : "" ); + + + gpgme_release (ctx); + return 0; +} diff -Nru gpgme1.0-1.7.0/tests/run-tofu.c gpgme1.0-1.8.0/tests/run-tofu.c --- gpgme1.0-1.7.0/tests/run-tofu.c 2016-09-14 18:16:20.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-tofu.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building @@ -99,6 +99,7 @@ const char *fpr; const char *policystr = NULL; gpgme_tofu_policy_t policy; + const char *s; if (argc) { argc--; argv++; } @@ -145,10 +146,31 @@ fail_if_err (err); gpgme_set_protocol (ctx, protocol); gpgme_set_armor (ctx, 1); + + + s = gpgme_get_ctx_flag (ctx, "no_such-flag"); + if (s) + { + fprintf (stderr, PGM ": gpgme_get_ctx_flag failed " + "(bad name not detected)\n"); + exit (1); + } + s = gpgme_get_ctx_flag (ctx, "full-status"); + if (!s || *s) + { + fprintf (stderr, PGM ": gpgme_get_ctx_flag failed (wrong false)\n"); + exit (1); + } if (print_status) { gpgme_set_status_cb (ctx, status_cb, NULL); gpgme_set_ctx_flag (ctx, "full-status", "1"); + s = gpgme_get_ctx_flag (ctx, "full-status"); + if (!s || strcmp (s, "1")) + { + fprintf (stderr, PGM ": gpgme_get_ctx_flag fauled (wrong true)\n"); + exit (1); + } } err = gpgme_get_key (ctx, fpr, &thekey, 0); diff -Nru gpgme1.0-1.7.0/tests/run-verify.c gpgme1.0-1.8.0/tests/run-verify.c --- gpgme1.0-1.7.0/tests/run-verify.c 2016-09-07 07:05:26.000000000 +0000 +++ gpgme1.0-1.8.0/tests/run-verify.c 2016-11-16 12:23:22.000000000 +0000 @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building @@ -221,6 +221,7 @@ " --status print status lines from the backend\n" " --openpgp use the OpenPGP protocol (default)\n" " --cms use the CMS protocol\n" + " --sender MBOX use MBOX as sender address\n" , stderr); exit (ex); } @@ -239,6 +240,7 @@ gpgme_data_t msg = NULL; gpgme_verify_result_t result; int print_status = 0; + const char *sender = NULL; if (argc) { argc--; argv++; } @@ -273,6 +275,14 @@ protocol = GPGME_PROTOCOL_CMS; argc--; argv++; } + else if (!strcmp (*argv, "--sender")) + { + argc--; argv++; + if (!argc) + show_usage (1); + sender = *argv; + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) show_usage (1); @@ -313,6 +323,12 @@ } /* gpgme_set_ctx_flag (ctx, "raw-description", "1"); */ + if (sender) + { + err = gpgme_set_sender (ctx, sender); + fail_if_err (err); + } + err = gpgme_data_new_from_stream (&sig, fp_sig); if (err) { diff -Nru gpgme1.0-1.7.0/THANKS gpgme1.0-1.8.0/THANKS --- gpgme1.0-1.7.0/THANKS 2013-03-15 19:27:33.000000000 +0000 +++ gpgme1.0-1.8.0/THANKS 2016-10-18 17:22:02.000000000 +0000 @@ -5,7 +5,7 @@ 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 @@ 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 -Nru gpgme1.0-1.7.0/VERSION gpgme1.0-1.8.0/VERSION --- gpgme1.0-1.7.0/VERSION 2016-09-21 07:20:07.000000000 +0000 +++ gpgme1.0-1.8.0/VERSION 2016-11-16 12:47:28.000000000 +0000 @@ -1 +1 @@ -1.7.0 +1.8.0