From 6db0c5f228d12fc1a1ef861717d1dc4a3c9d6a6c Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 28 Nov 2018 23:51:20 +0900 Subject: Improved previous commit using local8Bit() in place of utf8() when a password is transmitted over pipes to other processes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michele Calgaro Signed-off-by: Slávek Banko --- kdesktop/lock/lockprocess.cc | 4 ++-- kdesktop/minicli.cpp | 4 ++-- kdialog/kdialog.cpp | 2 +- tdepasswd/kcm/main.cpp | 2 +- tdepasswd/passwd.cpp | 2 +- tdepasswd/passwddlg.cpp | 6 +++--- tdepasswd/tdepasswd.cpp | 2 +- tdesu/tdesu/sudlg.cpp | 2 +- tdesu/tdesu/tdesu.cpp | 4 ++-- tdmlib/kgreet_classic.cpp | 6 +++--- tdmlib/kgreet_pam.cpp | 6 +++--- tdmlib/kgreet_winbind.cpp | 6 +++--- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index b34c5b494..fdde3fc9e 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -2807,8 +2807,8 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) { pin_entry = qryDlg.getEntry(); mInfoMessageDisplayed=false; if (mPipeOpen_out == true) { - TQCString pin_entry_utf8 = pin_entry.utf8(); // utf8 length may differ from TQString length - if (write(mPipe_fd_out, pin_entry_utf8.data(), pin_entry_utf8.length()+1) == -1) { + TQCString pin_entry_local8 = pin_entry.local8Bit(); // local 8 bit length may differ from TQString length + if (write(mPipe_fd_out, pin_entry_local8.data(), pin_entry_local8.length()+1) == -1) { // Error handler to shut up gcc warnings } if (write(mPipe_fd_out, "\n\r", 3) == -1) { diff --git a/kdesktop/minicli.cpp b/kdesktop/minicli.cpp index 9fb4a283c..4b8d390b3 100644 --- a/kdesktop/minicli.cpp +++ b/kdesktop/minicli.cpp @@ -483,7 +483,7 @@ int Minicli::runCommand() proc_checkpwd.setScheduler(m_iScheduler); } - if (proc_checkpwd.checkInstall(m_dlg->lePassword->password().utf8()) != 0) + if (proc_checkpwd.checkInstall(m_dlg->lePassword->password().local8Bit()) != 0) { KMessageBox::sorry(this, i18n("Incorrect password; please try again.")); return 1; @@ -534,7 +534,7 @@ int Minicli::runCommand() sigprocmask(SIG_BLOCK, &sset, 0L); proc.setTerminal(true); proc.setErase(true); - _exit(proc.exec(m_dlg->lePassword->password().utf8())); + _exit(proc.exec(m_dlg->lePassword->password().local8Bit())); return 0; } else diff --git a/kdialog/kdialog.cpp b/kdialog/kdialog.cpp index 671be7465..fa2512077 100644 --- a/kdialog/kdialog.cpp +++ b/kdialog/kdialog.cpp @@ -281,7 +281,7 @@ static int directCommand(TDECmdLineArgs *args) { TQString result; bool retcode = Widgets::passwordBox(0, title, TQString::fromLocal8Bit(args->getOption("password")), result); - cout << result.utf8() << endl; + cout << result.local8Bit().data() << endl; return retcode ? 0 : 1; } diff --git a/tdepasswd/kcm/main.cpp b/tdepasswd/kcm/main.cpp index 9b11acbcd..0751c997e 100644 --- a/tdepasswd/kcm/main.cpp +++ b/tdepasswd/kcm/main.cpp @@ -221,7 +221,7 @@ void KCMUserAccount::save() } ChfnProcess *proc = new ChfnProcess(); - ret = proc->exec(password.utf8(), _mw->leRealname->text().utf8() ); + ret = proc->exec(password.local8Bit(), _mw->leRealname->text().local8Bit() ); if ( ret ) { if ( ret == ChfnProcess::PasswordError ) diff --git a/tdepasswd/passwd.cpp b/tdepasswd/passwd.cpp index 6d6d45675..ab0e913a2 100644 --- a/tdepasswd/passwd.cpp +++ b/tdepasswd/passwd.cpp @@ -66,7 +66,7 @@ PasswdProcess::~PasswdProcess() int PasswdProcess::checkCurrent(const TQString &oldpass) { - return exec(oldpass.utf8(), 0L, 1); + return exec(oldpass.local8Bit(), 0L, 1); } diff --git a/tdepasswd/passwddlg.cpp b/tdepasswd/passwddlg.cpp index f58a29996..eb897dc95 100644 --- a/tdepasswd/passwddlg.cpp +++ b/tdepasswd/passwddlg.cpp @@ -88,7 +88,7 @@ TDEpasswd2Dialog::TDEpasswd2Dialog(const TQString &oldpass, const TQString &user if (m_User.isEmpty()) setPrompt(i18n("Please enter your new password:")); else - setPrompt(i18n("Please enter the new password for user %1:").arg(m_User.utf8().data())); + setPrompt(i18n("Please enter the new password for user %1:").arg(m_User.local8Bit().data())); } @@ -99,7 +99,7 @@ TDEpasswd2Dialog::~TDEpasswd2Dialog() bool TDEpasswd2Dialog::checkPassword(const TQString &password) { - PasswdProcess proc(m_User.utf8()); + PasswdProcess proc(m_User.local8Bit()); TQString edit_password = password; if (edit_password.length() > 8) @@ -127,7 +127,7 @@ bool TDEpasswd2Dialog::checkPassword(const TQString &password) } } - int ret = proc.exec(m_Pass.utf8(), edit_password.utf8()); + int ret = proc.exec(m_Pass.local8Bit(), edit_password.local8Bit()); switch (ret) { case 0: diff --git a/tdepasswd/tdepasswd.cpp b/tdepasswd/tdepasswd.cpp index 41567bf28..a6015eacc 100644 --- a/tdepasswd/tdepasswd.cpp +++ b/tdepasswd/tdepasswd.cpp @@ -52,7 +52,7 @@ int main(int argc, char **argv) TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); if (args->count()) - user = TQString(args->arg(0)); + user = TQString::fromLocal8Bit(args->arg(0)); /* You must be able to run "tdepasswd loginName" */ if ( !user.isEmpty() && user!=KUser().loginName() && !bRoot) diff --git a/tdesu/tdesu/sudlg.cpp b/tdesu/tdesu/sudlg.cpp index e17b3168d..59ab64b08 100644 --- a/tdesu/tdesu/sudlg.cpp +++ b/tdesu/tdesu/sudlg.cpp @@ -71,7 +71,7 @@ bool TDEsuDialog::checkPassword(const TQString &password) { SuProcess proc; proc.setUser(m_User); - int status = proc.checkInstall(password.utf8()); + int status = proc.checkInstall(password.local8Bit()); switch (status) { case -1: diff --git a/tdesu/tdesu/tdesu.cpp b/tdesu/tdesu/tdesu.cpp index 2849b4c62..f2635925e 100644 --- a/tdesu/tdesu/tdesu.cpp +++ b/tdesu/tdesu/tdesu.cpp @@ -391,7 +391,7 @@ static int startApp() } else if (keep && have_daemon) { - client.setPass(password.utf8(), timeout); + client.setPass(password.local8Bit(), timeout); client.setPriority(priority); client.setScheduler(scheduler); int result = client.exec(command, user, options, env); @@ -415,7 +415,7 @@ static int startApp() proc.setPriority(priority); proc.setScheduler(scheduler); proc.setCommand(command); - int result = proc.exec(password.utf8()); + int result = proc.exec(password.local8Bit()); return result; } return -1; diff --git a/tdmlib/kgreet_classic.cpp b/tdmlib/kgreet_classic.cpp index 053f4fdee..996754181 100644 --- a/tdmlib/kgreet_classic.cpp +++ b/tdmlib/kgreet_classic.cpp @@ -280,16 +280,16 @@ KClassicGreeter::returnData() KGreeterPluginHandler::IsUser ); break; case 1: - handler->gplugReturnText( passwdEdit->password().utf8(), + handler->gplugReturnText( passwdEdit->password().local8Bit(), KGreeterPluginHandler::IsPassword | KGreeterPluginHandler::IsSecret ); break; case 2: - handler->gplugReturnText( passwd1Edit->password().utf8(), + handler->gplugReturnText( passwd1Edit->password().local8Bit(), KGreeterPluginHandler::IsSecret ); break; default: // case 3: - handler->gplugReturnText( passwd2Edit->password().utf8(), + handler->gplugReturnText( passwd2Edit->password().local8Bit(), KGreeterPluginHandler::IsNewPassword | KGreeterPluginHandler::IsSecret ); break; diff --git a/tdmlib/kgreet_pam.cpp b/tdmlib/kgreet_pam.cpp index ade772938..e7a5f0747 100644 --- a/tdmlib/kgreet_pam.cpp +++ b/tdmlib/kgreet_pam.cpp @@ -325,16 +325,16 @@ KPamGreeter::returnData() KGreeterPluginHandler::IsUser ); break; case 1: - handler->gplugReturnText( authEdit[0]->password().utf8(), + handler->gplugReturnText( authEdit[0]->password().local8Bit(), KGreeterPluginHandler::IsPassword | KGreeterPluginHandler::IsSecret ); break; case 2: - handler->gplugReturnText( authEdit[1]->password().utf8(), + handler->gplugReturnText( authEdit[1]->password().local8Bit(), KGreeterPluginHandler::IsSecret ); break; default: // case 3: - handler->gplugReturnText( authEdit[2]->password().utf8(), + handler->gplugReturnText( authEdit[2]->password().local8Bit(), KGreeterPluginHandler::IsNewPassword | KGreeterPluginHandler::IsSecret ); break; diff --git a/tdmlib/kgreet_winbind.cpp b/tdmlib/kgreet_winbind.cpp index 0bfc1e7fb..471095d7e 100644 --- a/tdmlib/kgreet_winbind.cpp +++ b/tdmlib/kgreet_winbind.cpp @@ -356,16 +356,16 @@ KWinbindGreeter::returnData() KGreeterPluginHandler::IsUser ); break; case 1: - handler->gplugReturnText( passwdEdit->password().utf8(), + handler->gplugReturnText( passwdEdit->password().local8Bit(), KGreeterPluginHandler::IsPassword | KGreeterPluginHandler::IsSecret ); break; case 2: - handler->gplugReturnText( passwd1Edit->password().utf8(), + handler->gplugReturnText( passwd1Edit->password().local8Bit(), KGreeterPluginHandler::IsSecret ); break; default: // case 3: - handler->gplugReturnText( passwd2Edit->password().utf8(), + handler->gplugReturnText( passwd2Edit->password().local8Bit(), KGreeterPluginHandler::IsNewPassword | KGreeterPluginHandler::IsSecret ); break; -- cgit v1.2.3