Getting inside the quotes in sendmail...

Paul A Vixie vixie at decwrl.dec.com
Fri Dec 29 15:30:03 AEST 1989


There is not a good way to get inside of quoted strings.  To sendmail's
parser, a "quoted string" looks like a single token, which means that it
will for example match $- and show up in $1 or whatever.  This is a boon
if you are trying to encapsulate a very-foriegn address in a way that
guarantees that sendmail will leave it alone.  It is a pain when you want
to poke at the address.

Standard sendmail has an "s" mailer flag that lets you strip off the
quotes when you submit the message to an outgoing mailer.  One thing you
could do as a workaround is to submit to a mailer that just reinvoked
sendmail in its A=; if you said M=s, the next round of sendmail process-
ing would not see the quotes.  This is a performance hog as well as very
inelegant.

I was running into this same problem on the DECWRL gateway recently, and
my solution was to hack the sendmail source (which is freely available
from Berkeley, UUNET, DECWRL, and a lot of other places).  What I did was
to notice, at the end of a given rule, that the address being rewritten
had dwindled to a single argument and that that argument was a quoted
string.  In that event I strip off the quotes and re-tokenize the result.
Since DECnet/mail11 insists on sending me things like DECWRL::"foo at baz",
quotes and all, it fell to me only to strip off the DECWRL:: and my hacked
sendmail binary pulled off the quotes automagically.

Don't try this at home :-)..

Paul Vixie
DEC WRL
--
Paul Vixie
Work:    vixie at decwrl.dec.com    decwrl!vixie    +1 415 853 6600
Play:    paul at vixie.sf.ca.us     vixie!paul      +1 415 864 7013



More information about the Comp.unix.ultrix mailing list