Cory Wright <[EMAIL PROTECTED]> writes:
> On Sun, Jan 25, 2004 at 01:02:41AM -0700, Jason R. Mastaler wrote:
>> But this isn't as practical. With the address exposed, you get a
>> visual indication of who TMDA is responding to without having to
>> process logfiles.
>
> What's wrong with simply truncating the address? It maintain's consistancy
> with the current mechanism, and avoids the expensive SHA-1 calculation.
>
> My first idea would be to split on the "@", and truncation at 100 chars
> on the recipient, and 254 on the domain, then piece them back together.
> It's unlikely that any such address is valid anyway, so it's probably a
> waste of time to even go this far.
Well, since we also have to have space for the timestamp and PID, how
about this.
Timestamp is a long, max 10 characters; PID might be a long on 64-bit
architectures, so max 10 characters; 2 separator dots ('.') are 2
characters. 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:
newhost is min(len(host), 132)
newlocal is min(len(local), 232 - len(newhost))
'@' is 1, of course
at = env_sender.rfind('@')
if at == -1:
response_addr = env_sender
else:
newhost = env_sender[at+1:at+133]
newlocal = env_sender[:min(at, 233 - len(newhost)]
response_addr = newlocal + '@' + newhost
Tim
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers