diff options
-rw-r--r-- | libexec/ftpd/ftpd.8 | 5 | ||||
-rw-r--r-- | libexec/ftpd/ftpd.c | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8 index 80d95ec..69cf0c7 100644 --- a/libexec/ftpd/ftpd.8 +++ b/libexec/ftpd/ftpd.8 @@ -40,7 +40,7 @@ .Nd Internet File Transfer Protocol server .Sh SYNOPSIS .Nm -.Op Fl 46AdDEmMoOrRSUv +.Op Fl 46AdDEmMoOrRSUvW .Op Fl l Op Fl l .Op Fl a Ar address .Op Fl p Ar file @@ -190,6 +190,9 @@ option will revert to the old behavior. .It Fl v A synonym for .Fl d . +.It Fl W +Don't log FTP sessions to +.Pa /var/log/wtmp . .El .Pp The file diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 9704f60..80af14f 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -126,6 +126,7 @@ int paranoid = 1; /* be extra careful about security */ int anon_only = 0; /* Only anonymous ftp allowed */ int guest; int dochroot; +int dowtmp = 1; int stats; int statfd = -1; int type; @@ -295,7 +296,7 @@ main(int argc, char *argv[], char **envp) #endif /* OLD_SETPROCTITLE */ - while ((ch = getopt(argc, argv, "46a:AdDElmMoOp:rRSt:T:u:Uv")) != -1) { + while ((ch = getopt(argc, argv, "46a:AdDElmMoOp:rRSt:T:u:UvW")) != -1) { switch (ch) { case '4': enable_v4 = 1; @@ -394,6 +395,10 @@ main(int argc, char *argv[], char **envp) ftpdebug++; break; + case 'W': + dowtmp = 0; + break; + default: warnx("unknown flag -%c ignored", optopt); break; @@ -1128,7 +1133,7 @@ end_login(void) #endif (void) seteuid((uid_t)0); - if (logged_in) + if (logged_in && dowtmp) ftpd_logwtmp(ttyline, "", NULL); pw = NULL; #ifdef LOGIN_CAP @@ -1413,7 +1418,9 @@ skip: #endif /* open wtmp before chroot */ - ftpd_logwtmp(ttyline, pw->pw_name, (struct sockaddr *)&his_addr); + if (dowtmp) + ftpd_logwtmp(ttyline, pw->pw_name, + (struct sockaddr *)&his_addr); logged_in = 1; if (guest && stats && statfd < 0) @@ -2463,7 +2470,7 @@ dologout(int status) */ transflag = 0; - if (logged_in) { + if (logged_in && dowtmp) { (void) seteuid((uid_t)0); ftpd_logwtmp(ttyline, "", NULL); } |