summaryrefslogtreecommitdiffstats
path: root/libexec/ftpd
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2002-08-23 09:06:28 +0000
committeryar <yar@FreeBSD.org>2002-08-23 09:06:28 +0000
commit8edf222b9e5a4d6a18709ba4ff2ad1e7ec81a932 (patch)
tree3071c9727dce865b3a01e7ed3bbb745b5bb35932 /libexec/ftpd
parente9b0577c0ea65f0ff1b1c6ded5dcd6f9f00c4d6b (diff)
downloadFreeBSD-src-8edf222b9e5a4d6a18709ba4ff2ad1e7ec81a932.zip
FreeBSD-src-8edf222b9e5a4d6a18709ba4ff2ad1e7ec81a932.tar.gz
Add option '-W': don't log FTP sessions to wtmp.
Submitted by: maxim MFC after: 1 week
Diffstat (limited to 'libexec/ftpd')
-rw-r--r--libexec/ftpd/ftpd.85
-rw-r--r--libexec/ftpd/ftpd.c15
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);
}
OpenPOWER on IntegriCloud