[net.bugs.4bsd] 4.2 sendmail: can't define more than one macro from command line

bukys@rochester.UUCP (Liudvikas Bukys) (06/08/84)

Index:	usr.lib/sendmail/src/readcf.c 4.2 Fix

Description:
	Options specified on the command line are considered "sticky":
	they can't be overridden by later definitions on the command line
	or in the configuration file.  (This is fine.)

	Unfortunately, defining a macro on the command line sets the sticky
	flag for 'M' (macros), so subsequent macro definitions on the command
	line have no effect.  (This is not so good.)

	This is a pretty low-priority bug, since there's little reason for
	people to want to define more than one macro from the command line.
	But it would be nice if the bug disappeared from the "distribution".

Repeat-By:
	Stick a "$Z" someplace innocuous in sendmail.cf, like in a comment
	in the "Received:" line header.  Mail something to yourself with
		/usr/lib/sendmail -oMYTESTING -oMZ123 yourself < /etc/group
	See what the $Z expanded into; probably nothing; should be "123".

Fix:
	Move the "set the sticky bit" code past the switch statement.
	Have the 'M' case turn off the "please make this sticky" flag.

diff -c:

-------------------------------------------------------------------------------

*** /tmp/,RCSt1009151	Fri Jun  8 09:56:25 1984
--- readcf.c	Fri Jun  8 09:55:49 1984
***************
*** 621,628
  	else if (tTd(37, 1))
  		printf("\n");
  #endif DEBUG
- 	if (sticky)
- 		setbitn(opt, StickyOpt);
  
  	if (getruid() == 0)
  		safe = TRUE;

--- 621,626 -----
  	else if (tTd(37, 1))
  		printf("\n");
  #endif DEBUG
  
  	if (getruid() == 0)
  		safe = TRUE;
***************
*** 718,723
  
  	  case 'M':		/* define macro */
  		define(val[0], newstr(&val[1]), CurEnv);
  		break;
  
  	  case 'm':		/* send to me too */

--- 716,722 -----
  
  	  case 'M':		/* define macro */
  		define(val[0], newstr(&val[1]), CurEnv);
+ 		sticky = FALSE;
  		break;
  
  	  case 'm':		/* send to me too */
***************
*** 795,800
  	  default:
  		break;
  	}
  	return;
  }
  ^L/*

--- 794,801 -----
  	  default:
  		break;
  	}
+ 	if (sticky)
+ 		setbitn(opt, StickyOpt);
  	return;
  }
  ^L/*

-------------------------------------------------------------------------------

Brought to you by:
	Liudvikas Bukys
	rochester!bukys (uucp) via allegra, decvax, seismo
	bukys@rochester (arpa)