Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!seismo!hao!hplabs!sri-unix!dbj.rice@rand-relay From: dbj.rice%rand-relay@sri-unix.UUCP Newsgroups: net.unix-wizards Subject: Re: watch out when you modify /etc/ttys !! Message-ID: <2079@sri-arpa.UUCP> Date: Sun, 12-Jun-83 19:44:50 EDT Article-I.D.: sri-arpa.2079 Posted: Sun Jun 12 19:44:50 1983 Date-Received: Thu, 16-Jun-83 01:52:57 EDT Lines: 20 From: Dave JohnsonUCB Mail does a getlogin() to decide who to say the message is "From:", and if this returns a NULL, it instead tries a getpwuid(getuid()). Getlogin uses ttyslot() to find the "slot" number of this tty in /etc/ttys, and then uses this number also as the slot number in /etc/utmp (init maintains /etc/utmp in order of tty "slot" number as returned by ttyslot()). Thus, if you change /etc/ttys, you change what value is returned by ttyslot(), and thus, getlogin() starts looking at a different entry in /etc/utmp than was used to record when this person logged on to this terminal. Presumably, Mail thought it was faster to read through /etc/ttys than to read all of /etc/passwd to translate the uid... It should be "safe" to add new entries to the bottom of /etc/ttys. To "delete" lines from /etc/ttys, you can just put a "0" as the first character on the line and everybody will ignore that line. Dave Johnson Dept. of Math Science Rice University