]> git.decadent.org.uk Git - dak.git/commitdiff
Adjust to deal with the new Debian supplementaryGid
authorJoerg Jaspert <joerg@debian.org>
Sun, 18 Oct 2015 12:17:05 +0000 (14:17 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sun, 18 Oct 2015 12:17:05 +0000 (14:17 +0200)
Signed-off-by: Joerg Jaspert <joerg@debian.org>
dak/import_users_from_passwd.py

index ae99ef9094db7d8601202a79d47a2e09debd7471..ed121398fe43ece4320a65dc4d6a214c3d1c4835 100755 (executable)
@@ -30,6 +30,7 @@
 ################################################################################
 
 import pwd
+import grp
 import sys
 import re
 import apt_pkg
@@ -73,15 +74,18 @@ def main ():
         usage(1)
 
     session = DBConn().session()
-    valid_gid = int(cnf.get("Import-Users-From-Passwd::ValidGID",""))
+    valid_gid = cnf.get("Import-Users-From-Passwd::ValidGID", "")
+    if valid_gid:
+        debiangrp = grp.getgrnam(valid_gid).gr_mem
+    else:
+        debiangrp = []
 
     passwd_unames = {}
     for entry in pwd.getpwall():
         uname = entry[0]
-        gid = entry[3]
-        if valid_gid and gid != valid_gid:
+        if uname not in debiangrp:
             if Options["Verbose"]:
-                print "Skipping %s (GID %s != Valid GID %s)." % (uname, gid, valid_gid)
+                print "Skipping %s (Not in group %s)." % (uname, valid_gid)
             continue
         passwd_unames[uname] = ""