+# Generate the DNS Zone file
+def GenDNS(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 zone file entry for each user
+ for x in PasswdAttrs:
+ if x[1].has_key("dnszoneentry") == 0:
+ continue;
+ try:
+ F.write("; %s\n"%(EmailAddress(x)));
+ for z in x[1]["dnszoneentry"]:
+ Split = string.split(string.lower(z));
+ for y in range(0,len(Split)):
+ if Split[y] == "$":
+ Split[y] = "\n\t";
+
+ Line = string.join(Split," ") + "\n";
+ F.write(Line);
+ F.write("\n");
+ except:
+ pass;
+
+ # Oops, something unspeakable happened.
+ except:
+ Die(F,Fdb);
+ raise;
+ Done(File,F,Fdb);
+