projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GenBSMTP
[mirror/userdir-ldap.git]
/
ud-generate
diff --git
a/ud-generate
b/ud-generate
index
e2b3353
..
eed7698
100755
(executable)
--- a/
ud-generate
+++ b/
ud-generate
@@
-709,15
+709,8
@@
def GenMailList(File, key):
raise
Done(File, F, None)
raise
Done(File, F, None)
-def isRoleAccount(pwEntry):
- if not pwEntry.has_key("objectClass"):
- raise "pwEntry has no objectClass"
- oc = pwEntry['objectClass']
- try:
- i = oc.index('debianRoleAccount')
- return True
- except ValueError:
- return False
+def isRoleAccount(account):
+ return 'debianRoleAccount' in account['objectClass']
# Generate the DNS Zone file
def GenDNS(File):
# Generate the DNS Zone file
def GenDNS(File):
@@
-731,15
+724,13
@@
def GenDNS(File):
# Write out the zone file entry for each user
for x in PasswdAttrs:
# Write out the zone file entry for each user
for x in PasswdAttrs:
- if x[1].has_key("dnsZoneEntry") == 0:
- continue
-
- # If the account has no PGP key, do not write it
- if x[1].has_key("keyFingerPrint") == 0 and not isRoleAccount(x[1]):
- continue
+ a = UDLdap.Account(x[0], x[1])
+ if not 'dnsZoneEntry' in a: continue
+ if not a.is_active_user() and not isRoleAccount(a): continue
+
try:
try:
- F.write("; %s\n"%(
EmailAddress(x
)))
- for z in
x[1]
["dnsZoneEntry"]:
+ F.write("; %s\n"%(
a.email_address(
)))
+ for z in
a
["dnsZoneEntry"]:
Split = z.lower().split()
if Split[1].lower() == 'in':
for y in range(0, len(Split)):
Split = z.lower().split()
if Split[1].lower() == 'in':
for y in range(0, len(Split)):
@@
-755,8
+746,8
@@
def GenDNS(File):
# Write some identification information
if not RRs.has_key(Host):
if Split[2].lower() in ["a", "aaaa"]:
# Write some identification information
if not RRs.has_key(Host):
if Split[2].lower() in ["a", "aaaa"]:
- Line = "%s IN TXT \"%s\"\n"%(Split[0],
EmailAddress(x
))
- for y in
x[1]
["keyFingerPrint"]:
+ Line = "%s IN TXT \"%s\"\n"%(Split[0],
a.email_address(
))
+ for y in
a
["keyFingerPrint"]:
Line = Line + "%s IN TXT \"PGP %s\"\n"%(Split[0], FormatPGPKey(y))
F.write(Line)
RRs[Host] = 1
Line = Line + "%s IN TXT \"PGP %s\"\n"%(Split[0], FormatPGPKey(y))
F.write(Line)
RRs[Host] = 1
@@
-765,8
+756,10
@@
def GenDNS(File):
F.write(Line)
F.write("\n")
F.write(Line)
F.write("\n")
- except:
- F.write("; Errors\n")
+ except Exception, e:
+ F.write("; Errors:\n")
+ for line in str(e).split("\n"):
+ F.write("; %s\n"%(line))
pass
# Oops, something unspeakable happened.
pass
# Oops, something unspeakable happened.
@@
-880,17
+873,15
@@
def GenBSMTP(File, HomePrefix):
# Fetch all the users
global PasswdAttrs
# Fetch all the users
global PasswdAttrs
-
+
# Write out the zone file entry for each user
for x in PasswdAttrs:
# Write out the zone file entry for each user
for x in PasswdAttrs:
- if x[1].has_key("dnsZoneEntry") == 0:
- continue
-
- # If the account has no PGP key, do not write it
- if x[1].has_key("keyFingerPrint") == 0:
- continue
+ a = UDLdap.Account(x[0], x[1])
+ if not 'dnsZoneEntry' in a: continue
+ if not a.is_active_user(): continue
+
try:
try:
- for z in
x[1]
["dnsZoneEntry"]:
+ for z in
a
["dnsZoneEntry"]:
Split = z.lower().split()
if Split[1].lower() == 'in':
for y in range(0, len(Split)):
Split = z.lower().split()
if Split[1].lower() == 'in':
for y in range(0, len(Split)):
@@
-901,7
+892,7
@@
def GenBSMTP(File, HomePrefix):
Host = Split[0] + DNSZone
if BSMTPCheck.match(Line) != None:
F.write("%s: user=%s group=Debian file=%s%s/bsmtp/%s\n"%(Host,
Host = Split[0] + DNSZone
if BSMTPCheck.match(Line) != None:
F.write("%s: user=%s group=Debian file=%s%s/bsmtp/%s\n"%(Host,
-
GetAttr(x, "uid"), HomePrefix, GetAttr(x, "uid")
, Host))
+
a['uid'], HomePrefix, a['uid']
, Host))
except:
F.write("; Errors\n")
except:
F.write("; Errors\n")