diff options
| author | bwarsaw | 2001-07-10 13:51:42 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-07-10 13:51:42 +0000 |
| commit | 957ca08f597ef164a6ce7beedcff907642a31042 (patch) | |
| tree | e8116c67ee2adcf06afb3eb21b8d965bbe81b23d /Mailman/Handlers/CalcRecips.py | |
| parent | e161ec36dbe17a4db27e212413f877e97990f8b3 (diff) | |
| download | mailman-957ca08f597ef164a6ce7beedcff907642a31042.tar.gz mailman-957ca08f597ef164a6ce7beedcff907642a31042.tar.zst mailman-957ca08f597ef164a6ce7beedcff907642a31042.zip | |
Added support for an Urgent: header, which should contain a password
(either the list administrator's, or the list moderator's). If the
message contains this header with a matching password, the message is
sent to the entire list membership immediately, even to those members
who receive the message via digests. Note that the message /is/ still
digested too. Specifically,
RejectUrgentMessage: New class, derived from RejectMessage, which is
raised if the password in the Urgent: header does not match. Thus,
the original message is returned to the sender immediately, and is not
held or posted.
process(): Check Urgent: for a matching list moderator's or list
administrator's header. If found, set the recipients list to both the
regular and digest delivery members. If Urgent: is found, but the
password doesn't match, bounce the message back to the sender.
Diffstat (limited to 'Mailman/Handlers/CalcRecips.py')
| -rw-r--r-- | Mailman/Handlers/CalcRecips.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Mailman/Handlers/CalcRecips.py b/Mailman/Handlers/CalcRecips.py index 92bcab9ea..d70f329d4 100644 --- a/Mailman/Handlers/CalcRecips.py +++ b/Mailman/Handlers/CalcRecips.py @@ -24,6 +24,32 @@ SendmailDeliver and BulkDeliver modules. """ from Mailman import mm_cfg +from Mailman import Utils +from Mailman import Message +from Mailman.i18n import _ +from Mailman.Errors import RejectMessage +from Mailman.Logging.Syslog import syslog + + + +class RejectUrgentMessage(RejectMessage): + def __init__(self, mlist, msg): + self._realname = mlist.real_name + self._subject = msg['subject'] or _('(no subject)') + + def subject(self): + return _('Your urgent message was rejected') + + def details(self): + # Do it this way for i18n. + realname = self._realname + subject = self._subject + txt = _("""\ +Your urgent message to the %(realname)s mailing list was not authorized for +delivery. The original message as received by Mailman is attached. + +""") + return Utils.wrap(txt) @@ -32,6 +58,27 @@ def process(mlist, msg, msgdata): # regardless of whether the list is empty or not. if msgdata.has_key('recips'): return + # Support for urgent messages, which bypasses digests and disabled + # delivery and forces an immediate delivery to all members Right Now. We + # are specifically /not/ allowing the site admins password to work here + # because we want to discourage the practice of sending the site admin + # password through email in the clear. (see also Approve.py) + missing = [] + password = msg.get('urgent', missing) + if password is not missing: + if mlist.Authenticate((mm_cfg.AuthListModerator, + mm_cfg.AuthListAdmin), + password): + recips = mlist.GetDeliveryMembers() + \ + mlist.GetDigestDeliveryMembers() + msgdata['recips'] = recips + return + else: + # Bad Urgent: password, so hold it instead of passing it on. I + # think it's better that the sender know they screwed up than to + # deliver it normally. + raise RejectUrgentMessage(mlist, msg) + # Normal delivery to the regular members. dont_send_to_sender = 0 # Get the membership address of the sender, if a member. Then get the # sender's receive-own-posts option |
