Deleted Added
full compact
ftpcmd.y (88935) ftpcmd.y (89935)
1/*
2 * Copyright (c) 1985, 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 31 unchanged lines hidden (view full) ---

40
41%{
42
43#ifndef lint
44#if 0
45static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
46#endif
47static const char rcsid[] =
1/*
2 * Copyright (c) 1985, 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 31 unchanged lines hidden (view full) ---

40
41%{
42
43#ifndef lint
44#if 0
45static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
46#endif
47static const char rcsid[] =
48 "$FreeBSD: head/libexec/ftpd/ftpcmd.y 88935 2002-01-05 20:13:01Z dwmalone $";
48 "$FreeBSD: head/libexec/ftpd/ftpcmd.y 89935 2002-01-28 19:28:14Z yar $";
49#endif /* not lint */
50
51#include <sys/param.h>
52#include <sys/socket.h>
53#include <sys/stat.h>
54
55#include <netinet/in.h>
56#include <arpa/ftp.h>
57
58#include <ctype.h>
59#include <errno.h>
60#include <glob.h>
61#include <netdb.h>
62#include <pwd.h>
49#endif /* not lint */
50
51#include <sys/param.h>
52#include <sys/socket.h>
53#include <sys/stat.h>
54
55#include <netinet/in.h>
56#include <arpa/ftp.h>
57
58#include <ctype.h>
59#include <errno.h>
60#include <glob.h>
61#include <netdb.h>
62#include <pwd.h>
63#include <setjmp.h>
64#include <signal.h>
65#include <stdio.h>
66#include <stdlib.h>
67#include <string.h>
68#include <syslog.h>
69#include <time.h>
70#include <unistd.h>
71#include <libutil.h>

--- 24 unchanged lines hidden (view full) ---

96extern int noretr;
97extern int noguestretr;
98
99off_t restart_point;
100
101static int cmd_type;
102static int cmd_form;
103static int cmd_bytesz;
63#include <signal.h>
64#include <stdio.h>
65#include <stdlib.h>
66#include <string.h>
67#include <syslog.h>
68#include <time.h>
69#include <unistd.h>
70#include <libutil.h>

--- 24 unchanged lines hidden (view full) ---

95extern int noretr;
96extern int noguestretr;
97
98off_t restart_point;
99
100static int cmd_type;
101static int cmd_form;
102static int cmd_bytesz;
103static int state;
104char cbuf[512];
105char *fromname = (char *) 0;
106
107extern int epsvall;
108
109%}
110
111%union {

--- 633 unchanged lines hidden (view full) ---

745 if ($4 != NULL)
746 free($4);
747 }
748 | QUIT CRLF
749 {
750 reply(221, "Goodbye.");
751 dologout(0);
752 }
104char cbuf[512];
105char *fromname = (char *) 0;
106
107extern int epsvall;
108
109%}
110
111%union {

--- 633 unchanged lines hidden (view full) ---

745 if ($4 != NULL)
746 free($4);
747 }
748 | QUIT CRLF
749 {
750 reply(221, "Goodbye.");
751 dologout(0);
752 }
753 | error CRLF
753 | error
754 {
754 {
755 yyerrok;
755 yyclearin; /* discard lookahead data */
756 yyerrok; /* clear error condition */
757 state = 0; /* reset lexer state */
756 }
757 ;
758rcmd
759 : RNFR check_login_ro SP pathname CRLF
760 {
761 restart_point = (off_t) 0;
762 if ($2 && $4) {
763 if (fromname)

--- 278 unchanged lines hidden (view full) ---

1042 }
1043 else
1044 $$ = check_login1();
1045 }
1046 ;
1047
1048%%
1049
758 }
759 ;
760rcmd
761 : RNFR check_login_ro SP pathname CRLF
762 {
763 restart_point = (off_t) 0;
764 if ($2 && $4) {
765 if (fromname)

--- 278 unchanged lines hidden (view full) ---

1044 }
1045 else
1046 $$ = check_login1();
1047 }
1048 ;
1049
1050%%
1051
1050extern jmp_buf errcatch;
1051
1052#define CMD 0 /* beginning of command */
1053#define ARGS 1 /* expect miscellaneous arguments */
1054#define STR1 2 /* expect SP followed by STRING */
1055#define STR2 3 /* expect STRING */
1056#define OSTR 4 /* optional SP then STRING */
1057#define ZSTR1 5 /* optional SP then optional STRING */
1058#define ZSTR2 6 /* optional STRING after SP */
1059#define SITECMD 7 /* SITE command */

--- 188 unchanged lines hidden (view full) ---

1248 syslog(LOG_INFO, "User %s timed out after %d seconds",
1249 (pw ? pw -> pw_name : "unknown"), timeout);
1250 dologout(1);
1251}
1252
1253static int
1254yylex()
1255{
1052#define CMD 0 /* beginning of command */
1053#define ARGS 1 /* expect miscellaneous arguments */
1054#define STR1 2 /* expect SP followed by STRING */
1055#define STR2 3 /* expect STRING */
1056#define OSTR 4 /* optional SP then STRING */
1057#define ZSTR1 5 /* optional SP then optional STRING */
1058#define ZSTR2 6 /* optional STRING after SP */
1059#define SITECMD 7 /* SITE command */

--- 188 unchanged lines hidden (view full) ---

1248 syslog(LOG_INFO, "User %s timed out after %d seconds",
1249 (pw ? pw -> pw_name : "unknown"), timeout);
1250 dologout(1);
1251}
1252
1253static int
1254yylex()
1255{
1256 static int cpos, state;
1256 static int cpos;
1257 char *cp, *cp2;
1258 struct tab *p;
1259 int n;
1260 char c;
1261
1262 for (;;) {
1263 switch (state) {
1264

--- 20 unchanged lines hidden (view full) ---

1285 c = cbuf[cpos];
1286 cbuf[cpos] = '\0';
1287 upper(cbuf);
1288 p = lookup(cmdtab, cbuf);
1289 cbuf[cpos] = c;
1290 if (p != 0) {
1291 if (p->implemented == 0) {
1292 nack(p->name);
1257 char *cp, *cp2;
1258 struct tab *p;
1259 int n;
1260 char c;
1261
1262 for (;;) {
1263 switch (state) {
1264

--- 20 unchanged lines hidden (view full) ---

1285 c = cbuf[cpos];
1286 cbuf[cpos] = '\0';
1287 upper(cbuf);
1288 p = lookup(cmdtab, cbuf);
1289 cbuf[cpos] = c;
1290 if (p != 0) {
1291 if (p->implemented == 0) {
1292 nack(p->name);
1293 longjmp(errcatch,0);
1294 /* NOTREACHED */
1293 return (LEXERR);
1295 }
1296 state = p->state;
1297 yylval.s = p->name;
1298 return (p->token);
1299 }
1300 break;
1301
1302 case SITECMD:

--- 8 unchanged lines hidden (view full) ---

1311 cbuf[cpos] = '\0';
1312 upper(cp);
1313 p = lookup(sitetab, cp);
1314 cbuf[cpos] = c;
1315 if (guest == 0 && p != 0) {
1316 if (p->implemented == 0) {
1317 state = CMD;
1318 nack(p->name);
1294 }
1295 state = p->state;
1296 yylval.s = p->name;
1297 return (p->token);
1298 }
1299 break;
1300
1301 case SITECMD:

--- 8 unchanged lines hidden (view full) ---

1310 cbuf[cpos] = '\0';
1311 upper(cp);
1312 p = lookup(sitetab, cp);
1313 cbuf[cpos] = c;
1314 if (guest == 0 && p != 0) {
1315 if (p->implemented == 0) {
1316 state = CMD;
1317 nack(p->name);
1319 longjmp(errcatch,0);
1320 /* NOTREACHED */
1318 return (LEXERR);
1321 }
1322 state = p->state;
1323 yylval.s = p->name;
1324 return (p->token);
1325 }
1326 state = CMD;
1327 break;
1328

--- 133 unchanged lines hidden (view full) ---

1462 return (T);
1463
1464 }
1465 break;
1466
1467 default:
1468 fatalerror("Unknown state in scanner.");
1469 }
1319 }
1320 state = p->state;
1321 yylval.s = p->name;
1322 return (p->token);
1323 }
1324 state = CMD;
1325 break;
1326

--- 133 unchanged lines hidden (view full) ---

1460 return (T);
1461
1462 }
1463 break;
1464
1465 default:
1466 fatalerror("Unknown state in scanner.");
1467 }
1470 yyerror((char *) 0);
1471 state = CMD;
1468 state = CMD;
1472 longjmp(errcatch,0);
1469 return (LEXERR);
1473 }
1474}
1475
1476void
1477upper(s)
1478 char *s;
1479{
1480 while (*s != '\0') {

--- 235 unchanged lines hidden ---
1470 }
1471}
1472
1473void
1474upper(s)
1475 char *s;
1476{
1477 while (*s != '\0') {

--- 235 unchanged lines hidden ---