A few people once asked about letting gatewayed newsgroup postings
through to members-only lists automatically. I think I have this (and
would appreciate comments on what I've done).

Note that this opens up the possibility of spam: all a spammer has to
do is add a "Newsgroup:" header with the correct newsgroup, and their
messages will get through. (But then technically, all they had to do
in the past was find a member, and set their messages from that
member. Since they don't do the latter, I'm not too worried about
this one.)

This is for Mailman 2.0.8.

In ~/Mailman/Handlers/ there is a file called 'Hold.py'. This
apparently is what does the work of shunting inappropriate mail off
to administrators for approval.

In it, there is a section that says:

     if mlist.member_posting_only:
         posters = Utils.List2Dict(map(string.lower, mlist.posters))
         if not mlist.IsMember(sender) and \
            not Utils.FindMatchingAddresses(sender, posters):
             # the sender is neither a member of the list, nor in the list of
             # explicitly approved posters
             hold_for_approval(mlist, msg, msgdata, NonMemberPost)
             # no return

This is fairly obvious (assuming I've parsed it correctly): if
member_posting_only is set for the list, then hold all messages
unless they come from a member or are on the list of valid posters.

Change it to:

     if mlist.member_posting_only:
         if mlist.gateway_to_news:
             needgroup = string.lower(mlist.linked_newsgroup)
             newsgroup = string.lower(msg.getheader('newsgroups'))

         posters = Utils.List2Dict(map(string.lower, mlist.posters))
         if not mlist.IsMember(sender) and \
            not (mlist.gateway_to_news and needgroup and
newsgroup==needgroup) and \
            not Utils.FindMatchingAddresses(sender, posters):
             # the sender is neither a member of the list, nor in the list of
             # explicitly approved posters
             # nor is it from the gatewayed newsgroup
             hold_for_approval(mlist, msg, msgdata, NonMemberPost)
             # no return

This, if "gateway_to_news" is set, grabs the newsgroup name that
gatewaying is set for, and if one is available, also grabs the value
of the Newsgroup: header in the message. It adds one more "unless" to
the "hold all messages unless" logic: unless gatewaying is set up and
there is a newsgroup set for gatewaying and the value of the
newsgroup header matches the newsgroup we're gatewaying to.

Note that crossposted messages will not get through--but they will be
available for administrative approval. I see this as a feature, not a
bug :*)

Jerry
--
[EMAIL PROTECTED]
http://www.sandiego.edu/~jerry/
Serra 188B/x8773
--
The more restrictions there are, the poorer the people become. The
greater the governmentıs power, the more chaotic the nation would
become. The more the ruler imposes laws and prohibitions on his
people, the more frequently evil deeds would occur.
--The Silence of the Wise: The Sayings of Lao Zi

------------------------------------------------------
Mailman-Users maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-users

Reply via email to