SCCS-vsn: libexec/ftpd/ftpd.c 5.5
SCCS-vsn: libexec/ftpd/ftpcmd.y 5.5
-static char sccsid[] = "@(#)ftpcmd.y 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)ftpcmd.y 5.5 (Berkeley) %G%";
#endif
#include <sys/types.h>
#endif
#include <sys/types.h>
(void) close(pdata);
}
pdata = -1;
(void) close(pdata);
}
pdata = -1;
+ reply(200, "PORT command successful.");
- reply(502, "Unimplemented STRU type.");
+ reply(504, "Unimplemented STRU type.");
}
}
| MODE SP mode_code CRLF
}
}
| MODE SP mode_code CRLF
}
| ALLO SP NUMBER CRLF
= {
}
| ALLO SP NUMBER CRLF
= {
+ reply(202, "ALLO command ignored.");
}
| RETR check_login SP pathname CRLF
= {
}
| RETR check_login SP pathname CRLF
= {
+ reply(225, "ABOR command successful.");
}
| CWD check_login CRLF
= {
}
| CWD check_login CRLF
= {
+ reply(200, "NOOP command successful.");
}
| XMKD check_login SP pathname CRLF
= {
}
| XMKD check_login SP pathname CRLF
= {
+ /*
+ * Problem: this production is used for all pathname
+ * processing, but only gives a 550 error reply.
+ * This is a valid reply in some cases but not in others.
+ */
if ($1 && strncmp((char *) $1, "~", 1) == 0) {
$$ = (int)*glob((char *) $1);
if (globerr != NULL) {
if ($1 && strncmp((char *) $1, "~", 1) == 0) {
$$ = (int)*glob((char *) $1);
if (globerr != NULL) {
columns = 1;
lines = (NCMDS + columns - 1) / columns;
for (i = 0; i < lines; i++) {
columns = 1;
lines = (NCMDS + columns - 1) / columns;
for (i = 0; i < lines; i++) {
for (j = 0; j < columns; j++) {
c = cmdtab + j * lines + i;
printf("%s%c", c->name,
for (j = 0; j < columns; j++) {
c = cmdtab + j * lines + i;
printf("%s%c", c->name,
upper(s);
c = lookup(s);
if (c == (struct tab *)0) {
upper(s);
c = lookup(s);
if (c == (struct tab *)0) {
- reply(504, "Unknown command %s.", s);
+ reply(502, "Unknown command %s.", s);
return;
}
if (c->implemented)
return;
}
if (c->implemented)
-/*
-reapchild()
-{
- union wait status;
-
- while (wait3(&status, WNOHANG, 0) > 0)
- ;
-}
-*/
setegid(pw->pw_gid);
initgroups(pw->pw_name, pw->pw_gid);
if (chdir(pw->pw_dir)) {
setegid(pw->pw_gid);
initgroups(pw->pw_name, pw->pw_gid);
if (chdir(pw->pw_dir)) {
- reply(550, "User %s: can't change directory to %s.",
+ reply(530, "User %s: can't change directory to %s.",
pw->pw_name, pw->pw_dir);
goto bad;
}
pw->pw_name, pw->pw_dir);
goto bad;
}
fout = fopen(local, mode), closefunc = fclose;
}
if (fout == NULL) {
fout = fopen(local, mode), closefunc = fclose;
}
if (fout == NULL) {
- reply(550, "%s: %s.", local, sys_errlist[errno]);
+ reply(553, "%s: %s.", local, sys_errlist[errno]);
return;
}
din = dataconn(local, (off_t)-1, "r");
if (din == NULL)
goto done;
if ((tmp = receive_data(din, fout)) > 0 || ferror(fout) > 0) {
return;
}
din = dataconn(local, (off_t)-1, "r");
if (din == NULL)
goto done;
if ((tmp = receive_data(din, fout)) > 0 || ferror(fout) > 0) {
- reply(550, "%s: %s.", local, sys_errlist[errno]);
+ reply(552, "%s: %s.", local, sys_errlist[errno]);
}
else if (tmp == 0 && !unique) {
reply(226, "Transfer complete.");
}
else if (tmp == 0 && !unique) {
reply(226, "Transfer complete.");
transflag = 0;
return (cnt < 0);
}
transflag = 0;
return (cnt < 0);
}
- reply(504,"Unimplemented TYPE %d in send_data", type);
+ reply(550, "Unimplemented TYPE %d in send_data", type);
return (cnt < 0);
case TYPE_E:
return (cnt < 0);
case TYPE_E:
- reply(504, "TYPE E not implemented.");
+ reply(553, "TYPE E not implemented.");
case TYPE_A:
while ((c = getc(instr)) != EOF) {
case TYPE_A:
while ((c = getc(instr)) != EOF) {
-/* NOT CALLED ANYWHERE
-replystr(s)
- char *s;
-{
- printf("%s\r\n", s);
- (void) fflush(stdout);
- if (debug)
- fprintf(stderr, "<--- %s\n", s);
-}
-*/
-
- reply(200, "%s command successful.", s);
+ reply(250, "%s command successful.", s);
}
if (dochown)
(void) chown(name, pw->pw_uid, -1);
}
if (dochown)
(void) chown(name, pw->pw_uid, -1);
+ reply(257, "MKD command successful.");
reply(550, "%s: %s.", name, sys_errlist[errno]);
return;
}
reply(550, "%s: %s.", name, sys_errlist[errno]);
return;
}
char path[MAXPATHLEN + 1];
if (getwd(path) == NULL) {
char path[MAXPATHLEN + 1];
if (getwd(path) == NULL) {
- reply(451, "%s.", path);
+ reply(550, "%s.", path);
- reply(251, "\"%s\" is current directory.", path);
+ reply(257, "\"%s\" is current directory.", path);
+/*
+ * Note: The 530 reply codes could be 4xx codes, except nothing is
+ * given in the state tables except 421 which implies an exit. (RFC959)
+ */
pdata = socket(AF_INET, SOCK_STREAM, 0);
if (pdata < 0) {
pdata = socket(AF_INET, SOCK_STREAM, 0);
if (pdata < 0) {
- reply(451, "Can't open passive connection");
+ reply(530, "Can't open passive connection");
return;
}
tmp = ctrl_addr;
return;
}
tmp = ctrl_addr;
seteuid(pw->pw_uid);
(void) close(pdata);
pdata = -1;
seteuid(pw->pw_uid);
(void) close(pdata);
pdata = -1;
- reply(451, "Can't open passive connection");
+ reply(530, "Can't open passive connection");
return;
}
seteuid(pw->pw_uid);
return;
}
seteuid(pw->pw_uid);
if (getsockname(pdata, (char *) &tmp, &len) < 0) {
(void) close(pdata);
pdata = -1;
if (getsockname(pdata, (char *) &tmp, &len) < 0) {
(void) close(pdata);
pdata = -1;
- reply(451, "Can't open passive connection");
+ reply(530, "Can't open passive connection");
return;
}
if (listen(pdata, 1) < 0) {
(void) close(pdata);
pdata = -1;
return;
}
if (listen(pdata, 1) < 0) {
(void) close(pdata);
pdata = -1;
- reply(451, "Can't open passive connection");
+ reply(530, "Can't open passive connection");
return;
}
a = (char *) &tmp.sin_addr;
return;
}
a = (char *) &tmp.sin_addr;
*cp++ = '.';
while (!d) {
if (++count == 100) {
*cp++ = '.';
while (!d) {
if (++count == 100) {
- reply(451, "Unique file name not cannot be created.");
+ reply(452, "Unique file name not cannot be created.");
return((char *) 0);
}
*cp++ = ext;
return((char *) 0);
}
*cp++ = ext;