From 493d0e14bffe589c8ae87e45f503c872993c4fb5 Mon Sep 17 00:00:00 2001 From: jgg <> Date: Fri, 16 Feb 2001 06:07:38 +0000 Subject: [PATCH] BSMTP --- debian/changelog | 8 +++++++- ud-generate | 28 +++++++++++++++++++--------- ud-mailgate | 3 ++- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2e26af4..85c272f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,15 @@ +userdir-ldap (0.2) unstable; urgency=low + + * What the hey, a new version number. + + -- Jason Gunthrope Sun, 11 Feb 2001 18:37:27 -0800 + userdir-ldap (0.1) unstable; urgency=low * Initial Packaging -- Jason Gunthrope Fri, 30 Apr 1999 00:39:31 -0600 - + Local variables: mode: debian-changelog add-log-mailing-address: "jgg@debian.org" diff --git a/ud-generate b/ud-generate index b20e6bb..674cc60 100755 --- a/ud-generate +++ b/ud-generate @@ -11,6 +11,8 @@ Allowed = None; CurrentHost = ""; EmailCheck = re.compile("^([^ <>@]+@[^ ,<>@]+)?$"); +BSMTPCheck = re.compile(".*mx 0 klecker\.debian\.org\..*",re.DOTALL); +DNSZone = ".debian.net" def Sanitize(Str): return string.translate(Str,string.maketrans("\n\r\t","$$$")); @@ -379,13 +381,13 @@ def GenPrivate(l,File): Done(File,F,Fdb); # Generate the DNS Zone file -def GenDNS(l,File): +def GenDNS(l,File,BSMTPFile,HomePrefix): F = None; - Fdb = None; + FB = None; try: F = open(File + ".tmp","w"); - Fdb = None; - + FB = open(BSMTPFile + ".tmp","w"); + # Fetch all the users global PasswdAttrs; if PasswdAttrs == None: @@ -406,7 +408,13 @@ def GenDNS(l,File): Line = string.join(Split," ") + "\n"; F.write(Line); - # Write some identication information + Host = Split[0] + DNSZone; + if BSMTPCheck.match(Line) != None: + F.write("; Has BSMTP\n"); + FB.write("%s: user=%s group=Debian file=%s%s/bsmtp/%s\n"%(Host, + GetAttr(x,"uid"),HomePrefix,GetAttr(x,"uid"),Host)); + + # Write some identification information if string.lower(Split[2]) == "a": Line = "%s IN TXT \"%s\"\n"%(Split[0],EmailAddress(x)); for y in x[1]["keyfingerprint"]: @@ -418,13 +426,16 @@ def GenDNS(l,File): F.write("\n"); except: + F.write("; Errors\n"); pass; # Oops, something unspeakable happened. except: - Die(File,F,Fdb); + Die(File,F,None); + Die(BSMTPFile,FB,None); raise; - Done(File,F,Fdb); + Done(File,F,None); + Done(BSMTPFile,FB,None); # Connect to the ldap server l = ldap.open(LDAPServer); @@ -464,7 +475,6 @@ GlobalDir = GenerateDir+"/"; GenSSHShadow(l,GlobalDir+"ssh-rsa-shadow"); GenAllForward(l,GlobalDir+"mail-forward.cdb"); GenMarkers(l,GlobalDir+"markers"); -GenDNS(l,GlobalDir+"dns-zone"); GenPrivate(l,GlobalDir+"debian-private"); # Compatibility. @@ -516,7 +526,7 @@ while(1): DoLink(GlobalDir,OutDir,"forward-alias"); if ExtraList.has_key("[DNS]"): - DoLink(GlobalDir,OutDir,"dns-zone"); + GenDNS(l,OutDir+"dns-zone",OutDir+"bsmtp",Split[1]); if ExtraList.has_key("[PRIVATE]"): DoLink(GlobalDir,OutDir,"debian-private"); diff --git a/ud-mailgate b/ud-mailgate index 4e3b39d..7a70f66 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -178,7 +178,8 @@ def DoSSH(Str,Attrs): def DoDNS(Str,Attrs,DnRecord): if re.match('^[\w-]+\s+in\s+a\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$',\ Str,re.IGNORECASE) == None and \ - re.match("^[\w-]+\s+in\s+cname\s+[\w.\-]+\.$",Str,re.IGNORECASE) == None: + re.match("^[\w-]+\s+in\s+cname\s+[\w.\-]+\.$",Str,re.IGNORECASE) == None and \ + re.match("^[\w-]+\s+in\s+mx\s+\d{1,3}\s+[\w.\-]+\.$",Str,re.IGNORECASE) == None: return None; # Check if the name is already taken -- 2.20.1