Improved previous commit using local8Bit() in place of utf8() when a

password is transmitted over pipes to other processes.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/20/head
Michele Calgaro 5 years ago
parent 6ae10fc66e
commit 6db0c5f228
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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) {

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

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

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

@ -66,7 +66,7 @@ PasswdProcess::~PasswdProcess()
int PasswdProcess::checkCurrent(const TQString &oldpass)
{
return exec(oldpass.utf8(), 0L, 1);
return exec(oldpass.local8Bit(), 0L, 1);
}

@ -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 <b>%1</b>:").arg(m_User.utf8().data()));
setPrompt(i18n("Please enter the new password for user <b>%1</b>:").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:

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

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

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

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

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

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

Loading…
Cancel
Save