* src/keylist.c (gpgme_op_keylist_from_data_start): Call
_gpgme_op_import_init_result.
--
This fixes a crash when importing keys from data. Initializing the
import result was missing for this keylist operation.
Fixes-commit: f3ca57dfd7
GnuPG-bug-id: 5951
* src/keylist.c (parse_sec_field15): Set SECRET flag.
--
Explicitly setting the SECRET flag for subkeys stored on smart cards
makes sure that the flag is also set if GPGME_KEYLIST_MODE_WITH_SECRET
is used when listing OpenPGP keys (as documented in the API
documentation). If secret keys are listed, then the flag is already set
when the packet type is parsed.
GnuPG-bug-id: 5965
* 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.
--
This makes it easier to check those properties for different keys, e.g.
with the run-keylist test program.
GnuPG-bug-id: 5965
* lang/cpp/tests/run-keylist.cpp (main): Handle --with-secret option.
Print error for unknown option.
--
The --with-secret option was already listed in the help. Now it also
works.
GnuPG-bug-id: 5965
* lang/qt/src/refreshkeysjob.h (RefreshKeysJob::result): Remove optional
parameters auditLogAsHtml and auditLogError.
* lang/qt/tests/run-refreshkeysjob.cpp (main): Update accordingly.
--
This reverts f4c3560925. The reason for
the previous change does no longer apply.
GnuPG-bug-id: 5951
* 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.
--
This adds RefreshOpenPGPKeysJob complementing RefreshKeysJob (for S/MIME
keys). Changing the result type of RefreshKeysJob would break the ABI.
Therefore we have to introduce a new base class for the refresh job for
OpenPGP. We derive this base class from AbstractImportJob because we
want to return an import result.
GnuPG-bug-id: 5951
* 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.
--
Adding Import to lastop for keylist operations that perform a locate
allows retrieving the import result with Context::importResult.
GnuPG-bug-id: 5951
* 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.
--
If a keylist operation with keylist mode GPGME_KEYLIST_MODE_LOCATE is
run, then gpg emits import status lines. Handling those status lines
allows users to retrieve the result of a --locate-(external)-keys
command.
GnuPG-bug-id: 5951
* lang/cpp/src/importresult.h, lang/cpp/src/importresult.cpp (class
ImportResult): Add member function mergeWith.
--
This allows creating a consolidated result of several independent
imports. If the import results to merge considered the same keys, then
not all counts can be consolidated correctly, but the important numbers
like the number of considered keys, the number of imported keys, the
number of unchanged keys and the numbers of new user IDs, subkeys,
signatures and revocations should be correct.
GnuPG-bug-id: 5951
* lang/qt/src/protocol_p.h (Protocol::locateKeysJob): Use Locate alias
instead of Extern|Local.
* lang/qt/src/qgpgmekeyformailboxjob.cpp (do_work): Ditto.
--
* 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.
--
The new job performs a --locate-external-keys for the email addresses
of all not revoked user IDs of the given keys, and it performs a
--recv-keys for the fingerprints of the given keys. The former may
import new keys from WKD or an LDAP server or via some other
(hopefully trusted) auto-key-locate mechanism.
GnuPG-bug-id: 5951
* lang/cpp/src/context.h, lang/cpp/src/context.cpp (class Context):
Add nested class KeyListModeSaver.
--
This RAII-style class can be used to save the currently used key list
mode in case it needs to be changed temporarily. On destruction, it
will restore the key list mode that was active at construction time.
GnuPG-bug-id: 5951
* 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.
--
For now output stdout and stderr of gpgsm process as debug log. In
particular, this "adds" the missing slot slotStdout.
GnuPG-bug-id: 5951
* lang/qt/src/refreshkeysjob.h (RefreshKeysJob::result): Add optional
parameters auditLogAsHtml and auditLogError.
--
This is necessary for the OpenPGP-implementation of this job.
GnuPG-bug-id: 5951
* 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.
--
The new overload makes it easier to refresh some keys if one does
already have Keys.
GnuPG-bug-id: 5951
* 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.
--
To avoid confusion with a similar job for OpenPGP keys with a completely
different implementation, we rename this class to make clear that it is
specific for S/MIME keys.
GnuPG-bug-id: 5951
* lang/cpp/tests/run-getkey.cpp, lang/cpp/tests/run-keylist.cpp (main):
Check used keylist mode.
--
Since Context::setKeyListMode() does not return the error returned by
gpgme, we need to verify explicitly that the keylist mode was set
successfully.
GnuPG-bug-id: 5951
* 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.
--
GnuPG-bug-id: 5951
* lang/qt/src/qgpgmedecryptverifyjob.cpp (patch_decryption_result):
Removed.
(decrypt_verify): Remove usage of patch_decryption_result.
--
This reverts most of revision d8e5871dca.
GnuPG-bug-id: 5939
* 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.
--
Return a bad passphrase error if the failure during symmetric decryption
is likely caused by the user entering a wrong passphrase. The special
error code of a failed public key decryption takes precedence.
GnuPG-bug-id: 5939
* lang/qt/src/qgpgmedecryptverifyjob.cpp (patch_decryption_result): New.
(decrypt_verify): Call patch_decryption_result.
--
Replace the generic "decryption failed" error with the more specific
"bad passphrase" error if the audit log indicates that a wrong symmetric
password caused the decryption to fail.
GnuPG-bug-id: 5939
* lang/cpp/src/result.h (class Result): Add member function setError.
--
This can be used to replace the error of a result with a more suitable
error.
GnuPG-bug-id: 5939
* lang/cpp/src/editinteractor.cpp
(CallbackHelper::edit_interactor_callback_impl): Check for error _or_
canceled state.
--
Without this canceling an edit operation resulted in a "General error".
GnuPG-bug-id: 5904
* lang/cpp/src/editinteractor.cpp, lang/cpp/src/editinteractor.h
(EditInteractor::parseStatusError): New.
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp
(GpgRevokeKeyEditInteractor::Private::nextState): Handle status
error.
--
With this change the interactor returns a proper error like "Bad
Passphrase" or "Empty Passphrase" instead of an unspecific "General
Error" if a status error occurred.
GnuPG-bug-id: 5904
* 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.
--
Check that the key is not a null key, that the reason has a valid
value, and that the description lines do not contain endline characters
and are not empty.
GnuPG-bug-id: 5904
* 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.
--
gpgme doesn't parse the information, so we run gpg manually to verify
the revocation reason and the description.
GnuPG-bug-id: 5904
* configure.ac: Add -fvisibility=hidden to GPGME_QT_CFLAGS if gcc
supports the flag.
--
With this change all defined symbols are hidden by default, so that they
are not exported anymore. All symbols that are part of the ABI and that
shall still be exported are already marked as having default visibility.
GnuPG-bug-id: 5906
* 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.
--
With this change all defined symbols are hidden by default, so that they
are not exported anymore. All symbols that are part of the ABI and that
shall still be exported are already marked as having default visibility.
The m4 macro was taken from the website mentioned in the License header
of the file.
GnuPG-bug-id: 5906
--
These lines were accidentally added with the documentation for
gpgme_op_setexpire. The actual documentation for gpgme_op_revuid_start
is a bit further down.