[debian-edu-commits] debian-edu/upstream/ 48/71: * Make module more robust. Move group lookup into the code path where it is used, to avoid failing if the group is missing when the user is already available locally (Closes: #). * Add code to handle missing primary group infomration when creating the local user.

Petter Reinholdtsen pere at moszumanska.debian.org
Mon Jun 9 18:25:39 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 566362f30fa20898824a23447eb7dc2a89a69dee
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Fri Sep 17 09:38:37 2010 +0000

    * Make module more robust.  Move group lookup into the code path
      where it is used, to avoid failing if the group is missing when
      the user is already available locally (Closes: #).
    * Add code to handle missing primary group infomration when creating
      the local user.
---
 debian/changelog     | 10 ++++++++++
 debian/pam-python.py | 10 +++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index dd9099c..758188f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+libpam-mklocaluser (0.6) UNRELEASED; urgency=low
+
+  * Make module more robust.  Move group lookup into the code path
+    where it is used, to avoid failing if the group is missing when
+    the user is already available locally (Closes: #).
+  * Add code to handle missing primary group infomration when creating
+    the local user.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Fri, 17 Sep 2010 11:24:46 +0200
+
 libpam-mklocaluser (0.5) unstable; urgency=low
 
   * Do not create local home directory if the directory mentioned in
diff --git a/debian/pam-python.py b/debian/pam-python.py
index 3ca0e7c..05cb237 100755
--- a/debian/pam-python.py
+++ b/debian/pam-python.py
@@ -47,9 +47,6 @@ def check_and_create_localuser(pamh, user):
   gecos = userinfo[4]
   homedir =  userinfo[5]
 
-  groupinfo = grp.getgrgid(gid)
-  groupname = groupinfo[0]
-
   # Ignore users with uid < 1000
   if userinfo[2] < minimum_uid:
     return pamh.PAM_SUCCESS
@@ -67,6 +64,13 @@ def check_and_create_localuser(pamh, user):
 
   newhomedir = os.path.join(topdir, user)
   if not os.path.isdir(homedir) and not os.path.isdir(newhomedir):
+    try:
+      groupinfo = grp.getgrgid(gid)
+      groupname = groupinfo[0]
+    except KeyError, e:
+      syslog.syslog("Unknown primary group with gid %d" % gid)
+      groupname = "[unknown]"
+
     syslog.syslog("Creating local passwd entry uid=%d(%s) gid=%d(%s) gecos='%s' home=%s" % (uid, user, gid, groupname, gecos, newhomedir))
     try:
       # Add user entry with overridden home directory in /etc/passwd.

-- 
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