summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorbwarsaw2001-11-30 23:33:38 +0000
committerbwarsaw2001-11-30 23:33:38 +0000
commit936a07feab0d279a2755bac00294b46faa06304a (patch)
tree78d077f782521089253fc465cd650e956612daed /scripts
parent4ed6e2af8c73e6ef4f1b479baa422e2642befdcd (diff)
downloadmailman-936a07feab0d279a2755bac00294b46faa06304a.tar.gz
mailman-936a07feab0d279a2755bac00294b46faa06304a.tar.zst
mailman-936a07feab0d279a2755bac00294b46faa06304a.zip
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.in2
-rw-r--r--scripts/auto116
-rwxr-xr-xscripts/mailcmd64
-rwxr-xr-xscripts/mailowner73
4 files changed, 1 insertions, 254 deletions
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 7d3a0b5e4..9198e713c 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -40,7 +40,7 @@ SCRIPTSDIR= $(prefix)/scripts
SHELL= /bin/sh
-SCRIPTS= bounces mailcmd mailowner post driver join leave
+SCRIPTS= bounces driver join leave owner post request
# Modes for directories and executables created by the install
# process. Default to group-writable directories but
diff --git a/scripts/auto b/scripts/auto
deleted file mode 100644
index caf6493ff..000000000
--- a/scripts/auto
+++ /dev/null
@@ -1,116 +0,0 @@
-# -*- python -*-
-#
-# Copyright (C) 2000,2001 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-"""Automatically send a message to a mailing list.
-"""
-
-# To use with Postfix, set the following in your main.cf file:
-#
-# recipient_delimiter = +
-# luser_relay = mm+$user@yourdomain.com
-# owner_request_special = no
-
-import sys
-import os
-import time
-
-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman import MailList
-from Mailman import Errors
-from Mailman.Queue.sbcache import get_switchboard
-from Mailman.Logging.Utils import LogStdErr
-
-# Error code if it's really not a Mailman list addr destination
-EX_NOUSER = 67
-
-LogStdErr('auto', 'auto')
-
-DISPOSE_MAP = {None : 'tolist',
- 'request': 'torequest',
- 'admin' : 'toadmin',
- 'owner' : 'toadmin',
- }
-
-
-
-def fqdn_listname(listname, hostname):
- return ('%s@%s' % (listname, hostname)).lower()
-
-
-
-def main():
- # Postfix sets some environment variables based on information gleaned
- # from the original message. This is the most direct way to figure out
- # which list the message was intended for.
- extension = os.environ.get('EXTENSION', '').lower()
- i = extension.rfind('-')
- if i < 0:
- listname = extension
- subdest = 'tolist'
- else:
- missing = []
- listname = extension[:i]
- subdest = DISPOSE_MAP.get(extension[i+1:], missing)
- if not Utils.list_exists(listname) or subdest is missing:
- # must be a list that has a `-' in it's name
- listname = extension
- subdest = 'tolist'
- if not listname:
- print >> sys.stderr, 'Empty list name (someone being subversive?)'
- return EX_NOUSER
- try:
- mlist = MailList.MailList(listname, lock=0)
- except Errors.MMListError:
- print >> sys.stderr, 'List not found:', listname
- return EX_NOUSER
-
- # Make sure that the domain part of the incoming address matches the
- # domain of the mailing list. Actually, it's possible that one or the
- # other is more fully qualified, and thus longer. So we split the domains
- # by dots, reverse them and make sure that whatever parts /are/ defined
- # for both are equivalent.
- domain = os.environ.get('DOMAIN', '').lower()
- domainp = domain.split('.')
- hostname = mlist.host_name.split('.')
- domainp.reverse()
- hostname.reverse()
- for ca, cb in zip(domainp, hostname):
- if ca <> cb:
- print >> sys.stderr, 'Domain mismatch: %s@%s (expected @%s)' \
- % (listname, domain, mlist.host_name)
- return EX_NOUSER
-
- if subdest is None:
- print >> sys.stderr, 'Bad sub-destination:', extension
- return EX_NOUSER
-
- inq = get_switchboard(mm_cfg.INQUEUE_DIR)
- inq.enqueue(sys.stdin.read(),
- listname=listname,
- received_time=time.time(),
- _plaintext=1,
- **{subdest: 1})
- return 0
-
-
-
-if __name__ == '__main__':
- code = main()
- sys.exit(code)
diff --git a/scripts/mailcmd b/scripts/mailcmd
deleted file mode 100755
index 25fdb0d0e..000000000
--- a/scripts/mailcmd
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- python -*-
-#
-# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-"""Process emailed commands.
-
-Called by the wrapper, stdin is the mail message, and argv[1] is the name
-of the target mailing list.
-
-Errors are redirected to logs/errors.
-"""
-
-import sys
-
-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman.i18n import _
-from Mailman.Queue.sbcache import get_switchboard
-from Mailman.Logging.Utils import LogStdErr
-
-LogStdErr('error', 'mailcmd')
-
-
-
-def main():
- try:
- listname = sys.argv[1]
- except IndexError:
- print >> sys.stderr, _('mailcmd script got no listname.')
- sys.exit(1)
- # Make sure the list exists
- if not Utils.list_exists(listname):
- print >> sys.stderr, _('mailcmd script, list not found: %(listname)s')
- sys.exit(1)
- # Immediately queue the message for the bounce/cmd qrunner to process.
- # The advantage to this approach is that messages should never get lost --
- # some MTAs have a hard limit to the time a filter prog can run. Postfix
- # is a good example; if the limit is hit, the proc is SIGKILL'd giving us
- # no chance to save the message.
- cmdq = get_switchboard(mm_cfg.CMDQUEUE_DIR)
- cmdq.enqueue(sys.stdin.read(),
- listname=listname,
- torequest=1,
- _plaintext=1)
-
-
-
-if __name__ == '__main__':
- main()
diff --git a/scripts/mailowner b/scripts/mailowner
deleted file mode 100755
index d018d0c71..000000000
--- a/scripts/mailowner
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- python -*-
-#
-# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-"""Send a message to the mailing list owner.
-
-All messages to a list's -owner address should be piped through this script.
-The -owner address is defined to be delivered directly to the list owners plus
-the list moderators, with no intervention for bounce processing.
-
-Stdin is the mail message, and argv[1] is the name of the target mailing list.
-"""
-
-import sys
-
-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman.i18n import _
-from Mailman.Queue.sbcache import get_switchboard
-from Mailman.Logging.Utils import LogStdErr
-
-LogStdErr('error', 'mailowner')
-
-OWNER_PIPELINE = [
- 'SpamDetect',
- 'Replybot',
- 'OwnerRecips',
- 'ToOutgoing',
- ]
-
-
-
-def main():
- try:
- listname = sys.argv[1]
- except IndexError:
- print >> sys.stderr, _('mailowner got no listname.')
- sys.exit(1)
- # Make sure the list exists
- if not Utils.list_exists(listname):
- print >> sys.stderr, _(
- 'mailowner script, list not found: %(listname)s')
- sys.exit(1)
- # Queue the message for the owners. We will send them through the
- # incoming queue because we need some processing done on the message. The
- # processing is minimal though, so craft our own pipeline, expressly for
- # the purpose of delivering to the list owners.
- inq = get_switchboard(mm_cfg.INQUEUE_DIR)
- inq.enqueue(sys.stdin.read(),
- listname=listname,
- _plaintext=1,
- envsender=Utils.get_site_email(extra='bounces'),
- pipeline=OWNER_PIPELINE)
-
-
-
-if __name__ == '__main__':
- main()