diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2018-11-30 16:17:09 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2018-11-30 16:24:31 +0100 |
commit | 6492b716b372d0f929f98a2965e00e10a0355204 (patch) | |
tree | 45a233b3f64424bea40533578150d392fa07b704 /libkpgp | |
parent | 2e5de46030e2354b851ba731f6c76ac30a2e8a3b (diff) | |
download | tdepim-6492b716b372d0f929f98a2965e00e10a0355204.tar.gz tdepim-6492b716b372d0f929f98a2965e00e10a0355204.zip |
Improved previous commit
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'libkpgp')
-rw-r--r-- | libkpgp/kpgp.cpp | 10 | ||||
-rw-r--r-- | libkpgp/kpgp.h | 2 | ||||
-rw-r--r-- | libkpgp/kpgpbase.cpp | 16 | ||||
-rw-r--r-- | libkpgp/kpgpbase.h | 34 | ||||
-rw-r--r-- | libkpgp/kpgpbase2.cpp | 18 | ||||
-rw-r--r-- | libkpgp/kpgpbase5.cpp | 18 | ||||
-rw-r--r-- | libkpgp/kpgpbase6.cpp | 2 | ||||
-rw-r--r-- | libkpgp/kpgpbaseG.cpp | 18 | ||||
-rw-r--r-- | libkpgp/kpgpui.cpp | 2 | ||||
-rw-r--r-- | libkpgp/kpgpui.h | 2 |
10 files changed, 61 insertions, 61 deletions
diff --git a/libkpgp/kpgp.cpp b/libkpgp/kpgp.cpp index a42429573..4d5120d0e 100644 --- a/libkpgp/kpgp.cpp +++ b/libkpgp/kpgp.cpp @@ -55,7 +55,7 @@ Module::Module() mPublicKeysCached(false), mSecretKeys(), mSecretKeysCached(false), - passphrase(0), havePassPhrase(false) + passphrase(TQString::null), havePassPhrase(false) { if (!kpgpObject) { kdDebug(5100) << "creating new pgp object" << endl; @@ -230,8 +230,8 @@ Module::wipePassPhrase(bool freeMem) if (!passphrase.isEmpty()) { passphrase.fill(' '); } - if (freeMem && !passphrase.isNull()) { - passphrase = TQString(); + if (freeMem) { + passphrase.truncate(0); } havePassPhrase = false; } @@ -830,13 +830,13 @@ Module::getAsciiPublicKey(const KeyID& keyID) } -bool Module::setPassPhrase(const TQString& aPass) +bool Module::setPassPhrase(const TQString &aPass) { // null out old buffer before we touch the new string. So in case // aPass isn't properly null-terminated, we don't leak secret data. wipePassPhrase(); - if (!aPass.isNull()) + if (!aPass.isEmpty()) { if (aPass.length() >= 1024) { // rediculously long passphrase. diff --git a/libkpgp/kpgp.h b/libkpgp/kpgp.h index 1ea49664e..4382f1f5f 100644 --- a/libkpgp/kpgp.h +++ b/libkpgp/kpgp.h @@ -332,7 +332,7 @@ private: KeyIDList getEncryptionKeys( const TQString& person ); /** Set pass phrase */ - bool setPassPhrase(const TQString& pass); + bool setPassPhrase(const TQString &pass); /** test if the PGP executable is found and if there is a passphrase set or given. Returns: diff --git a/libkpgp/kpgpbase.cpp b/libkpgp/kpgpbase.cpp index 5b28bd540..a033a0b4a 100644 --- a/libkpgp/kpgpbase.cpp +++ b/libkpgp/kpgpbase.cpp @@ -59,7 +59,7 @@ Base::clear() int -Base::run( const char *cmd, const TQString& passphrase, bool onlyReadFromPGP ) +Base::run( const char *cmd, const TQString &passphrase, bool onlyReadFromPGP ) { /* the pipe ppass is used for to pass the password to * pgp. passing the password together with the normal input through @@ -74,7 +74,7 @@ Base::run( const char *cmd, const TQString& passphrase, bool onlyReadFromPGP ) struct pollfd pollin, pollout, pollerr; int pollstatus; - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) { if (pipe(ppass) < 0) { // An error occurred @@ -369,7 +369,7 @@ Base::run( const char *cmd, const TQString& passphrase, bool onlyReadFromPGP ) close(perr[0]); unsetenv("PGPPASSFD"); - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) close(ppass[0]); // Did the child exit normally? @@ -398,7 +398,7 @@ Base::run( const char *cmd, const TQString& passphrase, bool onlyReadFromPGP ) int -Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuPG ) +Base::runGpg( const char *cmd, const TQString &passphrase, bool onlyReadFromGnuPG ) { /* the pipe ppass is used for to pass the password to * pgp. passing the password together with the normal input through @@ -418,7 +418,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP const int STD_IN = 2; int pollstatus; - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) { if (pipe(ppass) < 0) { // An error occurred @@ -461,7 +461,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); } - if (!passphrase.isNull()) { + if (!passphrase.isEmpty()) { if( mVersion >= "1.0.7" ) { // GnuPG >= 1.0.7 supports the gpg-agent, so we look for it. if( 0 == getenv("GPG_AGENT_INFO") ) { @@ -506,7 +506,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP //#warning FIXME: there has to be a better way to do this /* this is nasty nasty nasty (but it works) */ - if (!passphrase.isNull()) { + if (!passphrase.isEmpty()) { if( mVersion >= "1.0.7" ) { // GnuPG >= 1.0.7 supports the gpg-agent, so we look for it. if( 0 == getenv("GPG_AGENT_INFO") ) { @@ -684,7 +684,7 @@ Base::runGpg( const char *cmd, const TQString& passphrase, bool onlyReadFromGnuP close(pout[0]); close(perr[0]); - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) close(ppass[0]); // Did the child exit normally? diff --git a/libkpgp/kpgpbase.h b/libkpgp/kpgpbase.h index 3f99073a4..1dc0acf59 100644 --- a/libkpgp/kpgpbase.h +++ b/libkpgp/kpgpbase.h @@ -45,10 +45,10 @@ public: /** Encrypts and signs the message with the given keys. */ virtual int encsign( Block& , const KeyIDList& , - const TQString& = 0) { return OK; } + const TQString& = TQString::null) { return OK; } /** Decrypts the message. */ - virtual int decrypt( Block& , const TQString& = 0) { return OK; } + virtual int decrypt( Block& , const TQString& = TQString::null) { return OK; } /** Verifies the message. */ virtual int verify( Block& block ) { return decrypt( block, 0 ); } @@ -86,9 +86,9 @@ public: protected: - virtual int run( const char *cmd, const TQString& passphrase = 0, + virtual int run( const char *cmd, const TQString &passphrase = TQString::null, bool onlyReadFromPGP = false ); - virtual int runGpg( const char *cmd, const TQString& passphrase = 0, + virtual int runGpg( const char *cmd, const TQString &passphrase = TQString::null, bool onlyReadFromGnuPG = false ); virtual void clear(); @@ -115,10 +115,10 @@ public: virtual ~Base2(); virtual int encrypt( Block& block, const KeyIDList& recipients ); - virtual int clearsign( Block& block, const TQString& passphrase ); + virtual int clearsign( Block& block, const TQString &passphrase ); virtual int encsign( Block& block, const KeyIDList& recipients, - const TQString& passphrase = 0 ); - virtual int decrypt( Block& block, const TQString& passphrase = 0 ); + const TQString &passphrase = TQString::null ); + virtual int decrypt( Block& block, const TQString &passphrase = TQString::null ); virtual int verify( Block& block ) { return decrypt( block, 0 ); } virtual Key* readPublicKey( const KeyID& keyID, @@ -127,7 +127,7 @@ public: virtual KeyList publicKeys( const TQStringList & patterns = TQStringList() ); virtual KeyList secretKeys( const TQStringList & patterns = TQStringList() ); virtual TQCString getAsciiPublicKey( const KeyID& keyID ); - virtual int signKey( const KeyID& keyID, const TQString& passphrase ); + virtual int signKey( const KeyID& keyID, const TQString &passphrase ); protected: KeyList doGetPublicKeys( const TQCString & cmd, @@ -147,10 +147,10 @@ public: virtual ~BaseG(); virtual int encrypt( Block& block, const KeyIDList& recipients ); - virtual int clearsign( Block& block, const TQString& passphrase ); + virtual int clearsign( Block& block, const TQString &passphrase ); virtual int encsign( Block& block, const KeyIDList& recipients, - const TQString& passphrase = 0 ); - virtual int decrypt( Block& block, const TQString& passphrase = 0 ); + const TQString &passphrase = TQString::null ); + virtual int decrypt( Block& block, const TQString &passphrase = TQString::null ); virtual int verify( Block& block ) { return decrypt( block, 0 ); } virtual Key* readPublicKey( const KeyID& keyID, @@ -159,7 +159,7 @@ public: virtual KeyList publicKeys( const TQStringList & patterns = TQStringList() ); virtual KeyList secretKeys( const TQStringList & patterns = TQStringList() ); virtual TQCString getAsciiPublicKey( const KeyID& keyID ); - virtual int signKey( const KeyID& keyID, const TQString& passphrase ); + virtual int signKey( const KeyID& keyID, const TQString &passphrase ); private: Key* parseKeyData( const TQCString& output, int& offset, Key* key = 0 ); @@ -175,10 +175,10 @@ public: virtual ~Base5(); virtual int encrypt( Block& block, const KeyIDList& recipients ); - virtual int clearsign( Block& block, const TQString& passphrase ); + virtual int clearsign( Block& block, const TQString &passphrase ); virtual int encsign( Block& block, const KeyIDList& recipients, - const TQString& passphrase = 0 ); - virtual int decrypt( Block& block, const TQString& passphrase = 0 ); + const TQString &passphrase = TQString::null ); + virtual int decrypt( Block& block, const TQString &passphrase = TQString::null ); virtual int verify( Block& block ) { return decrypt( block, 0 ); } virtual Key* readPublicKey( const KeyID& keyID, @@ -187,7 +187,7 @@ public: virtual KeyList publicKeys( const TQStringList & patterns = TQStringList() ); virtual KeyList secretKeys( const TQStringList & patterns = TQStringList() ); virtual TQCString getAsciiPublicKey( const KeyID& keyID ); - virtual int signKey( const KeyID& keyID, const TQString& passphrase ); + virtual int signKey( const KeyID& keyID, const TQString &passphrase ); private: Key* parseKeyData( const TQCString& output, int& offset, Key* key = 0 ); @@ -204,7 +204,7 @@ public: Base6(); virtual ~Base6(); - virtual int decrypt( Block& block, const TQString& passphrase = 0 ); + virtual int decrypt( Block& block, const TQString &passphrase = TQString::null ); virtual int verify( Block& block ) { return decrypt( block, 0 ); } virtual Key* readPublicKey( const KeyID& keyID, diff --git a/libkpgp/kpgpbase2.cpp b/libkpgp/kpgpbase2.cpp index d0d08a0ff..255701a6f 100644 --- a/libkpgp/kpgpbase2.cpp +++ b/libkpgp/kpgpbase2.cpp @@ -55,7 +55,7 @@ Base2::encrypt( Block& block, const KeyIDList& recipients ) int -Base2::clearsign( Block& block, const TQString& passphrase ) +Base2::clearsign( Block& block, const TQString &passphrase ) { return encsign( block, KeyIDList(), passphrase ); } @@ -63,16 +63,16 @@ Base2::clearsign( Block& block, const TQString& passphrase ) int Base2::encsign( Block& block, const KeyIDList& recipients, - const TQString& passphrase ) + const TQString &passphrase ) { TQCString cmd; int exitStatus = 0; - if (!recipients.isEmpty() && !passphrase.isNull()) + if (!recipients.isEmpty() && !passphrase.isEmpty()) cmd = PGP2 " +batchmode +language=en +verbose=1 -seat"; else if(!recipients.isEmpty()) cmd = PGP2 " +batchmode +language=en +verbose=1 -eat"; - else if (!passphrase.isNull()) + else if (!passphrase.isEmpty()) cmd = PGP2 " +batchmode +language=en +verbose=1 -sat"; else { @@ -80,7 +80,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, return OK; } - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) cmd += addUserId(); if(!recipients.isEmpty()) { @@ -185,7 +185,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, } } #endif - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) { if(error.find("Pass phrase is good") != -1) { @@ -224,7 +224,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients, int -Base2::decrypt( Block& block, const TQString& passphrase ) +Base2::decrypt( Block& block, const TQString &passphrase ) { int index, index2; int exitStatus = 0; @@ -294,7 +294,7 @@ Base2::decrypt( Block& block, const TQString& passphrase ) block.setRequiredUserId( error.mid(index, index2 - index) ); //kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n"; - if ((!passphrase.isNull()) && (error.find("Bad pass phrase") != -1)) + if ((!passphrase.isEmpty()) && (error.find("Bad pass phrase") != -1)) { errMsg = i18n("Bad passphrase; could not decrypt."); kdDebug(5100) << "Base: passphrase is bad" << endl; @@ -573,7 +573,7 @@ Base2::secretKeys( const TQStringList & patterns ) int -Base2::signKey(const KeyID& keyID, const TQString& passphrase) +Base2::signKey(const KeyID& keyID, const TQString &passphrase) { TQCString cmd; int exitStatus = 0; diff --git a/libkpgp/kpgpbase5.cpp b/libkpgp/kpgpbase5.cpp index dad10b3fd..c3a8a9d34 100644 --- a/libkpgp/kpgpbase5.cpp +++ b/libkpgp/kpgpbase5.cpp @@ -55,7 +55,7 @@ Base5::encrypt( Block& block, const KeyIDList& recipients ) int -Base5::clearsign( Block& block, const TQString& passphrase ) +Base5::clearsign( Block& block, const TQString &passphrase ) { return encsign( block, KeyIDList(), passphrase ); } @@ -63,7 +63,7 @@ Base5::clearsign( Block& block, const TQString& passphrase ) int Base5::encsign( Block& block, const KeyIDList& recipients, - const TQString& passphrase ) + const TQString &passphrase ) { TQCString cmd; int exitStatus = 0; @@ -73,11 +73,11 @@ Base5::encsign( Block& block, const KeyIDList& recipients, // we want a clear signature bool signonly = false; - if (!recipients.isEmpty() && !passphrase.isNull()) + if (!recipients.isEmpty() && !passphrase.isEmpty()) cmd = "pgpe +batchmode -afts "; else if(!recipients.isEmpty()) cmd = "pgpe +batchmode -aft "; - else if (!passphrase.isNull()) + else if (!passphrase.isEmpty()) { cmd = "pgps +batchmode -abft "; signonly = true; @@ -88,7 +88,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, return OK; } - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) cmd += addUserId(); if(!recipients.isEmpty()) @@ -191,7 +191,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, int -Base5::decrypt( Block& block, const TQString& passphrase ) +Base5::decrypt( Block& block, const TQString &passphrase ) { int exitStatus = 0; @@ -222,7 +222,7 @@ Base5::decrypt( Block& block, const TQString& passphrase ) // or do we not have the secret key? if(error.find("Need a pass phrase") != -1) { - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) { errMsg = i18n("Bad passphrase; could not decrypt."); kdDebug(5100) << "Base: passphrase is bad" << endl; @@ -433,12 +433,12 @@ TQCString Base5::getAsciiPublicKey(const KeyID& keyID) int -Base5::signKey(const KeyID& keyID, const TQString& passphrase) +Base5::signKey(const KeyID& keyID, const TQString &passphrase) { TQCString cmd; int exitStatus = 0; - if (passphrase.isNull()) return false; + if (passphrase.isEmpty()) return false; cmd = "pgpk -s -f +batchmode=1 0x"; cmd += keyID; diff --git a/libkpgp/kpgpbase6.cpp b/libkpgp/kpgpbase6.cpp index 4d00441f9..eb1fdb186 100644 --- a/libkpgp/kpgpbase6.cpp +++ b/libkpgp/kpgpbase6.cpp @@ -46,7 +46,7 @@ Base6::~Base6() int -Base6::decrypt( Block& block, const TQString& passphrase ) +Base6::decrypt( Block& block, const TQString &passphrase ) { int index, index2; int exitStatus = 0; diff --git a/libkpgp/kpgpbaseG.cpp b/libkpgp/kpgpbaseG.cpp index e63c30153..2e5c916fc 100644 --- a/libkpgp/kpgpbaseG.cpp +++ b/libkpgp/kpgpbaseG.cpp @@ -62,7 +62,7 @@ BaseG::encrypt( Block& block, const KeyIDList& recipients ) int -BaseG::clearsign( Block& block, const TQString& passphrase ) +BaseG::clearsign( Block& block, const TQString &passphrase ) { return encsign( block, KeyIDList(), passphrase ); } @@ -70,16 +70,16 @@ BaseG::clearsign( Block& block, const TQString& passphrase ) int BaseG::encsign( Block& block, const KeyIDList& recipients, - const TQString& passphrase ) + const TQString &passphrase ) { TQCString cmd; int exitStatus = 0; - if (!recipients.isEmpty() && !passphrase.isNull()) + if (!recipients.isEmpty() && !passphrase.isEmpty()) cmd = "--batch --armor --sign --encrypt --textmode"; else if(!recipients.isEmpty()) cmd = "--batch --armor --encrypt --textmode"; - else if (!passphrase.isNull()) + else if (!passphrase.isEmpty()) cmd = "--batch --escape-from --clearsign"; else { @@ -87,7 +87,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients, return OK; } - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) cmd += addUserId(); if(!recipients.isEmpty()) @@ -164,7 +164,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients, } } #endif - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) { // Example 1 (bad passphrase, clearsign only): // gpg: skipped `0x12345678': bad passphrase @@ -205,7 +205,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients, int -BaseG::decrypt( Block& block, const TQString& passphrase ) +BaseG::decrypt( Block& block, const TQString &passphrase ) { int index, index2; int exitStatus = 0; @@ -252,7 +252,7 @@ BaseG::decrypt( Block& block, const TQString& passphrase ) { if( ( index = error.find( "bad passphrase" ) ) != -1 ) { - if (!passphrase.isNull()) + if (!passphrase.isEmpty()) { errMsg = i18n( "Bad passphrase; could not decrypt." ); kdDebug(5100) << "Base: passphrase is bad" << endl; @@ -483,7 +483,7 @@ BaseG::secretKeys( const TQStringList & patterns ) int -BaseG::signKey(const KeyID& keyID, const TQString& passphrase) +BaseG::signKey(const KeyID& keyID, const TQString &passphrase) { TQCString cmd; int exitStatus = 0; diff --git a/libkpgp/kpgpui.cpp b/libkpgp/kpgpui.cpp index 3c099d6bc..3ad786ab0 100644 --- a/libkpgp/kpgpui.cpp +++ b/libkpgp/kpgpui.cpp @@ -95,7 +95,7 @@ PassphraseDialog::~PassphraseDialog() { } -const TQString PassphraseDialog::passphrase() +TQString PassphraseDialog::passphrase() { return lineedit->password(); } diff --git a/libkpgp/kpgpui.h b/libkpgp/kpgpui.h index bf2b4213e..184b61f54 100644 --- a/libkpgp/kpgpui.h +++ b/libkpgp/kpgpui.h @@ -62,7 +62,7 @@ class KDE_EXPORT PassphraseDialog : public KDialogBase bool modal=true, const TQString &keyID=TQString()); virtual ~PassphraseDialog(); - const TQString passphrase(); + TQString passphrase(); private: KPasswordEdit *lineedit; |