diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2018-11-29 19:52:17 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2018-11-29 21:48:23 +0100 |
commit | 2e5de46030e2354b851ba731f6c76ac30a2e8a3b (patch) | |
tree | e48732e76e7d0ceb4e01caab16c1aa2a119c1ad0 /libkpgp/kpgpbase.cpp | |
parent | 2f0c49e8523a4d26b6bb9c7c8a05d68cb023a568 (diff) | |
download | tdepim-2e5de46030e2354b851ba731f6c76ac30a2e8a3b.tar.gz tdepim-2e5de46030e2354b851ba731f6c76ac30a2e8a3b.zip |
Adapted to new KPasswordEdit::password() signature.
This relates to bug 2961.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'libkpgp/kpgpbase.cpp')
-rw-r--r-- | libkpgp/kpgpbase.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libkpgp/kpgpbase.cpp b/libkpgp/kpgpbase.cpp index c8efdfa4a..5b28bd540 100644 --- a/libkpgp/kpgpbase.cpp +++ b/libkpgp/kpgpbase.cpp @@ -59,7 +59,7 @@ Base::clear() int -Base::run( const char *cmd, const char *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 char *passphrase, bool onlyReadFromPGP ) struct pollfd pollin, pollout, pollerr; int pollstatus; - if(passphrase) + if (!passphrase.isNull()) { if (pipe(ppass) < 0) { // An error occurred @@ -83,7 +83,8 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) } pass = fdopen(ppass[1], "w"); - fwrite(passphrase, sizeof(char), strlen(passphrase), pass); + TQCString pass2 = passphrase.local8Bit(); + fwrite(pass2, sizeof(char), pass2.length(), pass); fwrite("\n", sizeof(char), 1, pass); fclose(pass); close(ppass[1]); @@ -368,7 +369,7 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) close(perr[0]); unsetenv("PGPPASSFD"); - if(passphrase) + if (!passphrase.isNull()) close(ppass[0]); // Did the child exit normally? @@ -397,7 +398,7 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) int -Base::runGpg( const char *cmd, const char *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 @@ -417,7 +418,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) const int STD_IN = 2; int pollstatus; - if(passphrase) + if (!passphrase.isNull()) { if (pipe(ppass) < 0) { // An error occurred @@ -426,7 +427,8 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) } pass = fdopen(ppass[1], "w"); - fwrite(passphrase, sizeof(char), strlen(passphrase), pass); + TQCString pass2 = passphrase.local8Bit(); + fwrite(pass2, sizeof(char), pass2.length(), pass); fwrite("\n", sizeof(char), 1, pass); fclose(pass); close(ppass[1]); @@ -459,7 +461,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); } - if( passphrase ) { + if (!passphrase.isNull()) { if( mVersion >= "1.0.7" ) { // GnuPG >= 1.0.7 supports the gpg-agent, so we look for it. if( 0 == getenv("GPG_AGENT_INFO") ) { @@ -504,7 +506,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) //#warning FIXME: there has to be a better way to do this /* this is nasty nasty nasty (but it works) */ - if( passphrase ) { + if (!passphrase.isNull()) { if( mVersion >= "1.0.7" ) { // GnuPG >= 1.0.7 supports the gpg-agent, so we look for it. if( 0 == getenv("GPG_AGENT_INFO") ) { @@ -682,7 +684,7 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) close(pout[0]); close(perr[0]); - if(passphrase) + if (!passphrase.isNull()) close(ppass[0]); // Did the child exit normally? |