[debian-edu-commits] debian-edu/upstream/ 12/71: Changing home directory on the fly do not work. Reject login to force user to log in again with the new home directory.

Petter Reinholdtsen pere at moszumanska.debian.org
Mon Jun 9 18:25:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository libpam-mklocaluser.

commit 31312f217e41443bb9ca5633b52ae4207ccbd207
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sat May 1 15:28:59 2010 +0000

    Changing home directory on the fly do not work.  Reject login to force
    user to log in again with the new home directory.
---
 debian/pam-python.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/pam-python.py b/debian/pam-python.py
index 73efc26..a738701 100755
--- a/debian/pam-python.py
+++ b/debian/pam-python.py
@@ -14,7 +14,7 @@ import subprocess
 def runcmd(pamh, cmd):
   proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,)
   output = proc.communicate()[0]
-  print "output: %s" % output
+#  print "output: %s" % output
 
 def check_and_create_localuser(pamh, user):
   # Location of local users
@@ -66,13 +66,14 @@ def check_and_create_localuser(pamh, user):
       # Change perm of new home dir
       os.chmod(newhomedir,0700)
       # os.chown(newhomedir, uid, gid)
-      runcmd(pamh, "/sbin/chown %d:%d %s" % (uid, gid, newhomedir))
+      runcmd(pamh, "/bin/chown -R %d:%d %s" % (uid, gid, newhomedir))
 
       # Flush nscd cache to get rid of original user entry
       runcmd(pamh, "/sbin/ncsd -i passwd")
 
-      # Set $HOME to new home directory. XXX Do this work?
-      pamh.env["HOME"] = newhomedir
+      # Throw out user, as the log process cached the home directory
+      # and need to be restarted.
+      return pamh.PAM_SYSTEM_ERR
     except Exception, e:
       print e
       pass

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/libpam-mklocaluser.git



More information about the debian-edu-commits mailing list