projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More loop logic cleanup - we only handle mail for gid Debian, so we
[mirror/userdir-ldap.git]
/
ud-generate
diff --git
a/ud-generate
b/ud-generate
index
b8e3d74
..
18c008b
100755
(executable)
--- a/
ud-generate
+++ b/
ud-generate
@@
-36,7
+36,6
@@
global CurrentHost
PasswdAttrs = None
DisabledUsers = []
PasswdAttrs = None
DisabledUsers = []
-RetiredUsers = []
GroupIDMap = {}
SubGroupMap = {}
Allowed = None
GroupIDMap = {}
SubGroupMap = {}
Allowed = None
@@
-108,6
+107,12
@@
def IsRetired(DnRecord):
return False
return False
+def IsGidDebian(x):
+ try:
+ return int(GetAttr(x, "gidNumber", 0)) == 800
+ except ValueError:
+ return False
+
# See if this user is in the group list
def IsInGroup(DnRecord):
if Allowed == None:
# See if this user is in the group list
def IsInGroup(DnRecord):
if Allowed == None:
@@
-461,8
+466,8
@@
def GenGroup(File):
return grouprevmap
def CheckForward():
return grouprevmap
def CheckForward():
- global
PasswdAtt
rs
- for x in
PasswdAtt
rs:
+ global
DebianUse
rs
+ for x in
DebianUse
rs:
if x[1].has_key("emailForward") == 0:
continue
if x[1].has_key("emailForward") == 0:
continue
@@
-488,10
+493,10
@@
def GenForward(File):
os.umask(OldMask)
# Fetch all the users
os.umask(OldMask)
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
# Write out the email address for each user
# Write out the email address for each user
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
if x[1].has_key("emailForward") == 0:
continue
if x[1].has_key("emailForward") == 0:
continue
@@
-513,10
+518,10
@@
def GenAllForward(File):
os.umask(OldMask)
# Fetch all the users
os.umask(OldMask)
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
# Write out the email address for each user
# Write out the email address for each user
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
if x[1].has_key("emailForward") == 0:
continue
if x[1].has_key("emailForward") == 0:
continue
@@
-541,10
+546,10
@@
def GenMarkers(File):
F = open(File + ".tmp", "w")
# Fetch all the users
F = open(File + ".tmp", "w")
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
# Write out the position for each user
# Write out the position for each user
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
if x[1].has_key("latitude") == 0 or x[1].has_key("longitude") == 0:
continue
try:
if x[1].has_key("latitude") == 0 or x[1].has_key("longitude") == 0:
continue
try:
@@
-567,10
+572,10
@@
def GenPrivate(File):
F = open(File + ".tmp", "w")
# Fetch all the users
F = open(File + ".tmp", "w")
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
# Write out the position for each user
# Write out the position for each user
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
if x[1].has_key("privateSub") == 0:
continue
if x[1].has_key("privateSub") == 0:
continue
@@
-578,10
+583,6
@@
def GenPrivate(File):
if x[1].has_key("keyFingerPrint") == 0:
continue
if x[1].has_key("keyFingerPrint") == 0:
continue
- # Must be in the Debian group (yuk, hard coded for now)
- if GetAttr(x, "gidNumber") != "800":
- continue
-
try:
Line = "%s"%(GetAttr(x, "privateSub"))
Line = Sanitize(Line) + "\n"
try:
Line = "%s"%(GetAttr(x, "privateSub"))
Line = Sanitize(Line) + "\n"
@@
-636,9
+637,9
@@
def GenMailDisable(File):
F = open(File + ".tmp", "w")
# Fetch all the users
F = open(File + ".tmp", "w")
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
Reason = None
if x[1].has_key("mailDisableMessage"):
Reason = None
if x[1].has_key("mailDisableMessage"):
@@
-646,10
+647,6
@@
def GenMailDisable(File):
else:
continue
else:
continue
- # Must be in the Debian group (yuk, hard coded for now)
- if GetAttr(x, "gidNumber") != "800":
- continue
-
try:
Line = "%s: %s"%(GetAttr(x, "uid"), Reason)
Line = Sanitize(Line) + "\n"
try:
Line = "%s: %s"%(GetAttr(x, "uid"), Reason)
Line = Sanitize(Line) + "\n"
@@
-670,18
+667,14
@@
def GenMailBool(File, Key):
F = open(File + ".tmp", "w")
# Fetch all the users
F = open(File + ".tmp", "w")
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
Reason = None
if x[1].has_key(Key) == 0:
continue
Reason = None
if x[1].has_key(Key) == 0:
continue
- # Must be in the Debian group (yuk, hard coded for now)
- if GetAttr(x, "gidNumber") != "800":
- continue
-
if GetAttr(x, Key) != "TRUE":
continue
if GetAttr(x, Key) != "TRUE":
continue
@@
-705,18
+698,14
@@
def GenMailList(File, Key):
F = open(File + ".tmp", "w")
# Fetch all the users
F = open(File + ".tmp", "w")
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
Reason = None
if x[1].has_key(Key) == 0:
continue
Reason = None
if x[1].has_key(Key) == 0:
continue
- # Must be in the Debian group (yuk, hard coded for now)
- if GetAttr(x, "gidNumber") != "800":
- continue
-
try:
found = 0
Line = None
try:
found = 0
Line = None
@@
-853,10
+842,10
@@
def GenBSMTP(File, HomePrefix):
F = open(File + ".tmp", "w")
# Fetch all the users
F = open(File + ".tmp", "w")
# Fetch all the users
- global
PasswdAtt
rs
+ global
DebianUse
rs
# Write out the zone file entry for each user
# Write out the zone file entry for each user
- for x in
PasswdAtt
rs:
+ for x in
DebianUse
rs:
if x[1].has_key("dnsZoneEntry") == 0:
continue
if x[1].has_key("dnsZoneEntry") == 0:
continue
@@
-1056,11
+1045,8
@@
else:
GlobalDir = GenerateDir + "/"
GenDisabledAccounts(GlobalDir + "disabled-accounts")
GlobalDir = GenerateDir + "/"
GenDisabledAccounts(GlobalDir + "disabled-accounts")
-for x in PasswdAttrs:
- if IsRetired(x):
- RetiredUsers.append(x)
-
-PasswdAttrs = filter(lambda x: not x in RetiredUsers, PasswdAttrs)
+PasswdAttrs = filter(not IsRetired, PasswdAttrs)
+DebianUsers = filter(IsGidDebian, PasswdAttrs)
CheckForward()
CheckForward()