Trouble with utmp/wtmp

Trouble with utmp/wtmp

Post by John Spa » Thu, 08 Feb 1996 04:00:00



: Hello, all.  I think I've found a bug, but I don't know too much about
: it.
:
: At some point, my utmp stopped being properly updated when I exited a
: telnet or xterm.  Commands like 'w', 'who', and 'last' all show that
: I'm logged in and idle when in reality, I've logged out.  Usually,
: after a couple hours, these entries do get updated, and the
: aforementioned commands say that I'm logged out.

        I have the same problem and have not been able
to find the cause.  Is there a new utmkp format that the old
programs are not closing correctly or something?  

                        John

 
 
 

Trouble with utmp/wtmp

Post by Ronald Wah » Thu, 08 Feb 1996 04:00:00



Quote:> Hello, all.  I think I've found a bug, but I don't know too much about
> it.

You found a(n already known) bug in the xterm code.

Quote:> Now the question is, what could have caused this?  My system is based
> on Slackware 3.0.  I've updated my libc and libm a couple of times,
> from 5.0.9 to 5.2.16 to 5.2.18.  The bug manifests itself on the last
> two.  I've also updated ld.so and ld-linux.so from 1.7.3 to 1.7.10 to
> 1.7.14.  Again, the bug popped up on the last two releases.  My
> current kernel is 1.3.59.  I'm not really sure what details to report,
> since I've got no clue what the bug's source is.

Apply the following patch to the xterm-sources:

***************************************************************************
--- main.c.orig Tue Oct 31 14:35:21 1995

                    utptr->ut_time = time((Time_t *) 0);
 #endif
                    (void) pututline(utptr);
+                   /* Make sure that ut_user is cleared so that we don't
+                      get an extraneous login event!  -DD */
+                   strcpy(utptr->ut_user, "");
 #ifdef WTMP
 #ifdef SVR4
-                   updwtmpx(WTMPX_FILE, &utmp);
+                   if (term->misc.login_shell)
+                     updwtmpx(WTMPX_FILE, &utmp);
 #else
                    /* set wtmp entry if wtmp file exists */
-                   if ((fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
+                   if (term->misc.login_shell &&
+                        (fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
                      i = write(fd, utptr, sizeof(utmp));
                      i = close(fd);
                    }
***************************************************************************

ron

--

 \ WWW: http://www.tu-chemnitz.de/~row             \

   \ PGP key available by finger to my email address \

 
 
 

1. location of utmp wtmp in utmp.h

When building sysVinit using libc4.4 I found that 'last' was looking
for /etc/utmp and /usr/adm/wtmp.  I found that it was getting these
locations from /usr/include/utmp.h.  Why this strange inconsitency?

Is this a mistake?  Should utmp.h be changed to put both in /etc?

2. soundblaster pci 128:

3. utmp and wtmp corruption...

4. problems installing PC Card 3COM FE575C

5. How to remove utmp/wtmp entries?

6. Kernel experiment - sort of works

7. utmp and wtmp re-init

8. Problems using fetchmail with gmx

9. Redhat 5.0 wtmp and utmp problems...

10. is it safe to simply truncate wtmp/utmp ??

11. Are wtmp and utmp Binaries?

12. utmp/wtmp in lx99pl8

13. utmp/wtmp in kvt/KDE