On Tue, 2 Mar 93 15:00:30 Dr. Dieter Mack wrote:
>Folks,
>
>I just got the following problem reported by a colleague of mine:
>
> ---------------------------------------------------------------------
> We are running AIX 3.2.2 with AFS 3.2 and the AFS-Versions of "login"
> and "ftpd".

> We have many problems with the accounting system coming from
>corrupted records in "/var/adm/wtmp". But i dont know which program
>causes the corrupted records.  Did you know about any of these
>problems caused by the AFS-Versions of "login" or "ftpd" ?


Yes.  IBM's AIX login is responsible for cleaning up the utmp file.  It
has been APAR'd several times.  However, the best solution I can give
you is to use the following program (utmpfix) that has been passed
around somewhat to keep the utmp file clean:

#if defined(LOGGING)
#include <stdio.h>
#endif
#include <sys/types.h>
#include <utmp.h>
#include <fcntl.h>

main (int argc, char *argv[])
{
        int     fd;
        struct  utmp    utmp;

#if defined(DAEMON)
        while (1) {
#endif
                if ((fd = open ("/etc/utmp", O_RDWR)) >= 0) {

                    while (read (fd, &utmp, sizeof utmp) == sizeof utmp) {
                        if (utmp.ut_type == USER_PROCESS &&
                                        kill (utmp.ut_pid, 0) != 0) {
                                lseek (fd, - (long) sizeof utmp, 1);
                                utmp.ut_type = DEAD_PROCESS;
                                write (fd, &utmp, sizeof utmp);
#if defined(LOGGING)
                                printf("%s zapped: %8.8s %12.12s\n",
                                    argv[0], utmp.ut_name, utmp.ut_line);
#endif
                        }
                    }
                    close (fd);
                }
#if defined(DAEMON)
                sleep (60);
        }
#endif
}


                                                      ,,,
                                                     (o o)
-------------------------------+-----------------oOO--(_)--OOo----------
Frank Swasey                   | IBMIPNET: [EMAIL PROTECTED]
I&TSS NorthEast Region         | Internet: [EMAIL PROTECTED]
Distributed Computing Services |   BITNET: FSWASEY at VNET
D54/615-1                      |     VNET: FSWASEY at BTV
(802) 871-4011 (tie 435)       |      fax: (802) 871-4253 (tie 435)

"The most important political office is that of private citizen."
                                                     -- Louis Brandeis

Reply via email to