Bug 100443 - Editing of a user in KUser destroys it.
Summary: Editing of a user in KUser destroys it.
Status: RESOLVED FIXED
Alias: None
Product: kuser
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR grave
Target Milestone: ---
Assignee: Maksim Orlovich
URL:
Keywords:
: 100342 102317 102613 102734 104247 106092 106820 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-28 15:56 UTC by Jānis Legzdiņš
Modified: 2005-08-26 23:17 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jānis Legzdiņš 2005-02-28 15:56:02 UTC
Version:            (using KDE KDE 3.3.92)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.3 
OS:                Linux

When I edit an user account to add another group, when I save it, it's basicly destroyed - it's saved with uid 0, no home directory and shell, password expirations are reset to 0 days. I had to use usermod and passwd to restore account to a working state.
Comment 1 Gleb Litvjak 2005-03-13 09:53:44 UTC
I can confirm - using kde 3.4.0-rc1 (from gentoo portage), gcc 3.4.3

I noticed this misbehavior when adding a new user. As I've read on the Gentoo forums I am not the only one affected.
Comment 2 Ludo 2005-03-21 17:11:47 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 Maksim Orlovich 2005-03-27 22:35:06 UTC
*** Bug 102613 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2005-03-29 17:16:49 UTC
*** Bug 102734 has been marked as a duplicate of this bug. ***
Comment 5 Stephan Binner 2005-03-31 10:31:31 UTC
Does http://bugs.kde.org/attachment.cgi?id=10409&action=view patch apply for this one as well?
Comment 6 Jānis Legzdiņš 2005-03-31 14:04:45 UTC
Yes, it fixes the problem.
Comment 7 Gleb Litvjak 2005-03-31 14:49:57 UTC
The patch fixed the trouble for me too.
Comment 8 Thiago Macieira 2005-04-01 02:05:24 UTC
Closing as issue seems to have been resolved.

Has the patch been committed already?
Comment 9 Maksim Orlovich 2005-04-01 02:44:43 UTC
Nope, but will do so in half a week or so
Comment 10 Stephan Binner 2005-04-03 14:22:02 UTC
reopen until applied
Comment 11 Maksim Orlovich 2005-04-07 16:30:48 UTC
CVS commit by orlovich: 

Do not access cbposix if it's not initialized (also set it to 0 in that case, so the app 
crashes but does not corrupt data in case of other unguarded access; this probably should be done for 
the other conditionally created widgets as well, but that's up to KUser folks).

Avoids damaging accounts in people's password files(!!!!), and crashing when editting 
all over the place.

CCBUG:100443


  M +7 -3      propdlg.cpp   1.85


--- kdeadmin/kuser/propdlg.cpp  #1.84:1.85
@@ -211,4 +211,6 @@ void propdlg::initDlg()
       connect(cbposix, SIGNAL(stateChanged(int)), this, SLOT(cbposixChanged()));
       addRow(frame, layout, row++, cbposix, i18n("Disable &POSIX account information"), whatstr);
+    } else {
+      cbposix = 0;
     }
     frontrow = row;
@@ -707,5 +709,6 @@ void propdlg::mergeUser( KUser *user, KU
 
   newuser->copy( user );
-  if ( cbposix->state() != QButton::NoChange ) {
+
+  if ( kug->getUsers().getCaps() & KUsers::Cap_Disable_POSIX && cbposix->state() != QButton::NoChange ) {
     if ( cbposix->isChecked() )
       newuser->setCaps( newuser->getCaps() & ~KUser::Cap_POSIX );
@@ -874,5 +877,5 @@ bool propdlg::check()
 {
   bool one = ( mUsers.getFirst() == mUsers.getLast() );
-  bool posix = !( cbposix->isChecked() );
+  bool posix = !( kug->getUsers().getCaps() & KUsers::Cap_Disable_POSIX ) || !( cbposix->isChecked() );
 
   if ( one && posix && leid->text().isEmpty() ) {
@@ -929,5 +932,6 @@ void propdlg::slotOk()
   uid_t newuid = leid->text().toULong();
 
-  if ( one && !cbposix->isChecked() && olduid != newuid )
+  if ( one && ( !( kug->getUsers().getCaps() & KUsers::Cap_Disable_POSIX ) || !cbposix->isChecked() )
+               && olduid != newuid )
   {
     if (kug->getUsers().lookup(newuid)) {
Comment 12 Maksim Orlovich 2005-04-07 16:33:48 UTC
CVS commit by orlovich: 

Backport the fix to the grave #100443: do not scribble over uninitialized
pointers, damaging account data.
BUG:100443


  M +7 -3      propdlg.cpp   1.84.2.1


--- kdeadmin/kuser/propdlg.cpp  #1.84:1.84.2.1
@@ -211,4 +211,6 @@ void propdlg::initDlg()
       connect(cbposix, SIGNAL(stateChanged(int)), this, SLOT(cbposixChanged()));
       addRow(frame, layout, row++, cbposix, i18n("Disable &POSIX account information"), whatstr);
+    } else {
+      cbposix = 0;
     }
     frontrow = row;
@@ -707,5 +709,6 @@ void propdlg::mergeUser( KUser *user, KU
 
   newuser->copy( user );
-  if ( cbposix->state() != QButton::NoChange ) {
+
+  if ( kug->getUsers().getCaps() & KUsers::Cap_Disable_POSIX && cbposix->state() != QButton::NoChange ) {
     if ( cbposix->isChecked() )
       newuser->setCaps( newuser->getCaps() & ~KUser::Cap_POSIX );
@@ -874,5 +877,5 @@ bool propdlg::check()
 {
   bool one = ( mUsers.getFirst() == mUsers.getLast() );
-  bool posix = !( cbposix->isChecked() );
+  bool posix = !( kug->getUsers().getCaps() & KUsers::Cap_Disable_POSIX ) || !( cbposix->isChecked() );
 
   if ( one && posix && leid->text().isEmpty() ) {
@@ -929,5 +932,6 @@ void propdlg::slotOk()
   uid_t newuid = leid->text().toULong();
 
-  if ( one && !cbposix->isChecked() && olduid != newuid )
+  if ( one && ( !( kug->getUsers().getCaps() & KUsers::Cap_Disable_POSIX ) || !cbposix->isChecked() )
+               && olduid != newuid )
   {
     if (kug->getUsers().lookup(newuid)) {
Comment 13 Maksim Orlovich 2005-04-12 21:08:17 UTC
*** Bug 100342 has been marked as a duplicate of this bug. ***
Comment 14 Maksim Orlovich 2005-04-20 00:24:15 UTC
*** Bug 104247 has been marked as a duplicate of this bug. ***
Comment 15 Maksim Orlovich 2005-04-20 00:24:26 UTC
*** Bug 102317 has been marked as a duplicate of this bug. ***
Comment 16 Maksim Orlovich 2005-05-22 05:14:19 UTC
*** Bug 106092 has been marked as a duplicate of this bug. ***
Comment 17 Maksim Orlovich 2005-06-05 17:24:00 UTC
*** Bug 106820 has been marked as a duplicate of this bug. ***
Comment 18 Alessandro 2005-07-23 10:48:20 UTC
I have this problem but I don't undestand how I can resolve it.. can somebody help me?
Comment 19 indrek seppo 2005-08-19 23:01:11 UTC
The problem (with kuser meshing up the /etc/password file, changing uid to 0 etc) exists again with kde 3.4.2, please reopen the bug.
Comment 20 Szombathelyi György 2005-08-26 23:17:04 UTC
Can you attach the debug output of KUser when the UID erasing happens?