$NetBSD: patch-ai,v 1.10 2006/09/22 19:44:01 joerg Exp $ --- src/ftpd.c.orig 2006-09-22 21:01:34.000000000 +0000 +++ src/ftpd.c @@ -75,6 +75,7 @@ #include #endif #include +#include #define VA_LOCAL_DECL va_list ap; #define VA_START(f) va_start(ap, f) @@ -85,9 +86,17 @@ #ifdef HAVE_UFS_QUOTA_H #include #endif + +#if defined(__DragonFly__) && __DragonFly_version >= 160000 +#define dqblk ufs_dqblk +#endif + #ifdef HAVE_SYS_FS_UFS_QUOTA_H #include #endif +#ifdef HAVE_UFS_UFS_QUOTA_H +#include +#endif #ifdef HAVE_SYS_SYSLOG_H #include @@ -214,7 +223,6 @@ int Send(FILE *sockfp, char *format,...) /* File containing login names NOT to be used on this machine. Commonly used * to disallow uucp. */ -extern int errno; extern int pidfd; extern char *ctime(const time_t *); @@ -2370,7 +2378,8 @@ void end_login(void) (void) seteuid((uid_t) 0); if (logged_in) if (wtmp_logging) - wu_logwtmp(ttyline, pw->pw_name, remotehost, 0); + wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE + ? remoteaddr : remotehost, 0); pw = NULL; #ifdef AFS_AUTH ktc_ForgetAllTokens(); @@ -2869,7 +2878,8 @@ void pass(char *passwd) #ifdef DEBUG syslog(LOG_DEBUG, "about to call wtmp"); #endif - wu_logwtmp(ttyline, pw->pw_name, remotehost, 1); + wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE + ? remoteaddr : remotehost, 1); } logged_in = 1; @@ -5459,7 +5469,9 @@ void reply(int n, char *fmt,...) *p = '\0'; /* send a line...(note that this overrides dolreplies!) */ + VA_START(fmt); vreply(USE_REPLY_LONG | USE_REPLY_NOTFMT, n, ptr, ap); + VA_END; /* *NEVER* send a 0 as an ap, some machines use a *struct* for a va_list! */ if (p) ptr = p + 1; /* set to the next line... (\0 is handled in the while) */ @@ -6083,6 +6095,8 @@ void dologout(int status) (void) seteuid((uid_t) 0); if (wtmp_logging) wu_logwtmp(ttyline, pw->pw_name, remotehost, 0); + wu_logwtmp(ttyline, pw->pw_name, strlen(remotehost) > UT_HOSTSIZE + ? remoteaddr : remotehost, 0); } if (logging) syslog(LOG_INFO, "FTP session closed"); @@ -7378,7 +7392,7 @@ int SockPrintf(FILE *sockfp, char *forma char buf[32768]; va_start(ap, format); - vsprintf(buf, format, ap); + vsnprintf(buf, sizeof(buf), format, ap); va_end(ap); return SockWrite(buf, 1, strlen(buf), sockfp); }