Re: [Mailman-Users] Having mailman treat two domains as equal duringmigration...

2005-10-28 Thread Mark Sapiro
Mike Cisar wrote:

What I would like to do is do a one-shot conversion of all the users to the
new domain name and then internally to mailman, when the message is first
submitted into the mailman process simply have a regex replacement of the
sender's domain name so even though the message might actually be coming
from [EMAIL PROTECTED] mailman would read that in, do a quick replace in
its mind and for the rest of the process treat the message as if it had come
from [EMAIL PROTECTED] 

I am assuming that this should pretty much be a 'one-liner' code
modification to mailman.   Pardon my Perl (I'm not a native Pythoner so that
doesn't help matters :-) but the equivalent of sender =~
s/olddomain/newdomain/ immediately after mailman parses 'sender' from the
incoming message.  I don't really grok how the message flows through the
internals of Mailman... so the couple of places I've tried putting the
'one-liner' don't seem to have any effect.  I'm assuming that this should be
done literally as soon as possible after Mailman has received the message
from the MTA to ensure that the substitution is used in all possible
processes?

I'm hoping someone on the list may be able to tell me if this a) is really a
one-liner and b) roughly where to look at inserting the 'one-liner' in order
to acchieve the required result.  

Well, maybe a two liner :)

Aside --
Actually, John Dennis' reply suggesting rewriting the address in the
MTA is a good one. The way I read your original, his concern about
replies is not relevant as I think you said the users already receive
mail addressed to either domain.

In spite of my agreement that John's suggestion is probably best, there
is one small caveat. If you have USE_ENVELOPE_SENDER = Yes in
mm_cfg.py, you'll have to rewrite the envelope sender too, and I don't
know if you can do that.

In any case, I'd already written most of the following before I saw
John's reply, so rather than let it go to waste ...   :)
End aside ---

It depends on what the desired result is. I'm not clear on whether you
want to actually change the domain in the From: and maybe elsewhere in
the message so when the message from [EMAIL PROTECTED] goes out, it is
From: [EMAIL PROTECTED], or if you just want [EMAIL PROTECTED] to be
considered equivalent to [EMAIL PROTECTED] for the purpose of validating
list membership for posting.

The easy one is the latter, so for that I would look at
Mailman/Message.py in the get_sender() and get_senders() methods. In
get_sender(), I would do the replacement in 'address' just before

if not preserve_case:
return address.lower()
return address

In get_senders(), I would again do it to 'address' in this loop where
the dots are

for pair in pairs:
address = pair[1]
...
if address is not None and not preserve_case:
address = address.lower()
authors.append(address)

This will also cause other messages (e.g. auotoresponses and your
message awaits approval) to go to the new domain, but I gather that
is not a problem.

If you want to do the former (rewrite the headers), I suggest one of
two things. Do it in the first handler in the pipeline which is
Mailman/Handlers/SpamDetect.py, or make a new handler (e.g.
Mailman/Handlers/MungDomain.py) to do it and insert the new handler at
the beginning of the pipeline with something like

GLOBAL_PIPELINE.insert(0, 'MungDomain')

in mm_cfg.py. This won't work for any list which has a 'pipeline'
attribute, but that is rare.

-- 
Mark Sapiro [EMAIL PROTECTED]   The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp


Re: [Mailman-Users] Having mailman treat two domains as equal duringmigration...

2005-10-28 Thread Mike Cisar
Hi Mark,

 I'm hoping someone on the list may be able to tell me if this a) is 
 really a one-liner and b) roughly where to look at inserting the 
 'one-liner' in order to acchieve the required result.
 
 Well, maybe a two liner :)
 
 Aside --
 Actually, John Dennis' reply suggesting rewriting the address 
 in the MTA is a good one. The way I read your original, his 
 concern about replies is not relevant as I think you said the 
 users already receive mail addressed to either domain.

Yes it's a sendmail configuration and it has actually been reconfigured
completely as the new domain with an alias for the old domain, so if users
are receiving mail to either address it ends up in the same mailbox.
Rewriting in the MTA is definitely something I had not thought of, but your
two-liner looks much easier ;-)  Rule #1 in configuring sendmail... if it's
working don't touch it :-)

 From: [EMAIL PROTECTED], or if you just want [EMAIL PROTECTED] to 
 be considered equivalent to [EMAIL PROTECTED] for the purpose 
 of validating list membership for posting.

That's it, that's the one :-)  Basically all of the user memberships will be
converted for the new domain, and we just don't want posts to get held for
the people who are 'less than prompt' in reconfiguring their email clients
during the transition.  

 The easy one is the latter, so for that I would look at 
 Mailman/Message.py in the get_sender() and get_senders() 
 methods. In get_sender(), I would do the replacement in 
 'address' just before

  snip
 
 This will also cause other messages (e.g. auotoresponses and 
 your message awaits approval) to go to the new domain, but 
 I gather that is not a problem.

Will give this a try and see how it goes :-)

Cheers,
 Mike 

--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp


Re: [Mailman-Users] Having mailman treat two domains as equal duringmigration...

2005-10-28 Thread John Dennis
It's Friday afternoon so forgive me a little tongue-n-cheek humor :-)

On Fri, 2005-10-28 at 12:54 -0600, Mike Cisar wrote:
 Rule #1 in configuring sendmail... if it's working don't touch it :-)

Corollary #1 follows from Rule #1:

sendmail configuration is so painful it can't be changed readily.

Thus Rule #2 follows from Corollary #1:

Don't use sendmail :-)
-- 
John Dennis [EMAIL PROTECTED]

--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp