[comp.mail.sendmail] sendmail 5.61 turns off resolver inappropriately

hubert@cac.washington.edu (Steve Hubert) (09/01/89)

Index: ideas 4.3BSD

Description:
    This is a request for a change in the next version of sendmail.  I am
    using version 5.61 now and have been since its release.

    I have designed a sendmail.cf for our campus.  The addition of these
    lines in deliver.c:

    #ifdef NAMED_BIND
	    _res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
    #endif
    
    #ifdef NAMED_BIND
	    _res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
    #endif

    to turn off RES_DNSRCH and RES_DEFNAMES in deliver() is causing
    problems for me.  Presumably, this was done so that everyone would
    come up with sendmail.cf's that have fully-qualified names by the
    time they reach this point.  That's fine, but unfortunately it has
    some bad side effects.  In particular, at the time of delivery,
    all of the raw header recipient addresses are run through remotename()
    to expand them to what they should be on the remote host.  I would
    like to use the resolver to find the canonical names for me, and
    to expand short hand names.  Since the RES features are turned off
    the headers are not properly expanded.

    I'll give an example.  We have a naming scheme with 4 levels,
    host.dept.washington.edu.  We want people to be able to mail to
    user@host.dept or user@dept.  With unmodified sendmail 5.61, if I
    send mail to user@ucbvax.berkeley.edu and to user@host.dept, then
    I can't get user@host.dept to expand correctly in the header to
    the ucbvax recipient.  So the ucbvax recipient is going to see a
    header that says the mail was cc'd to user@host.dept instead of
    user@host.dept.washington.edu.  The only way I can get this to work
    is to have a class containing the names of all the subdomains on
    campus.  I really don't want to do that since the list keeps
    changing.  I could probably also do it by having a list of all
    top-level domains in a class.  That has the same changing-list
    problem.  What I am currently doing instead is distributing two
    versions of config files.  One gets distributed with a version of
    sendmail with the above two lines commented out.  The other has a
    class containing all of the subdomains on campus.  It goes to those
    administrators who don't want to modify their sendmail.  There is
    no other way to get this to work short of using a different mail
    user agent that does the qualification of addresses before passing
    it to sendmail.

Fix:
    Removal of the two XXX lines from deliver.c would fix this problem.
    An alternative fix would be to turn the resolver options back on
    before each call to remotename().  (I haven't checked that idea out.)

Steve Hubert
Networks and Distributed Computing
Univ. of Washington, Seattle
hubert@cac.washington.edu

necurtis@ndsuvax.UUCP (William Bruce Curtis) (09/13/89)

In article <3440@blake.acs.washington.edu> Steve Hubert <hubert@cac.washington.edu> writes:
>    I have designed a sendmail.cf for our campus.  The addition of these
>    lines in deliver.c:
>
>    #ifdef NAMED_BIND
>	    _res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
>    #endif
>    #ifdef NAMED_BIND
>	    _res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
>    #endif
>
>    to turn off RES_DNSRCH and RES_DEFNAMES in deliver() is causing
>    problems for me.  Presumably, this was done so that everyone would
>
	(Example problems deleted)
>Fix:
>    Removal of the two XXX lines from deliver.c would fix this problem.
>    An alternative fix would be to turn the resolver options back on
>    before each call to remotename().  (I haven't checked that idea out.)
>
>Steve Hubert
>Networks and Distributed Computing
>Univ. of Washington, Seattle
>hubert@cac.washington.edu

  Last week I also ran into the same problem with host names in headers not 
being fully qualified.  I wasn't sure that the lines above were causing the 
problem or what problems deleting them would cause so I wound up turning
the resolver options back on before the call to remotename in daemon.c

Below is the diff for the additions to daemon.c:


*** daemon.c.orig	Tue Sep 12 12:23:01 1989
--- daemon.c	Tue Sep 12 12:23:48 1989
***************
*** 37,42 ****
--- 37,44 ----
  # include <sys/file.h>
  # include <sys/types.h>
  # include <sys/stat.h>
+ # include <arpa/nameser.h>
+ # include <resolv.h>
  
  /*
  **  DAEMON.C -- routines to use when running as a daemon.
***************
*** 539,544 ****
--- 543,553 ----
  	}
  	else
  	{
+ 		/* NDSU fix.  If _res.options has been messed with make */
+ 		/* sure that it will be re-initialized.  Bruce Curtis */
+ 		if (!(_res.options & RES_DEFNAMES)) 
+ 			_res.options = RES_DEFAULT;
+ 		
  		hp = gethostbyname(hbuf);
  		if (hp == NULL) {
  			/* try lowercase version */
-- 
Bruce Curtis	necurtis@plains.NoDak.edu  	necurtis@ndsuvax.bitnet
North Dakota State University			..!uunet!ndsuvax!necurtis