Subject: Re: ssh.com oddity
To: None <current-users@netbsd.org>
From: Tero Kivinen <kivinen@ssh.fi>
List: current-users
Date: 10/07/2002 05:48:32
dive-nb@endersgame.net (Sean Davis) writes:
> 2) has anyone else running ssh.com ssh 3.2.0's sshd2 on -current noticed
> that when a user logs in, it is not recorded in utmp/wtmp, and thus does not
> show up on w/who or related utilities? if so, any ideas on how to fix? (I am
> trying something I extrapolated from the patches to the 1.x version, but i
> don't have much confidence in it working.)

The configure detects that the netbsd now haves utmpx file and only
writes stuff to there. I do not know if it should write stuff to only
to utmp or only to utmpx or to both. The following patch will modify
it so that lib/sshsession/wtmp.c writes to both files, and that seems
to fix the not seeing users on netbsd 1.6 problem.

The code has another problem caused by the patch, as now the utmpx.h
defines the DEAD_PROCESS and the utmp code thinks that if that symbol
exists then the utmp will have ut_type field. I fixed it by adding
defined(HAVE_UT_TYPE_IN_UTMP) there which will never be defined (as
there is no matching test in configure.in), but in netbsd that is ok
and everything seems to work.

Here is a patch (I think it should be added to the security/ssh2
package too..):
----------------------------------------------------------------------
--- lib/sshsession/wtmp.c.orig      Thu May 16 13:32:17 2002
+++ lib/sshsession/wtmp.c   Sat Oct  5 23:33:53 2002
@@ -217,13 +217,13 @@
 # endif /* LASTLOG_IS_DIR */
 #endif /* HAVE_LASTLOG_H || HAVE_LASTLOG */
 
-#if defined(HAVE_UTMP_H) && !defined(HAVE_UTMPX_H)
+#if defined(HAVE_UTMP_H)
   struct utmp u;
   const char *utmp, *wtmp;
 
   /* Construct an utmp/wtmp entry. */
   memset(&u, 0, sizeof(u));
-# ifdef DEAD_PROCESS
+# if defined(DEAD_PROCESS) && defined(HAVE_UT_TYPE_IN_UTMP)
   if (user == NULL)
     u.ut_type = DEAD_PROCESS; /* logout */
   else
-- 
kivinen@ssh.fi
SSH Communications Security                  http://www.ssh.fi/
SSH IPSEC Toolkit                            http://www.ssh.fi/ipsec/