Openssh-2.1.0p1 test release

Damien Miller djm at mindrot.org
Sat May 20 12:58:39 EST 2000


On Fri, 19 May 2000, Lars Hecking wrote:

>  Under Solaris 8, /var/tmp/utmp is gone, and only utmpx is
>  used. There is a utmp daemon to watch/update the latter. Actually,
>  a quick look into utmp(4) on Solaris 7 says the same thing, and
>  the utmp daemon is there as well, but I never noticed these syslog
>  messages before. The timestamp on the utmp file corresponds to the
>  time of my ssh login

Does this patch help?

Index: bsd-login.c
===================================================================
RCS file: /var/cvs/openssh/bsd-login.c,v
retrieving revision 1.11
diff -u -r1.11 bsd-login.c
--- bsd-login.c	2000/05/17 12:53:34	1.11
+++ bsd-login.c	2000/05/20 02:55:51
@@ -73,7 +73,7 @@
 	int t = 0;
 	struct utmp * u;
 
-#ifdef HAVE_TYPE_IN_UTMP
+#if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX)
 	setutent();
 
 	while((u = getutent()) != NULL) {
@@ -123,16 +123,26 @@
 	 */
 	tty = find_tty_slot(utp);
 
+#ifdef USE_UTMPX
+	fd = open(_PATH_UTMPX, O_RDWR|O_CREAT, 0644);
+	if (fd == -1) {
+		log("Couldn't open %s: %s", _PATH_UTMPX, strerror(errno));
+#else /* USE_UTMPX */
 	fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644);
 	if (fd == -1) {
 		log("Couldn't open %s: %s", _PATH_UTMP, strerror(errno));
+#endif /* USE_UTMPX */
 	} else {
 		/* If no tty was found... */
 		if (tty == -1) {
 			/* ... append it to utmp on login */
-#ifdef HAVE_TYPE_IN_UTMP
+#if defined(HAVE_TYPE_IN_UTMP) || defined(HAVE_TYPE_IN_UTMPX)
 			if (utp->ut_type == USER_PROCESS) {
+#ifdef USE_UTMPX
+				if ((fd = open(_PATH_UTMPX, O_WRONLY|O_APPEND, 0)) >= 0) {
+#else /* USE_UTMPX */
 				if ((fd = open(_PATH_UTMP, O_WRONLY|O_APPEND, 0)) >= 0) {
+#endif /* USE_UTMPX */
 					(void)write(fd, utp, sizeof(struct utmp));
 					(void)close(fd);
 				}
Index: configure.in
===================================================================
RCS file: /var/cvs/openssh/configure.in,v
retrieving revision 1.123
diff -u -r1.123 configure.in
--- configure.in	2000/05/17 13:29:18	1.123
+++ configure.in	2000/05/20 02:55:56
@@ -494,6 +494,7 @@
 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
+OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)


-- 
| "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