Browse Source

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>
Michele Calgaro 3 months ago
parent
commit
6db0c5f228
Signed by: Michele Calgaro <michele.calgaro@yahoo.it> GPG Key ID: 2A75B7CA8ADED5CF

+ 2
- 2
kdesktop/lock/lockprocess.cc View File

@@ -2807,8 +2807,8 @@ void LockProcess::processInputPipeCommand(TQString inputcommand) {
2807 2807
 			pin_entry = qryDlg.getEntry();
2808 2808
 			mInfoMessageDisplayed=false;
2809 2809
 			if (mPipeOpen_out == true) {
2810
-			  TQCString pin_entry_utf8 = pin_entry.utf8();  // utf8 length may differ from TQString length
2811
-				if (write(mPipe_fd_out, pin_entry_utf8.data(), pin_entry_utf8.length()+1) == -1) {
2810
+			  TQCString pin_entry_local8 = pin_entry.local8Bit();  // local 8 bit length may differ from TQString length
2811
+				if (write(mPipe_fd_out, pin_entry_local8.data(), pin_entry_local8.length()+1) == -1) {
2812 2812
 					// Error handler to shut up gcc warnings
2813 2813
 				}
2814 2814
 				if (write(mPipe_fd_out, "\n\r", 3) == -1) {

+ 2
- 2
kdesktop/minicli.cpp View File

@@ -483,7 +483,7 @@ int Minicli::runCommand()
483 483
         proc_checkpwd.setScheduler(m_iScheduler);
484 484
       }
485 485
 
486
-      if (proc_checkpwd.checkInstall(m_dlg->lePassword->password().utf8()) != 0)
486
+      if (proc_checkpwd.checkInstall(m_dlg->lePassword->password().local8Bit()) != 0)
487 487
       {
488 488
           KMessageBox::sorry(this, i18n("Incorrect password; please try again."));
489 489
         return 1;
@@ -534,7 +534,7 @@ int Minicli::runCommand()
534 534
     sigprocmask(SIG_BLOCK, &sset, 0L);
535 535
     proc.setTerminal(true);
536 536
     proc.setErase(true);
537
-    _exit(proc.exec(m_dlg->lePassword->password().utf8()));
537
+    _exit(proc.exec(m_dlg->lePassword->password().local8Bit()));
538 538
     return 0;
539 539
   }
540 540
   else

+ 1
- 1
kdialog/kdialog.cpp View File

@@ -281,7 +281,7 @@ static int directCommand(TDECmdLineArgs *args)
281 281
     {
282 282
       TQString result;
283 283
       bool retcode = Widgets::passwordBox(0, title, TQString::fromLocal8Bit(args->getOption("password")), result);
284
-      cout << result.utf8() << endl;
284
+      cout << result.local8Bit().data() << endl;
285 285
       return retcode ? 0 : 1;
286 286
     }
287 287
 

+ 1
- 1
tdepasswd/kcm/main.cpp View File

@@ -221,7 +221,7 @@ void KCMUserAccount::save()
221 221
 		}
222 222
 
223 223
 		ChfnProcess *proc = new ChfnProcess();
224
-		ret = proc->exec(password.utf8(), _mw->leRealname->text().utf8() );
224
+		ret = proc->exec(password.local8Bit(), _mw->leRealname->text().local8Bit() );
225 225
 		if ( ret )
226 226
 			{
227 227
 			if ( ret == ChfnProcess::PasswordError )

+ 1
- 1
tdepasswd/passwd.cpp View File

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

+ 3
- 3
tdepasswd/passwddlg.cpp View File

@@ -88,7 +88,7 @@ TDEpasswd2Dialog::TDEpasswd2Dialog(const TQString &oldpass, const TQString &user
88 88
     if (m_User.isEmpty())
89 89
         setPrompt(i18n("Please enter your new password:"));
90 90
     else
91
-        setPrompt(i18n("Please enter the new password for user <b>%1</b>:").arg(m_User.utf8().data()));
91
+        setPrompt(i18n("Please enter the new password for user <b>%1</b>:").arg(m_User.local8Bit().data()));
92 92
 }
93 93
 
94 94
 
@@ -99,7 +99,7 @@ TDEpasswd2Dialog::~TDEpasswd2Dialog()
99 99
 
100 100
 bool TDEpasswd2Dialog::checkPassword(const TQString &password)
101 101
 {
102
-    PasswdProcess proc(m_User.utf8());
102
+    PasswdProcess proc(m_User.local8Bit());
103 103
     TQString edit_password = password;
104 104
 
105 105
     if (edit_password.length() > 8)
@@ -127,7 +127,7 @@ bool TDEpasswd2Dialog::checkPassword(const TQString &password)
127 127
 	}
128 128
     }
129 129
 
130
-    int ret = proc.exec(m_Pass.utf8(), edit_password.utf8());
130
+    int ret = proc.exec(m_Pass.local8Bit(), edit_password.local8Bit());
131 131
     switch (ret)
132 132
     {
133 133
     case 0:

+ 1
- 1
tdepasswd/tdepasswd.cpp View File

@@ -52,7 +52,7 @@ int main(int argc, char **argv)
52 52
     TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
53 53
 
54 54
     if (args->count())
55
-	user = TQString(args->arg(0));
55
+	user = TQString::fromLocal8Bit(args->arg(0));
56 56
 
57 57
     /* You must be able to run "tdepasswd loginName" */
58 58
     if ( !user.isEmpty() && user!=KUser().loginName() && !bRoot)

+ 1
- 1
tdesu/tdesu/sudlg.cpp View File

@@ -71,7 +71,7 @@ bool TDEsuDialog::checkPassword(const TQString &password)
71 71
 {
72 72
     SuProcess proc;
73 73
     proc.setUser(m_User);
74
-    int status = proc.checkInstall(password.utf8());
74
+    int status = proc.checkInstall(password.local8Bit());
75 75
     switch (status)
76 76
     {
77 77
     case -1:

+ 2
- 2
tdesu/tdesu/tdesu.cpp View File

@@ -391,7 +391,7 @@ static int startApp()
391 391
     }
392 392
     else if (keep && have_daemon)
393 393
     {
394
-        client.setPass(password.utf8(), timeout);
394
+        client.setPass(password.local8Bit(), timeout);
395 395
         client.setPriority(priority);
396 396
         client.setScheduler(scheduler);
397 397
         int result = client.exec(command, user, options, env);
@@ -415,7 +415,7 @@ static int startApp()
415 415
         proc.setPriority(priority);
416 416
         proc.setScheduler(scheduler);
417 417
         proc.setCommand(command);
418
-        int result = proc.exec(password.utf8());
418
+        int result = proc.exec(password.local8Bit());
419 419
         return result;
420 420
     }
421 421
     return -1;

+ 3
- 3
tdmlib/kgreet_classic.cpp View File

@@ -280,16 +280,16 @@ KClassicGreeter::returnData()
280 280
 		                          KGreeterPluginHandler::IsUser );
281 281
 		break;
282 282
 	case 1:
283
-		handler->gplugReturnText( passwdEdit->password().utf8(),
283
+		handler->gplugReturnText( passwdEdit->password().local8Bit(),
284 284
 		                          KGreeterPluginHandler::IsPassword |
285 285
 		                          KGreeterPluginHandler::IsSecret );
286 286
 		break;
287 287
 	case 2:
288
-		handler->gplugReturnText( passwd1Edit->password().utf8(),
288
+		handler->gplugReturnText( passwd1Edit->password().local8Bit(),
289 289
 		                          KGreeterPluginHandler::IsSecret );
290 290
 		break;
291 291
 	default: // case 3:
292
-		handler->gplugReturnText( passwd2Edit->password().utf8(),
292
+		handler->gplugReturnText( passwd2Edit->password().local8Bit(),
293 293
 		                          KGreeterPluginHandler::IsNewPassword |
294 294
 		                          KGreeterPluginHandler::IsSecret );
295 295
 		break;

+ 3
- 3
tdmlib/kgreet_pam.cpp View File

@@ -325,16 +325,16 @@ KPamGreeter::returnData()
325 325
 					  KGreeterPluginHandler::IsUser );
326 326
 		break;
327 327
 	case 1:
328
-		handler->gplugReturnText( authEdit[0]->password().utf8(),
328
+		handler->gplugReturnText( authEdit[0]->password().local8Bit(),
329 329
 					  KGreeterPluginHandler::IsPassword |
330 330
 					  KGreeterPluginHandler::IsSecret );
331 331
 		break;
332 332
 	case 2:
333
-		handler->gplugReturnText( authEdit[1]->password().utf8(),
333
+		handler->gplugReturnText( authEdit[1]->password().local8Bit(),
334 334
 					  KGreeterPluginHandler::IsSecret );
335 335
 		break;
336 336
 	default: // case 3:
337
-		handler->gplugReturnText( authEdit[2]->password().utf8(),
337
+		handler->gplugReturnText( authEdit[2]->password().local8Bit(),
338 338
 					  KGreeterPluginHandler::IsNewPassword |
339 339
 					  KGreeterPluginHandler::IsSecret );
340 340
 		break;

+ 3
- 3
tdmlib/kgreet_winbind.cpp View File

@@ -356,16 +356,16 @@ KWinbindGreeter::returnData()
356 356
 		                          KGreeterPluginHandler::IsUser );
357 357
 		break;
358 358
 	case 1:
359
-		handler->gplugReturnText( passwdEdit->password().utf8(),
359
+		handler->gplugReturnText( passwdEdit->password().local8Bit(),
360 360
 		                          KGreeterPluginHandler::IsPassword |
361 361
 		                          KGreeterPluginHandler::IsSecret );
362 362
 		break;
363 363
 	case 2:
364
-		handler->gplugReturnText( passwd1Edit->password().utf8(),
364
+		handler->gplugReturnText( passwd1Edit->password().local8Bit(),
365 365
 		                          KGreeterPluginHandler::IsSecret );
366 366
 		break;
367 367
 	default: // case 3:
368
-		handler->gplugReturnText( passwd2Edit->password().utf8(),
368
+		handler->gplugReturnText( passwd2Edit->password().local8Bit(),
369 369
 		                          KGreeterPluginHandler::IsNewPassword |
370 370
 		                          KGreeterPluginHandler::IsSecret );
371 371
 		break;

Loading…
Cancel
Save