Add option '-W': don't log FTP sessions to wtmp.

Submitted by:	maxim
MFC after:	1 week
This commit is contained in:
Yaroslav Tykhiy 2002-08-23 09:06:28 +00:00
parent b1acc4a299
commit 5d7e0128ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102311
2 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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 @@ pass(char *passwd)
#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);
}