1 /* $NetBSD: ftpcmd.y,v 1.6 1995/06/03 22:46:45 mycroft Exp $ */
4 * Copyright (c) 1985, 1988, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * @(#)ftpcmd.y 8.3 (Berkeley) 4/6/94
39 * Grammar for FTP commands.
45 #include "ftpd_locl.h"
46 RCSID("$Id: ftpcmd.y,v 1.56.2.2 2000/06/23 02:48:19 assar Exp $");
52 static int cmd_bytesz;
60 short implemented; /* 1 if command is implemented */
64 extern struct tab cmdtab[];
65 extern struct tab sitetab[];
67 static char *copy (char *);
68 static void help (struct tab *, char *);
70 lookup (struct tab *, char *);
71 static void sizecmd (char *);
72 static RETSIGTYPE toolong (int);
73 static int yylex (void);
75 /* This is for bison */
77 #if !defined(alloca) && !defined(HAVE_ALLOCA)
78 #define alloca(x) malloc(x)
94 USER PASS ACCT REIN QUIT PORT
95 PASV TYPE STRU MODE RETR STOR
96 APPE MLFL MAIL MSND MSOM MSAM
97 MRSQ MRCP ALLO REST RNFR RNTO
98 ABOR DELE CWD LIST NLST SITE
99 sTAT HELP NOOP MKD RMD PWD
100 CDUP STOU SMNT SYST SIZE MDTM
105 AUTH ADAT PROT PBSZ CCC MIC
108 KAUTH KLIST KDESTROY KRBTKFILE AFSLOG
118 %type <i> check_login check_login_no_guest check_secure octal_number byte_size
119 %type <i> struct_code mode_code type_code form_code
120 %type <s> pathstring pathname password username
130 fromname = (char *) 0;
131 restart_point = (off_t) 0;
137 : USER SP username CRLF
142 | PASS SP password CRLF
145 memset ($3, 0, strlen($3));
148 | PORT SP host_port CRLF
155 reply(200, "PORT command successful.");
157 | EPRT SP STRING CRLF
170 | EPSV SP STRING CRLF
175 | TYPE SP type_code CRLF
180 if (cmd_form == FORM_N) {
181 reply(200, "Type set to A.");
185 reply(504, "Form must be N.");
189 reply(504, "Type E not implemented.");
193 reply(200, "Type set to I.");
199 if (cmd_bytesz == 8) {
201 "Type set to L (byte size 8).");
204 reply(504, "Byte size must be 8.");
205 #else /* NBBY == 8 */
206 UNIMPLEMENTED for NBBY != 8
207 #endif /* NBBY == 8 */
210 | STRU SP struct_code CRLF
215 reply(200, "STRU F ok.");
219 reply(504, "Unimplemented STRU type.");
222 | MODE SP mode_code CRLF
227 reply(200, "MODE S ok.");
231 reply(502, "Unimplemented MODE type.");
234 | ALLO SP NUMBER CRLF
236 reply(202, "ALLO command ignored.");
238 | ALLO SP NUMBER SP R SP NUMBER CRLF
240 reply(202, "ALLO command ignored.");
242 | RETR SP pathname CRLF check_login
246 if ($5 && name != NULL)
251 | STOR SP pathname CRLF check_login
255 if ($5 && name != NULL)
256 do_store(name, "w", 0);
260 | APPE SP pathname CRLF check_login
264 if ($5 && name != NULL)
265 do_store(name, "a", 0);
269 | NLST CRLF check_login
274 | NLST SP STRING CRLF check_login
278 if ($5 && name != NULL)
279 send_file_list(name);
283 | LIST CRLF check_login
288 | LIST SP pathname CRLF check_login
294 | sTAT SP pathname CRLF check_login
296 if ($5 && $3 != NULL)
304 if (file_size != (off_t) -1)
305 reply(213, "Status: %lu of %lu bytes transferred",
306 (unsigned long)byte_count,
307 (unsigned long)file_size);
309 reply(213, "Status: %lu bytes transferred",
310 (unsigned long)byte_count);
314 | DELE SP pathname CRLF check_login_no_guest
316 if ($5 && $3 != NULL)
321 | RNTO SP pathname CRLF check_login_no_guest
325 renamecmd(fromname, $3);
327 fromname = (char *) 0;
329 reply(503, "Bad sequence of commands.");
338 reply(426, "Transfer aborted. Data connection closed.");
339 reply(226, "Abort successful");
341 longjmp(urgcatch, 1);
343 reply(225, "ABOR command successful.");
345 | CWD CRLF check_login
350 | CWD SP pathname CRLF check_login
352 if ($5 && $3 != NULL)
359 help(cmdtab, (char *) 0);
361 | HELP SP STRING CRLF
365 if (strncasecmp(cp, "SITE", 4) == 0) {
372 help(sitetab, (char *) 0);
378 reply(200, "NOOP command successful.");
380 | MKD SP pathname CRLF check_login
382 if ($5 && $3 != NULL)
387 | RMD SP pathname CRLF check_login_no_guest
389 if ($5 && $3 != NULL)
394 | PWD CRLF check_login
399 | CDUP CRLF check_login
406 lreply(211, "Supported features:");
408 lreply(0, " REST STREAM");
412 | OPTS SP STRING CRLF
415 reply(501, "Bad options");
420 help(sitetab, (char *) 0);
422 | SITE SP HELP SP STRING CRLF
426 | SITE SP UMASK CRLF check_login
429 int oldmask = umask(0);
431 reply(200, "Current UMASK is %03o", oldmask);
434 | SITE SP UMASK SP octal_number CRLF check_login_no_guest
437 if (($5 == -1) || ($5 > 0777)) {
438 reply(501, "Bad UMASK value");
440 int oldmask = umask($5);
442 "UMASK set to %03o (was %03o)",
447 | SITE SP CHMOD SP octal_number SP pathname CRLF check_login_no_guest
449 if ($9 && $7 != NULL) {
452 "CHMOD: Mode value must be between 0 and 0777");
453 else if (chmod($7, $5) < 0)
454 perror_reply(550, $7);
456 reply(200, "CHMOD command successful.");
464 "Current IDLE time limit is %d seconds; max %d",
465 ftpd_timeout, maxtimeout);
467 | SITE SP IDLE SP NUMBER CRLF
469 if ($5 < 30 || $5 > maxtimeout) {
471 "Maximum IDLE time must be between 30 and %d seconds",
475 alarm((unsigned) ftpd_timeout);
477 "Maximum IDLE time set to %d seconds",
482 | SITE SP KAUTH SP STRING CRLF check_login
488 reply(500, "Can't be done as guest.");
490 if($7 && $5 != NULL){
491 p = strpbrk($5, " \t");
494 kauth($5, p + strspn(p, " \t"));
502 reply(500, "Command not implemented.");
505 | SITE SP KLIST CRLF check_login
511 reply(500, "Command not implemented.");
514 | SITE SP KDESTROY CRLF check_login
520 reply(500, "Command not implemented.");
523 | SITE SP KRBTKFILE SP STRING CRLF check_login
527 reply(500, "Can't be done as guest.");
533 reply(500, "Command not implemented.");
536 | SITE SP AFSLOG CRLF check_login
540 reply(500, "Can't be done as guest.");
544 reply(500, "Command not implemented.");
547 | SITE SP AFSLOG SP STRING CRLF check_login
551 reply(500, "Can't be done as guest.");
557 reply(500, "Command not implemented.");
560 | SITE SP LOCATE SP STRING CRLF check_login
569 reply(200, "http://www.pdc.kth.se/kth-krb/");
571 | STOU SP pathname CRLF check_login
573 if ($5 && $3 != NULL)
574 do_store($3, "w", 1);
580 #if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)
581 reply(215, "UNIX Type: L%d", NBBY);
583 reply(215, "UNKNOWN Type: L%d", NBBY);
588 * SIZE is not in RFC959, but Postel has blessed it and
589 * it will be in the updated RFC.
591 * Return size of file in a format suitable for
592 * using with RESTART (we just count bytes).
594 | SIZE SP pathname CRLF check_login
596 if ($5 && $3 != NULL)
603 * MDTM is not in RFC959, but Postel has blessed it and
604 * it will be in the updated RFC.
606 * Return modification time of file as an ISO 3307
607 * style time. E.g. YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx
608 * where xxx is the fractional second (of any precision,
609 * not necessarily 3 digits)
611 | MDTM SP pathname CRLF check_login
613 if ($5 && $3 != NULL) {
615 if (stat($3, &stbuf) < 0)
617 $3, strerror(errno));
618 else if (!S_ISREG(stbuf.st_mode)) {
620 "%s: not a plain file.", $3);
623 time_t mtime = stbuf.st_mtime;
627 "%04d%02d%02d%02d%02d%02d",
641 reply(221, "Goodbye.");
650 : RNFR SP pathname CRLF check_login_no_guest
652 restart_point = (off_t) 0;
654 fromname = renamefrom($3);
655 if (fromname == (char *) 0 && $3) {
660 | REST SP byte_size CRLF
662 fromname = (char *) 0;
663 restart_point = $3; /* XXX $3 is only "int" */
664 reply(350, "Restarting at %ld. %s",
666 "Send STORE or RETRIEVE to initiate transfer.");
668 | AUTH SP STRING CRLF
673 | ADAT SP STRING CRLF
678 | PBSZ SP NUMBER CRLF
682 | PROT SP STRING CRLF
695 | CONF SP STRING CRLF
697 mec($3, prot_confidential);
702 mec($3, prot_private);
714 $$ = (char *)calloc(1, sizeof(char));
724 : NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
727 struct sockaddr_in *sin = (struct sockaddr_in *)data_dest;
729 sin->sin_family = AF_INET;
730 sin->sin_port = htons($9 * 256 + $11);
731 sin->sin_addr.s_addr =
732 htonl(($1 << 24) | ($3 << 16) | ($5 << 8) | $7);
786 /* this is for a bug in the BBN ftp */
828 * Problem: this production is used for all pathname
829 * processing, but only gives a 550 error reply.
830 * This is a valid reply in some cases but not in others.
832 if (logged_in && $1 && *$1 == '~') {
835 GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
837 memset(&gl, 0, sizeof(gl));
838 if (glob($1, flags, NULL, &gl) ||
840 reply(550, "not found");
843 $$ = strdup(gl.gl_pathv[0]);
859 int ret, dec, multby, digit;
862 * Convert a number that was read as decimal number
863 * to what it would be if it had been read as octal.
874 ret += digit * multby;
883 check_login_no_guest : check_login
887 reply(550, "Permission denied");
891 check_login : check_secure
894 if(($$ = logged_in) == 0)
895 reply(530, "Please login with USER and PASS.");
901 check_secure : /* empty */
904 if(sec_complete && !secure_command()) {
906 reply(533, "Command protection level denied "
907 "for paranoid reasons.");
914 extern jmp_buf errcatch;
916 #define CMD 0 /* beginning of command */
917 #define ARGS 1 /* expect miscellaneous arguments */
918 #define STR1 2 /* expect SP followed by STRING */
919 #define STR2 3 /* expect STRING */
920 #define OSTR 4 /* optional SP then STRING */
921 #define ZSTR1 5 /* SP then optional STRING */
922 #define ZSTR2 6 /* optional STRING after SP */
923 #define SITECMD 7 /* SITE command */
924 #define NSTR 8 /* Number followed by a string */
926 struct tab cmdtab[] = { /* In order defined in RFC 765 */
927 { "USER", USER, STR1, 1, "<sp> username" },
928 { "PASS", PASS, ZSTR1, 1, "<sp> password" },
929 { "ACCT", ACCT, STR1, 0, "(specify account)" },
930 { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
931 { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
932 { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
933 { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
934 { "EPRT", EPRT, STR1, 1, "<sp> string" },
935 { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
936 { "EPSV", EPSV, OSTR, 1, "[<sp> foo]" },
937 { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
938 { "STRU", STRU, ARGS, 1, "(specify file structure)" },
939 { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
940 { "RETR", RETR, STR1, 1, "<sp> file-name" },
941 { "STOR", STOR, STR1, 1, "<sp> file-name" },
942 { "APPE", APPE, STR1, 1, "<sp> file-name" },
943 { "MLFL", MLFL, OSTR, 0, "(mail file)" },
944 { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
945 { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
946 { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
947 { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
948 { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
949 { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
950 { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
951 { "REST", REST, ARGS, 1, "<sp> offset (restart command)" },
952 { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
953 { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
954 { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
955 { "DELE", DELE, STR1, 1, "<sp> file-name" },
956 { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
957 { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
958 { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
959 { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
960 { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
961 { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
962 { "STAT", sTAT, OSTR, 1, "[ <sp> path-name ]" },
963 { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
964 { "NOOP", NOOP, ARGS, 1, "" },
965 { "MKD", MKD, STR1, 1, "<sp> path-name" },
966 { "XMKD", MKD, STR1, 1, "<sp> path-name" },
967 { "RMD", RMD, STR1, 1, "<sp> path-name" },
968 { "XRMD", RMD, STR1, 1, "<sp> path-name" },
969 { "PWD", PWD, ARGS, 1, "(return current directory)" },
970 { "XPWD", PWD, ARGS, 1, "(return current directory)" },
971 { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
972 { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
973 { "STOU", STOU, STR1, 1, "<sp> file-name" },
974 { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
975 { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
977 /* extensions from RFC2228 */
978 { "AUTH", AUTH, STR1, 1, "<sp> auth-type" },
979 { "ADAT", ADAT, STR1, 1, "<sp> auth-data" },
980 { "PBSZ", PBSZ, ARGS, 1, "<sp> buffer-size" },
981 { "PROT", PROT, STR1, 1, "<sp> prot-level" },
982 { "CCC", CCC, ARGS, 1, "" },
983 { "MIC", MIC, STR1, 1, "<sp> integrity command" },
984 { "CONF", CONF, STR1, 1, "<sp> confidentiality command" },
985 { "ENC", ENC, STR1, 1, "<sp> privacy command" },
988 { "FEAT", FEAT, ARGS, 1, "" },
989 { "OPTS", OPTS, ARGS, 1, "<sp> command [<sp> options]" },
994 struct tab sitetab[] = {
995 { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
996 { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
997 { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
998 { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
1000 { "KAUTH", KAUTH, STR1, 1, "<sp> principal [ <sp> ticket ]" },
1001 { "KLIST", KLIST, ARGS, 1, "(show ticket file)" },
1002 { "KDESTROY", KDESTROY, ARGS, 1, "(destroy tickets)" },
1003 { "KRBTKFILE", KRBTKFILE, STR1, 1, "<sp> ticket-file" },
1004 { "AFSLOG", AFSLOG, OSTR, 1, "[<sp> cell]" },
1006 { "LOCATE", LOCATE, STR1, 1, "<sp> globexpr" },
1007 { "FIND", LOCATE, STR1, 1, "<sp> globexpr" },
1009 { "URL", URL, ARGS, 1, "?" },
1011 { NULL, 0, 0, 0, 0 }
1015 lookup(struct tab *p, char *cmd)
1018 for (; p->name != NULL; p++)
1019 if (strcmp(cmd, p->name) == 0)
1025 * ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.
1028 ftpd_getline(char *s, int n)
1034 /* tmpline may contain saved command from urgent mode interruption */
1036 strlcpy(s, ftp_command, n);
1038 syslog(LOG_DEBUG, "command: %s", s);
1040 fprintf(stderr, "%s\n", s);
1044 while ((c = getc(stdin)) != EOF) {
1047 if ((c = getc(stdin)) != EOF) {
1053 printf("%c%c%c", IAC, DONT, 0377&c);
1059 printf("%c%c%c", IAC, WONT, 0377&c);
1065 continue; /* ignore command */
1070 if (--n <= 0 || c == '\n')
1073 if (c == EOF && cs == s)
1077 if (!guest && strncasecmp("pass ", s, 5) == 0) {
1078 /* Don't syslog passwords */
1079 syslog(LOG_DEBUG, "command: %.5s ???", s);
1084 /* Don't syslog trailing CR-LF */
1087 while (cp >= s && (*cp == '\n' || *cp == '\r')) {
1091 syslog(LOG_DEBUG, "command: %.*s", len, s);
1095 fprintf(stderr, "%s\n", s);
1105 "Timeout (%d seconds): closing control connection.",
1108 syslog(LOG_INFO, "User %s timed out after %d seconds",
1109 (pw ? pw -> pw_name : "unknown"), ftpd_timeout);
1117 static int cpos, state;
1127 signal(SIGALRM, toolong);
1128 alarm((unsigned) ftpd_timeout);
1129 if (ftpd_getline(cbuf, sizeof(cbuf)-1) == NULL) {
1130 reply(221, "You could at least say goodbye.");
1134 #ifdef HAVE_SETPROCTITLE
1135 if (strncasecmp(cbuf, "PASS", 4) != NULL)
1136 setproctitle("%s: %s", proctitle, cbuf);
1137 #endif /* HAVE_SETPROCTITLE */
1138 if ((cp = strchr(cbuf, '\r'))) {
1142 if ((cp = strpbrk(cbuf, " \n")))
1149 p = lookup(cmdtab, cbuf);
1152 if (p->implemented == 0) {
1154 longjmp(errcatch,0);
1164 if (cbuf[cpos] == ' ') {
1169 if ((cp2 = strpbrk(cp, " \n")))
1174 p = lookup(sitetab, cp);
1177 if (p->implemented == 0) {
1180 longjmp(errcatch,0);
1191 if (cbuf[cpos] == '\n') {
1200 if (cbuf[cpos] == ' ') {
1211 if (cbuf[cpos] == '\n') {
1222 * Make sure the string is nonempty and \n terminated.
1224 if (n > 1 && cbuf[cpos] == '\n') {
1226 yylval.s = copy(cp);
1234 if (cbuf[cpos] == ' ') {
1238 if (isdigit(cbuf[cpos])) {
1240 while (isdigit(cbuf[++cpos]))
1244 yylval.i = atoi(cp);
1253 if (isdigit(cbuf[cpos])) {
1255 while (isdigit(cbuf[++cpos]))
1259 yylval.i = atoi(cp);
1263 switch (cbuf[cpos++]) {
1327 fatal("Unknown state in scanner.");
1329 yyerror((char *) 0);
1331 longjmp(errcatch,0);
1342 fatal("Ran out of memory.");
1347 help(struct tab *ctab, char *s)
1354 if (ctab == sitetab)
1358 width = 0, NCMDS = 0;
1359 for (c = ctab; c->name != NULL; c++) {
1360 int len = strlen(c->name);
1366 width = (width + 8) &~ 7;
1371 lreply(214, "The following %scommands are recognized %s.",
1372 type, "(* =>'s unimplemented)");
1373 columns = 76 / width;
1376 lines = (NCMDS + columns - 1) / columns;
1377 for (i = 0; i < lines; i++) {
1378 strlcpy (buf, " ", sizeof(buf));
1379 for (j = 0; j < columns; j++) {
1380 c = ctab + j * lines + i;
1381 snprintf (buf + strlen(buf),
1382 sizeof(buf) - strlen(buf),
1385 c->implemented ? ' ' : '*');
1386 if (c + lines >= &ctab[NCMDS])
1388 w = strlen(c->name) + 1;
1396 lreply(214, "%s", buf);
1398 reply(214, "Direct comments to kth-krb-bugs@pdc.kth.se");
1402 c = lookup(ctab, s);
1403 if (c == (struct tab *)0) {
1404 reply(502, "Unknown command %s.", s);
1408 reply(214, "Syntax: %s%s %s", type, c->name, c->help);
1410 reply(214, "%s%-*s\t%s; unimplemented.", type, width,
1415 sizecmd(char *filename)
1421 if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
1422 reply(550, "%s: not a plain file.", filename);
1424 reply(213, "%lu", (unsigned long)stbuf.st_size);
1432 fin = fopen(filename, "r");
1434 perror_reply(550, filename);
1437 if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
1438 reply(550, "%s: not a plain file.", filename);
1444 while((c=getc(fin)) != EOF) {
1445 if (c == '\n') /* will get expanded to \r\n */
1451 reply(213, "%lu", (unsigned long)count);
1455 reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);