diff options
| author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2002-08-30 10:24:31 +0000 |
|---|---|---|
| committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2002-08-30 10:24:31 +0000 |
| commit | b2bacd00f519c1bcff9df89d70e0fb764f3cc4ac (patch) | |
| tree | 67251931a493cf036633b0eb5bf435a9d7e08c66 /libexec | |
| parent | 3850f7b9d7670bc5c6241c14fd1663ddd04e825b (diff) | |
MFC: Add the "-W" option: Don't log every FTP session to wtmp(5).
Notes
svn path=/stable/4/; revision=102609
Diffstat (limited to 'libexec')
| -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 72ed9e39a102..f846dc6db1f6 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 @@ -189,6 +189,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 a28e37807f45..654d68c25cd8 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -133,6 +133,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; @@ -304,7 +305,7 @@ main(argc, argv, 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; @@ -403,6 +404,10 @@ main(argc, argv, envp) ftpdebug++; break; + case 'W': + dowtmp = 0; + break; + default: warnx("unknown flag -%c ignored", optopt); break; @@ -1134,7 +1139,7 @@ end_login() { (void) seteuid((uid_t)0); - if (logged_in) + if (logged_in && dowtmp) ftpd_logwtmp(ttyline, "", NULL); pw = NULL; #ifdef LOGIN_CAP @@ -1381,7 +1386,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) @@ -2475,7 +2482,7 @@ dologout(status) */ transflag = 0; - if (logged_in) { + if (logged_in && dowtmp) { (void) seteuid((uid_t)0); ftpd_logwtmp(ttyline, "", NULL); } |
