* tests/gpg/t-support.h (fail_with_syserr): New.
(check_data): Use it to avoid compiler warnings.
* tests/run-support.h (fail_with_syserr): New.
--
I don't think that there is a way to tell gcc that
gpgme_err_code_from_errno will never return 0. Thus we better use a
different macro.
* lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Use
QByteArray overload of QString::fromUtf8.
--
There's no need to make the code more complicated than necessary. Unless
we want to provoke weird compiler warnings. :-)
* lang/qt/src/qgpgmeexportjob.cpp (ExportJob::exec): Return a value and
remove unused argument names.
--
ExportJob::exec is never executed because its virtual overload is always
used. Therefore it doesn't matter what value we return.
* configure.ac (NEED_GPG_ERROR_VERSION): Require 1.47.
--
Libgpg-error 1.47 has been released more than 1 year ago and we use a
new error code defined in this version.
GnuPG-bug-id: 6971
* tests/gpg/t-verify.c (main): Change assertion of test.
--
The change introduced with 1dc44b7c makes gpg abort the verification
of a clear-signed message if it encounters garbage following the
signed data. We have to adapt the test to this change.
GnuPG-bug-id: 6907
* lang/cpp/src/editinteractor.cpp (parse_sc_op_failure): New.
(CallbackHelper::edit_interactor_callback_impl): Parse failure code on
GPGME_STATUS_SC_OP_FAILURE status.
(sc_op_failure_to_error): New.
--
This converts a SC_OP_FAILURE status message logged by gpg to a
corresponding error. Unfortunately, GPG_ERR_BAD_PIN and
GPG_ERR_BAD_RESET_CODE are mapped to the same SC_OP_FAILURE code, so
that we had to choose one.
GnuPG-bug-id: 6971
* lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
(QGpgMEAddExistingSubkeyJob::exec): Remove call of resultHook.
* lang/qt/src/qgpgmedecryptjob.cpp (QGpgMEDecryptJob::exec): Remove
call of resultHook.
(QGpgMEDecryptJob::resultHook): Remove.
* lang/qt/src/qgpgmedecryptjob.h (QGpgMEDecryptJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmedecryptverifyjob.cpp (QGpgMEDecryptVerifyJob::exec):
Remove call of resultHook.
(QGpgMEDecryptVerifyJob::resultHook): Remove.
* lang/qt/src/qgpgmedecryptverifyjob.h (QGpgMEDecryptVerifyJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmeencryptjob.cpp (QGpgMEEncryptJob::exec): Remove
call of resultHook.
(QGpgMEEncryptJob::resultHook): Remove.
* lang/qt/src/qgpgmeencryptjob.h (QGpgMEEncryptJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmegpgcardjob.cpp (QGpgMEGpgCardJob::exec): Remove
call of resultHook.
* lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
(QGpgMEImportFromKeyserverJob::exec): Remove call of resultHook.
(QGpgMEImportFromKeyserverJob::resultHook): Remove.
* lang/qt/src/qgpgmeimportfromkeyserverjob.h
(QGpgMEImportFromKeyserverJob): Remove resultHook override. Remove
member mResult.
* lang/qt/src/qgpgmeimportjob.cpp (QGpgMEImportJob::exec): Remove call
of resultHook.
(QGpgMEImportJob::resultHook): Remove.
* lang/qt/src/qgpgmeimportjob.h (QGpgMEImportJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmekeyformailboxjob.cpp (QGpgMEKeyForMailboxJob::exec):
Remove call of resultHook.
* lang/qt/src/qgpgmekeylistjob.cpp (QGpgMEKeyListJob::QGpgMEKeyListJob):
Remove initialization of mResult.
(QGpgMEKeyListJob::resultHook): Do not set (removed) mResult.
* lang/qt/src/qgpgmekeylistjob.h (QGpgMEKeyListJob): Remove member
mResult.
* lang/qt/src/qgpgmelistallkeysjob.cpp
(QGpgMEListAllKeysJob::QGpgMEListAllKeysJob): Remove initialization of
mResult.
(QGpgMEListAllKeysJob::exec): Remove call of resultHook.
(QGpgMEListAllKeysJob::resultHook): Remove.
* lang/qt/src/qgpgmelistallkeysjob.h (QGpgMEListAllKeysJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmereceivekeysjob.cpp (QGpgMEReceiveKeysJob::exec):
Remove call of resultHook.
(QGpgMEReceiveKeysJob::resultHook): Remove.
* lang/qt/src/qgpgmereceivekeysjob.h (QGpgMEReceiveKeysJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmerevokekeyjob.cpp (QGpgMERevokeKeyJob::exec): Remove
call of resultHook.
* lang/qt/src/qgpgmesignencryptjob.cpp (QGpgMESignEncryptJob::exec):
Remove call of resultHook.
(QGpgMESignEncryptJob::resultHook): Remove.
* lang/qt/src/qgpgmesignencryptjob.h (QGpgMESignEncryptJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmesignjob.cpp (QGpgMESignJob::exec): Remove call of
resultHook.
(QGpgMESignJob::resultHook): Remove.
* lang/qt/src/qgpgmesignjob.h (QGpgMESignJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmeverifydetachedjob.cpp
(QGpgMEVerifyDetachedJob::exec): Remove call of resultHook.
(QGpgMEVerifyDetachedJob::resultHook): Remove.
* lang/qt/src/qgpgmeverifydetachedjob.h (QGpgMEVerifyDetachedJob):
Remove resultHook override. Remove member mResult.
* lang/qt/src/qgpgmeverifyopaquejob.cpp (QGpgMEVerifyOpaqueJob::exec):
Remove call of resultHook.
(QGpgMEVerifyOpaqueJob::resultHook): Remove.
* lang/qt/src/qgpgmeverifyopaquejob.h (QGpgMEVerifyOpaqueJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmewkdlookupjob.cpp (QGpgMEWKDLookupJob::exec):
Remove call of resultHook.
--
All overrides of resultHook (except for the one of QGpgMEKeyListJob)
are superfluous. All the resultHook overrides do is store the result in
a member variable which is then returned in exec() (which just before
returning calls resultHook). The member variable the result is stored in
is only ever used by exec(). So exec() can simply return the result
directly. Some Job subclasses call resultHook without overriding it.
That's equally useless because the default implementation of resultHook
is empty. The only resultHook override that does anything useful is the
one of QGpgMEKeyListJob.
* lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportjob.cpp: Remove obsolete comment.
* lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.cpp: Remove long obsolete, #if 0'ed out
definitions of showErrorDialog.
--
Informing the users about errors is the responsibility of the users of
the QGpgME Job API since a long time.
* m4/ax_python_devel.m4: Do not emit 'HAVE_PYTHON'.
--
This reapplies the changes made with 5189c08 that are still needed for
detecting multiple Python versions.
* configure.ac: Call AX_PYTHON_DEVEL with new "optional" argument.
* m4/ax_python_devel.m4: Replace with current version from the autoconf
archive.
--
The new "optional" argument allows us to leave out one of our custom
changes.
* lang/cpp/tests/run-wkdlookup.cpp (main): Replace backslashes with
forward slashes in homedir returned by GpgME::dirInfo. Use "gpgconf
--launch dirmngr" to start dirmngr.
--
With this change the same code as by QGpgMEWKDLookupJob is again used to
launch dirmngr. It also fixes the bad example of starting dirmngr
without the help of gpgconf.
GnuPG-bug-id: 6833
* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Replace backslashes
with forward slashes in homedir returned by GpgME::dirInfo.
--
This works around a bug which causes backslashes to be escaped (doubled)
twice on Windows, once by gpgme_op_spawn and once by the spawn helper
gpgme-w32spawn. The next versions of GnuPG 2.2 and 2.4 also have a
workaround for this.
GnuPG-bug-id: 6833
* lang/qt/src/qgpgmequickjob.cpp: Fix expiration calculation
--
The job calculates the validity as the seconds since epoch,
while GPG expects the seconds since the current time.
This leads to the validity being significantly longer than expected.
GnuPG-Bug-Id: 6889
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (VerifyDetachedJob): Move definition of
constructor and destructor and inclusion of the moc file to the
corresponding .cpp file.
* lang/qt/src/verifydetachedjob.cpp: New.
* lang/qt/src/verifydetachedjob.h (VerifyDetachedJob): Add member
functions setSignatureFile, signatureFile, setSignedFile, signedFile.
* lang/qt/src/verifydetachedjob_p.h: New.
* lang/qt/src/qgpgmeverifydetachedjob.cpp (class
QGpgMEVerifyDetachedJobPrivate): New.
(QGpgMEVerifyDetachedJob::QGpgMEVerifyDetachedJob): Instantiate private
job class.
(verify_from_filename): New.
* lang/qt/tests/Makefile.am: Add new test program.
* lang/qt/tests/run-verifydetachedjob.cpp: New.
--
This makes it possible to tell gpg to read the input directly from the
specified files bypassing GpgME's Data IO when verifying a detached
signature.
GnuPG-bug-id: 6550
* src/engine-gpg.c (gpg_verify): Add "--verify" to command line.
--
Since GnuPG 2.1.16 --verify writes the signed data to the file specified
by --output. Explicitly telling gpg that we want to verify signed data
frees gpg from guessing what we want and avoids the corresponding
warning "no command supplied. Trying to guess what you mean ..."
GnuPG-bug-id: 6907
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (VerifyOpaqueJob): Move definition of constructor
and destructor and inclusion of the moc file to the corresponding .cpp
file.
* lang/qt/src/verifyopaquejob.cpp: New.
* lang/qt/src/verifyopaquejob.h (VerifyOpaqueJob): Add member
functions setInputFile, inputFile, setOutputFile, outputFile.
* lang/qt/src/verifyopaquejob_p.h: New.
* lang/qt/src/qgpgmeverifyopaquejob.cpp (class
QGpgMEVerifyOpaqueJobPrivate): New.
(QGpgMEVerifyOpaqueJob::QGpgMEVerifyOpaqueJob): Instantiate private
job class.
(verify_from_filename): New.
* lang/qt/tests/Makefile.am: Add new test program.
* lang/qt/tests/run-verifyopaquejob.cpp: New.
--
This makes it possible to tell gpg to read the input and write the
output directly to a specified file bypassing GpgME's Data IO when
verifying an opaque signed (or clear signed) file.
GnuPG-bug-id: 6550
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (DecryptVerifyJob): Move definition of constructor
and destructor and inclusion of the moc file to the corresponding .cpp
file.
* lang/qt/src/decryptverifyjob.cpp: New.
* lang/qt/src/decryptverifyjob.h (DecryptVerifyJob): Add member
functions setInputFile, inputFile, setOutputFile, outputFile.
* lang/qt/src/decryptverifyjob_p.h: New.
* lang/qt/src/qgpgmedecryptverifyjob.cpp (class
QGpgMEDecryptVerifyJobPrivate): New.
(QGpgMEDecryptVerifyJob::QGpgMEDecryptVerifyJob): Instantiate private
job class.
(decrypt_verify_from_filename): New.
* lang/qt/tests/Makefile.am: Add new test program.
* lang/qt/tests/run-decryptverifyjob.cpp: New.
--
This makes it possible to tell gpg to read the input and write the
output directly to a specified file bypassing GpgME's Data IO when
decrypting (and verifying) a file.
GnuPG-bug-id: 6550
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (EncryptJob, SignJob, SignEncryptJob): Move
definition of constructor and destructor and inclusion of the moc file
to the corresponding .cpp files.
* lang/qt/src/encryptjob.cpp (EncryptJob): Define constructor. Define
destructor as default. Include moc file.
* lang/qt/src/encryptjob.cpp, lang/qt/src/encryptjob.h (EncryptJob):
Add member functions setRecipients, recipients, setInputFile, inputFile,
setOutputFile, outputFile, setEncryptionFlags, encryptionFlags.
* lang/qt/src/encryptjob_p.h (EncryptJobPrivate): Add members
m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags.
* lang/qt/src/qgpgmeencryptjob.cpp (encrypt_to_filename): New.
(QGpgMEEncryptJobPrivate::startIt): Start the job with the values
from the member variables.
* lang/qt/src/qgpgmesignencryptjob.cpp (sign_encrypt_to_filename): New.
(QGpgMESignEncryptJobPrivate::startIt): Start the job with the values
from the member variables.
* lang/qt/src/qgpgmesignjob.cpp (class QGpgMESignJobPrivate): New.
(QGpgMESignJob::QGpgMESignJob): Instantiate private job class.
(sign_to_filename): New.
* lang/qt/src/signencryptjob.cpp (SignEncryptJob): Define constructor.
Define destructor as default. Include moc file.
* lang/qt/src/signencryptjob.cpp, lang/qt/src/signencryptjob.h
(SignEncryptJob): Add member functions setSigners, signers,
setRecipients, recipients, setInputFile, inputFile, setOutputFile,
outputFile, setEncryptionFlags, encryptionFlags.
* lang/qt/src/signencryptjob_p.h (SignEncryptJobPrivate): Add members
m_signers, m_recipients, m_inputFilePath, m_outputFilePath,
m_encryptionFlags.
* lang/qt/src/signjob.cpp: New.
* lang/qt/src/signjob.h (SignJob): Add member functions setSigners,
signers, setInputFile, inputFile, setOutputFile, outputFile,
setSigningFlags, signingFlags.
* lang/qt/src/signjob_p.h: New.
* lang/qt/tests/Makefile.am: Add new test programs.
* lang/qt/tests/run-encryptjob.cpp: New.
* lang/qt/tests/run-signjob.cpp: New.
--
This makes it possible to tell gpg to read the input and write the
output directly to a specified file bypassing GpgME's Data IO when
signing and/or encrypting a file.
GnuPG-bug-id: 6550
* lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.cpp, lang/qt/src/qgpgmesignjob.cpp:
Remove long commented out showErrorDialog member function definitions.
--
Displaying error messages is delegated to the job users since ages.
* lang/cpp/src/context.h (enum EncryptionFlags): Add constant
EncryptFile.
* lang/cpp/src/global.h (enum SignatureMode): Add constant SignFile.
* lang/cpp/src/context.cpp (sigflags2sigflags): Handle new flag
SignFile.
(encryptflags2encryptflags): Handle new flag EncryptFile.
(operator<<): Add new flags to the corresponding debug streams.
* lang/cpp/src/signingresult.cpp (CreatedSignature::mode): Handle
new flag SignFile (even if it cannot occur).
--
GnuPG-bug-id: 6550
* src/engine-gpg.c (gpg_decrypt): Pass output file name to gpg if output
has file name set.
(gpg_verify): Ditto.
* tests/run-decrypt.c (show_usage): New option --output.
(main): Parse new option. Set file name on output if --output is given.
Do not print output if --output is given.
* tests/run-verify.c (show_usage): New option --output.
(main): Parse new option. Set file name on output if --output is given.
--
This change makes it possible to tell gpg to write the output (i.e. the
decrypted/verified data) directly to a file with given file name instead
of piping the output back to gpgme.
GnuPG-bug-id: 6550
* src/gpgme.h.in (GPGME_SIG_MODE_FILE): New signature mode flag.
* src/engine-gpg.c (gpg_sign): Separate signature mode from additional
flags. Check for incompatible flags. Explicitly set output to stdout if
no output file is used. Pass filename instead of fd to gpg when new flag
is set.
* src/engine-gpgsm.c (gpgsm_sign): Return error if new flag is set.
* src/engine-uiserver.c (uiserver_sign): Ditto.
* src/sign.c (sign_start): Consider new flag on check for invalid flags.
* tests/run-sign.c (show_usage): New options --detach and
--direct-file-io.
(main): Parse new options. Create a detached signature if --detach is
given. Make gpg read the input file itself if --direct-file-io is given.
--
With this change the gpgme_op_sign* functions gain the possibility to
make gpg read the data to sign directly from a file instead of from an
input FD to which it is written by gpgme.
GnuPG-bug-id: 6550
* src/gpgme.h.in (GPGME_ENCRYPT_FILE): New encryption flag.
* src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Check for
incompatible flags. Pass filename instead of fd to gpg when new flag is
set.
* src/engine-gpgsm.c (gpgsm_encrypt): Return error if new flag is set.
* src/engine-uiserver.c (uiserver_encrypt): Ditto.
* tests/run-encrypt.c (show_usage): New option --direct-file-io.
(main): Parse new option. Make gpg read the input file itself if the
option is given.
--
With this change the gpgme_op_encrypt* and gpgme_op_encrypt_sign*
functions gain the possibility to make gpg read the data to (sign and)
encrypt directly from a file instead of from an input FD to which it is
written by gpgme.
GnuPG-bug-id: 6550
* lang/qt/src/defaultkeygenerationjob.h, lang/qt/src/qgpgmebackend.h,
lang/qt/src/quickjob.h, lang/qt/src/threadedjobmixin.h: Replace all
occurrences of Q_NULLPTR with nullptr.
--
* src/op-support.c (_gpgme_parse_plaintext): Decode filename
as percent string.
--
From gnupg/doc/DETAILS:
If a filename is available it gets printed as the third
argument, percent-escaped as usual.
so we can use the usual percent decode function here.
GnuPG-Bug-Id: T6852
* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use "gpgconf
--launch dirmngr" to start dirmngr.
--
Using gpgconf to start dirmngr prevents multiple instances to be started
by the concurrently running keyserver lookup and WKD lookup.
GnuPG-bug-id: 6833
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/cleaner.cpp, lang/qt/src/cleaner.h: New.
* lang/qt/src/util.cpp (PartialFileGuard::~PartialFileGuard): Call
Cleaner::removeFile instead of removeFile.
* lang/qt/src/util.cpp, lang/qt/src/util.h (removeFile): Remove.
--
If the initial attempt to remove the file fails then a Cleaner is
created that tries to remove the file at regular intervals (10 s)
and on destruction (which happens on application shutdown).
GnuPG-bug-id: 6584
* src/decrypt.c (_gpgme_decrypt_status_handler): Ignore received failure
code if we already have a specific failure code.
* src/encrypt.c (_gpgme_encrypt_status_handler): Ditto.
* src/export.c (export_status_handler): Ditto.
* src/genkey.c (genkey_status_handler): Ditto.
* src/keylist.c (keylist_status_handler): Ditto.
* src/keysign.c (keysign_status_handler): Ditto.
* src/passwd.c (passwd_status_handler): Ditto.
* src/revsig.c (revsig_status_handler): Ditto.
* src/setexpire.c (setexpire_status_handler): Ditto.
* src/sign.c (_gpgme_sign_status_handler): Ditto.
* src/tofupolicy.c (tofu_policy_status_handler): Ditto.
* src/verify.c (_gpgme_verify_status_handler): Ditto.
--
Usually, a process emits at most one failure code. But some operations
like the creation of an encrypted archive involve multiple chained
processes, so that multiple failure codes can be received. We want to
keep the first specific failure code we received. Further failure codes
are only parsed if we received just an unspecific "general error" so
far.
GnuPG-bug-id: 6575