- continue;
- for I in x[1]["sshRSAAuthKey"]:
- User = GetAttr(x,"uid");
- Line = "%s: %s" %(User,I);
- Line = Sanitize(Line) + "\n";
- F.write(Line);
- # Oops, something unspeakable happened.
- except:
- Die(File,F,None);
- raise;
- Done(File,F,None);
-
-# Generate the group list
-def GenGroup(l,File):
- F = None;
- try:
- F = open(File + ".tdb.tmp","w");
-
- # Generate the GroupMap
- GroupMap = {};
- for x in GroupIDMap.keys():
- GroupMap[x] = [];
-
- # Fetch all the users
- global PasswdAttrs;
- if PasswdAttrs == None:
- raise "No Users";
-
- # Sort them into a list of groups having a set of users
- for x in PasswdAttrs:
- if x[1].has_key("uidNumber") == 0 or IsInGroup(x) == 0:
- continue;
- if x[1].has_key("supplementaryGid") == 0:
- continue;
-
- for I in x[1]["supplementaryGid"]:
- if GroupMap.has_key(I):
- GroupMap[I].append(GetAttr(x,"uid"));
- else:
- print "Group does not exist ",I,"but",GetAttr(x,"uid"),"is in it";
-
- # Output the group file.
- J = 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]:
- Line = Line + ("%s%s" % (Comma,I));
- Comma = ',';
- Line = Sanitize(Line) + "\n";
- F.write("0%u %s" % (J,Line));
- F.write(".%s %s" % (x,Line));
- F.write("=%u %s" % (GroupIDMap[x],Line));
- J = J + 1;
-
- # Oops, something unspeakable happened.
- except:
- Die(File,None,F);
- raise;
- Done(File,None,F);
-
-# Generate the email forwarding list
-def GenForward(l,File):
- F = None;
- try:
- OldMask = os.umask(0022);
- F = open(File + ".tmp","w",0644);
- os.umask(OldMask);
-
- # 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("emailForward") == 0 or IsInGroup(x) == 0:
- continue;
-
- # Do not allow people to try to buffer overflow busted parsers
- if len(GetAttr(x,"emailForward")) > 200:
- continue;
-
- # Check the forwarding address
- if EmailCheck.match(GetAttr(x,"emailForward")) == None:
- continue;
- Line = "%s: %s" % (GetAttr(x,"uid"),GetAttr(x,"emailForward"));
- Line = Sanitize(Line) + "\n";
- F.write(Line);
-
- # Oops, something unspeakable happened.
- except:
- Die(File,F,None);
- raise;
- Done(File,F,None);
-
-def GenAllForward(l,File):
- Fdb = None;
- try:
- OldMask = os.umask(0022);
- Fdb = os.popen("cdbmake %s %s.tmp"%(File,File),"w");
- os.umask(OldMask);
-
- # 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("emailForward") == 0:
- continue;
-
- # Do not allow people to try to buffer overflow busted parsers
- Forward = GetAttr(x,"emailForward");
- if len(Forward) > 200:
- continue;
-
- # Check the forwarding address
- if EmailCheck.match(Forward) == None:
- continue;
-
- User = GetAttr(x,"uid");
- Fdb.write("+%d,%d:%s->%s\n"%(len(User),len(Forward),User,Forward));
- Fdb.write("\n");
- # Oops, something unspeakable happened.
- except:
- Fdb.close();
- raise;
- if Fdb.close() != None:
- raise "cdbmake gave an error";
-
-# Generate the anon XEarth marker file
-def GenMarkers(l,File):
- F = None;
- try:
- F = open(File + ".tmp","w");