[master][PATCH] Revert chrooting when setting user/root password

Vratislav Podzimek vpodzime at redhat.com
Mon Apr 28 12:28:01 UTC 2014


The commit cea0be396b21e6edb368bd8f8846470e2681af0e made code setting the
user/root password run in chroot. However, that code seems to just modify the
database which is then written out and that cannot run in chroot because that
makes the change ineffective. Thus reverting the change.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/users.py | 31 +++++++++++--------------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/pyanaconda/users.py b/pyanaconda/users.py
index a37b615..275aed9 100644
--- a/pyanaconda/users.py
+++ b/pyanaconda/users.py
@@ -408,27 +408,18 @@ class Users:
         else:
             return self._finishChroot(childpid)
 
-    def setUserPassword(self, username, password, isCrypted, lock, algo=None, root=None):
-        childpid = self._prepareChroot(root)
-
-        if childpid == 0:
-            user = self.admin.lookupUserByName(username)
+    def setUserPassword(self, username, password, isCrypted, lock, algo=None):
+        user = self.admin.lookupUserByName(username)
 
-            if isCrypted:
-                self.admin.setpassUser(user, password, True)
-            else:
-                self.admin.setpassUser(user, cryptPassword(password, algo=algo), True)
+        if isCrypted:
+            self.admin.setpassUser(user, password, True)
+        else:
+            self.admin.setpassUser(user, cryptPassword(password, algo=algo), True)
 
-            if lock:
-                self.admin.lockUser(user)
+        if lock:
+            self.admin.lockUser(user)
 
-            user.set(libuser.SHADOWLASTCHANGE, "")
-            if self.admin.modifyUser(user):
-                os._exit(0)
-            else:
-                os._exit(1)
-        else:
-            return self._finishChroot(childpid)
+        user.set(libuser.SHADOWLASTCHANGE, "")
 
-    def setRootPassword(self, password, isCrypted=False, isLocked=False, algo=None, root=None):
-        return self.setUserPassword("root", password, isCrypted, isLocked, algo, root)
+    def setRootPassword(self, password, isCrypted=False, isLocked=False, algo=None):
+        return self.setUserPassword("root", password, isCrypted, isLocked, algo)
-- 
1.9.0



More information about the anaconda-patches mailing list