[comp.mail.sendmail] $x macro in sendmail.cf

rasmus@dmntor.on.ca (Rasmus Lerdorf) (07/20/90)

The $x macro should contain the full name of the originating user.  I recently
installed smail2.5 and made some changes.  Now, the $x macro always contains
my name (Rasmus Lerdorf) no matter who is sending the mail.  It seems odd to
me.  The manual says that the $x macro is found by checking the Full Name:
header line if one exists (it doesn't), checking the full name flag passed
to sendmail (I doubt I am always sending it my own name) or by checking
the /etc/passwd file (I know that we don't have 30 users with my name there!)
I checked the sendmail.cf file, and the part that puts the full name in the
From: header line has not changed from before the smail installation.  It
gets the user id right, ie.
	From: mike (Rasmus Lerdorf)

Any suggestions on where to look to remedy this?
-- 
Rasmus Lerdorf | geac!dmntor!rasmus  (Work) | '94 WC prediction
UW SD Eng. '93 | geac!contact!rasmus (Home) | Denmark will take the Cup!

seeger@bikini.cis.ufl.edu (F. L. Charles Seeger III) (07/22/90)

Sorry for sending this to the group, but name resolution of "dmntor.on.ca"
failed from here (perhaps due to recent troubles with SuraNet connectivity,
as I have every confidence that it is properly registered and served 8-) ).
Anyway, since this is short I won't bother with trying the evil bang-path.
Someone else may have a better solution, too.

In article <1990Jul20.142925.25885@dmntor.on.ca> rasmus@dmntor.on.ca (Rasmus Lerdorf) writes:
| The $x macro should contain the full name of the originating user.  I recently
| installed smail2.5 and made some changes.  Now, the $x macro always contains
| my name (Rasmus Lerdorf) no matter who is sending the mail.  ...
| Any suggestions on where to look to remedy this?

This happened to me about a year ago.  When I started a sendmail daemon by
hand while su'ed to root, the daemon would read my NAME environment variable
and use that on any mail that it forwarded.  Included below is a fix that
I wrote (and posted).  If the same thing is happening to you, this might
help.  Anyway, my problem arose when I configured a central mail server
(with exported /var/spool/mail) to accept mail from clients (which didn't
run sendmail daemons), to rewrite the host name so that mail appeared to come
from the domain, and then to forward it on.  It seemed strange that the
forwarding daemon would rewrite the senders full name to mine.  This quick
hack didn't really fix that problem directly, but did prevent it from ever
happening by preventing sendmail from reading the NAME environment variable
when started in daemon mode.

Let me (us?) know what fixes your problem.

Regards,
Chuck
--
  Charles Seeger    E301 CSE Building             Office: +1 904 392 1508
  CIS Department    University of Florida         Fax:    +1 904 392 1220
  seeger@ufl.edu    Gainesville, FL 32611-2024    Home:   +1 904 375 1819
----

*** sendmail-5.61/src/main.c	Wed Jan 25 00:43:21 1989
--- sendmail-5.61ufiec/src/main.c	Wed Aug 23 18:38:15 1989
***************
*** 112,119 ****
  	bool readconfig = TRUE;
  	bool queuemode = FALSE;		/* process queue requests */
  	bool nothaw;
  	static bool reenter = FALSE;
! 	char jbuf[30];			/* holds MyHostName */
  	extern bool safefile();
  	extern time_t convtime();
  	extern putheader(), putbody();
--- 112,120 ----
  	bool readconfig = TRUE;
  	bool queuemode = FALSE;		/* process queue requests */
  	bool nothaw;
+ 	bool daemonmode = FALSE;
  	static bool reenter = FALSE;
! 	char jbuf[64];			/* holds MyHostName */
  	extern bool safefile();
  	extern time_t convtime();
  	extern putheader(), putbody();
***************
*** 190,195 ****
--- 191,198 ----
  		}
  		else if (strncmp(p, "-bz", 3) == 0)
  			nothaw = TRUE;
+ 		else if (strncmp(p, "-bd", 3) == 0)
+ 			daemonmode = TRUE;
  		else if (strncmp(p, "-d", 2) == 0)
  		{
  			tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
***************
*** 234,240 ****
  	OldUmask = umask(0);
  	OpMode = MD_DELIVER;
  	MotherPid = getpid();
! 	FullName = getenv("NAME");
  
  #ifdef LOG_MAIL
  	openlog("sendmail", LOG_PID, LOG_MAIL);
--- 237,246 ----
  	OldUmask = umask(0);
  	OpMode = MD_DELIVER;
  	MotherPid = getpid();
! 	if (daemonmode)
! 		FullName = NULL;
! 	else
! 		FullName = getenv("NAME");
  
  #ifdef LOG_MAIL
  	openlog("sendmail", LOG_PID, LOG_MAIL);

----
P.S. If it fits your style better, feel free to substitute 
	FullName = (daemonmode) ? NULL : getenv("NAME");
for the if-else construct.  I probably will when I eventually move to 5.64.
At least it doesn't gratuitously mess up the line numbers as much in diffs.
--
  Charles Seeger    E301 CSE Building             Office: +1 904 392 1508
  CIS Department    University of Florida         Fax:    +1 904 392 1220
  seeger@ufl.edu    Gainesville, FL 32611-2024    Home:   +1 904 375 1819