summaryrefslogtreecommitdiffstats
path: root/certmanager/lib/backends
diff options
context:
space:
mode:
Diffstat (limited to 'certmanager/lib/backends')
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp16
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp8
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp1
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp8
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmejob.cpp16
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmejob.h7
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp16
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h1
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp5
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp4
-rw-r--r--certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp5
17 files changed, 87 insertions, 27 deletions
diff --git a/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp b/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp
index c67800502..ae45d6833 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp
@@ -447,6 +447,13 @@ TQVariant QGpgMECryptoConfigEntry::stringToValue( const TQString& str, bool unes
bool isString = isStringType();
if ( isList() ) {
+ if ( argType() == ArgType_None ) {
+ bool ok = true;
+ const TQVariant v = str.isEmpty() ? 0U : str.toUInt( &ok ) ;
+ if ( !ok )
+ kdWarning(5150) << "list-of-none should have an unsigned int as value:" << str << endl;
+ return v;
+ }
TQValueList<TQVariant> lst;
TQStringList items = TQStringList::split( ',', str );
for( TQStringList::const_iterator valit = items.begin(); valit != items.end(); ++valit ) {
@@ -657,7 +664,10 @@ void QGpgMECryptoConfigEntry::resetToDefault()
if ( mFlags & GPGCONF_FLAG_DEFAULT )
mValue = mDefaultValue;
else if ( mArgType == ArgType_None )
- mValue = false;
+ if ( isList() )
+ mValue = 0U;
+ else
+ mValue = false;
}
void QGpgMECryptoConfigEntry::setBoolValue( bool b )
@@ -715,7 +725,9 @@ void QGpgMECryptoConfigEntry::setNumberOfTimesSet( unsigned int i )
{
Q_ASSERT( mArgType == ArgType_None );
Q_ASSERT( isList() );
- setUIntValue( i );
+ mValue = i;
+ mSet = i > 0;
+ mDirty = true;
}
void QGpgMECryptoConfigEntry::setStringValueList( const TQStringList& lst )
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp
index 692efa322..15d3246fe 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedecryptjob.cpp
@@ -85,7 +85,10 @@ GpgME::DecryptionResult Kleo::QGpgMEDecryptJob::exec( const TQByteArray & cipher
}
void Kleo::QGpgMEDecryptJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->decryptionResult(), mOutDataDataProvider->data() );
+ const GpgME::DecryptionResult res = mCtx->decrypt( *mInData, *mOutData );
+ const TQByteArray plainText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( res, plainText );
}
#include "qgpgmedecryptjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp
index 68f67d0fd..a14e7e18f 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedecryptverifyjob.cpp
@@ -87,9 +87,11 @@ Kleo::QGpgMEDecryptVerifyJob::exec( const TQByteArray & cipherText, TQByteArray
}
void Kleo::QGpgMEDecryptVerifyJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->decryptionResult(),
- mCtx->verificationResult(),
- mOutDataDataProvider->data() );
+ const GpgME::DecryptionResult dr = mCtx->decryptionResult();
+ const GpgME::VerificationResult vr = mCtx->verificationResult();
+ const TQByteArray plainText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( dr, vr, plainText );
}
#include "qgpgmedecryptverifyjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp
index c06907eea..3665ee668 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedeletejob.cpp
@@ -64,6 +64,7 @@ GpgME::Error Kleo::QGpgMEDeleteJob::start( const GpgME::Key & key, bool allowSec
}
void Kleo::QGpgMEDeleteJob::doOperationDoneEvent( const GpgME::Error & error ) {
+ getAuditLog();
emit result( error );
}
diff --git a/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp
index 364e8f9f7..979a85490 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmedownloadjob.cpp
@@ -72,7 +72,9 @@ GpgME::Error Kleo::QGpgMEDownloadJob::start( const TQStringList & pats ) {
}
void Kleo::QGpgMEDownloadJob::doOperationDoneEvent( const GpgME::Error & error ) {
- emit result( error, mOutDataDataProvider->data() );
+ const TQByteArray data = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( error, data );
}
#include "qgpgmedownloadjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp
index ddd51717f..a6a380b0b 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeencryptjob.cpp
@@ -97,7 +97,10 @@ GpgME::EncryptionResult Kleo::QGpgMEEncryptJob::exec( const std::vector<GpgME::K
}
void Kleo::QGpgMEEncryptJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mResult = mCtx->encryptionResult(), mOutDataDataProvider->data() );
+ mResult = mCtx->encryptionResult();
+ const TQByteArray ciphertext = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( mResult, ciphertext );
}
void Kleo::QGpgMEEncryptJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp
index c31074aff..16e5fb773 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeexportjob.cpp
@@ -72,7 +72,9 @@ GpgME::Error Kleo::QGpgMEExportJob::start( const TQStringList & pats ) {
}
void Kleo::QGpgMEExportJob::doOperationDoneEvent( const GpgME::Error & error ) {
- emit result( error, mOutDataDataProvider->data() );
+ const TQByteArray data = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( error, data );
}
#include "qgpgmeexportjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp
index 7c698e7e7..80792161f 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeimportjob.cpp
@@ -75,11 +75,15 @@ GpgME::Error Kleo::QGpgMEImportJob::start( const TQByteArray & keyData ) {
GpgME::ImportResult Kleo::QGpgMEImportJob::exec( const TQByteArray & keyData ) {
setup( keyData );
- return mCtx->importKeys( *mInData );
+ const GpgME::ImportResult res = mCtx->importKeys( *mInData );
+ getAuditLog();
+ return res;
}
void Kleo::QGpgMEImportJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->importResult() );
+ const GpgME::ImportResult res = mCtx->importResult();
+ getAuditLog();
+ emit result( res );
}
diff --git a/certmanager/lib/backends/qgpgme/qgpgmejob.cpp b/certmanager/lib/backends/qgpgme/qgpgmejob.cpp
index 72f9f77ff..6d7ae5b45 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmejob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmejob.cpp
@@ -236,21 +236,19 @@ void Kleo::QGpgMEJob::createOutData() {
static const unsigned int GetAuditLogFlags = GpgME::Context::AuditLogWithHelp|GpgME::Context::HtmlAuditLog;
-static TQString audit_log_as_html( GpgME::Context * ctx ) {
- if ( !ctx )
- return TQString();
+static TQString audit_log_as_html( GpgME::Context * ctx, GpgME::Error & err ) {
+ assert( ctx );
QGpgME::QByteArrayDataProvider dp;
GpgME::Data data( &dp );
assert( !data.isNull() );
- if ( const GpgME::Error err = ctx->getAuditLog( data, GetAuditLogFlags ) )
+ if ( ( err = ctx->getAuditLog( data, GetAuditLogFlags ) ) )
return TQString();
- else
- return TQString::fromUtf8( dp.data().data() );
+ const TQByteArray ba = dp.data();
+ return TQString::fromUtf8( ba.data(), ba.size() );
}
void Kleo::QGpgMEJob::doSlotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & e ) {
if ( context == mCtx ) {
- getAuditLog();
doEmitDoneSignal();
doOperationDoneEvent( e );
mThis->deleteLater();
@@ -258,7 +256,9 @@ void Kleo::QGpgMEJob::doSlotOperationDoneEvent( GpgME::Context * context, const
}
void Kleo::QGpgMEJob::getAuditLog() {
- mAuditLogAsHtml = audit_log_as_html( mCtx );
+ if ( !mCtx )
+ return;
+ mAuditLogAsHtml = audit_log_as_html( mCtx, mAuditLogError );
}
void Kleo::QGpgMEJob::doSlotCancel() {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmejob.h b/certmanager/lib/backends/qgpgme/qgpgmejob.h
index 984bed445..0681c165d 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmejob.h
+++ b/certmanager/lib/backends/qgpgme/qgpgmejob.h
@@ -37,6 +37,7 @@
#include <gpgmepp/interfaces/passphraseprovider.h>
#include <gpgmepp/key.h>
+#include <gpgmepp/context.h>
#include <tqcstring.h>
#include <tqstring.h>
@@ -45,8 +46,6 @@
#include <kdepimmacros.h>
namespace GpgME {
- class Error;
- class Context;
class Data;
}
@@ -120,6 +119,7 @@ namespace Kleo {
virtual void doEmitDoneSignal() = 0;
void doSlotCancel();
TQString auditLogAsHtml() const { return mAuditLogAsHtml; }
+ GpgME::Error auditLogError() const { return mAuditLogError; }
private:
/*! \reimp from GpgME::ProgressProvider */
@@ -146,6 +146,7 @@ namespace Kleo {
unsigned int mNumPatterns;
unsigned int mChunkSize;
unsigned int mPatternStartIndex, mPatternEndIndex;
+ GpgME::Error mAuditLogError;
TQString mAuditLogAsHtml;
};
@@ -154,7 +155,7 @@ namespace Kleo {
#define make_slot_cancel private: void slotCancel() { QGpgMEJob::doSlotCancel(); }
#define make_progress_emitter private: void doEmitProgressSignal( const TQString & what, int cur, int tot ) { emit progress( what, cur, tot ); }
#define make_done_emitter private: void doEmitDoneSignal() { emit done(); }
-#define make_auditLogAsHtml private: TQString auditLogAsHtml() const { return QGpgMEJob::auditLogAsHtml(); }
+#define make_auditLogAsHtml private: TQString auditLogAsHtml() const { return QGpgMEJob::auditLogAsHtml(); } GpgME::Error auditLogError() const { return QGpgMEJob::auditLogError(); }
#define QGPGME_JOB make_slot_cancel make_progress_emitter make_done_emitter make_auditLogAsHtml
#endif // __KLEO_QGPGMEJOB_H__
diff --git a/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp
index b226d6498..16e131348 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmekeygenerationjob.cpp
@@ -80,7 +80,10 @@ GpgME::Error Kleo::QGpgMEKeyGenerationJob::start( const TQString & parameters )
}
void Kleo::QGpgMEKeyGenerationJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->keyGenerationResult(), mPubKeyDataProvider ? mPubKeyDataProvider->data() : TQByteArray() );
+ const GpgME::KeyGenerationResult res = mCtx->keyGenerationResult();
+ const TQByteArray data = mPubKeyDataProvider ? mPubKeyDataProvider->data() : TQByteArray() ;
+ getAuditLog();
+ emit result( res, data );
}
#include "qgpgmekeygenerationjob.moc"
diff --git a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp
index 9e663e92d..b07135f01 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.cpp
@@ -48,6 +48,7 @@
#include <kdebug.h>
#include <tqstringlist.h>
+#include <tqtimer.h>
#include <algorithm>
@@ -97,6 +98,10 @@ GpgME::Error Kleo::QGpgMEKeyListJob::start( const TQStringList & pats, bool secr
kdDebug(5150) << "QGpgMEKeyListJob::start(): retrying keylisting with chunksize " << chunkSize() << endl;
continue;
}
+ } else if ( err.code() == GPG_ERR_EOF ) {
+ kdDebug(5150) << "QGpgMEKeyListJob::start(): early end of keylisting, trying to fake an empty result" << endl;
+ TQTimer::singleShot( 10, this, TQT_SLOT(slotFakeOperationDoneEvent()) );
+ return GpgME::Error();
}
deleteLater();
mResult = GpgME::KeyListResult( 0, err );
@@ -158,6 +163,17 @@ void Kleo::QGpgMEKeyListJob::slotNextKeyEvent( GpgME::Context * context, const G
emit nextKey( key );
}
+void Kleo::QGpgMEKeyListJob::slotFakeOperationDoneEvent() {
+ const GpgME::KeyListResult res = mCtx->keyListResult();
+ if ( !res.error().code() == GPG_ERR_EOF )
+ kdDebug(5150) << "QGpgMEKeyListJob::slotFakeOperationDoneEvent: expected EOF, got "
+ << res.error().asString() << endl;
+ mResult = GpgME::KeyListResult();
+ emit done();
+ emit result( mResult );
+ deleteLater();
+}
+
void Kleo::QGpgMEKeyListJob::slotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & ) {
if ( context != mCtx )
return;
diff --git a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h
index 0bc84c08c..388641076 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h
+++ b/certmanager/lib/backends/qgpgme/qgpgmekeylistjob.h
@@ -65,6 +65,7 @@ namespace Kleo {
private slots:
void slotNextKeyEvent( GpgME::Context * context, const GpgME::Key & key );
void slotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & e );
+ void slotFakeOperationDoneEvent();
private:
void doOperationDoneEvent( const GpgME::Error &) {} // unused, we implement slotOperationDoneEvent ourselves.
diff --git a/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp
index bc05eb86c..9a469001c 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp
@@ -109,7 +109,9 @@ Kleo::QGpgMESignEncryptJob::exec( const std::vector<GpgME::Key> & signers,
void Kleo::QGpgMESignEncryptJob::doOperationDoneEvent( const GpgME::Error & ) {
mResult.first = mCtx->signingResult();
mResult.second = mCtx->encryptionResult();
- emit result( mResult.first, mResult.second, mOutDataDataProvider->data() );
+ const TQByteArray cipherText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( mResult.first, mResult.second, cipherText );
}
void Kleo::QGpgMESignEncryptJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp
index 0042d6a38..01ae8a91f 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmesignjob.cpp
@@ -102,7 +102,10 @@ GpgME::SigningResult Kleo::QGpgMESignJob::exec( const std::vector<GpgME::Key> &
}
void Kleo::QGpgMESignJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mResult = mCtx->signingResult(), mOutDataDataProvider->data() );
+ mResult = mCtx->signingResult();
+ const TQByteArray signature = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( mResult, signature );
}
void Kleo::QGpgMESignJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const {
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp
index b1022f61b..41fa48494 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeverifydetachedjob.cpp
@@ -89,7 +89,9 @@ GpgME::VerificationResult Kleo::QGpgMEVerifyDetachedJob::exec( const TQByteArray
}
void Kleo::QGpgMEVerifyDetachedJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->verificationResult() );
+ const GpgME::VerificationResult res = mCtx->verificationResult();
+ getAuditLog();
+ emit result( res );
}
diff --git a/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp b/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp
index 92e1917b7..e4340aa39 100644
--- a/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp
+++ b/certmanager/lib/backends/qgpgme/qgpgmeverifyopaquejob.cpp
@@ -84,7 +84,10 @@ GpgME::VerificationResult Kleo::QGpgMEVerifyOpaqueJob::exec( const TQByteArray &
}
void Kleo::QGpgMEVerifyOpaqueJob::doOperationDoneEvent( const GpgME::Error & ) {
- emit result( mCtx->verificationResult(), mOutDataDataProvider->data() );
+ const GpgME::VerificationResult res = mCtx->verificationResult();
+ const TQByteArray plainText = mOutDataDataProvider->data();
+ getAuditLog();
+ emit result( res, plainText );
}