1 --- proftpd-1.2.10rc3/src/log.c.orig 2004-04-20 04:05:41.000000000 +0200
2 +++ proftpd-1.2.10rc3/src/log.c 2004-09-01 08:26:12.959741640 +0200
5 int log_wtmp(char *line, const char *name, const char *host,
12 -#if (defined(SVR4) || defined(__SVR4)) && \
13 - !(defined(LINUX) || defined(__hpux) || defined (_AIX))
14 - /* This "auxilliary" utmp doesn't exist under linux. */
21 - static int fdx = -1;
24 - (fdx = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
25 - pr_log_pri(PR_LOG_WARNING, "wtmpx %s: %s", WTMPX_FILE, strerror(errno));
28 + static int washere = 0;
31 + utmpname(_PATH_WTMP);
36 /* Unfortunately, utmp string fields are terminated by '\0' if they are
37 * shorter than the size of the field, but if they are exactly the size of
39 * Insane if you ask me. Unless there's massive uproar, I prefer to err on
40 * the side of caution and always null-terminate our strings.
42 - if (fstat(fdx, &buf) == 0) {
43 - memset(&utx, 0, sizeof(utx));
45 - sstrncpy(utx.ut_user, name, sizeof(utx.ut_user));
46 - sstrncpy(utx.ut_id, "ftp", sizeof(utx.ut_user));
47 - sstrncpy(utx.ut_line, line, sizeof(utx.ut_line));
48 - sstrncpy(utx.ut_host, host, sizeof(utx.ut_host));
49 - utx.ut_syslen = strlen(utx.ut_host)+1;
50 - utx.ut_pid = getpid();
53 - utx.ut_tv.tv_sec = (time32_t)t;
55 - time(&utx.ut_tv.tv_sec);
58 - utx.ut_type = USER_PROCESS;
60 - utx.ut_type = DEAD_PROCESS;
61 -#ifdef HAVE_UT_UT_EXIT
62 - utx.ut_exit.e_termination = 0;
63 - utx.ut_exit.e_exit = 0;
64 -#endif /* HAVE_UT_UT_EXIT */
65 - if (write(fdx, (char *)&utx, sizeof(utx)) != sizeof(utx))
66 - ftruncate(fdx, buf.st_size);
69 - pr_log_debug(DEBUG0, "%s fstat(): %s", WTMPX_FILE, strerror(errno));
73 -#else /* Non-SVR4 systems */
76 - (fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
77 - pr_log_pri(PR_LOG_WARNING, "wtmp %s: %s", WTMP_FILE, strerror(errno));
81 - if (fstat(fd, &buf) == 0) {
82 memset(&ut, 0, sizeof(ut));
86 #endif /* HAVE_UT_UT_HOST */
89 - if (write(fd, (char *)&ut, sizeof(ut)) != sizeof(ut))
90 - ftruncate(fd, buf.st_size);
93 - pr_log_debug(DEBUG0, "%s fstat(): %s",WTMP_FILE,strerror(errno));
99 + while ((getutent())) ;