X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=881f5217cbd62d6b4e3ae2d83346bb5e689f71fe;hb=e98aa810efeea1da3ac4c2f547b661674968c2f9;hp=93559659a3fa8ebb4b6da11fa8db96d7c0d390da;hpb=b48d0155910b67628883d9b9df6852a9cbdf4415;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index 9355965..881f521 100755 --- a/ud-generate +++ b/ud-generate @@ -48,7 +48,7 @@ EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)?$") BSMTPCheck = re.compile(".*mx 0 (master)\.debian\.org\..*",re.DOTALL) PurposeHostField = re.compile(r".*\[\[([\*\-]?[a-z0-9.\-]*)(?:\|.*)?\]\]") IsV6Addr = re.compile("^[a-fA-F0-9:]+$") -IsDebianHost = re.compile("[a-zA-Z0-9\.]+\.debian\.org$") +IsDebianHost = re.compile(ConfModule.dns_hostmatch) DNSZone = ".debian.net" Keyrings = ConfModule.sync_keyrings.split(":") @@ -426,6 +426,7 @@ def GenGroup(File): GroupMap = {} for x in GroupIDMap.keys(): GroupMap[x] = [] + GroupHasPrimaryMembers = {} # Fetch all the users global PasswdAttrs @@ -433,6 +434,8 @@ def GenGroup(File): # Sort them into a list of groups having a set of users for x in PasswdAttrs: uid = GetAttr(x, "uid") + if 'gidNumber' in x[1]: + GroupHasPrimaryMembers[ int(x[1]["gidNumber"][0]) ] = True if x[1].has_key("uidNumber") == 0 or not IsInGroup(x): continue if x[1].has_key("supplementaryGid") == 0: @@ -446,11 +449,10 @@ def GenGroup(File): # Output the group file. J = 0 for x in GroupMap.keys(): - - if len(GroupMap[x]) == 0: + if GroupIDMap.has_key(x) == 0: continue - if GroupIDMap.has_key(x) == 0: + if len(GroupMap[x]) == 0 and GroupIDMap[x] not in GroupHasPrimaryMembers: continue grouprevmap[GroupIDMap[x]] = x