Subject: [2.5.0 Quick Fix] GNU libc updwtmp() does not record logouts

From: Gregory A Lundberg <[email-masked]>
Date: Tue, 3 Aug 1999 10:05:03 -0400

A change in WU-FTPD version 2.5.0 was to use the supplied udpwtmp()
function to handle wtmp logging.  Unfortunately, udpwtmp() turns out to be
overly simplistic and unreliable.

This correction allows WU-FTPD 2.5.0 on systems using GNU libc version 2 to
record logout information in the wtmp file.  Primarily, this effects Linux;
other systems may be effected.

The fix for this problem is available from:

  ftp://ftp.wu-ftpd.org/pub/wu-ftpd/quickfixes/apply_to_2.5.0/glibc.wtmp.patch

--

Gregory A Lundberg              WU-FTPD Development Group
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195
This reverses an earlier change to src/logwtmp.c.  The original comment was:
Garry Shtern <[email-masked]> submitted a patch on Fri, 9 Apr 1999, which he
says was needed to support glibc2 on linux.

It turns out this has the effect of breaking wtmp logging on Linux.  The GNU
libc updwtmp() function cannot find _PATH_WTMP when a guest or anonymous user
is logging out because the daemon has chroot'd.

Index: logwtmp.c
===================================================================
RCS file: /cvsroot/wu-ftpd-stable/src/logwtmp.c,v
retrieving revision 1.4
diff -c -r1.4 logwtmp.c
*** logwtmp.c	1999/05/21 14:15:39	1.4
--- logwtmp.c	1999/08/03 13:28:08
***************
*** 93,127 ****
      struct stat buf;
      struct utmp ut;
  
- 
- #if defined(__GLIBC__)
- #   if (__GLIBC__ == 2) && defined(LINUX)
- 
-     /* zero out the entry */
-     memset(&ut, 0, sizeof(ut));
- 
-     /* fill with defaults */
-     gettimeofday(&ut.ut_tv, NULL);
-     strncpy(ut.ut_line,line,UT_LINESIZE);
-     strncpy(ut.ut_id,"",3);
-     strncpy(ut.ut_host,host,UT_HOSTSIZE);
-     ut.ut_pid = getpid();
- 
-     /* create a new entry */
-     if (login) {
-        strncpy(ut.ut_user,name,UT_NAMESIZE);
-        ut.ut_type = USER_PROCESS;
-     } /* delete existing one */
-     else {
-        ut.ut_type = DEAD_PROCESS;
-     }
- 
-     /* dump out the structure */
-     updwtmp(_PATH_WTMP,&ut);
- 
- #   endif
- #else
- 
  #ifdef SVR4
  #ifndef NO_UTMPX
      /*
--- 93,98 ----
***************
*** 233,239 ****
              sizeof(struct utmp))
                (void) ftruncate(fd, buf.st_size);
      }
- #endif
  }

--- 204,209 ----