I thought I'd run through how I'd like to fix this.  The problem is
that when AutoResponse.record() tries to write an entry to
~/.tmda/responses/, an IOError is raised because the filename exceeds
the maximum number of chars allowed in a filename (255 max on POSIX
systems).

The first thing I checked was rfc 2821 to see if qmail was at fault
for allowing such a ridiculously long address to enter the system.
Surprisingly, the rfc does allow such lengths (section 4.5.3.1).  It
only has recommendations on maximum lengths, and gives the SMTP server
the option to refuse, but does not require it.  

My first thought was to try/except the open() call, and pass if
errno.ENAMETOOLONG was raised.  This however could leave the system
open to a mail loop attack in that the attacker would just have to use
an excessively long address to in essence defeat
MAX_AUTORESPONSES_PER_DAY.

So, instead, how about if the address exceeds 255 chars, use a SHA-1
hexdigest to represent the address portion of the .responses entry
instead of the full address.  So, instead of:

[EMAIL PROTECTED]

we'd write:

1074964987.2288.ecb252044b5ea0f679ee78ec1a12904739e2904d

which would fit within the limits of the system.  Any problems with
this?  Any easier solution I didn't think of?

-------------------- Start of forwarded message --------------------
Date: Sat, 24 Jan 2004 06:56:39 -0700 (MST)
From: Rob Penrose <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Bug?

Hi all, I'm not a member of the list, but am seeing a problem involving 
tmda.  I'm hoping I've not missed some config option...

The particulars:
I'm running at present, TMDA/1.0 "Cannonade" (Python/2.2 on linux-i686)
Qmail is my MTA, I install TMDA from a tarball.

the debug log shows:
Uncaught Python 2.2 Exception (Sat Jan 24 06:10:33 2004):
---------------------------------------------------------
Traceback (most recent call last):
  File "/usr/src/tmda/bin/tmda-filter", line 53, in ?
    execfile(os.path.join(execdir, 'tmda-rfilter'))
  File "/usr/src/tmda/bin/tmda-rfilter", line 891, in ?
    main()
  File "/usr/src/tmda/bin/tmda-rfilter", line 887, in main
    do_default_action(default_action, 'action_incoming', bouncetext)
  File "/usr/src/tmda/bin/tmda-rfilter", line 471, in do_default_action
    bouncegen('request')
  File "/usr/src/tmda/bin/tmda-rfilter", line 772, in bouncegen
    send_bounce(bounce_message, mode)
  File "/usr/src/tmda/bin/tmda-rfilter", line 445, in send_bounce
    ar.record()
  File "./TMDA/AutoResponse.py", line 243, in record
IOError: [Errno 36] File name too long: 
'/home/rob/.tmda/responses/[EMAIL PROTECTED]'

Any help will be appreciated.  Please include my address in your 
response(s).
TIA,
   Rob***

-------------------- End of forwarded message --------------------
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to