F = open(File, "w", 0600)
os.umask(OldMask)
- root = Element('include')
-
for a in accounts:
if not 'voipPassword' in a: continue
if not a.pw_active(): continue
- Pass = str(a['voipPassword'])
- user = Element('user')
- user.attrib['id'] = "%s" % (a['uid'])
- root.append(user)
- params = Element('params')
- user.append(params)
- param = Element('param')
- params.append(param)
- param.attrib['name'] = "a1-hash"
- param.attrib['value'] = "%s" % (Pass)
- variables = Element('variables')
- user.append(variables)
- variable = Element('variable')
- variable.attrib['name'] = "toll_allow"
- variable.attrib['value'] = "domestic,international,local"
- variables.append(variable)
-
- F.write("%s" % (prettify(root)))
-
+ Line = "%s@debian.org:%s:sip.debian.org:AUTHORIZED" % (a['uid'], str(a['voipPassword']))
+ Line = Sanitize(Line) + "\n"
+ F.write("%s" % (Line))
except:
Die(File, None, F)
pass
try:
- Fdb = dbm.open(fn + ".tmp", "c")
+ Fdb = dbm.open(fn, "c")
os.umask(OldMask)
# Write out the email address for each user
Fdb.close()
except:
- Die(File, Fdb, None)
+ # python-dbm names the files Fdb.db.db so we want to them to be Fdb.db
+ os.remove(File + ".db")
raise
- Done(File, Fdb, None)
+ # python-dbm names the files Fdb.db.db so we want to them to be Fdb.db
+ os.rename (File + ".db", File)
# Generate the anon XEarth marker file
def GenMarkers(accounts, File):
GenMailDisable(accounts, global_dir + "mail-disable")
GenCDB(accounts, global_dir + "mail-forward.cdb", 'emailForward')
- GenDBM(accounts, global_dir + "mail-forward", 'emailForward')
+ GenDBM(accounts, global_dir + "mail-forward.db", 'emailForward')
GenCDB(accounts, global_dir + "mail-contentinspectionaction.cdb", 'mailContentInspectionAction')
- GenDBM(accounts, global_dir + "mail-contentinspectionaction", 'mailContentInspectionAction')
+ GenDBM(accounts, global_dir + "mail-contentinspectionaction.db", 'mailContentInspectionAction')
GenPrivate(accounts, global_dir + "debian-private")
GenSSHKnown(host_attrs, global_dir+"authorized_keys", 'authorized_keys', global_dir+'ud-generate.lock')
GenMailBool(accounts, global_dir + "mail-greylist", "mailGreylisting")
DoLink(global_dir, OutDir, "mail-whitelist")
DoLink(global_dir, OutDir, "all-accounts.json")
GenCDB(accounts, OutDir + "user-forward.cdb", 'emailForward')
- GenDBM(accounts, OutDir + "user-forward", 'emailForward')
+ GenDBM(accounts, OutDir + "user-forward.db", 'emailForward')
GenCDB(accounts, OutDir + "batv-tokens.cdb", 'bATVToken')
- GenDBM(accounts, OutDir + "batv-tokens", 'bATVToken')
+ GenDBM(accounts, OutDir + "batv-tokens.db", 'bATVToken')
GenCDB(accounts, OutDir + "default-mail-options.cdb", 'mailDefaultOptions')
- GenDBM(accounts, OutDir + "default-mail-options", 'mailDefaultOptions')
+ GenDBM(accounts, OutDir + "default-mail-options.db", 'mailDefaultOptions')
# Compatibility.
DoLink(global_dir, OutDir, "forward-alias")