anonymous ftps aren't recorded in wtmp
cak at Purdue.ARPA
cak at Purdue.ARPA
Thu Jan 12 11:04:00 AEST 1984
From: Christopher A Kent <cak at Purdue.ARPA>
Description:
FTP users who log in as "anonymous" or "ftp" are not recorded
in wtmp. This is because the logging is done after the chroot call;
thus the open of "/usr/adm/wtmp" is now relative to ~ftp. Even if it
succeeds, the record is written into the wrong file.
Repeat-By:
ftp localhost and log in as anonymous. quit and do a last; no
session is recorded.
Fix:
Move the log action to after the user has logged in but before
the chroot() call. If the chroot fails, there will be extra log
entries, but this is fairly unlikely. A diff:
*** ftpd.c.old
--- ftpd.c.new
***************
*** 235,240
pw->pw_name, pw->pw_dir);
goto bad;
}
if (guest && chroot(pw->pw_dir) < 0) {
reply(550, "Can't set guest privileges.");
goto bad;
--- 235,241 -----
pw->pw_name, pw->pw_dir);
goto bad;
}
+ dologin(pw); /* before chroot for ftp */
if (guest && chroot(pw->pw_dir) < 0) {
reply(550, "Can't set guest privileges.");
goto bad;
***************
*** 244,250
else
reply(230, "Guest login ok, access restrictions apply.");
logged_in = 1;
- dologin(pw);
seteuid(pw->pw_uid);
/*
* Save everything so globbing doesn't
--- 245,250 -----
else
reply(230, "Guest login ok, access restrictions apply.");
logged_in = 1;
seteuid(pw->pw_uid);
/*
* Save everything so globbing doesn't
----------
More information about the Comp.unix.wizards
mailing list