Improved previous commit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/12/head
Slávek Banko 6 years ago
parent 2e5de46030
commit 6492b716b3
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -100,7 +100,7 @@ Kleo::PassphraseDialog::~PassphraseDialog() {
delete d; d = 0;
}
const TQString Kleo::PassphraseDialog::passphrase() const {
TQString Kleo::PassphraseDialog::passphrase() const {
return d->lineedit->password();
}

@ -63,13 +63,13 @@ namespace Kleo {
bool modal=true );
~PassphraseDialog();
const TQString passphrase() const;
TQString passphrase() const;
signals:
/** emitted when the user clicks Ok. \a pass is never NULL.
\c pass only valid inside slots connected to this signal.
*/
void finished( const TQString pass );
void finished( const TQString &pass );
/** emitted when the user clicks Cancel. */
void canceled();

@ -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.

@ -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:

@ -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?

@ -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,

@ -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;

@ -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;

@ -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;

@ -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;

@ -95,7 +95,7 @@ PassphraseDialog::~PassphraseDialog()
{
}
const TQString PassphraseDialog::passphrase()
TQString PassphraseDialog::passphrase()
{
return lineedit->password();
}

@ -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;

Loading…
Cancel
Save