[debian-edu-commits] [Git][debian-edu/upstream/libpam-mklocaluser][master] 2 commits: debian/pam-python.py: white-space cleanup.

Mike Gabriel gitlab at salsa.debian.org
Fri May 22 16:27:31 BST 2020



Mike Gabriel pushed to branch master at Debian Edu / upstream / libpam-mklocaluser


Commits:
5e1ae8b1 by Mike Gabriel at 2020-05-22T07:55:27+02:00
debian/pam-python.py: white-space cleanup.

- - - - -
40749704 by Mike Gabriel at 2020-05-22T17:24:37+02:00
debian/pam-python.py: Set HOME env variable to the new home directory, even on initial user login. This makes it possibilty to drop the concept of enforced re-login on initial user login. (Closes: #760496, #961254).

- - - - -


2 changed files:

- debian/changelog
- debian/pam-python.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+libpam-mklocaluser (0.18) UNRELEASED; urgency=medium
+
+  * Team upload.
+
+  [ Mike Gabriel ]
+  * debian/pam-python.py: White-space clean-up.
+
+ -- Mike Gabriel <sunweaver at debian.org>  Fri, 22 May 2020 07:53:40 +0200
+
 libpam-mklocaluser (0.17) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/pam-python.py
=====================================
@@ -44,8 +44,8 @@ def append_line(filename, line):
 
 def chown_recursive(path, uid, gid):
   os.chown(path, uid, gid)
-  for root, dirs, files in os.walk(path):  
-    for dirname in dirs:  
+  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)
@@ -126,7 +126,7 @@ def check_and_create_localuser(pamh, user):
                     (user, uid, gid, gecos, newhomedir, shell))
 
       # Add shadow entry too.
-      # FIXME Should only add it if it is missing.  
+      # FIXME Should only add it if it is missing.
       append_line('/etc/shadow', \
                     "%s:x:%d:%d:%d:%d:::\n" \
                     % (user, pwlastchange, pwminage, pwmaxage, pwwarn))
@@ -147,14 +147,13 @@ def check_and_create_localuser(pamh, user):
       # FIXME Should be rewritten in python, I guess
       runcmd(pamh, "if [ -d /etc/mklocaluser.d ]; then ORIGHOMEDIR='%s' USER='%s' /bin/run-parts /etc/mklocaluser.d ; fi" % (homedir, user))
 
-      # Let the user know what is going on
-      msg = pamh.Message(pamh.PAM_TEXT_INFO,
-                         "Local user created in /home/, please log in again to start using it.")
-      pamh.conversation(msg)
+      # At this point, the HOME environment variable is still set to the
+      # value (i.e. path) as provided by the LDAP database. With pam_mklocaluser,
+      # we want a HOME path with the pattern /<topdir>/<user>. Luckily
+      # the pam_python.so implementation provides an easy-to-use interface to
+      # pam_getenv/pam_putenv:
+      pamh.env['HOME'] = newhomedir
 
-      # Throw out user, as the log process cached the home directory
-      # and need to be restarted.
-      return pamh.PAM_TRY_AGAIN
     except Exception as e:
       syslog.syslog("Failure while creating local user: %s " % (e))
       pass
@@ -187,7 +186,7 @@ def pam_sm_open_session(pamh, flags, argv):
       return pamh.PAM_SUCCESS
   except pamh.exception as e:
     return e.pam_result
-    
+
   try:
     return check_and_create_localuser(pamh, user)
   except KeyError as e:



View it on GitLab: https://salsa.debian.org/debian-edu/upstream/libpam-mklocaluser/-/compare/3975a2cbb2192c9104b5f96ab9624ac5b0362253...407497044bd135bc013d32a83b091f35a9ae3abf

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/upstream/libpam-mklocaluser/-/compare/3975a2cbb2192c9104b5f96ab9624ac5b0362253...407497044bd135bc013d32a83b091f35a9ae3abf
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20200522/78c7090a/attachment-0001.html>


More information about the debian-edu-commits mailing list