Please test this snapshot

Tom Bertelson tbert at abac.com
Fri Jun 30 04:17:54 EST 2000


Damien Miller wrote:
> 
> On Wed, 28 Jun 2000, Rip Loomis wrote:
> 
> > Hey Damien--would it be reasonable to release a
> > 2.1.1p2 sometime soon to stop this FAQ?
> 
> Yes, it has been a lack of time which has prevented me so far.
> 
> It would be great if I could get some feedback on how
> http://www.mindrot.org/misc/junk/openssh-SNAP-20000629.tar.gz
> works on Solaris, Irix 6.x, HPUX, AIX, Tru64 and SCO.

Sorry, but there's problems with AIX.

Some old thing - utmp entries.  This fixes a buffer underrun, a reversed
test, and the assumption size_t == int. I suspect any architecture that
uses pututline(3) and doesn't have utmpx may have the same problems.

To test for this:
host1$ ssh host2
host2$ tty # note the number
host2$ who # you should be there
host2$ ssh localhost
host2$ tty # a different number
host2$ who # Oops!  First entry replaced with this new one
host2$ exit
host2$ tty # still there
host2$ who # Oops!  First entry gone

I'm looking at logintest.c and trying to figure out a good test for this
without trashing utmp (too much), but no luck so far.

Also, I noticed incomplete support for HAVE_ID_IN_UTMPX. I've tested
this with Solaris, and it seems to work fine with or without this patch.
-- 
Tom Bertelson           "Any sufficiently advanced technology
RHI Consulting           is indistinguishable from magic."
tbert at abac.com             -- Arthur C. Clarke
-------------- next part --------------
--- configure.in.orig	Thu Jun 29 13:18:02 2000
+++ configure.in	Thu Jun 29 13:18:12 2000
@@ -636,6 +636,7 @@
 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_id, utmpx.h, HAVE_ID_IN_UTMPX)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
--- config.h.in.orig	Thu Jun 29 13:48:26 2000
+++ config.h.in	Thu Jun 29 13:48:31 2000
@@ -53,6 +53,7 @@
 #undef HAVE_TV_IN_UTMP
 #undef HAVE_TV_IN_UTMPX
 #undef HAVE_ID_IN_UTMP
+#undef HAVE_ID_IN_UTMPX
 #undef HAVE_EXIT_IN_UTMP
 #undef HAVE_TIME_IN_UTMP
 #undef HAVE_TIME_IN_UTMPX
--- loginrec.c.orig	Thu Jun 29 13:13:12 2000
+++ loginrec.c	Thu Jun 29 14:01:50 2000
@@ -535,11 +535,13 @@
 	
 	memset(dst, '\0', dstsize);
 	
+	if (strncmp(src, "/dev/", 5) == 0)
+		src += 5;
 	len = strlen(src);
 
-	if (len <= 0) {
-		src += (len - dstsize);
-		strncpy(dst, src, dstsize); /* note: _don't_ change this to strlcpy */
+	if (len > 0) {
+		src += (int) len - dstsize > 0 ? (int) len - dstsize : 0;
+		strncpy(dst, src, (size_t) dstsize); /* note: _don't_ change this to strlcpy */
 	}
 	
 	return dst;
@@ -647,7 +649,9 @@
 construct_utmpx(struct logininfo *li, struct utmpx *utx)
 {
 	memset(utx, '\0', sizeof(struct utmpx));
+# ifdef HAVE_ID_IN_UTMPX
 	line_abbrevname(utx->ut_id, li->line, sizeof(utx->ut_id));
+# endif
 
 	/* this is done here to keep utmp constants out of loginrec.h */
 	switch (li->type) {
--- configure.orig	Thu Jun 29 13:20:40 2000
+++ configure	Thu Jun 29 13:20:09 2000
@@ -3827,6 +3827,46 @@
 	fi
 
 
+# look for field 'ut_id' in header 'utmpx.h'
+		ossh_safe=`echo "utmpx.h" | sed 'y%./+-%__p_%'`
+		ossh_varname="ossh_cv_$ossh_safe""_has_"ut_id
+	echo $ac_n "checking for ut_id field in utmpx.h""... $ac_c" 1>&6
+echo "configure:3795: checking for ut_id field in utmpx.h" >&5
+	if eval "test \"`echo '$''{'$ossh_varname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+		cat > conftest.$ac_ext <<EOF
+#line 3801 "configure"
+#include "confdefs.h"
+#include <utmpx.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "ut_id" >/dev/null 2>&1; then
+  rm -rf conftest*
+   			eval "$ossh_varname=yes" 		
+else
+  rm -rf conftest*
+   			eval "$ossh_varname=no" 		
+fi
+rm -f conftest*
+ 	
+fi
+
+	ossh_result=`eval 'echo $'"$ossh_varname"`
+	if test -n "`echo $ossh_varname`"; then
+		echo "$ac_t""$ossh_result" 1>&6
+		if test "x$ossh_result" = "xyes"; then
+			cat >> confdefs.h <<\EOF
+#define HAVE_ID_IN_UTMPX 1
+EOF
+
+		fi
+	else
+		echo "$ac_t""no" 1>&6
+	fi
+
+
 # look for field 'ut_addr' in header 'utmp.h'
 		ossh_safe=`echo "utmp.h" | sed 'y%./+-%__p_%'`
 		ossh_varname="ossh_cv_$ossh_safe""_has_"ut_addr


More information about the openssh-unix-dev mailing list