Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!cak@Purdue.ARPA From: cak@Purdue.ARPA Newsgroups: net.unix-wizards Subject: anonymous ftps aren't recorded in wtmp Message-ID: <15426@sri-arpa.UUCP> Date: Wed, 11-Jan-84 20:04:00 EST Article-I.D.: sri-arpa.15426 Posted: Wed Jan 11 20:04:00 1984 Date-Received: Sun, 15-Jan-84 01:35:15 EST Lines: 55 From: Christopher A Kent 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 ----------