X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=792383e870750ef58c8b244f366ce38e17c36c61;hb=2525bf73603cb6487cfcea096e2dc347ad360394;hp=e70efb040c5cc72e1816472de8a903146796126c;hpb=32e0c5640dc72acf4c362fd373f26be78a45a277;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index e70efb0..792383e 100755 --- a/ud-generate +++ b/ud-generate @@ -2,7 +2,7 @@ # -*- mode: python -*- # Generates passwd, shadow and group files from the ldap directory. -import string, re, time, ldap, getopt, sys, os, posix, pwd; +import string, re, time, ldap, getopt, sys, os, pwd; from userdir_ldap import *; PasswdAttrs = None; @@ -202,6 +202,8 @@ def GenGroup(l,File): # Output the group file. Counter = 0; for x in GroupMap.keys(): + if GroupIDMap.has_key(x) == 0: + continue; Line = "%s:x:%u:" % (x,GroupIDMap[x]); Comma = ''; for I in GroupMap[x]: @@ -334,7 +336,7 @@ def GenDNS(l,File): # Connect to the ldap server l = ldap.open(LDAPServer); -F = open(PassDir+"/pass-"+pwd.getpwuid(posix.getuid())[0],"r"); +F = open(PassDir+"/pass-"+pwd.getpwuid(os.getuid())[0],"r"); Pass = string.split(string.strip(F.readline())," "); F.close(); l.simple_bind_s("uid="+Pass[0]+","+BaseDn,Pass[1]);