ANNOUNCE: openssh-1.2.1pre20

Damien Miller djm at mindrot.org
Mon Dec 27 11:55:52 EST 1999


On Sun, 26 Dec 1999, Andre Lucas wrote:

> I don't think you were! pututxline() uses the ut_id field as a key
> into the utmpx file, so if it's not set I don't see how the system
> can know where to put the entry. Maybe some OSs look at the ut_line
> entry. With the current code, HPUX puts all the pty entries in the
> same place...

Ok, I am now copying the last couple of characters of the tty path.
This is what Linux's /bin/login does.

Index: login.c
===================================================================
RCS file: /var/cvs/openssh/login.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- login.c	1999/12/25 23:21:48	1.12
+++ login.c	1999/12/27 00:33:56	1.13
@@ -141,6 +141,7 @@
 	/* Construct an utmp/wtmp entry. */
 	memset(&u, 0, sizeof(u));
 	strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line));
+	strncpy(u.ut_id, ttyname + 8, sizeof(u.ut_id));
 	u.ut_pid = (pid_t)pid;
 	u.ut_time = time(NULL);
 	strncpy(u.ut_name, user, sizeof(u.ut_name));
@@ -153,6 +154,7 @@
 	memset(&utx, 0, sizeof(utx));
 	strncpy(utx.ut_user, user, sizeof(utx.ut_name));
 	strncpy(utx.ut_line, ttyname + 5, sizeof(utx.ut_line));
+	strncpy(utx.ut_id, ttyname + 8, sizeof(utx.ut_id));
 	utx.ut_pid = (pid_t)pid;
 	utx.ut_tv.tv_sec = time(NULL);
  	utx.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;


Regards,
Damien

--
| "Bombay is 250ms from New York in the new world order" - Alan Cox
| Damien Miller - http://www.mindrot.org/
| Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)








More information about the openssh-unix-dev mailing list