[comp.unix.aix] AIX sendmail problem

ced@bcstec.uucp (Charles Derykus) (03/28/91)

I've run into a problem mailing to host "777sup1" in our domain. 
Both sender and recipient are AIX RS/6000's running 3003 and using DNS.
I've included a debug session below: 

	> /usr/lib/sendmail -v </dev/null guest@777sup1

          ced... setsender:  uid/gid = 200/1
          guest@777sup1... Connecting to 777sup1.ca.boeing.com.tcp...
          guest@777sup1... Connecting to 777sup1.ca.boeing.com (tcp)...
          777 up1.ca.boeing.com Sendmail AIX 3.1/UCB 5.61/4.03 ready at Wed,
          27 Mar 91 10:41:02 -0800
          >>> QUIT
          221 777sup1.ca.boeing.com closing connection
          guest@777sup1... Deferred: Bad file number


I note that sendmail on "777sup1" has apparently munched the
"s" in its hostname as evidenced by the line:

	"777 up1.ca.boeing.com Sendmail AIX...."

Other names with 3 initial digits suffer the same fate.

Any advice greatly appreciated.


Charles DeRykus				Internet:   ced@bcstec.boeing.com
Boeing Computer Services		UUCP:	    ...!uunet!bcstec!ced
Renton, WA.  M/S 6R-37			(206) 234-9223

Andy.Linton@comp.vuw.ac.nz (Andy Linton) (03/28/91)

In article <759@bcstec.boeing.com>, ced@bcstec.uucp (Charles Derykus) writes:

|> I note that sendmail on "777sup1" has apparently munched the
|> "s" in its hostname as evidenced by the line:
|> 
|> 	"777 up1.ca.boeing.com Sendmail AIX...."
|> 
|> Other names with 3 initial digits suffer the same fate.

This message occurs because of a bug in (feature of) the routine
message() which lives in err.c in sendmail. This routine is used to
print out messages from inside sendmail. The comment from the code
follows:

**  MESSAGE -- print message (not necessarily an error)
**
**      Parameters:
**              num -- the default ARPANET error number (in ascii)
**              msg -- the message (printf fmt) -- if it begins
**                      with a digit, this number overrides num.
**              a, b, c, d, e -- printf arguments
**
**      Returns:
**              none
**
**      Side Effects:
**              none.
*/

The comment about side effects is dubious (:-)

The offending code is in another routine called fmtmsg() which is called
by message. If the first three characters of the message are digits,
they get used as the reply code and the fourth character is discarded.
        
	/* output the reply code */
        if (isdigit(fmt[0]) && isdigit(fmt[1]) && isdigit(fmt[2]))
        {
                num = fmt;
                fmt += 4;
        }

Try using a hostname with 2 leading digits to confirm.

This is a bug which is exercised by the decision in rfc1123 to allow
hostnames which start with a digit. Previously '777sup1.ca.boeing.com'
would not have been a valid name and so the problem would not have
arisen.

Craig_Everhart@TRANSARC.COM (03/29/91)

This isn't just an AIX sendmail problem, but a sendmail problem for all
platforms.  (This is from memory.)

The code in sendmail that prints messages like this ("450 User at
lunch") is real convoluted.  Essentially, if a message starts with three
digits, this code will assume that these three digits are the SMTP
message code, and will separate them out, rather than finding the
message code in some other parameter or global variable.  As to the
fourth character, I'd guess that it's allowed to be space or hyphen, but
will get clobbered to space if the caller was so unwise as not to have
allowed that.

Thus, when sendmail starts up, it would ordinarily print its ``220
my.domain.name'' message, but if ``my.domain.name'' really starts with
three digits as 777sup1.ca.boeing.com does, the greet message will be
printed with a 777 message code.

Of course, in SMTP-land, such a code would indicate something truly
weird going on.

The only solutions I can think of involve heavy sendmail hacks, running
something besides sendmail as an SMTP server, or changing the host name
involved so it doesn't start with three digits.

		Craig