1 diff -ur proftpd-1.2.0rc2.orig/src/log.c proftpd-1.2.0rc2/src/log.c
2 --- proftpd-1.2.0rc2.orig/src/log.c Wed Jul 26 13:03:17 2000
3 +++ proftpd-1.2.0rc2/src/log.c Wed Aug 9 17:14:50 2000
5 * Also added a command line argument (-d,--debug) to alter the
6 * debug level at runtime. See main.c.
16 int log_wtmp(char *line, char *name, char *host, p_in_addr_t *ip)
23 -#if defined(SVR4) || defined(__SVR4)
24 -#if !(defined(LINUX) || defined(__hpux) || defined (_AIX))
26 /* This "auxilliary" utmp doesn't exist under linux. */
28 - static int fdx = -1;
30 - if(fdx < 0 && (fdx = open(WTMPX_FILE, O_WRONLY | O_APPEND, 0)) < 0) {
31 - log_pri(LOG_WARNING,"wtmpx %s: %s",WTMPX_FILE,strerror(errno));
35 /* Unfortunately, utmp string fields are terminated by '\0' if they are
36 * shorter than the size of the field, but if they are exactly the size of
38 * Insane if you ask me. Unless there's massive uproar, I prefer to err on
39 * the side of caution and always null-terminate our strings.
41 - if(fstat(fdx,&buf) == 0) {
42 memset(&utx,0,sizeof(utx));
43 sstrncpy(utx.ut_user,name,sizeof(utx.ut_user));
44 sstrncpy(utx.ut_id,"ftp",sizeof(utx.ut_user));
45 sstrncpy(utx.ut_line,line,sizeof(utx.ut_line));
46 sstrncpy(utx.ut_host,host,sizeof(utx.ut_host));
47 - utx.ut_syslen = strlen(utx.ut_host)+1;
48 utx.ut_pid = getpid();
49 time(&utx.ut_tv.tv_sec);
52 utx.ut_type = DEAD_PROCESS;
53 utx.ut_exit.e_termination = 0;
54 utx.ut_exit.e_exit = 0;
55 - if(write(fdx,(char*)&utx,sizeof(utx)) != sizeof(utx))
56 - ftruncate(fdx, buf.st_size);
58 - log_debug(DEBUG0,"%s fstat(): %s",WTMPX_FILE,strerror(errno));
61 + updwtmpx(_PATH_WTMP, &utx);
68 - if(fd < 0 && (fd = open(WTMP_FILE,O_WRONLY|O_APPEND,0)) < 0) {
69 - log_pri(LOG_WARNING,"wtmp %s: %s",WTMP_FILE,strerror(errno));
73 - if(fstat(fd,&buf) == 0) {
74 memset(&ut,0,sizeof(ut));
78 #endif /* HAVE_UT_UT_HOST */
81 - if(write(fd,(char*)&ut,sizeof(ut)) != sizeof(ut))
82 - ftruncate(fd,buf.st_size);
84 - log_debug(DEBUG0,"%s fstat(): %s",WTMP_FILE,strerror(errno));
87 + updwtmp(_PATH_WTMP, &ut);