[comp.mail.sendmail] Bug in IDA sendmail when using 'p'

per@erix.ericsson.se (Per Hedeland) (04/04/89)

Version: sendmail 5.61 + IDA 1.2.8

When using the 'p' flag for the UUCP mailer in order to get the value of $k
(uucp name) prepended to the envelope sender address, this won't be done if $k
happens to be an initial substring of the existing sender address, e.g. if your
uucp name is 'erix' and the sender address is 'erix-u.ericsson.se!user'. (BTW
this very same bug was once present in the news software, fixed back at 2.10.2
or somesuch, I believe...:-)

--Per Hedeland
per@erix.ericsson.se   or  ...{uunet,mcvax}!erix.ericsson.se!per

Fix:

*** /usr/src/usr.lib/sendmail.5.61.ida/src/deliver.c.orig	Thu Jan 26 16:50:57 1989
--- /usr/src/usr.lib/sendmail.5.61.ida/src/deliver.c	Tue Apr  4 12:07:58 1989
***************
*** 1166,1174 ****
  	/* construct path through us if needed */
  	if (bitnset(M_FROMPATH, m->m_flags)) {
  		char myname[MAXLINE];
  
  		expand("\001k", myname, &myname[sizeof myname - 1], CurEnv);
! 		if (index(oldg, '!') == NULL
  		    || strncmp(oldg, myname, strlen(myname)) != 0) {
  			sprintf(newg, "%s!%s", myname, oldg);
  			define('g', newg, CurEnv);
--- 1166,1176 ----
  	/* construct path through us if needed */
  	if (bitnset(M_FROMPATH, m->m_flags)) {
  		char myname[MAXLINE];
+ 		char *bang;
  
  		expand("\001k", myname, &myname[sizeof myname - 1], CurEnv);
! 		if ((bang = index(oldg, '!')) == NULL
! 		    || strlen(myname) != bang - oldg
  		    || strncmp(oldg, myname, strlen(myname)) != 0) {
  			sprintf(newg, "%s!%s", myname, oldg);
  			define('g', newg, CurEnv);