[comp.mail.sendmail] Mangled header problem with sendmail.5.61.IDA

Malcolm.Harper@prg.oxford.ac.uk (04/24/91)

We're running 5.61++ IDA sendmail ($Header: READ_ME_UK,v 1.5 89/08/18 12:30:15)
and have encountered a problem with header rewriting, especially of "From:"
and "Reply-To:" lines.

There seems to be no problem with lines of the form
        From: Malcolm.Harper@uk.ac.oxford.prg (Malcolm Harper (Postmaster))
but lines of the form
        From: Malcolm.Harper@uk.ac.oxford.prg (Malcolm Harper \(Postmaster\))
get mangled into
        From: Malcolm.Harper@prg(.oxford.ac.uk (Malcolm Harper \(Postmaster\))
and then fail with "Unbalanced '('".

As far as I can tell, our system does not add the "\" characters before the
inner brackets, but we are receiving frequent "From:" lines of this form from
various mailing lists (such as cellular-automata, help-gnu-emacs, infovax and 
xpert).

The addresses are sometimes mangled into
        From: user@machine(:university:edu (Forename Surname \(comment\))
but that may be through subsequent mangling by the (UK-2.1 configured)
sendmail rewrite rules.

Has anyone else seen this problem?

-- Malcolm Harper

rickert@mp.cs.niu.edu (Neil Rickert) (04/25/91)

In article <9104241220.AA01017@gruffle.comlab.prg.ox.ac.uk> Malcolm.Harper@prg.oxford.ac.uk writes:
>We're running 5.61++ IDA sendmail ($Header: READ_ME_UK,v 1.5 89/08/18 12:30:15)
>and have encountered a problem with header rewriting, especially of "From:"
>and "Reply-To:" lines.
>
>There seems to be no problem with lines of the form
>        From: Malcolm.Harper@uk.ac.oxford.prg (Malcolm Harper (Postmaster))
>but lines of the form
>        From: Malcolm.Harper@uk.ac.oxford.prg (Malcolm Harper \(Postmaster\))
>get mangled into
>        From: Malcolm.Harper@prg(.oxford.ac.uk (Malcolm Harper \(Postmaster\))
>and then fail with "Unbalanced '('".

  This seems to be a combination of a bug in the sendmail sources from
Berkeley, and a possible bug in the 'sendmail.cf' you are using.

  I am compiling a possible fix to the source bug right now.  I will post
if it works out.

  Here is what I am seeing:

The function prescan() is supposed to convert

   address (comment)

into just

   address

However it seems to convert

   address (comment \x )

into

   address\x (comment \x )

 In other words, backslash escaped characters inside the comments are
mishandled.

 That puts your address into the form:

Malcolm.Harper@uk.ac.oxford.prg \(\)

 and somehow the address rewriting rules seem to be dropping the \) from
this.  I don't have any such rewrite problem here, but then I don't have
to reverse addresses the way you folks do.  Probably the rewrite rules are
being fooled by two consecutive tokens which are not separated by a '.'
during the domain reversal algorithm.  (Which may mean that this is nothing
to worry about once the source code fix is in place).
-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940

rickert@mp.cs.niu.edu (Neil Rickert) (04/25/91)

In article <1991Apr24.205539.11879@mp.cs.niu.edu> rickert@mp.cs.niu.edu (Neil Rickert) writes:
>In article <9104241220.AA01017@gruffle.comlab.prg.ox.ac.uk> Malcolm.Harper@prg.oxford.ac.uk writes:
>>but lines of the form
>>        From: Malcolm.Harper@uk.ac.oxford.prg (Malcolm Harper \(Postmaster\))
>>get mangled into
>>        From: Malcolm.Harper@prg(.oxford.ac.uk (Malcolm Harper \(Postmaster\))
>>and then fail with "Unbalanced '('".

>  This seems to be a combination of a bug in the sendmail sources from
>Berkeley, and a possible bug in the 'sendmail.cf' you are using.
>
>  I am compiling a possible fix to the source bug right now.  I will post
>if it works out.

 Here is the promised patch.

 It compiles, and it passes my preliminary tests.  I am now running the patched
version as my system 'sendmail'.  If any problems turn up I will post a notice.

 As you can see, the patch just changes an 'else if'  into an 'if'

 What was happening was that a backslash quoted character was handled first,
by setting a quote bit.  Because of the 'else' it was never looked at again
and so missed the processing to handle the fact that it was in a parenthesized
comment.  Removing the 'else' should eliminate the problem.

*** /tmp/RCSAAA029384	Wed Apr 24 16:18:02 1991
--- parseaddr.c	Wed Apr 24 16:04:46 1991
***************
*** 389,395 ****
  				bslashmode = TRUE;
  				c = NOCHAR;
  			}
! 			else if (state == QST)
  			{
  				/* do nothing, just avoid next clauses */
  			}
--- 389,395 ----
  				bslashmode = TRUE;
  				c = NOCHAR;
  			}
! 			/* else */ if (state == QST)
  			{
  				/* do nothing, just avoid next clauses */
  			}

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940