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 a

⟦362aa5f48⟧ TextFile

    Length: 30463 (0x76ff)
    Types: TextFile
    Names: »apollo+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/apollo+uk.src.patches« 

TextFile

*** /tmp/,RCSt1a05356	Thu Dec 20 23:57:57 1990
--- collect.c	Thu Dec 20 23:55:28 1990
***************
*** 236,243 ****
--- 236,250 ----
  			    "collect: unexpected close on connection from %s: %m\n",
  			    CurEnv->e_from.q_paddr, RealHostName);
  # endif /* LOG */
+ #ifdef CANT_SELECT_FUNCS
+ 		if (feof(InChannel))
+ 			usrerr ("collect: unexpected close, from=%s", CurEnv->e_from.q_paddr);
+ 		else
+ 			syserr ("collect: unexpected close, from=%s", CurEnv->e_from.q_paddr);
+ #else
  		(feof(InChannel) ? usrerr: syserr)
  			("collect: unexpected close, from=%s", CurEnv->e_from.q_paddr);
+ #endif /* CANT_SELECT_FUNCS */
  
  		/* don't return an error indication */
  		CurEnv->e_to = NULL;
*** /tmp/,RCSt1a05356	Thu Dec 20 23:58:09 1990
--- conf.h	Thu Dec 20 23:55:36 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 */
***************
*** 65,71 ****
  # define UGLYUUCP	1	/* output ugly UUCP From lines */
  # define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
  /*# define MAIL11V3	1	/* enable non-standard SMTP mods for DECnet */
! # define SETPROCTITLE	1	/* munge argv to display current status */
  # define NAMED_BIND	1	/* use Berkeley Internet Domain Server */
  # define SIG_TYPE	int	/* SUN's signal() returns void type */
  # define VSPRINTF	1	/* have vsprintf() in /lib/libc.a */
--- 65,73 ----
  # define UGLYUUCP	1	/* output ugly UUCP From lines */
  # define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
  /*# define MAIL11V3	1	/* enable non-standard SMTP mods for DECnet */
! # ifndef apollo		/* jf 12/90 - this action always crashes apollos */
! #   define SETPROCTITLE	1	/* munge argv to display current status */
! # endif
  # define NAMED_BIND	1	/* use Berkeley Internet Domain Server */
  # define SIG_TYPE	int	/* SUN's signal() returns void type */
  # define VSPRINTF	1	/* have vsprintf() in /lib/libc.a */
***************
*** 87,93 ****
  ** file.  Older systems used /usr/lib/sendmail.cf, some newer systems move
  ** this file to /etc/sendmail.cf.
  */
! # define	_PATH_SENDMAILCF	"/etc/sendmail.cf"
  
  /*
  ** Comment out the following line if freeze files don't work on your platform.
--- 89,95 ----
  ** file.  Older systems used /usr/lib/sendmail.cf, some newer systems move
  ** this file to /etc/sendmail.cf.
  */
! #define	_PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
  
  /*
  ** Comment out the following line if freeze files don't work on your platform.
***************
*** 94,105 ****
  ** Freeze files will not work on the Next, nor under AIX 3.1 unless both
  ** 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 */
  
  /*
  ** Comment out this line if you don't want sendmail to write a file with
  ** the daemon's pid.
  */
! # define	_PATH_SENDMAILPID   	"/etc/sendmail.pid"
--- 96,264 ----
  ** Freeze files will not work on the Next, nor under AIX 3.1 unless both
  ** malloc.c and getpwent.c are compiled with the sendmail source.
  */
! #if !defined(NeXT) && !defined(_AIX)
! /* # define	_PATH_SENDMAILFC	"/etc/sendmail.fc" */
! #endif /* !NeXT && !_AIX */
  
  /*
  ** Comment out this line if you don't want sendmail to write a file with
  ** the daemon's pid.
  */
! /* #define	_PATH_SENDMAILPID   	"/etc/sendmail.pid" */
! 
! /* The following two definitions added from older implementations -
!    particularly for HP Apollo 10.1 - John.Forrest@umist.ac.uk 12/90 */
! 	/* There are problems on HP Apollo's when updating database files.
! 	   Essentially, one node will lock out the others if they are opened
! 	   RW. By default this distribution gets around this by stopping
! 	   Apollo's from auto-updating. This is not always convenient. An
! 	   alternative, which some users may prefer, would be to give every
! 	   machine a unique directory - `node_data/sendmail for instance -
! 	   and make /usr/lib/mail or whatever symbolic links there. The
! 	   responsibility for this falls onto the system manager - otherwise
! 	   sendmail will give lots of messages about being unable to open
! 	   files. If you want this feature, uncomment the next define. This
! 	   has no affect on non-Apollo machines. */
! #define APOLLO_CAN_UPDATE 1
! 
! 	/* 
! 	 * A problem has arrisen on Apollo OS/10.1, where sendmail
! 	 * is sometimes unable to exec mailers with EBADF errno.
! 	 * This would appear to be related to closing files by
! 	 * setting their "close on exec" flag, just before the
! 	 * exec itself. To get around this, defining 
! 	 * EXPLICIT_CLOSE_ON_EXEC forces explicit calls to close
! 	 * instead. The effect should be identical - it is difficult
! 	 * to see why close was not used to start with.
! 	 */
! #define EXPLICIT_CLOSE_ON_EXEC 1
! 
! 	/* Some compilers cannot cope with:
! 		(conf ? func1 : func2) (args);
! 	   These include the OS10.1 Apollo compilers. To get around
! 	   this problem, define CANT_SELECT_FUNCS. jf 12/90, after earlier fix. */
! #define CANT_SELECT_FUNCS 1
! 
! 	/*
! 	 * There is a bug in doprnt in some machines, including
! 	 * Apollo 10.1, where %.*s has problems. The bug manifests
! 	 * itself an extra blank line being added to each set of 
! 	 * blank lines in the original. To overcome this, we use
! 	 * an older version of putline in util.c - if DOPRNT_FIX
! 	 * is defined.
! 	 */
! #define DOPRNT_FIX 1
! 
! /* 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 */
! 
! /* end of jf domain.c changes */
! 
! 	/*
! 	 * 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 */
*** /tmp/,RCSt1a05356	Thu Dec 20 23:58:33 1990
--- deliver.c	Thu Dec 20 23:56:00 1990
***************
*** 1027,1035 ****
  #else
                  for (i = getdtablesize(); i > 2; --i) {
  #endif /* XPG3 */
! 			register int j;
! 			if ((j = fcntl(i, F_GETFD, 0)) != -1)
! 				(void)fcntl(i, F_SETFD, j|1);
  		}
  
  		/* try to execute the mailer */
--- 1027,1041 ----
  #else
                  for (i = getdtablesize(); i > 2; --i) {
  #endif /* XPG3 */
! #ifdef EXPLICIT_CLOSE_ON_EXEC
!                        if (close(i) < 0)
!                                if (errno != EBADF)
!                                       syserr("Can't close fd %d\n", i);
! #else
!                         register int j;
!                         if ((j = fcntl(i, F_GETFD, 0)) != -1)
!                                 (void)fcntl(i, F_SETFD, j|1);
! #endif
  		}
  
  		/* try to execute the mailer */
*** /tmp/,RCSt1a05356	Thu Dec 20 23:58:39 1990
--- domain.c	Thu Dec 20 23:56:05 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 */
*** /tmp/,RCSt1a05356	Thu Dec 20 23:59:35 1990
--- readcf.c	Thu Dec 20 23:56:47 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')
  			{
***************
*** 784,790 ****
  
  	  case 'D':		/* rebuild alias database as needed */
  		AutoRebuild = atobool(val);
! #if defined(apollo)
  		/*
  		 * Apollo cannot handle multiple processes (perhaps on
  		 * separate nodes) opening the alias database read-write.
--- 790,798 ----
  
  	  case 'D':		/* rebuild alias database as needed */
  		AutoRebuild = atobool(val);
! #if defined(apollo) && !defined(APOLLO_CAN_UPDATE)
! 	/* jf 12/90 - see note in conf.h about alternative solution
! 	   to this problem. */
  		/*
  		 * Apollo cannot handle multiple processes (perhaps on
  		 * separate nodes) opening the alias database read-write.
*** /tmp/,RCSt1a05356	Fri Dec 21 00:00:23 1990
--- util.c	Thu Dec 20 23:57:18 1990
***************
*** 504,509 ****
--- 504,513 ----
  
  #define SMTPLINELIM	990	/* maximum line length */
  
+ #if defined(DOPRNT_FIX)
+ 	 /* this is the putline from Berkeley 5.65, which seems */
+ 	 /* more reliable that the original IDA 5.65 version below */
+ 
  putline(l, fp, m)
  	register char *l;
  	FILE *fp;
***************
*** 511,516 ****
--- 515,575 ----
  {
  	register char *p;
  	char svchar;
+ 
+ 	/* strip out 0200 bits -- these can look like TELNET protocol */
+ 	if (bitnset(M_LIMITS, m->m_flags))
+ 	{
+ 		p = l;
+ 		while ((*p++ &= ~0200) != 0)
+ 			continue;
+ 	}
+ 
+ 	do
+ 	{
+ 		/* find the end of the line */
+ 		p = index(l, '\n');
+ 		if (p == NULL)
+ 			p = &l[strlen(l)];
+ 
+ 		/* check for line overflow */
+ 		while ((p - l) > SMTPLINELIM && bitnset(M_LIMITS, m->m_flags))
+ 		{
+ 			register char *q = &l[SMTPLINELIM - 1];
+ 
+ 			svchar = *q;
+ 			*q = '\0';
+ 			if (l[0] == '.' && bitnset(M_XDOT, m->m_flags))
+ 				(void) putc('.', fp);
+ 			fputs(l, fp);
+ 			(void) putc('!', fp);
+ 			fputs(m->m_eol, fp);
+ 			*q = svchar;
+ 			l = q;
+ 		}
+ 
+ 		/* output last part */
+ 		svchar = *p;
+ 		*p = '\0';
+ 		if (l[0] == '.' && bitnset(M_XDOT, m->m_flags))
+ 			(void) putc('.', fp);
+ 		fputs(l, fp);
+ 		fputs(m->m_eol, fp);
+ 		*p = svchar;
+ 		l = p;
+ 		if (*l == '\n')
+ 			l++;
+ 	} while (l[0] != '\0');
+ }
+ 
+ #else /* DOPRNT_FIX */
+ 
+ putline(l, fp, m)
+ 	register char *l;
+ 	FILE *fp;
+ 	MAILER *m;
+ {
+ 	register char *p;
+ 	char svchar;
  	int	limitsflag,	xdotflag;
  
  	limitsflag = bitnset(M_LIMITS, m->m_flags);
***************
*** 548,553 ****
--- 607,614 ----
  			l++;
  	} while (*l != '\0');
  }
+ 
+ #endif /* DOPRNT_FIX */
  \f

/*
  **  XUNLINK -- unlink a file, doing logging as appropriate.
  **