def main():
    os.nice(5)  # Handle mailing lists at non-interactive priority.
    # delete this if you wish

    try:
        MailmanOwner = mm_cfg.DEB_LISTMASTER
    except AttributeError:
        MailmanOwner = 'postmaster@localhost'

    try:
        domain, local = [a.lower() for a in sys.argv[1:]]
    except:
        # This might happen if we're not using Postfix or
        # /etc/postfix/master.cf is badly misconfigured
        sys.stderr.write('Illegal invocation: %r\n' % ' '.join(sys.argv))
        if len(sys.argv) > 3:
            sys.stderr.write('Did you forget to set '
                             'mailman_destination_recipient_limit=1 '
                             'in main.cf?')
        sys.exit(EX_USAGE)

    # Redirect required addresses to
    if local in ('postmaster', 'abuse', 'mailer-daemon'):
        os.execv("/usr/sbin/sendmail", ("/usr/sbin/sendmail", MailmanOwner))
        sys.exit(0)

    # Assume normal posting to a mailing list
    mlist, func = local, 'post'

    # Check for control extension on local part
    for ext in (
            '-admin',
            '-owner',
            '-request',
            '-bounces',
            '-confirm',
            '-join',
            '-leave',
            '-subscribe',
            '-unsubscribe',
    ):
        if local.endswith(ext):
            mlist = local[:-len(ext)]
            func = ext[1:]
            break

    # Let Mailman decide if a list exists.
    from Mailman.Utils import list_exists
    if list_exists(mlist):
        mm_pgm = os.path.join(paths.prefix, 'mail', 'mailman')
        os.execv(mm_pgm, (mm_pgm, func, mlist))
        # NOT REACHED
    else:
        try:
            sys.stderr.write(mm_cfg.DEB_HELP_TEXT)
        except AttributeError:
            sys.exit(EX_NOUSER)

        sys.exit(1)
Example #2
0
def get_listnames(domain=None):
    """Return the names of all the known lists for the given domain.

    If domain is given, it is the virtual domain for the named list.  The
    default is to not distinguish list paths on the basis of virtual domains.
    """
    # Import this here to avoid circular imports
    from Mailman.Utils import list_exists
    # We don't currently support separate virtual domain directories
    got = []
    for fn in os.listdir(mm_cfg.LIST_DATA_DIR):
        if list_exists(fn):
            got.append(fn)
    return got
Example #3
0
def get_listnames(domain=None):
    """Return the names of all the known lists for the given domain.

    If domain is given, it is the virtual domain for the named list.  The
    default is to not distinguish list paths on the basis of virtual domains.
    """
    # Import this here to avoid circular imports
    from Mailman.Utils import list_exists
    # We don't currently support separate virtual domain directories
    got = []
    for fn in os.listdir(mm_cfg.LIST_DATA_DIR):
        if list_exists(fn):
            got.append(fn)
    return got
def main():
    os.nice(5)     # Handle mailing lists at non-interactive priority.
                   # delete this if you wish

    try:
        MailmanOwner = mm_cfg.DEB_LISTMASTER
    except AttributeError:
        MailmanOwner = 'postmaster@localhost'

    try:
        domain, full = [ a.lower() for a in sys.argv[1:] ]
        local = full.split("@")[0]
    except:
        # This might happen if we're not using Postfix or
        # /etc/postfix/master.cf is badly misconfigured
        sys.stderr.write('Illegal invocation: %r\n'
                         % ' '.join(sys.argv))
        if len(sys.argv) > 3:
            sys.stderr.write('Did you forget to set '
                             'mailman_destination_recipient_limit=1 '
                             'in main.cf?')
        sys.exit(EX_USAGE)

    # Redirect required addresses to 
    if local in ('postmaster', 'abuse', 'mailer-daemon'):
        os.execv("/usr/sbin/sendmail",
                 ("/usr/sbin/sendmail", MailmanOwner))
        sys.exit(0)

    # Assume normal posting to a mailing list
    mlist, func = local, 'post'

    # Let Mailman decide if a list exists.
    from Mailman.Utils import list_exists

    if list_exists(mlist):
        mm_pgm = os.path.join(paths.prefix, 'mail', 'mailman')
        os.execv(mm_pgm, (mm_pgm, func, mlist))
        # NOT REACHED

    # Check for control extension on local part
    for ext in ('-admin',
                '-owner',
                '-request',
                '-bounces',
                '-confirm',
                '-join',
                '-leave',
                '-subscribe',
                '-unsubscribe',
                ):
        if local.endswith(ext):
            mlist = local[:-len(ext)]
            func  = ext[1:]
            break

    if list_exists(mlist):
        mm_pgm = os.path.join(paths.prefix, 'mail', 'mailman')
        os.execv(mm_pgm, (mm_pgm, func, mlist))
        # NOT REACHED
    else:
        try:
            sys.stderr.write(mm_cfg.DEB_HELP_TEXT)
        except AttributeError:
            sys.exit(EX_NOUSER)

        sys.exit(1)
def main():
    os.nice(5)  # Handle mailing lists at non-interactive priority.
    # delete this if you wish

    try:
        MailmanOwner = mm_cfg.FREEBSD_LISTMASTER
    except AttributeError:
        MailmanOwner = "postmaster@localhost"

    try:
        domain, local = [a.lower() for a in sys.argv[1:]]
    except:
        # This might happen if we're not using Postfix or
        # /etc/postfix/master.cf is badly misconfigured
        sys.stderr.write("Illegal invocation: %r\n" % " ".join(sys.argv))
        if len(sys.argv) > 3:
            sys.stderr.write("Did you forget to set " "mailman_destination_recipient_limit=1 " "in main.cf?")
        sys.exit(EX_USAGE)

    # Redirect required addresses to
    if local in ("postmaster", "abuse", "mailer-daemon"):
        os.execv("/usr/sbin/sendmail", ("/usr/sbin/sendmail", MailmanOwner))
        sys.exit(0)

    # Assume normal posting to a mailing list
    mlist, func = local, "post"

    # Let Mailman decide if a list exists.
    from Mailman.Utils import list_exists

    if list_exists(mlist):
        mm_pgm = os.path.join(paths.prefix, "mail", "mailman")
        os.execv(mm_pgm, (mm_pgm, func, mlist))
        # NOT REACHED

    # Check for control extension on local part
    for ext in (
        "-admin",
        "-owner",
        "-request",
        "-bounces",
        "-confirm",
        "-join",
        "-leave",
        "-subscribe",
        "-unsubscribe",
    ):
        if local.endswith(ext):
            mlist = local[: -len(ext)]
            func = ext[1:]
            break

    if list_exists(mlist):
        mm_pgm = os.path.join(paths.prefix, "mail", "mailman")
        os.execv(mm_pgm, (mm_pgm, func, mlist))
        # NOT REACHED
    else:
        try:
            sys.stderr.write(mm_cfg.FREEBSD_HELP_TEXT)
        except AttributeError:
            sys.exit(EX_NOUSER)

        sys.exit(1)