Parse_headers problem in RT 1.0.x

Hello,

With the help of an end user (lets call him user@example.com), we
discovered a problem in the mail header parsing routine in RT 1.0.7. I
haven’t had a chance to look at the RT2 code base so I’m not sure if it
has the same problem or not.

The problem:

Replies from RT were being sent to “user@example.com@ourhostname

Why it happened:

The incoming mail from the end user had a from address in the format of:
user@example.comuser@example.com

The parse_headers routine in rt-1.0.7/lib/rt/ui/mail/manipulate.pm breaks
the from address (or reply-to or sender) into the user’s name and e-mail
address. RT finds “user@example.com” as the user’s e-mail address and
stores this in $current_user. This gets saved as the requestors address,
qoutes and all.

When RT sends the mail, it sends it to “user@example.com”. Sendmail is
reading this as just the local part of an address and appends ourhostname
to it before sending the mail.

Our solution:

I added logic to rt-1.0.7/lib/rt/ui/mail/manipulate.pm to strip the quotes
from the $current_user:

$current_user = $replyto || $from || $sender;


#Get the real name of the current user from the replyto/from/sender/etc

$name_temp  = $current_user;

if ($current_user =~/(\S*\@\S*)/) {
$current_user =$1;
}
if ($current_user =~/<(\S*\@\S*)>/){
$current_user =$1;
}
if ($current_user =~/<(\S*)>/){
$current_user =$1;
}

$current_user =~ s/\"//g; ### added to strip quotes from address

$rt::users{"$current_user"}{'real_name'} = $name_temp;
$rt::users{"$current_user"}{'real_name'} =~ s/(\S*)\@(\S*)//;
$rt::users{"$current_user"}{'real_name'} =~ s/<(.*?)>//;

Regards,
Bill Gerrard