+# Generate the shadow list
+def GenSSHShadow(l,File):
+ F = None;
+ Fdb = None;
+ try:
+ OldMask = os.umask(0077);
+ F = open(File + ".tmp","w",0600);
+ Fdb = None;
+ os.umask(OldMask);
+
+ # Fetch all the users
+ global PasswdAttrs;
+ if PasswdAttrs == None:
+ raise "No Users";
+
+ I = 0;
+ for x in PasswdAttrs:
+ if x[1].has_key("uidnumber") == 0 or IsInGroup(x) == 0 or \
+ x[1].has_key("sshrsaauthkey") == 0:
+ continue;
+ for I in x[1]["sshrsaauthkey"]:
+ Line = "%s: %s" %(GetAttr(x,"uid"),I);
+ Line = Sanitize(Line) + "\n";
+ F.write(Line);
+
+ # Oops, something unspeakable happened.
+ except:
+ Die(F,Fdb);
+ raise;
+ Done(File,F,Fdb);
+