X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=a0d5d7c67ee40c127b5eb6fb6d4c7369c986a7de;hb=51f98437460dd3adac2cacd9510551dd2f3d54a7;hp=b627cae93f7e2744bacb8964f09a7fe1c442c005;hpb=c50d88536a4feb3087d1aa802e110250cb2861fc;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index b627cae..a0d5d7c 100755 --- a/ud-generate +++ b/ud-generate @@ -146,7 +146,7 @@ def GenGroup(l,File,Allowed): if GroupMap.has_key(I): GroupMap[I].append(GetAttr(x,"uid")); else: - GroupMap[I] = [GetAttr(x,"uid")]; + print "Group does not exist ",I,"but",GetAttr(x,"uid"),"is in it"; # Output the group file. Counter = 0; @@ -195,6 +195,34 @@ def GenForward(l,File,Allowed): raise; Done(File,F,Fdb); +# Generate the anon XEarth marker file +def GenMarkers(l,File): + F = None; + Fdb = None; + try: + F = open(File + ".tmp","w"); + Fdb = None; + + # Fetch all the users + global PasswdAttrs; + if PasswdAttrs == None: + raise "No Users"; + + # Write out the email address for each user + for x in PasswdAttrs: + if x[1].has_key("latitude") == 0 or x[1].has_key("longitude") == 0: + continue; + try: + F.write("%8s %8s \"\"\n"%(DecDegree(x,"latitude",1),DecDegree(x,"longitude",1))); + except: + pass; + + # Oops, something unspeakable happened. + except: + Die(F,Fdb); + raise; + Done(File,F,Fdb); + # Connect to the ldap server l = ldap.open(LDAPServer); F = open(PassDir+"/pass-"+pwd.getpwuid(posix.getuid())[0],"r"); @@ -218,7 +246,7 @@ PasswdAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=*",\ ["uid","uidnumber","gidnumber","supplementarygid",\ "gecos","loginshell","userpassword","shadowlastchange",\ "shadowmin","shadowmax","shadowwarning","shadowinactive", - "shadowexpire","emailforward"]); + "shadowexpire","emailforward","latitude","longitude"]); # Open the control file if len(sys.argv) == 1: @@ -251,3 +279,5 @@ while(1): GenGroup(l,OutDir+"group",GroupList); GenShadow(l,OutDir+"shadow",GroupList); GenForward(l,OutDir+"forward-alias",GroupList); + GenMarkers(l,OutDir+"markers"); +