from dsa_mq.config import Config
import string, re, time, ldap, optparse, sys, os, pwd, posix, socket, base64, hashlib, shutil, errno, tarfile, grp, fcntl, dbm
+import subprocess
from userdir_ldap import *
from userdir_exceptions import *
import UDLdap
return False
def Die(File, F, Fdb):
- if F != None:
+ if F is not None:
F.close()
- if Fdb != None:
+ if Fdb is not None:
Fdb.close()
try:
os.remove(File + ".tmp")
pass
def Done(File, F, Fdb):
- if F != None:
+ if F is not None:
F.close()
os.rename(File + ".tmp", File)
- if Fdb != None:
+ if Fdb is not None:
Fdb.close()
os.rename(File + ".tdb.tmp", File + ".tdb")
userlist = {}
i = 0
for a in accounts:
+ if 'loginShell' not in a:
+ continue
# Do not let people try to buffer overflow some busted passwd parser.
if len(a['gecos']) > 100 or len(a['loginShell']) > 50: continue
if 'sudoPassword' in a:
for entry in a['sudoPassword']:
Match = re.compile('^('+UUID_FORMAT+') (confirmed:[0-9a-f]{40}|unconfirmed) ([a-z0-9.,*-]+) ([^ ]+)$').match(entry)
- if Match == None:
+ if Match is None:
continue
uuid = Match.group(1)
status = Match.group(2)
F.write(Line)
Host = Split[0] + DNSZone
- if BSMTPCheck.match(Line) != None:
+ if BSMTPCheck.match(Line) is not None:
F.write("; Has BSMTP\n")
# Write some identification information
Algorithm = 2
if key_prefix == 'ssh-ed25519':
Algorithm = 4
- if Algorithm == None:
+ if Algorithm is None:
continue
# and more from the registry
sshfp_digest_codepoints = [ (1, 'sha1'), (2, 'sha256') ]
Line = " ".join(Split) + "\n"
Host = Split[0] + DNSZone
- if BSMTPCheck.match(Line) != None:
+ if BSMTPCheck.match(Line) is not None:
F.write("%s: user=%s group=Debian file=%s%s/bsmtp/%s\n"%(Host,
a['uid'], HomePrefix, a['uid'], Host))
"mXRecord", "ipHostNumber", "dnsTTL", "machine", "architecture",
"sshfpHostname"])
- if HostAttrs == None:
+ if HostAttrs is None:
raise UDEmptyList, "No Hosts"
HostAttrs.sort(lambda x, y: cmp((GetAttr(x, "hostname")).lower(), (GetAttr(y, "hostname")).lower()))
DoLink(global_dir, OutDir, "mail-rhsbl")
DoLink(global_dir, OutDir, "mail-whitelist")
DoLink(global_dir, OutDir, "all-accounts.json")
- DoLink(global_dir, Outdir, "default-mail-options.cdb")
- DoLink(global_dir, Outdir, "default-mail-options.db")
+ DoLink(global_dir, OutDir, "default-mail-options.cdb")
+ DoLink(global_dir, OutDir, "default-mail-options.db")
GenCDB(accounts, OutDir + "user-forward.cdb", 'emailForward')
GenDBM(accounts, OutDir + "user-forward.db", 'emailForward')
GenCDB(accounts, OutDir + "batv-tokens.cdb", 'bATVToken')
v = entry.split('=',1)
if v[0] != 'GITOLITE' or len(v) != 2: continue
options = v[1].split(',')
- group = options.pop(0);
+ group = options.pop(0)
gitolite_accounts = filter(lambda x: IsInGroup(x, [group], current_host), all_accounts)
if 'nohosts' not in options:
gitolite_hosts = filter(lambda x: GitoliteExportHosts.match(x[1]["hostname"][0]), all_hosts)