-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Barry Warsaw wrote:
| On Jul 2, 2008, at 11:01 PM, Mark Sapiro wrote:
|
|> The attached 'post' file is a modified version of scripts/post.
|
| Hi Mark, there was no attachment.


Yes, I know. I was just about to resend. It is attached here. The MUA I
used to send the previous message gives any attachment without an
extension Content-Type: application/octet-stream, so the list's content
filtering removed it.


|> It does the following compared to the normal script.
|
|> The normal script reads the message from the pipe from the MTA and
|> queues it in the 'in' queue for processing by an IncomingRunner. This
|> script receives the message and instead queues it in the 'bad' queue.
|> It then looks at the size of the 'bad' queue entry (a Python pickle
|> that will be just slightly larger than the message text). If the size
|> is less than MAXSIZE bytes (a parameter near the beginning of the
|> script, currently set to 1000000, but which you can change as you
|> desire), it moves the queue entry from the 'bad' queue to the 'in'
|> queue for processing.
|
| I'm not sure 'bad' should be used.  Perhaps a separate queue called
| 'raw'?  It is nice that files > MAXSIZE need only be left in 'bad'.


If we're going to do something like this going forward, we can certainly
change the queue. For this 'debug' effort, I wanted to keep it simple
and use an existing mm_cfg queue name.

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)

iD8DBQFIbERTVVuXXpU7hpMRAtD3AJ4wak9befESKQlF3t2ZKos9W2WuTQCfbOCB
Yh9VIStJMHWfiLVlYjM5uoo=
=bU1+
-----END PGP SIGNATURE-----
# -*- python -*-
#
# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

"""Accept posts to a list and handle them properly.

The main advertised address for a list should be filtered to this program,
through the mail wrapper.  E.g. for list [EMAIL PROTECTED]', the `test'
alias would deliver to this script.

Stdin is the mail message, and argv[1] is the name of the target mailing list.

"""

import os
import sys

import paths
from Mailman import mm_cfg
from Mailman import Utils
from Mailman.i18n import _
from Mailman.Queue.sbcache import get_switchboard
from Mailman.Logging.Utils import LogStdErr

LogStdErr("error", "post")

MAXSIZE = 1000000



def main():
    # TBD: If you've configured your list or aliases so poorly as to get
    # either of these first two errors, there's little that can be done to
    # save your messages.  They will be lost.  Minimal testing of new lists
    # should avoid either of these problems.
    try:
        listname = sys.argv[1]
    except IndexError:
        print >> sys.stderr, _('post script got no listname.')
        sys.exit(1)
    # Make sure the list exists
    if not Utils.list_exists(listname):
        print >> sys.stderr, _('post script, list not found: %(listname)s')
        sys.exit(1)
    # Immediately queue the message for the incoming qrunner to process.  The
    # advantage to this approach is that messages should never get lost --
    # some MTAs have a hard limit to the time a filter prog can run.  Postfix
    # is a good example; if the limit is hit, the proc is SIGKILL'd giving us
    # no chance to save the message.
    bdq = get_switchboard(mm_cfg.BADQUEUE_DIR)
    filebase = bdq.enqueue(sys.stdin.read(),
                           listname=listname,
                           tolist=1, _plaintext=1)
    frompath= os.path.join(mm_cfg.BADQUEUE_DIR, filebase + '.pck')
    topath= os.path.join(mm_cfg.INQUEUE_DIR, filebase + '.pck')
    if os.stat(frompath).st_size < MAXSIZE:
        os.rename(frompath,topath)



if __name__ == '__main__':
    main()
------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
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://wiki.list.org/x/QIA9

Reply via email to