Cory Wright <[EMAIL PROTECTED]> writes:

> What's wrong with simply truncating the address?  It maintain's
> consistancy with the current mechanism, and avoids the expensive
> SHA-1 calculation.

Probably a better idea, yes.

Tim Legant <[EMAIL PROTECTED]> writes:

> Therefore, the email address can be a maximum of 255 - 22 or 233
> characters.  Then, to preserve as much as possible, make the local
> and host parts relative lengths:

I think it's more straightforward to just chop off the tail if it
exeeds 233 chars, so this is the patch I propose:

Index: Util.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Util.py,v
retrieving revision 1.110.2.1
diff -u -r1.110.2.1 Util.py
--- Util.py	9 Jan 2004 19:21:50 -0000	1.110.2.1
+++ Util.py	25 Jan 2004 17:31:11 -0000
@@ -48,6 +48,7 @@
 MODE_READ = 04
 MODE_WRITE = 02
 NL = '\n'
+POSIX_NAME_MAX = 255                    # maximum length of a file name
 
 
 def gethostname():
@@ -449,10 +450,14 @@
       outside the directory.
     - Spaces are replaced with underscores.
     - The address is lowercased.
+    - Truncate sender at 233 chars to insure the full filename
+    (including time, pid, and two dots) fits within the POSIX limit of
+    255 chars for a filename.
     """
     sender = sender.replace(' ', '_')
     sender = sender.replace('/', ':')
-    return sender.lower()
+    sender = sender.lower()
+    return sender[:POSIX_NAME_MAX - 22]
 
 
 def confirm_append_address(xp, rp):
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to