diff --git a/mailman/Mailman/Defaults.py.in b/mailman/Mailman/Defaults.py.in index 142f5d8..df10473 100644 --- a/mailman/Mailman/Defaults.py.in +++ b/mailman/Mailman/Defaults.py.in @@ -394,6 +394,7 @@ POSTFIX_STYLE_VIRTUAL_DOMAINS = [] # separating space), so it must be appropriate for os.system(). POSTFIX_ALIAS_CMD = '/usr/sbin/postalias' POSTFIX_MAP_CMD = '/usr/sbin/postmap' +POSTFIX_CONF_CMD = '/usr/sbin/postconf' # Ceiling on the number of recipients that can be specified in a single SMTP # transaction. Set to 0 to submit the entire recipient list in one diff --git a/mailman/Mailman/MTA/Postfix.py b/mailman/Mailman/MTA/Postfix.py index 33cb9a4..6161f58 100644 --- a/mailman/Mailman/MTA/Postfix.py +++ b/mailman/Mailman/MTA/Postfix.py @@ -45,19 +45,24 @@ except NameError: def _update_maps(): msg = 'command failed: %s (status: %s, %s)' - acmd = mm_cfg.POSTFIX_ALIAS_CMD + ' ' + ALIASFILE - status = (os.system(acmd) >> 8) & 0xff - if status: - errstr = os.strerror(status) - syslog('error', msg, acmd, status, errstr) - raise RuntimeError, msg % (acmd, status, errstr) - if os.path.exists(VIRTFILE): - vcmd = mm_cfg.POSTFIX_MAP_CMD + ' ' + VIRTFILE - status = (os.system(vcmd) >> 8) & 0xff - if status: - errstr = os.strerror(status) - syslog('error', msg, vcmd, status, errstr) - raise RuntimeError, msg % (vcmd, status, errstr) + ccmd = mm_cfg.POSTFIX_CONF_CMD + ' -h alias_maps' + for mapfile in os.popen(ccmd).readline().rstrip('\n').split(','): + if mapfile == ALIASFILE or mapfile.endswith(':' + ALIASFILE): + acmd = mm_cfg.POSTFIX_ALIAS_CMD + ' ' + mapfile + status = (os.system(acmd) >> 8) & 0xff + if status: + errstr = os.strerror(status) + syslog('error', msg, acmd, status, errstr) + raise RuntimeError, msg % (acmd, status, errstr) + ccmd = mm_cfg.POSTFIX_CONF_CMD + ' -h virtual_maps' + for mapfile in os.popen(ccmd).readline().rstrip('\n').split(','): + if (mapfile == VIRTFILE or mapfile.endswith(':' + VIRTFILE)) and os.path.exists(VIRTFILE): + vcmd = mm_cfg.POSTFIX_MAP_CMD + ' ' + mapfile + status = (os.system(vcmd) >> 8) & 0xff + if status: + errstr = os.strerror(status) + syslog('error', msg, vcmd, status, errstr) + raise RuntimeError, msg % (vcmd, status, errstr)