DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T u

⟦96dd5098d⟧ TextFile

    Length: 22430 (0x579e)
    Types: TextFile
    Names: »uk.src.patches«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦bfebc70e2⟧ »EurOpenD3/mail/sendmail-5.65b+IDA-1.4.3.tar.Z« 
        └─⟦f9e35cd84⟧ 
            └─⟦this⟧ »sendmail/uk.extras/uk.src.patches« 

TextFile

*** /tmp/,RCSt1a05098	Thu Dec 20 23:05:54 1990
--- conf.h	Thu Dec 20 23:05:11 1990
***************
*** 36,42 ****
  # define MAXHOP		17		/* max value of HopCount */
  # define MAXATOM	200		/* max atoms per address */
  # define MAXMAILERS	25		/* maximum mailers known to system */
! # define MAXRWSETS	31		/* max # of sets of rewriting rules */
  # define MAXPRIORITIES	25		/* max values for Precedence: field */
  # define MAXTRUST	30		/* maximum number of trusted users */
  # define MAXUSERENVIRON	40		/* max # of items in user environ */
--- 36,42 ----
  # define MAXHOP		17		/* max value of HopCount */
  # define MAXATOM	200		/* max atoms per address */
  # define MAXMAILERS	25		/* maximum mailers known to system */
! # define MAXRWSETS	40		/* max # of sets of rewriting rules */
  # define MAXPRIORITIES	25		/* max values for Precedence: field */
  # define MAXTRUST	30		/* maximum number of trusted users */
  # define MAXUSERENVIRON	40		/* max # of items in user environ */
***************
*** 95,101 ****
  ** malloc.c and getpwent.c are compiled with the sendmail source.
  */
  # if !defined(NeXT) && !defined(_AIX) && !defined(apollo)
! #  define	_PATH_SENDMAILFC	"/etc/sendmail.fc"
  # endif /* !NeXT && !_AIX && !apollo */
  
  /*
--- 95,101 ----
  ** malloc.c and getpwent.c are compiled with the sendmail source.
  */
  # if !defined(NeXT) && !defined(_AIX) && !defined(apollo)
! #  define	_PATH_SENDMAILFC	"/etc/sendmail.fc" 
  # endif /* !NeXT && !_AIX && !apollo */
  
  /*
***************
*** 103,105 ****
--- 103,219 ----
  ** the daemon's pid.
  */
  # define	_PATH_SENDMAILPID   	"/etc/sendmail.pid"
+ 
+ /* Beginning of changes aimed at domain.c done by John Forrest, 
+    Dept of Computation, UMIST - John.Forrest@umist.ac.uk */
+ 
+ 	/*
+ 	 * If you define LOOK_FOR_LONGSYNONYMS, sendmail will try to spot
+ 	 * situations where parent domains have synonyms in BIND. 
+ 	 * For example, with:
+ 	 *	manchester.ac.uk.		CNAME	man.ac.uk.
+ 	 *	computer-science.man.ac.uk	CNAME	cs.man.ac.uk.
+ 	 *
+ 	 * with this option set, given computer-science.manchester.ac.uk
+ 	 * it will produce cs.man.ac.uk. Normally, no such synonym will
+ 	 * be spotted. Note this is primarily intended for use in the UK,
+ 	 * where such synonyms abound. It does take longer to spot a bad
+ 	 * address, so if you don't need the functionality don't use it -
+ 	 * comment out the next line - jf 12/90 */
+ #define LOOK_FOR_LONGSYNONYMS 1
+ 
+ 	/* An extension which allows one of the classes to be nominated
+ 	   as known top domains. If an address ends with one of these to start
+ 	   with, we assume it is fully expanded, and the only point of looking
+ 	   up the name is to find synonyms. Note: this only affects getting
+ 	   the canonical name using BIND. To enable the extension, define
+ 	   TOP_DOMAIN_CLASS to the letter you wish to use. It is suggested
+ 	   that class 't' be used - because this is lower case, no other cf rule
+ 	   set should use this for another reason. However, as a safety
+ 	   measure, the feature is only enabled if there is some data placed
+ 	   in TOP_DOMAIN_CLASS.
+ 
+ 	   By default, names are always searched for normally (if
+ 	   NO_WILDCARD_MX) or not really searched for (! NO_WILDCARD_MX).
+ 	   jf 12/90
+ 	*/
+ #define TOP_DOMAIN_CLASS 't'
+ 
+ 	/*
+ 	 * By default, during getcanonname, sendmail accesses BIND
+ 	 * with the DEFNAMES and DNSRCH flags set. This means that
+ 	 * partially defined names will be automatically resolved
+ 	 * by BIND. [Note, if TOP_DOMAIN_CLASS is defined, there is
+ 	 * a dot in the name, and the last element is in the
+ 	 * top domain class, the search will take place with these
+ 	 * bits reset.] If you prefer never to use DNSRCH in this
+ 	 * situation, for some reason, uncomment the next line. The
+ 	 * effect of this is that BIND only knows local and global
+ 	 * names. The bits used are refered to as the "SEARCH bits".
+ 	 * The disadvantage of this is that there are ambiguity
+ 	 * problems if TOP_DOMAIN_CLASS is not kept up to date - there
+ 	 * is a small possibility that what is really a full address
+ 	 * from somewhere else will match a local address. Whether you
+ 	 * feel this is a real possibility is a matter of opinion.
+ 	 *	John Forrest 12/90.
+ 	 */
+ /* #define DONT_DNSRCH 1 */
+ 
+ 	/*
+ 	 * if IGNORE_SELF_MX is defined, getcanonname fails if the
+ 	 * found name has MX's where the best points to the current
+ 	 * node. The reason for this ``trick'' is as follows:
+ 	 *
+ 	 * Host 'somecompany.com', which has a uucp node name of 
+ 	 * 'somecompany' arranges to have an MX record created, 
+ 	 * pointing to the localnmode as the best preference.  
+ 	 * At the same time, they make sure their uucp name is in 
+ 	 * the uucp maps.
+ 	 *
+ 	 * When any internet user sends mail to 
+ 	 * 'user@somecompany.com' it arrives at the localnode. 
+ 	 * Because the best preference MX is local, the TCP mailer 
+ 	 * is not selected.  There is now a lookup of the PATHTABLE 
+ 	 * database.  This contains a record:
+ 	 *
+ 	 * 	somecompany.com		foo!bar!somecompany%s
+ 	 *
+ 	 * which was generated from the uucp maps, using the 
+ 	 * pathalias function.
+ 	 *
+ 	 * The big advantage of this is that whether to use the relay
+ 	 * or not can be determined by ``samecompany'' - it is a
+ 	 * question of changing the MX entry. The disadvantage is
+ 	 * that you have to be able to cope with ALL local synonyms
+ 	 * yourself - via PSEUDONUMS or via the DOMAINTABLE database.
+ 	 * Otherwise, you may find yourself with bouncing mail.
+ 	 * The alternative technique for routing is to use the
+ 	 * MAILERTABLE to indicate different mailers are required
+ 	 * for particular mail. This requires more local intervention,
+ 	 * but doesn't have any of the problems associated with
+ 	 * this option.
+ 	 *
+ 	 * Generally, if you don't relay or you are using non-IDA
+ 	 * .cf files, it is best to leave the option commented out.
+ 	 * Otherwise, it is up to you - it probably depends on
+ 	 * how many nodes you relay to, and how frequently the
+ 	 * information changes.
+ 	    - John.Forrest@umist 11/90. This option selectively
+ 	      enables code added by Paul Pomes. Comment derived 
+ 	      from mail by Neil Rickert. */
+ /* #define IGNORE_SELF_MX 1 */
+ 
+ 	/*
+ 	 * There is always a problem of knowing what to do if
+ 	 * the name server returns h_errno==TRY_AGAIN during getcanonname.
+ 	 * By default, it will return FALSE, but if you define
+ 	 * IGNORE_TRYAGAIN, it will return TRUE. Normally if the 
+ 	 * condition still persists, then it will be met again
+ 	 * during getmxrs, and the mail will be requeued. However,
+ 	 * if you use BIND to resolve names, there is always a possibility
+ 	 * that the wrong action will occur. Probably best only to
+ 	 * set this if BIND problems are common.
+ 	 */
+ /* #define IGNORE_TRYAGAIN 1 */
+ 
+ /* end of jf domain.c changes */
*** /tmp/,RCSt1a05098	Thu Dec 20 23:05:59 1990
--- readcf.c	Thu Dec 20 23:05:15 1990
***************
*** 177,182 ****
--- 177,188 ----
  
  		  case 'C':		/* word class */
  		  case 'F':		/* word class from file */
+ #if defined(TOP_DOMAIN_CLASS) && defined(NAMED_BIND) && defined(NO_WILDCARD_MX)
+ 			if (buf[1] == TOP_DOMAIN_CLASS) {
+ 				extern clear_topdomain;
+ 				clear_topdomain = FALSE;
+ 			}
+ #endif	
  			/* read list of words from argument or file */
  			if (buf[0] == 'F')
  			{
*** /tmp/,RCSt1a05098	Thu Dec 20 23:06:04 1990
--- domain.c	Thu Dec 20 23:05:20 1990
***************
*** 170,235 ****
  	return(nmx);
  }
  
! /*
! **	Getcanonname() below is broken in the sense that it won't return
! **	unqualified local host names with their full domain extension,
! **	unless the argument is an alias.
  **
! **	Since gethostbyname() calls the name server with bind 4.8,
! **	I don't see why this function would be needed at all.  I've
! **	therefore restored the old code in maphostname() of daemon.c
! **	that uses gethostbyname().  If there's something I've missed,
! **	feel free to change maphostname() to again call getcanonname(),
! **	but also make sure that the latter will qualify the host with
! **	its full domain AND return a status code indicating if the host
! **	was found.
! **
! **	Lennart Lovstrand, Rank Xerox EuroPARC, 24-Aug-88
! **
! **	Unfortunately, just using gethostbyname won't do it.  It queries for
! **	and returns only A Resource Records, so it will miss a host with only
! **	an MX record listed.  If you're trying to deliver everything you can
! **	via the Internet, and deliver to only those hosts who are not in the
! **	domain name system at all by a "smart UUCP" mailer like smail, you
! **	will end up delivering more than you want to via that smart mailer.
! **	In that case, gethostbyname isn't enough.
! **
! **	Chet Ramey, Case Western Reserve University, 15-Sep-88
! **
! **	Changed to make it return FALSE on an error, TRUE if an answer was
! **	found (any answer is enough).
! **
! **	Chet Ramey, Case Western Reserve University, 16-Sep-88
! **
! **	In the case of a host with a MX record pointing at localhost,
! **	another routing method must be used.  Examine any MX RRs returned.
! **	If the best one points to localhost, return FALSE.
! **
! **	Paul Pomes, University of Illinois, 10-Oct-88
  */
  getcanonname(host, hbsize)
  	char *host;
  	int hbsize;
  {
- 	extern int h_errno;
  	register u_char *eom, *cp;
! 	register int n; 
  	HEADER *hp;
  	querybuf answer;
  	u_short type;
  	int first, ancount, qdcount, loopcnt;
  	char nbuf[PACKETSZ];
! 	u_short MailPreference = (u_short) -1;
  	char MailAgent[MAXNAME];
  	char MyName[MAXNAME];
  	char **MyAliases;
- 
  	extern char **myhostname();
  
- 	MailAgent[0] = '\0';
- 
  	loopcnt = 0;
  loop:
  	/*
  	 * Use query type of ANY if possible (NO_WILDCARD_MX), which will
  	 * find types CNAME, A, and MX, and will cause all existing records
--- 170,320 ----
  	return(nmx);
  }
  
! /* Getcanonname - try to find canonical names using the BIND name
!    server. This is basically done by looking up entries and using
!    the names found, or the CNAME values. If nothing is found then
!    FALSE is returned. Note, that if the return value is FALSE,
!    the host value is not necessarily valid - the code that calls
!    getcanonname only uses host for TRUE results.
! 
!    The exact behaviour depends on the values of NO_WOLDCARD_MX,
!    TOP_DOMAIN_CLASS, DONT_DNSRCH, LOOK_FOR_LONGSYNONYMS and 
!    IGNORE_SELF_MX - see conf.h for more details.
! 
!    This version, John.Forrest@umist.ac.uk December 90 */
! 
! #ifndef NO_WILDCARD_MX
!    /* if NO_WILDCARD_MX is undefined, we can only resolve full names. */
! #  define is_full_name(host) (TRUE)
! 
! #else
! 
! #ifdef TOP_DOMAIN_CLASS
! clear_topdomain = TRUE;
! #endif /* TOP_DOMAIN_CLASS */
! 
! static is_full_name (host)
! 	char *host;
! {
! 	char *top_dom;
! 
! 	top_dom = rindex (host, '.');
! 	if (top_dom == NULL) 
! 		return FALSE;
! 	top_dom += 1;
! 	if (*top_dom == '\0') /* name ends with "." */
! 		return TRUE;
! #if defined(TOP_DOMAIN_CLASS)
! 	{
! 	STAB *s;
! 	if (clear_topdomain) /* we know no top domains - have to */
! 		return TRUE;  /* assume full for safety */
! 	/* is it in class TOP_DOMAIN_CLASS ? */
! 	s = stab (top_dom, ST_CLASS, ST_FIND);
! 	return (s != NULL && bitnset(TOP_DOMAIN_CLASS, s->s_class));
! 	}
! #else
! 	return FALSE;
! #endif /* TOP_DOMAIN_CLASS */
! }
! 
! #endif /* !NO_WILDCARD_MX */
! 
! #if defined(TOP_DOMAIN_CLASS) && defined(NO_WILDCARD_MX) && defined(LOG)
! #  define CHECK_TOP 1
! #else
! #  define CHECK_TOP 0
! #endif
! 
! #if CHECK_TOP
! 
! static check_top(host)
! 	char *host;
! {
! 	char *top_dom;
! 	STAB *s;
! 
! 
! 	if ((top_dom = rindex (host, '.')) == NULL) {
! 		syslog(LOG_WARNING, "Incomplete named found by BIND - %s",
! 			host);
! 		return;
! 	}
! 	if (clear_topdomain)
! 		return;
! 	top_dom += 1; /* skip over '.' */
! 	/* is it in class TOP_DOMAIN_CLASS ? */
! 	s = stab (top_dom, ST_CLASS, ST_FIND);
! 	if (s == NULL || ! bitnset(TOP_DOMAIN_CLASS, s->s_class))
! 		syslog (LOG_WARNING, "Unknown top domains %s in %s (returned from BIND)",
! 			top_dom, host);
! }
! 
! #endif /* CHECK_TOP */
! 	
! #if defined(DONT_DNSRCH)
! #  define SEARCH (RES_DEFNAMES)
! #else
! #  define SEARCH (RES_DEFNAMES|RES_DNSRCH)
! #endif
! 
! # if defined(IGNORE_SELF_MX)
! /*      In the case of a host with a MX record pointing at localhost,
! **      another routing method must be used.  Examine any MX RRs returned.
! **      If the best one points to localhost, return FALSE.
  **
! **      Paul Pomes, University of Illinois, 10-Oct-88
  */
+ 
+ #define InitPreference 1000
+ # endif
+ 
  getcanonname(host, hbsize)
  	char *host;
  	int hbsize;
  {
  	register u_char *eom, *cp;
! 	register int n;
  	HEADER *hp;
  	querybuf answer;
  	u_short type;
  	int first, ancount, qdcount, loopcnt;
  	char nbuf[PACKETSZ];
! 	char *wanted_name;
! #ifdef LOOK_FOR_LONGSYNONYMS
! 	char name_stub [MAXNAME];
! 	char *temp;
! #endif
! 	int must_be_full;
! 	long keep_res_options;
! 	int search_failed;
! #ifdef IGNORE_SELF_MX
! 	u_short MailPreference;
  	char MailAgent[MAXNAME];
  	char MyName[MAXNAME];
  	char **MyAliases;
  	extern char **myhostname();
+ #endif
+ #ifdef LOOK_FOR_LONGSYNONYMS
+ #  define no_stub() (*name_stub == '\0')
+ #else
+ #  define no_stub() (TRUE)
+ #endif
  
  	loopcnt = 0;
+ 	must_be_full = is_full_name (host);
+ 	keep_res_options = _res.options;
  loop:
+ 	wanted_name = host;
+ #ifdef IGNORE_SELF_MX
+ 	MailPreference = InitPreference;
+ 	MailAgent[0] = '\0';
+ #endif
+ #ifdef LOOK_FOR_LONGSYNONYMS
+ 	strcpy (name_stub, "");
+ 	while (strlen(wanted_name) > 0) {
+ #endif
+ 	search_failed = 0;
  	/*
  	 * Use query type of ANY if possible (NO_WILDCARD_MX), which will
  	 * find types CNAME, A, and MX, and will cause all existing records
***************
*** 238,303 ****
  	 * searched, we can't use ANY; it would cause fully-qualified names
  	 * to match as names in a local domain.
  	 */
! # ifndef NO_WILDCARD_MX
! 	_res.options &= ( ~RES_DEFNAMES & 0xffff ) ;
! # endif /* NO_WILDCARD_MX */
! 	n = res_search(host, C_IN, T_ANY, (char *)&answer, sizeof(answer));
! # ifndef NO_WILDCARD_MX
! 	_res.options |= RES_DEFNAMES ;
! # endif /* NO_WILDCARD_MX */
  	if (n < 0) {
- 	        /*
- 	         * If getcanonname() times out we don't really know whether
- 		 * the name is good or bad.  Give it the benefit of the doubt,
- 		 * take it in and sort it out later using getmxrr().
- 		 */
- 		if (h_errno == TRY_AGAIN)
- 		{
- 			if (tTd(8, 1))
- 				printf("getcanonname:  res_search timed out (errno=%d, h_errno=%d)\n",
- 				    errno, h_errno);
- 			return TRUE;
- 		}
  		if (tTd(8, 1))
  			printf("getcanonname:  res_search failed (errno=%d, h_errno=%d)\n",
  			    errno, h_errno);
! 
! 		return FALSE;
  	}
  
! 	/* find first satisfactory answer */
! 	hp = (HEADER *)&answer;
! 	ancount = ntohs(hp->ancount);
  
! 	/* we don't care about errors here, only if we got an answer */
! 	if (ancount == 0) {
! 		if (tTd(8, 1))
! 			printf("rcode = %d, ancount=%d\n", hp->rcode, ancount);
! 		return FALSE;
  	}
! 	cp = (u_char *)&answer + sizeof(HEADER);
! 	eom = (u_char *)&answer + n;
! 	for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ)
! 		if ((n = dn_skipname(cp, eom)) < 0)
  			return FALSE;
! 
  	/*
  	 * just in case someone puts a CNAME record after another record,
  	 * check all records for CNAME; otherwise, just take the first
  	 * name found.
  	 */
! 	for (first = 1; --ancount >= 0 && cp < eom; ) {
  		if ((n = dn_expand((char *)&answer, eom, cp, nbuf,
  		    sizeof(nbuf))) < 0)
  			break;
! 		if (first) {			/* XXX */
! 			(void)strncpy(host, nbuf, hbsize);
! 			host[hbsize - 1] = '\0';
  			first = 0;
  		}
  		cp += n;
  		GETSHORT(type, cp);
!  		cp += sizeof(u_short) + sizeof(u_long);
  		GETSHORT(n, cp);
  		if (type == T_CNAME)  {
  			/*
--- 323,427 ----
  	 * searched, we can't use ANY; it would cause fully-qualified names
  	 * to match as names in a local domain.
  	 */
! 	if (must_be_full)
! 		_res.options &= ( ~SEARCH & 0xffff );
! 	else
! 		_res.options |= SEARCH;
! 	if (tTd(8, 1))
! 	    printf ("getcanonname: looking for %s (%d %d %x)\n", wanted_name, 
! 		no_stub(), must_be_full, _res.options); /* DEBUG */
! 	n = 0;
! 	if (! no_stub ()) { 
! 		/* if this is true, we are just interested in CNAMES,
! 		   but in BIND4.6 at least, a lookup for CNAME
! 		   seems to produce "delayed" lookup, even with
! 		   RES_RECURSE set. Thus, look on local server for
! 		   CNAME, and if that fails do ANY normally */
! 		if (tTd(8, 2))
! 	    		printf ("getcanonname: looking for CNAME\n");
! 		_res.options &= ~ RES_RECURSE;
! 		n = res_search(wanted_name, C_IN, 
! 			T_CNAME, (char *)&answer, sizeof(answer));
! 		_res.options |= RES_RECURSE;
! 	}
! 	if (n <= 0) {
! 		if (tTd(8, 2))
! 	    		printf ("getcanonname: looking for ANY\n");
! 		n = res_search(wanted_name, C_IN, 
! 			T_ANY, (char *)&answer, sizeof(answer));
! 	}
! 	_res.options = keep_res_options;
  	if (n < 0) {
  		if (tTd(8, 1))
  			printf("getcanonname:  res_search failed (errno=%d, h_errno=%d)\n",
  			    errno, h_errno);
! 		if (h_errno == TRY_AGAIN) /* difficult to know what to do */
! #ifdef IGNORE_TRYAGAIN
! 			return TRUE;
! #else
! 			return FALSE;
! #endif
! 		search_failed ++;
  	}
  
! 	if (!search_failed) {
! 		/* find first satisfactory answer */
! 		hp = (HEADER *)&answer;
! 		ancount = ntohs(hp->ancount);
  
! 		/* we don't care about errors here, only if we got an answer */
! 		if (ancount == 0) {
! 			if (tTd(8, 1))
! 				printf("rcode = %d, ancount=%d\n", hp->rcode, ancount);
! 			search_failed ++;
! 		}
  	}
! 	if (!search_failed) {
! 		cp = (u_char *)&answer + sizeof(HEADER);
! 		eom = (u_char *)&answer + n;
! 		for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ)
! 			if ((n = dn_skipname(cp, eom)) < 0)
! 				search_failed ++;
! 	}
! 	if (search_failed)
! # ifdef LOOK_FOR_LONGSYNONYMS
! 	{
! 		temp = index (wanted_name, '.');
! 		if (temp == NULL)
  			return FALSE;
! 		temp += 1;
! 		if (*temp == '\0')
! 			return FALSE;
! 		strncat (name_stub, wanted_name, temp - wanted_name);
! 		wanted_name = temp;
! 		continue;
! 	}
! # else
! 		return FALSE;
! # endif
  	/*
  	 * just in case someone puts a CNAME record after another record,
  	 * check all records for CNAME; otherwise, just take the first
  	 * name found.
  	 */
! 	for (first = 1; --ancount >= 0 && cp < eom; cp += n) {
  		if ((n = dn_expand((char *)&answer, eom, cp, nbuf,
  		    sizeof(nbuf))) < 0)
  			break;
! 		if (first) {                    /* XXX */
! 			/* if ! no_stub() we are only interested in CNAME ! */
! 			if (no_stub ()) {
! 				(void)strncpy(host, nbuf, hbsize);
! 				host[hbsize - 1] = '\0';
! #if CHECK_TOP
! 				check_top (host);
! #endif
! 			}
  			first = 0;
  		}
  		cp += n;
  		GETSHORT(type, cp);
! 		cp += sizeof(u_short) + sizeof(u_long);
  		GETSHORT(n, cp);
  		if (type == T_CNAME)  {
  			/*
***************
*** 308,320 ****
  			if ((n = dn_expand((char *)&answer, eom, cp, nbuf,
  			    sizeof(nbuf))) < 0)
  				break;
! 			/* cp += n;  un-used  -pbp */
  			(void)strncpy(host, nbuf, hbsize); /* XXX */
  			host[hbsize - 1] = '\0';
! 			if (++loopcnt > 8)	/* never be more than 1 */
  				return FALSE;
  			goto loop;
  		}
  		else if (type == T_MX)  {
  			/*
  			 * Be sure that the best MX record doesn't point
--- 432,454 ----
  			if ((n = dn_expand((char *)&answer, eom, cp, nbuf,
  			    sizeof(nbuf))) < 0)
  				break;
! #ifdef LOOK_FOR_LONGSYNONYMS
! 			host [0] = '\0';
! 			strncat (host, name_stub, hbsize);
! 			strncat (host, nbuf, hbsize - strlen (host));
! #else
  			(void)strncpy(host, nbuf, hbsize); /* XXX */
  			host[hbsize - 1] = '\0';
! #endif
! #if CHECK_TOP
! 			check_top (host);
! #endif
! 			must_be_full = 1;       /* new name is bound to be full */
! 			if (++loopcnt > 8)      /* never be more than 1 */
  				return FALSE;
  			goto loop;
  		}
+ #ifdef IGNORE_SELF_MX
  		else if (type == T_MX)  {
  			/*
  			 * Be sure that the best MX record doesn't point
***************
*** 328,334 ****
  			if ((n = dn_expand((char *)&answer, eom, cp, nbuf,
  			    sizeof(nbuf))) < 0)
  				break;
- 			cp += n;
  			if (tTd(8, 1))
  				printf("getcanonname: MX host %s, preference %d\n",
  					nbuf, preference);
--- 462,467 ----
***************
*** 335,349 ****
  			if (preference < MailPreference) {
  				MailPreference = preference;
  				(void) strcpy(MailAgent, nbuf);
! 	}
  		}
! 		else
! 			cp += n;
  	}
  	/* test MailAgent against $j */
  	if (MailAgent[0] != '\0' && MyHostName != NULL &&
  	    strcasecmp(MailAgent, MyHostName) == 0)
! 		return (FALSE);
  
  	/* test MailAgent against our DNS name and aliases */
  	if (MailAgent[0] != '\0' &&
--- 468,495 ----
  			if (preference < MailPreference) {
  				MailPreference = preference;
  				(void) strcpy(MailAgent, nbuf);
! 			}
  		}
! #endif /* IGNORE_SELF_MX */
  	}
+ #ifdef LOOK_FOR_LONGSYNONYMS
+ 	break;
+ 	}
+ #endif
+ 	if (tTd(8, 1))
+ #ifdef LOOK_FOR_LONGSYNONYMS
+ 		printf ("getcanonname: found stub='%s' host='%s'\n",
+ 			name_stub, host);
+ #else
+ 		printf ("getcanonname: found '%s'\n", host);
+ #endif
+ 	if (! no_stub())
+ 		return FALSE;
+ #ifdef IGNORE_SELF_MX
  	/* test MailAgent against $j */
  	if (MailAgent[0] != '\0' && MyHostName != NULL &&
  	    strcasecmp(MailAgent, MyHostName) == 0)
! 		return FALSE;
  
  	/* test MailAgent against our DNS name and aliases */
  	if (MailAgent[0] != '\0' &&
***************
*** 353,362 ****
  		for (; *MyAliases != NULL; MyAliases++)
  			if (strcasecmp(MailAgent, *MyAliases) == 0)
  				return FALSE;
- 		return TRUE;
  	}
! 	else
! 		return TRUE;
  }
  
  #else /* !NAMED_BIND */
--- 499,507 ----
  		for (; *MyAliases != NULL; MyAliases++)
  			if (strcasecmp(MailAgent, *MyAliases) == 0)
  				return FALSE;
  	}
! #endif /* IGNORE_SELF_MX */
! 	return TRUE;
  }
  
  #else /* !NAMED_BIND */
***************
*** 371,382 ****
  
  	hp = gethostbyname(host);
  	if (hp == NULL)
! 		return;
  
  	if (strlen(hp->h_name) >= hbsize)
! 		return;
  
  	(void) strcpy(host, hp->h_name);
  }
  
  #endif /* !NAMED_BIND */
--- 516,529 ----
  
  	hp = gethostbyname(host);
  	if (hp == NULL)
! 		return FALSE;
  
  	if (strlen(hp->h_name) >= hbsize)
! 		return FALSE;
  
  	(void) strcpy(host, hp->h_name);
+ 
+ 	return TRUE;
  }
  
  #endif /* !NAMED_BIND */