diff options
| -rwxr-xr-x | scripts/mailcmd | 32 | ||||
| -rwxr-xr-x | scripts/request | 32 |
2 files changed, 48 insertions, 16 deletions
diff --git a/scripts/mailcmd b/scripts/mailcmd index 19fe69d5c..edbb9e961 100755 --- a/scripts/mailcmd +++ b/scripts/mailcmd @@ -1,20 +1,36 @@ #! /usr/local/bin/python -# -# This script gets called by the wrapper. -# Stdin is the mail message, and argv[1] is the name of the mailing list -# being posted to. + +"""Handle emailed request commands. + + +Called by the wrapper, stdin is the mail message, and argv[1] is the name +of the target mailing list.""" import sys -f = open('/tmp/mailcmd.err', 'a+') -sys.stderr = f sys.path.append('/home/mailman/mailman/modules') -import maillist +import maillist, mm_utils + +try: + sys.stderr = mm_utils.StampedLogger("error", label='scripts/mailcmd') +except IOError, reason: + pass # SOL on redirecting. + # Only let one program run at once per list. -# TODO: This can fail, and should send back an error message when it does. +if sys.argv[1] not in mm_utils.list_names(): + import mm_cfg + mm_utils.SendTextToUser("Misconfigured list %s" % sys.argv[1], + ("List %s in aliases but not among " + "list_names?\n\n" + "---------- Forwarded message ----------\n" + "%s" + % (mm_cfg.MAILMAN_OWNER, sys.stdin.read())), + mm_cfg.MAILMAN_OWNER, + sender=mm_cfg.MAILMAN_OWNER) + list = maillist.MailList(sys.argv[1]) try: diff --git a/scripts/request b/scripts/request index 19fe69d5c..edbb9e961 100755 --- a/scripts/request +++ b/scripts/request @@ -1,20 +1,36 @@ #! /usr/local/bin/python -# -# This script gets called by the wrapper. -# Stdin is the mail message, and argv[1] is the name of the mailing list -# being posted to. + +"""Handle emailed request commands. + + +Called by the wrapper, stdin is the mail message, and argv[1] is the name +of the target mailing list.""" import sys -f = open('/tmp/mailcmd.err', 'a+') -sys.stderr = f sys.path.append('/home/mailman/mailman/modules') -import maillist +import maillist, mm_utils + +try: + sys.stderr = mm_utils.StampedLogger("error", label='scripts/mailcmd') +except IOError, reason: + pass # SOL on redirecting. + # Only let one program run at once per list. -# TODO: This can fail, and should send back an error message when it does. +if sys.argv[1] not in mm_utils.list_names(): + import mm_cfg + mm_utils.SendTextToUser("Misconfigured list %s" % sys.argv[1], + ("List %s in aliases but not among " + "list_names?\n\n" + "---------- Forwarded message ----------\n" + "%s" + % (mm_cfg.MAILMAN_OWNER, sys.stdin.read())), + mm_cfg.MAILMAN_OWNER, + sender=mm_cfg.MAILMAN_OWNER) + list = maillist.MailList(sys.argv[1]) try: |
