summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTizenOpenSource <tizenopensrc@samsung.com>2023-02-01 18:22:00 +0900
committerTizenOpenSource <tizenopensrc@samsung.com>2023-02-01 18:22:00 +0900
commit73f75b48c0470a46b31340f5cc9e5219d6ee0faa (patch)
treede57a4f03945b3365d4a85eac0ea2eb4c68ab801
parent9dc2bb3fe7e57cb5a597efe3a7bf78bda815f374 (diff)
downloadgpgme-73f75b48c0470a46b31340f5cc9e5219d6ee0faa.tar.gz
gpgme-73f75b48c0470a46b31340f5cc9e5219d6ee0faa.tar.bz2
gpgme-73f75b48c0470a46b31340f5cc9e5219d6ee0faa.zip
Imported Upstream version 1.18.0upstream/1.18.0
-rw-r--r--ChangeLog525
-rw-r--r--Makefile.in2
-rw-r--r--NEWS66
-rw-r--r--VERSION2
-rw-r--r--aclocal.m41
-rwxr-xr-xbuild-aux/config.guess1612
-rwxr-xr-xbuild-aux/config.sub2655
-rw-r--r--conf/config.h.in6
-rwxr-xr-xconfigure211
-rw-r--r--configure.ac43
-rw-r--r--doc/Makefile.in2
-rw-r--r--doc/defsincdate2
-rw-r--r--doc/gpgme.info222
-rw-r--r--doc/gpgme.info-143
-rw-r--r--doc/gpgme.info-29
-rw-r--r--doc/gpgme.texi40
-rw-r--r--gpgme.spec2
-rw-r--r--lang/Makefile.in2
-rw-r--r--lang/cl/Makefile.in2
-rw-r--r--lang/cl/gpgme.asd2
-rw-r--r--lang/cpp/Makefile.in2
-rw-r--r--lang/cpp/src/GpgmeppConfig-w32.cmake.in.in4
-rw-r--r--lang/cpp/src/GpgmeppConfig.cmake.in.in4
-rw-r--r--lang/cpp/src/Makefile.am5
-rw-r--r--lang/cpp/src/Makefile.in14
-rw-r--r--lang/cpp/src/context.cpp38
-rw-r--r--lang/cpp/src/context.h14
-rw-r--r--lang/cpp/src/context_p.h1
-rw-r--r--lang/cpp/src/editinteractor.cpp19
-rw-r--r--lang/cpp/src/editinteractor.h3
-rw-r--r--lang/cpp/src/global.h15
-rw-r--r--lang/cpp/src/gpgrevokekeyeditinteractor.cpp216
-rw-r--r--lang/cpp/src/gpgrevokekeyeditinteractor.h62
-rw-r--r--lang/cpp/src/importresult.cpp125
-rw-r--r--lang/cpp/src/importresult.h10
-rw-r--r--lang/cpp/src/key.cpp12
-rw-r--r--lang/cpp/src/result.h8
-rw-r--r--lang/cpp/src/util.h35
-rw-r--r--lang/cpp/tests/Makefile.in2
-rw-r--r--lang/cpp/tests/run-getkey.cpp14
-rw-r--r--lang/cpp/tests/run-keylist.cpp18
-rw-r--r--lang/js/BrowserTestExtension/Makefile.in2
-rw-r--r--lang/js/DemoExtension/Makefile.in2
-rw-r--r--lang/js/Makefile.in2
-rw-r--r--lang/js/src/Makefile.in2
-rw-r--r--lang/python/Makefile.in2
-rw-r--r--lang/python/doc/Makefile.in2
-rw-r--r--lang/python/examples/Makefile.in2
-rw-r--r--lang/python/src/Makefile.in2
-rw-r--r--lang/python/src/core.py28
-rw-r--r--lang/python/tests/Makefile.in2
-rwxr-xr-xlang/python/tests/t-idiomatic.py3
-rw-r--r--lang/qt/Makefile.in2
-rw-r--r--lang/qt/doc/Makefile.in2
-rw-r--r--lang/qt/src/Makefile.am23
-rw-r--r--lang/qt/src/Makefile.in62
-rw-r--r--lang/qt/src/RevokeKeyJob1
-rw-r--r--lang/qt/src/SetPrimaryUserIDJob1
-rw-r--r--lang/qt/src/decryptjob.h2
-rw-r--r--lang/qt/src/decryptverifyjob.h2
-rw-r--r--lang/qt/src/downloadjob.h2
-rw-r--r--lang/qt/src/encryptjob.cpp61
-rw-r--r--lang/qt/src/encryptjob.h7
-rw-r--r--lang/qt/src/exportjob.h3
-rw-r--r--lang/qt/src/gpgcardjob.h18
-rw-r--r--lang/qt/src/job.cpp6
-rw-r--r--lang/qt/src/keyformailboxjob.h10
-rw-r--r--lang/qt/src/keylistjob.h6
-rw-r--r--lang/qt/src/protocol.h16
-rw-r--r--lang/qt/src/protocol_p.h35
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.cpp8
-rw-r--r--lang/qt/src/qgpgmeencryptjob.cpp25
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.cpp2
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.cpp (renamed from lang/qt/src/qgpgmerefreshkeysjob.cpp)61
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.h (renamed from lang/qt/src/qgpgmerefreshkeysjob.h)17
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.cpp128
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.h70
-rw-r--r--lang/qt/src/qgpgmesetprimaryuseridjob.cpp75
-rw-r--r--lang/qt/src/qgpgmesetprimaryuseridjob.h64
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.cpp23
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.cpp6
-rw-r--r--lang/qt/src/refreshkeysjob.h23
-rw-r--r--lang/qt/src/revokekeyjob.h86
-rw-r--r--lang/qt/src/setprimaryuseridjob.h69
-rw-r--r--lang/qt/src/signencryptjob.cpp61
-rw-r--r--lang/qt/src/signencryptjob.h7
-rw-r--r--lang/qt/src/signjob.h2
-rw-r--r--lang/qt/src/signkeyjob.h2
-rw-r--r--lang/qt/src/util.cpp18
-rw-r--r--lang/qt/src/util.h16
-rw-r--r--lang/qt/src/verifydetachedjob.h5
-rw-r--r--lang/qt/src/verifyopaquejob.h2
-rw-r--r--lang/qt/src/wkspublishjob.h7
-rw-r--r--lang/qt/tests/Makefile.am13
-rw-r--r--lang/qt/tests/Makefile.in87
-rw-r--r--lang/qt/tests/run-refreshkeysjob.cpp155
-rw-r--r--lang/qt/tests/t-revokekey.cpp338
-rw-r--r--lang/qt/tests/t-setprimaryuserid.cpp165
-rw-r--r--lang/qt/tests/t-various.cpp12
-rw-r--r--lang/qt/tests/t-verify.cpp2
-rw-r--r--m4/ax_gcc_func_attribute.m4242
-rw-r--r--m4/glib-2.0.m49
-rw-r--r--m4/gpg-error.m43
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile.in7
-rw-r--r--src/assuan-support.c42
-rw-r--r--src/decrypt.c23
-rw-r--r--src/engine-backend.h3
-rw-r--r--src/engine-gpg.c12
-rw-r--r--src/engine.c5
-rw-r--r--src/engine.h1
-rw-r--r--src/gpgme-json.c5
-rw-r--r--src/gpgme-tool.c4
-rw-r--r--src/gpgme.c4
-rw-r--r--src/gpgme.h.in2
-rw-r--r--src/import.c52
-rw-r--r--src/keylist.c21
-rw-r--r--src/ops.h12
-rw-r--r--src/posix-io.c24
-rw-r--r--tests/Makefile.in2
-rw-r--r--tests/gpg/Makefile.in2
-rw-r--r--tests/gpg/t-edit-sign.c6
-rw-r--r--tests/gpgsm/Makefile.in2
-rw-r--r--tests/json/Makefile.in2
-rw-r--r--tests/opassuan/Makefile.in2
-rw-r--r--tests/run-sign.c6
126 files changed, 6007 insertions, 2417 deletions
diff --git a/ChangeLog b/ChangeLog
index 82bdd4a..0061180 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,530 @@
+2022-08-10 Werner Koch <wk@gnupg.org>
+
+ Release 1.18.0.
+ + commit 26ff163bd6912fa7e8cb522d0799e17095ac1efb
+
+
+ tests: Make t-edit-sign more robust.
+ + commit 9ee74b68e688b474881768a5ae59d857397c8fbf
+ * tests/gpg/t-edit-sign.c (interact_fnc): Provide the default answer.
+
+2022-08-10 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Add missing include.
+ + commit 5d91182c955d128c8ff7cdd29189fc3ae06201d9
+ * lang/qt/tests/t-revokekey.cpp: Include QDebug.
+
+2022-08-09 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Add job to set the primary user ID of OpenPGP keys.
+ + commit db7d79063f57c6e0ccf382fdf1cf47d514e12f6e
+ * lang/qt/src/qgpgmesetprimaryuseridjob.cpp,
+ lang/qt/src/qgpgmesetprimaryuseridjob.h,
+ lang/qt/src/setprimaryuseridjob.h: New.
+ * lang/qt/src/protocol.h (class Protocol): Add pure virtual member
+ function setPrimaryUserIDJob.
+ * lang/qt/src/protocol_p.h (Protocol::setPrimaryUserIDJob): New.
+ * lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.
+
+ * lang/qt/tests/t-setprimaryuserid.cpp: New.
+ * lang/qt/tests/Makefile.am: Add new test.
+
+ cpp: Add support for gpgme_op_set_uid_flag.
+ + commit 125867f268f2a49ff060a7adc859500500b77025
+ * lang/cpp/src/context.cpp, lang/cpp/src/context.h
+ (Context::setPrimaryUid, Context::startSetPrimaryUid): New.
+
+2022-08-09 NIIBE Yutaka <gniibe@fsij.org>
+
+ python: Don't call __del__ from __exit__ method.
+ + commit f8d99bb9e4a7f6229c19c4fbd951ccad6fa97bde
+ * lang/python/src/core.py (Context, Data): Don't call __del__
+ from __exit__ method, as the object may be still in use.
+ * lang/python/tests/t-idiomatic.py: Fix the test.
+
+2022-08-05 NIIBE Yutaka <gniibe@fsij.org>
+
+ python: Don't access gpgme with wrapped=None.
+ + commit 180899c7c313335128606bfff738da00dce4f5c9
+ * lang/python/src/core.py (GpgmeWrapper, Context): Check self.wrapped
+ is valid.
+
+2022-08-05 Jasper Spaans <jasper@startmail.com>
+
+ python: Reset passphrase callback correctly.
+ + commit b2f224a471fecce566443bf0f0e554de6f567f4e
+ * lang/python/src/core.py (Context(GpgmeWrapper)): Reset passphrase
+ callback correctly, for encrypt, decrypt, create_key, and
+ create_subkey methods.
+
+2022-08-04 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Remove job for refreshing OpenPGP keys.
+ + commit c3b183831db5a2a490ba49bf4804730679eb59d0
+ * lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp,
+ lang/qt/src/qgpgmerefreshopenpgpkeysjob.h,
+ lang/qt/src/refreshopenpgpkeysjob.h: Remove.
+ * lang/qt/src/Makefile.am, lang/qt/src/job.cpp: Update accordingly.
+ * lang/qt/src/protocol.h (class Protocol): Remove pure virtual member
+ function refreshOpenPGPKeysJob.
+ * lang/qt/src/protocol_p.h (Protocol::refreshOpenPGPKeysJob): Remove.
+
+ * lang/qt/tests/run-refreshkeysjob.cpp (main): Use ReceiveKeysJob for
+ OpenPGP keys.
+
+2022-07-21 NIIBE Yutaka <gniibe@fsij.org>
+
+ build: Update config.guess and config.sub.
+ + commit cc37447b625b45efb5c94c40461084460f03f24a
+ * build-aux/config.guess: Update from upstream.
+ * build-aux/config.sub: Ditto.
+
+ build: Fix for modern Autoconf.
+ + commit 16020c5fd96427961734c4a8f5b2b5e901b1bb60
+ * m4/glib-2.0.m4: Use AC_RUN_IFELSE and AC_LINK_IFELSE.
+
+2022-07-05 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Allow setting the file name of signed and encrypted data.
+ + commit 5436b309fe67dd3c4531f751d99c98128ca66e4d
+ * lang/qt/src/Makefile.am (qgpgme_sources): Add signencryptjob.cpp.
+ * lang/qt/src/signencryptjob.cpp: New.
+ * lang/qt/src/signencryptjob.h (class SignEncryptJob): Add member
+ functions setFileName, fileName.
+ * lang/qt/src/qgpgmesignencryptjob.cpp (sign_encrypt): Set file name of
+ input.
+ (sign_encrypt_qba, QGpgMESignEncryptJob::exec,
+ QGpgMESignEncryptJob::start): Pass file name to sign_encrypt resp.
+ sign_encrypt_qba.
+
+ qt: Allow setting the file name of encrypted data.
+ + commit bc10169724d2806b38f91beff39ef637b5e52b8d
+ * lang/qt/src/Makefile.am (qgpgme_sources): Add encryptjob.cpp.
+ * lang/qt/src/encryptjob.cpp: New.
+ * lang/qt/src/encryptjob.h (class EncryptJob): Add member functions
+ setFileName, fileName.
+ * lang/qt/src/qgpgmeencryptjob.cpp (encrypt): Set file name of input.
+ (encrypt_qba, QGpgMEEncryptJob::exec, QGpgMEEncryptJob::start): Pass
+ file name to encrypt resp. encrypt_qba.
+
+2022-07-04 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Fix filename of cmake config files for w32.
+ + commit 31423945d214292f24dd1f700cd8ab53722dd1eb
+ * lang/qt/src/Makefile.am (EXTRA_DIST): Add
+ QGpgmeConfig-w32.cmake.in.in.
+
+2022-07-04 Laurent Montel <montel@kde.org>
+
+ qt: Add #include <QStringList> needed for building against qt6.
+ + commit d42323f90213157a5e847bfa89bee55a29ee8df0
+ * lang/qt/src/downloadjob.h, lang/qt/src/exportjob.h,
+ lang/qt/src/keylistjob.h lang/qt/src/refreshkeysjob.h: in qt6 we need
+ to use #include <QStringList>
+
+2022-06-30 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ cpp: Remove obsolete compatibility with KF5 variants.
+ + commit 6e45da30ae787dd45836e55d34f7aa4e001b641c
+ * lang/cpp/src/GpgmeppConfig-w32.cmake.in.in,
+ lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove find_package() call.
+
+2022-06-28 NIIBE Yutaka <gniibe@fsij.org>
+
+ build: When no gpg-error-config, not install gpgme-config.
+ + commit 02a2f350359013bf33c3957e95c98726273ced8c
+ * configure.ac (USE_GPGRT_CONFIG): New.
+ * src/Makefile.am [USE_GPGRT_CONFIG]: Conditionalize the install
+ of gpgme-config.
+
+ build: Update gpg-error.m4.
+ + commit aa94b4cee5aabfa9097abd4560fdf002516db82a
+ * m4/gpg-error.m4: Update from libgpg-error.
+
+2022-06-14 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ tests: Add support for clear text signatures to test runner.
+ + commit d59cf1725755f24e79a0ce12ddc59fedc97292c6
+ * tests/run-sign.c (show_usage): Add new argument "--clear".
+ (main): Handle new argument "--clear".
+
+2022-06-10 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt,tests: Allow 1-day-offset for expiration date.
+ + commit fd813f5c3938423137db1fcb02c3c527bd9f58c6
+ * lang/qt/tests/t-various.cpp (TestVarious::testSignKeyWithExpiration):
+ Assert that the expiration date is either 2106-02-05 or 2106-02-04.
+
+ qt: Prevent u32 overflow when calculating expiration date.
+ + commit 7870fdbfeff47755138136dbd6648b18f6b4fc76
+ * lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Change maxAllowedDate to
+ 2106-02-05. Change log-level from warning to debug.
+ * lang/qt/tests/t-various.cpp (TestVarious::testSignKeyWithExpiration):
+ Remove check for warning. Adapt assertion.
+
+2022-06-09 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ Revert "tests: Avoid problems with local time across a day boundary."
+ + commit 918afc809d40e057266ced6dfc98a5b3e5b4d3ee
+ This reverts commit 5ba0e454a37c9b0d3badddfc2dad8bcc7c7af874.
+
+ core: Handle import status lines during keylist operation.
+ + commit 5d19eb4ad5ad9e93c34bf9b03ed6f583c6bf8491
+ * src/keylist.c (gpgme_op_keylist_from_data_start): Call
+ _gpgme_op_import_init_result.
+
+2022-05-12 Andre Heinecke <aheinecke@gnupg.org>
+
+ cpp: Export KeyListModeSaver.
+ + commit f3011b5a1918dbe9d2b1316707a2c1034c847507
+ * lang/cpp/src/context.h (Context::KeyListModeSaver): Add Export.
+
+2022-05-06 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ core: Set SECRET flag of subkeys stored on smart cards.
+ + commit f72cf726ca749a138a8950b02c51e7b3a50c6a83
+ * src/keylist.c (parse_sec_field15): Set SECRET flag.
+
+2022-05-05 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ cpp: Output more properties of a subkey.
+ + commit 306fd9c915cbccddbd146f37ba9bd826f10d2535
+ * lang/cpp/src/key.cpp (ostream operator<< for Subkey): Fix wrong output
+ of isInvalid and isDisabled flags. Add output of key grip, card serial
+ number and the flags isSecret, isQualified, isDeVs, and isCardKey.
+
+ cpp,tests: Actually parse the --with-secret option.
+ + commit e029fd27350fcbda1b4689bc557e996d749d78ac
+ * lang/cpp/tests/run-keylist.cpp (main): Handle --with-secret option.
+ Print error for unknown option.
+
+ qt: Revert change of result signal of RefreshKeysJob.
+ + commit 9e8c8e448ec83c454fb310f80ce0bf9f828a7145
+ * lang/qt/src/refreshkeysjob.h (RefreshKeysJob::result): Remove optional
+ parameters auditLogAsHtml and auditLogError.
+ * lang/qt/tests/run-refreshkeysjob.cpp (main): Update accordingly.
+
+ qt: Use lambda instead of std::bind.
+ + commit 15a4940aa73019bce002302b14aaa73312da3df4
+ * lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp
+ (QGpgMERefreshOpenPGPKeysJob::start): Replace std::bind call with a
+ lambda.
+
+2022-05-04 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Emit import result when refreshing OpenPGP keys.
+ + commit c64a8daf507a2216611861a12f312466b0bae8b2
+ * lang/qt/src/refreshopenpgpkeysjob.h: New.
+ * lang/qt/src/Makefile.am, lang/qt/src/job.cpp: Update accordingly.
+ * lang/qt/src/qgpgmerefreshopenpgpkeysjob.h (class
+ QGpgMERefreshOpenPGPKeysJob): Derive from RefreshOpenPGPKeysJob with
+ result ImportResult. Remove unused start overload.
+ * lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp (locate_external_keys):
+ Ignore result of KeyListJob. Return import result.
+ (receive_keys): Return import result.
+ (refresh_keys): Merge the two import results and return the result.
+ * lang/qt/src/protocol.h (class Protocol): Add pure virtual member
+ function refreshOpenPGPKeysJob.
+ * lang/qt/src/protocol_p.h (Protocol::refreshKeysJob): Return nullptr
+ for OpenPGP protocol.
+ (Protocol::refreshOpenPGPKeysJob): New.
+
+ * lang/qt/tests/run-refreshkeysjob.cpp (main): Use appropriate job
+ for the protocol of the key to refresh.
+
+ cpp: Allow retrieving import result of key listing with locate mode.
+ + commit 3519d6117332f25b601c9c0636878baf4e8cf55b
+ * lang/cpp/src/context_p.h (enum Context::Private::Operation): Add
+ value KeyListWithImport.
+ * lang/cpp/src/context.cpp (Context::startKeyListing, Context::nextKey):
+ Set lastop to KeyListWithImport if keylist mode includes Locate.
+
+ core: Handle import status lines during keylist operation.
+ + commit f3ca57dfd7af19f9b2fd01616a81dc889707a4d3
+ * src/import.c (import_status_handler): Rename to ...
+ (_gpgme_import_status_handler): this. Make non-static.
+ (_gpgme_op_import_init_result): New.
+ (_gpgme_op_import_start, _gpgme_op_import_keys_start,
+ _gpgme_op_receive_keys_start): Call _gpgme_op_import_init_result.
+ * src/keylist.c (keylist_status_handler): Call
+ _gpgme_import_status_handler to handle import status lines.
+ (gpgme_op_keylist_start, gpgme_op_keylist_ext_start): Call
+ _gpgme_op_import_init_result.
+ * src/ops.h (_gpgme_op_import_init_result,
+ _gpgme_import_status_handler): New prototypes.
+
+ cpp: Allow merging the results of two imports.
+ + commit d911a1536488a5645f257a48b4d9cf221c0ed6b6
+ * lang/cpp/src/importresult.h, lang/cpp/src/importresult.cpp (class
+ ImportResult): Add member function mergeWith.
+
+2022-05-02 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Apply compiler hint.
+ + commit f1a354fd57d6cc9e34ff33ea60aa4ef0aca382a3
+ * lang/qt/tests/t-verify.cpp (VerifyTest::testSignatureKey): Use
+ reference type to prevent copying.
+
+ qt: Use GpgME::Locate alias.
+ + commit 540e7bf3d457a78497b6b7ac33b486b3c5b50857
+ * lang/qt/src/protocol_p.h (Protocol::locateKeysJob): Use Locate alias
+ instead of Extern|Local.
+ * lang/qt/src/qgpgmekeyformailboxjob.cpp (do_work): Ditto.
+
+ qt: Add job for refreshing OpenPGP keys.
+ + commit e12861f18c6b431b40bfa78eb6f1d149690a5fcd
+ * lang/qt/src/qgpgmerefreshopenpgpkeysjob.h,
+ lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp: New.
+ * lang/qt/src/Makefile.am: Add new files.
+ * lang/qt/src/protocol_p.h (Protocol::refreshKeysJob): Add support for
+ OpenPGP protocol.
+
+ cpp: Add RAII class for saving/restoring the key list mode.
+ + commit 34786132fed0a776d4cd314c44ed62e29ff75328
+ * lang/cpp/src/context.h, lang/cpp/src/context.cpp (class Context):
+ Add nested class KeyListModeSaver.
+
+ qt: Add debug helper for Result classes with output stream operator.
+ + commit 99fd565889f3d22459ff82296b206fa228a4c468
+ * lang/qt/src/util.h (toLogString): New.
+
+ qt: Factor out helper for getting the fingerprints of some keys.
+ + commit 0c304beeaab54dc25a8572270704fd5fa90cf836
+ * lang/qt/src/util.h, lang/qt/src/util.cpp (toFingerprints): New.
+ * lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: Use the helper.
+
+2022-04-29 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Fix connection to readyReadStandardOutput signal.
+ + commit 54c4fd16d1832fcce05aa9e471a4acebff0e3269
+ * lang/qt/src/qgpgmerefreshsmimekeysjob.h,
+ lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
+ (QGpgMERefreshSMIMEKeysJob::slotStderr): Remove.
+ * lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
+ (QGpgMERefreshSMIMEKeysJob::startAProcess): Handle
+ readyReadStandardOutput and readyReadStandardError signals with lambdas.
+
+ qt: Add test runner for refresh job.
+ + commit 9686258bd16707a5e1eb292262a6c28faa581c34
+ * lang/qt/tests/run-refreshkeysjob.cpp: New.
+ * lang/qt/tests/Makefile.am (run_refreshkeysjob_SOURCES): New.
+ (noinst_PROGRAMS): Add new build artifact.
+
+ qt: Make RefreshKeysJob result compatible with standard job result.
+ + commit f4c35609257156d0e32b8dd7315011b484919f05
+ * lang/qt/src/refreshkeysjob.h (RefreshKeysJob::result): Add optional
+ parameters auditLogAsHtml and auditLogError.
+
+ qt: Allow refreshing a list of keys.
+ + commit fd97cbaa44b8e7914089319afac1e776c9a64283
+ * lang/qt/src/refreshkeysjob.h (class RefreshKeysJob): Add pure virtual
+ member function start taking a list of keys.
+ * lang/qt/src/qgpgmerefreshsmimekeysjob.h,
+ lang/qt/src/qgpgmerefreshsmimekeysjob.cpp (class
+ QGpgMERefreshSMIMEKeysJob): Implement new member function.
+
+ qt: Minor refactoring.
+ + commit 62e770971786f272ecc079b78b11e798ec699d77
+ * lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: Use namespace QGpgME.
+
+ qt: Rename QGpgMERefreshKeysJob to QGpgMERefreshSMIMEKeysJob.
+ + commit f47bc992ae6ca6a9043d4de5bfc10179e4676256
+ * lang/qt/src/qgpgmerefreshkeysjob.h,
+ lang/qt/src/qgpgmerefreshkeysjob.cpp: Change name to
+ * lang/qt/src/qgpgmerefreshsmimekeysjob.h,
+ lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: ... this, and adapt the
+ include guard.
+ (class QGpgMERefreshKeysJob): Rename to QGpgMERefreshSMIMEKeysJob.
+ * lang/qt/src/Makefile.am: Adapt mentioned file names accordingly.
+ * lang/qt/src/protocol_p.h (Protocol::refreshKeysJob): Use renamed
+ class.
+
+2022-04-28 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ cpp,tests: Verify that requested keylist mode is used.
+ + commit 359906c8bcde7e351540708777e3678fee0cc2c1
+ * lang/cpp/tests/run-getkey.cpp, lang/cpp/tests/run-keylist.cpp (main):
+ Check used keylist mode.
+
+2022-04-27 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ cpp: Support new keylist modes.
+ + commit dea872f21ff77cd58bafe0966d89d6331c8d2e07
+ * lang/cpp/src/global.h (ForceExtern, LocateExternal, KeyListModeMask):
+ New.
+ * lang/cpp/src/context.cpp (operator<<): Add check.
+ * lang/cpp/src/util.h (gpgme_keylist_mode_t,
+ convert_from_gpgme_keylist_mode_t): Handle ForceExtern.
+ * lang/cpp/tests/run-getkey.cpp (show_usage, main): Add arguments
+ --force-extern and --locate-external.
+ * lang/cpp/tests/run-keylist.cpp (show_usage, main): Ditto.
+
+ core: Support --locate-external-keys command of gpg.
+ + commit aff9aaac68450e76f84d0f9a3feabffe9e82dd7e
+ * src/gpgme.h.in (GPGME_KEYLIST_MODE_FORCE_EXTERN): New.
+ (GPGME_KEYLIST_MODE_LOCATE_EXTERNAL): New.
+ * src/gpgme.c (gpgme_set_keylist_mode): Check for invalid mode.
+ * src/engine-gpg.c (gpg_keylist_build_options): Use
+ "--locate-external-keys" instead of "--locate-keys" if flag is set.
+ * src/gpgme-json.c (op_keylist): New flag "force-extern".
+ * src/gpgme-tool.c (gt_get_keylist_mode, cmd_keylist_mode): Handle
+ new mode.
+
+2022-04-25 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Rely on the bad passphrase error reported by gpg.
+ + commit 512f11b458d82bb8a42b5764f11e11978173f896
+ * lang/qt/src/qgpgmedecryptverifyjob.cpp (patch_decryption_result):
+ Removed.
+ (decrypt_verify): Remove usage of patch_decryption_result.
+
+ core: Return BAD_PASSPHRASE error code on symmetric decryption.
+ + commit e21c3b559dfb59c61f789572071e72e31bb089bf
+ * src/decrypt.c (op_data_t): Add field symdecrypt_failed.
+ (parse_status_error): Handle BAD_PASSPHRASE error code.
+ (_gpgme_decrypt_status_handler): Consult new field.
+
+2022-04-22 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Report better error if decryption failed because of bad passphrase.
+ + commit d8e5871dca9425811873058150677a158235613d
+ * lang/qt/src/qgpgmedecryptverifyjob.cpp (patch_decryption_result): New.
+ (decrypt_verify): Call patch_decryption_result.
+
+ cpp: Allow changing the error of a result.
+ + commit 321c8a0254f4729ff1ffe56956fb049555272321
+ * lang/cpp/src/result.h (class Result): Add member function setError.
+
+2022-04-05 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ cpp: Handle canceling of an edit operation.
+ + commit 28cdbfdccb347e1ef15f794d4afd36f9275f073c
+ * lang/cpp/src/editinteractor.cpp
+ (CallbackHelper::edit_interactor_callback_impl): Check for error _or_
+ canceled state.
+
+ cpp: Return actual error if revocation fails.
+ + commit db532eca8ebd64536985e7a40af22e803e3b3df9
+ * lang/cpp/src/editinteractor.cpp, lang/cpp/src/editinteractor.h
+ (EditInteractor::parseStatusError): New.
+ * lang/cpp/src/gpgrevokekeyeditinteractor.cpp
+ (GpgRevokeKeyEditInteractor::Private::nextState): Handle status
+ error.
+
+ cpp: Add internal utility function for splitting strings.
+ + commit c965b45bcd915ce92943fd4d436b5bd790f0442f
+ * lang/cpp/src/util.h (split): New.
+
+ cpp: Do not export symbols of the Private class.
+ + commit 4beb6f419954b0df475d88bef7fc8b8065848b75
+ * lang/cpp/src/gpgrevokekeyeditinteractor.h (class
+ GpgRevokeKeyEditInteractor): Mark nested class Private as hidden.
+
+2022-04-05 NIIBE Yutaka <gniibe@fsij.org>
+
+ core: Don't use internal __assuan functions.
+ + commit a36d71a8e33e817b1cc2fde5d0fd476ddc6ac560
+ * configure.ac (nanosleep): Detect.
+ * src/assuan-support.c: Don't use __assuan_usleep.
+ (my_socketpair): Don't use __assuan_socketpair.
+
+ core: Don't keep using deprecated ath_ API.
+ + commit 110a375401878b72984241c0dd84cb7fdeaae795
+ * src/posix-io.c: Don't include ath.h.
+ (_gpgme_io_read): Call read directly.
+ (_gpgme_io_write): Call write directly.
+ (_gpgme_io_waitpid): Call waitpid directly.
+ (_gpgme_io_select_select): Call select directly.
+ (_gpgme_io_recvmsg): Call recvmsg directly.
+ (_gpgme_io_sendmsg): Call sendmsg directly.
+ (_gpgme_io_connect): Call connect directly.
+ * src/assuan-support.c: Don't include ath.h.
+ (my_waitpid): Call waitpid directly.
+
+2022-03-31 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Check arguments passed to the revoke key job.
+ + commit 7f089165e3ae42274e75e0e6fa1c45ca641f4023
+ * lang/qt/src/qgpgmerevokekeyjob.cpp (check_arguments): New.
+ (QGpgMERevokeKeyJob::start, QGpgMERevokeKeyJob::exec): Call
+ check_arguments.
+ * lang/qt/tests/t-revokekey.cpp (RevokeKeyJobTest): Add member functions
+ testErrorHandling_nullKey, testErrorHandling_invalidReason,
+ testErrorHandling_invalidDescription.
+
+2022-03-30 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt,tests: Verify reason code and description of revocation.
+ + commit 3856ae8621bb28873123578a64eb81a4a591758e
+ * lang/qt/tests/t-revokekey.cpp (RevokeKeyJobTest::testRevokeKeyAsync,
+ RevokeKeyJobTest::testRevokeKeySync_noReasonDescription,
+ RevokeKeyJobTest::testRevokeKeySync_oneLineReasonDescription,
+ RevokeKeyJobTest::testRevokeKeySync_twoLinesReasonDescription): Call
+ verifyReason.
+ (class RevokeKeyJobTest): Add private member function verifyReason.
+
+ qt: Add job to revoke own OpenPGP keys.
+ + commit 41297520da32081d0a34ac2799812f210b7a9335
+ * lang/qt/src/revokekeyjob.h, lang/qt/src/qgpgmerevokekeyjob.h,
+ lang/qt/src/qgpgmerevokekeyjob.cpp: New.
+ * lang/qt/src/protocol.h (class Protocol): Add pure virtual member
+ function revokeKeyJob.
+ * lang/qt/src/protocol_p.h (Protocol::revokeKeyJob): New.
+ * lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.
+
+ * lang/qt/tests/Makefile.am (the_tests, moc_files, noinst_PROGRAMS):
+ Add new test.
+ (t_revokekey_SOURCES): New.
+ * lang/qt/tests/t-revokekey.cpp: New.
+
+ cpp: Add interactor to revoke a key.
+ + commit d96e8a7a6bfcaad4587dd2bb648aa764b0d4e1ba
+ * lang/cpp/src/global.h (enum class RevocationReason): New.
+ * lang/cpp/src/gpgrevokekeyeditinteractor.cpp,
+ lang/cpp/src/gpgrevokekeyeditinteractor.h: New.
+ * lang/cpp/src/Makefile.am: Add new files.
+
+2022-03-28 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Set default visibility of all symbols to hidden.
+ + commit 3b3b36a60749ea5c3b166bb1c8f3f6dda8ce6fcd
+ * configure.ac: Add -fvisibility=hidden to GPGME_QT_CFLAGS if gcc
+ supports the flag.
+
+ cpp: Set default visibility of all symbols to hidden.
+ + commit fe588fef0963987b5624dc8c4bc73202ac2c9298
+ * configure.ac: Add -fvisibility=hidden to GPGME_CPP_CFLAGS if gcc
+ supports the flag.
+ * lang/cpp/src/Makefile.am (AM_CPPFLAGS): Add GPGME_CPP_CFLAGS.
+ * m4/ax_gcc_func_attribute.m4: New.
+
+ cpp: Put local helper function into unnamed namespace.
+ + commit 92139e7b6b5fe84015d44d9516f3e1df7a3fc3bc
+ lang/cpp/src/context.cpp (to_auditlog_flags): Wrap in unnamed namespace.
+
+2022-03-16 NIIBE Yutaka <gniibe@fsij.org>
+
+ core: Support keylist mode for op_keylist_from_data.
+ + commit b2a2158384a9f048ff61ee0cebef8346055f0454
+ * src/engine-backend.h (keylist_data): Add MODE argument.
+ * src/engine-gpg.c (gpg_keylist_data): Add MODE argument.
+ * src/engine.c (_gpgme_engine_op_keylist_data): Likewise.
+ * src/engine.h (_gpgme_engine_op_keylist_data): Declaration.
+ * src/keylist.c (gpgme_op_keylist_from_data_start): Call
+ _gpgme_engine_op_keylist_data with ctx->keylist_mode.
+
+2022-03-07 Ingo Klöcker <dev@ingo-kloecker.de>
+
+ qt: Add missing include of config.h.
+ + commit 55861ba9ccc6b1087cb81acd93bed81fc0787208
+ * lang/qt/src/util.cpp: Include config.h.
+
2022-03-06 Werner Koch <wk@gnupg.org>
+ Post release updates.
+ + commit f61a14f189d33ca320f6c4ee6323f1e48c46e4ea
+
+
Release 1.17.1.
+ commit ee50a38823daaa16b151a549a7dafef34bbd1e81
* configure.ac: Bump QT LT version to C15/A0/R0.
diff --git a/Makefile.in b/Makefile.in
index 739a66b..02f0cff 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -293,6 +294,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/NEWS b/NEWS
index a460ddf..063a8ca 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,52 @@
+Noteworthy changes in version 1.18.0 (2022-08-10)
+-------------------------------------------------
+
+ * New keylist mode to force refresh via external methods. [T5951]
+
+ * The keylist operations now create an import result to report the
+ result of the locate keylist modes. [T5951]
+
+ * core: Return BAD_PASSPHRASE error code on symmetric decryption
+ failure. [T5939]
+
+ * cpp, qt: Do not export internal symbols anymore. [T5906]
+
+ * cpp, qt: Support revocation of own OpenPGP keys. [T5904]
+
+ * qt: The file name of (signed and) encrypted data can now be set. [T6056]
+
+ * cpp, qt: Support setting the primary user ID. [T5938]
+
+ * python: Fix segv(NULL) when inspecting contect after exeception. [T6060]
+
+ * Interface changes relative to the 1.17.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ GPGME_KEYLIST_MODE_FORCE_EXTERN NEW.
+ GPGME_KEYLIST_MODE_LOCATE_EXTERNAL NEW.
+ cpp: RevocationReason NEW.
+ cpp: GpgRevokeKeyEditInteractor NEW.
+ cpp: Result::setError NEW.
+ cpp: KeyListMode::ForceExtern NEW.
+ cpp: KeyListMode::LocateExternal NEW.
+ cpp: KeyListMode::KeyListModeMask NEW.
+ cpp: ImportResult::mergeWith NEW.
+ cpp: KeyListModeSaver NEW.
+ cpp: Context::setPrimaryUid NEW.
+ cpp: Context::startSetPrimaryUid NEW.
+ qt: RevokeKeyJob NEW.
+ qt: Protocol::revokeKeyJob NEW.
+ qt: EncryptJob::setFileName NEW.
+ qt: EncryptJob::fileName NEW.
+ qt: SignEncryptJob::setFileName NEW.
+ qt: SignEncryptJob::fileName NEW.
+ qt: SetPrimaryUserIDJob NEW.
+ qt: Protocol::setPrimaryUserIDJob NEW.
+
+ [c=C38/A27/R0 cpp=C21/A15/R0 qt=C16/A1/R0]
+
+ Release-info: https://dev.gnupg.org/T6128
+
+
Noteworthy changes in version 1.17.1 (2022-03-06)
-------------------------------------------------
@@ -5,7 +54,7 @@ Noteworthy changes in version 1.17.1 (2022-03-06)
[c=C37/A26/R0 cpp=C20/A14/R0 qt=C15/A0/R0]
- Release-info: https://dev.gnupg.org/T5819
+ Release-info: https://dev.gnupg.org/T5872
Noteworthy changes in version 1.17.0 (2022-02-07)
@@ -44,7 +93,11 @@ Noteworthy changes in version 1.17.0 (2022-02-07)
* cpp,qt: Support for adding existing subkeys to other keys. [#5770]
* qt: Extend ChangeExpiryJob to change expiration of primary key
- and of subkeys at the same time. [#4717]
+ and of subkeys at the same time. [#4717]
+
+ * qt: Support WKD lookup without implicit import. [#5728]
+
+ * qt: Allow specifying an import filter when importing keys. [#5739]
* qt: Expect UTF-8 on stderr on Windows. [rM8fe1546282]
@@ -70,6 +123,15 @@ Noteworthy changes in version 1.17.0 (2022-02-07)
qt: ChangeExpiryJob::Options NEW.
qt: ChangeExpiryJob::setOptions NEW.
qt: ChangeExpiryJob::options NEW.
+ qt: CryptoConfigEntry::defaultValue NEW.
+ qt: WKDLookupJob NEW.
+ qt: WKDLookupResult NEW.
+ qt: Protocol::wkdLookupJob NEW.
+ qt: ImportJob::setKeyOrigin NEW.
+ qt: ImportJob::keyOrigin NEW.
+ qt: ImportJob::keyOriginUrl NEW.
+ qt: setImportFilter NEW.
+ qt: importFilter NEW.
qt: AddExistingSubkeyJob NEW.
qt: Protocol::addExistingSubkeyJob NEW.
diff --git a/VERSION b/VERSION
index 511a76e..84cc529 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.17.1
+1.18.0
diff --git a/aclocal.m4 b/aclocal.m4
index 9427cda..d426d6b 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1204,6 +1204,7 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/ax_cxx_compile_stdcxx.m4])
+m4_include([m4/ax_gcc_func_attribute.m4])
m4_include([m4/ax_pkg_swig.m4])
m4_include([m4/ax_python_devel.m4])
m4_include([m4/glib-2.0.m4])
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 2132341..7f76b62 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -1,12 +1,14 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2016 Free Software Foundation, Inc.
+# Copyright 1992-2022 Free Software Foundation, Inc.
-timestamp='2016-05-15'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2022-01-09'
# This file 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 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -27,11 +29,19 @@ timestamp='2016-05-15'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
#
# Please send patches to <config-patches@gnu.org>.
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
@@ -39,7 +49,7 @@ Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
-Operation modes:
+Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -50,7 +60,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2016 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,7 +94,8 @@ if test $# != 0; then
exit 1
fi
-trap 'exit 1' 1 2 15
+# Just in case it came from the environment.
+GUESS=
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
@@ -96,66 +107,90 @@ trap 'exit 1' 1 2 15
# Portable tmp directory creation inspired by the Autoconf team.
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
+tmp=
+# shellcheck disable=SC2172
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
+
+set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
+ : "${TMPDIR=/tmp}"
+ # shellcheck disable=SC2039,SC3028
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
+ dummy=$tmp/dummy
+ case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
+ ,,) echo "int x;" > "$dummy.c"
+ for driver in cc gcc c89 c99 ; do
+ if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
+ CC_FOR_BUILD=$driver
+ break
+ fi
+ done
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+ esac
+}
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-case "${UNAME_SYSTEM}" in
+case $UNAME_SYSTEM in
Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
+ LIBC=unknown
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
+ set_cc_for_build
+ cat <<-EOF > "$dummy.c"
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
- #else
+ #elif defined(__GLIBC__)
LIBC=gnu
+ #else
+ #include <stdarg.h>
+ /* First heuristic to detect musl libc. */
+ #ifdef __DEFINED_va_list
+ LIBC=musl
+ #endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ eval "$cc_set_libc"
+
+ # Second heuristic to detect musl libc.
+ if [ "$LIBC" = unknown ] &&
+ command -v ldd >/dev/null &&
+ ldd --version 2>&1 | grep -q ^musl; then
+ LIBC=musl
+ fi
+
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ if [ "$LIBC" = unknown ]; then
+ LIBC=gnu
+ fi
;;
esac
# Note: order is significant - the case branches are not exclusive.
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -167,32 +202,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
+ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
+ case $UNAME_MACHINE_ARCH in
+ aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+ arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+ endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ *) machine=$UNAME_MACHINE_ARCH-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI.
- case "${UNAME_MACHINE_ARCH}" in
+ case $UNAME_MACHINE_ARCH in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
+ set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
@@ -208,10 +243,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;;
esac
# Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
+ case $UNAME_MACHINE_ARCH in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+ abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
;;
esac
# The OS release
@@ -219,47 +254,68 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
+ case $UNAME_VERSION in
Debian*)
release='-gnu'
;;
*)
- release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
+ release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
- exit ;;
+ GUESS=$machine-${os}${release}${abi-}
+ ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+ ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+ ;;
+ *:SecBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+ GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+ ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+ ;;
+ *:MidnightBSD:*:*)
+ GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+ ;;
*:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+ ;;
*:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+ ;;
+ *:OS108:*:*)
+ GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+ ;;
macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
+ GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+ ;;
*:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+ ;;
*:Sortix:*:*)
- echo ${UNAME_MACHINE}-unknown-sortix
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-sortix
+ ;;
+ *:Twizzler:*:*)
+ GUESS=$UNAME_MACHINE-unknown-twizzler
+ ;;
+ *:Redox:*:*)
+ GUESS=$UNAME_MACHINE-unknown-redox
+ ;;
+ mips:OSF1:*.*)
+ GUESS=mips-dec-osf1
+ ;;
alpha:OSF1:*:*)
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ trap '' 0
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -273,7 +329,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
+ case $ALPHA_CPU_TYPE in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
@@ -310,126 +366,121 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
+ OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+ ;;
Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
+ GUESS=m68k-unknown-sysv4
+ ;;
*:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-amigaos
+ ;;
*:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-morphos
+ ;;
*:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
+ GUESS=i370-ibm-openedition
+ ;;
*:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
+ GUESS=s390-ibm-zvmoe
+ ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
+ GUESS=powerpc-ibm-os400
+ ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
+ GUESS=arm-acorn-riscix$UNAME_RELEASE
+ ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
+ GUESS=arm-unknown-riscos
+ ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
+ GUESS=hppa1.1-hitachi-hiuxmpp
+ ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
+ case `(/bin/universe) 2>/dev/null` in
+ att) GUESS=pyramid-pyramid-sysv3 ;;
+ *) GUESS=pyramid-pyramid-bsd ;;
+ esac
+ ;;
NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
+ GUESS=pyramid-pyramid-svr4
+ ;;
DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
+ GUESS=sparc-icl-nx6
+ ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
+ sparc) GUESS=sparc-icl-nx7 ;;
+ esac
+ ;;
s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+ ;;
sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-hal-solaris2$SUN_REL
+ ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris2$SUN_REL
+ ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
+ GUESS=i386-pc-auroraux$UNAME_RELEASE
+ ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
+ set_cc_for_build
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH=x86_64
fi
fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+ ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=sparc-sun-solaris3$SUN_REL
+ ;;
sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
+ case `/usr/bin/arch -k` in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+ GUESS=sparc-sun-sunos$SUN_REL
+ ;;
sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
+ ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
- case "`/bin/arch`" in
+ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
+ case `/bin/arch` in
sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
+ GUESS=m68k-sun-sunos$UNAME_RELEASE
;;
sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
+ GUESS=sparc-sun-sunos$UNAME_RELEASE
;;
esac
- exit ;;
+ ;;
aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
+ GUESS=sparc-auspex-sunos$UNAME_RELEASE
+ ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -439,44 +490,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-atari-mint$UNAME_RELEASE
+ ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-milan-mint$UNAME_RELEASE
+ ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-hades-mint$UNAME_RELEASE
+ ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-unknown-mint$UNAME_RELEASE
+ ;;
m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-apple-machten$UNAME_RELEASE
+ ;;
powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
+ GUESS=powerpc-apple-machten$UNAME_RELEASE
+ ;;
RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
+ GUESS=mips-dec-mach_bsd4.3
+ ;;
RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
+ GUESS=mips-dec-ultrix$UNAME_RELEASE
+ ;;
VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
+ GUESS=vax-dec-ultrix$UNAME_RELEASE
+ ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
+ GUESS=clipper-intergraph-clix$UNAME_RELEASE
+ ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
@@ -485,95 +536,96 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
+ GUESS=mips-mips-riscos$UNAME_RELEASE
+ ;;
Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
+ GUESS=powerpc-motorola-powermax
+ ;;
Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
+ GUESS=powerpc-harris-powermax
+ ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
+ GUESS=powerpc-harris-powermax
+ ;;
Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
+ GUESS=powerpc-harris-powerunix
+ ;;
m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
+ GUESS=m88k-harris-cxux7
+ ;;
m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
+ GUESS=m88k-motorola-sysv4
+ ;;
m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
+ GUESS=m88k-motorola-sysv3
+ ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+ test "$TARGET_BINARY_INTERFACE"x = x
then
- echo m88k-dg-dgux${UNAME_RELEASE}
+ GUESS=m88k-dg-dgux$UNAME_RELEASE
else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
fi
else
- echo i586-dg-dgux${UNAME_RELEASE}
+ GUESS=i586-dg-dgux$UNAME_RELEASE
fi
- exit ;;
+ ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
+ GUESS=m88k-dolphin-sysv3
+ ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
+ GUESS=m88k-motorola-sysv3
+ ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
+ GUESS=m88k-tektronix-sysv3
+ ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
+ GUESS=m68k-tektronix-bsd
+ ;;
*:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
+ IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+ GUESS=mips-sgi-irix$IRIX_REL
+ ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
+ GUESS=i386-ibm-aix
+ ;;
ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
+ if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel`
else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
+ GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+ ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h>
main()
@@ -584,77 +636,77 @@ EOF
exit(0);
}
EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
then
- echo "$SYSTEM_NAME"
+ GUESS=$SYSTEM_NAME
else
- echo rs6000-ibm-aix3.2.5
+ GUESS=rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
+ GUESS=rs6000-ibm-aix3.2.4
else
- echo rs6000-ibm-aix3.2
+ GUESS=rs6000-ibm-aix3.2
fi
- exit ;;
+ ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ if test -x /usr/bin/lslpp ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
+ GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+ ;;
*:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
+ GUESS=rs6000-ibm-aix
+ ;;
+ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
+ GUESS=romp-ibm-bsd4.4
+ ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
+ GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to
+ ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
+ GUESS=rs6000-bull-bosx
+ ;;
DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
+ GUESS=m68k-bull-sysv3
+ ;;
9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
+ GUESS=m68k-hp-bsd
+ ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
+ GUESS=m68k-hp-bsd4.4
+ ;;
9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ case $UNAME_MACHINE in
+ 9000/31?) HP_ARCH=m68000 ;;
+ 9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
+ if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
+ case $sc_cpu_version in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
+ case $sc_kernel_bits in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ if test "$HP_ARCH" = ""; then
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE
#include <stdlib.h>
@@ -687,13 +739,13 @@ EOF
exit (0);
}
EOF
- (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ ${HP_ARCH} = hppa2.0w ]
+ if test "$HP_ARCH" = hppa2.0w
then
- eval $set_cc_for_build
+ set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
@@ -712,15 +764,15 @@ EOF
HP_ARCH=hppa64
fi
fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
+ GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+ ;;
ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
+ HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+ GUESS=ia64-hp-hpux$HPUX_REV
+ ;;
3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ set_cc_for_build
+ sed 's/^ //' << EOF > "$dummy.c"
#include <unistd.h>
int
main ()
@@ -745,38 +797,38 @@ EOF
exit (0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
+ GUESS=unknown-hitachi-hiuxwe2
+ ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
+ GUESS=hppa1.1-hp-bsd
+ ;;
9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
+ GUESS=hppa1.0-hp-bsd
+ ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
+ GUESS=hppa1.0-hp-mpeix
+ ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
+ GUESS=hppa1.1-hp-osf
+ ;;
hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
+ GUESS=hppa1.0-hp-osf
+ ;;
i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
+ if test -x /usr/sbin/sysversion ; then
+ GUESS=$UNAME_MACHINE-unknown-osf1mk
else
- echo ${UNAME_MACHINE}-unknown-osf1
+ GUESS=$UNAME_MACHINE-unknown-osf1
fi
- exit ;;
+ ;;
parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
+ GUESS=hppa1.1-hp-lites
+ ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
+ GUESS=c1-convex-bsd
+ ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
@@ -784,139 +836,148 @@ EOF
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
+ GUESS=c34-convex-bsd
+ ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
+ GUESS=c38-convex-bsd
+ ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
+ GUESS=c4-convex-bsd
+ ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=ymp-cray-unicos$CRAY_REL
+ ;;
CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=t90-cray-unicos$CRAY_REL
+ ;;
CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=alphaev5-cray-unicosmk$CRAY_REL
+ ;;
CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=sv1-cray-unicos$CRAY_REL
+ ;;
*:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
+ CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+ GUESS=craynv-cray-unicosmp$CRAY_REL
+ ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+ GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+ GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+ ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+ ;;
sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
+ GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+ ;;
*:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+ ;;
+ arm:FreeBSD:*:*)
+ UNAME_PROCESSOR=`uname -p`
+ set_cc_for_build
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
+ else
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
+ fi
+ ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
+ case $UNAME_PROCESSOR in
amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ UNAME_PROCESSOR=x86_64 ;;
+ i386)
+ UNAME_PROCESSOR=i586 ;;
esac
- exit ;;
+ FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+ ;;
i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-cygwin
+ ;;
*:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-mingw64
+ ;;
*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-mingw32
+ ;;
*:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-msys
+ ;;
i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-pw32
+ ;;
+ *:SerenityOS:*:*)
+ GUESS=$UNAME_MACHINE-pc-serenity
+ ;;
*:Interix*:*)
- case ${UNAME_MACHINE} in
+ case $UNAME_MACHINE in
x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
+ GUESS=i586-pc-interix$UNAME_RELEASE
+ ;;
authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
+ GUESS=x86_64-unknown-interix$UNAME_RELEASE
+ ;;
IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
+ GUESS=ia64-unknown-interix$UNAME_RELEASE
+ ;;
esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-uwin
+ ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
+ GUESS=x86_64-pc-cygwin
+ ;;
prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
+ SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+ GUESS=powerpcle-unknown-solaris2$SUN_REL
+ ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
+ GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+ GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+ ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
+ GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+ GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+ ;;
+ *:Minix:*:*)
+ GUESS=$UNAME_MACHINE-unknown-minix
+ ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -927,177 +988,225 @@ EOF
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
arm*:Linux:*:*)
- eval $set_cc_for_build
+ set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+ GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
fi
fi
- exit ;;
+ ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+ ;;
e2k:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+ ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
k1om:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
+ loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ set_cc_for_build
+ IS_GLIBC=0
+ test x"${LIBC}" = xgnu && IS_GLIBC=1
+ sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
+ #undef mips
+ #undef mipsel
+ #undef mips64
+ #undef mips64el
+ #if ${IS_GLIBC} && defined(_ABI64)
+ LIBCABI=gnuabi64
+ #else
+ #if ${IS_GLIBC} && defined(_ABIN32)
+ LIBCABI=gnuabin32
+ #else
+ LIBCABI=${LIBC}
+ #endif
+ #endif
+
+ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa64r6
+ #else
+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa32r6
+ #else
+ #if defined(__mips64)
+ CPU=mips64
+ #else
+ CPU=mips
+ #endif
+ #endif
+ #endif
+
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
+ MIPS_ENDIAN=el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
+ MIPS_ENDIAN=
#else
- CPU=
+ MIPS_ENDIAN=
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+ cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+ eval "$cc_set_vars"
+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
+ ;;
+ mips64el:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
+ GUESS=or1k-unknown-linux-$LIBC
+ ;;
or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
+ GUESS=sparc-unknown-linux-$LIBC
+ ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
+ GUESS=hppa64-unknown-linux-$LIBC
+ ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
+ PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+ PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+ *) GUESS=hppa-unknown-linux-$LIBC ;;
esac
- exit ;;
+ ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
+ GUESS=powerpc64-unknown-linux-$LIBC
+ ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
+ GUESS=powerpc-unknown-linux-$LIBC
+ ;;
ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
+ GUESS=powerpc64le-unknown-linux-$LIBC
+ ;;
ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
+ GUESS=powerpcle-unknown-linux-$LIBC
+ ;;
+ riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+ ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+ ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
+ set_cc_for_build
+ LIBCABI=$LIBC
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_X32 >/dev/null
+ then
+ LIBCABI=${LIBC}x32
+ fi
+ fi
+ GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
+ ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+ ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
+ GUESS=i386-sequent-sysv4
+ ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+ ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-os2-emx
+ ;;
i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-stop
+ ;;
i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-atheos
+ ;;
i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-syllable
+ ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
+ GUESS=i386-unknown-lynxos$UNAME_RELEASE
+ ;;
i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+ ;;
+ i*86:*:4.*:*)
+ UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
fi
- exit ;;
+ ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
@@ -1105,12 +1214,12 @@ EOF
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1120,11 +1229,11 @@ EOF
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
else
- echo ${UNAME_MACHINE}-pc-sysv32
+ GUESS=$UNAME_MACHINE-pc-sysv32
fi
- exit ;;
+ ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1132,31 +1241,31 @@ EOF
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
+ GUESS=i586-pc-msdosdjgpp
+ ;;
Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
+ GUESS=i386-pc-mach3
+ ;;
paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
+ GUESS=i860-intel-osf1
+ ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4
fi
- exit ;;
+ ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
- echo m68010-convergent-sysv
- exit ;;
+ GUESS=m68010-convergent-sysv
+ ;;
mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
+ GUESS=m68k-convergent-sysv
+ ;;
M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
+ GUESS=m68k-diab-dnix
+ ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
@@ -1164,9 +1273,9 @@ EOF
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
@@ -1175,249 +1284,437 @@ EOF
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+ ;;
mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
+ GUESS=m68k-atari-sysv4
+ ;;
TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
+ GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+ ;;
rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
+ GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+ ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
+ GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+ ;;
SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
+ GUESS=mips-dde-sysv$UNAME_RELEASE
+ ;;
RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
+ GUESS=mips-sni-sysv4
+ ;;
RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
+ GUESS=mips-sni-sysv4
+ ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
+ GUESS=$UNAME_MACHINE-sni-sysv4
else
- echo ns32k-sni-sysv
+ GUESS=ns32k-sni-sysv
fi
- exit ;;
+ ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ GUESS=i586-unisys-sysv4
+ ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
+ GUESS=hppa1.1-stratus-sysv4
+ ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
+ GUESS=i860-stratus-sysv4
+ ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
+ GUESS=$UNAME_MACHINE-stratus-vos
+ ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
+ GUESS=hppa1.1-stratus-vos
+ ;;
mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
+ GUESS=m68k-apple-aux$UNAME_RELEASE
+ ;;
news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
+ GUESS=mips-sony-newsos6
+ ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
+ if test -d /usr/nec; then
+ GUESS=mips-nec-sysv$UNAME_RELEASE
else
- echo mips-unknown-sysv${UNAME_RELEASE}
+ GUESS=mips-unknown-sysv$UNAME_RELEASE
fi
- exit ;;
+ ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
+ GUESS=powerpc-be-beos
+ ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
+ GUESS=powerpc-apple-beos
+ ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
+ GUESS=i586-pc-beos
+ ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
+ GUESS=i586-pc-haiku
+ ;;
x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
+ GUESS=x86_64-unknown-haiku
+ ;;
SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sx4-nec-superux$UNAME_RELEASE
+ ;;
SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sx5-nec-superux$UNAME_RELEASE
+ ;;
SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sx6-nec-superux$UNAME_RELEASE
+ ;;
SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sx7-nec-superux$UNAME_RELEASE
+ ;;
SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sx8-nec-superux$UNAME_RELEASE
+ ;;
SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sx8r-nec-superux$UNAME_RELEASE
+ ;;
SX-ACE:SUPER-UX:*:*)
- echo sxace-nec-superux${UNAME_RELEASE}
- exit ;;
+ GUESS=sxace-nec-superux$UNAME_RELEASE
+ ;;
Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
+ GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+ ;;
*:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+ ;;
+ arm64:Darwin:*:*)
+ GUESS=aarch64-apple-darwin$UNAME_RELEASE
+ ;;
*:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
+ UNAME_PROCESSOR=`uname -p`
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ if command -v xcode-select > /dev/null 2> /dev/null && \
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+ # Avoid executing cc if there is no toolchain installed as
+ # cc will be a stub that puts up a graphical alert
+ # prompting the user to install developer tools.
+ CC_FOR_BUILD=no_compiler_found
+ else
+ set_cc_for_build
fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
+ # uname -m returns i386 or x86_64
+ UNAME_PROCESSOR=$UNAME_MACHINE
fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+ ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+ ;;
*:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
+ GUESS=i386-pc-qnx
+ ;;
+ NEO-*:NONSTOP_KERNEL:*:*)
+ GUESS=neo-tandem-nsk$UNAME_RELEASE
+ ;;
NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
+ GUESS=nse-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSR-*:NONSTOP_KERNEL:*:*)
+ GUESS=nsr-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSV-*:NONSTOP_KERNEL:*:*)
+ GUESS=nsv-tandem-nsk$UNAME_RELEASE
+ ;;
+ NSX-*:NONSTOP_KERNEL:*:*)
+ GUESS=nsx-tandem-nsk$UNAME_RELEASE
+ ;;
*:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
+ GUESS=mips-compaq-nonstopux
+ ;;
BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
+ GUESS=bs2000-siemens-sysv
+ ;;
DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
+ GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+ ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
- if test "$cputype" = 386; then
+ if test "${cputype-}" = 386; then
UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
+ elif test "x${cputype-}" != x; then
+ UNAME_MACHINE=$cputype
fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-plan9
+ ;;
*:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
+ GUESS=pdp10-unknown-tops10
+ ;;
*:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
+ GUESS=pdp10-unknown-tenex
+ ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
+ GUESS=pdp10-dec-tops20
+ ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
+ GUESS=pdp10-xkl-tops20
+ ;;
*:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
+ GUESS=pdp10-unknown-tops20
+ ;;
*:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
+ GUESS=pdp10-unknown-its
+ ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
+ GUESS=mips-sei-seiux$UNAME_RELEASE
+ ;;
*:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
+ DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+ GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+ ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
+ case $UNAME_MACHINE in
+ A*) GUESS=alpha-dec-vms ;;
+ I*) GUESS=ia64-dec-vms ;;
+ V*) GUESS=vax-dec-vms ;;
esac ;;
*:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
+ GUESS=i386-pc-xenix
+ ;;
i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
- exit ;;
+ SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+ GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+ ;;
i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
+ GUESS=$UNAME_MACHINE-pc-rdos
+ ;;
+ i*86:Fiwix:*:*)
+ GUESS=$UNAME_MACHINE-pc-fiwix
+ ;;
+ *:AROS:*:*)
+ GUESS=$UNAME_MACHINE-unknown-aros
+ ;;
x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
+ GUESS=$UNAME_MACHINE-unknown-esx
+ ;;
amd64:Isilon\ OneFS:*:*)
- echo x86_64-unknown-onefs
- exit ;;
+ GUESS=x86_64-unknown-onefs
+ ;;
+ *:Unleashed:*:*)
+ GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+ ;;
+esac
+
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+ echo "$GUESS"
+ exit
+fi
+
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname un;
+ uname (&un);
+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname *un;
+ uname (&un);
+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
+echo "$0: unable to guess system type" >&2
+
+case $UNAME_MACHINE:$UNAME_SYSTEM in
+ mips:Linux | mips64:Linux)
+ # If we got here on MIPS GNU/Linux, output extra information.
+ cat >&2 <<EOF
+
+NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
+the system type. Please install a C compiler and try again.
+EOF
+ ;;
esac
cat >&2 <<EOF
-$0: unable to guess system type
This script (version $timestamp), has failed to recognize the
-operating system you are using. If your script is old, overwrite
-config.guess and config.sub with the latest versions from:
+operating system you are using. If your script is old, overwrite *all*
+copies of config.guess and config.sub with the latest versions from:
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+ https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
+EOF
+
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
+# shellcheck disable=SC2003
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
+ cat >&2 <<EOF
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1440,16 +1737,17 @@ hostinfo = `(hostinfo) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
EOF
+fi
exit 1
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/build-aux/config.sub b/build-aux/config.sub
index c4b3f7a..dba16e8 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1,12 +1,14 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2016 Free Software Foundation, Inc.
+# Copyright 1992-2022 Free Software Foundation, Inc.
-timestamp='2016-06-20'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2022-01-03'
# This file 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 3 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -33,7 +35,7 @@ timestamp='2016-06-20'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -50,6 +52,13 @@ timestamp='2016-06-20'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX. However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
@@ -57,7 +66,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
-Operation modes:
+Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -67,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2016 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -89,12 +98,12 @@ while test $# -gt 0 ; do
- ) # Use stdin as input.
break ;;
-* )
- echo "$me: invalid option $1$help"
+ echo "$me: invalid option $1$help" >&2
exit 1 ;;
*local*)
# First pass through any local machine types.
- echo $1
+ echo "$1"
exit ;;
* )
@@ -110,1242 +119,1186 @@ case $# in
exit 1;;
esac
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
+# Split fields of configuration type
+# shellcheck disable=SC2162
+saved_IFS=$IFS
+IFS="-" read field1 field2 field3 field4 <<EOF
+$1
+EOF
+IFS=$saved_IFS
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
+# Separate into logical components for further validation
+case $1 in
+ *-*-*-*-*)
+ echo Invalid configuration \`"$1"\': more than four components >&2
+ exit 1
;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ *-*-*-*)
+ basic_machine=$field1-$field2
+ basic_os=$field3-$field4
;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ *-*-*)
+ # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
+ # parts
+ maybe_os=$field2-$field3
+ case $maybe_os in
+ nto-qnx* | linux-* | uclinux-uclibc* \
+ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
+ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
+ | storm-chaos* | os2-emx* | rtmk-nova*)
+ basic_machine=$field1
+ basic_os=$maybe_os
+ ;;
+ android-linux)
+ basic_machine=$field1-unknown
+ basic_os=linux-android
+ ;;
+ *)
+ basic_machine=$field1-$field2
+ basic_os=$field3
+ ;;
+ esac
;;
- -psos*)
- os=-psos
+ *-*)
+ # A lone config we happen to match not fitting any pattern
+ case $field1-$field2 in
+ decstation-3100)
+ basic_machine=mips-dec
+ basic_os=
+ ;;
+ *-*)
+ # Second component is usually, but not always the OS
+ case $field2 in
+ # Prevent following clause from handling this valid os
+ sun*os*)
+ basic_machine=$field1
+ basic_os=$field2
+ ;;
+ zephyr*)
+ basic_machine=$field1-unknown
+ basic_os=$field2
+ ;;
+ # Manufacturers
+ dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
+ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
+ | unicom* | ibm* | next | hp | isi* | apollo | altos* \
+ | convergent* | ncr* | news | 32* | 3600* | 3100* \
+ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \
+ | ultra | tti* | harris | dolphin | highlevel | gould \
+ | cbm | ns | masscomp | apple | axis | knuth | cray \
+ | microblaze* | sim | cisco \
+ | oki | wec | wrs | winbond)
+ basic_machine=$field1-$field2
+ basic_os=
+ ;;
+ *)
+ basic_machine=$field1
+ basic_os=$field2
+ ;;
+ esac
+ ;;
+ esac
;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
+ *)
+ # Convert single-component short-hands not valid as part of
+ # multi-component configurations.
+ case $field1 in
+ 386bsd)
+ basic_machine=i386-pc
+ basic_os=bsd
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ basic_os=udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ basic_os=scout
+ ;;
+ alliant)
+ basic_machine=fx80-alliant
+ basic_os=
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ basic_os=
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ basic_os=bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ basic_os=sysv
+ ;;
+ amiga)
+ basic_machine=m68k-unknown
+ basic_os=
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ basic_os=amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ basic_os=sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ basic_os=sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ basic_os=bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ basic_os=aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ basic_os=aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ basic_os=dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ basic_os=linux
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ basic_os=cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ basic_os=bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ basic_os=bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ basic_os=bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ basic_os=bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ basic_os=bsd
+ ;;
+ cray)
+ basic_machine=j90-cray
+ basic_os=unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ basic_os=
+ ;;
+ da30)
+ basic_machine=m68k-da30
+ basic_os=
+ ;;
+ decstation | pmax | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ basic_os=
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ basic_os=sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ basic_os=dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ basic_os=msdosdjgpp
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ basic_os=ebmon
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ basic_os=ose
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ basic_os=sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ basic_os=go32
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ basic_os=hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ basic_os=xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ basic_os=hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ basic_os=sysv3
+ ;;
+ hp300 | hp300hpux)
+ basic_machine=m68k-hp
+ basic_os=hpux
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ basic_os=bsd
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ basic_os=osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ basic_os=proelf
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ basic_os=mach
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ basic_os=sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ basic_os=linux
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ basic_os=sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ basic_os=sysv
+ ;;
+ mingw64)
+ basic_machine=x86_64-pc
+ basic_os=mingw64
+ ;;
+ mingw32)
+ basic_machine=i686-pc
+ basic_os=mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ basic_os=mingw32ce
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ basic_os=coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ basic_os=morphos
+ ;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ basic_os=moxiebox
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ basic_os=msdos
+ ;;
+ msys)
+ basic_machine=i686-pc
+ basic_os=msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ basic_os=mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ basic_os=nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ basic_os=sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-pc
+ basic_os=netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ basic_os=linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ basic_os=newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ basic_os=newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ basic_os=sysv
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ basic_os=cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ basic_os=cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ basic_os=nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ basic_os=mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ basic_os=nonstopux
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ basic_os=os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ basic_os=ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ basic_os=os68k
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ basic_os=osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ basic_os=linux
+ ;;
+ psp)
+ basic_machine=mipsallegrexel-sony
+ basic_os=psp
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ basic_os=pw32
+ ;;
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ basic_os=rdos
+ ;;
+ rdos32)
+ basic_machine=i386-pc
+ basic_os=rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ basic_os=coff
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ basic_os=udi
+ ;;
+ sei)
+ basic_machine=mips-sei
+ basic_os=seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ basic_os=
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ basic_os=sysv2
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ basic_os=
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ basic_os=sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ basic_os=
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ basic_os=sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ basic_os=sunos4
+ ;;
+ sun3)
+ basic_machine=m68k-sun
+ basic_os=
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ basic_os=sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ basic_os=sunos4
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ basic_os=
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ basic_os=sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ basic_os=sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ basic_os=solaris2
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ basic_os=
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ basic_os=unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ basic_os=dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ basic_os=unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ basic_os=unicos
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ basic_os=tops20
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ basic_os=tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ basic_os=udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ basic_os=sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ basic_os=none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ basic_os=sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ basic_os=vms
+ ;;
+ vsta)
+ basic_machine=i386-pc
+ basic_os=vsta
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ basic_os=vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ basic_os=vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ basic_os=vxworks
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ basic_os=mingw32
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ basic_os=unicos
+ ;;
+ *)
+ basic_machine=$1
+ basic_os=
+ ;;
+ esac
;;
esac
-# Decode aliases for certain CPU-COMPANY combinations.
+# Decode 1-component or ad-hoc basic machines
case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | ba \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | e2k | epiphany \
- | fido | fr30 | frv | ft32 \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | riscv32 | riscv64 \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | visium \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- leon|leon[3-9])
- basic_machine=sparc-$basic_machine
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
+ # Here we handle the default manufacturer of certain CPU types. It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ cpu=hppa1.1
+ vendor=winbond
;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ op50n)
+ cpu=hppa1.1
+ vendor=oki
;;
- ms1)
- basic_machine=mt-unknown
+ op60c)
+ cpu=hppa1.1
+ vendor=oki
;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
+ ibm*)
+ cpu=i370
+ vendor=ibm
;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
+ orion105)
+ cpu=clipper
+ vendor=highlevel
;;
- xscaleeb)
- basic_machine=armeb-unknown
+ mac | mpw | mac-mpw)
+ cpu=m68k
+ vendor=apple
;;
-
- xscaleel)
- basic_machine=armel-unknown
+ pmac | pmac-mpw)
+ cpu=powerpc
+ vendor=apple
;;
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | ba-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | e2k-* | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | riscv32-* | riscv64-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | visium-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
+ cpu=m68000
+ vendor=att
;;
3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- asmjs)
- basic_machine=asmjs-unknown
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
+ cpu=we32k
+ vendor=att
;;
bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
+ cpu=powerpc
+ vendor=ibm
+ basic_os=cnk
;;
decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
+ cpu=pdp10
+ vendor=dec
+ basic_os=tops10
;;
decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
+ cpu=pdp10
+ vendor=dec
+ basic_os=tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
+ cpu=m68k
+ vendor=motorola
;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- e500v[12])
- basic_machine=powerpc-unknown
- os=$os"spe"
- ;;
- e500v[12]-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=$os"spe"
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
+ dpx2*)
+ cpu=m68k
+ vendor=bull
+ basic_os=sysv3
;;
encore | umax | mmax)
- basic_machine=ns32k-encore
+ cpu=ns32k
+ vendor=encore
;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
+ elxsi)
+ cpu=elxsi
+ vendor=elxsi
+ basic_os=${basic_os:-bsd}
;;
fx2800)
- basic_machine=i860-alliant
+ cpu=i860
+ vendor=alliant
;;
genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
+ cpu=ns32k
+ vendor=ns
;;
h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
+ cpu=hppa1.1
+ vendor=hitachi
+ basic_os=hiuxwe2
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
+ cpu=hppa1.0
+ vendor=hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
+ cpu=m68000
+ vendor=hp
;;
hp9k3[2-9][0-9])
- basic_machine=m68k-hp
+ cpu=m68k
+ vendor=hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
+ cpu=hppa1.0
+ vendor=hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
+ cpu=hppa1.1
+ vendor=hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
+ cpu=hppa1.0
+ vendor=hp
;;
i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv32
;;
i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv4
;;
i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=sysv
;;
i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
+ cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ vendor=pc
+ basic_os=solaris2
;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
+ j90 | j90-cray)
+ cpu=j90
+ vendor=cray
+ basic_os=${basic_os:-unicos}
;;
iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
+ cpu=mips
+ vendor=sgi
+ case $basic_os in
+ irix*)
;;
*)
- os=-irix4
+ basic_os=irix4
;;
esac
;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- moxiebox)
- basic_machine=moxie-unknown
- os=-moxiebox
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
+ cpu=m68000
+ vendor=convergent
;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
+ *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ cpu=m68k
+ vendor=atari
+ basic_os=mint
;;
news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
+ cpu=mips
+ vendor=sony
+ basic_os=newsos
+ ;;
+ next | m*-next)
+ cpu=m68k
+ vendor=next
+ case $basic_os in
+ openstep*)
+ ;;
+ nextstep*)
;;
- -ns2*)
- os=-nextstep2
+ ns2*)
+ basic_os=nextstep2
;;
*)
- os=-nextstep3
+ basic_os=nextstep3
;;
esac
;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
+ cpu=np1
+ vendor=gould
;;
op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
+ cpu=hppa1.1
+ vendor=oki
+ basic_os=proelf
;;
pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
+ cpu=hppa1.1
+ vendor=hitachi
+ basic_os=hiuxwe2
;;
pbd)
- basic_machine=sparc-tti
+ cpu=sparc
+ vendor=tti
;;
pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
+ cpu=m68k
+ vendor=tti
;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ pc532)
+ cpu=ns32k
+ vendor=pc532
;;
pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
+ cpu=pn
+ vendor=gould
;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ power)
+ cpu=power
+ vendor=ibm
;;
ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
+ cpu=i386
+ vendor=ibm
;;
rm[46]00)
- basic_machine=mips-siemens
+ cpu=mips
+ vendor=siemens
;;
rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
+ cpu=romp
+ vendor=ibm
;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
+ sde)
+ cpu=mipsisa32
+ vendor=sde
+ basic_os=${basic_os:-elf}
;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
+ simso-wrs)
+ cpu=sparclite
+ vendor=wrs
+ basic_os=vxworks
;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
+ tower | tower-32)
+ cpu=m68k
+ vendor=ncr
;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
+ vpp*|vx|vx-*)
+ cpu=f301
+ vendor=fujitsu
;;
- sei)
- basic_machine=mips-sei
- os=-seiux
+ w65)
+ cpu=w65
+ vendor=wdc
;;
- sequent)
- basic_machine=i386-sequent
+ w89k-*)
+ cpu=hppa1.1
+ vendor=winbond
+ basic_os=proelf
;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
+ none)
+ cpu=none
+ vendor=none
;;
- sh5el)
- basic_machine=sh5le-unknown
+ leon|leon[3-9])
+ cpu=sparc
+ vendor=$basic_machine
;;
- sh64)
- basic_machine=sh64-unknown
+ leon-*|leon[3-9]-*)
+ cpu=sparc
+ vendor=`echo "$basic_machine" | sed 's/-.*//'`
;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
+
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read cpu vendor <<EOF
+$basic_machine
+EOF
+ IFS=$saved_IFS
;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ cpu=$basic_machine
+ vendor=pc
;;
- spur)
- basic_machine=spur-unknown
+ # These rules are duplicated from below for sake of the special case above;
+ # i.e. things that normalized to x86 arches should also default to "pc"
+ pc98)
+ cpu=i386
+ vendor=pc
;;
- st2000)
- basic_machine=m68k-tandem
+ x64 | amd64)
+ cpu=x86_64
+ vendor=pc
;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
+ # Recognize the basic CPU types without company name.
+ *)
+ cpu=$basic_machine
+ vendor=unknown
;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+esac
+
+unset -v basic_machine
+
+# Decode basic machines in the full and proper CPU-Company form.
+case $cpu-$vendor in
+ # Here we handle the default manufacturer of certain CPU types in canonical form. It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+ craynv-unknown)
+ vendor=cray
+ basic_os=${basic_os:-unicosmp}
;;
- sun2)
- basic_machine=m68000-sun
+ c90-unknown | c90-cray)
+ vendor=cray
+ basic_os=${Basic_os:-unicos}
;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
+ fx80-unknown)
+ vendor=alliant
;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
+ romp-unknown)
+ vendor=ibm
;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
+ mmix-unknown)
+ vendor=knuth
;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
+ microblaze-unknown | microblazeel-unknown)
+ vendor=xilinx
;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
+ rs6000-unknown)
+ vendor=ibm
;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
+ vax-unknown)
+ vendor=dec
;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
+ pdp11-unknown)
+ vendor=dec
;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
+ we32k-unknown)
+ vendor=att
;;
- sun4)
- basic_machine=sparc-sun
+ cydra-unknown)
+ vendor=cydrome
;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
+ i370-ibm*)
+ vendor=ibm
;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
+ orion-unknown)
+ vendor=highlevel
;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
+ xps-unknown | xps100-unknown)
+ cpu=xps100
+ vendor=honeywell
;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
+
+ # Here we normalize CPU types with a missing or matching vendor
+ armh-unknown | armh-alt)
+ cpu=armv7l
+ vendor=alt
+ basic_os=${basic_os:-linux-gnueabihf}
;;
- t90)
- basic_machine=t90-cray
- os=-unicos
+ dpx20-unknown | dpx20-bull)
+ cpu=rs6000
+ vendor=bull
+ basic_os=${basic_os:-bosx}
;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
+
+ # Here we normalize CPU types irrespective of the vendor
+ amd64-*)
+ cpu=x86_64
;;
- tx39)
- basic_machine=mipstx39-unknown
+ blackfin-*)
+ cpu=bfin
+ basic_os=linux
;;
- tx39el)
- basic_machine=mipstx39el-unknown
+ c54x-*)
+ cpu=tic54x
;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
+ c55x-*)
+ cpu=tic55x
;;
- tower | tower-32)
- basic_machine=m68k-ncr
+ c6x-*)
+ cpu=tic6x
;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
+ e500v[12]-*)
+ cpu=powerpc
+ basic_os=${basic_os}"spe"
;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
+ mips3*-*)
+ cpu=mips64
;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
+ ms1-*)
+ cpu=mt
;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
+ m68knommu-*)
+ cpu=m68k
+ basic_os=linux
;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
+ m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
+ cpu=s12z
;;
- vms)
- basic_machine=vax-dec
- os=-vms
+ openrisc-*)
+ cpu=or32
;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
+ parisc-*)
+ cpu=hppa
+ basic_os=linux
;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ cpu=i586
;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
+ pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
+ cpu=i686
;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ cpu=i686
;;
- w65*)
- basic_machine=w65-wdc
- os=-none
+ pentium4-*)
+ cpu=i786
;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
+ pc98-*)
+ cpu=i386
;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
+ ppc-* | ppcbe-*)
+ cpu=powerpc
;;
- xps | xps100)
- basic_machine=xps100-honeywell
+ ppcle-* | powerpclittle-*)
+ cpu=powerpcle
;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ppc64-*)
+ cpu=powerpc64
;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
+ ppc64le-* | powerpc64little-*)
+ cpu=powerpc64le
;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
+ sb1-*)
+ cpu=mipsisa64sb1
;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
+ sb1el-*)
+ cpu=mipsisa64sb1el
;;
- none)
- basic_machine=none-none
- os=-none
+ sh5e[lb]-*)
+ cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
+ spur-*)
+ cpu=spur
;;
- op50n)
- basic_machine=hppa1.1-oki
+ strongarm-* | thumb-*)
+ cpu=arm
;;
- op60c)
- basic_machine=hppa1.1-oki
+ tx39-*)
+ cpu=mipstx39
;;
- romp)
- basic_machine=romp-ibm
+ tx39el-*)
+ cpu=mipstx39el
;;
- mmix)
- basic_machine=mmix-knuth
+ x64-*)
+ cpu=x86_64
;;
- rs6000)
- basic_machine=rs6000-ibm
+ xscale-* | xscalee[bl]-*)
+ cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
- vax)
- basic_machine=vax-dec
+ arm64-* | aarch64le-*)
+ cpu=aarch64
;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
+
+ # Recognize the canonical CPU Types that limit and/or modify the
+ # company names they are paired with.
+ cr16-*)
+ basic_os=${basic_os:-elf}
;;
- pdp11)
- basic_machine=pdp11-dec
+ crisv32-* | etraxfs*-*)
+ cpu=crisv32
+ vendor=axis
;;
- we32k)
- basic_machine=we32k-att
+ cris-* | etrax*-*)
+ cpu=cris
+ vendor=axis
;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
+ crx-*)
+ basic_os=${basic_os:-elf}
;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
+ neo-tandem)
+ cpu=neo
+ vendor=tandem
;;
- cydra)
- basic_machine=cydra-cydrome
+ nse-tandem)
+ cpu=nse
+ vendor=tandem
;;
- orion)
- basic_machine=orion-highlevel
+ nsr-tandem)
+ cpu=nsr
+ vendor=tandem
;;
- orion105)
- basic_machine=clipper-highlevel
+ nsv-tandem)
+ cpu=nsv
+ vendor=tandem
;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
+ nsx-tandem)
+ cpu=nsx
+ vendor=tandem
;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
+ mipsallegrexel-sony)
+ cpu=mipsallegrexel
+ vendor=sony
;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
+ tile*-*)
+ basic_os=${basic_os:-linux-gnu}
;;
+
*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
+ # Recognize the canonical CPU types that are allowed with any
+ # company name.
+ case $cpu in
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | abacus \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
+ | alphapca5[67] | alpha64pca5[67] \
+ | am33_2.0 \
+ | amdgcn \
+ | arc | arceb | arc32 | arc64 \
+ | arm | arm[lb]e | arme[lb] | armv* \
+ | avr | avr32 \
+ | asmjs \
+ | ba \
+ | be32 | be64 \
+ | bfin | bpf | bs2000 \
+ | c[123]* | c30 | [cjt]90 | c4x \
+ | c8051 | clipper | craynv | csky | cydra \
+ | d10v | d30v | dlx | dsp16xx \
+ | e2k | elxsi | epiphany \
+ | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \
+ | h8300 | h8500 \
+ | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i*86 | i860 | i960 | ia16 | ia64 \
+ | ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
+ | lm32 \
+ | loongarch32 | loongarch64 | loongarchx32 \
+ | m32c | m32r | m32rle \
+ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
+ | m88110 | m88k | maxq | mb | mcore | mep | metag \
+ | microblaze | microblazeel \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64eb | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r3 | mipsisa32r3el \
+ | mipsisa32r5 | mipsisa32r5el \
+ | mipsisa32r6 | mipsisa32r6el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r3 | mipsisa64r3el \
+ | mipsisa64r5 | mipsisa64r5el \
+ | mipsisa64r6 | mipsisa64r6el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
+ | mipstx39 | mipstx39el \
+ | mmix \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nfp \
+ | nios | nios2 | nios2eb | nios2el \
+ | none | np1 | ns16k | ns32k | nvptx \
+ | open8 \
+ | or1k* \
+ | or32 \
+ | orion \
+ | picochip \
+ | pdp10 | pdp11 | pj | pjl | pn | power \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
+ | pru \
+ | pyramid \
+ | riscv | riscv32 | riscv32be | riscv64 | riscv64be \
+ | rl78 | romp | rs6000 | rx \
+ | s390 | s390x \
+ | score \
+ | sh | shl \
+ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+ | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
+ | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
+ | spu \
+ | tahoe \
+ | thumbv7* \
+ | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
+ | tron \
+ | ubicom32 \
+ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+ | vax \
+ | visium \
+ | w65 \
+ | wasm32 | wasm64 \
+ | we32k \
+ | x86 | x86_64 | xc16x | xgate | xps100 \
+ | xstormy16 | xtensa* \
+ | ymp \
+ | z8k | z80)
+ ;;
+
+ *)
+ echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2
+ exit 1
+ ;;
+ esac
;;
esac
# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+case $vendor in
+ digital*)
+ vendor=dec
;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ commodore*)
+ vendor=cbm
;;
*)
;;
@@ -1353,203 +1306,215 @@ esac
# Decode manufacturer-specific aliases for certain operating systems.
-if [ x"$os" != x"" ]
+if test x$basic_os != x
then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
+
+# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+ gnu/linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
+ ;;
+ os2-emx)
+ kernel=os2
+ os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
+ ;;
+ nto-qnx*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
+ ;;
+ *-*)
+ # shellcheck disable=SC2162
+ saved_IFS=$IFS
+ IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+ IFS=$saved_IFS
+ ;;
+ # Default OS when just kernel was specified
+ nto*)
+ kernel=nto
+ os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
+ ;;
+ linux*)
+ kernel=linux
+ os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ *)
+ kernel=
+ os=$basic_os
+ ;;
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
+case $os in
+ # First match some system type aliases that might get confused
+ # with valid system types.
+ # solaris* is a basic system type, with this one exception.
+ auroraux)
+ os=auroraux
;;
- -solaris)
- os=-solaris2
+ bluegene*)
+ os=cnk
;;
- -svr4*)
- os=-sysv4
+ solaris1 | solaris1.*)
+ os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
;;
- -unixware*)
- os=-sysv4.2uw
+ solaris)
+ os=solaris2
;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ unixware*)
+ os=sysv4.2uw
;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* | -cloudabi* | -sortix* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos* | -phoenix*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
+ # es1800 is here to avoid being matched by es* (a different OS)
+ es1800*)
+ os=ose
;;
- -nto-qnx*)
+ # Some version numbers need modification
+ chorusos*)
+ os=chorusos
;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ isc)
+ os=isc2.2
;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ sco6)
+ os=sco5v6
;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
+ sco5)
+ os=sco3.2v5
;;
- -linux-dietlibc)
- os=-linux-dietlibc
+ sco4)
+ os=sco3.2v4
;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ sco3.2.[4-9]*)
+ os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ sco*v* | scout)
+ # Don't match below
;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ sco*)
+ os=sco3.2v2
;;
- -opened*)
- os=-openedition
+ psos*)
+ os=psos
;;
- -os400*)
- os=-os400
+ qnx*)
+ os=qnx
;;
- -wince*)
- os=-wince
+ hiux*)
+ os=hiuxwe2
;;
- -osfrose*)
- os=-osfrose
+ lynx*178)
+ os=lynxos178
;;
- -osf*)
- os=-osf
+ lynx*5)
+ os=lynxos5
;;
- -utek*)
- os=-bsd
+ lynxos*)
+ # don't get caught up in next wildcard
;;
- -dynix*)
- os=-bsd
+ lynx*)
+ os=lynxos
;;
- -acis*)
- os=-aos
+ mac[0-9]*)
+ os=`echo "$os" | sed -e 's|mac|macos|'`
;;
- -atheos*)
- os=-atheos
+ opened*)
+ os=openedition
;;
- -syllable*)
- os=-syllable
+ os400*)
+ os=os400
;;
- -386bsd)
- os=-bsd
+ sunos5*)
+ os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
;;
- -ctix* | -uts*)
- os=-sysv
+ sunos6*)
+ os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
;;
- -nova*)
- os=-rtmk-nova
+ wince*)
+ os=wince
;;
- -ns2 )
- os=-nextstep2
+ utek*)
+ os=bsd
;;
- -nsk*)
- os=-nsk
+ dynix*)
+ os=bsd
;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
+ acis*)
+ os=aos
;;
- -sinix*)
- os=-sysv4
+ atheos*)
+ os=atheos
;;
- -tpf*)
- os=-tpf
+ syllable*)
+ os=syllable
;;
- -triton*)
- os=-sysv3
+ 386bsd)
+ os=bsd
;;
- -oss*)
- os=-sysv3
+ ctix* | uts*)
+ os=sysv
;;
- -svr4)
- os=-sysv4
+ nova*)
+ os=rtmk-nova
;;
- -svr3)
- os=-sysv3
+ ns2)
+ os=nextstep2
;;
- -sysvr4)
- os=-sysv4
+ # Preserve the version number of sinix5.
+ sinix5.*)
+ os=`echo "$os" | sed -e 's|sinix|sysv|'`
;;
- # This must come after -sysvr4.
- -sysv*)
+ sinix*)
+ os=sysv4
;;
- -ose*)
- os=-ose
+ tpf*)
+ os=tpf
;;
- -es1800*)
- os=-ose
+ triton*)
+ os=sysv3
;;
- -xenix)
- os=-xenix
+ oss*)
+ os=sysv3
;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
+ svr4*)
+ os=sysv4
;;
- -aros*)
- os=-aros
+ svr3)
+ os=sysv3
;;
- -zvmoe)
- os=-zvmoe
+ sysvr4)
+ os=sysv4
;;
- -dicos*)
- os=-dicos
+ ose*)
+ os=ose
;;
- -nacl*)
+ *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+ os=mint
;;
- -ios)
+ dicos*)
+ os=dicos
;;
- -none)
+ pikeos*)
+ # Until real need of OS specific support for
+ # particular features comes up, bare metal
+ # configurations are quite functional.
+ case $cpu in
+ arm*)
+ os=eabi
+ ;;
+ *)
+ os=elf
+ ;;
+ esac
;;
*)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
+ # No normalization, but not necessarily accepted, that comes below.
;;
esac
+
else
# Here we handle the default operating systems that come with various machines.
@@ -1562,261 +1527,363 @@ else
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
-case $basic_machine in
+kernel=
+case $cpu-$vendor in
score-*)
- os=-elf
+ os=elf
;;
spu-*)
- os=-elf
+ os=elf
;;
*-acorn)
- os=-riscix1.2
+ os=riscix1.2
;;
arm*-rebel)
- os=-linux
+ kernel=linux
+ os=gnu
;;
arm*-semi)
- os=-aout
+ os=aout
;;
c4x-* | tic4x-*)
- os=-coff
+ os=coff
;;
c8051-*)
- os=-elf
+ os=elf
+ ;;
+ clipper-intergraph)
+ os=clix
;;
hexagon-*)
- os=-elf
+ os=elf
;;
tic54x-*)
- os=-coff
+ os=coff
;;
tic55x-*)
- os=-coff
+ os=coff
;;
tic6x-*)
- os=-coff
+ os=coff
;;
# This must come before the *-dec entry.
pdp10-*)
- os=-tops20
+ os=tops20
;;
pdp11-*)
- os=-none
+ os=none
;;
*-dec | vax-*)
- os=-ultrix4.2
+ os=ultrix4.2
;;
m68*-apollo)
- os=-domain
+ os=domain
;;
i386-sun)
- os=-sunos4.0.2
+ os=sunos4.0.2
;;
m68000-sun)
- os=-sunos3
+ os=sunos3
;;
m68*-cisco)
- os=-aout
+ os=aout
;;
mep-*)
- os=-elf
+ os=elf
;;
mips*-cisco)
- os=-elf
+ os=elf
;;
mips*-*)
- os=-elf
+ os=elf
;;
or32-*)
- os=-coff
+ os=coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
+ os=sysv3
;;
sparc-* | *-sun)
- os=-sunos4.1.1
+ os=sunos4.1.1
;;
- *-be)
- os=-beos
+ pru-*)
+ os=elf
;;
- *-haiku)
- os=-haiku
+ *-be)
+ os=beos
;;
*-ibm)
- os=-aix
+ os=aix
;;
*-knuth)
- os=-mmixware
+ os=mmixware
;;
*-wec)
- os=-proelf
+ os=proelf
;;
*-winbond)
- os=-proelf
+ os=proelf
;;
*-oki)
- os=-proelf
+ os=proelf
;;
*-hp)
- os=-hpux
+ os=hpux
;;
*-hitachi)
- os=-hiux
+ os=hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
+ os=sysv
;;
*-cbm)
- os=-amigaos
+ os=amigaos
;;
*-dg)
- os=-dgux
+ os=dgux
;;
*-dolphin)
- os=-sysv3
+ os=sysv3
;;
m68k-ccur)
- os=-rtu
+ os=rtu
;;
m88k-omron*)
- os=-luna
+ os=luna
;;
- *-next )
- os=-nextstep
+ *-next)
+ os=nextstep
;;
*-sequent)
- os=-ptx
+ os=ptx
;;
*-crds)
- os=-unos
+ os=unos
;;
*-ns)
- os=-genix
+ os=genix
;;
i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
+ os=mvs
;;
*-gould)
- os=-sysv
+ os=sysv
;;
*-highlevel)
- os=-bsd
+ os=bsd
;;
*-encore)
- os=-bsd
+ os=bsd
;;
*-sgi)
- os=-irix
+ os=irix
;;
*-siemens)
- os=-sysv4
+ os=sysv4
;;
*-masscomp)
- os=-rtu
+ os=rtu
;;
f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
+ os=uxpv
;;
*-rom68k)
- os=-coff
+ os=coff
;;
*-*bug)
- os=-coff
+ os=coff
;;
*-apple)
- os=-macos
+ os=macos
;;
*-atari*)
- os=-mint
+ os=mint
+ ;;
+ *-wrs)
+ os=vxworks
;;
*)
- os=-none
+ os=none
;;
esac
+
fi
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+ # Sometimes we do "kernel-libc", so those need to count as OSes.
+ musl* | newlib* | relibc* | uclibc*)
+ ;;
+ # Likewise for "kernel-abi"
+ eabi* | gnueabi*)
+ ;;
+ # VxWorks passes extra cpu info in the 4th filed.
+ simlinux | simwindows | spe)
+ ;;
+ # Now accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
+ | hiux* | abug | nacl* | netware* | windows* \
+ | os9* | macos* | osx* | ios* \
+ | mpw* | magic* | mmixware* | mon960* | lnews* \
+ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
+ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+ | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
+ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+ | udi* | lites* | ieee* | go32* | aux* | hcos* \
+ | chorusrdb* | cegcc* | glidix* | serenity* \
+ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+ | midipix* | mingw32* | mingw64* | mint* \
+ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+ | interix* | uwin* | mks* | rhapsody* | darwin* \
+ | openstep* | oskit* | conix* | pw32* | nonstopux* \
+ | storm-chaos* | tops10* | tenex* | tops20* | its* \
+ | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+ | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+ | fiwix* )
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ ;;
+ none)
+ ;;
+ *)
+ echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
+ | linux-musl* | linux-relibc* | linux-uclibc* )
+ ;;
+ uclinux-uclibc* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+ # These are just libc implementations, not actual OSes, and thus
+ # require a kernel.
+ echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ kfreebsd*-gnu* | kopensolaris*-gnu*)
+ ;;
+ vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+ ;;
+ nto-qnx*)
+ ;;
+ os2-emx)
+ ;;
+ *-eabi* | *-gnueabi*)
+ ;;
+ -*)
+ # Blank kernel with real OS is always fine.
+ ;;
+ *-*)
+ echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+ exit 1
+ ;;
+esac
+
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
+case $vendor in
+ unknown)
+ case $cpu-$os in
+ *-riscix*)
vendor=acorn
;;
- -sunos*)
+ *-sunos*)
vendor=sun
;;
- -cnk*|-aix*)
+ *-cnk* | *-aix*)
vendor=ibm
;;
- -beos*)
+ *-beos*)
vendor=be
;;
- -hpux*)
+ *-hpux*)
vendor=hp
;;
- -mpeix*)
+ *-mpeix*)
vendor=hp
;;
- -hiux*)
+ *-hiux*)
vendor=hitachi
;;
- -unos*)
+ *-unos*)
vendor=crds
;;
- -dgux*)
+ *-dgux*)
vendor=dg
;;
- -luna*)
+ *-luna*)
vendor=omron
;;
- -genix*)
+ *-genix*)
vendor=ns
;;
- -mvs* | -opened*)
+ *-clix*)
+ vendor=intergraph
+ ;;
+ *-mvs* | *-opened*)
+ vendor=ibm
+ ;;
+ *-os400*)
vendor=ibm
;;
- -os400*)
+ s390-* | s390x-*)
vendor=ibm
;;
- -ptx*)
+ *-ptx*)
vendor=sequent
;;
- -tpf*)
+ *-tpf*)
vendor=ibm
;;
- -vxsim* | -vxworks* | -windiss*)
+ *-vxsim* | *-vxworks* | *-windiss*)
vendor=wrs
;;
- -aux*)
+ *-aux*)
vendor=apple
;;
- -hms*)
+ *-hms*)
vendor=hitachi
;;
- -mpw* | -macos*)
+ *-mpw* | *-macos*)
vendor=apple
;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
vendor=atari
;;
- -vos*)
+ *-vos*)
vendor=stratus
;;
esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
-echo $basic_machine$os
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
exit
# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/conf/config.h.in b/conf/config.h.in
index 3176adc..f0d00e3 100644
--- a/conf/config.h.in
+++ b/conf/config.h.in
@@ -59,6 +59,9 @@
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
+/* Define to 1 if the system has the `visibility' function attribute */
+#undef HAVE_FUNC_ATTRIBUTE_VISIBILITY
+
/* Define to 1 if you have the `getegid' function. */
#undef HAVE_GETEGID
@@ -80,6 +83,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `nanosleep' function. */
+#undef HAVE_NANOSLEEP
+
/* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H
diff --git a/configure b/configure
index 17eb5b9..c1611c7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gpgme 1.17.1.
+# Generated by GNU Autoconf 2.69 for gpgme 1.18.0.
#
# Report bugs to <https://bugs.gnupg.org>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gpgme'
PACKAGE_TARNAME='gpgme'
-PACKAGE_VERSION='1.17.1'
-PACKAGE_STRING='gpgme 1.17.1'
+PACKAGE_VERSION='1.18.0'
+PACKAGE_STRING='gpgme 1.18.0'
PACKAGE_BUGREPORT='https://bugs.gnupg.org'
PACKAGE_URL=''
@@ -651,6 +651,8 @@ USE_DESCRIPTOR_PASSING_TRUE
LIBASSUAN_LIBS
LIBASSUAN_CFLAGS
LIBASSUAN_CONFIG
+USE_GPGRT_CONFIG_FALSE
+USE_GPGRT_CONFIG_TRUE
GPG_ERROR_MT_LIBS
GPG_ERROR_MT_CFLAGS
GPG_ERROR_LIBS
@@ -705,6 +707,7 @@ GPGME_QTTEST_LIBS
GPGME_QTTEST_CFLAGS
GPGME_QT_LIBS
GPGME_QT_CFLAGS
+GPGME_CPP_CFLAGS
HAVE_CXX11
BUILD_W32_GLIB_FALSE
BUILD_W32_GLIB_TRUE
@@ -1469,7 +1472,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gpgme 1.17.1 to adapt to many kinds of systems.
+\`configure' configures gpgme 1.18.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1540,7 +1543,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gpgme 1.17.1:";;
+ short | recursive ) echo "Configuration of gpgme 1.18.0:";;
esac
cat <<\_ACEOF
@@ -1690,7 +1693,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gpgme configure 1.17.1
+gpgme configure 1.18.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2520,7 +2523,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gpgme $as_me 1.17.1, which was
+It was created by gpgme $as_me 1.18.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2885,19 +2888,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# (Interfaces added: AGE++)
# (Interfaces removed: AGE=0)
#
-LIBGPGME_LT_CURRENT=37
-LIBGPGME_LT_AGE=26
+LIBGPGME_LT_CURRENT=38
+LIBGPGME_LT_AGE=27
LIBGPGME_LT_REVISION=0
# 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=20
-LIBGPGMEPP_LT_AGE=14
+LIBGPGMEPP_LT_CURRENT=21
+LIBGPGMEPP_LT_AGE=15
LIBGPGMEPP_LT_REVISION=0
-LIBQGPGME_LT_CURRENT=15
-LIBQGPGME_LT_AGE=0
+LIBQGPGME_LT_CURRENT=16
+LIBQGPGME_LT_AGE=1
LIBQGPGME_LT_REVISION=0
################################################
@@ -2923,8 +2926,8 @@ NEED_LIBASSUAN_VERSION=2.4.2
VERSION_MAJOR=1
-VERSION_MINOR=17
-VERSION_MICRO=1
+VERSION_MINOR=18
+VERSION_MICRO=0
ac_aux_dir=
for ac_dir in build-aux "$srcdir"/build-aux; do
@@ -3440,7 +3443,7 @@ fi
# Define the identity of the package.
PACKAGE='gpgme'
- VERSION='1.17.1'
+ VERSION='1.18.0'
cat >>confdefs.h <<_ACEOF
@@ -6500,7 +6503,7 @@ test -n "$GITLOG_TO_CHANGELOG" || GITLOG_TO_CHANGELOG="gitlog-to-changelog"
-VERSION_NUMBER=0x011101
+VERSION_NUMBER=0x011200
# We need to compile and run a program on the build machine. A
@@ -17672,7 +17675,6 @@ $as_echo "no" >&6; }
LIBS="$LIBS $GLIB_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
#include <glib.h>
#include <stdio.h>
@@ -17872,8 +17874,6 @@ done
fi
done
-
-
# Enable C++ 11 if cpp language is requested
name="cpp"
@@ -18565,6 +18565,78 @@ $as_echo "$as_me: WARNING:
fi
fi
+# Check whether compiler supports visibility attribute (if cpp language is enabled)
+
+name="cpp"
+list=$enabled_languages
+found=0
+
+for n in $list; do
+ if test "x$name" = "x$n"; then
+ found=1
+ fi
+done
+
+if test "$found" = "1"; then
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility))" >&5
+$as_echo_n "checking for __attribute__((visibility))... " >&6; }
+if ${ax_cv_have_func_attribute_visibility+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+ int foo_def( void ) __attribute__((visibility("default")));
+ int foo_hid( void ) __attribute__((visibility("hidden")));
+ int foo_int( void ) __attribute__((visibility("internal")));
+ int foo_pro( void ) __attribute__((visibility("protected")));
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if grep -- -Wattributes conftest.err; then :
+ ax_cv_have_func_attribute_visibility=no
+else
+ ax_cv_have_func_attribute_visibility=yes
+fi
+else
+ ax_cv_have_func_attribute_visibility=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_func_attribute_visibility" >&5
+$as_echo "$ax_cv_have_func_attribute_visibility" >&6; }
+
+ if test yes = $ax_cv_have_func_attribute_visibility; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_FUNC_ATTRIBUTE_VISIBILITY 1
+_ACEOF
+
+fi
+
+
+
+ if test "$ax_cv_have_func_attribute_visibility" = "yes"; then
+ GPGME_CPP_CFLAGS="$GPGME_CPP_CFLAGS -fvisibility=hidden"
+ fi
+fi
+
+
# Check that if qt is enabled cpp also is enabled
name="qt"
@@ -19323,6 +19395,78 @@ $as_echo "$as_me: WARNING: Graphviz not found - Qt binding doc will not have dia
fi
fi
fi
+
+# Check if compiler supports visibility attribute (if qt is enabled)
+
+name="qt"
+list=$enabled_languages
+found=0
+
+for n in $list; do
+ if test "x$name" = "x$n"; then
+ found=1
+ fi
+done
+
+if test "$found" = "1"; then
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility))" >&5
+$as_echo_n "checking for __attribute__((visibility))... " >&6; }
+if ${ax_cv_have_func_attribute_visibility+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+ int foo_def( void ) __attribute__((visibility("default")));
+ int foo_hid( void ) __attribute__((visibility("hidden")));
+ int foo_int( void ) __attribute__((visibility("internal")));
+ int foo_pro( void ) __attribute__((visibility("protected")));
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if grep -- -Wattributes conftest.err; then :
+ ax_cv_have_func_attribute_visibility=no
+else
+ ax_cv_have_func_attribute_visibility=yes
+fi
+else
+ ax_cv_have_func_attribute_visibility=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_func_attribute_visibility" >&5
+$as_echo "$ax_cv_have_func_attribute_visibility" >&6; }
+
+ if test yes = $ax_cv_have_func_attribute_visibility; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_FUNC_ATTRIBUTE_VISIBILITY 1
+_ACEOF
+
+fi
+
+
+
+ if test "$ax_cv_have_func_attribute_visibility" = "yes"; then
+ GPGME_QT_CFLAGS="$GPGME_QT_CFLAGS -fvisibility=hidden"
+ fi
+fi
+
if test -n "$DOXYGEN"; then
HAVE_DOXYGEN_TRUE=
HAVE_DOXYGEN_FALSE='#'
@@ -24562,7 +24706,7 @@ ENABLED_LANGUAGES=$enabled_languages
#
# Provide information about the build.
#
-BUILD_REVISION="ee50a388"
+BUILD_REVISION="26ff163b"
cat >>confdefs.h <<_ACEOF
@@ -24571,7 +24715,7 @@ _ACEOF
BUILD_VERSION=`echo "$PACKAGE_VERSION" | sed 's/\([0-9.]*\).*/\1./'`
-BUILD_VERSION="${BUILD_VERSION}61008"
+BUILD_VERSION="${BUILD_VERSION}9983"
BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
@@ -25800,6 +25944,7 @@ $as_echo "$as_me: Use gpgrt-config with $gpgrt_libdir as gpg-error-config" >&6;}
fi
elif test "$GPG_ERROR_CONFIG" != "no"; then
gpg_error_config_version=`$GPG_ERROR_CONFIG --version`
+ unset GPGRT_CONFIG
fi
if test "$GPG_ERROR_CONFIG" != "no"; then
req_major=`echo $min_gpg_error_version | \
@@ -25881,6 +26026,16 @@ $as_echo "no" >&6; }
$as_echo "#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGME" >>confdefs.h
+ if test -n "$GPGRT_CONFIG" \
+ -a "$ac_cv_path_GPG_ERROR_CONFIG" = no; then
+ USE_GPGRT_CONFIG_TRUE=
+ USE_GPGRT_CONFIG_FALSE='#'
+else
+ USE_GPGRT_CONFIG_TRUE='#'
+ USE_GPGRT_CONFIG_FALSE=
+fi
+
+
# And for libassuan.
have_libassuan=no
@@ -26086,7 +26241,7 @@ fi
#
# Check for getgid etc
-for ac_func in getgid getegid closefrom
+for ac_func in getgid getegid closefrom nanosleep
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -26563,6 +26718,10 @@ if test -z "${RUN_G13_TESTS_TRUE}" && test -z "${RUN_G13_TESTS_FALSE}"; then
as_fn_error $? "conditional \"RUN_G13_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${USE_GPGRT_CONFIG_TRUE}" && test -z "${USE_GPGRT_CONFIG_FALSE}"; then
+ as_fn_error $? "conditional \"USE_GPGRT_CONFIG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${USE_DESCRIPTOR_PASSING_TRUE}" && test -z "${USE_DESCRIPTOR_PASSING_FALSE}"; then
as_fn_error $? "conditional \"USE_DESCRIPTOR_PASSING\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -26968,7 +27127,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gpgme $as_me 1.17.1, which was
+This file was extended by gpgme $as_me 1.18.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -27034,7 +27193,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gpgme config.status 1.17.1
+gpgme config.status 1.18.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -29360,7 +29519,7 @@ fi
echo "
GPGME v${VERSION} has been configured as follows:
- Revision: ee50a388 (61008)
+ Revision: 26ff163b (9983)
Platform: $host
UI Server: $uiserver
diff --git a/configure.ac b/configure.ac
index 43b18f6..9d696b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,8 +31,8 @@ min_automake_version="1.14"
# for the LT versions.
m4_define([mym4_package],[gpgme])
m4_define([mym4_major], [1])
-m4_define([mym4_minor], [17])
-m4_define([mym4_micro], [1])
+m4_define([mym4_minor], [18])
+m4_define([mym4_micro], [0])
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
@@ -53,19 +53,19 @@ AC_INIT([mym4_package],[mym4_version],[https://bugs.gnupg.org])
# (Interfaces added: AGE++)
# (Interfaces removed: AGE=0)
#
-LIBGPGME_LT_CURRENT=37
-LIBGPGME_LT_AGE=26
+LIBGPGME_LT_CURRENT=38
+LIBGPGME_LT_AGE=27
LIBGPGME_LT_REVISION=0
# 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=20
-LIBGPGMEPP_LT_AGE=14
+LIBGPGMEPP_LT_CURRENT=21
+LIBGPGMEPP_LT_AGE=15
LIBGPGMEPP_LT_REVISION=0
-LIBQGPGME_LT_CURRENT=15
-LIBQGPGME_LT_AGE=0
+LIBQGPGME_LT_CURRENT=16
+LIBQGPGME_LT_AGE=1
LIBQGPGME_LT_REVISION=0
################################################
@@ -331,8 +331,6 @@ for language in $enabled_languages; do
fi
done
-
-
# Enable C++ 11 if cpp language is requested
LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "1"; then
@@ -354,6 +352,16 @@ if test "$found" = "1"; then
fi
fi
+# Check whether compiler supports visibility attribute (if cpp language is enabled)
+LIST_MEMBER("cpp", $enabled_languages)
+if test "$found" = "1"; then
+ AX_GCC_FUNC_ATTRIBUTE(visibility)
+ if test "$ax_cv_have_func_attribute_visibility" = "yes"; then
+ GPGME_CPP_CFLAGS="$GPGME_CPP_CFLAGS -fvisibility=hidden"
+ fi
+fi
+AC_SUBST(GPGME_CPP_CFLAGS)
+
# Check that if qt is enabled cpp also is enabled
LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then
@@ -394,6 +402,16 @@ if test "$found" = "1"; then
fi
fi
fi
+
+# Check if compiler supports visibility attribute (if qt is enabled)
+LIST_MEMBER("qt", $enabled_languages)
+if test "$found" = "1"; then
+ AX_GCC_FUNC_ATTRIBUTE(visibility)
+ if test "$ax_cv_have_func_attribute_visibility" = "yes"; then
+ GPGME_QT_CFLAGS="$GPGME_QT_CFLAGS -fvisibility=hidden"
+ fi
+fi
+
AM_CONDITIONAL([HAVE_DOXYGEN],
[test -n "$DOXYGEN"])
if test -n "$GRAPHVIZ"; then
@@ -706,6 +724,9 @@ AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
[The default error source for GPGME.])
+AM_CONDITIONAL(USE_GPGRT_CONFIG, [test -n "$GPGRT_CONFIG" \
+ -a "$ac_cv_path_GPG_ERROR_CONFIG" = no])
+
# And for libassuan.
have_libassuan=no
AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
@@ -721,7 +742,7 @@ fi
#
# Check for getgid etc
-AC_CHECK_FUNCS(getgid getegid closefrom)
+AC_CHECK_FUNCS(getgid getegid closefrom nanosleep)
# Replacement functions.
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 5f4bebe..63adc02 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -268,6 +269,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/doc/defsincdate b/doc/defsincdate
index b8cb3c6..c8c88f0 100644
--- a/doc/defsincdate
+++ b/doc/defsincdate
@@ -1 +1 @@
-1643900190
+1651071437
diff --git a/doc/gpgme.info b/doc/gpgme.info
index 4c70883..d544012 100644
--- a/doc/gpgme.info
+++ b/doc/gpgme.info
@@ -19,8 +19,8 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.17.0, last updated 3 February 2022, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.17.0.
+ This is Edition 1.18.0, last updated 3 February 2022, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.18.0.
Copyright © 2002–2008, 2010, 2012–2018 g10 Code GmbH.
@@ -38,7 +38,7 @@ Public License for more details.

Indirect:
gpgme.info-1: 1673
-gpgme.info-2: 303842
+gpgme.info-2: 304250

Tag Table:
(Indirect)
@@ -52,114 +52,114 @@ Node: Header14706
Node: Building the Source15453
Node: Largefile Support (LFS)17597
Node: Using Automake23013
-Node: Using Libtool25566
-Node: Library Version Check25928
-Node: Signal Handling31988
-Node: Multi-Threading33258
-Ref: Multi-Threading-Footnote-134674
-Node: Protocols and Engines35097
-Node: Engine Version Check37848
-Node: Engine Information40731
-Node: Engine Configuration44591
-Node: OpenPGP45895
-Node: Cryptographic Message Syntax46235
-Node: Assuan46548
-Node: Algorithms46922
-Ref: Algorithms-Footnote-147401
-Node: Public Key Algorithms47529
-Node: Hash Algorithms50131
-Node: Error Handling51345
-Node: Error Values53219
-Node: Error Sources58422
-Node: Error Codes60862
-Node: Error Strings65655
-Node: Exchanging Data67462
-Node: Creating Data Buffers69347
-Node: Memory Based Data Buffers69863
-Node: File Based Data Buffers73296
-Node: Callback Based Data Buffers76409
-Node: Destroying Data Buffers80600
-Node: Manipulating Data Buffers82107
-Node: Data Buffer I/O Operations82599
-Node: Data Buffer Meta-Data84972
-Node: Data Buffer Convenience90291
-Node: Contexts92511
-Node: Creating Contexts93630
-Node: Destroying Contexts94477
-Node: Result Management94816
-Node: Context Attributes96397
-Node: Protocol Selection97564
-Node: Crypto Engine98610
-Node: Setting the Sender100499
-Node: ASCII Armor102012
-Node: Text Mode102641
-Node: Offline Mode103575
-Node: Pinentry Mode105073
-Node: Included Certificates106967
-Node: Key Listing Mode108413
-Node: Passphrase Callback113537
-Node: Progress Meter Callback117099
-Node: Status Message Callback119084
-Node: Context Flags120849
-Node: Locale128340
-Node: Additional Logs129932
-Node: Key Management132130
-Node: Key objects133354
-Node: Listing Keys148360
-Node: Information About Keys157013
-Node: Manipulating Keys158321
-Node: Generating Keys161219
-Node: Signing Keys179539
-Node: Exporting Keys185298
-Node: Importing Keys192887
-Ref: Importing Keys-Footnote-1201753
-Node: Deleting Keys201881
-Node: Changing Passphrases204161
-Node: Changing TOFU Data205488
-Node: Advanced Key Editing207596
-Node: Crypto Operations210329
-Node: Decrypt211586
-Node: Verify218866
-Node: Decrypt and Verify231959
-Node: Sign234814
-Node: Selecting Signers235378
-Node: Creating a Signature236784
-Node: Signature Notation Data241554
-Node: Encrypt243839
-Node: Encrypting a Plaintext244195
-Node: Miscellaneous258607
-Node: Running other Programs259019
-Node: Using the Assuan protocol261182
-Node: Checking for updates263980
-Node: Run Control268797
-Node: Waiting For Completion269541
-Node: Using External Event Loops271666
-Node: I/O Callback Interface273638
-Node: Registering I/O Callbacks278566
-Node: I/O Callback Example280605
-Node: I/O Callback Example GTK+287230
-Node: I/O Callback Example GDK289019
-Node: I/O Callback Example Qt290661
-Node: Cancellation292949
-Node: UI Server Protocol295257
-Ref: UI Server Protocol-Footnote-1296692
-Node: UI Server Encrypt296811
-Node: UI Server Sign303842
-Node: UI Server Decrypt306195
-Node: UI Server Verify307850
-Node: UI Server Set Input Files311422
-Node: UI Server Sign/Encrypt Files312492
-Node: UI Server Verify/Decrypt Files314300
-Node: UI Server Import/Export Keys316176
-Node: UI Server Checksum Files317238
-Node: Miscellaneous UI Server Commands319456
-Ref: command SENDER321387
-Node: Debugging323089
-Node: Deprecated Functions324838
-Node: Library Copying347847
-Node: Copying376067
-Node: Concept Index413817
-Node: Function and Data Index428529
+Node: Using Libtool25402
+Node: Library Version Check25764
+Node: Signal Handling31824
+Node: Multi-Threading33094
+Ref: Multi-Threading-Footnote-134510
+Node: Protocols and Engines34933
+Node: Engine Version Check37684
+Node: Engine Information40567
+Node: Engine Configuration44427
+Node: OpenPGP45731
+Node: Cryptographic Message Syntax46071
+Node: Assuan46384
+Node: Algorithms46758
+Ref: Algorithms-Footnote-147237
+Node: Public Key Algorithms47365
+Node: Hash Algorithms49967
+Node: Error Handling51181
+Node: Error Values53055
+Node: Error Sources58258
+Node: Error Codes60698
+Node: Error Strings65491
+Node: Exchanging Data67298
+Node: Creating Data Buffers69183
+Node: Memory Based Data Buffers69699
+Node: File Based Data Buffers73132
+Node: Callback Based Data Buffers76245
+Node: Destroying Data Buffers80436
+Node: Manipulating Data Buffers81943
+Node: Data Buffer I/O Operations82435
+Node: Data Buffer Meta-Data84808
+Node: Data Buffer Convenience90127
+Node: Contexts92347
+Node: Creating Contexts93466
+Node: Destroying Contexts94313
+Node: Result Management94652
+Node: Context Attributes96233
+Node: Protocol Selection97400
+Node: Crypto Engine98446
+Node: Setting the Sender100335
+Node: ASCII Armor101848
+Node: Text Mode102477
+Node: Offline Mode103411
+Node: Pinentry Mode104909
+Node: Included Certificates106803
+Node: Key Listing Mode108249
+Node: Passphrase Callback114337
+Node: Progress Meter Callback117899
+Node: Status Message Callback119884
+Node: Context Flags121649
+Node: Locale129140
+Node: Additional Logs130732
+Node: Key Management132930
+Node: Key objects134154
+Node: Listing Keys149160
+Node: Information About Keys157813
+Node: Manipulating Keys159121
+Node: Generating Keys161627
+Node: Signing Keys179947
+Node: Exporting Keys185706
+Node: Importing Keys193295
+Ref: Importing Keys-Footnote-1202161
+Node: Deleting Keys202289
+Node: Changing Passphrases204569
+Node: Changing TOFU Data205896
+Node: Advanced Key Editing208004
+Node: Crypto Operations210737
+Node: Decrypt211994
+Node: Verify219274
+Node: Decrypt and Verify232367
+Node: Sign235222
+Node: Selecting Signers235786
+Node: Creating a Signature237192
+Node: Signature Notation Data241962
+Node: Encrypt244247
+Node: Encrypting a Plaintext244603
+Node: Miscellaneous259015
+Node: Running other Programs259427
+Node: Using the Assuan protocol261590
+Node: Checking for updates264388
+Node: Run Control269205
+Node: Waiting For Completion269949
+Node: Using External Event Loops272074
+Node: I/O Callback Interface274046
+Node: Registering I/O Callbacks278974
+Node: I/O Callback Example281013
+Node: I/O Callback Example GTK+287638
+Node: I/O Callback Example GDK289427
+Node: I/O Callback Example Qt291069
+Node: Cancellation293357
+Node: UI Server Protocol295665
+Ref: UI Server Protocol-Footnote-1297100
+Node: UI Server Encrypt297219
+Node: UI Server Sign304250
+Node: UI Server Decrypt306603
+Node: UI Server Verify308258
+Node: UI Server Set Input Files311830
+Node: UI Server Sign/Encrypt Files312900
+Node: UI Server Verify/Decrypt Files314708
+Node: UI Server Import/Export Keys316584
+Node: UI Server Checksum Files317646
+Node: Miscellaneous UI Server Commands319864
+Ref: command SENDER321795
+Node: Debugging323497
+Node: Deprecated Functions325246
+Node: Library Copying348255
+Node: Copying376475
+Node: Concept Index414225
+Node: Function and Data Index428937

End Tag Table
diff --git a/doc/gpgme.info-1 b/doc/gpgme.info-1
index 03fb2f5..6a77b8f 100644
--- a/doc/gpgme.info-1
+++ b/doc/gpgme.info-1
@@ -19,8 +19,8 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.17.0, last updated 3 February 2022, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.17.0.
+ This is Edition 1.18.0, last updated 3 February 2022, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.18.0.
Copyright © 2002–2008, 2010, 2012–2018 g10 Code GmbH.
@@ -41,8 +41,8 @@ File: gpgme.info, Node: Top, Next: Introduction, Up: (dir)
Main Menu
*********
-This is Edition 1.17.0, last updated 3 February 2022, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.17.0 of the GPGME library.
+This is Edition 1.18.0, last updated 3 February 2022, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.18.0 of the GPGME library.
* Menu:
@@ -537,10 +537,6 @@ to Automake that does all the work for you.
the string ‘libgcrypt’ is appended to the variable
‘gpg_config_script_warn’.
- ‘AM_PATH_GPGME_PTH’ checks for the version of GPGME that can be
- used with GNU Pth, and defines ‘GPGME_PTH_CFLAGS’ and
- ‘GPGME_PTH_LIBS’.
-
‘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’. Since version
@@ -2686,6 +2682,27 @@ File: gpgme.info, Node: Key Listing Mode, Next: Passphrase Callback, Prev: In
Currently only implemented for the S/MIME backend and ignored
for other backends.
+ ‘GPGME_KEYLIST_MODE_FORCE_EXTERN’
+ SINCE: 1.18.0
+
+ The ‘GPGME_KEYLIST_MODE_FORCE_EXTERN’ symbol specifies that
+ only external sources should be searched for keys in the
+ keylisting operation. If used in combination with
+ ‘GPGME_KEYLIST_MODE_LOCATE’, the keylisting results in a
+ ‘--locate-external-keys’ for ‘GPGME_PROTOCOL_OpenPGP’. The
+ combination with ‘GPGME_KEYLIST_MODE_LOCAL’, but without
+ ‘GPGME_KEYLIST_MODE_EXTERN’ is not allowed. Currently only
+ implemented for the OpenPGP backend and ignored for other
+ backends.
+
+ ‘GPGME_KEYLIST_MODE_LOCATE_EXTERNAL’
+ SINCE: 1.18.0
+
+ This is a shortcut for the combination of
+ ‘GPGME_KEYLIST_MODE_LOCATE’ and
+ ‘GPGME_KEYLIST_MODE_FORCE_EXTERN’, which results in a
+ ‘--locate-external-keys’ for ‘GPGME_PROTOCOL_OpenPGP’.
+
At least one of ‘GPGME_KEYLIST_MODE_LOCAL’ and
‘GPGME_KEYLIST_MODE_EXTERN’ must be specified. For future binary
compatibility, you should get the current mode with
@@ -3874,16 +3891,6 @@ File: gpgme.info, Node: Manipulating Keys, Next: Generating Keys, Prev: Infor
completed by calling ‘gpgme_wait’ on the context. *Note Waiting
For Completion::.
- -- Function: gpgme_error_t gpgme_op_revuid_start (gpgme_ctx_t CTX,
- gpgme_key_t KEY, const char *USERID, unsigned int FLAGS);
-
- SINCE: 1.14.1
-
- The function ‘gpgme_op_setexpire_start’ initiates a
- ‘gpgme_op_setexpire’ operation; see there for details. It must be
- completed by calling ‘gpgme_wait’ on the context. *Note Waiting
- For Completion::.
-

File: gpgme.info, Node: Generating Keys, Next: Signing Keys, Prev: Manipulating Keys, Up: Key Management
diff --git a/doc/gpgme.info-2 b/doc/gpgme.info-2
index 641052c..d540d40 100644
--- a/doc/gpgme.info-2
+++ b/doc/gpgme.info-2
@@ -19,8 +19,8 @@ END-INFO-DIR-ENTRY
This file documents the GPGME library.
- This is Edition 1.17.0, last updated 3 February 2022, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.17.0.
+ This is Edition 1.18.0, last updated 3 February 2022, of ‘The ‘GnuPG
+Made Easy’ Reference Manual’, for Version 1.18.0.
Copyright © 2002–2008, 2010, 2012–2018 g10 Code GmbH.
@@ -2702,7 +2702,7 @@ Function and Data Index
* gpgme_get_io_cbs: Registering I/O Callbacks.
(line 44)
* gpgme_get_key: Listing Keys. (line 178)
-* gpgme_get_keylist_mode: Key Listing Mode. (line 103)
+* gpgme_get_keylist_mode: Key Listing Mode. (line 124)
* gpgme_get_offline: Offline Mode. (line 31)
* gpgme_get_passphrase_cb: Passphrase Callback. (line 63)
* gpgme_get_pinentry_mode: Pinentry Mode. (line 18)
@@ -2841,8 +2841,7 @@ Function and Data Index
* gpgme_op_revsig: Signing Keys. (line 89)
* gpgme_op_revsig_start: Signing Keys. (line 124)
* gpgme_op_revuid: Generating Keys. (line 224)
-* gpgme_op_revuid_start: Manipulating Keys. (line 58)
-* gpgme_op_revuid_start <1>: Generating Keys. (line 252)
+* gpgme_op_revuid_start: Generating Keys. (line 252)
* gpgme_op_setexpire: Manipulating Keys. (line 15)
* gpgme_op_setexpire_start: Manipulating Keys. (line 47)
* gpgme_op_set_uid_flag_start: Generating Keys. (line 293)
diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index 9590ce8..7f17815 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -601,10 +601,6 @@ does not match the target type you are building for a warning is
printed and the string @code{libgcrypt} is appended to the variable
@code{gpg_config_script_warn}.
-@code{AM_PATH_GPGME_PTH} checks for the version of @acronym{GPGME}
-that can be used with GNU Pth, and defines @code{GPGME_PTH_CFLAGS} and
-@code{GPGME_PTH_LIBS}.
-
@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}. Since
@@ -2876,6 +2872,26 @@ validity information from an internal cache. This might be an
expensive operation and is in general not useful. Currently only
implemented for the S/MIME backend and ignored for other backends.
+@item GPGME_KEYLIST_MODE_FORCE_EXTERN
+@since{1.18.0}
+
+The @code{GPGME_KEYLIST_MODE_FORCE_EXTERN} symbol specifies that only
+external sources should be searched for keys in the keylisting
+operation. If used in combination with @code{GPGME_KEYLIST_MODE_LOCATE},
+the keylisting results in a @code{--locate-external-keys} for
+@code{GPGME_PROTOCOL_OpenPGP}. The combination with
+@code{GPGME_KEYLIST_MODE_LOCAL}, but without @code{GPGME_KEYLIST_MODE_EXTERN}
+is not allowed. Currently only implemented for the OpenPGP backend and
+ignored for other backends.
+
+@item GPGME_KEYLIST_MODE_LOCATE_EXTERNAL
+@since{1.18.0}
+
+This is a shortcut for the combination of
+@code{GPGME_KEYLIST_MODE_LOCATE} and @code{GPGME_KEYLIST_MODE_FORCE_EXTERN},
+which results in a @code{--locate-external-keys} for
+@code{GPGME_PROTOCOL_OpenPGP}.
+
@end table
At least one of @code{GPGME_KEYLIST_MODE_LOCAL} and
@@ -4137,22 +4153,6 @@ be completed by calling @code{gpgme_wait} on the context.
@end deftypefun
-@deftypefun gpgme_error_t gpgme_op_revuid_start @
- (@w{gpgme_ctx_t @var{ctx}}, @
- @w{gpgme_key_t @var{key}}, @
- @w{const char *@var{userid}}, @
- @w{unsigned int @var{flags}});
-
-@since{1.14.1}
-
-The function @code{gpgme_op_setexpire_start} initiates a
-@code{gpgme_op_setexpire} operation; see there for details. It must
-be completed by calling @code{gpgme_wait} on the context.
-@xref{Waiting For Completion}.
-
-@end deftypefun
-
-
@node Generating Keys
@subsection Generating Keys
@cindex key, creation
diff --git a/gpgme.spec b/gpgme.spec
index e23d740..0fe46fb 100644
--- a/gpgme.spec
+++ b/gpgme.spec
@@ -1,7 +1,7 @@
# This is a template. The dist target uses it to create the real file.
Summary: GPGME - GnuPG Made Easy
Name: gpgme
-Version: 1.17.1
+Version: 1.18.0
Release: 1
URL: https://gnupg.org/gpgme.html
Source: https://www.gnupg.org/ftp/gcrypt/gpgme/%{name}-%{version}.tar.gz
diff --git a/lang/Makefile.in b/lang/Makefile.in
index c080aa4..0be4fc8 100644
--- a/lang/Makefile.in
+++ b/lang/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -257,6 +258,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/cl/Makefile.in b/lang/cl/Makefile.in
index d9639d4..9891ca7 100644
--- a/lang/cl/Makefile.in
+++ b/lang/cl/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = lang/cl
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -229,6 +230,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/cl/gpgme.asd b/lang/cl/gpgme.asd
index facdc8e..72564c4 100644
--- a/lang/cl/gpgme.asd
+++ b/lang/cl/gpgme.asd
@@ -27,7 +27,7 @@
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.17.1"
+ :version "1.18.0"
:licence "GPL"
:defsystem-depends-on ("cffi-grovel")
:depends-on ("cffi" "gpg-error" "trivial-garbage")
diff --git a/lang/cpp/Makefile.in b/lang/cpp/Makefile.in
index 14315ac..7c835ea 100644
--- a/lang/cpp/Makefile.in
+++ b/lang/cpp/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = lang/cpp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -259,6 +260,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
index 1282676..51ada3b 100644
--- a/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
+++ b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
@@ -97,7 +97,3 @@ 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 --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in
index 73f5eaa..8777623 100644
--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in
+++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in
@@ -93,7 +93,3 @@ 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 --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am
index ba8a7fb..fbec70b 100644
--- a/lang/cpp/src/Makefile.am
+++ b/lang/cpp/src/Makefile.am
@@ -34,6 +34,7 @@ main_sources = \
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp gpggencardkeyinteractor.cpp \
gpgaddexistingsubkeyeditinteractor.cpp \
+ gpgrevokekeyeditinteractor.cpp \
defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
statusconsumerassuantransaction.cpp \
@@ -49,6 +50,7 @@ gpgmepp_headers = \
gpgsetownertrusteditinteractor.h gpgsignkeyeditinteractor.h \
gpggencardkeyinteractor.h \
gpgaddexistingsubkeyeditinteractor.h \
+ gpgrevokekeyeditinteractor.h \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
statusconsumerassuantransaction.h \
@@ -71,7 +73,8 @@ nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
-AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
+AM_CPPFLAGS = -I$(top_builddir)/src \
+ @GPGME_CPP_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_GPGMEPP -Wsuggest-override \
-Wzero-as-null-pointer-constant
diff --git a/lang/cpp/src/Makefile.in b/lang/cpp/src/Makefile.in
index f5e859a..0518307 100644
--- a/lang/cpp/src/Makefile.in
+++ b/lang/cpp/src/Makefile.in
@@ -113,6 +113,7 @@ host_triplet = @host@
subdir = lang/cpp/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -174,7 +175,8 @@ am__objects_1 = exception.lo context.lo key.lo trustitem.lo data.lo \
gpgsetownertrusteditinteractor.lo gpgsignkeyeditinteractor.lo \
gpgadduserideditinteractor.lo gpggencardkeyinteractor.lo \
gpgaddexistingsubkeyeditinteractor.lo \
- defaultassuantransaction.lo scdgetinfoassuantransaction.lo \
+ gpgrevokekeyeditinteractor.lo defaultassuantransaction.lo \
+ scdgetinfoassuantransaction.lo \
gpgagentgetinfoassuantransaction.lo \
statusconsumerassuantransaction.lo vfsmountresult.lo \
configuration.lo tofuinfo.lo swdbresult.lo util.lo
@@ -217,6 +219,7 @@ am__depfiles_remade = ./$(DEPDIR)/callbacks.Plo \
./$(DEPDIR)/gpgadduserideditinteractor.Plo \
./$(DEPDIR)/gpgagentgetinfoassuantransaction.Plo \
./$(DEPDIR)/gpggencardkeyinteractor.Plo \
+ ./$(DEPDIR)/gpgrevokekeyeditinteractor.Plo \
./$(DEPDIR)/gpgsetexpirytimeeditinteractor.Plo \
./$(DEPDIR)/gpgsetownertrusteditinteractor.Plo \
./$(DEPDIR)/gpgsignkeyeditinteractor.Plo \
@@ -350,6 +353,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
@@ -513,6 +517,7 @@ main_sources = \
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp gpggencardkeyinteractor.cpp \
gpgaddexistingsubkeyeditinteractor.cpp \
+ gpgrevokekeyeditinteractor.cpp \
defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
statusconsumerassuantransaction.cpp \
@@ -528,6 +533,7 @@ gpgmepp_headers = \
gpgsetownertrusteditinteractor.h gpgsignkeyeditinteractor.h \
gpggencardkeyinteractor.h \
gpgaddexistingsubkeyeditinteractor.h \
+ gpgrevokekeyeditinteractor.h \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
statusconsumerassuantransaction.h \
@@ -549,7 +555,8 @@ nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
-AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
+AM_CPPFLAGS = -I$(top_builddir)/src \
+ @GPGME_CPP_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_GPGMEPP -Wsuggest-override \
-Wzero-as-null-pointer-constant
@@ -664,6 +671,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgadduserideditinteractor.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgagentgetinfoassuantransaction.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpggencardkeyinteractor.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgrevokekeyeditinteractor.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgsetexpirytimeeditinteractor.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgsetownertrusteditinteractor.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgsignkeyeditinteractor.Plo@am__quote@ # am--include-marker
@@ -925,6 +933,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/gpgadduserideditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgagentgetinfoassuantransaction.Plo
-rm -f ./$(DEPDIR)/gpggencardkeyinteractor.Plo
+ -rm -f ./$(DEPDIR)/gpgrevokekeyeditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgsetexpirytimeeditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgsetownertrusteditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgsignkeyeditinteractor.Plo
@@ -1004,6 +1013,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/gpgadduserideditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgagentgetinfoassuantransaction.Plo
-rm -f ./$(DEPDIR)/gpggencardkeyinteractor.Plo
+ -rm -f ./$(DEPDIR)/gpgrevokekeyeditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgsetexpirytimeeditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgsetownertrusteditinteractor.Plo
-rm -f ./$(DEPDIR)/gpgsignkeyeditinteractor.Plo
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 5072681..dba958c 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -195,6 +195,19 @@ std::ostream &operator<<(std::ostream &os, const Error &err)
return os << "GpgME::Error(" << err.encodedError() << " (" << err.asString() << "))";
}
+Context::KeyListModeSaver::KeyListModeSaver(Context *ctx)
+ : mCtx{ctx}
+ , mKeyListMode{ctx ? ctx->keyListMode() : 0}
+{
+}
+
+Context::KeyListModeSaver::~KeyListModeSaver()
+{
+ if (mCtx) {
+ mCtx->setKeyListMode(mKeyListMode);
+ }
+}
+
Context::Context(gpgme_ctx_t ctx) : d(new Private(ctx))
{
}
@@ -522,19 +535,25 @@ const char *Context::getSender ()
Error Context::startKeyListing(const char *pattern, bool secretOnly)
{
- d->lastop = Private::KeyList;
+ d->lastop = (((keyListMode() & GpgME::Locate) == GpgME::Locate)
+ ? Private::KeyListWithImport
+ : Private::KeyList);
return Error(d->lasterr = gpgme_op_keylist_start(d->ctx, pattern, int(secretOnly)));
}
Error Context::startKeyListing(const char *patterns[], bool secretOnly)
{
- d->lastop = Private::KeyList;
+ d->lastop = (((keyListMode() & GpgME::Locate) == GpgME::Locate)
+ ? Private::KeyListWithImport
+ : Private::KeyList);
return Error(d->lasterr = gpgme_op_keylist_ext_start(d->ctx, patterns, int(secretOnly), 0));
}
Key Context::nextKey(GpgME::Error &e)
{
- d->lastop = Private::KeyList;
+ d->lastop = (((keyListMode() & GpgME::Locate) == GpgME::Locate)
+ ? Private::KeyListWithImport
+ : Private::KeyList);
gpgme_key_t key = nullptr;
e = Error(d->lasterr = gpgme_op_keylist_next(d->ctx, &key));
return Key(key, false);
@@ -1154,6 +1173,7 @@ Error Context::startCombinedDecryptionAndVerification(const Data &cipherText, Da
return startCombinedDecryptionAndVerification(cipherText, plainText, DecryptNone);
}
+namespace {
unsigned int to_auditlog_flags(unsigned int flags)
{
unsigned int result = 0;
@@ -1168,6 +1188,7 @@ unsigned int to_auditlog_flags(unsigned int flags)
}
return result;
}
+}
Error Context::startGetAuditLog(Data &output, unsigned int flags)
{
@@ -1620,6 +1641,16 @@ Error Context::startRevUid(const Key &k, const char *userid)
k.impl(), userid, 0));
}
+Error Context::setPrimaryUid(const Key &k, const char *userid)
+{
+ return Error(d->lasterr = gpgme_op_set_uid_flag(d->ctx, k.impl(), userid, "primary", nullptr));
+}
+
+Error Context::startSetPrimaryUid(const Key &k, const char *userid)
+{
+ return Error(d->lasterr = gpgme_op_set_uid_flag_start(d->ctx, k.impl(), userid, "primary", nullptr));
+}
+
Error Context::createSubkey(const Key &k, const char *algo,
unsigned long reserved,
unsigned long expires,
@@ -1847,6 +1878,7 @@ std::ostream &operator<<(std::ostream &os, KeyListMode mode)
CHECK(WithTofu);
CHECK(WithKeygrip);
CHECK(WithSecret);
+ CHECK(ForceExtern);
#undef CHECK
return os << ')';
}
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index 9c2b2a5..7bd1b03 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -64,6 +64,17 @@ class GPGMEPP_EXPORT Context
public:
//using GpgME::Protocol;
+ /// RAII-style class for saving/restoring the key list mode.
+ class GPGMEPP_EXPORT KeyListModeSaver
+ {
+ public:
+ explicit KeyListModeSaver(Context *ctx);
+ ~KeyListModeSaver();
+ private:
+ Context *mCtx;
+ unsigned int mKeyListMode;
+ };
+
//
// Creation and destruction:
//
@@ -284,6 +295,9 @@ public:
Error revUid(const Key &key, const char *userid);
Error startRevUid(const Key &key, const char *userid);
+ Error setPrimaryUid(const Key &key, const char *userid);
+ Error startSetPrimaryUid(const Key &key, const char *userid);
+
Error createSubkey(const Key &key, const char *algo,
unsigned long reserved = 0,
unsigned long expires = 0,
diff --git a/lang/cpp/src/context_p.h b/lang/cpp/src/context_p.h
index 491e7f7..8782609 100644
--- a/lang/cpp/src/context_p.h
+++ b/lang/cpp/src/context_p.h
@@ -53,6 +53,7 @@ public:
KeyGen = 0x080,
KeyList = 0x100,
+ KeyListWithImport = KeyList | Import, // gpgme_keylist_result_t and gpgme_import_result_t
TrustList = 0x200, // no gpgme_trustlist_result_t, but nevertheless...
Edit = 0x400, // no gpgme_edit_result_t, but nevertheless...
diff --git a/lang/cpp/src/editinteractor.cpp b/lang/cpp/src/editinteractor.cpp
index e411ada..08cb1bc 100644
--- a/lang/cpp/src/editinteractor.cpp
+++ b/lang/cpp/src/editinteractor.cpp
@@ -29,6 +29,7 @@
#include "editinteractor.h"
#include "callbacks.h"
#include "error.h"
+#include "util.h"
#include <gpgme.h>
@@ -100,7 +101,7 @@ public:
std::fprintf(ei->debug, "EditInteractor: %u -> nextState( %s, %s ) -> %u\n",
oldState, status_to_string(status), args ? args : "<null>", ei->state);
}
- if (err) {
+ if (err || err.isCanceled()) {
ei->state = oldState;
goto error;
}
@@ -153,7 +154,7 @@ public:
}
error:
- if (err) {
+ if (err || err.isCanceled()) {
ei->error = err;
ei->state = EditInteractor::ErrorState;
}
@@ -256,6 +257,20 @@ void EditInteractor::setDebugChannel(std::FILE *debug)
d->debug = debug;
}
+GpgME::Error EditInteractor::parseStatusError(const char *args)
+{
+ Error err;
+
+ const auto fields = split(args, ' ');
+ if (fields.size() >= 2) {
+ err = Error{static_cast<unsigned int>(std::stoul(fields[1]))};
+ } else {
+ err = Error::fromCode(GPG_ERR_GENERAL);
+ }
+
+ return err;
+}
+
static const char *const status_strings[] = {
"EOF",
/* mkstatus processing starts here */
diff --git a/lang/cpp/src/editinteractor.h b/lang/cpp/src/editinteractor.h
index 247bf8c..2505b02 100644
--- a/lang/cpp/src/editinteractor.h
+++ b/lang/cpp/src/editinteractor.h
@@ -60,6 +60,9 @@ public:
void setDebugChannel(std::FILE *file);
+protected:
+ Error parseStatusError(const char *args);
+
private:
class Private;
Private *const d;
diff --git a/lang/cpp/src/global.h b/lang/cpp/src/global.h
index a25b46c..1336142 100644
--- a/lang/cpp/src/global.h
+++ b/lang/cpp/src/global.h
@@ -60,18 +60,29 @@ enum Engine { GpgEngine, GpgSMEngine, GpgConfEngine, UnknownEngine, AssuanEngine
enum KeyListMode {
Local = 0x1,
Extern = 0x2,
- Locate = 0x3,
+ Locate = Local|Extern,
Signatures = 0x4,
SignatureNotations = 0x8,
Validate = 0x10,
Ephemeral = 0x20,
WithTofu = 0x40,
WithKeygrip = 0x80,
- WithSecret = 0x100
+ WithSecret = 0x100,
+ ForceExtern = 0x200,
+ LocateExternal = Locate|ForceExtern,
+
+ KeyListModeMask = 0x3ff
};
enum SignatureMode { NormalSignatureMode, Detached, Clearsigned };
+enum class RevocationReason {
+ Unspecified = 0,
+ Compromised = 1,
+ Superseded = 2,
+ NoLongerUsed = 3
+};
+
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Protocol proto);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Engine eng);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, KeyListMode mode);
diff --git a/lang/cpp/src/gpgrevokekeyeditinteractor.cpp b/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
new file mode 100644
index 0000000..86b3c3c
--- /dev/null
+++ b/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
@@ -0,0 +1,216 @@
+/*
+ gpgrevokekeyeditinteractor.cpp - Edit Interactor to revoke own OpenPGP keys
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "gpgrevokekeyeditinteractor.h"
+
+#include "error.h"
+
+#include <gpgme.h>
+
+#include <sstream>
+#include <vector>
+
+// avoid conflict (msvc)
+#ifdef ERROR
+# undef ERROR
+#endif
+
+using namespace GpgME;
+
+class GpgRevokeKeyEditInteractor::Private
+{
+ enum {
+ START = EditInteractor::StartState,
+ COMMAND,
+ CONFIRM_REVOKING_ENTIRE_KEY,
+ REASON_CODE,
+ REASON_TEXT,
+ // all these free slots belong to REASON_TEXT, too; we increase state()
+ // by one for each line of text, so that action() is called
+ REASON_TEXT_DONE = REASON_TEXT + 1000,
+ CONFIRM_REASON,
+ QUIT,
+ CONFIRM_SAVE,
+
+ ERROR = EditInteractor::ErrorState
+ };
+
+ GpgRevokeKeyEditInteractor *const q = nullptr;
+
+public:
+ Private(GpgRevokeKeyEditInteractor *q)
+ : q{q}
+ , reasonCode{"0"}
+ {
+ }
+
+ const char *action(Error &err) const;
+ unsigned int nextState(unsigned int statusCode, const char *args, Error &err);
+
+ std::string reasonCode;
+ std::vector<std::string> reasonLines;
+ int nextLine = -1;
+};
+
+const char *GpgRevokeKeyEditInteractor::Private::action(Error &err) const
+{
+ switch (const auto state = q->state()) {
+ case COMMAND:
+ return "revkey";
+ case CONFIRM_REVOKING_ENTIRE_KEY:
+ return "Y";
+ case REASON_CODE:
+ return reasonCode.c_str();
+ case REASON_TEXT_DONE:
+ return "";
+ case CONFIRM_REASON:
+ return "Y";
+ case QUIT:
+ return "quit";
+ case CONFIRM_SAVE:
+ return "Y";
+ case START:
+ return nullptr;
+ default:
+ if (state >= REASON_TEXT && state < REASON_TEXT_DONE) {
+ return reasonLines[nextLine].c_str();
+ }
+ // fall through
+ case ERROR:
+ err = Error::fromCode(GPG_ERR_GENERAL);
+ return nullptr;
+ }
+}
+
+unsigned int GpgRevokeKeyEditInteractor::Private::nextState(unsigned int status, const char *args, Error &err)
+{
+ using std::strcmp;
+
+ static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
+
+ if (q->needsNoResponse(status)) {
+ return q->state();
+ }
+
+ if (status == GPGME_STATUS_ERROR) {
+ err = q->parseStatusError(args);
+ return ERROR;
+ }
+ switch (const auto state = q->state()) {
+ case START:
+ if (status == GPGME_STATUS_GET_LINE &&
+ strcmp(args, "keyedit.prompt") == 0) {
+ return COMMAND;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case COMMAND:
+ if (status == GPGME_STATUS_GET_BOOL &&
+ strcmp(args, "keyedit.revoke.subkey.okay") == 0) {
+ return CONFIRM_REVOKING_ENTIRE_KEY;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case CONFIRM_REVOKING_ENTIRE_KEY:
+ if (status == GPGME_STATUS_GET_LINE &&
+ strcmp(args, "ask_revocation_reason.code") == 0) {
+ return REASON_CODE;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case REASON_CODE:
+ if (status == GPGME_STATUS_GET_LINE &&
+ strcmp(args, "ask_revocation_reason.text") == 0) {
+ nextLine++;
+ return nextLine < reasonLines.size() ? REASON_TEXT : REASON_TEXT_DONE;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ default:
+ if (state >= REASON_TEXT && state < REASON_TEXT_DONE) {
+ if (status == GPGME_STATUS_GET_LINE &&
+ strcmp(args, "ask_revocation_reason.text") == 0) {
+ nextLine++;
+ return nextLine < reasonLines.size() ? state + 1 : REASON_TEXT_DONE;
+ }
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case REASON_TEXT_DONE:
+ if (status == GPGME_STATUS_GET_BOOL &&
+ strcmp(args, "ask_revocation_reason.okay") == 0) {
+ return CONFIRM_REASON;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case CONFIRM_REASON:
+ if (status == GPGME_STATUS_GET_LINE &&
+ strcmp(args, "keyedit.prompt") == 0) {
+ return QUIT;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case QUIT:
+ if (status == GPGME_STATUS_GET_BOOL &&
+ strcmp(args, "keyedit.save.okay") == 0) {
+ return CONFIRM_SAVE;
+ }
+ err = GENERAL_ERROR;
+ return ERROR;
+ case ERROR:
+ if (status == GPGME_STATUS_GET_LINE &&
+ strcmp(args, "keyedit.prompt") == 0) {
+ return QUIT;
+ }
+ err = q->lastError();
+ return ERROR;
+ }
+}
+
+GpgRevokeKeyEditInteractor::GpgRevokeKeyEditInteractor()
+ : EditInteractor{}
+ , d{new Private{this}}
+{
+}
+
+GpgRevokeKeyEditInteractor::~GpgRevokeKeyEditInteractor() = default;
+
+void GpgRevokeKeyEditInteractor::setReason(RevocationReason reason, const std::vector<std::string> &description)
+{
+ d->reasonCode = std::to_string(static_cast<int>(reason));
+ d->reasonLines = description;
+}
+
+const char *GpgRevokeKeyEditInteractor::action(Error &err) const
+{
+ return d->action(err);
+}
+
+unsigned int GpgRevokeKeyEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
+{
+ return d->nextState(status, args, err);
+}
diff --git a/lang/cpp/src/gpgrevokekeyeditinteractor.h b/lang/cpp/src/gpgrevokekeyeditinteractor.h
new file mode 100644
index 0000000..c33a71b
--- /dev/null
+++ b/lang/cpp/src/gpgrevokekeyeditinteractor.h
@@ -0,0 +1,62 @@
+/*
+ gpgrevokekeyeditinteractor.h - Edit Interactor to revoke own OpenPGP keys
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_GPGREVOKEKEYEDITINTERACTOR_H__
+#define __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__
+
+#include "editinteractor.h"
+#include "global.h"
+
+#include <memory>
+#include <vector>
+
+namespace GpgME
+{
+
+/** Edit interactor to revoke the key a key edit operation is working on.
+ * Supports revocation of own keys only. */
+class GPGMEPP_EXPORT GpgRevokeKeyEditInteractor : public EditInteractor
+{
+public:
+ GpgRevokeKeyEditInteractor();
+ ~GpgRevokeKeyEditInteractor() override;
+
+ /** Sets the reason for the revocation. The reason defaults to \c Unspecified.
+ * \a description can be used for adding a comment for the revocation. The
+ * individual elements of \a description must be non-empty strings and they
+ * must not contain any endline characters.
+ */
+ void setReason(RevocationReason reason, const std::vector<std::string> &description = {});
+
+private:
+ const char *action(Error &err) const override;
+ unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
+
+private:
+ class GPGMEPP_NO_EXPORT Private;
+ const std::unique_ptr<Private> d;
+};
+
+} // namespace GpgME
+
+#endif // __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__
diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
index 803c34d..0625872 100644
--- a/lang/cpp/src/importresult.cpp
+++ b/lang/cpp/src/importresult.cpp
@@ -94,6 +94,131 @@ void GpgME::ImportResult::init(gpgme_ctx_t ctx)
make_standard_stuff(ImportResult)
+void GpgME::ImportResult::mergeWith(const ImportResult &other)
+{
+ if (other.isNull()) {
+ return;
+ }
+ if (isNull()) { // just assign
+ operator=(other);
+ return;
+ }
+
+ // Add the numbers of considered keys; the number will be corrected when
+ // merging the imports to account for duplicates
+ d->res.considered += other.d->res.considered;
+ // Add the numbers of keys without user ID; may count duplicates
+ d->res.no_user_id += other.d->res.no_user_id;
+ // Add the numbers of imported keys
+ d->res.imported += other.d->res.imported;
+ // Add the numbers of imported RSA keys
+ d->res.imported_rsa += other.d->res.imported_rsa;
+ // Add the numbers of unchanged keys; the number will be corrected when
+ // merging the imports to account for keys changed by this import
+ d->res.unchanged += other.d->res.unchanged;
+ // Add the numbers of new user IDs
+ d->res.new_user_ids += other.d->res.new_user_ids;
+ // Add the numbers of new subkeys
+ d->res.new_sub_keys += other.d->res.new_sub_keys;
+ // Add the numbers of new signatures
+ d->res.new_signatures += other.d->res.new_signatures;
+ // Add the numbers of new revocations
+ d->res.new_revocations += other.d->res.new_revocations;
+
+ // Add the numbers of considered secret keys; the number will be corrected when
+ // merging the imports to account for duplicates
+ d->res.secret_read += other.d->res.secret_read;
+ // Add the numbers of imported secret keys
+ d->res.secret_imported += other.d->res.secret_imported;
+ // Add the numbers of unchanged secret keys; the number will be corrected when
+ // merging the imports to account for keys changed by this import
+ d->res.secret_unchanged += other.d->res.secret_unchanged;
+
+ // Add the numbers of new keys that were skipped; may count duplicates
+ d->res.skipped_new_keys += other.d->res.skipped_new_keys;
+ // Add the numbers of keys that were not imported; may count duplicates
+ d->res.not_imported += other.d->res.not_imported;
+ // Add the numbers of v3 keys that were skipped; may count duplicates
+ d->res.skipped_v3_keys += other.d->res.skipped_v3_keys;
+
+ // Look at the list of keys for which an import was attempted during the
+ // other import to correct some of the consolidated numbers
+ for (auto it = std::begin(other.d->imports), end = std::end(other.d->imports); it != end; ++it) {
+ const char *fpr = (*it)->fpr;
+ if (!fpr || !*fpr) {
+ // we cannot derive any useful information about an import if the
+ // fingerprint is null or empty
+ continue;
+ }
+ // was this key also considered during the first import
+ const auto consideredInFirstImports =
+ std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
+ return i->fpr && !strcmp(i->fpr, fpr);
+ });
+ // did we see this key already in the list of keys of the other import
+ const auto consideredInPreviousOtherImports =
+ std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
+ return i->fpr && !strcmp(i->fpr, fpr);
+ });
+ // was anything added to this key during the other import
+ const auto changedInOtherImports =
+ std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const auto i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status != 0);
+ });
+ if (consideredInFirstImports && !consideredInPreviousOtherImports) {
+ // key was also considered during first import, but not before in the list of other imports
+ d->res.considered -= 1;
+ if (!changedInOtherImports) {
+ // key was (most likely) counted as unchanged in the second import;
+ // this needs to be corrected (regardless of whether it was changed in the first import)
+ d->res.unchanged -= 1;
+ }
+ }
+
+ // now do the same for the secret key counts
+ const auto secretKeyConsideredInFirstImports =
+ std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
+ });
+ const auto secretKeyConsideredInPreviousOtherImports =
+ std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
+ });
+ const auto secretKeyChangedInOtherImports =
+ std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const auto i) {
+ return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET) && (i->status != GPGME_IMPORT_SECRET);
+ });
+ if (secretKeyConsideredInFirstImports && !secretKeyConsideredInPreviousOtherImports) {
+ // key was also considered during first import, but not before in the list of other imports
+ d->res.secret_read -= 1;
+ if (!secretKeyChangedInOtherImports) {
+ // key was (most likely) counted as unchanged in the second import;
+ // this needs to be corrected (regardless of whether it was changed in the first import)
+ d->res.secret_unchanged -= 1;
+ }
+ }
+ }
+
+ // Now append the list of keys for which an import was attempted during the
+ // other import
+ d->imports.reserve(d->imports.size() + other.d->imports.size());
+ std::transform(std::begin(other.d->imports), std::end(other.d->imports),
+ std::back_inserter(d->imports),
+ [](const auto import) {
+ gpgme_import_status_t copy = new _gpgme_import_status{*import};
+ if (import->fpr) {
+ copy->fpr = strdup(import->fpr);
+ }
+ copy->next = nullptr; // should already be null, but better safe than sorry
+ return copy;
+ });
+
+ // Finally, merge the error if there was none yet
+ if (!bool(error())) {
+ Result::operator=(other);
+ }
+}
+
int GpgME::ImportResult::numConsidered() const
{
return d ? d->res.considered : 0 ;
diff --git a/lang/cpp/src/importresult.h b/lang/cpp/src/importresult.h
index bcd956c..5936698 100644
--- a/lang/cpp/src/importresult.h
+++ b/lang/cpp/src/importresult.h
@@ -60,6 +60,16 @@ public:
swap(this->d, other.d);
}
+ /**
+ * Merges the result @p other into this result (and all of its copies).
+ *
+ * @note The merge algorithm assumes that @p other is the result of an
+ * import that was performed after the import of this result.
+ * @note Some numbers cannot be consolidated reliably, e.g. the number of
+ * keys without user ID.
+ */
+ void mergeWith(const ImportResult &other);
+
bool isNull() const;
int numConsidered() const;
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index b893a7c..293c9e5 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -1250,16 +1250,22 @@ std::ostream &operator<<(std::ostream &os, const Subkey &subkey)
os << "GpgME::Subkey(";
if (!subkey.isNull()) {
os << "\n fingerprint: " << protect(subkey.fingerprint())
+ << "\n keyGrip: " << protect(subkey.keyGrip())
<< "\n creationTime: " << subkey.creationTime()
<< "\n expirationTime:" << subkey.expirationTime()
<< "\n isRevoked: " << subkey.isRevoked()
<< "\n isExpired: " << subkey.isExpired()
- << "\n isInvalid: " << subkey.isRevoked()
- << "\n isDisabled: " << subkey.isInvalid()
+ << "\n isInvalid: " << subkey.isInvalid()
+ << "\n isDisabled: " << subkey.isDisabled()
<< "\n canSign: " << subkey.canSign()
<< "\n canEncrypt: " << subkey.canEncrypt()
<< "\n canCertify: " << subkey.canCertify()
- << "\n canAuth: " << subkey.canAuthenticate();
+ << "\n canAuth: " << subkey.canAuthenticate()
+ << "\n isSecret: " << subkey.isSecret()
+ << "\n isQualified: " << subkey.isQualified()
+ << "\n isDeVs: " << subkey.isDeVs()
+ << "\n isCardKey: " << subkey.isCardKey()
+ << "\n cardSerialNumber:" << protect(subkey.cardSerialNumber());
}
return os << ')';
}
diff --git a/lang/cpp/src/result.h b/lang/cpp/src/result.h
index 5ed52a8..a587afb 100644
--- a/lang/cpp/src/result.h
+++ b/lang/cpp/src/result.h
@@ -50,6 +50,14 @@ public:
{
return mError;
}
+ /**
+ * Replaces the error set during construction with \p error.
+ * Use with care, e.g. to set a more suitable error.
+ */
+ void setError(const Error &error)
+ {
+ mError = error;
+ }
protected:
Error mError;
diff --git a/lang/cpp/src/util.h b/lang/cpp/src/util.h
index b6f9ca5..cb6df0d 100644
--- a/lang/cpp/src/util.h
+++ b/lang/cpp/src/util.h
@@ -89,19 +89,15 @@ static inline gpgme_keylist_mode_t add_to_gpgme_keylist_mode_t(unsigned int oldm
if (newmodes & GpgME::WithSecret) {
oldmode |= GPGME_KEYLIST_MODE_WITH_SECRET;
}
+ if (newmodes & GpgME::ForceExtern) {
+ oldmode |= GPGME_KEYLIST_MODE_FORCE_EXTERN;
+ }
#ifndef NDEBUG
- if (newmodes & ~(GpgME::Local |
- GpgME::Extern |
- GpgME::Signatures |
- GpgME::SignatureNotations |
- GpgME::Validate |
- GpgME::Ephemeral |
- GpgME::WithTofu |
- GpgME::WithKeygrip |
- GpgME::WithSecret)) {
+ if (newmodes & ~(GpgME::KeyListModeMask)) {
//std::cerr << "GpgME::Context: keylist mode must be one of Local, "
//"Extern, Signatures, SignatureNotations, Validate, Ephemeral, WithTofu, "
- //"WithKeygrip, WithSecret, or a combination thereof!" << std::endl;
+ //"WithKeygrip, WithSecret, ForceExtern, or a combination thereof!"
+ //<< std::endl;
}
#endif
return static_cast<gpgme_keylist_mode_t>(oldmode);
@@ -137,6 +133,9 @@ static inline unsigned int convert_from_gpgme_keylist_mode_t(unsigned int mode)
if (mode & GPGME_KEYLIST_MODE_VALIDATE) {
result |= GpgME::Validate;
}
+ if (mode & GPGME_KEYLIST_MODE_FORCE_EXTERN) {
+ result |= GpgME::ForceExtern;
+ }
#ifndef NDEBUG
if (mode & ~(GPGME_KEYLIST_MODE_LOCAL |
GPGME_KEYLIST_MODE_EXTERN |
@@ -146,7 +145,8 @@ static inline unsigned int convert_from_gpgme_keylist_mode_t(unsigned int mode)
GPGME_KEYLIST_MODE_WITH_TOFU |
GPGME_KEYLIST_MODE_WITH_KEYGRIP |
GPGME_KEYLIST_MODE_EPHEMERAL |
- GPGME_KEYLIST_MODE_VALIDATE)) {
+ GPGME_KEYLIST_MODE_VALIDATE |
+ GPGME_KEYLIST_MODE_FORCE_EXTERN)) {
//std::cerr << "GpgME: WARNING: gpgme_get_keylist_mode() returned an unknown flag!" << std::endl;
}
#endif // NDEBUG
@@ -177,6 +177,19 @@ static inline gpgme_sig_notation_flags_t add_to_gpgme_sig_notation_flags_t(unsi
return static_cast<gpgme_sig_notation_flags_t>(result);
}
+static inline std::vector<std::string> split(const std::string &text, char delimiter)
+{
+ std::vector<std::string> result;
+ if (!text.empty()) {
+ std::istringstream stream{text};
+ std::string line;
+ while (std::getline(stream, line, delimiter)) {
+ result.push_back(line);
+ }
+ }
+ return result;
+}
+
/**
* Adapter for passing a vector of strings as NULL-terminated array of
* const char* to the C-interface of gpgme.
diff --git a/lang/cpp/tests/Makefile.in b/lang/cpp/tests/Makefile.in
index 280ffec..46dd9f0 100644
--- a/lang/cpp/tests/Makefile.in
+++ b/lang/cpp/tests/Makefile.in
@@ -111,6 +111,7 @@ noinst_PROGRAMS = run-getkey$(EXEEXT) run-keylist$(EXEEXT) \
subdir = lang/cpp/tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -274,6 +275,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/cpp/tests/run-getkey.cpp b/lang/cpp/tests/run-getkey.cpp
index 35b15eb..c47da0b 100644
--- a/lang/cpp/tests/run-getkey.cpp
+++ b/lang/cpp/tests/run-getkey.cpp
@@ -60,6 +60,8 @@ show_usage (int ex)
" --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n"
" --validate use GPGME_KEYLIST_MODE_VALIDATE\n"
" --locate use GPGME_KEYLIST_MODE_LOCATE\n"
+ " --force-extern use GPGME_KEYLIST_MODE_FORCE_EXTERN\n"
+ " --locate-external use GPGME_KEYLIST_MODE_LOCATE_EXTERNAL\n"
, stderr);
exit (ex);
}
@@ -116,6 +118,12 @@ main (int argc, char **argv)
} else if (!strcmp (*argv, "--locate")) {
argc--; argv++;
mode |= KeyListMode::Locate;
+ } else if (!strcmp (*argv, "--force-extern")) {
+ argc--; argv++;
+ mode |= KeyListMode::ForceExtern;
+ } else if (!strcmp (*argv, "--locate-external")) {
+ argc--; argv++;
+ mode |= KeyListMode::LocateExternal;
} else if (!strncmp (*argv, "--", 2)) {
show_usage (1);
}
@@ -132,6 +140,12 @@ main (int argc, char **argv)
return -1;
}
ctx->setKeyListMode (mode);
+ if (ctx->keyListMode() != mode) {
+ // unfortunately, Context::setKeyListMode() does not return the error
+ // returned by gpgme
+ std::cerr << "Failed to set keylist mode. You may have used an invalid combination of options.";
+ return -1;
+ }
Error err;
const GpgME::Key key = ctx->key (*argv, err, only_secret);
std::stringstream ss;
diff --git a/lang/cpp/tests/run-keylist.cpp b/lang/cpp/tests/run-keylist.cpp
index 5457739..9e7d763 100644
--- a/lang/cpp/tests/run-keylist.cpp
+++ b/lang/cpp/tests/run-keylist.cpp
@@ -61,6 +61,8 @@ show_usage (int ex)
" --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n"
" --validate use GPGME_KEYLIST_MODE_VALIDATE\n"
" --locate use GPGME_KEYLIST_MODE_LOCATE\n"
+ " --force-extern use GPGME_KEYLIST_MODE_FORCE_EXTERN\n"
+ " --locate-external use GPGME_KEYLIST_MODE_LOCATE_EXTERNAL\n"
, stderr);
exit (ex);
}
@@ -117,7 +119,17 @@ main (int argc, char **argv)
} else if (!strcmp (*argv, "--locate")) {
argc--; argv++;
mode |= KeyListMode::Locate;
+ } else if (!strcmp (*argv, "--with-secret")) {
+ argc--; argv++;
+ mode |= KeyListMode::WithSecret;
+ } else if (!strcmp (*argv, "--force-extern")) {
+ argc--; argv++;
+ mode |= KeyListMode::ForceExtern;
+ } else if (!strcmp (*argv, "--locate-external")) {
+ argc--; argv++;
+ mode |= KeyListMode::LocateExternal;
} else if (!strncmp (*argv, "--", 2)) {
+ std::cerr << "Error: Unknown option: " << *argv << std::endl;
show_usage (1);
}
}
@@ -133,6 +145,12 @@ main (int argc, char **argv)
return -1;
}
ctx->setKeyListMode (mode);
+ if (ctx->keyListMode() != mode) {
+ // unfortunately, Context::setKeyListMode() does not return the error
+ // returned by gpgme
+ std::cerr << "Failed to set keylist mode. You may have used an invalid combination of options.\n";
+ return -1;
+ }
Error err = ctx->startKeyListing (*argv, only_secret);
if (err) {
std::cout << "Error: " << err.asString() << "\n";
diff --git a/lang/js/BrowserTestExtension/Makefile.in b/lang/js/BrowserTestExtension/Makefile.in
index 68fa1ac..5f6fae4 100644
--- a/lang/js/BrowserTestExtension/Makefile.in
+++ b/lang/js/BrowserTestExtension/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = lang/js/BrowserTestExtension
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -199,6 +200,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/js/DemoExtension/Makefile.in b/lang/js/DemoExtension/Makefile.in
index ce14e1f..70d5b1c 100644
--- a/lang/js/DemoExtension/Makefile.in
+++ b/lang/js/DemoExtension/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = lang/js/DemoExtension
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -199,6 +200,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/js/Makefile.in b/lang/js/Makefile.in
index 8810732..a0904d9 100644
--- a/lang/js/Makefile.in
+++ b/lang/js/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang/js
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -258,6 +259,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/js/src/Makefile.in b/lang/js/src/Makefile.in
index 05f1d7a..b11046d 100644
--- a/lang/js/src/Makefile.in
+++ b/lang/js/src/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = lang/js/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -199,6 +200,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/python/Makefile.in b/lang/python/Makefile.in
index c0fc091..b3e6b56 100644
--- a/lang/python/Makefile.in
+++ b/lang/python/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang/python
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -259,6 +260,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/python/doc/Makefile.in b/lang/python/doc/Makefile.in
index a53283b..2d9e826 100644
--- a/lang/python/doc/Makefile.in
+++ b/lang/python/doc/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang/python/doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -198,6 +199,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/python/examples/Makefile.in b/lang/python/examples/Makefile.in
index 06ea925..87c0c20 100644
--- a/lang/python/examples/Makefile.in
+++ b/lang/python/examples/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang/python/examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -198,6 +199,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/python/src/Makefile.in b/lang/python/src/Makefile.in
index f250242..c711628 100644
--- a/lang/python/src/Makefile.in
+++ b/lang/python/src/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang/python/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -198,6 +199,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/python/src/core.py b/lang/python/src/core.py
index 9618adc..c7b312b 100644
--- a/lang/python/src/core.py
+++ b/lang/python/src/core.py
@@ -106,9 +106,13 @@ class GpgmeWrapper(object):
set_func = getattr(gpgme, "{}set_{}".format(self._cprefix, key))
def get(slf):
+ if not slf.wrapped:
+ return False
return bool(get_func(slf.wrapped))
def set_(slf, value):
+ if not slf.wrapped:
+ return
set_func(slf.wrapped, bool(value))
p = property(get, set_, doc="{} flag".format(key))
@@ -135,6 +139,8 @@ class GpgmeWrapper(object):
if self._errorcheck(name):
def _funcwrap(slf, *args):
+ if not slf.wrapped:
+ return None
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
gpgme.gpg_raise_callback_exception(slf)
@@ -142,6 +148,8 @@ class GpgmeWrapper(object):
else:
def _funcwrap(slf, *args):
+ if not slf.wrapped:
+ return None
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
gpgme.gpg_raise_callback_exception(slf)
@@ -332,8 +340,7 @@ class Context(GpgmeWrapper):
finally:
if passphrase is not None:
self.pinentry_mode = old_pinentry_mode
- if old_passphrase_cb:
- self.set_passphrase_cb(*old_passphrase_cb[1:])
+ gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb)
result = self.op_encrypt_result()
assert not result.invalid_recipients
@@ -426,8 +433,7 @@ class Context(GpgmeWrapper):
finally:
if passphrase is not None:
self.pinentry_mode = old_pinentry_mode
- if old_passphrase_cb:
- self.set_passphrase_cb(*old_passphrase_cb[1:])
+ gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb)
result = self.op_decrypt_result()
@@ -851,8 +857,7 @@ class Context(GpgmeWrapper):
finally:
if util.is_a_string(passphrase):
self.pinentry_mode = old_pinentry_mode
- if old_passphrase_cb:
- self.set_passphrase_cb(*old_passphrase_cb[1:])
+ gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb)
return self.op_genkey_result()
@@ -934,8 +939,7 @@ class Context(GpgmeWrapper):
finally:
if util.is_a_string(passphrase):
self.pinentry_mode = old_pinentry_mode
- if old_passphrase_cb:
- self.set_passphrase_cb(*old_passphrase_cb[1:])
+ gpgme.gpg_set_passphrase_cb(self, old_passphrase_cb)
return self.op_genkey_result()
@@ -1102,6 +1106,8 @@ class Context(GpgmeWrapper):
@property
def signers(self):
"""Keys used for signing"""
+ if not self.wrapped:
+ return None
return [self.signers_enum(i) for i in range(self.signers_count())]
@signers.setter
@@ -1137,6 +1143,8 @@ class Context(GpgmeWrapper):
@property
def home_dir(self):
"""Engine's home directory"""
+ if not self.wrapped:
+ return None
return self.engine_info.home_dir
@home_dir.setter
@@ -1182,7 +1190,7 @@ class Context(GpgmeWrapper):
return self
def __exit__(self, type, value, tb):
- self.__del__()
+ return False
def op_keylist_all(self, *args, **kwargs):
self.op_keylist_start(*args, **kwargs)
@@ -1520,7 +1528,7 @@ class Data(GpgmeWrapper):
return self
def __exit__(self, type, value, tb):
- self.__del__()
+ return False
def _free_datacbs(self):
self._data_cbs = None
diff --git a/lang/python/tests/Makefile.in b/lang/python/tests/Makefile.in
index 9e60086..cbc6980 100644
--- a/lang/python/tests/Makefile.in
+++ b/lang/python/tests/Makefile.in
@@ -108,6 +108,7 @@ host_triplet = @host@
subdir = lang/python/tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -197,6 +198,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/python/tests/t-idiomatic.py b/lang/python/tests/t-idiomatic.py
index bc05e6c..faa4190 100755
--- a/lang/python/tests/t-idiomatic.py
+++ b/lang/python/tests/t-idiomatic.py
@@ -35,6 +35,9 @@ with gpg.Context() as c, gpg.Data() as d:
d.write(b"Halloechen")
leak_c = c
leak_d = d
+
+leak_c.__del__()
+leak_d.__del__()
assert leak_c.wrapped is None
assert leak_d.wrapped is None
diff --git a/lang/qt/Makefile.in b/lang/qt/Makefile.in
index d186d88..b8d894b 100644
--- a/lang/qt/Makefile.in
+++ b/lang/qt/Makefile.in
@@ -110,6 +110,7 @@ host_triplet = @host@
subdir = lang/qt
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -259,6 +260,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/qt/doc/Makefile.in b/lang/qt/doc/Makefile.in
index eadc021..56ffde0 100644
--- a/lang/qt/doc/Makefile.in
+++ b/lang/qt/doc/Makefile.in
@@ -109,6 +109,7 @@ host_triplet = @host@
subdir = lang/qt/doc
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -198,6 +199,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index d47da89..3923e5b 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -21,7 +21,7 @@
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \
- QGpgmeConfig.cmake.in.in
+ QGpgmeConfig-w32.cmake.in.in
qgpgme_sources = \
dataprovider.cpp \
@@ -35,14 +35,17 @@ qgpgme_sources = \
qgpgmeimportjob.cpp qgpgmekeygenerationjob.cpp qgpgmekeylistjob.cpp \
qgpgmelistallkeysjob.cpp qgpgmenewcryptoconfig.cpp \
qgpgmereceivekeysjob.cpp \
- qgpgmerefreshkeysjob.cpp \
+ qgpgmerefreshsmimekeysjob.cpp \
+ qgpgmerevokekeyjob.cpp \
+ qgpgmesetprimaryuseridjob.cpp \
qgpgmesignencryptjob.cpp \
qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
qgpgmeverifyopaquejob.cpp qgpgmewkdlookupjob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
- qgpgmegpgcardjob.cpp changeexpiryjob.cpp importjob.cpp \
+ qgpgmegpgcardjob.cpp changeexpiryjob.cpp encryptjob.cpp importjob.cpp \
+ signencryptjob.cpp \
dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
util.cpp
@@ -70,6 +73,8 @@ qgpgme_headers= \
qgpgmenewcryptoconfig.h \
quickjob.h \
receivekeysjob.h \
+ revokekeyjob.h \
+ setprimaryuseridjob.h \
specialjob.h \
signjob.h \
signkeyjob.h \
@@ -114,6 +119,8 @@ camelcase_headers= \
QGpgMENewCryptoConfig \
QuickJob \
ReceiveKeysJob \
+ RevokeKeyJob \
+ SetPrimaryUserIDJob \
SpecialJob \
SignJob \
SignKeyJob \
@@ -158,7 +165,9 @@ private_qgpgme_headers = \
qgpgmekeylistjob.h \
qgpgmelistallkeysjob.h \
qgpgmereceivekeysjob.h \
- qgpgmerefreshkeysjob.h \
+ qgpgmerefreshsmimekeysjob.h \
+ qgpgmerevokekeyjob.h \
+ qgpgmesetprimaryuseridjob.h \
qgpgmesignencryptjob.h \
qgpgmesignjob.h \
qgpgmesignkeyjob.h \
@@ -211,7 +220,9 @@ qgpgme_moc_sources = \
qgpgmekeylistjob.moc \
qgpgmelistallkeysjob.moc \
qgpgmereceivekeysjob.moc \
- qgpgmerefreshkeysjob.moc \
+ qgpgmerefreshsmimekeysjob.moc \
+ qgpgmerevokekeyjob.moc \
+ qgpgmesetprimaryuseridjob.moc \
qgpgmesignencryptjob.moc \
qgpgmesignjob.moc \
qgpgmesignkeyjob.moc \
@@ -223,6 +234,8 @@ qgpgme_moc_sources = \
qgpgmetofupolicyjob.moc \
receivekeysjob.moc \
refreshkeysjob.moc \
+ revokekeyjob.moc \
+ setprimaryuseridjob.moc \
signencryptjob.moc \
signjob.moc \
signkeyjob.moc \
diff --git a/lang/qt/src/Makefile.in b/lang/qt/src/Makefile.in
index 2f09648..52ab451 100644
--- a/lang/qt/src/Makefile.in
+++ b/lang/qt/src/Makefile.in
@@ -92,6 +92,7 @@ host_triplet = @host@
subdir = lang/qt/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -155,15 +156,17 @@ am__objects_1 = dataprovider.lo debug.lo job.lo multideletejob.lo \
qgpgmeimportjob.lo qgpgmekeygenerationjob.lo \
qgpgmekeylistjob.lo qgpgmelistallkeysjob.lo \
qgpgmenewcryptoconfig.lo qgpgmereceivekeysjob.lo \
- qgpgmerefreshkeysjob.lo qgpgmesignencryptjob.lo \
+ qgpgmerefreshsmimekeysjob.lo qgpgmerevokekeyjob.lo \
+ qgpgmesetprimaryuseridjob.lo qgpgmesignencryptjob.lo \
qgpgmesignjob.lo qgpgmesignkeyjob.lo \
qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \
qgpgmewkdlookupjob.lo threadedjobmixin.lo \
qgpgmekeyformailboxjob.lo qgpgme_debug.lo \
qgpgmetofupolicyjob.lo qgpgmequickjob.lo \
defaultkeygenerationjob.lo qgpgmewkspublishjob.lo \
- qgpgmegpgcardjob.lo changeexpiryjob.lo importjob.lo dn.lo \
- cryptoconfig.lo wkdlookupresult.lo util.lo
+ qgpgmegpgcardjob.lo changeexpiryjob.lo encryptjob.lo \
+ importjob.lo signencryptjob.lo dn.lo cryptoconfig.lo \
+ wkdlookupresult.lo util.lo
am__objects_2 =
am_libqgpgme_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_2)
@@ -195,9 +198,9 @@ am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/changeexpiryjob.Plo \
./$(DEPDIR)/cryptoconfig.Plo ./$(DEPDIR)/dataprovider.Plo \
./$(DEPDIR)/debug.Plo ./$(DEPDIR)/defaultkeygenerationjob.Plo \
- ./$(DEPDIR)/dn.Plo ./$(DEPDIR)/importjob.Plo \
- ./$(DEPDIR)/job.Plo ./$(DEPDIR)/multideletejob.Plo \
- ./$(DEPDIR)/qgpgme_debug.Plo \
+ ./$(DEPDIR)/dn.Plo ./$(DEPDIR)/encryptjob.Plo \
+ ./$(DEPDIR)/importjob.Plo ./$(DEPDIR)/job.Plo \
+ ./$(DEPDIR)/multideletejob.Plo ./$(DEPDIR)/qgpgme_debug.Plo \
./$(DEPDIR)/qgpgmeaddexistingsubkeyjob.Plo \
./$(DEPDIR)/qgpgmeadduseridjob.Plo \
./$(DEPDIR)/qgpgmebackend.Plo \
@@ -220,7 +223,9 @@ am__depfiles_remade = ./$(DEPDIR)/changeexpiryjob.Plo \
./$(DEPDIR)/qgpgmenewcryptoconfig.Plo \
./$(DEPDIR)/qgpgmequickjob.Plo \
./$(DEPDIR)/qgpgmereceivekeysjob.Plo \
- ./$(DEPDIR)/qgpgmerefreshkeysjob.Plo \
+ ./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo \
+ ./$(DEPDIR)/qgpgmerevokekeyjob.Plo \
+ ./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo \
./$(DEPDIR)/qgpgmesignencryptjob.Plo \
./$(DEPDIR)/qgpgmesignjob.Plo ./$(DEPDIR)/qgpgmesignkeyjob.Plo \
./$(DEPDIR)/qgpgmetofupolicyjob.Plo \
@@ -228,6 +233,7 @@ am__depfiles_remade = ./$(DEPDIR)/changeexpiryjob.Plo \
./$(DEPDIR)/qgpgmeverifyopaquejob.Plo \
./$(DEPDIR)/qgpgmewkdlookupjob.Plo \
./$(DEPDIR)/qgpgmewkspublishjob.Plo \
+ ./$(DEPDIR)/signencryptjob.Plo \
./$(DEPDIR)/threadedjobmixin.Plo ./$(DEPDIR)/util.Plo \
./$(DEPDIR)/wkdlookupresult.Plo
am__mv = mv -f
@@ -351,6 +357,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
@@ -524,7 +531,7 @@ top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \
- QGpgmeConfig.cmake.in.in
+ QGpgmeConfig-w32.cmake.in.in
qgpgme_sources = \
dataprovider.cpp \
@@ -538,14 +545,17 @@ qgpgme_sources = \
qgpgmeimportjob.cpp qgpgmekeygenerationjob.cpp qgpgmekeylistjob.cpp \
qgpgmelistallkeysjob.cpp qgpgmenewcryptoconfig.cpp \
qgpgmereceivekeysjob.cpp \
- qgpgmerefreshkeysjob.cpp \
+ qgpgmerefreshsmimekeysjob.cpp \
+ qgpgmerevokekeyjob.cpp \
+ qgpgmesetprimaryuseridjob.cpp \
qgpgmesignencryptjob.cpp \
qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
qgpgmeverifyopaquejob.cpp qgpgmewkdlookupjob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
- qgpgmegpgcardjob.cpp changeexpiryjob.cpp importjob.cpp \
+ qgpgmegpgcardjob.cpp changeexpiryjob.cpp encryptjob.cpp importjob.cpp \
+ signencryptjob.cpp \
dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
util.cpp
@@ -574,6 +584,8 @@ qgpgme_headers = \
qgpgmenewcryptoconfig.h \
quickjob.h \
receivekeysjob.h \
+ revokekeyjob.h \
+ setprimaryuseridjob.h \
specialjob.h \
signjob.h \
signkeyjob.h \
@@ -618,6 +630,8 @@ camelcase_headers = \
QGpgMENewCryptoConfig \
QuickJob \
ReceiveKeysJob \
+ RevokeKeyJob \
+ SetPrimaryUserIDJob \
SpecialJob \
SignJob \
SignKeyJob \
@@ -662,7 +676,9 @@ private_qgpgme_headers = \
qgpgmekeylistjob.h \
qgpgmelistallkeysjob.h \
qgpgmereceivekeysjob.h \
- qgpgmerefreshkeysjob.h \
+ qgpgmerefreshsmimekeysjob.h \
+ qgpgmerevokekeyjob.h \
+ qgpgmesetprimaryuseridjob.h \
qgpgmesignencryptjob.h \
qgpgmesignjob.h \
qgpgmesignkeyjob.h \
@@ -715,7 +731,9 @@ qgpgme_moc_sources = \
qgpgmekeylistjob.moc \
qgpgmelistallkeysjob.moc \
qgpgmereceivekeysjob.moc \
- qgpgmerefreshkeysjob.moc \
+ qgpgmerefreshsmimekeysjob.moc \
+ qgpgmerevokekeyjob.moc \
+ qgpgmesetprimaryuseridjob.moc \
qgpgmesignencryptjob.moc \
qgpgmesignjob.moc \
qgpgmesignkeyjob.moc \
@@ -727,6 +745,8 @@ qgpgme_moc_sources = \
qgpgmetofupolicyjob.moc \
receivekeysjob.moc \
refreshkeysjob.moc \
+ revokekeyjob.moc \
+ setprimaryuseridjob.moc \
signencryptjob.moc \
signjob.moc \
signkeyjob.moc \
@@ -861,6 +881,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dn.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encryptjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multideletejob.Plo@am__quote@ # am--include-marker
@@ -887,7 +908,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmenewcryptoconfig.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmequickjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmereceivekeysjob.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmerefreshkeysjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmerevokekeyjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesignencryptjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesignjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesignkeyjob.Plo@am__quote@ # am--include-marker
@@ -896,6 +919,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmeverifyopaquejob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmewkdlookupjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmewkspublishjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signencryptjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threadedjobmixin.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkdlookupresult.Plo@am__quote@ # am--include-marker
@@ -1135,6 +1159,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/debug.Plo
-rm -f ./$(DEPDIR)/defaultkeygenerationjob.Plo
-rm -f ./$(DEPDIR)/dn.Plo
+ -rm -f ./$(DEPDIR)/encryptjob.Plo
-rm -f ./$(DEPDIR)/importjob.Plo
-rm -f ./$(DEPDIR)/job.Plo
-rm -f ./$(DEPDIR)/multideletejob.Plo
@@ -1161,7 +1186,9 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/qgpgmenewcryptoconfig.Plo
-rm -f ./$(DEPDIR)/qgpgmequickjob.Plo
-rm -f ./$(DEPDIR)/qgpgmereceivekeysjob.Plo
- -rm -f ./$(DEPDIR)/qgpgmerefreshkeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerevokekeyjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignencryptjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignkeyjob.Plo
@@ -1170,6 +1197,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/qgpgmeverifyopaquejob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkdlookupjob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkspublishjob.Plo
+ -rm -f ./$(DEPDIR)/signencryptjob.Plo
-rm -f ./$(DEPDIR)/threadedjobmixin.Plo
-rm -f ./$(DEPDIR)/util.Plo
-rm -f ./$(DEPDIR)/wkdlookupresult.Plo
@@ -1226,6 +1254,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/debug.Plo
-rm -f ./$(DEPDIR)/defaultkeygenerationjob.Plo
-rm -f ./$(DEPDIR)/dn.Plo
+ -rm -f ./$(DEPDIR)/encryptjob.Plo
-rm -f ./$(DEPDIR)/importjob.Plo
-rm -f ./$(DEPDIR)/job.Plo
-rm -f ./$(DEPDIR)/multideletejob.Plo
@@ -1252,7 +1281,9 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/qgpgmenewcryptoconfig.Plo
-rm -f ./$(DEPDIR)/qgpgmequickjob.Plo
-rm -f ./$(DEPDIR)/qgpgmereceivekeysjob.Plo
- -rm -f ./$(DEPDIR)/qgpgmerefreshkeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerevokekeyjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignencryptjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignkeyjob.Plo
@@ -1261,6 +1292,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/qgpgmeverifyopaquejob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkdlookupjob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkspublishjob.Plo
+ -rm -f ./$(DEPDIR)/signencryptjob.Plo
-rm -f ./$(DEPDIR)/threadedjobmixin.Plo
-rm -f ./$(DEPDIR)/util.Plo
-rm -f ./$(DEPDIR)/wkdlookupresult.Plo
diff --git a/lang/qt/src/RevokeKeyJob b/lang/qt/src/RevokeKeyJob
new file mode 100644
index 0000000..5d0f973
--- /dev/null
+++ b/lang/qt/src/RevokeKeyJob
@@ -0,0 +1 @@
+#include "qgpgme/revokekeyjob.h"
diff --git a/lang/qt/src/SetPrimaryUserIDJob b/lang/qt/src/SetPrimaryUserIDJob
new file mode 100644
index 0000000..f61a24c
--- /dev/null
+++ b/lang/qt/src/SetPrimaryUserIDJob
@@ -0,0 +1 @@
+#include "qgpgme/setprimaryuseridjob.h"
diff --git a/lang/qt/src/decryptjob.h b/lang/qt/src/decryptjob.h
index 7753e18..5195407 100644
--- a/lang/qt/src/decryptjob.h
+++ b/lang/qt/src/decryptjob.h
@@ -84,8 +84,6 @@ public:
If \a plainText is non-null, the plaintext is written
there. Otherwise, it will be delivered in the second argument
of result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
diff --git a/lang/qt/src/decryptverifyjob.h b/lang/qt/src/decryptverifyjob.h
index e5c4346..8444e4d 100644
--- a/lang/qt/src/decryptverifyjob.h
+++ b/lang/qt/src/decryptverifyjob.h
@@ -85,8 +85,6 @@ public:
If \a plainText is non-null, the plaintext is written
there. Otherwise, it will be delivered in the third argument
of result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
diff --git a/lang/qt/src/downloadjob.h b/lang/qt/src/downloadjob.h
index 7c8bb72..b916c41 100644
--- a/lang/qt/src/downloadjob.h
+++ b/lang/qt/src/downloadjob.h
@@ -38,6 +38,7 @@
#include "job.h"
#include <QtCore/QByteArray>
+#include <QtCore/QStringList>
#include <memory>
@@ -46,7 +47,6 @@ namespace GpgME
class Error;
}
-class QStringList;
class QIODevice;
class QByteArray;
diff --git a/lang/qt/src/encryptjob.cpp b/lang/qt/src/encryptjob.cpp
new file mode 100644
index 0000000..7533bd9
--- /dev/null
+++ b/lang/qt/src/encryptjob.cpp
@@ -0,0 +1,61 @@
+/*
+ encryptjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "encryptjob.h"
+#include "job_p.h"
+
+using namespace QGpgME;
+
+namespace
+{
+struct EncryptJobPrivate : public JobPrivate
+{
+ QString m_fileName;
+};
+}
+
+void EncryptJob::setFileName(const QString &fileName)
+{
+ auto d = jobPrivate<EncryptJobPrivate>(this);
+ d->m_fileName = fileName;
+}
+
+QString EncryptJob::fileName() const
+{
+ auto d = jobPrivate<EncryptJobPrivate>(this);
+ return d->m_fileName;
+}
diff --git a/lang/qt/src/encryptjob.h b/lang/qt/src/encryptjob.h
index 937ee8d..8135053 100644
--- a/lang/qt/src/encryptjob.h
+++ b/lang/qt/src/encryptjob.h
@@ -5,6 +5,8 @@
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -80,6 +82,9 @@ protected:
public:
~EncryptJob();
+ void setFileName(const QString &fileName);
+ QString fileName() const;
+
/**
Starts the encryption operation. \a recipients is the a list of
keys to encrypt \a plainText to. Empty (null) keys are
@@ -99,8 +104,6 @@ public:
If \a cipherText is non-null, the ciphertext is written
there. Otherwise, it will be delivered in the second argument of
result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::vector<GpgME::Key> &recipients,
const std::shared_ptr<QIODevice> &plainText,
diff --git a/lang/qt/src/exportjob.h b/lang/qt/src/exportjob.h
index 7f79ea0..4fdb468 100644
--- a/lang/qt/src/exportjob.h
+++ b/lang/qt/src/exportjob.h
@@ -39,14 +39,13 @@
#include "job.h"
#include <QtCore/QByteArray>
+#include <QtCore/QStringList>
namespace GpgME
{
class Error;
}
-class QStringList;
-
namespace QGpgME
{
diff --git a/lang/qt/src/gpgcardjob.h b/lang/qt/src/gpgcardjob.h
index 63f5cf7..3f1b239 100644
--- a/lang/qt/src/gpgcardjob.h
+++ b/lang/qt/src/gpgcardjob.h
@@ -44,24 +44,6 @@ class Error;
namespace QGpgME
{
-/**
- @short Get the best key to use for a Mailbox
-
- To use the keyformailboxjob, first obtain an instance from the
- CryptoBackend and either exec it or start and
- conncet the result() signals to a suitable slot.
- The job will be automatically deleted in which
- case the KeylistJob instance will have schedules it's own
- destruction with a call to QObject::deleteLater().
-
- The best key is defined as the key with a UID that has an
- E-Mail that matches the mailbox provided. If multiple
- keys are found the one with the highest validity is returned.
-
- After result() is emitted, the
- KeyListJob will schedule it's own destruction by calling
- QObject::deleteLater().
-*/
class QGPGME_EXPORT GpgCardJob: public Job
{
Q_OBJECT
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
index a9edc8e..98f408b 100644
--- a/lang/qt/src/job.cpp
+++ b/lang/qt/src/job.cpp
@@ -72,6 +72,8 @@
#include "quickjob.h"
#include "gpgcardjob.h"
#include "receivekeysjob.h"
+#include "revokekeyjob.h"
+#include "setprimaryuseridjob.h"
#include <QCoreApplication>
#include <QDebug>
@@ -172,6 +174,8 @@ make_job_subclass(WKSPublishJob)
make_job_subclass(TofuPolicyJob)
make_job_subclass(QuickJob)
make_job_subclass(GpgCardJob)
+make_job_subclass(RevokeKeyJob)
+make_job_subclass(SetPrimaryUserIDJob)
#undef make_job_subclass
@@ -208,3 +212,5 @@ make_job_subclass(GpgCardJob)
#include "quickjob.moc"
#include "gpgcardjob.moc"
#include "receivekeysjob.moc"
+#include "revokekeyjob.moc"
+#include "setprimaryuseridjob.moc"
diff --git a/lang/qt/src/keyformailboxjob.h b/lang/qt/src/keyformailboxjob.h
index 42d1729..5e08907 100644
--- a/lang/qt/src/keyformailboxjob.h
+++ b/lang/qt/src/keyformailboxjob.h
@@ -57,18 +57,14 @@ namespace QGpgME
To use the keyformailboxjob, first obtain an instance from the
CryptoBackend and either exec it or start and
- conncet the result() signals to a suitable slot.
- The job will be automatically deleted in which
- case the KeylistJob instance will have schedules it's own
- destruction with a call to QObject::deleteLater().
+ connect the result() signal to a suitable slot.
The best key is defined as the key with a UID that has an
E-Mail that matches the mailbox provided. If multiple
keys are found the one with the highest validity is returned.
- After result() is emitted, the
- KeyListJob will schedule it's own destruction by calling
- QObject::deleteLater().
+ After result() is emitted, the job will schedule it's own
+ destruction by calling QObject::deleteLater().
*/
class QGPGME_EXPORT KeyForMailboxJob: public Job
{
diff --git a/lang/qt/src/keylistjob.h b/lang/qt/src/keylistjob.h
index 88eac87..ace9fbe 100644
--- a/lang/qt/src/keylistjob.h
+++ b/lang/qt/src/keylistjob.h
@@ -44,6 +44,8 @@
# include <gpgme++/key.h>
#endif
+#include <QtCore/QStringList>
+
#include <vector>
namespace GpgME
@@ -52,8 +54,6 @@ class Error;
class KeyListResult;
}
-class QStringList;
-
namespace QGpgME
{
@@ -64,7 +64,7 @@ namespace QGpgME
CryptoBackend implementation, connect the nextKey(), progress()
and result() signals to suitable slots and then start the key
listing with a call to start(). This call might fail, in which
- case the KeylistJob instance will have schedules it's own
+ case the KeylistJob instance will have scheduled it's own
destruction with a call to QObject::deleteLater().
During keylisting, you will receive new key objects through the
diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h
index 62b2cb2..019633a 100644
--- a/lang/qt/src/protocol.h
+++ b/lang/qt/src/protocol.h
@@ -71,6 +71,8 @@ class TofuPolicyJob;
class QuickJob;
class GpgCardJob;
class ReceiveKeysJob;
+class RevokeKeyJob;
+class SetPrimaryUserIDJob;
/** The main entry point for QGpgME Comes in OpenPGP and SMIME(CMS) flavors.
*
@@ -134,6 +136,12 @@ public:
virtual DeleteJob *deleteJob() const = 0;
virtual SignEncryptJob *signEncryptJob(bool armor = false, bool textMode = false) const = 0;
virtual DecryptVerifyJob *decryptVerifyJob(bool textmode = false) const = 0;
+
+ /**
+ * For S/MIME keys this job performs a full validation check of the keys
+ * with updated CRLs.
+ * For OpenPGP keys, use receiveKeysJob.
+ */
virtual RefreshKeysJob *refreshKeysJob() const = 0;
virtual ChangeExpiryJob *changeExpiryJob() const = 0;
virtual SignKeyJob *signKeyJob() const = 0;
@@ -173,6 +181,14 @@ public:
virtual ExportJob *secretSubkeyExportJob(bool armor = false) const = 0;
virtual AddExistingSubkeyJob *addExistingSubkeyJob() const = 0;
virtual ReceiveKeysJob *receiveKeysJob() const = 0;
+
+ virtual RevokeKeyJob *revokeKeyJob() const = 0;
+
+ /**
+ * Returns a job for flagging a user ID as the primary user ID of an
+ * OpenPGP key.
+ */
+ virtual SetPrimaryUserIDJob *setPrimaryUserIDJob() const = 0;
};
/** Obtain a reference to the OpenPGP Protocol.
diff --git a/lang/qt/src/protocol_p.h b/lang/qt/src/protocol_p.h
index 4211e00..685ac4d 100644
--- a/lang/qt/src/protocol_p.h
+++ b/lang/qt/src/protocol_p.h
@@ -42,7 +42,7 @@
#include "qgpgmelistallkeysjob.h"
#include "qgpgmedecryptjob.h"
#include "qgpgmedecryptverifyjob.h"
-#include "qgpgmerefreshkeysjob.h"
+#include "qgpgmerefreshsmimekeysjob.h"
#include "qgpgmedeletejob.h"
#include "qgpgmedownloadjob.h"
#include "qgpgmesignencryptjob.h"
@@ -65,6 +65,8 @@
#include "qgpgmetofupolicyjob.h"
#include "qgpgmequickjob.h"
#include "qgpgmereceivekeysjob.h"
+#include "qgpgmerevokekeyjob.h"
+#include "qgpgmesetprimaryuseridjob.h"
namespace
{
@@ -282,12 +284,11 @@ public:
QGpgME::RefreshKeysJob *refreshKeysJob() const Q_DECL_OVERRIDE
{
- if (mProtocol != GpgME::CMS) { // fixme: add support for gpg, too
+ if (mProtocol != GpgME::CMS) {
return nullptr;
}
- // this operation is not supported by gpgme, so we have to call gpgsm ourselves:
- return new QGpgME::QGpgMERefreshKeysJob();
+ return new QGpgME::QGpgMERefreshSMIMEKeysJob;
}
QGpgME::DownloadJob *downloadJob(bool armor) const Q_DECL_OVERRIDE
@@ -421,7 +422,7 @@ public:
if (!context) {
return nullptr;
}
- context->setKeyListMode(GpgME::Extern | GpgME::Local | GpgME::Signatures | GpgME::Validate);
+ context->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
return new QGpgME::QGpgMEKeyListJob(context);
}
@@ -481,6 +482,30 @@ public:
}
return new QGpgME::QGpgMEQuickJob(context);
}
+
+ QGpgME::RevokeKeyJob *revokeKeyJob() const Q_DECL_OVERRIDE
+ {
+ if (mProtocol != GpgME::OpenPGP) {
+ return nullptr;
+ }
+ GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
+ if (!context) {
+ return nullptr;
+ }
+ return new QGpgME::QGpgMERevokeKeyJob(context);
+ }
+
+ QGpgME::SetPrimaryUserIDJob *setPrimaryUserIDJob() const override
+ {
+ if (mProtocol != GpgME::OpenPGP) {
+ return nullptr;
+ }
+ GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
+ if (!context) {
+ return nullptr;
+ }
+ return new QGpgME::QGpgMESetPrimaryUserIDJob{context};
+ }
};
}
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp
index 5f9a8ab..e2b3724 100644
--- a/lang/qt/src/qgpgmedecryptverifyjob.cpp
+++ b/lang/qt/src/qgpgmedecryptverifyjob.cpp
@@ -67,8 +67,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::weak_ptr<QIODevice> &cipherText_,
const std::weak_ptr<QIODevice> &plainText_)
{
-
- qCDebug(QGPGME_LOG);
+ qCDebug(QGPGME_LOG) << __func__;
const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
const std::shared_ptr<QIODevice> plainText = plainText_.lock();
@@ -86,7 +85,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
- qCDebug(QGPGME_LOG) << "End no plainText. Error: " << ae;
+ qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae.asString();
return std::make_tuple(res.first, res.second, out.data(), log, ae);
} else {
QGpgME::QIODeviceDataProvider out(plainText);
@@ -95,10 +94,9 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
- qCDebug(QGPGME_LOG) << "End plainText. Error: " << ae;
+ qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae.asString();
return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
}
-
}
static QGpgMEDecryptVerifyJob::result_type decrypt_verify_qba(Context *ctx, const QByteArray &cipherText)
diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp
index 8fb3dd3..cd54496 100644
--- a/lang/qt/src/qgpgmeencryptjob.cpp
+++ b/lang/qt/src/qgpgmeencryptjob.cpp
@@ -5,6 +5,8 @@
Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -45,7 +47,7 @@
#include "data.h"
#include <QBuffer>
-
+#include <QFileInfo>
#include <cassert>
@@ -71,7 +73,8 @@ static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
const std::weak_ptr<QIODevice> &plainText_,
const std::weak_ptr<QIODevice> &cipherText_,
const Context::EncryptionFlags eflags,
- bool outputIsBsse64Encoded)
+ bool outputIsBsse64Encoded,
+ const QString &fileName)
{
const std::shared_ptr<QIODevice> plainText = plainText_.lock();
@@ -81,7 +84,12 @@ static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
const _detail::ToThreadMover ptMover(plainText, thread);
QGpgME::QIODeviceDataProvider in(plainText);
- const Data indata(&in);
+ Data indata(&in);
+
+ const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
+ if (!pureFileName.empty()) {
+ indata.setFileName(pureFileName.c_str());
+ }
if (!cipherText) {
QGpgME::QByteArrayDataProvider out;
@@ -111,20 +119,20 @@ static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
}
-static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded)
+static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
{
const std::shared_ptr<QBuffer> buffer(new QBuffer);
buffer->setData(plainText);
if (!buffer->open(QIODevice::ReadOnly)) {
assert(!"This should never happen: QBuffer::open() failed");
}
- return encrypt(ctx, nullptr, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded);
+ return encrypt(ctx, nullptr, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, fileName);
}
Error QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
{
run(std::bind(&encrypt_qba, std::placeholders::_1, recipients, plainText,
- alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded));
+ alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded, fileName()));
return Error();
}
@@ -136,14 +144,15 @@ void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shar
recipients,
std::placeholders::_3, std::placeholders::_4,
eflags,
- mOutputIsBase64Encoded),
+ mOutputIsBase64Encoded,
+ fileName()),
plainText, cipherText);
}
EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, const QByteArray &plainText,
const Context::EncryptionFlags eflags, QByteArray &cipherText)
{
- const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded);
+ const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded, fileName());
cipherText = std::get<1>(r);
resultHook(r);
return mResult;
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp
index 534e9a3..b6ab3db 100644
--- a/lang/qt/src/qgpgmekeyformailboxjob.cpp
+++ b/lang/qt/src/qgpgmekeyformailboxjob.cpp
@@ -71,7 +71,7 @@ static bool subkeyIsOk(const Subkey s)
static QGpgMEKeyForMailboxJob::result_type do_work(Context *ctx, const QString &mailbox, bool canEncrypt)
{
/* Do a Keylisting. */
- ctx->setKeyListMode(GpgME::Extern | GpgME::Local | GpgME::Signatures | GpgME::Validate);
+ ctx->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
std::vector<Key> keys;
QGpgMEKeyListJob *keylist = new QGpgMEKeyListJob(ctx);
diff --git a/lang/qt/src/qgpgmerefreshkeysjob.cpp b/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
index 5f78f2a..3187a0c 100644
--- a/lang/qt/src/qgpgmerefreshkeysjob.cpp
+++ b/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
@@ -1,5 +1,5 @@
/*
- qgpgmerefreshkeysjob.cpp
+ qgpgmerefreshsmimekeysjob.cpp
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (c) 2004 Klarävdalens Datakonsult AB
@@ -38,21 +38,27 @@
#include "config.h"
#endif
-#include "qgpgmerefreshkeysjob.h"
+#include "qgpgmerefreshsmimekeysjob.h"
+#include "util.h"
#include <QDebug>
#include "qgpgme_debug.h"
#include "context.h"
+#include <key.h>
#include <QByteArray>
+#include <QMetaObject>
+#include <QProcess>
#include <QStringList>
#include <gpg-error.h>
#include <assert.h>
-QGpgME::QGpgMERefreshKeysJob::QGpgMERefreshKeysJob()
+using namespace QGpgME;
+
+QGpgMERefreshSMIMEKeysJob::QGpgMERefreshSMIMEKeysJob()
: RefreshKeysJob(nullptr),
mProcess(nullptr),
mError(0)
@@ -60,12 +66,12 @@ QGpgME::QGpgMERefreshKeysJob::QGpgMERefreshKeysJob()
}
-QGpgME::QGpgMERefreshKeysJob::~QGpgMERefreshKeysJob()
+QGpgMERefreshSMIMEKeysJob::~QGpgMERefreshSMIMEKeysJob()
{
}
-GpgME::Error QGpgME::QGpgMERefreshKeysJob::start(const QStringList &patterns)
+GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const QStringList &patterns)
{
assert(mPatternsToDo.empty());
@@ -79,11 +85,31 @@ GpgME::Error QGpgME::QGpgMERefreshKeysJob::start(const QStringList &patterns)
return startAProcess();
}
+GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const std::vector<GpgME::Key> &keys)
+{
+ if (keys.empty()) {
+ QMetaObject::invokeMethod(this, [this]() {
+ Q_EMIT slotProcessExited(0, QProcess::NormalExit);
+ }, Qt::QueuedConnection);
+ return {};
+ }
+
+ const bool gotWrongKeys = std::any_of(std::begin(keys), std::end(keys), [](const auto &k) {
+ return k.protocol() != GpgME::CMS;
+ });
+ if (gotWrongKeys) {
+ qCDebug(QGPGME_LOG) << "Error: At least one of the keys is not an S/MIME key";
+ return GpgME::Error::fromCode(GPG_ERR_INV_VALUE);
+ }
+
+ return start(toFingerprints(keys));
+}
+
#if MAX_CMD_LENGTH < 65 + 128
#error MAX_CMD_LENGTH is too low
#endif
-GpgME::Error QGpgME::QGpgMERefreshKeysJob::startAProcess()
+GpgME::Error QGpgMERefreshSMIMEKeysJob::startAProcess()
{
if (mPatternsToDo.empty()) {
return GpgME::Error();
@@ -122,10 +148,12 @@ GpgME::Error QGpgME::QGpgMERefreshKeysJob::startAProcess()
connect(mProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
SLOT(slotProcessExited(int,QProcess::ExitStatus)));
- connect(mProcess, SIGNAL(readyReadStandardOutput()),
- SLOT(slotStdout()));
- connect(mProcess, &QProcess::readyReadStandardError,
- this, &QGpgMERefreshKeysJob::slotStderr);
+ connect(mProcess, &QProcess::readyReadStandardOutput, this, [this]() {
+ qCDebug(QGPGME_LOG) << "stdout:" << mProcess->readAllStandardOutput();
+ });
+ connect(mProcess, &QProcess::readyReadStandardError, this, [this]() {
+ qCDebug(QGPGME_LOG) << "stderr:" << mProcess->readAllStandardError();
+ });
mProcess->start();
if (!mProcess->waitForStarted()) {
@@ -137,7 +165,7 @@ GpgME::Error QGpgME::QGpgMERefreshKeysJob::startAProcess()
}
}
-void QGpgME::QGpgMERefreshKeysJob::slotCancel()
+void QGpgMERefreshSMIMEKeysJob::slotCancel()
{
if (mProcess) {
mProcess->kill();
@@ -146,7 +174,7 @@ void QGpgME::QGpgMERefreshKeysJob::slotCancel()
mError = GpgME::Error::fromCode(GPG_ERR_CANCELED, GPG_ERR_SOURCE_GPGSM);
}
-void QGpgME::QGpgMERefreshKeysJob::slotStatus(QProcess *proc, const QString &type, const QStringList &args)
+void QGpgMERefreshSMIMEKeysJob::slotStatus(QProcess *proc, const QString &type, const QStringList &args)
{
if (proc != mProcess) {
return;
@@ -204,12 +232,7 @@ void QGpgME::QGpgMERefreshKeysJob::slotStatus(QProcess *proc, const QString &typ
}
}
-void QGpgME::QGpgMERefreshKeysJob::slotStderr()
-{
- // implement? or not?
-}
-
-void QGpgME::QGpgMERefreshKeysJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
+void QGpgMERefreshSMIMEKeysJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
{
if (!mError && !mPatternsToDo.empty()) {
if (const GpgME::Error err = startAProcess()) {
@@ -227,4 +250,4 @@ void QGpgME::QGpgMERefreshKeysJob::slotProcessExited(int exitCode, QProcess::Exi
Q_EMIT result(mError);
deleteLater();
}
-#include "qgpgmerefreshkeysjob.moc"
+#include "qgpgmerefreshsmimekeysjob.moc"
diff --git a/lang/qt/src/qgpgmerefreshkeysjob.h b/lang/qt/src/qgpgmerefreshsmimekeysjob.h
index 4dfd942..b5b70e9 100644
--- a/lang/qt/src/qgpgmerefreshkeysjob.h
+++ b/lang/qt/src/qgpgmerefreshsmimekeysjob.h
@@ -1,5 +1,5 @@
/*
- qgpgmerefreshkeysjob.h
+ qgpgmerefreshsmimekeysjob.h
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (c) 2004 Klarälvdalens Datakonsult AB
@@ -32,8 +32,8 @@
your version.
*/
-#ifndef __QGPGME_QGPGMEREFRESHKEYSJOB_H__
-#define __QGPGME_QGPGMEREFRESHKEYSJOB_H__
+#ifndef __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
+#define __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
#include "refreshkeysjob.h"
#ifdef BUILDING_QGPGME
@@ -48,22 +48,23 @@
namespace QGpgME
{
-class QGpgMERefreshKeysJob : public RefreshKeysJob
+class QGpgMERefreshSMIMEKeysJob : public RefreshKeysJob
{
Q_OBJECT
public:
- QGpgMERefreshKeysJob();
- ~QGpgMERefreshKeysJob();
+ QGpgMERefreshSMIMEKeysJob();
+ ~QGpgMERefreshSMIMEKeysJob();
/* from RefreshKeysJob */
GpgME::Error start(const QStringList &patterns) Q_DECL_OVERRIDE;
+ GpgME::Error start(const std::vector<GpgME::Key> &keys) override;
+
private Q_SLOTS:
/* from Job */
void slotCancel() Q_DECL_OVERRIDE;
void slotStatus(QProcess *, const QString &, const QStringList &);
- void slotStderr();
void slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus);
private:
@@ -77,4 +78,4 @@ private:
}
-#endif // __QGPGME_QGPGMEREFRESHKEYSJOB_H__
+#endif // __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmerevokekeyjob.cpp b/lang/qt/src/qgpgmerevokekeyjob.cpp
new file mode 100644
index 0000000..8a2c224
--- /dev/null
+++ b/lang/qt/src/qgpgmerevokekeyjob.cpp
@@ -0,0 +1,128 @@
+/*
+ qgpgmerevokekeyjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "qgpgmerevokekeyjob.h"
+
+#include "dataprovider.h"
+
+#include <context.h>
+#include <data.h>
+#include <gpgrevokekeyeditinteractor.h>
+#include <key.h>
+
+#include <gpg-error.h>
+
+#include "qgpgme_debug.h"
+
+using namespace QGpgME;
+using namespace GpgME;
+
+QGpgMERevokeKeyJob::QGpgMERevokeKeyJob(Context *context)
+ : mixin_type{context}
+{
+ lateInitialization();
+}
+
+QGpgMERevokeKeyJob::~QGpgMERevokeKeyJob() = default;
+
+
+static Error check_arguments(const Key &key,
+ RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ if (key.isNull()) {
+ qWarning(QGPGME_LOG) << "Error: Key is null key";
+ return Error::fromCode(GPG_ERR_INV_ARG);
+ }
+ if (reason < RevocationReason::Unspecified || reason > RevocationReason::NoLongerUsed) {
+ qWarning(QGPGME_LOG) << "Error: Invalid revocation reason" << static_cast<int>(reason);
+ return Error::fromCode(GPG_ERR_INV_VALUE);
+ }
+ if (std::any_of(std::begin(description), std::end(description),
+ [](const std::string &line) {
+ return line.empty() || line.find('\n') != std::string::npos;
+ })) {
+ qWarning(QGPGME_LOG) << "Error: Revocation description contains empty lines or lines with endline characters";
+ return Error::fromCode(GPG_ERR_INV_VALUE);
+ }
+ return {};
+}
+
+static QGpgMERevokeKeyJob::result_type revoke_key(Context *ctx, const Key &key,
+ RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ std::unique_ptr<GpgRevokeKeyEditInteractor> interactor{new GpgRevokeKeyEditInteractor};
+ interactor->setReason(reason, description);
+
+ QGpgME::QByteArrayDataProvider dp;
+ Data outData(&dp);
+ assert(!outData.isNull());
+
+ ctx->setFlag("extended-edit", "1");
+
+ const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(interactor.release()), outData);
+ Error ae;
+ const QString log = _detail::audit_log_as_html(ctx, ae);
+ return std::make_tuple(err, log, ae);
+}
+
+Error QGpgMERevokeKeyJob::start(const GpgME::Key &key,
+ GpgME::RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ Error err = check_arguments(key, reason, description);
+ if (!err) {
+ run(std::bind(&revoke_key, std::placeholders::_1, key, reason, description));
+ }
+ return err;
+}
+
+Error QGpgMERevokeKeyJob::exec(const GpgME::Key &key,
+ GpgME::RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ Error err = check_arguments(key, reason, description);
+ if (!err) {
+ const result_type r = revoke_key(context(), key, reason, description);
+ resultHook(r);
+ err = std::get<0>(r);
+ }
+ return err;
+}
+
+#include "qgpgmerevokekeyjob.moc"
diff --git a/lang/qt/src/qgpgmerevokekeyjob.h b/lang/qt/src/qgpgmerevokekeyjob.h
new file mode 100644
index 0000000..0eba5cb
--- /dev/null
+++ b/lang/qt/src/qgpgmerevokekeyjob.h
@@ -0,0 +1,70 @@
+/*
+ qgpgmerevokekeyjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_QGPGMEREVOKEKEYJOB_H__
+#define __QGPGME_QGPGMEREVOKEKEYJOB_H__
+
+#include "threadedjobmixin.h"
+#include "revokekeyjob.h"
+
+namespace QGpgME
+{
+
+class QGpgMERevokeKeyJob
+#ifdef Q_MOC_RUN
+ : public RevokeKeyJob
+#else
+ : public _detail::ThreadedJobMixin<RevokeKeyJob>
+#endif
+{
+ Q_OBJECT
+#ifdef Q_MOC_RUN
+public Q_SLOTS:
+ void slotFinished();
+#endif
+public:
+ explicit QGpgMERevokeKeyJob(GpgME::Context *context);
+ ~QGpgMERevokeKeyJob() override;
+
+ GpgME::Error start(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) override;
+
+ GpgME::Error exec(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) override;
+};
+
+}
+
+#endif // __QGPGME_QGPGMEREVOKEKEYJOB_H__
diff --git a/lang/qt/src/qgpgmesetprimaryuseridjob.cpp b/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
new file mode 100644
index 0000000..32da1fc
--- /dev/null
+++ b/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
@@ -0,0 +1,75 @@
+/*
+ qgpgmesetprimaryuseridjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "qgpgmesetprimaryuseridjob.h"
+
+#include "util.h"
+
+#include <engineinfo.h>
+
+using namespace QGpgME;
+using namespace GpgME;
+
+static bool quickSetPrimayUidSupportsUidHash()
+{
+ return GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.3.8";
+}
+
+static QGpgMESetPrimaryUserIDJob::result_type set_primary_userid(Context *ctx, const GpgME::UserID &userId)
+{
+ auto err = ctx->setPrimaryUid(userId.parent(), quickSetPrimayUidSupportsUidHash() ? userId.uidhash() : userId.id());
+ return std::make_tuple(err, QString(), Error());
+}
+
+QGpgMESetPrimaryUserIDJob::QGpgMESetPrimaryUserIDJob(Context *context)
+ : mixin_type{context}
+{
+ lateInitialization();
+}
+
+QGpgMESetPrimaryUserIDJob::~QGpgMESetPrimaryUserIDJob() = default;
+
+GpgME::Error QGpgMESetPrimaryUserIDJob::start(const GpgME::UserID &userId)
+{
+ if (userId.isNull()) {
+ return Error{make_error(GPG_ERR_INV_ARG)};
+ }
+ run([userId](Context *ctx) { return set_primary_userid(ctx, userId); });
+ return {};
+}
+
+#include "qgpgmesetprimaryuseridjob.moc"
diff --git a/lang/qt/src/qgpgmesetprimaryuseridjob.h b/lang/qt/src/qgpgmesetprimaryuseridjob.h
new file mode 100644
index 0000000..4ee967a
--- /dev/null
+++ b/lang/qt/src/qgpgmesetprimaryuseridjob.h
@@ -0,0 +1,64 @@
+/*
+ qgpgmesetprimaryuseridjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_QGPGMESETPRIMARYUSERIDJOB_H__
+#define __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
+
+#include "setprimaryuseridjob.h"
+#include "threadedjobmixin.h"
+
+namespace QGpgME
+{
+
+class QGpgMESetPrimaryUserIDJob
+#ifdef Q_MOC_RUN
+ : public SetPrimaryUserIDJob
+#else
+ : public _detail::ThreadedJobMixin<SetPrimaryUserIDJob>
+#endif
+{
+ Q_OBJECT
+#ifdef Q_MOC_RUN
+public Q_SLOTS:
+ void slotFinished();
+#endif
+public:
+ explicit QGpgMESetPrimaryUserIDJob(GpgME::Context *context);
+ ~QGpgMESetPrimaryUserIDJob() override;
+
+ GpgME::Error start(const GpgME::UserID &userId) override;
+};
+
+}
+
+#endif // __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp
index 284c110..5466c54 100644
--- a/lang/qt/src/qgpgmesignencryptjob.cpp
+++ b/lang/qt/src/qgpgmesignencryptjob.cpp
@@ -5,6 +5,8 @@
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -46,7 +48,7 @@
#include "exception.h"
#include <QBuffer>
-
+#include <QFileInfo>
#include <cassert>
@@ -69,7 +71,7 @@ void QGpgMESignEncryptJob::setOutputIsBase64Encoded(bool on)
static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thread, const std::vector<Key> &signers,
const std::vector<Key> &recipients, const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &cipherText_, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded)
+ const std::weak_ptr<QIODevice> &cipherText_, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
{
const std::shared_ptr<QIODevice> &plainText = plainText_.lock();
const std::shared_ptr<QIODevice> &cipherText = cipherText_.lock();
@@ -78,7 +80,12 @@ static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thr
const _detail::ToThreadMover ptMover(plainText, thread);
QGpgME::QIODeviceDataProvider in(plainText);
- const Data indata(&in);
+ Data indata(&in);
+
+ const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
+ if (!pureFileName.empty()) {
+ indata.setFileName(pureFileName.c_str());
+ }
ctx->clearSigningKeys();
Q_FOREACH (const Key &signer, signers)
@@ -116,26 +123,26 @@ static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thr
}
static QGpgMESignEncryptJob::result_type sign_encrypt_qba(Context *ctx, const std::vector<Key> &signers,
- const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded)
+ const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
{
const std::shared_ptr<QBuffer> buffer(new QBuffer);
buffer->setData(plainText);
if (!buffer->open(QIODevice::ReadOnly)) {
assert(!"This should never happen: QBuffer::open() failed");
}
- return sign_encrypt(ctx, nullptr, signers, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded);
+ return sign_encrypt(ctx, nullptr, signers, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, fileName);
}
Error QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
{
- run(std::bind(&sign_encrypt_qba, std::placeholders::_1, signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded));
+ run(std::bind(&sign_encrypt_qba, std::placeholders::_1, signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded, fileName()));
return Error();
}
void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients,
const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, const Context::EncryptionFlags eflags)
{
- run(std::bind(&sign_encrypt, std::placeholders::_1, std::placeholders::_2, signers, recipients, std::placeholders::_3, std::placeholders::_4, eflags, mOutputIsBase64Encoded), plainText, cipherText);
+ run(std::bind(&sign_encrypt, std::placeholders::_1, std::placeholders::_2, signers, recipients, std::placeholders::_3, std::placeholders::_4, eflags, mOutputIsBase64Encoded, fileName()), plainText, cipherText);
}
void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust)
@@ -145,7 +152,7 @@ void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vec
std::pair<SigningResult, EncryptionResult> QGpgMESignEncryptJob::exec(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, QByteArray &cipherText)
{
- const result_type r = sign_encrypt_qba(context(), signers, recipients, plainText, eflags, mOutputIsBase64Encoded);
+ const result_type r = sign_encrypt_qba(context(), signers, recipients, plainText, eflags, mOutputIsBase64Encoded, fileName());
cipherText = std::get<2>(r);
resultHook(r);
return mResult;
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
index 5036a9b..506d64a 100644
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ b/lang/qt/src/qgpgmesignkeyjob.cpp
@@ -127,11 +127,11 @@ static QGpgMESignKeyJob::result_type sign_key(Context *ctx, const Key &key, cons
if (expirationDate.isValid()) {
// on 2106-02-07, the Unix time will reach 0xFFFFFFFF; since gpg uses uint32 internally
- // for the expiration date clip it at 2106-02-06
- static const QDate maxAllowedDate{2106, 2, 6};
+ // for the expiration date clip it at 2106-02-05 to avoid problems with negative time zones
+ static const QDate maxAllowedDate{2106, 2, 5};
const auto clippedExpirationDate = expirationDate <= maxAllowedDate ? expirationDate : maxAllowedDate;
if (clippedExpirationDate != expirationDate) {
- qCWarning(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
+ qCDebug(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
}
// use the "days from now" format to specify the expiration date of the certification;
// this format is the most appropriate regardless of the local timezone
diff --git a/lang/qt/src/refreshkeysjob.h b/lang/qt/src/refreshkeysjob.h
index c4ba74a..67774c2 100644
--- a/lang/qt/src/refreshkeysjob.h
+++ b/lang/qt/src/refreshkeysjob.h
@@ -38,6 +38,8 @@
#include "job.h"
#include "qgpgme_export.h"
+#include <QtCore/QStringList>
+
#include <vector>
namespace GpgME
@@ -46,8 +48,6 @@ class Error;
class Key;
}
-class QStringList;
-
namespace QGpgME
{
@@ -61,7 +61,7 @@ namespace QGpgME
RefreshKeysJob instance will have scheduled its own destruction
with a call to QObject::deleteLater().
- After result() is emitted, the KeyListJob will schedule it's own
+ After result() is emitted, the job will schedule it's own
destruction by calling QObject::deleteLater().
*/
class QGPGME_EXPORT RefreshKeysJob : public Job
@@ -73,21 +73,22 @@ public:
~RefreshKeysJob();
/**
- Starts the keylist operation. \a pattern is a list of patterns
+ Starts the refresh operation. \a pattern is a list of patterns
used to restrict the list of keys returned. Empty patterns are
ignored. If \a pattern is empty or contains only empty strings,
- all keys are returned (however, the backend is free to truncate
- the result and should do so; when this happens, it will be
- reported by the reult object).
+ all keys are refreshed.
- If \a secretOnly is true, only keys for which the secret key is
- also available are returned. Use this if you need to select a
- key for signing.
+ Only implemented for S/MIME.
*/
virtual GpgME::Error start(const QStringList &patterns) = 0;
+ /**
+ Starts a refresh of the \a keys.
+ */
+ virtual GpgME::Error start(const std::vector<GpgME::Key> &keys) = 0;
+
Q_SIGNALS:
- void result(const GpgME::Error &error);
+ void result(const GpgME::Error &result);
};
}
diff --git a/lang/qt/src/revokekeyjob.h b/lang/qt/src/revokekeyjob.h
new file mode 100644
index 0000000..69aef06
--- /dev/null
+++ b/lang/qt/src/revokekeyjob.h
@@ -0,0 +1,86 @@
+/*
+ revokekeyjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_REVOKEKEYJOB_H__
+#define __QGPGME_REVOKEKEYJOB_H__
+
+#include "job.h"
+#include "qgpgme_export.h"
+
+class QString;
+
+namespace GpgME
+{
+class Error;
+class Key;
+}
+
+namespace QGpgME
+{
+
+class QGPGME_EXPORT RevokeKeyJob : public Job
+{
+ Q_OBJECT
+protected:
+ explicit RevokeKeyJob(QObject *parent);
+
+public:
+ ~RevokeKeyJob();
+
+ /**
+ Starts the operation. \a key is the key to revoke with reason \a reason and
+ optional description \a description. The individual elements of \a description
+ must be non-empty strings and they must not contain any endline characters.
+
+ The job deletes itself after it has completed the operation.
+ */
+ virtual GpgME::Error start(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) = 0;
+
+ /**
+ Runs the operation. \a key is the key to revoke with reason \a reason and
+ optional description \a description. The individual elements of \a description
+ must be non-empty strings and they must not contain any endline characters.
+ */
+ virtual GpgME::Error exec(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) = 0;
+
+Q_SIGNALS:
+ void result(const GpgME::Error &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
+};
+
+}
+
+#endif // __QGPGME_REVOKEKEYJOB_H__
diff --git a/lang/qt/src/setprimaryuseridjob.h b/lang/qt/src/setprimaryuseridjob.h
new file mode 100644
index 0000000..fa76199
--- /dev/null
+++ b/lang/qt/src/setprimaryuseridjob.h
@@ -0,0 +1,69 @@
+/*
+ setprimaryuseridjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_SETPRIMARYUSERIDJOB_H__
+#define __QGPGME_SETPRIMARYUSERIDJOB_H__
+
+#include "job.h"
+
+#include "qgpgme_export.h"
+
+namespace GpgME
+{
+class Error;
+class UserID;
+}
+
+namespace QGpgME
+{
+
+class QGPGME_EXPORT SetPrimaryUserIDJob : public Job
+{
+ Q_OBJECT
+public:
+ explicit SetPrimaryUserIDJob(QObject *parent);
+ ~SetPrimaryUserIDJob() override;
+
+ /**
+ * Starts setting user ID \a userId as the primary user ID.
+ */
+ virtual GpgME::Error start(const GpgME::UserID &userId) = 0;
+
+Q_SIGNALS:
+ void result(const GpgME::Error &error,
+ const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
+};
+
+}
+
+#endif // __QGPGME_SETPRIMARYUSERIDJOB_H__
diff --git a/lang/qt/src/signencryptjob.cpp b/lang/qt/src/signencryptjob.cpp
new file mode 100644
index 0000000..aa02fca
--- /dev/null
+++ b/lang/qt/src/signencryptjob.cpp
@@ -0,0 +1,61 @@
+/*
+ signencryptjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "signencryptjob.h"
+#include "job_p.h"
+
+using namespace QGpgME;
+
+namespace
+{
+struct SignEncryptJobPrivate : public JobPrivate
+{
+ QString m_fileName;
+};
+}
+
+void SignEncryptJob::setFileName(const QString &fileName)
+{
+ auto d = jobPrivate<SignEncryptJobPrivate>(this);
+ d->m_fileName = fileName;
+}
+
+QString SignEncryptJob::fileName() const
+{
+ auto d = jobPrivate<SignEncryptJobPrivate>(this);
+ return d->m_fileName;
+}
diff --git a/lang/qt/src/signencryptjob.h b/lang/qt/src/signencryptjob.h
index 61ab5c6..ebb866d 100644
--- a/lang/qt/src/signencryptjob.h
+++ b/lang/qt/src/signencryptjob.h
@@ -5,6 +5,8 @@
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -85,6 +87,9 @@ protected:
public:
~SignEncryptJob();
+ void setFileName(const QString &fileName);
+ QString fileName() const;
+
/**
Starts the combined signing and encrypting operation. \a signers
is the list of keys to sign \a plainText with. \a recipients is
@@ -106,8 +111,6 @@ public:
If \a cipherText is non-null, the ciphertext is written
there. Otherwise, it will be delivered in the third argument of
result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::vector<GpgME::Key> &signers,
const std::vector<GpgME::Key> &recipients,
diff --git a/lang/qt/src/signjob.h b/lang/qt/src/signjob.h
index 57d2d17..c05231c 100644
--- a/lang/qt/src/signjob.h
+++ b/lang/qt/src/signjob.h
@@ -95,8 +95,6 @@ public:
If \a signature is non-null the signature is written
there. Otherwise, it will be delivered in the second argument of
result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::vector<GpgME::Key> &signers,
const std::shared_ptr<QIODevice> &plainText,
diff --git a/lang/qt/src/signkeyjob.h b/lang/qt/src/signkeyjob.h
index f4b3ed8..d0e90c2 100644
--- a/lang/qt/src/signkeyjob.h
+++ b/lang/qt/src/signkeyjob.h
@@ -149,7 +149,7 @@ public:
* Sets the expiration date of the key signature to @a expiration. By default,
* key signatures do not expire.
*
- * Note: Expiration dates after 2106-02-06 will be set to 2106-02-06.
+ * Note: Expiration dates after 2106-02-05 will be set to 2106-02-05.
*
* Not pure virtual for ABI compatibility.
**/
diff --git a/lang/qt/src/util.cpp b/lang/qt/src/util.cpp
index 3d10e2f..66c7eed 100644
--- a/lang/qt/src/util.cpp
+++ b/lang/qt/src/util.cpp
@@ -31,9 +31,17 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "util.h"
#include <QStringList>
+
+#include <key.h>
+
+#include <algorithm>
#include <functional>
std::vector<std::string> toStrings(const QStringList &l)
@@ -45,3 +53,13 @@ std::vector<std::string> toStrings(const QStringList &l)
std::mem_fn(&QString::toStdString));
return v;
}
+
+QStringList toFingerprints(const std::vector<GpgME::Key> &keys)
+{
+ QStringList fprs;
+ fprs.reserve(keys.size());
+ std::transform(std::begin(keys), std::end(keys), std::back_inserter(fprs), [](const auto &k) {
+ return QString::fromLatin1(k.primaryFingerprint());
+ });
+ return fprs;
+}
diff --git a/lang/qt/src/util.h b/lang/qt/src/util.h
index 94c9733..6aba62e 100644
--- a/lang/qt/src/util.h
+++ b/lang/qt/src/util.h
@@ -36,11 +36,17 @@
#include <gpgme.h>
+#include <sstream>
#include <string>
#include <vector>
class QStringList;
+namespace GpgME
+{
+class Key;
+}
+
static inline gpgme_error_t make_error(gpgme_err_code_t code)
{
return gpgme_err_make((gpgme_err_source_t)22, code);
@@ -48,4 +54,14 @@ static inline gpgme_error_t make_error(gpgme_err_code_t code)
std::vector<std::string> toStrings(const QStringList &l);
+QStringList toFingerprints(const std::vector<GpgME::Key> &keys);
+
+template<class Result>
+std::string toLogString(const Result &result)
+{
+ std::stringstream stream;
+ stream << result;
+ return stream.str();
+}
+
#endif // __QGPGME_UTIL_H__
diff --git a/lang/qt/src/verifydetachedjob.h b/lang/qt/src/verifydetachedjob.h
index 2293f3a..12fdfbb 100644
--- a/lang/qt/src/verifydetachedjob.h
+++ b/lang/qt/src/verifydetachedjob.h
@@ -81,11 +81,6 @@ public:
virtual GpgME::Error start(const QByteArray &signature,
const QByteArray &signedData) = 0;
- /*!
- \overload
-
- \throws GpgME::Exception if starting fails.
- */
virtual void start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData) = 0;
virtual GpgME::VerificationResult exec(const QByteArray &signature,
diff --git a/lang/qt/src/verifyopaquejob.h b/lang/qt/src/verifyopaquejob.h
index bfa34e9..c9b2247 100644
--- a/lang/qt/src/verifyopaquejob.h
+++ b/lang/qt/src/verifyopaquejob.h
@@ -85,8 +85,6 @@ public:
If \a plainText is non-null, the plaintext is written
there. Otherwise, it will be delivered in the second argument
of result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
index ff3f21e..2b4daf5 100644
--- a/lang/qt/src/wkspublishjob.h
+++ b/lang/qt/src/wkspublishjob.h
@@ -52,11 +52,9 @@ namespace QGpgME {
* 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
+ * When the response is received call startReceive with the
* RFC822 mail received as parameter response. Check for errors
- * and then send again send the result from returnedData back to
- * the server.
- *
+ * and then send the result from returnedData back to the server.
*/
class QGPGME_EXPORT WKSPublishJob: public Job
{
@@ -66,7 +64,6 @@ protected:
public:
~WKSPublishJob();
-
/** Start a check if WKS Publishing is supported. As this involves
* an HTTP Query it might take a while. Returns GPG_ERR_NOT_SUPPORED
* result if GnuPG is too old or the required tools are not installed.
diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
index 6c082b0..5724a2d 100644
--- a/lang/qt/tests/Makefile.am
+++ b/lang/qt/tests/Makefile.am
@@ -30,7 +30,7 @@ the_tests = \
t-addexistingsubkey \
t-keylist t-keylocate t-ownertrust t-tofuinfo \
t-encrypt t-verify t-various t-config t-remarks t-trustsignatures \
- t-changeexpiryjob t-wkdlookup t-import
+ t-changeexpiryjob t-wkdlookup t-import t-revokekey t-setprimaryuserid
TESTS = initial.test $(the_tests) final.test
@@ -39,7 +39,8 @@ moc_files = \
t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc \
t-various.moc t-config.moc t-remarks.moc t-trustsignatures.moc \
- t-changeexpiryjob.moc t-wkdlookup.moc t-import.moc
+ t-changeexpiryjob.moc t-wkdlookup.moc t-import.moc t-revokekey.moc \
+ t-setprimaryuserid.moc
AM_LDFLAGS = -no-install
@@ -70,10 +71,13 @@ t_trustsignatures_SOURCES = t-trustsignatures.cpp $(support_src)
t_changeexpiryjob_SOURCES = t-changeexpiryjob.cpp $(support_src)
t_wkdlookup_SOURCES = t-wkdlookup.cpp $(support_src)
t_import_SOURCES = t-import.cpp $(support_src)
+t_revokekey_SOURCES = t-revokekey.cpp $(support_src)
+t_setprimaryuserid_SOURCES = t-setprimaryuserid.cpp $(support_src)
run_exportjob_SOURCES = run-exportjob.cpp
run_importjob_SOURCES = run-importjob.cpp
run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
run_receivekeysjob_SOURCES = run-receivekeysjob.cpp
+run_refreshkeysjob_SOURCES = run-refreshkeysjob.cpp
nodist_t_keylist_SOURCES = $(moc_files)
@@ -83,8 +87,9 @@ noinst_PROGRAMS = \
t-addexistingsubkey \
t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \
run-keyformailboxjob t-wkspublish t-verify t-various t-config t-remarks \
- t-trustsignatures t-changeexpiryjob t-wkdlookup t-import run-importjob \
- run-exportjob run-receivekeysjob
+ t-trustsignatures t-changeexpiryjob t-wkdlookup t-import t-revokekey \
+ t-setprimaryuserid \
+ run-importjob run-exportjob run-receivekeysjob run-refreshkeysjob
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
diff --git a/lang/qt/tests/Makefile.in b/lang/qt/tests/Makefile.in
index 89fad15..1c4b87a 100644
--- a/lang/qt/tests/Makefile.in
+++ b/lang/qt/tests/Makefile.in
@@ -114,11 +114,14 @@ noinst_PROGRAMS = t-addexistingsubkey$(EXEEXT) t-keylist$(EXEEXT) \
t-wkspublish$(EXEEXT) t-verify$(EXEEXT) t-various$(EXEEXT) \
t-config$(EXEEXT) t-remarks$(EXEEXT) \
t-trustsignatures$(EXEEXT) t-changeexpiryjob$(EXEEXT) \
- t-wkdlookup$(EXEEXT) t-import$(EXEEXT) run-importjob$(EXEEXT) \
- run-exportjob$(EXEEXT) run-receivekeysjob$(EXEEXT)
+ t-wkdlookup$(EXEEXT) t-import$(EXEEXT) t-revokekey$(EXEEXT) \
+ t-setprimaryuserid$(EXEEXT) run-importjob$(EXEEXT) \
+ run-exportjob$(EXEEXT) run-receivekeysjob$(EXEEXT) \
+ run-refreshkeysjob$(EXEEXT)
subdir = lang/qt/tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -161,6 +164,11 @@ run_receivekeysjob_OBJECTS = $(am_run_receivekeysjob_OBJECTS)
run_receivekeysjob_LDADD = $(LDADD)
run_receivekeysjob_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
../src/libqgpgme.la ../../../src/libgpgme.la
+am_run_refreshkeysjob_OBJECTS = run-refreshkeysjob.$(OBJEXT)
+run_refreshkeysjob_OBJECTS = $(am_run_refreshkeysjob_OBJECTS)
+run_refreshkeysjob_LDADD = $(LDADD)
+run_refreshkeysjob_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
+ ../src/libqgpgme.la ../../../src/libgpgme.la
am__objects_1 = t-support.$(OBJEXT)
am_t_addexistingsubkey_OBJECTS = t-addexistingsubkey.$(OBJEXT) \
$(am__objects_1)
@@ -212,6 +220,17 @@ t_remarks_OBJECTS = $(am_t_remarks_OBJECTS)
t_remarks_LDADD = $(LDADD)
t_remarks_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
../src/libqgpgme.la ../../../src/libgpgme.la
+am_t_revokekey_OBJECTS = t-revokekey.$(OBJEXT) $(am__objects_1)
+t_revokekey_OBJECTS = $(am_t_revokekey_OBJECTS)
+t_revokekey_LDADD = $(LDADD)
+t_revokekey_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
+ ../src/libqgpgme.la ../../../src/libgpgme.la
+am_t_setprimaryuserid_OBJECTS = t-setprimaryuserid.$(OBJEXT) \
+ $(am__objects_1)
+t_setprimaryuserid_OBJECTS = $(am_t_setprimaryuserid_OBJECTS)
+t_setprimaryuserid_LDADD = $(LDADD)
+t_setprimaryuserid_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
+ ../src/libqgpgme.la ../../../src/libgpgme.la
am_t_tofuinfo_OBJECTS = t-tofuinfo.$(OBJEXT) $(am__objects_1)
t_tofuinfo_OBJECTS = $(am_t_tofuinfo_OBJECTS)
t_tofuinfo_LDADD = $(LDADD)
@@ -262,11 +281,13 @@ am__depfiles_remade = ./$(DEPDIR)/run-exportjob.Po \
./$(DEPDIR)/run-importjob.Po \
./$(DEPDIR)/run-keyformailboxjob.Po \
./$(DEPDIR)/run-receivekeysjob.Po \
+ ./$(DEPDIR)/run-refreshkeysjob.Po \
./$(DEPDIR)/t-addexistingsubkey.Po \
./$(DEPDIR)/t-changeexpiryjob.Po ./$(DEPDIR)/t-config.Po \
./$(DEPDIR)/t-encrypt.Po ./$(DEPDIR)/t-import.Po \
./$(DEPDIR)/t-keylist.Po ./$(DEPDIR)/t-keylocate.Po \
./$(DEPDIR)/t-ownertrust.Po ./$(DEPDIR)/t-remarks.Po \
+ ./$(DEPDIR)/t-revokekey.Po ./$(DEPDIR)/t-setprimaryuserid.Po \
./$(DEPDIR)/t-support.Po ./$(DEPDIR)/t-tofuinfo.Po \
./$(DEPDIR)/t-trustsignatures.Po ./$(DEPDIR)/t-various.Po \
./$(DEPDIR)/t-verify.Po ./$(DEPDIR)/t-wkdlookup.Po \
@@ -310,23 +331,26 @@ am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(run_exportjob_SOURCES) $(run_importjob_SOURCES) \
$(run_keyformailboxjob_SOURCES) $(run_receivekeysjob_SOURCES) \
- $(t_addexistingsubkey_SOURCES) $(t_changeexpiryjob_SOURCES) \
- $(t_config_SOURCES) $(t_encrypt_SOURCES) $(t_import_SOURCES) \
- $(t_keylist_SOURCES) $(nodist_t_keylist_SOURCES) \
- $(t_keylocate_SOURCES) $(t_ownertrust_SOURCES) \
- $(t_remarks_SOURCES) $(t_tofuinfo_SOURCES) \
- $(t_trustsignatures_SOURCES) $(t_various_SOURCES) \
- $(t_verify_SOURCES) $(t_wkdlookup_SOURCES) \
- $(t_wkspublish_SOURCES)
-DIST_SOURCES = $(run_exportjob_SOURCES) $(run_importjob_SOURCES) \
- $(run_keyformailboxjob_SOURCES) $(run_receivekeysjob_SOURCES) \
- $(t_addexistingsubkey_SOURCES) $(t_changeexpiryjob_SOURCES) \
- $(t_config_SOURCES) $(t_encrypt_SOURCES) $(t_import_SOURCES) \
- $(t_keylist_SOURCES) $(t_keylocate_SOURCES) \
+ $(run_refreshkeysjob_SOURCES) $(t_addexistingsubkey_SOURCES) \
+ $(t_changeexpiryjob_SOURCES) $(t_config_SOURCES) \
+ $(t_encrypt_SOURCES) $(t_import_SOURCES) $(t_keylist_SOURCES) \
+ $(nodist_t_keylist_SOURCES) $(t_keylocate_SOURCES) \
$(t_ownertrust_SOURCES) $(t_remarks_SOURCES) \
+ $(t_revokekey_SOURCES) $(t_setprimaryuserid_SOURCES) \
$(t_tofuinfo_SOURCES) $(t_trustsignatures_SOURCES) \
$(t_various_SOURCES) $(t_verify_SOURCES) \
$(t_wkdlookup_SOURCES) $(t_wkspublish_SOURCES)
+DIST_SOURCES = $(run_exportjob_SOURCES) $(run_importjob_SOURCES) \
+ $(run_keyformailboxjob_SOURCES) $(run_receivekeysjob_SOURCES) \
+ $(run_refreshkeysjob_SOURCES) $(t_addexistingsubkey_SOURCES) \
+ $(t_changeexpiryjob_SOURCES) $(t_config_SOURCES) \
+ $(t_encrypt_SOURCES) $(t_import_SOURCES) $(t_keylist_SOURCES) \
+ $(t_keylocate_SOURCES) $(t_ownertrust_SOURCES) \
+ $(t_remarks_SOURCES) $(t_revokekey_SOURCES) \
+ $(t_setprimaryuserid_SOURCES) $(t_tofuinfo_SOURCES) \
+ $(t_trustsignatures_SOURCES) $(t_various_SOURCES) \
+ $(t_verify_SOURCES) $(t_wkdlookup_SOURCES) \
+ $(t_wkspublish_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -378,7 +402,8 @@ am__EXEEXT_1 = t-addexistingsubkey$(EXEEXT) t-keylist$(EXEEXT) \
t-encrypt$(EXEEXT) t-verify$(EXEEXT) t-various$(EXEEXT) \
t-config$(EXEEXT) t-remarks$(EXEEXT) \
t-trustsignatures$(EXEEXT) t-changeexpiryjob$(EXEEXT) \
- t-wkdlookup$(EXEEXT) t-import$(EXEEXT)
+ t-wkdlookup$(EXEEXT) t-import$(EXEEXT) t-revokekey$(EXEEXT) \
+ t-setprimaryuserid$(EXEEXT)
am__DIST_COMMON = $(srcdir)/Makefile.in \
$(top_srcdir)/build-aux/depcomp \
$(top_srcdir)/build-aux/mkinstalldirs
@@ -432,6 +457,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
@@ -589,14 +615,15 @@ the_tests = \
t-addexistingsubkey \
t-keylist t-keylocate t-ownertrust t-tofuinfo \
t-encrypt t-verify t-various t-config t-remarks t-trustsignatures \
- t-changeexpiryjob t-wkdlookup t-import
+ t-changeexpiryjob t-wkdlookup t-import t-revokekey t-setprimaryuserid
moc_files = \
t-addexistingsubkey.moc \
t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc \
t-various.moc t-config.moc t-remarks.moc t-trustsignatures.moc \
- t-changeexpiryjob.moc t-wkdlookup.moc t-import.moc
+ t-changeexpiryjob.moc t-wkdlookup.moc t-import.moc t-revokekey.moc \
+ t-setprimaryuserid.moc
AM_LDFLAGS = -no-install
LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \
@@ -625,10 +652,13 @@ t_trustsignatures_SOURCES = t-trustsignatures.cpp $(support_src)
t_changeexpiryjob_SOURCES = t-changeexpiryjob.cpp $(support_src)
t_wkdlookup_SOURCES = t-wkdlookup.cpp $(support_src)
t_import_SOURCES = t-import.cpp $(support_src)
+t_revokekey_SOURCES = t-revokekey.cpp $(support_src)
+t_setprimaryuserid_SOURCES = t-setprimaryuserid.cpp $(support_src)
run_exportjob_SOURCES = run-exportjob.cpp
run_importjob_SOURCES = run-importjob.cpp
run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
run_receivekeysjob_SOURCES = run-receivekeysjob.cpp
+run_refreshkeysjob_SOURCES = run-refreshkeysjob.cpp
nodist_t_keylist_SOURCES = $(moc_files)
BUILT_SOURCES = $(moc_files) pubring-stamp
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
@@ -696,6 +726,10 @@ run-receivekeysjob$(EXEEXT): $(run_receivekeysjob_OBJECTS) $(run_receivekeysjob_
@rm -f run-receivekeysjob$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(run_receivekeysjob_OBJECTS) $(run_receivekeysjob_LDADD) $(LIBS)
+run-refreshkeysjob$(EXEEXT): $(run_refreshkeysjob_OBJECTS) $(run_refreshkeysjob_DEPENDENCIES) $(EXTRA_run_refreshkeysjob_DEPENDENCIES)
+ @rm -f run-refreshkeysjob$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(run_refreshkeysjob_OBJECTS) $(run_refreshkeysjob_LDADD) $(LIBS)
+
t-addexistingsubkey$(EXEEXT): $(t_addexistingsubkey_OBJECTS) $(t_addexistingsubkey_DEPENDENCIES) $(EXTRA_t_addexistingsubkey_DEPENDENCIES)
@rm -f t-addexistingsubkey$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_addexistingsubkey_OBJECTS) $(t_addexistingsubkey_LDADD) $(LIBS)
@@ -732,6 +766,14 @@ t-remarks$(EXEEXT): $(t_remarks_OBJECTS) $(t_remarks_DEPENDENCIES) $(EXTRA_t_rem
@rm -f t-remarks$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_remarks_OBJECTS) $(t_remarks_LDADD) $(LIBS)
+t-revokekey$(EXEEXT): $(t_revokekey_OBJECTS) $(t_revokekey_DEPENDENCIES) $(EXTRA_t_revokekey_DEPENDENCIES)
+ @rm -f t-revokekey$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_revokekey_OBJECTS) $(t_revokekey_LDADD) $(LIBS)
+
+t-setprimaryuserid$(EXEEXT): $(t_setprimaryuserid_OBJECTS) $(t_setprimaryuserid_DEPENDENCIES) $(EXTRA_t_setprimaryuserid_DEPENDENCIES)
+ @rm -f t-setprimaryuserid$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_setprimaryuserid_OBJECTS) $(t_setprimaryuserid_LDADD) $(LIBS)
+
t-tofuinfo$(EXEEXT): $(t_tofuinfo_OBJECTS) $(t_tofuinfo_DEPENDENCIES) $(EXTRA_t_tofuinfo_DEPENDENCIES)
@rm -f t-tofuinfo$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_tofuinfo_OBJECTS) $(t_tofuinfo_LDADD) $(LIBS)
@@ -766,6 +808,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-importjob.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keyformailboxjob.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-receivekeysjob.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-refreshkeysjob.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-addexistingsubkey.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-changeexpiryjob.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-config.Po@am__quote@ # am--include-marker
@@ -775,6 +818,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-keylocate.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-ownertrust.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-remarks.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-revokekey.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-setprimaryuserid.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-support.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-tofuinfo.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-trustsignatures.Po@am__quote@ # am--include-marker
@@ -1044,6 +1089,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/run-importjob.Po
-rm -f ./$(DEPDIR)/run-keyformailboxjob.Po
-rm -f ./$(DEPDIR)/run-receivekeysjob.Po
+ -rm -f ./$(DEPDIR)/run-refreshkeysjob.Po
-rm -f ./$(DEPDIR)/t-addexistingsubkey.Po
-rm -f ./$(DEPDIR)/t-changeexpiryjob.Po
-rm -f ./$(DEPDIR)/t-config.Po
@@ -1053,6 +1099,8 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/t-keylocate.Po
-rm -f ./$(DEPDIR)/t-ownertrust.Po
-rm -f ./$(DEPDIR)/t-remarks.Po
+ -rm -f ./$(DEPDIR)/t-revokekey.Po
+ -rm -f ./$(DEPDIR)/t-setprimaryuserid.Po
-rm -f ./$(DEPDIR)/t-support.Po
-rm -f ./$(DEPDIR)/t-tofuinfo.Po
-rm -f ./$(DEPDIR)/t-trustsignatures.Po
@@ -1109,6 +1157,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/run-importjob.Po
-rm -f ./$(DEPDIR)/run-keyformailboxjob.Po
-rm -f ./$(DEPDIR)/run-receivekeysjob.Po
+ -rm -f ./$(DEPDIR)/run-refreshkeysjob.Po
-rm -f ./$(DEPDIR)/t-addexistingsubkey.Po
-rm -f ./$(DEPDIR)/t-changeexpiryjob.Po
-rm -f ./$(DEPDIR)/t-config.Po
@@ -1118,6 +1167,8 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/t-keylocate.Po
-rm -f ./$(DEPDIR)/t-ownertrust.Po
-rm -f ./$(DEPDIR)/t-remarks.Po
+ -rm -f ./$(DEPDIR)/t-revokekey.Po
+ -rm -f ./$(DEPDIR)/t-setprimaryuserid.Po
-rm -f ./$(DEPDIR)/t-support.Po
-rm -f ./$(DEPDIR)/t-tofuinfo.Po
-rm -f ./$(DEPDIR)/t-trustsignatures.Po
diff --git a/lang/qt/tests/run-refreshkeysjob.cpp b/lang/qt/tests/run-refreshkeysjob.cpp
new file mode 100644
index 0000000..940c0c7
--- /dev/null
+++ b/lang/qt/tests/run-refreshkeysjob.cpp
@@ -0,0 +1,155 @@
+/*
+ run-refreshkeysjob.cpp
+
+ This file is part of QGpgME's test suite.
+ Copyright (c) 2022 by g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License,
+ version 2, as published by the Free Software Foundation.
+
+ 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 <protocol.h>
+#include <refreshkeysjob.h>
+#include <receivekeysjob.h>
+
+#include <QCoreApplication>
+#include <QDebug>
+
+#include <context.h>
+#include <importresult.h>
+
+#include <iostream>
+
+using namespace GpgME;
+
+std::ostream &operator<<(std::ostream &os, const QString &s)
+{
+ return os << s.toLocal8Bit().constData();
+}
+
+const char *displayName(Protocol protocol)
+{
+ switch (protocol) {
+ case GpgME::OpenPGP:
+ return "OpenPGP";
+ case GpgME::CMS:
+ return "S/MIME";
+ default:
+ return "Unknown protocol";
+ }
+}
+
+struct KeyAndError {
+ Key key;
+ Error error;
+};
+
+KeyAndError getKey(const QString &keyId, Protocol protocol)
+{
+ KeyAndError result;
+
+ auto ctx = Context::create(protocol);
+ if (!ctx) {
+ result.error = Error::fromCode(GPG_ERR_GENERAL);
+ return result;
+ }
+
+ result.key = ctx->key(keyId.toLatin1().constData(), result.error);
+ if (result.error.code() == GPG_ERR_EOF) {
+ result.error = Error{};
+ }
+ return result;
+}
+
+int main(int argc, char **argv)
+{
+ GpgME::initializeLibrary();
+
+ if (argc != 2) {
+ std::cerr << "Usage: " << argv[0] << " KEYID" << std::endl;
+ return 1;
+ }
+
+ QCoreApplication app{argc, argv};
+ const auto keyId = qApp->arguments().last();
+
+ auto openPGPKey = getKey(keyId, GpgME::OpenPGP);
+ auto smimeKey = getKey(keyId, GpgME::CMS);
+ if ((!openPGPKey.key.isNull() && !smimeKey.key.isNull())
+ || (openPGPKey.error.code() == GPG_ERR_AMBIGUOUS_NAME)
+ || (smimeKey.error.code() == GPG_ERR_AMBIGUOUS_NAME)) {
+ std::cerr << "Error: Multiple keys matching '" << keyId << "' found" << std::endl;
+ return 1;
+ } else if (openPGPKey.key.isNull() && smimeKey.key.isNull()) {
+ std::cerr << "Error: No key matching '" << keyId << "' found" << std::endl;
+ return 1;
+ }
+ if (openPGPKey.error) {
+ std::cerr << "Warning: Error while getting OpenPGP key: " << openPGPKey.error.asString() << std::endl;
+ }
+ if (smimeKey.error) {
+ std::cerr << "Warning: Error while getting S/MIME key: " << openPGPKey.error.asString() << std::endl;
+ }
+ auto key = openPGPKey.key.isNull() ? smimeKey.key : openPGPKey.key;
+ std::cout << "Refreshing " << displayName(key.protocol()) << " key " << key.userID(0).id() << std::endl;
+
+ if (key.protocol() == GpgME::OpenPGP) {
+ auto job = QGpgME::openpgp()->receiveKeysJob();
+ if (!job) {
+ std::cerr << "Error: Could not create job to refresh OpenPGP key" << std::endl;
+ return 1;
+ }
+ QObject::connect(job, &QGpgME::ReceiveKeysJob::result, &app, [](const GpgME::ImportResult &result, const QString &, const GpgME::Error &) {
+ std::cout << "Result: " << result << std::endl;
+ qApp->quit();
+ });
+ const auto err = job->start({QString::fromLatin1(key.primaryFingerprint())});
+ if (err) {
+ std::cerr << "Error: " << err.asString() << std::endl;
+ return 1;
+ }
+ } else {
+ auto job = QGpgME::smime()->refreshKeysJob();
+ if (!job) {
+ std::cerr << "Error: Could not create job to refresh S/MIME key" << std::endl;
+ return 1;
+ }
+ QObject::connect(job, &QGpgME::RefreshKeysJob::result, &app, [](const GpgME::Error &err) {
+ std::cout << "Result: " << err.asString() << std::endl;
+ qApp->quit();
+ });
+ const auto err = job->start({key});
+ if (err) {
+ std::cerr << "Error: " << err.asString() << std::endl;
+ return 1;
+ }
+ }
+
+ return app.exec();
+}
diff --git a/lang/qt/tests/t-revokekey.cpp b/lang/qt/tests/t-revokekey.cpp
new file mode 100644
index 0000000..83d5e71
--- /dev/null
+++ b/lang/qt/tests/t-revokekey.cpp
@@ -0,0 +1,338 @@
+/* t-revokekey.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "t-support.h"
+
+#include <protocol.h>
+#include <revokekeyjob.h>
+
+#include <QDebug>
+#include <QProcess>
+#include <QRegularExpression>
+#include <QSignalSpy>
+#include <QTest>
+
+#include <context.h>
+#include <data.h>
+
+#include <algorithm>
+
+using namespace QGpgME;
+using namespace GpgME;
+
+/* Test keys
+ sec ed25519 2022-03-29 [SC]
+ 604122B94C86BE846EAFE637FC2BCFB1B19A1CF4
+ uid [ultimate] revoke-me@example.net
+ ssb cv25519 2022-03-29 [E]
+ * generated with
+export GNUPGHOME=$(mktemp -d)
+gpg -K
+gpg --batch --pinentry-mode loopback --passphrase abc --quick-gen-key revoke-me@example.net default default never
+gpg -K
+gpg --export-secret-keys --armor --batch --pinentry-mode loopback --passphrase abc --comment revoke-me@example.net revoke-me@example.net | sed 's/\(.*\)/ "\1\\n"/'
+#rm -rf ${GNUPGHOME}
+unset GNUPGHOME
+*/
+static const char *testKeyData =
+ "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
+ "Comment: revoke-me@example.net\n"
+ "\n"
+ "lIYEYkLSGhYJKwYBBAHaRw8BAQdAWKBjYOZIW33CjwlHKKGIgqXDOGhmbPCStkj1\n"
+ "+2/cVFL+BwMCXJpRHkD8EcT8DMWdVo84Lx4w7RNDCQx5xnm6rO5kvtmh+PjgM3qt\n"
+ "CQVGy8H7Dq35yzi0Hihm5zvHxVGYdAu96ShAI2ZqqVL7is0CdAmAibQVcmV2b2tl\n"
+ "LW1lQGV4YW1wbGUubmV0iJQEExYKADwWIQRgQSK5TIa+hG6v5jf8K8+xsZoc9AUC\n"
+ "YkLSGgIbAwULCQgHAgMiAgEGFQoJCAsCBBYCAwECHgcCF4AACgkQ/CvPsbGaHPSH\n"
+ "LAD/RNFgm1Bp6ltDXLS6oS0S5Bgjjg3CBpbdxWTvLjPpaagBAIU2pTLrsGNDKIZq\n"
+ "EAY7hY50tdcvOfT4OSAySJACJzMFnIsEYkLSGhIKKwYBBAGXVQEFAQEHQIOTbPEz\n"
+ "hUtL72BHfetUWESlEbh2IF/NEUWASUtQJDghAwEIB/4HAwJGE5naBnwwcfyPC+Nq\n"
+ "DwY5FO28hQVAzgNu9KAncmPtpST1J8sEPAtJGhtq/9fki9eSvBMbAa64VVpFHKHK\n"
+ "ravZxr2uCrK6J/u4rTvnR8HgiHgEGBYKACAWIQRgQSK5TIa+hG6v5jf8K8+xsZoc\n"
+ "9AUCYkLSGgIbDAAKCRD8K8+xsZoc9ANAAP9rX/xanm7YvcGFIxPclmy4h33lLaG8\n"
+ "dE5RA6zeSg7DqQD8Dae82iKaqKfTpe2+2vIEyxBVy8+WttoElUoXiwr0AQg=\n"
+ "=/5re\n"
+ "-----END PGP PRIVATE KEY BLOCK-----\n";
+
+class RevokeKeyJobTest : public QGpgMETest
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void initTestCase()
+ {
+ QGpgMETest::initTestCase();
+
+ // set up the test fixture for this test
+ qputenv("GNUPGHOME", mGnupgHomeTestFixture.path().toUtf8());
+ QVERIFY(importSecretKeys(testKeyData, 1));
+ }
+
+ void init()
+ {
+ // set up a copy of the test fixture for each test function
+ mGnupgHomeTestCopy.reset(new QTemporaryDir{});
+ QVERIFY(copyKeyrings(mGnupgHomeTestFixture.path(), mGnupgHomeTestCopy->path()));
+ qputenv("GNUPGHOME", mGnupgHomeTestCopy->path().toUtf8());
+ }
+
+ void testAsync()
+ {
+ // Get the key that shall be revoked
+ auto key = getTestKey("revoke-me@example.net");
+ QVERIFY(!key.isNull());
+ QVERIFY(!key.isRevoked());
+
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ hookUpPassphraseProvider(job.get());
+
+ Error result;
+ connect(job.get(), &RevokeKeyJob::result,
+ job.get(), [this, &result](const Error &result_) {
+ result = result_;
+ Q_EMIT asyncDone();
+ });
+ QVERIFY(!job->start(key, RevocationReason::NoLongerUsed,
+ {"This key is not used anymore."}));
+ job.release(); // after the job has been started it's on its own
+
+ QSignalSpy spy (this, SIGNAL(asyncDone()));
+ QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
+
+ QVERIFY(result.code() == GPG_ERR_NO_ERROR);
+ key.update();
+ QVERIFY(key.isRevoked());
+ verifyReason(key, RevocationReason::NoLongerUsed,
+ {"This key is not used anymore."});
+ }
+
+ void testSync_noReasonDescription()
+ {
+ // Get the key that shall be revoked
+ auto key = getTestKey("revoke-me@example.net");
+ QVERIFY(!key.isNull());
+ QVERIFY(!key.isRevoked());
+
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ hookUpPassphraseProvider(job.get());
+
+ const auto result = job->exec(key);
+
+ QVERIFY(result.code() == GPG_ERR_NO_ERROR);
+ key.update();
+ QVERIFY(key.isRevoked());
+ verifyReason(key, RevocationReason::Unspecified, {});
+ }
+
+ void testSync_oneLineReasonDescription()
+ {
+ // Get the key that shall be revoked
+ auto key = getTestKey("revoke-me@example.net");
+ QVERIFY(!key.isNull());
+ QVERIFY(!key.isRevoked());
+
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ hookUpPassphraseProvider(job.get());
+
+ const auto result = job->exec(key, RevocationReason::Compromised,
+ {"The secret key was stolen."});
+
+ QVERIFY(result.code() == GPG_ERR_NO_ERROR);
+ key.update();
+ QVERIFY(key.isRevoked());
+ verifyReason(key, RevocationReason::Compromised,
+ {"The secret key was stolen."});
+ }
+
+ void testSync_twoLinesReasonDescription()
+ {
+ // Get the key that shall be revoked
+ auto key = getTestKey("revoke-me@example.net");
+ QVERIFY(!key.isNull());
+ QVERIFY(!key.isRevoked());
+
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ hookUpPassphraseProvider(job.get());
+
+ const auto result = job->exec(key, RevocationReason::Superseded,
+ {"This key has been superseded by key",
+ "0000 1111 2222 3333 4444 5555 6666 7777 8888 9999."});
+
+ QVERIFY(result.code() == GPG_ERR_NO_ERROR);
+ key.update();
+ QVERIFY(key.isRevoked());
+ verifyReason(key, RevocationReason::Superseded,
+ {"This key has been superseded by key",
+ "0000 1111 2222 3333 4444 5555 6666 7777 8888 9999."});
+ }
+
+ void testErrorHandling_nullKey()
+ {
+ {
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ QTest::ignoreMessage(QtWarningMsg, "Error: Key is null key");
+ const auto result = job->exec(Key{});
+ QVERIFY(result.code() == GPG_ERR_INV_ARG);
+ }
+ {
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ QTest::ignoreMessage(QtWarningMsg, "Error: Key is null key");
+ const auto result = job->start(Key{});
+ QVERIFY(result.code() == GPG_ERR_INV_ARG);
+ }
+ }
+
+ void testErrorHandling_invalidReason()
+ {
+ // Get the key that shall be revoked
+ auto key = getTestKey("revoke-me@example.net");
+ QVERIFY(!key.isNull());
+ QVERIFY(!key.isRevoked());
+
+ {
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression{"^Error: Invalid revocation reason"});
+ const auto result = job->exec(key, static_cast<RevocationReason>(-1));
+ QVERIFY(result.code() == GPG_ERR_INV_VALUE);
+ }
+ {
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression{"^Error: Invalid revocation reason"});
+ const auto result = job->start(key, static_cast<RevocationReason>(4));
+ QVERIFY(result.code() == GPG_ERR_INV_VALUE);
+ }
+ }
+
+ void testErrorHandling_invalidDescription()
+ {
+ // Get the key that shall be revoked
+ auto key = getTestKey("revoke-me@example.net");
+ QVERIFY(!key.isNull());
+ QVERIFY(!key.isRevoked());
+
+ {
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ QTest::ignoreMessage(QtWarningMsg, "Error: Revocation description contains empty lines or lines with endline characters");
+ const auto result = job->exec(key, RevocationReason::Unspecified,
+ {"line1", "", "line3"});
+ QVERIFY(result.code() == GPG_ERR_INV_VALUE);
+ }
+ {
+ auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
+ QTest::ignoreMessage(QtWarningMsg, "Error: Revocation description contains empty lines or lines with endline characters");
+ const auto result = job->start(key, RevocationReason::Unspecified,
+ {"line1\nline2"});
+ QVERIFY(result.code() == GPG_ERR_INV_VALUE);
+ }
+ }
+
+private:
+ Key getTestKey(const char *pattern)
+ {
+ auto ctx = Context::create(OpenPGP);
+ VERIFY_OR_OBJECT(ctx);
+
+ Error err;
+ auto key = ctx->key(pattern, err, /*secret=*/true);
+ VERIFY_OR_OBJECT(!err);
+ VERIFY_OR_OBJECT(!key.isNull());
+ return key;
+ }
+
+ bool verifyReason(const Key &key, RevocationReason reason, const QStringList &description)
+ {
+ static const auto startTimeout = std::chrono::milliseconds{1000};
+ static const auto finishTimeout = std::chrono::milliseconds{2000};
+ static const QStringList hexCodeForReason = {
+ QStringLiteral("00"), /* no particular reason */
+ QStringLiteral("02"), /* key has been compromised */
+ QStringLiteral("01"), /* key is superseded */
+ QStringLiteral("03") /* key is no longer used */
+ };
+
+ QProcess p;
+ p.setProgram(dirInfo("gpg-name"));
+ p.setArguments({QStringLiteral("-K"),
+ QStringLiteral("--with-colon"),
+ QStringLiteral("--with-sig-list"),
+ QLatin1String{key.primaryFingerprint()}
+ });
+
+ p.start();
+
+ if (!p.waitForStarted(startTimeout.count())) {
+ qWarning() << "Timeout while waiting for start of" << p.program() << p.arguments().join(u' ');
+ return false;
+ }
+ if (!p.waitForFinished(finishTimeout.count())) {
+ qWarning() << "Timeout while waiting for completion of" << p.program() << p.arguments().join(u' ');
+ return false;
+ }
+ if (p.exitStatus() != QProcess::NormalExit) {
+ qWarning() << p.program() << "terminated abnormally with exit status" << p.exitStatus();
+ return false;
+ }
+
+ const auto lines = QString::fromUtf8(p.readAllStandardOutput()).split(u'\n');
+ for (const auto &l : lines) {
+ const auto fields = l.split(u':');
+ if (fields[0] == QLatin1String{"rev"}) {
+ // or "rev" the signature class may be followed by a comma
+ // and a 2 digit hexnumber with the revocation reason
+ const auto sigClass = fields.value(10);
+ const auto revReason = sigClass.split(u',').value(1);
+ COMPARE_OR_FALSE(revReason, hexCodeForReason.value(static_cast<int>(reason)));
+
+ // decode the \n in the C-style quoted comment field
+ const auto comment = fields.value(20).replace(QStringLiteral("\\n"), QStringLiteral("\n"));
+ COMPARE_OR_FALSE(comment, description.join(u'\n'));
+ return true;
+ }
+ if (fields[0] == QLatin1String{"uid"}) {
+ qWarning() << "Found uid before rev in key listing:\n" << stdout;
+ return false;
+ }
+ }
+ return false;
+ }
+
+private:
+ QTemporaryDir mGnupgHomeTestFixture;
+ std::unique_ptr<QTemporaryDir> mGnupgHomeTestCopy;
+};
+
+QTEST_MAIN(RevokeKeyJobTest)
+
+#include "t-revokekey.moc"
diff --git a/lang/qt/tests/t-setprimaryuserid.cpp b/lang/qt/tests/t-setprimaryuserid.cpp
new file mode 100644
index 0000000..c1bd106
--- /dev/null
+++ b/lang/qt/tests/t-setprimaryuserid.cpp
@@ -0,0 +1,165 @@
+/* t-setprimaryuserid.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "t-support.h"
+
+#include <keylistjob.h>
+#include <protocol.h>
+
+#include <context.h>
+#include <engineinfo.h>
+#include <keylistresult.h>
+
+using namespace QGpgME;
+using namespace GpgME;
+
+class TestSetPrimaryUserID: public QGpgMETest
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void testSetPrimaryUserID()
+ {
+ Key key;
+ {
+ std::unique_ptr<KeyListJob> job{openpgp()->keyListJob()};
+ std::vector<GpgME::Key> keys;
+ GpgME::KeyListResult result = job->exec({QStringLiteral("alfa@example.net")}, true, keys);
+ QVERIFY(!result.error());
+ QVERIFY(keys.size() == 1);
+ key = keys.front();
+ }
+
+ QCOMPARE(key.numUserIDs(), 3u);
+ const std::string oldPrimaryUserId = key.userID(0).id();
+ const std::string newPrimaryUserId = key.userID(1).id();
+ const std::string newPrimaryUserIdHash = key.userID(1).uidhash();
+
+ {
+ std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
+ QVERIFY(ctx);
+ hookUpPassphraseProvider(ctx.get());
+
+ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.3.8") {
+ QVERIFY(!ctx->setPrimaryUid(key, newPrimaryUserIdHash.c_str()));
+ } else {
+ QVERIFY(!ctx->setPrimaryUid(key, newPrimaryUserId.c_str()));
+ }
+ }
+ key.update();
+
+ QCOMPARE(key.userID(0).id(), newPrimaryUserId);
+
+ {
+ std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
+ QVERIFY(ctx);
+ hookUpPassphraseProvider(ctx.get());
+
+ QVERIFY(!ctx->setPrimaryUid(key, oldPrimaryUserId.c_str()));
+ }
+ key.update();
+
+ QCOMPARE(key.userID(0).id(), oldPrimaryUserId);
+ }
+
+ void testErrorHandling_noSecretKey()
+ {
+ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.3.8") {
+ QSKIP("gpg < 2.3.8 does not report status error");
+ }
+ Key key;
+ {
+ std::unique_ptr<KeyListJob> job{openpgp()->keyListJob()};
+ std::vector<GpgME::Key> keys;
+ GpgME::KeyListResult result = job->exec({QStringLiteral("bravo@example.net")}, false, keys);
+ QVERIFY(!result.error());
+ QVERIFY(keys.size() == 1);
+ key = keys.front();
+ }
+
+ QCOMPARE(key.numUserIDs(), 2u);
+ const std::string newPrimaryUserId = key.userID(1).id();
+
+ {
+ std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
+ QVERIFY(ctx);
+ auto err = ctx->setPrimaryUid(key, newPrimaryUserId.c_str());
+ QCOMPARE(err.code(), static_cast<int>(GPG_ERR_NO_SECKEY));
+ }
+ }
+
+ void testErrorHandling_noUserID()
+ {
+ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.3.8") {
+ QSKIP("gpg < 2.3.8 does not report status error");
+ }
+ Key key;
+ {
+ std::unique_ptr<KeyListJob> job{openpgp()->keyListJob()};
+ std::vector<GpgME::Key> keys;
+ GpgME::KeyListResult result = job->exec({QStringLiteral("alfa@example.net")}, true, keys);
+ QVERIFY(!result.error());
+ QVERIFY(keys.size() == 1);
+ key = keys.front();
+ }
+ {
+ std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
+ QVERIFY(ctx);
+ auto err = ctx->setPrimaryUid(key, "bravo");
+ QCOMPARE(err.code(), static_cast<int>(GPG_ERR_NO_USER_ID));
+ }
+ }
+
+ void initTestCase()
+ {
+ QGpgMETest::initTestCase();
+ const QString gpgHome = qgetenv("GNUPGHOME");
+ QVERIFY(copyKeyrings(gpgHome, mDir.path()));
+ qputenv("GNUPGHOME", mDir.path().toUtf8());
+ QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
+ QVERIFY(conf.open(QIODevice::WriteOnly));
+ if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.2.18") {
+ conf.write("allow-weak-key-signatures\n");
+ }
+ conf.close();
+ }
+
+private:
+ QTemporaryDir mDir;
+};
+
+QTEST_MAIN(TestSetPrimaryUserID)
+
+#include "t-setprimaryuserid.moc"
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
index b630350..336ad34 100644
--- a/lang/qt/tests/t-various.cpp
+++ b/lang/qt/tests/t-various.cpp
@@ -328,8 +328,6 @@ private Q_SLOTS:
}
});
- QTest::ignoreMessage(QtWarningMsg, "Expiration of certification has been changed to QDate(\"2106-02-06\")");
-
job->start(target);
QSignalSpy spy{this, &TestVarious::asyncDone};
QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
@@ -339,7 +337,15 @@ private Q_SLOTS:
const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
QVERIFY(!keySignature.neverExpires());
const auto expirationDate = QDateTime::fromSecsSinceEpoch(uint_least32_t(keySignature.expirationTime())).date();
- QCOMPARE(expirationDate, QDate(2106, 2, 6)); // expiration date is capped at 2106-02-06
+ // expiration date is capped at 2106-02-05; we also allow 2106-02-04 as expiration date because for locations that use DST
+ // the expiration date may be 2106-02-04-23:xx:xx (in local non-DST time) if the current time is 00:xx::xx (in local DST time)
+ const auto expectedExpirationRange = std::make_pair(QDate{2106, 2, 4}, QDate{2106, 2, 5});
+ QVERIFY2(expirationDate >= expectedExpirationRange.first,
+ ("\n Actual : " + expirationDate.toString(Qt::ISODate).toLatin1() +
+ "\n Expected: " + expectedExpirationRange.first.toString(Qt::ISODate).toLatin1()).constData());
+ QVERIFY2(expirationDate <= expectedExpirationRange.second,
+ ("\n Actual : " + expirationDate.toString(Qt::ISODate).toLatin1() +
+ "\n Expected: " + expectedExpirationRange.second.toString(Qt::ISODate).toLatin1()).constData());
}
void testVersion()
diff --git a/lang/qt/tests/t-verify.cpp b/lang/qt/tests/t-verify.cpp
index e6b0c8a..0dbecf7 100644
--- a/lang/qt/tests/t-verify.cpp
+++ b/lang/qt/tests/t-verify.cpp
@@ -81,7 +81,7 @@ private Q_SLOTS:
QVERIFY(!key.isNull());
bool found = false;
- for (const auto subkey: key.subkeys()) {
+ for (const auto &subkey: key.subkeys()) {
if (!strcmp (subkey.fingerprint(), sig.fingerprint())) {
found = true;
}
diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4
new file mode 100644
index 0000000..fa4e089
--- /dev/null
+++ b/m4/ax_gcc_func_attribute.m4
@@ -0,0 +1,242 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
+#
+# DESCRIPTION
+#
+# This macro checks if the compiler supports one of GCC's function
+# attributes; many other compilers also provide function attributes with
+# the same syntax. Compiler warnings are used to detect supported
+# attributes as unsupported ones are ignored by default so quieting
+# warnings when using this macro will yield false positives.
+#
+# The ATTRIBUTE parameter holds the name of the attribute to be checked.
+#
+# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
+#
+# The macro caches its result in the ax_cv_have_func_attribute_<attribute>
+# variable.
+#
+# The macro currently supports the following function attributes:
+#
+# alias
+# aligned
+# alloc_size
+# always_inline
+# artificial
+# cold
+# const
+# constructor
+# constructor_priority for constructor attribute with priority
+# deprecated
+# destructor
+# dllexport
+# dllimport
+# error
+# externally_visible
+# fallthrough
+# flatten
+# format
+# format_arg
+# gnu_format
+# gnu_inline
+# hot
+# ifunc
+# leaf
+# malloc
+# noclone
+# noinline
+# nonnull
+# noreturn
+# nothrow
+# optimize
+# pure
+# sentinel
+# sentinel_position
+# unused
+# used
+# visibility
+# warning
+# warn_unused_result
+# weak
+# weakref
+#
+# Unsupported function attributes will be tested with a prototype
+# returning an int and not accepting any arguments and the result of the
+# check might be wrong or meaningless so use with care.
+#
+# LICENSE
+#
+# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 13
+
+AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
+ AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
+
+ AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ m4_case([$1],
+ [alias], [
+ int foo( void ) { return 0; }
+ int bar( void ) __attribute__(($1("foo")));
+ ],
+ [aligned], [
+ int foo( void ) __attribute__(($1(32)));
+ ],
+ [alloc_size], [
+ void *foo(int a) __attribute__(($1(1)));
+ ],
+ [always_inline], [
+ inline __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [artificial], [
+ inline __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [cold], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [const], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [constructor_priority], [
+ int foo( void ) __attribute__((__constructor__(65535/2)));
+ ],
+ [constructor], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [deprecated], [
+ int foo( void ) __attribute__(($1("")));
+ ],
+ [destructor], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [dllexport], [
+ __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [dllimport], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [error], [
+ int foo( void ) __attribute__(($1("")));
+ ],
+ [externally_visible], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [fallthrough], [
+ void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }};
+ ],
+ [flatten], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [format], [
+ int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
+ ],
+ [gnu_format], [
+ int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2)));
+ ],
+ [format_arg], [
+ char *foo(const char *p) __attribute__(($1(1)));
+ ],
+ [gnu_inline], [
+ inline __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [hot], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [ifunc], [
+ int my_foo( void ) { return 0; }
+ static int (*resolve_foo(void))(void) { return my_foo; }
+ int foo( void ) __attribute__(($1("resolve_foo")));
+ ],
+ [leaf], [
+ __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [malloc], [
+ void *foo( void ) __attribute__(($1));
+ ],
+ [noclone], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [noinline], [
+ __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [nonnull], [
+ int foo(char *p) __attribute__(($1(1)));
+ ],
+ [noreturn], [
+ void foo( void ) __attribute__(($1));
+ ],
+ [nothrow], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [optimize], [
+ __attribute__(($1(3))) int foo( void ) { return 0; }
+ ],
+ [pure], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [sentinel], [
+ int foo(void *p, ...) __attribute__(($1));
+ ],
+ [sentinel_position], [
+ int foo(void *p, ...) __attribute__(($1(1)));
+ ],
+ [returns_nonnull], [
+ void *foo( void ) __attribute__(($1));
+ ],
+ [unused], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [used], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [visibility], [
+ int foo_def( void ) __attribute__(($1("default")));
+ int foo_hid( void ) __attribute__(($1("hidden")));
+ int foo_int( void ) __attribute__(($1("internal")));
+ int foo_pro( void ) __attribute__(($1("protected")));
+ ],
+ [warning], [
+ int foo( void ) __attribute__(($1("")));
+ ],
+ [warn_unused_result], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [weak], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [weakref], [
+ static int foo( void ) { return 0; }
+ static int bar( void ) __attribute__(($1("foo")));
+ ],
+ [
+ m4_warn([syntax], [Unsupported attribute $1, the test may fail])
+ int foo( void ) __attribute__(($1));
+ ]
+ )], [])
+ ],
+ dnl GCC doesn't exit with an error if an unknown attribute is
+ dnl provided but only outputs a warning, so accept the attribute
+ dnl only if no warning were issued.
+ [AS_IF([grep -- -Wattributes conftest.err],
+ [AS_VAR_SET([ac_var], [no])],
+ [AS_VAR_SET([ac_var], [yes])])],
+ [AS_VAR_SET([ac_var], [no])])
+ ])
+
+ AS_IF([test yes = AS_VAR_GET([ac_var])],
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
+ [Define to 1 if the system has the `$1' function attribute])], [])
+
+ AS_VAR_POPDEF([ac_var])
+])
diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4
index cb28430..ec3fc9a 100644
--- a/m4/glib-2.0.m4
+++ b/m4/glib-2.0.m4
@@ -87,7 +87,7 @@ dnl Now check if the installed GLIB is sufficiently new. (Also sanity
dnl checks the results of pkg-config to some extent)
dnl
rm -f conf.glibtest
- AC_TRY_RUN([
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
@@ -158,7 +158,7 @@ main ()
}
return 1;
}
-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+]])],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
@@ -180,10 +180,9 @@ main ()
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
- AC_TRY_LINK([
-#include <glib.h>
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <glib.h>
#include <stdio.h>
-], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+]], [[ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ]])],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4
index 56a5d07..4b5cd40 100644
--- a/m4/gpg-error.m4
+++ b/m4/gpg-error.m4
@@ -10,7 +10,7 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# Last-changed: 2021-03-31
+# Last-changed: 2022-02-15
dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION,
@@ -139,6 +139,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR],
fi
elif test "$GPG_ERROR_CONFIG" != "no"; then
gpg_error_config_version=`$GPG_ERROR_CONFIG --version`
+ unset GPGRT_CONFIG
fi
if test "$GPG_ERROR_CONFIG" != "no"; then
req_major=`echo $min_gpg_error_version | \
diff --git a/src/Makefile.am b/src/Makefile.am
index 39c341f..67805a8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,11 @@ EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \
gpgme.h.in versioninfo.rc.in gpgme.def \
gpgme.pc.in gpgme-glib.pc.in
+if USE_GPGRT_CONFIG
+noinst_SCRIPTS = gpgme-config
+else
bin_SCRIPTS = gpgme-config
+endif
m4datadir = $(datadir)/aclocal
m4data_DATA = gpgme.m4
nodist_include_HEADERS = gpgme.h
diff --git a/src/Makefile.in b/src/Makefile.in
index 65d40af..88c5835 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -116,6 +116,7 @@ bin_PROGRAMS = gpgme-tool$(EXEEXT) gpgme-json$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -248,7 +249,7 @@ gpgme_tool_DEPENDENCIES = libgpgme.la
gpgme_w32spawn_SOURCES = gpgme-w32spawn.c
gpgme_w32spawn_OBJECTS = gpgme-w32spawn.$(OBJEXT)
gpgme_w32spawn_LDADD = $(LDADD)
-SCRIPTS = $(bin_SCRIPTS)
+SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -409,6 +410,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
@@ -564,7 +566,8 @@ EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \
gpgme.h.in versioninfo.rc.in gpgme.def \
gpgme.pc.in gpgme-glib.pc.in
-bin_SCRIPTS = gpgme-config
+@USE_GPGRT_CONFIG_TRUE@noinst_SCRIPTS = gpgme-config
+@USE_GPGRT_CONFIG_FALSE@bin_SCRIPTS = gpgme-config
m4datadir = $(datadir)/aclocal
m4data_DATA = gpgme.m4
nodist_include_HEADERS = gpgme.h
diff --git a/src/assuan-support.c b/src/assuan-support.c
index 0ddf29b..0bc003b 100644
--- a/src/assuan-support.c
+++ b/src/assuan-support.c
@@ -27,10 +27,20 @@
#include <stdlib.h>
#include <errno.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifndef HAVE_W32_SYSTEM
+#include <unistd.h>
+#include <sys/wait.h>
+#endif
+
#include "assuan.h"
#include "gpgme.h"
-#include "ath.h"
#include "priv-io.h"
#include "debug.h"
@@ -62,8 +72,28 @@ _gpgme_assuan_log_cb (assuan_context_t ctx, void *hook,
static void
my_usleep (assuan_context_t ctx, unsigned int usec)
{
- /* FIXME: Add to ath. */
- __assuan_usleep (ctx, usec);
+ (void)ctx;
+
+ if (!usec)
+ return;
+
+#ifdef HAVE_W32_SYSTEM
+ Sleep (usec / 1000);
+#else
+# ifdef HAVE_NANOSLEEP
+ {
+ struct timespec req;
+ struct timespec rem;
+
+ req.tv_sec = usec / 1000000;
+ req.tv_nsec = (usec % 1000000) * 1000;
+ while (nanosleep (&req, &rem) < 0 && errno == EINTR)
+ req = rem;
+ }
+# else
+ usleep (usec);
+# endif
+#endif
}
@@ -294,7 +324,7 @@ my_waitpid (assuan_context_t ctx, pid_t pid,
NOWAIT in POSIX systems just means the caller already did the
waitpid for this child. */
if (! nowait)
- return _gpgme_ath_waitpid (pid, status, options);
+ return waitpid (pid, status, options);
#endif
return 0;
}
@@ -306,8 +336,8 @@ static int
my_socketpair (assuan_context_t ctx, int namespace, int style,
int protocol, assuan_fd_t filedes[2])
{
-#ifdef HAVE_W32_SYSTEM
(void)ctx;
+#ifdef HAVE_W32_SYSTEM
(void)namespace;
(void)style;
(void)protocol;
@@ -316,7 +346,7 @@ my_socketpair (assuan_context_t ctx, int namespace, int style,
return -1;
#else
/* FIXME: Debug output missing. */
- return __assuan_socketpair (ctx, namespace, style, protocol, filedes);
+ return socketpair (namespace, style, protocol, filedes);
#endif
}
diff --git a/src/decrypt.c b/src/decrypt.c
index f884799..896a873 100644
--- a/src/decrypt.c
+++ b/src/decrypt.c
@@ -44,10 +44,12 @@ typedef struct
int okay;
- /* A flag telling that the a decryption failed and an optional error
- * code to further specify the failure. */
+ /* A flag telling that the a decryption failed and two optional error
+ * codes to further specify the failure for public key decryption and
+ * symmetric decryption. */
int failed;
gpg_error_t pkdecrypt_failed;
+ gpg_error_t symdecrypt_failed;
/* At least one secret key is not available. gpg issues NO_SECKEY
* status lines for each key the message has been encrypted to but
@@ -228,7 +230,22 @@ parse_status_error (char *args, op_data_t opd)
opd->result.legacy_cipher_nomdc = 1;
opd->not_integrity_protected = 1;
}
+ else if (!strcmp (field[0], "symkey_decrypt.maybe_error"))
+ {
+ switch (gpg_err_code (err))
+ {
+ case GPG_ERR_BAD_PASSPHRASE:
+ /* A bad passphrase is severe enough that we return this
+ * error code. */
+ opd->symdecrypt_failed = err;
+ break;
+ default:
+ /* For now all other error codes are ignored and the
+ * standard DECRYPT_FAILED is returned. */
+ break;
+ }
+ }
/* Record the first error code. */
if (err && !opd->first_status_error)
opd->first_status_error = err;
@@ -376,6 +393,8 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
/* This comes from a specialized ERROR status line. */
if (opd->pkdecrypt_failed)
return opd->pkdecrypt_failed;
+ if (opd->symdecrypt_failed)
+ return opd->symdecrypt_failed;
/* For an integrity failure return just DECRYPTION_FAILED;
* the actual cause can be taken from an already set
diff --git a/src/engine-backend.h b/src/engine-backend.h
index 9b755a3..75ed49c 100644
--- a/src/engine-backend.h
+++ b/src/engine-backend.h
@@ -106,7 +106,8 @@ struct engine_ops
int secret_only, int reserved,
gpgme_keylist_mode_t mode,
int engine_flags);
- gpgme_error_t (*keylist_data) (void *engine, gpgme_data_t data);
+ gpgme_error_t (*keylist_data) (void *engine, gpgme_keylist_mode_t mode,
+ gpgme_data_t data);
gpgme_error_t (*keysign) (void *engine,
gpgme_key_t key, const char *userid,
unsigned long expires, unsigned int flags,
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 88a248d..3bf5223 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -3105,8 +3105,11 @@ gpg_keylist_build_options (engine_gpg_t gpg, int secret_only,
code. The problem is that we don't know the context
here and thus can't access the cached version number
for the engine info structure. */
- err = add_arg (gpg, "--locate-keys");
- if ((mode & GPGME_KEYLIST_MODE_SIGS))
+ if ((mode & GPGME_KEYLIST_MODE_FORCE_EXTERN))
+ err = add_arg (gpg, "--locate-external-keys");
+ else
+ err = add_arg (gpg, "--locate-keys");
+ if (!err && (mode & GPGME_KEYLIST_MODE_SIGS))
err = add_arg (gpg, "--with-sig-check");
}
else
@@ -3179,7 +3182,7 @@ gpg_keylist_ext (void *engine, const char *pattern[], int secret_only,
static gpgme_error_t
-gpg_keylist_data (void *engine, gpgme_data_t data)
+gpg_keylist_data (void *engine, gpgme_keylist_mode_t mode, gpgme_data_t data)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
@@ -3198,6 +3201,9 @@ gpg_keylist_data (void *engine, gpgme_data_t data)
err = add_arg (gpg, "--dry-run");
if (!err)
err = add_arg (gpg, "--import");
+ if (!err && (mode & GPGME_KEYLIST_MODE_SIGS)
+ && have_gpg_version (gpg, "2.0.10"))
+ err = add_arg (gpg, "--with-sig-check");
if (!err)
err = add_arg (gpg, "--");
if (!err)
diff --git a/src/engine.c b/src/engine.c
index db594cb..895b7e1 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -897,7 +897,8 @@ _gpgme_engine_op_keylist_ext (engine_t engine, const char *pattern[],
gpgme_error_t
-_gpgme_engine_op_keylist_data (engine_t engine, gpgme_data_t data)
+_gpgme_engine_op_keylist_data (engine_t engine, gpgme_keylist_mode_t mode,
+ gpgme_data_t data)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
@@ -905,7 +906,7 @@ _gpgme_engine_op_keylist_data (engine_t engine, gpgme_data_t data)
if (!engine->ops->keylist_data)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
- return (*engine->ops->keylist_data) (engine->engine, data);
+ return (*engine->ops->keylist_data) (engine->engine, mode, data);
}
diff --git a/src/engine.h b/src/engine.h
index 8b45e13..d580d99 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -157,6 +157,7 @@ gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
gpgme_keylist_mode_t mode,
int engine_flags);
gpgme_error_t _gpgme_engine_op_keylist_data (engine_t engine,
+ gpgme_keylist_mode_t mode,
gpgme_data_t data);
gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
gpgme_data_t out, gpgme_sig_mode_t mode,
diff --git a/src/gpgme-json.c b/src/gpgme-json.c
index d3b8035..6077278 100644
--- a/src/gpgme-json.c
+++ b/src/gpgme-json.c
@@ -2471,6 +2471,11 @@ op_keylist (cjson_t request, cjson_t result)
if (abool)
mode |= GPGME_KEYLIST_MODE_LOCATE;
+ if ((err = get_boolean_flag (request, "force-extern", 0, &abool)))
+ goto leave;
+ if (abool)
+ mode |= GPGME_KEYLIST_MODE_FORCE_EXTERN;
+
if (!mode)
{
/* default to local */
diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c
index e45ea12..7d3ca16 100644
--- a/src/gpgme-tool.c
+++ b/src/gpgme-tool.c
@@ -1459,6 +1459,8 @@ gt_get_keylist_mode (gpgme_tool_t gt)
modes[idx++] = "ephemeral";
if (mode & GPGME_KEYLIST_MODE_VALIDATE)
modes[idx++] = "validate";
+ if (mode & GPGME_KEYLIST_MODE_FORCE_EXTERN)
+ modes[idx++] = "force_extern";
modes[idx++] = NULL;
gt_write_status (gt, STATUS_KEYLIST_MODE, modes[0], modes[1], modes[2],
@@ -2200,6 +2202,8 @@ cmd_keylist_mode (assuan_context_t ctx, char *line)
mode |= GPGME_KEYLIST_MODE_EPHEMERAL;
if (strstr (line, "validate"))
mode |= GPGME_KEYLIST_MODE_VALIDATE;
+ if (strstr (line, "force_extern"))
+ mode |= GPGME_KEYLIST_MODE_FORCE_EXTERN;
return gt_set_keylist_mode (server->gt, mode);
}
diff --git a/src/gpgme.c b/src/gpgme.c
index 6a5232e..2c5b51e 100644
--- a/src/gpgme.c
+++ b/src/gpgme.c
@@ -782,6 +782,10 @@ gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode)
if (!ctx)
return gpg_error (GPG_ERR_INV_VALUE);
+ if ((mode & GPGME_KEYLIST_MODE_LOCATE_EXTERNAL) ==
+ (GPGME_KEYLIST_MODE_LOCAL|GPGME_KEYLIST_MODE_FORCE_EXTERN))
+ return gpg_error (GPG_ERR_INV_VALUE);
+
ctx->keylist_mode = mode;
return 0;
}
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 0f7c361..502d68c 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -382,8 +382,10 @@ gpgme_protocol_t;
#define GPGME_KEYLIST_MODE_WITH_KEYGRIP 64
#define GPGME_KEYLIST_MODE_EPHEMERAL 128
#define GPGME_KEYLIST_MODE_VALIDATE 256
+#define GPGME_KEYLIST_MODE_FORCE_EXTERN 512
#define GPGME_KEYLIST_MODE_LOCATE (1|2)
+#define GPGME_KEYLIST_MODE_LOCATE_EXTERNAL (1|2|512)
typedef unsigned int gpgme_keylist_mode_t;
diff --git a/src/import.c b/src/import.c
index 85c459b..cd9f960 100644
--- a/src/import.c
+++ b/src/import.c
@@ -266,8 +266,8 @@ parse_error (char *args, gpgme_import_status_t *import_status)
}
-static gpgme_error_t
-import_status_handler (void *priv, gpgme_status_code_t code, char *args)
+gpgme_error_t
+_gpgme_import_status_handler (void *priv, gpgme_status_code_t code, char *args)
{
gpgme_ctx_t ctx = (gpgme_ctx_t) priv;
gpgme_error_t err;
@@ -311,28 +311,42 @@ import_status_handler (void *priv, gpgme_status_code_t code, char *args)
}
-static gpgme_error_t
-_gpgme_op_import_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t keydata)
+gpgme_error_t
+_gpgme_op_import_init_result (gpgme_ctx_t ctx)
{
gpgme_error_t err;
void *hook;
op_data_t opd;
- err = _gpgme_op_reset (ctx, synchronous);
- if (err)
- return err;
-
err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook,
sizeof (*opd), release_op_data);
opd = hook;
if (err)
return err;
+
opd->lastp = &opd->result.imports;
+ return 0;
+}
+
+
+static gpgme_error_t
+_gpgme_op_import_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t keydata)
+{
+ gpgme_error_t err;
+
+ err = _gpgme_op_reset (ctx, synchronous);
+ if (err)
+ return err;
+
+ err = _gpgme_op_import_init_result (ctx);
+ if (err)
+ return err;
if (!keydata)
return gpg_error (GPG_ERR_NO_DATA);
- _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx);
+ _gpgme_engine_set_status_handler (ctx->engine, _gpgme_import_status_handler,
+ ctx);
return _gpgme_engine_op_import (ctx->engine, keydata, NULL, NULL,
ctx->import_filter, ctx->key_origin);
@@ -380,20 +394,15 @@ _gpgme_op_import_keys_start (gpgme_ctx_t ctx, int synchronous,
gpgme_key_t *keys)
{
gpgme_error_t err;
- void *hook;
- op_data_t opd;
int idx, firstidx, nkeys;
err = _gpgme_op_reset (ctx, synchronous);
if (err)
return err;
- err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook,
- sizeof (*opd), release_op_data);
- opd = hook;
+ err = _gpgme_op_import_init_result (ctx);
if (err)
return err;
- opd->lastp = &opd->result.imports;
if (!keys)
return gpg_error (GPG_ERR_NO_DATA);
@@ -416,7 +425,8 @@ _gpgme_op_import_keys_start (gpgme_ctx_t ctx, int synchronous,
if (!nkeys)
return gpg_error (GPG_ERR_NO_DATA);
- _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx);
+ _gpgme_engine_set_status_handler (ctx->engine, _gpgme_import_status_handler,
+ ctx);
return _gpgme_engine_op_import (ctx->engine, NULL, keys, NULL,
ctx->import_filter, ctx->key_origin);
@@ -496,24 +506,20 @@ static gpgme_error_t
_gpgme_op_receive_keys_start (gpgme_ctx_t ctx, int synchronous, const char *keyids[])
{
gpgme_error_t err;
- void *hook;
- op_data_t opd;
err = _gpgme_op_reset (ctx, synchronous);
if (err)
return err;
- err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook,
- sizeof (*opd), release_op_data);
- opd = hook;
+ err = _gpgme_op_import_init_result (ctx);
if (err)
return err;
- opd->lastp = &opd->result.imports;
if (!keyids || !*keyids)
return gpg_error (GPG_ERR_NO_DATA);
- _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx);
+ _gpgme_engine_set_status_handler (ctx->engine, _gpgme_import_status_handler,
+ ctx);
return _gpgme_engine_op_import (ctx->engine, NULL, NULL, keyids,
ctx->import_filter, ctx->key_origin);
diff --git a/src/keylist.c b/src/keylist.c
index f2c90d2..1c01bd4 100644
--- a/src/keylist.c
+++ b/src/keylist.c
@@ -146,6 +146,12 @@ keylist_status_handler (void *priv, gpgme_status_code_t code, char *args)
err = 0;
break;
+ case GPGME_STATUS_IMPORT_OK:
+ case GPGME_STATUS_IMPORT_PROBLEM:
+ case GPGME_STATUS_IMPORT_RES:
+ err = _gpgme_import_status_handler (priv, code, args);
+ break;
+
default:
break;
}
@@ -417,6 +423,7 @@ parse_sec_field15 (gpgme_key_t key, gpgme_subkey_t subkey, char *field)
{
/* Fields starts with a hex digit; thus it is a serial number. */
key->secret = 1;
+ subkey->secret = 1;
subkey->is_cardkey = 1;
subkey->card_number = strdup (field);
if (!subkey->card_number)
@@ -1125,6 +1132,10 @@ gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, int secret_only)
if (err)
return TRACE_ERR (err);
+ err = _gpgme_op_import_init_result (ctx);
+ if (err)
+ return TRACE_ERR (err);
+
_gpgme_engine_set_status_handler (ctx->engine, keylist_status_handler, ctx);
err = _gpgme_engine_set_colon_line_handler (ctx->engine,
@@ -1169,6 +1180,10 @@ gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, const char *pattern[],
if (err)
return TRACE_ERR (err);
+ err = _gpgme_op_import_init_result (ctx);
+ if (err)
+ return TRACE_ERR (err);
+
_gpgme_engine_set_status_handler (ctx->engine, keylist_status_handler, ctx);
err = _gpgme_engine_set_colon_line_handler (ctx->engine,
keylist_colon_handler, ctx);
@@ -1210,13 +1225,17 @@ gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, gpgme_data_t data,
if (err)
return TRACE_ERR (err);
+ err = _gpgme_op_import_init_result (ctx);
+ if (err)
+ return TRACE_ERR (err);
+
_gpgme_engine_set_status_handler (ctx->engine, keylist_status_handler, ctx);
err = _gpgme_engine_set_colon_line_handler (ctx->engine,
keylist_colon_handler, ctx);
if (err)
return TRACE_ERR (err);
- err = _gpgme_engine_op_keylist_data (ctx->engine, data);
+ err = _gpgme_engine_op_keylist_data (ctx->engine, ctx->keylist_mode, data);
return TRACE_ERR (err);
}
diff --git a/src/ops.h b/src/ops.h
index 3b9728d..cde63a4 100644
--- a/src/ops.h
+++ b/src/ops.h
@@ -192,4 +192,16 @@ gpgme_error_t _gpgme_parse_notation (gpgme_sig_notation_t *notationp,
int type, int pkflags, int len,
char *data);
+
+/* From import.c. */
+
+/* Create an initial op data object for import. Needs to be called
+ once before calling _gpgme_import_status_handler. */
+gpgme_error_t _gpgme_op_import_init_result (gpgme_ctx_t ctx);
+
+/* Process a status line for import operations. */
+gpgme_error_t _gpgme_import_status_handler (void *priv,
+ gpgme_status_code_t code,
+ char *args);
+
#endif /* OPS_H */
diff --git a/src/posix-io.c b/src/posix-io.c
index 5c6cf1d..a422d8f 100644
--- a/src/posix-io.c
+++ b/src/posix-io.c
@@ -54,11 +54,18 @@
# include <dirent.h>
#endif /*USE_LINUX_GETDENTS*/
+#ifdef HAVE_POLL_H
+# include <poll.h>
+#else
+# ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+#endif
+#include <sys/socket.h>
#include "util.h"
#include "priv-io.h"
#include "sema.h"
-#include "ath.h"
#include "debug.h"
@@ -178,7 +185,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
do
{
- nread = _gpgme_ath_read (fd, buffer, count);
+ nread = read (fd, buffer, count);
}
while (nread == -1 && errno == EINTR);
@@ -197,7 +204,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
do
{
- nwritten = _gpgme_ath_write (fd, buffer, count);
+ nwritten = write (fd, buffer, count);
}
while (nwritten == -1 && errno == EINTR);
@@ -490,7 +497,7 @@ _gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal)
*r_status = 0;
*r_signal = 0;
do
- ret = _gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG);
+ ret = waitpid (pid, &status, hang? 0 : WNOHANG);
while (ret == (pid_t)(-1) && errno == EINTR);
if (ret == pid)
@@ -869,8 +876,7 @@ _gpgme_io_select_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
do
{
- count = _gpgme_ath_select (max_fd + 1, &readfds, &writefds, NULL,
- &timeout);
+ count = select (max_fd + 1, &readfds, &writefds, NULL, &timeout);
}
while (count < 0 && errno == EINTR);
if (count < 0)
@@ -946,7 +952,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags)
do
{
- nread = _gpgme_ath_recvmsg (fd, msg, flags);
+ nread = recvmsg (fd, msg, flags);
}
while (nread == -1 && errno == EINTR);
saved_errno = errno;
@@ -996,7 +1002,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags)
do
{
- nwritten = _gpgme_ath_sendmsg (fd, msg, flags);
+ nwritten = sendmsg (fd, msg, flags);
}
while (nwritten == -1 && errno == EINTR);
return TRACE_SYSRES (nwritten);
@@ -1041,7 +1047,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
"fd=%d addr=%p addrlen=%i", fd, addr, addrlen);
do
- res = ath_connect (fd, addr, addrlen);
+ res = connect (fd, addr, addrlen);
while (res == -1 && errno == EINTR);
return TRACE_SYSRES (res);
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 2eeeb6c..25d2a91 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -119,6 +119,7 @@ noinst_PROGRAMS = $(am__EXEEXT_1) run-keylist$(EXEEXT) \
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -404,6 +405,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in
index f24fffa..4d16ab6 100644
--- a/tests/gpg/Makefile.in
+++ b/tests/gpg/Makefile.in
@@ -114,6 +114,7 @@ noinst_PROGRAMS = $(am__EXEEXT_2) $(am__EXEEXT_4)
subdir = tests/gpg
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -423,6 +424,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/tests/gpg/t-edit-sign.c b/tests/gpg/t-edit-sign.c
index e0494c5..a3938b9 100644
--- a/tests/gpg/t-edit-sign.c
+++ b/tests/gpg/t-edit-sign.c
@@ -99,10 +99,8 @@ interact_fnc (void *opaque, const char *status, const char *args, int fd)
}
if (result)
- {
- gpgme_io_writen (fd, result, strlen (result));
- gpgme_io_writen (fd, "\n", 1);
- }
+ gpgme_io_writen (fd, result, strlen (result));
+ gpgme_io_writen (fd, "\n", 1);
return 0;
}
diff --git a/tests/gpgsm/Makefile.in b/tests/gpgsm/Makefile.in
index 0cd6a57..7fa39e7 100644
--- a/tests/gpgsm/Makefile.in
+++ b/tests/gpgsm/Makefile.in
@@ -114,6 +114,7 @@ noinst_PROGRAMS = $(am__EXEEXT_1) t-genkey$(EXEEXT) \
subdir = tests/gpgsm
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -326,6 +327,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/tests/json/Makefile.in b/tests/json/Makefile.in
index eae5ea7..b484738 100644
--- a/tests/json/Makefile.in
+++ b/tests/json/Makefile.in
@@ -112,6 +112,7 @@ noinst_PROGRAMS = $(am__EXEEXT_1)
subdir = tests/json
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -274,6 +275,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/tests/opassuan/Makefile.in b/tests/opassuan/Makefile.in
index e1d4220..4e7c454 100644
--- a/tests/opassuan/Makefile.in
+++ b/tests/opassuan/Makefile.in
@@ -112,6 +112,7 @@ noinst_PROGRAMS = $(am__EXEEXT_1) t-command$(EXEEXT)
subdir = tests/opassuan
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -277,6 +278,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
diff --git a/tests/run-sign.c b/tests/run-sign.c
index 55b2e48..37211d7 100644
--- a/tests/run-sign.c
+++ b/tests/run-sign.c
@@ -86,6 +86,7 @@ show_usage (int ex)
" --key NAME use key NAME for signing\n"
" --sender MBOX use MBOX as sender address\n"
" --include-key-block use this option with gpg\n"
+ " --clear create a clear text signature\n"
, stderr);
exit (ex);
}
@@ -172,6 +173,11 @@ main (int argc, char **argv)
include_key_block = 1;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--clear"))
+ {
+ sigmode = GPGME_SIG_MODE_CLEAR;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);