Hi everybody, I am plaing with mailman some time (John probaly remebers me) and now I see, that www.list.org is back online. So what I have, I would suggest You patch to verbose funcionality of mailman. All sugestion to my solution are welcome. What it solves, first part of patch to remove irriting headers from messages. I dont like to send messages like RCPT and so. Second uses DSN to send mails. This disables (when enabled) messages like warning, message is not delivered for 4 hours and so. Then comes some removing of winmail.dat binary attachments. I am working on removing all unwanted parts (html, rtf) and translating national characters into ascii, but is not complete yet. Then comes administrativ via filter, but it not works, it worked on mailman 1.0, but I cannot bring it running on b4, You will see, it is probably only a little bug, at least the filter shields list from administrative messages. So it is all for today, I am interested how You will find this patch, please send any comments to my. cheers dan diff -ru mailman-1.0b4/modules/mm_defaults.py mailman-1.0b4.new/modules/mm_defaults.py --- mailman-1.0b4/modules/mm_defaults.py Fri Jun 26 12:41:28 1998 +++ mailman-1.0b4.new/modules/mm_defaults.py Fri Jun 26 18:43:28 1998 @@ -202,3 +202,11 @@ # The Mailman version, also set by configure VERSION = '1.0b4' + +# Remove Microsoft binary attachments +REMOVE_WINMAIL = 1 +WINMAIL_FILTER_START = 'begin 600 WINMAIL\.DAT' +WINMAIL_FILTER_STOP = 'end' + +# Headers which are not useful +FILTER_HEADERS = ['^X-Confirm-Reading-To:','^X-pmrqc:','X-PMFLAGS:','^Return-receipt-to:'] Only in mailman-1.0b4/modules: mm_defaults.py.in diff -ru mailman-1.0b4/modules/mm_deliver.py mailman-1.0b4.new/modules/mm_deliver.py --- mailman-1.0b4/modules/mm_deliver.py Wed Jun 3 15:12:53 1998 +++ mailman-1.0b4.new/modules/mm_deliver.py Fri Jun 26 18:32:35 1998 @@ -135,6 +135,12 @@ msg.headers.append('To: %s\n' % self.GetListEmail()) else: tempfile.template = tmpfile_prefix + 'mailman.' +# Now remove unwanted headers from message + for pat in mm_defaults.FILTER_HEADERS: + try: + del msg[pat] + except: + pass if self.reply_goes_to_list: del msg['reply-to'] msg.headers.append('Reply-To: %s\n' % self.GetListEmail()) diff -ru mailman-1.0b4/modules/mm_message.py mailman-1.0b4.new/modules/mm_message.py --- mailman-1.0b4/modules/mm_message.py Tue Jun 2 04:47:11 1998 +++ mailman-1.0b4.new/modules/mm_message.py Fri Jun 26 18:01:47 1998 @@ -21,7 +21,7 @@ import sys -import rfc822, string, time +import rfc822, string, time, mm_defaults, regex # Utility functions 2 of these classes use: @@ -134,6 +134,24 @@ if (string.lower(self.headers[i][:len(name)+1]) == string.lower(name) + ':'): self.headers[i] = '%s: %s' % (name, value) + + def RemoveWinmail(self): + pattern_start = regex.compile(mm_defaults.WINMAIL_FILTER_START) + pattern_stop = regex.compile(mm_defaults.WINMAIL_FILTER_STOP) + occured = 0 + mybody=[] + mybody=string.split(self.body,'\n'); + for line in mybody[:]: + if occured == 1: + if pattern_stop.match(line) > 0: + occured = 0 + mybody.remove(line) + elif pattern_start.match(line) > 0: + occured = 1 + mybody.remove(line) + self.body=string.join(mybody,'\n') + + # XXX Eventually (1.5.1?) Python rfc822.Message() will have its own # __delitem__. diff -ru mailman-1.0b4/modules/smtplib.py mailman-1.0b4.new/modules/smtplib.py --- mailman-1.0b4/modules/smtplib.py Sat May 30 05:09:21 1998 +++ mailman-1.0b4.new/modules/smtplib.py Wed Jul 1 14:27:23 1998 @@ -20,6 +20,9 @@ # A lot of functionality was borrowed directly from ftplib... # John Viega (viega@list.org) +# Hack to use DSN, probably not the best way, but works fine +# But I have no not DSN aware server to check it without DSN + # >>> from smtplib import * # >>> s = SmtpConnection('list.org') # >>> s.helo('adder.cs.virginia.edu') @@ -27,7 +30,7 @@ # >>> s.quit() from socket import * -import string, types +import string, types, regex SMTP_PORT = 25 @@ -38,6 +41,8 @@ error_temp = 'smtplib.error_temp' # 4xx errors error_perm = 'smtplib.error_perm' # 5xx errors error_proto = 'smtplib.error_proto' # response does not begin with [1-5] +error_no_DSN = 'There is no DSN support' +DSN_support = 1 class SmtpConnection: def __init__(self, host=''): @@ -52,8 +57,15 @@ self.getresp() def helo(self, host): - self._sock.send('HELO %s\r\n' % host) - self.getresp() + self._sock.send('EHLO %s\r\n' % host) + try: + vysl = self.getresp() + except error_perm: + self._sock.send('HELO %s\r\n' % host) + self.getresp() + self.DSN_support=0 + if regex.match('.*DSN.*',vysl) == -1: + self.DSN_support=0 def quit(self): self._sock.send('QUIT\r\n') @@ -66,12 +78,16 @@ lines = string.split(text, '\n') self._sock.send('MAIL FROM: %s\r\n' % frm) self.getresp() + if DSN_support: + format = 'RCPT TO: %s NOTIFY=failure\r\n' + else: + format = 'RCPT TO: %s\r\n' if type(to) == types.StringType: - self._sock.send('RCPT TO: %s\r\n' % to) + self._sock.send(format % to) self.getresp() else: for item in to: - self._sock.send('RCPT TO: %s\r\n' % item) + self._sock.send(format % item) self.getresp() self._sock.send('DATA\r\n') self.getresp() diff -ru mailman-1.0b4/scripts/post mailman-1.0b4.new/scripts/post --- mailman-1.0b4/scripts/post Sun May 31 06:48:09 1998 +++ mailman-1.0b4.new/scripts/post Fri Jun 26 18:06:57 1998 @@ -31,7 +31,7 @@ import sys import paths -import maillist, mm_message, mm_err, mm_cfg, mm_utils +import maillist, mm_message, mm_err, mm_cfg, mm_utils, string, mm_defaults try: sys.stderr = mm_utils.StampedLogger("error", label = 'post', @@ -42,6 +42,18 @@ # Only let one program run at once per list. # TODO: This can fail, and should send back an error message when it does. +commands = { + 'subscribe' : '', + 'unsubscribe' : '', + 'who' : '', + 'info' : '', + 'lists' : '', + 'help' : '', + 'set' : '', + 'options' : '', + 'password' : '', + } + current_list = maillist.MailList(sys.argv[1]) if len(sys.argv) > 2: current_list.tmp_prevent_gate = 1 @@ -60,10 +72,41 @@ else: text = sys.stdin.read() msg = mm_message.IncomingMessage(text) + if mm_defaults.REMOVE_WINMAIL: msg.RemoveWinmail() + bad_dest = 0 + subject = msg.getheader("subject") + if subject: + subject = string.strip(subject) + if commands.has_key(string.split(subject)[0]): + bad_dest = 1 + lines = string.split(msg.body, '\n') + if len(lines) >= 10: + hopcnt = range(10) + else: + hopcnt = range(len(lines)) + for i in hopcnt: + try: + string.strip(lines[i]) + except: + pass + if not lines[i]: + continue + args = string.split(lines[i]) + if len(args)>0: + cmd = string.lower(args[0]) + if commands.has_key(cmd): + bad_dest = 1 - try: + if bad_dest: + try: + current_list.ParseMailCommands() + finally: +# current_list.Unlock() + pass + else: + try: current_list.Post(msg) - except mm_err.MMNeedApproval, err_msg: + except mm_err.MMNeedApproval, err_msg: if (current_list.dont_respond_to_post_requests or err_msg == mm_err.MODERATED_LIST_MSG or err_msg == mm_err.IMPLICIT_DEST_MSG ________________________________________ DDDDDD DD DD Dan Ohnesorg, supervisor on POWER DD OOOO Dan@feld.cvut.cz DD OODDOO Dep. of Power Engineering DDDDDD OO CVUT FEL Prague, Bohemia OO OO work: +420 2 24352785;+420 2 24972109 OOOO home: +420 311 679679;+420 311 679311 ________________________________________ Pocitac se od televizniho divaka lisi tim, ze ma vlastni program.
On Wed, 1 Jul 1998, Dan Ohnesorg, admin on power wrote:
Hi everybody,
Hi, dan. Sorry it's taken so long to respond - i for one haven't had much time to do a lot of pending mailman stuff, including looking at your patches, until now.
What it solves, first part of patch to remove irriting headers from messages. I dont
like to send messages like RCPT and so. Second uses DSN to send mails. This disables (when enabled) messages like warning, message is not delivered for 4 hours and so. Then comes some removing of winmail.dat binary attachments. I am working on removing all unwanted parts (html, rtf) and translating national characters into ascii, but is not complete yet. Then comes administrativ via filter, but it not works, it worked on mailman 1.0, but I cannot bring it running on b4, You will see, it is probably only a little bug, at least the filter shields list from administrative messages.
The main thing that interests me is the DSN capability. It may be that we'll integrate it for the next release.
I'm reluctant to do any administrivia filtering that catches anything but the most mechanical administrivia - i do not want to try to catch messages like "How do i subscribe to the list?", only those that were strictly formatted and intended for the -request address.
I also wouldn't recommend doing translation of stuff to ascii, or other surgery on messages. Minimum intrusion is the rule - granted, stuff like winmail.dat attachments are a nuisance, but it seems like the problem is with the origin, and not something a relatively transparent maillist should be trying to fix.
ken manheimer klm@python.org
On 14 Jul 98, at 0:21, Ken Manheimer wrote:
On Wed, 1 Jul 1998, Dan Ohnesorg, admin on power wrote: Hi Ken,
Hi everybody,
Hi, dan. Sorry it's taken so long to respond - i for one haven't had much time to do a lot of pending mailman stuff, including looking at your patches, until now. No problemo.
I'm reluctant to do any administrivia filtering that catches anything but the most mechanical administrivia - i do not want to try to catch messages like "How do i subscribe to the list?", only those that were strictly formatted and intended for the -request address.
Yes it is that, what my patch mades, it looks on first word on first 10 lines in message and when it founds command for listserv, it redirects the message. I think it will work fine, but I have following problem..
Jul 03 13:29:51 1998 post: Traceback (innermost last): post: File "/home/mailman/scripts/post", line 102, in ? post: current_list.ParseMailCommands() post: File "/home/mailman/Mailman/mm_mailcmd.py", line 80, in ParseMailCommands post: sender = string.lower(mail.GetSender()) post: File "/home/mailman/Mailman/mm_message.py", line 115, in GetSender post: return string.lower(mail_address) post: TypeError : read-only buffer, None
I think there is nothing bad, return modifies nothing.
I also wouldn't recommend doing translation of stuff to ascii, or other surgery on messages. Minimum intrusion is the rule - granted, stuff like winmail.dat attachments are a nuisance, but it seems like the problem is with the origin, and not something a relatively transparent maillist should be trying to fix.
Yes it is problem in origin. Problem in origin is also that smail many years corupts messages consisting CRLF.CRLF in body and mailman includes fix for that. I have list with 500 subscribers and 50 mesages per day, when I shall distribute unwanted parts of this messages, I am worried. It takes many MB, winmail.dat is many times bigger than mail itself. It makes archive big and slowes searching or at least indexing. And it slowes delivery. Many peoples cannot read correctly mesages with ms-tnef and html part and I will give them posibility to become readable messages. My vision is, that there should be posibility to send command like set ascii to become pure ascii messages.
I hope You will also include that part, which removes some headers, like confirm-delivery-to:, I will send more patterns soon. Yesterday I have shown RFC for delivery confirmation messages and there are some headers, which are not intended for public redistribute over maillists.
cheers dan
________________________________________
DDDDDD
DD DD Dan Ohnesorg, supervisor on POWER
DD OOOO Dan@feld.cvut.cz
DD OODDOO Dep. of Power Engineering
DDDDDD OO CVUT FEL Prague, Bohemia
OO OO work: +420 2 24352785;+420 2 24972109
OOOO home: +420 311 679679;+420 311 679311
________________________________________
Kdo se zahledi, neprokoukne.
participants (2)
-
Dan Ohnesorg, admin on power
-
Ken Manheimer