diff options
| author | bwarsaw | 2002-03-05 17:29:59 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-03-05 17:29:59 +0000 |
| commit | 70b967f500b30ec9349a65aaa6a8be4b3183c3dd (patch) | |
| tree | 87c9beb94b2483116481e880f3b6d3c5fb3e23be /Mailman/MTA | |
| parent | 8a9bc0febe512973d8331b0c85574d76d25eab13 (diff) | |
| download | mailman-70b967f500b30ec9349a65aaa6a8be4b3183c3dd.tar.gz mailman-70b967f500b30ec9349a65aaa6a8be4b3183c3dd.tar.zst mailman-70b967f500b30ec9349a65aaa6a8be4b3183c3dd.zip | |
_check_for_virtual_loopaddr(): Fixed this so duplicate virtual host
loop addresses don't get written.
_do_create(): Fixed this so that the check for loop addrs happens
after the original files get closed (otherwise they'd be zero
lengthed).
Also, fixed some formatting issues.
Diffstat (limited to 'Mailman/MTA')
| -rw-r--r-- | Mailman/MTA/Postfix.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py index 6cd180b3c..bf50cdf87 100644 --- a/Mailman/MTA/Postfix.py +++ b/Mailman/MTA/Postfix.py @@ -111,7 +111,7 @@ def _addlist(mlist, fp): def _addvirtual(mlist, fp): listname = mlist.internal_name() - fieldsz = len(listname) + len('request') + fieldsz = len(listname) + len('-unsubscribe') hostname = mlist.host_name # Set up the mailman-loop address loopaddr = Utils.get_site_email(mlist.host_name, extra='loop') @@ -140,7 +140,7 @@ def _addvirtual(mlist, fp): for k, v in makealiases(listname): fqdnaddr = '%s@%s' % (k, hostname) # Format the text file nicely - print >> fp, fqdnaddr, ((fieldsz - len(k) + 1) * ' '), '\t', k + print >> fp, fqdnaddr, ((fieldsz - len(k)) * ' '), k # Finish the text file stanza print >> fp, '# STANZA END:', listname print >> fp @@ -158,14 +158,31 @@ def _check_for_virtual_loopaddr(mlist, filename): finally: os.umask(omask) try: + # Find the start of the loop address block while 1: line = infp.readline() if not line: break outfp.write(line) if line.startswith('# LOOP ADDRESSES START'): + break + # Now see if our domain has already been written + while 1: + line = infp.readline() + if not line: + break + if line.startswith('# LOOP ADDRESSES END'): + # It hasn't print >> outfp, '%s\t%s' % (loopaddr, loopdest) + outfp.write(line) break + elif line.startswith(loopaddr): + # We just found it + outfp.write(line) + break + else: + # This isn't our loop address, so spit it out and continue + outfp.write(line) outfp.writelines(infp.readlines()) finally: infp.close() @@ -187,11 +204,11 @@ def _do_create(mlist, textfile, func): os.umask(omask) try: func(mlist, fp) - # Now double check the virtual plain text file - if func is _addvirtual: - _check_for_virtual_loopaddr(mlist, textfile) finally: fp.close() + # Now double check the virtual plain text file + if func is _addvirtual: + _check_for_virtual_loopaddr(mlist, textfile) def create(mlist, cgi=0, nolock=0): |
