Tan-Sheng Li writes:
: hi,
:
: I got a problem as following:
:
: I running sshd2 after server boot up, then the user login. I found that
: one connection appears two records in last log, wtmpx. What's wrong?
:
: jaffer pts/2 h103.s58.ts.hine Sat Jun 10 23:45 still logged
: in
: jaffer pts/2 Sat Jun 10 23:41 - 23:41
: (00:00)
Please try this patch, and tell me if it works or not.
cd to lib/sshsession and apply the patch with
% 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 04:13:40
@@ -342,9 +342,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 +353,7 @@
ux = *uxp;
break;
}
+ endutxent();
}
else
{
@@ -363,7 +364,6 @@
strncpy(ux.ut_user, ssh_user_name(user), sizeof(ux.ut_user));
ux.ut_type = USER_PROCESS;
}
- endutxent();
# 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/]