SCCS-vsn: libexec/ftpd/ftpd.c 5.31
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ftpd.c 5.30 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftpd.c 5.31 (Berkeley) %G%";
* Sets global passwd pointer pw if named account exists
* and is acceptable; sets askpasswd if a PASS command is
* expected. If logged in previously, need to reset state.
* Sets global passwd pointer pw if named account exists
* and is acceptable; sets askpasswd if a PASS command is
* expected. If logged in previously, need to reset state.
- * If name is "ftp" or "anonymous" and ftp account exists,
- * set guest and pw, then just return.
+ * If name is "ftp" or "anonymous", the name is not in /etc/ftpusers,
+ * and ftp account exists, set guest and pw, then just return.
* If account doesn't exist, ask for passwd anyway.
* Otherwise, check user requesting login privileges.
* Disallow anyone who does not have a standard
* If account doesn't exist, ask for passwd anyway.
* Otherwise, check user requesting login privileges.
* Disallow anyone who does not have a standard
guest = 0;
if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
guest = 0;
if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
- if ((pw = sgetpwnam("ftp")) != NULL) {
+ if (!checkuser("ftp") || !checkuser("anonymous"))
+ reply(530, "User %s access denied.", name);
+ else if ((pw = sgetpwnam("ftp")) != NULL) {
guest = 1;
askpasswd = 1;
reply(331, "Guest login ok, send ident as password.");
guest = 1;
askpasswd = 1;
reply(331, "Guest login ok, send ident as password.");