RT misparsing From header

Yesterday, someone sent a message to our RT instance with a From
header like this:

The mail then sent to the queue watchers had this header:

Joe " via RT" <webmaster-comment@schloss-online.de>

(www-dmz.schloss-online.de is the machine running RT.)

Any ideas what went wrong there, or how to correct it?
This is RT 2.0.13, sending mail via qmail.

Sebastian Flothow
sebastian@flothow.de
#include <stddisclaimer.h>

Yesterday Sebastian Flothow wrote:

Yesterday, someone sent a message to our RT instance with a From
header like this:

From: “Random, Joe” jrandom@some-company.com

The mail then sent to the queue watchers had this header:

From: “”@www-dmz.schloss-online.de, Random@www-dmz.schloss-online.de,
Joe " via RT" webmaster-comment@schloss-online.de

(www-dmz.schloss-online.de is the machine running RT.)

Any ideas what went wrong there, or how to correct it?

This sounds like what I postulated as being a problem a few week’s ago:

http://lists.fsck.com/pipermail/rt-users/2002-March/007455.html

However after some tests and off-list communication with Jesse I was
unable to produce this, so assumed my postulations were misguided.

This is RT 2.0.13, sending mail via qmail.

We’re using ‘Exim’; Phil Oester who had the problem last time uses
‘Sendmail’. This could be significant.

Can you look up the entry for Joe Random’s user account in ‘RT’ and look
to see what his real name is set to. In particular, does it have quotes
in it?

It looks like quotes are being added in two places (one of them probably
being when “via RT” is appended). The doubled quoting is of course
causing some words which should be quoted not to be, therefore they are
in places where an e-mail address should be. And you’ve probably got
your MTA configured so that local e-mail addresses can consist of just
the username part and have the domain added automatically.

Those things combined makes what you’re seeing seem plausible. For
fixing this we’re going to have to work out exactly where which quotes
are being added.

Simon
GBdirect

At 9:30 Uhr +0100 22.4.2002, Smylers wrote:

This sounds like what I postulated as being a problem a few week’s ago:

http://lists.fsck.com/pipermail/rt-users/2002-March/007455.html

Indeed.
I applied the modification proposed at the end of this post, which
solves the problem (and doesn’t cause any new problems as far as I
can see).
Jesse: will this be included in a future version of RT?

This is RT 2.0.13, sending mail via qmail.

We’re using ‘Exim’; Phil Oester who had the problem last time uses
‘Sendmail’. This could be significant.

Well, it supports the assumption that there’s nothing wrong with the MTA.

Can you look up the entry for Joe Random’s user account in ‘RT’ and look
to see what his real name is set to. In particular, does it have quotes
in it?

It’s set to “Random, Joe”, including the quotes. This shows that the
From header gets parsed correctly (unlike I assumed initially).

It looks like quotes are being added in two places (one of them probably
being when “via RT” is appended).

Not quite - RT adds quotes only once, when “via RT” is appended,
which causes trouble if the name already has quotes.
Thus, another way of fixing this would be to strip quotes when users
are auto-created on ticket creation.

And you’ve probably got
your MTA configured so that local e-mail addresses can consist of just
the username part and have the domain added automatically.

Yes, qmail does this by default.

Sebastian Flothow
sebastian@flothow.de
#include <stddisclaimer.h>

Yesterday Sebastian Flothow wrote:

At 9:30 Uhr +0100 22.4.2002, Smylers wrote:

http://lists.fsck.com/pipermail/rt-users/2002-March/007455.html

I applied the modification proposed at the end of this post, which
solves the problem (and doesn’t cause any new problems as far as I can
see).

Jesse: will this be included in a future version of RT?

This is RT 2.0.13, sending mail via qmail.

We’re using ‘Exim’; Phil Oester who had the problem last time uses
‘Sendmail’. This could be significant.

Well, it supports the assumption that there’s nothing wrong with the
MTA.

Except that we don’t get the problem with ‘Exim’. My mail quoted
above was written theoretically, based on what I expected to happen, not
on me having experienced the problem.

Jesse asked me to test Simon Cozen’s patch (referred to earlier in that
March thread) so I created a user with quote marks in their real name
and, but couldn’t actually coax my system into failing in the way I’d
expected either with or without Simon’s patch.

In other words, for me at least, the current ‘RT’ code works fine though
I don’t understand why. It could be that ‘Exim’ is doing something
funky to compensate for dodgy quotes, or it could be something entirely
different.

Can you look up the entry for Joe Random’s user account in ‘RT’ and
look to see what his real name is set to. In particular, does it
have quotes in it?

It’s set to “Random, Joe”, including the quotes.

That’s what I suspected, and is what I set up when trying and failing to
reproduce this behaviour.

It looks like quotes are being added in two places (one of them
probably being when “via RT” is appended).

Not quite - RT adds quotes only once, when “via RT” is appended, which
causes trouble if the name already has quotes.

Fair enough; what I meant is that the across the entire system there are
two places where quotes are being added. The first quotes are
(correctly) added by the requestor’s MUA; they are first added into ‘RT’
when that user is created.

Thus, another way of fixing this would be to strip quotes when users
are auto-created on ticket creation.

Yes – it’s probably more sensible to ensure that no quotes end up in
that field in the first place, than to have to remove them every time a
mail is sent. (Especially since typically each user created will
receive several mails.)

But I’ve just realized the disadvantage of that: stripping quotes on the
way in doesn’t help with any users already in your database with quotes
in them. You’d also need a script to iterate through the DB and remove
quotes from existing users, which is considerably more effort.

Cheers.

Smylers
GBdirect