I unfortunately sent a mail to the list, where I included a patch for
utpmx handling in ssh2. That patch was incomplete. However, I have a
confirmation from one user that the following patch fixes the bug.
cd to lib/sshsession and execute the following command:
% patch -p 0 < /path/to/patch-ssh-2.1.0-wtmp
Index: wtmp.c
===================================================================
RCS file: /src/ssh2/lib/sshsession/wtmp.c,v
retrieving revision 1.5
diff -u -r1.5 wtmp.c
--- wtmp.c 2000/04/29 15:42:33 1.5
+++ wtmp.c 2000/06/11 08:27:42
@@ -213,12 +213,18 @@
/* Construct an utmp/wtmp entry. */
memset(&u, 0, sizeof(u));
-# ifdef DEAD_PROCESS
if (user == NULL)
- u.ut_type = DEAD_PROCESS; /* logout */
- else
- u.ut_type = USER_PROCESS;
+ {
+# ifdef DEAD_PROCESS
+ u.ut_type = DEAD_PROCESS; /* logout */
+# else /* DEAD_PROCESS */
+ /* XXX */;
# endif /* DEAD_PROCESS */
+ }
+ else
+ {
+ u.ut_type = USER_PROCESS;
+ }
# ifdef HAVE_PID_IN_UTMP
u.ut_pid = pid;
# endif /* PID_IN_UTMP */
@@ -342,9 +348,9 @@
struct utmpx ux, *uxp;
memset(&ux, 0, sizeof(ux));
strncpy(ux.ut_line, ttyname + 5, sizeof(ux.ut_line));
- setutxent(); /* open the database and reset to first position */
if (user == NULL)
{
+ setutxent(); /* open the database and reset to first position */
/* logout; find previous entry for pid and zonk it */
while ((uxp = getutxent()))
{
@@ -353,6 +359,7 @@
ux = *uxp;
break;
}
+ endutxent();
}
else
{
@@ -363,7 +370,10 @@
strncpy(ux.ut_user, ssh_user_name(user), sizeof(ux.ut_user));
ux.ut_type = USER_PROCESS;
}
- endutxent();
+# ifdef DEAD_PROCESS
+ if (user == NULL)
+ ux.ut_type = DEAD_PROCESS; /* logout */
+# endif /* DEAD_PROCESS */
# if defined(__sgi) || defined(SCO) || defined(linux)
strncpy(ux.ut_id, ttyname + 8, sizeof(ux.ut_id)); /* /dev/ttyq99 -> q99 */
# else /* __sgi || SCO || linux */
--
[[EMAIL PROTECTED] -- Sami J. Lehtinen -- [EMAIL PROTECTED]]
[work:+358 9 85657425][gsm:+358 50 5170 258][http://www.iki.fi/~sjl]
[SSH Communications Security Corp http://www.ssh.com/]