[debian-edu-commits] r79918 - trunk/src/libpam-mklocaluser/debian
pere at alioth.debian.org
pere at alioth.debian.org
Sat May 4 06:58:09 UTC 2013
Author: pere
Date: 2013-05-04 06:58:09 +0000 (Sat, 04 May 2013)
New Revision: 79918
Modified:
trunk/src/libpam-mklocaluser/debian/changelog
trunk/src/libpam-mklocaluser/debian/pam-python.py
Log:
Do not call chown -R, implemnt it in python instead.
Modified: trunk/src/libpam-mklocaluser/debian/changelog
===================================================================
--- trunk/src/libpam-mklocaluser/debian/changelog 2013-05-04 06:49:51 UTC (rev 79917)
+++ trunk/src/libpam-mklocaluser/debian/changelog 2013-05-04 06:58:09 UTC (rev 79918)
@@ -5,6 +5,7 @@
calling "echo 'something' >> /etc/file" in a subshell.
* Do not try to syslog an exception, as a string is needed in newer
python versions.
+ * Do not call chown -R, implemnt it in python instead.
-- Petter Reinholdtsen <pere at debian.org> Sat, 04 May 2013 08:25:53 +0200
Modified: trunk/src/libpam-mklocaluser/debian/pam-python.py
===================================================================
--- trunk/src/libpam-mklocaluser/debian/pam-python.py 2013-05-04 06:49:51 UTC (rev 79917)
+++ trunk/src/libpam-mklocaluser/debian/pam-python.py 2013-05-04 06:58:09 UTC (rev 79918)
@@ -20,6 +20,13 @@
f.write(line)
f.close()
+def chown_recursive(path, uid, gid):
+ for root, dirs, files in os.walk(path):
+ for dirname in dirs:
+ os.chown(os.path.join(root, dirname), uid, gid)
+ for filename in files:
+ os.chown(os.path.join(root, filename), uid, gid)
+
# FIXME This function always report an error
def runcmd(pamh, cmd):
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,)
@@ -105,8 +112,7 @@
# Change perm of new home dir
os.chmod(newhomedir, dirmode)
- # os.chown(newhomedir, uid, gid) - not recursive
- runcmd(pamh, "/bin/chown -R %d:%d '%s'" % (uid, gid, newhomedir))
+ chown_recursive(newhomedir, uid, gid)
# Flush nscd cache to get rid of original user entry
if os.access("/usr/sbin/nscd", os.X_OK):
More information about the debian-edu-commits
mailing list