[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2218: sendmail package parseaddr.c changes break my sendmail.cf



Package: sendmail
Version: 8.6.12-9 (and -8 as shipped in 0.93r6)

My sendmail.mc uses nodns, uucp, and smtp, and this leads to the
following section of ruleset zero:
# pass names that still have a host to a smarthost (if defined)
R$* < @ $* > $*         $: $>95 < $S > $1 < @ $2 > $3   glue on smarthost name
# deal with other remote names
R$* < @$* > $*          $#smtp $@ $2 $: $1 < @ $2 > $3         user@host.domain

$S is set to uucp-dom:tweedledumb.

With a scratch-build sendmail 8.6.12, this works fine; with the debian
one, it blows up. If I back out the patch to parseaddr.c that is
listed in the -diffs file for -9, my configuration works properly.

The failing case is as follows:
rewrite: ruleset 95   input: < uucp-dom : tweedledumb > eichin < @ cygnus . com >
rewrite: ruleset 95 returns: $# uucp-dom $@ tweedledumb $: eichin < @ cygnus . com >
rewrite: ruleset  0 returns: $# smtp $@ cygnus . com $: $# uucp-dom $@ tweedledumb $: eichin < @ cygnus . com >

With a working sendmail, the 3rd line rewrite (corresponding to the
"deal with other remote host names" above) doesn't happen.

I'd recommend simply reverting that particular patch (which I've
included below) though it is possible that it can be fixed, there are
no comments in the debian.README justifying the change... I haven't
looked at 8.7 to see if it handles this differently.

Oh, and to be more specific about the failure -- the extra rewrite
above causes sendmail to actually try to connect via smtp to the host
mentioned (which it shouldn't be doing, and often won't work, as it
should be using the uucp queue for it.)

					_Mark_ <eichin@cygnus.com>
					Cygnus Support, Eastern USA

diff -cNr sendmail-8.6.12.orig/src/parseaddr.c sendmail-8.6.12/src/parseaddr.c
*** sendmail-8.6.12.orig/src/parseaddr.c	Sat Nov 25 18:23:35 1995
--- sendmail-8.6.12/src/parseaddr.c	Sat Sep 23 18:42:24 1995
***************
*** 38,43 ****
--- 38,45 ----

  # include "sendmail.h"

+ static int callsubr __P((char **, int, ENVELOPE *));
+
  /*
  **  PARSEADDR -- Parse an address
  **
***************
*** 1168,1203 ****

  		/*
  		**  Check for subroutine calls.
  		*/

! 		if (*npvp != NULL && (**npvp & 0377) == CALLSUBR)
! 		{
! 			int stat;

! 			if (npvp[1] == NULL)
! 			{
! 				syserr("parseaddr: NULL subroutine call in ruleset %d, rule %d",
! 					ruleset, ruleno);
! 				*pvp = NULL;
! 			}
! 			else
! 			{
! 				bcopy((char *) &npvp[2], (char *) pvp,
! 					(int) (avp - npvp - 2) * sizeof *avp);
! 				if (tTd(21, 3))
! 					printf("-----callsubr %s\n", npvp[1]);
! 				stat = rewrite(pvp, atoi(npvp[1]), reclevel, e);
! 				if (rstat == EX_OK || stat == EX_TEMPFAIL)
! 					rstat = stat;
! 				if (*pvp != NULL && (**pvp & 0377) == CANONNET)
! 				rwr = NULL;
! 			}
! 		}
! 		else
! 		{
! 			bcopy((char *) npvp, (char *) pvp,
! 				(int) (avp - npvp) * sizeof *avp);
! 		}
  		if (tTd(21, 4))
  		{
  			printf("rewritten as:");
--- 1170,1183 ----

  		/*
  		**  Check for subroutine calls.
+ 		**  Then copy vector back into original space.
  		*/

! 		rstat = callsubr(npvp, reclevel, e);

! 		for (avp = npvp; *avp++ != NULL;);
! 		bcopy((char *) npvp, (char *) pvp,
! 			(int) (avp - npvp) * sizeof *avp);
  		if (tTd(21, 4))
  		{
  			printf("rewritten as:");
***************
*** 1213,1218 ****
--- 1193,1254 ----

  	return rstat;
  }
+ /*
+ **  CALLSUBR -- call subroutines in rewrite vector
+ **
+ **
+ **	Parameters:
+ **		pvp -- pointer to token vector.
+ **
+ **	Returns:
+ **		none.
+ **
+ **	Side Effects:
+ **		pvp is modified.
+ */
+
+ static int
+ callsubr(pvp, reclevel, e)
+ 	char **pvp;
+ 	int reclevel;
+ 	ENVELOPE *e;
+ {
+ 	char **rvp;
+ 	int subr;
+ 	int stat = EX_OK;
+
+ 	for (; *pvp != NULL; pvp++)
+ 		if ((**pvp & 0377) == CALLSUBR && pvp[1] != NULL && isdigit(pvp[1][0]))
+ 		{
+ 			subr = atoi(pvp[1]);
+
+ 			if (tTd(21, 3))
+ 				printf("-----callsubr %d\n", subr);
+
+ 			/*
+ 			**  Take care of possible inner calls.
+ 			*/
+ 			if ((stat = callsubr(pvp+2, reclevel, e)) != EX_OK)
+ 				return stat;
+
+ 			/*
+ 			**  Move vector up over calling opcode.
+ 			*/
+ 			for (rvp = pvp+2; *rvp != NULL; rvp++)
+ 				rvp[-2] = rvp[0];
+ 			rvp[-2] = NULL;
+
+ 			/*
+ 			**  Call inferior ruleset.
+ 			*/
+ 			if ((stat = rewrite(pvp, subr, reclevel, e)) != EX_OK)
+ 				return stat;
+
+ 			break;
+ 		}
+ 	return stat;
+ }
+
  /*
  **  BUILDADDR -- build address from token vector.
  **


Reply to: