ANNOUNCE: openssh-1.2.1pre20

Ben Taylor bent at clark.net
Sat Dec 25 13:48:55 EST 1999


Here are my patches against pre20 which make utmpx support
work correctly for Solaris.

Fixes:

login.c: fix typo, add code, clean ups for utmpx
bsd-login.c: cleanup case with old_ut is only used when
   HAVE_HOST_IN_UTMP is used, as well as move defines
   used in only that case
config.h.in: fix for utmpx

Ben
-------------- next part --------------
--- Makefile.in.ORIG	Fri Dec 24 21:23:54 1999
+++ Makefile.in	Fri Dec 24 21:24:26 1999
@@ -48,6 +48,8 @@
 	$(AR) rv $@ $(LIBOBJS)
 	$(RANLIB) $@
 
+$(OBJS):	config.h
+
 ssh: ssh.o sshconnect.o log-client.o readconf.o clientloop.o libssh.a
 	$(CC) -o $@ ssh.o sshconnect.o log-client.o readconf.o \
 		clientloop.o $(LDFLAGS) -lssh $(LIBS)
--- bsd-login.c.ORIG	Fri Dec 24 21:20:53 1999
+++ bsd-login.c	Fri Dec 24 21:38:38 1999
@@ -65,13 +65,19 @@
 	struct utmp *utp;
 #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */
 {
+#if defined(HAVE_HOST_IN_UTMP)
 	struct utmp old_ut;
+#endif
 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
 	struct utmpx *old_utx;
 #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */
 	register int fd;
 	int tty;
 
+	tty = ttyslot();
+	if (tty > 0 && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) >= 0) {
+#if defined(HAVE_HOST_IN_UTMP)
+
 #ifndef UT_LINESIZE
 # define UT_LINESIZE (sizeof(old_ut.ut_line))
 # define UT_NAMESIZE (sizeof(old_ut.ut_name))
@@ -79,10 +85,6 @@
 #  define UT_HOSTSIZE (sizeof(old_ut.ut_host))
 # endif
 #endif
-
-	tty = ttyslot();
-	if (tty > 0 && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) >= 0) {
-#if defined(HAVE_HOST_IN_UTMP)
 		(void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
 		/*
 		 * Prevent luser from zero'ing out ut_host.
--- config.h.in.ORIG	Fri Dec 24 21:05:57 1999
+++ config.h.in	Fri Dec 24 21:10:06 1999
@@ -349,6 +349,23 @@
 # endif
 #endif
 
+#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
+# ifndef _PATH_UTMPX
+#  ifdef UTMPX_FILE
+#   define _PATH_UTMPX UTMPX_FILE
+#  else
+#   define _PATH_UTMPX "/var/adm/utmpx"
+#  endif
+# endif
+# ifndef _PATH_WTMPX
+#  ifdef WTMPX_FILE
+#   define _PATH_WTMPX WTMPX_FILE
+#  else
+#   define _PATH_WTMPX "/var/adm/wtmp"
+#  endif
+# endif
+#endif
+
 #ifndef _PATH_BSHELL
 # define _PATH_BSHELL "/bin/sh"
 #endif
--- login.c.ORIG	Fri Dec 24 21:15:34 1999
+++ login.c	Fri Dec 24 21:20:04 1999
@@ -152,10 +152,11 @@
 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
 	memset(&utx, 0, sizeof(utx));
 	strncpy(utx.ut_user, user, sizeof(utx.ut_name));
+	strcpy(utx.ut_id, "sshd");
 	strncpy(utx.ut_line, ttyname + 5, sizeof(utx.ut_line));
 	utx.ut_pid = (pid_t)pid;
 	utx.ut_tv.tv_sec = time(NULL);
- 	u.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
+ 	utx.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
 #ifdef HAVE_HOST_IN_UTMPX
 #ifdef HAVE_SYSLEN_IN_UTMPX
 	utx.ut_syslen = strlen(host);
@@ -166,7 +167,8 @@
 #endif
 #endif /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */
 
-#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) && !defined(HAVE_LOGIN)
+/*#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) && !defined(HAVE_LOGIN)*/
+#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
 	login(&u, &utx);
 #else /* defined(HAVE_UTMPX_H) && defined(USE_UTMPX) */
 	login(&u);


More information about the openssh-unix-dev mailing list