1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "2.3"
53 #define YYSKELETON_NAME "yacc.c"
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
227 #define KRBTKFILE 331
240 /* Copy the first part of user declarations. */
244 #include "ftpd_locl.h"
249 static int hasyyerrored;
254 static int cmd_bytesz;
262 short implemented; /* 1 if command is implemented */
266 extern struct tab cmdtab[];
267 extern struct tab sitetab[];
269 static char *copy (char *);
270 static void help (struct tab *, char *);
272 lookup (struct tab *, char *);
273 static void sizecmd (char *);
274 static RETSIGTYPE toolong (int);
275 static int yylex (void);
277 /* This is for bison */
279 #if !defined(alloca) && !defined(HAVE_ALLOCA)
280 #define alloca(x) malloc(x)
285 /* Enabling traces. */
290 /* Enabling verbose error messages. */
291 #ifdef YYERROR_VERBOSE
292 # undef YYERROR_VERBOSE
293 # define YYERROR_VERBOSE 1
295 # define YYERROR_VERBOSE 0
298 /* Enabling the token table. */
299 #ifndef YYTOKEN_TABLE
300 # define YYTOKEN_TABLE 0
303 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
304 typedef union YYSTYPE
310 /* Line 193 of yacc.c. */
313 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
314 # define YYSTYPE_IS_DECLARED 1
315 # define YYSTYPE_IS_TRIVIAL 1
320 /* Copy the second part of user declarations. */
323 /* Line 216 of yacc.c. */
331 typedef YYTYPE_UINT8 yytype_uint8;
333 typedef unsigned char yytype_uint8;
337 typedef YYTYPE_INT8 yytype_int8;
338 #elif (defined __STDC__ || defined __C99__FUNC__ \
339 || defined __cplusplus || defined _MSC_VER)
340 typedef signed char yytype_int8;
342 typedef short int yytype_int8;
346 typedef YYTYPE_UINT16 yytype_uint16;
348 typedef unsigned short int yytype_uint16;
352 typedef YYTYPE_INT16 yytype_int16;
354 typedef short int yytype_int16;
358 # ifdef __SIZE_TYPE__
359 # define YYSIZE_T __SIZE_TYPE__
360 # elif defined size_t
361 # define YYSIZE_T size_t
362 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
363 || defined __cplusplus || defined _MSC_VER)
364 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
365 # define YYSIZE_T size_t
367 # define YYSIZE_T unsigned int
371 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
374 # if defined YYENABLE_NLS && YYENABLE_NLS
376 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
377 # define YY_(msgid) dgettext ("bison-runtime", msgid)
381 # define YY_(msgid) msgid
385 /* Suppress unused-variable warnings by "using" E. */
386 #if ! defined lint || defined __GNUC__
387 # define YYUSE(e) ((void) (e))
389 # define YYUSE(e) /* empty */
392 /* Identity function, used to suppress warnings about constant conditions. */
396 #if (defined __STDC__ || defined __C99__FUNC__ \
397 || defined __cplusplus || defined _MSC_VER)
410 #if ! defined yyoverflow || YYERROR_VERBOSE
412 /* The parser invokes alloca or malloc; define the necessary symbols. */
414 # ifdef YYSTACK_USE_ALLOCA
415 # if YYSTACK_USE_ALLOCA
417 # define YYSTACK_ALLOC __builtin_alloca
418 # elif defined __BUILTIN_VA_ARG_INCR
419 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
421 # define YYSTACK_ALLOC __alloca
422 # elif defined _MSC_VER
423 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
424 # define alloca _alloca
426 # define YYSTACK_ALLOC alloca
427 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
428 || defined __cplusplus || defined _MSC_VER)
429 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
438 # ifdef YYSTACK_ALLOC
439 /* Pacify GCC's `empty if-body' warning. */
440 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
441 # ifndef YYSTACK_ALLOC_MAXIMUM
442 /* The OS might guarantee only one guard page at the bottom of the stack,
443 and a page size can be as small as 4096 bytes. So we cannot safely
444 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
445 to allow for a few compiler-allocated temporary stack slots. */
446 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
449 # define YYSTACK_ALLOC YYMALLOC
450 # define YYSTACK_FREE YYFREE
451 # ifndef YYSTACK_ALLOC_MAXIMUM
452 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
454 # if (defined __cplusplus && ! defined _STDLIB_H \
455 && ! ((defined YYMALLOC || defined malloc) \
456 && (defined YYFREE || defined free)))
457 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
463 # define YYMALLOC malloc
464 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
465 || defined __cplusplus || defined _MSC_VER)
466 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
471 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
472 || defined __cplusplus || defined _MSC_VER)
473 void free (void *); /* INFRINGES ON USER NAME SPACE */
477 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
480 #if (! defined yyoverflow \
481 && (! defined __cplusplus \
482 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
484 /* A type that is properly aligned for any stack member. */
491 /* The size of the maximum gap between one aligned stack and the next. */
492 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
494 /* The size of an array large to enough to hold all stacks, each with
496 # define YYSTACK_BYTES(N) \
497 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
498 + YYSTACK_GAP_MAXIMUM)
500 /* Copy COUNT objects from FROM to TO. The source and destination do
503 # if defined __GNUC__ && 1 < __GNUC__
504 # define YYCOPY(To, From, Count) \
505 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
507 # define YYCOPY(To, From, Count) \
511 for (yyi = 0; yyi < (Count); yyi++) \
512 (To)[yyi] = (From)[yyi]; \
518 /* Relocate STACK from its old location to the new one. The
519 local variables YYSIZE and YYSTACKSIZE give the old and new number of
520 elements in the stack, and YYPTR gives the new location of the
521 stack. Advance YYPTR to a properly aligned location for the next
523 # define YYSTACK_RELOCATE(Stack) \
526 YYSIZE_T yynewbytes; \
527 YYCOPY (&yyptr->Stack, Stack, yysize); \
528 Stack = &yyptr->Stack; \
529 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
530 yyptr += yynewbytes / sizeof (*yyptr); \
536 /* YYFINAL -- State number of the termination state. */
538 /* YYLAST -- Last index in YYTABLE. */
541 /* YYNTOKENS -- Number of terminals. */
543 /* YYNNTS -- Number of nonterminals. */
545 /* YYNRULES -- Number of rules. */
547 /* YYNRULES -- Number of states. */
548 #define YYNSTATES 317
550 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
552 #define YYMAXUTOK 339
554 #define YYTRANSLATE(YYX) \
555 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
557 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
558 static const yytype_uint8 yytranslate[] =
560 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
586 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
587 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
588 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
589 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
590 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
591 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
592 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
593 75, 76, 77, 78, 79, 80, 81, 82, 83, 84
597 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
599 static const yytype_uint16 yyprhs[] =
601 0, 0, 3, 4, 7, 10, 16, 22, 28, 34,
602 38, 42, 48, 54, 60, 66, 72, 82, 88, 94,
603 100, 104, 110, 114, 120, 126, 130, 136, 142, 146,
604 150, 156, 160, 166, 170, 176, 182, 186, 190, 194,
605 200, 206, 214, 220, 228, 238, 244, 252, 260, 266,
606 272, 280, 286, 294, 302, 308, 314, 318, 324, 330,
607 334, 337, 343, 349, 354, 359, 365, 371, 375, 380,
608 385, 390, 392, 393, 395, 397, 409, 411, 413, 415,
609 417, 421, 423, 427, 429, 431, 435, 438, 440, 442,
610 444, 446, 448, 450, 452, 454, 456, 458, 460
613 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
614 static const yytype_int8 yyrhs[] =
616 86, 0, -1, -1, 86, 87, -1, 86, 88, -1,
617 18, 15, 89, 16, 102, -1, 19, 15, 90, 16,
618 102, -1, 23, 15, 92, 16, 102, -1, 60, 15,
619 83, 16, 102, -1, 24, 16, 101, -1, 61, 16,
620 101, -1, 61, 15, 83, 16, 101, -1, 25, 15,
621 94, 16, 102, -1, 26, 15, 95, 16, 102, -1,
622 27, 15, 96, 16, 102, -1, 38, 15, 84, 16,
623 102, -1, 38, 15, 84, 15, 12, 15, 84, 16,
624 102, -1, 28, 15, 97, 16, 101, -1, 29, 15,
625 97, 16, 101, -1, 30, 15, 97, 16, 101, -1,
626 46, 16, 101, -1, 46, 15, 83, 16, 101, -1,
627 45, 16, 101, -1, 45, 15, 97, 16, 101, -1,
628 48, 15, 97, 16, 101, -1, 48, 16, 102, -1,
629 43, 15, 97, 16, 100, -1, 41, 15, 97, 16,
630 100, -1, 42, 16, 102, -1, 44, 16, 101, -1,
631 44, 15, 97, 16, 101, -1, 49, 16, 102, -1,
632 49, 15, 83, 16, 102, -1, 50, 16, 102, -1,
633 51, 15, 97, 16, 101, -1, 52, 15, 97, 16,
634 100, -1, 53, 16, 101, -1, 54, 16, 101, -1,
635 80, 16, 102, -1, 81, 15, 83, 16, 102, -1,
636 47, 15, 49, 16, 102, -1, 47, 15, 49, 15,
637 83, 16, 102, -1, 47, 15, 62, 16, 101, -1,
638 47, 15, 62, 15, 99, 16, 100, -1, 47, 15,
639 64, 15, 99, 15, 97, 16, 100, -1, 47, 15,
640 63, 16, 102, -1, 47, 15, 63, 15, 84, 16,
641 102, -1, 47, 15, 73, 15, 83, 16, 101, -1,
642 47, 15, 74, 16, 101, -1, 47, 15, 75, 16,
643 101, -1, 47, 15, 76, 15, 83, 16, 101, -1,
644 47, 15, 77, 16, 101, -1, 47, 15, 77, 15,
645 83, 16, 101, -1, 47, 15, 78, 15, 83, 16,
646 101, -1, 47, 15, 79, 16, 102, -1, 55, 15,
647 97, 16, 101, -1, 57, 16, 102, -1, 58, 15,
648 97, 16, 101, -1, 59, 15, 97, 16, 101, -1,
649 22, 16, 102, -1, 1, 16, -1, 40, 15, 97,
650 16, 100, -1, 39, 15, 91, 16, 102, -1, 65,
651 15, 83, 16, -1, 66, 15, 83, 16, -1, 68,
652 15, 84, 16, 102, -1, 67, 15, 83, 16, 102,
653 -1, 69, 16, 102, -1, 70, 15, 83, 16, -1,
654 71, 15, 83, 16, -1, 72, 15, 83, 16, -1,
655 83, -1, -1, 83, -1, 84, -1, 84, 17, 84,
656 17, 84, 17, 84, 17, 84, 17, 84, -1, 10,
657 -1, 14, -1, 5, -1, 3, -1, 3, 15, 93,
658 -1, 6, -1, 6, 15, 93, -1, 8, -1, 9,
659 -1, 9, 15, 91, -1, 9, 91, -1, 7, -1,
660 12, -1, 11, -1, 13, -1, 4, -1, 5, -1,
661 98, -1, 83, -1, 84, -1, 101, -1, 102, -1,
665 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
666 static const yytype_uint16 yyrline[] =
668 0, 129, 129, 131, 136, 140, 146, 154, 175, 181,
669 186, 191, 197, 234, 248, 262, 268, 274, 283, 292,
670 301, 306, 315, 320, 326, 333, 338, 345, 359, 364,
671 373, 380, 385, 402, 407, 414, 421, 426, 431, 441,
672 448, 453, 458, 466, 479, 493, 500, 517, 521, 526,
673 530, 534, 545, 558, 565, 570, 577, 595, 612, 640,
674 647, 653, 663, 673, 678, 683, 688, 693, 698, 703,
675 708, 716, 721, 724, 728, 732, 745, 749, 753, 760,
676 765, 770, 775, 780, 784, 789, 795, 803, 807, 811,
677 818, 822, 826, 833, 861, 865, 891, 899, 910
681 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
682 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
683 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
684 static const char *const yytname[] =
686 "$end", "error", "$undefined", "A", "B", "C", "E", "F", "I", "L", "N",
687 "P", "R", "S", "T", "SP", "CRLF", "COMMA", "USER", "PASS", "ACCT",
688 "REIN", "QUIT", "PORT", "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR",
689 "APPE", "MLFL", "MAIL", "MSND", "MSOM", "MSAM", "MRSQ", "MRCP", "ALLO",
690 "REST", "RNFR", "RNTO", "ABOR", "DELE", "CWD", "LIST", "NLST", "SITE",
691 "sTAT", "HELP", "NOOP", "MKD", "RMD", "PWD", "CDUP", "STOU", "SMNT",
692 "SYST", "SIZE", "MDTM", "EPRT", "EPSV", "UMASK", "IDLE", "CHMOD", "AUTH",
693 "ADAT", "PROT", "PBSZ", "CCC", "MIC", "CONF", "ENC", "KAUTH", "KLIST",
694 "KDESTROY", "KRBTKFILE", "AFSLOG", "LOCATE", "URL", "FEAT", "OPTS",
695 "LEXERR", "STRING", "NUMBER", "$accept", "cmd_list", "cmd", "rcmd",
696 "username", "password", "byte_size", "host_port", "form_code",
697 "type_code", "struct_code", "mode_code", "pathname", "pathstring",
698 "octal_number", "check_login_no_guest", "check_login", "check_secure", 0
703 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
705 static const yytype_uint16 yytoknum[] =
707 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
708 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
709 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
710 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
711 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
712 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
713 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
714 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
715 335, 336, 337, 338, 339
719 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
720 static const yytype_uint8 yyr1[] =
722 0, 85, 86, 86, 86, 87, 87, 87, 87, 87,
723 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
724 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
725 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
726 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
727 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
728 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
729 88, 89, 90, 90, 91, 92, 93, 93, 93, 94,
730 94, 94, 94, 94, 94, 94, 94, 95, 95, 95,
731 96, 96, 96, 97, 98, 99, 100, 101, 102
734 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
735 static const yytype_uint8 yyr2[] =
737 0, 2, 0, 2, 2, 5, 5, 5, 5, 3,
738 3, 5, 5, 5, 5, 5, 9, 5, 5, 5,
739 3, 5, 3, 5, 5, 3, 5, 5, 3, 3,
740 5, 3, 5, 3, 5, 5, 3, 3, 3, 5,
741 5, 7, 5, 7, 9, 5, 7, 7, 5, 5,
742 7, 5, 7, 7, 5, 5, 3, 5, 5, 3,
743 2, 5, 5, 4, 4, 5, 5, 3, 4, 4,
744 4, 1, 0, 1, 1, 11, 1, 1, 1, 1,
745 3, 1, 3, 1, 1, 3, 2, 1, 1, 1,
746 1, 1, 1, 1, 1, 1, 1, 1, 0
749 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
750 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
751 means the default is an error. */
752 static const yytype_uint8 yydefact[] =
754 2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
755 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
756 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
757 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
758 0, 0, 0, 0, 0, 0, 0, 0, 3, 4,
759 60, 0, 72, 98, 0, 98, 0, 0, 0, 0,
760 0, 0, 0, 0, 0, 0, 98, 0, 0, 98,
761 0, 98, 0, 98, 0, 0, 98, 0, 98, 98,
762 0, 0, 98, 98, 0, 98, 0, 0, 0, 0,
763 98, 0, 0, 0, 0, 98, 0, 0, 0, 98,
764 0, 71, 0, 73, 0, 59, 0, 0, 9, 97,
765 79, 81, 83, 84, 0, 87, 89, 88, 0, 91,
766 92, 90, 0, 94, 0, 93, 0, 0, 0, 74,
767 0, 0, 0, 28, 0, 0, 29, 0, 22, 0,
768 20, 0, 0, 0, 0, 0, 0, 0, 0, 0,
769 0, 0, 0, 25, 0, 31, 33, 0, 0, 36,
770 37, 0, 56, 0, 0, 0, 0, 10, 0, 0,
771 0, 0, 67, 0, 0, 0, 38, 0, 98, 98,
772 0, 98, 0, 0, 0, 86, 98, 98, 98, 98,
773 98, 98, 0, 98, 98, 98, 98, 98, 98, 98,
774 98, 0, 98, 0, 98, 0, 98, 0, 0, 98,
775 98, 0, 0, 98, 0, 98, 98, 98, 98, 98,
776 98, 98, 98, 98, 98, 63, 64, 98, 98, 68,
777 69, 70, 98, 5, 6, 0, 7, 78, 76, 77,
778 80, 82, 85, 12, 13, 14, 17, 18, 19, 0,
779 15, 62, 61, 96, 27, 26, 30, 23, 21, 0,
780 40, 95, 0, 42, 0, 45, 0, 0, 48, 49,
781 0, 0, 51, 0, 54, 24, 32, 34, 35, 55,
782 57, 58, 8, 11, 66, 65, 39, 0, 0, 98,
783 98, 98, 0, 98, 98, 98, 98, 0, 0, 41,
784 43, 46, 0, 47, 50, 52, 53, 0, 98, 98,
785 0, 16, 44, 0, 0, 0, 75
788 /* YYDEFGOTO[NTERM-NUM]. */
789 static const yytype_int16 yydefgoto[] =
791 -1, 1, 48, 49, 102, 104, 130, 107, 240, 114,
792 118, 122, 124, 125, 262, 252, 253, 109
795 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
797 #define YYPACT_NINF -196
798 static const yytype_int16 yypact[] =
800 -196, 246, -196, 3, 13, 20, 11, 24, 21, 26,
801 30, 45, 66, 67, 68, 69, 70, 71, 72, 76,
802 73, -7, -5, 15, 78, 28, 32, 80, 79, 82,
803 83, 91, 93, 94, 96, 97, 98, 38, 100, 101,
804 102, 103, 104, 106, 107, 108, 111, 109, -196, -196,
805 -196, -66, 36, -196, 14, -196, 12, 22, 1, 46,
806 46, 46, 25, 48, 46, 46, -196, 46, 46, -196,
807 46, -196, 53, -196, 27, 46, -196, 55, -196, -196,
808 46, 46, -196, -196, 46, -196, 46, 46, 56, 59,
809 -196, 60, 61, 62, 63, -196, 65, 77, 85, -196,
810 86, -196, 114, -196, 115, -196, 120, 130, -196, -196,
811 135, 136, -196, -11, 138, -196, -196, -196, 139, -196,
812 -196, -196, 143, -196, 145, -196, 147, 156, 47, -196,
813 157, 162, 165, -196, 166, 168, -196, 170, -196, 174,
814 -196, 49, 52, 54, 137, 177, 178, 179, 181, 64,
815 182, 183, 184, -196, 185, -196, -196, 186, 187, -196,
816 -196, 188, -196, 189, 190, 191, 192, -196, 193, 194,
817 195, 196, -196, 197, 198, 199, -196, 200, -196, -196,
818 133, -196, 2, 2, 48, -196, -196, -196, -196, -196,
819 -196, -196, 206, -196, -196, -196, -196, -196, -196, -196,
820 -196, 110, -196, 140, -196, 141, -196, 140, 144, -196,
821 -196, 146, 148, -196, 149, -196, -196, -196, -196, -196,
822 -196, -196, -196, -196, -196, -196, -196, -196, -196, -196,
823 -196, -196, -196, -196, -196, 202, -196, -196, -196, -196,
824 -196, -196, -196, -196, -196, -196, -196, -196, -196, 205,
825 -196, -196, -196, -196, -196, -196, -196, -196, -196, 207,
826 -196, -196, 210, -196, 212, -196, 215, 217, -196, -196,
827 218, 219, -196, 221, -196, -196, -196, -196, -196, -196,
828 -196, -196, -196, -196, -196, -196, -196, 155, 158, -196,
829 -196, -196, 46, -196, -196, -196, -196, 204, 224, -196,
830 -196, -196, 225, -196, -196, -196, -196, 159, -196, -196,
831 227, -196, -196, 161, 231, 167, -196
834 /* YYPGOTO[NTERM-NUM]. */
835 static const yytype_int16 yypgoto[] =
837 -196, -196, -196, -196, -196, -196, -110, -196, 39, -196,
838 -196, -196, -9, -196, 42, -195, -33, -53
841 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
842 positive, shift that token. If negative, reduce the rule which
843 number is the opposite. If zero, do what YYDEFACT says.
844 If YYTABLE_NINF, syntax error. */
845 #define YYTABLE_NINF -1
846 static const yytype_uint16 yytable[] =
848 105, 254, 255, 185, 184, 119, 120, 237, 68, 69,
849 70, 71, 238, 133, 121, 110, 239, 101, 111, 50,
850 112, 113, 108, 153, 278, 155, 156, 53, 51, 115,
851 72, 73, 162, 116, 117, 52, 136, 55, 138, 54,
852 140, 56, 172, 75, 76, 57, 176, 77, 78, 159,
853 160, 126, 127, 89, 90, 131, 132, 167, 134, 135,
854 58, 137, 192, 193, 201, 202, 152, 203, 204, 205,
855 206, 157, 158, 129, 242, 161, 141, 163, 164, 212,
856 213, 59, 60, 61, 62, 63, 64, 65, 67, 142,
857 143, 144, 66, 74, 80, 300, 79, 81, 106, 82,
858 145, 146, 147, 148, 149, 150, 151, 83, 84, 128,
859 85, 86, 87, 88, 312, 91, 92, 93, 94, 103,
860 95, 96, 97, 98, 100, 233, 234, 99, 236, 123,
861 178, 179, 129, 243, 244, 245, 139, 180, 154, 165,
862 250, 251, 166, 168, 169, 170, 181, 171, 173, 260,
863 182, 183, 207, 265, 186, 187, 246, 247, 248, 188,
864 174, 189, 274, 190, 276, 256, 257, 258, 175, 177,
865 282, 263, 191, 194, 284, 285, 268, 269, 195, 286,
866 272, 196, 197, 275, 198, 277, 199, 279, 280, 281,
867 200, 283, 208, 259, 209, 210, 211, 214, 0, 215,
868 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
869 226, 227, 228, 229, 230, 231, 232, 235, 249, 287,
870 288, 307, 241, 289, 261, 264, 290, 267, 291, 270,
871 292, 271, 273, 293, 294, 295, 299, 296, 301, 297,
872 308, 309, 298, 310, 313, 314, 2, 3, 315, 266,
873 0, 316, 0, 0, 0, 311, 0, 0, 0, 0,
874 303, 304, 305, 306, 4, 5, 0, 0, 6, 7,
875 8, 9, 10, 11, 12, 13, 14, 0, 0, 0,
876 0, 0, 0, 302, 15, 16, 17, 18, 19, 20,
877 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
878 31, 32, 0, 33, 34, 35, 36, 37, 0, 0,
879 0, 38, 39, 40, 41, 42, 43, 44, 45, 0,
880 0, 0, 0, 0, 0, 0, 46, 47
883 static const yytype_int16 yycheck[] =
885 53, 196, 197, 113, 15, 4, 5, 5, 15, 16,
886 15, 16, 10, 66, 13, 3, 14, 83, 6, 16,
887 8, 9, 55, 76, 219, 78, 79, 16, 15, 7,
888 15, 16, 85, 11, 12, 15, 69, 16, 71, 15,
889 73, 15, 95, 15, 16, 15, 99, 15, 16, 82,
890 83, 60, 61, 15, 16, 64, 65, 90, 67, 68,
891 15, 70, 15, 16, 15, 16, 75, 15, 16, 15,
892 16, 80, 81, 84, 184, 84, 49, 86, 87, 15,
893 16, 15, 15, 15, 15, 15, 15, 15, 15, 62,
894 63, 64, 16, 15, 15, 290, 16, 15, 84, 16,
895 73, 74, 75, 76, 77, 78, 79, 16, 15, 84,
896 16, 15, 15, 15, 309, 15, 15, 15, 15, 83,
897 16, 15, 15, 15, 15, 178, 179, 16, 181, 83,
898 16, 16, 84, 186, 187, 188, 83, 17, 83, 83,
899 193, 194, 83, 83, 83, 83, 16, 84, 83, 202,
900 15, 15, 15, 206, 16, 16, 189, 190, 191, 16,
901 83, 16, 215, 16, 217, 198, 199, 200, 83, 83,
902 223, 204, 16, 16, 227, 228, 209, 210, 16, 232,
903 213, 16, 16, 216, 16, 218, 16, 220, 221, 222,
904 16, 224, 15, 83, 16, 16, 15, 15, -1, 16,
905 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
906 16, 16, 16, 16, 16, 16, 16, 84, 12, 17,
907 15, 17, 183, 16, 84, 84, 16, 83, 16, 83,
908 15, 83, 83, 16, 16, 16, 289, 16, 291, 84,
909 16, 16, 84, 84, 17, 84, 0, 1, 17, 207,
910 -1, 84, -1, -1, -1, 308, -1, -1, -1, -1,
911 293, 294, 295, 296, 18, 19, -1, -1, 22, 23,
912 24, 25, 26, 27, 28, 29, 30, -1, -1, -1,
913 -1, -1, -1, 292, 38, 39, 40, 41, 42, 43,
914 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
915 54, 55, -1, 57, 58, 59, 60, 61, -1, -1,
916 -1, 65, 66, 67, 68, 69, 70, 71, 72, -1,
917 -1, -1, -1, -1, -1, -1, 80, 81
920 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
921 symbol of state STATE-NUM. */
922 static const yytype_uint8 yystos[] =
924 0, 86, 0, 1, 18, 19, 22, 23, 24, 25,
925 26, 27, 28, 29, 30, 38, 39, 40, 41, 42,
926 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
927 53, 54, 55, 57, 58, 59, 60, 61, 65, 66,
928 67, 68, 69, 70, 71, 72, 80, 81, 87, 88,
929 16, 15, 15, 16, 15, 16, 15, 15, 15, 15,
930 15, 15, 15, 15, 15, 15, 16, 15, 15, 16,
931 15, 16, 15, 16, 15, 15, 16, 15, 16, 16,
932 15, 15, 16, 16, 15, 16, 15, 15, 15, 15,
933 16, 15, 15, 15, 15, 16, 15, 15, 15, 16,
934 15, 83, 89, 83, 90, 102, 84, 92, 101, 102,
935 3, 6, 8, 9, 94, 7, 11, 12, 95, 4,
936 5, 13, 96, 83, 97, 98, 97, 97, 84, 84,
937 91, 97, 97, 102, 97, 97, 101, 97, 101, 83,
938 101, 49, 62, 63, 64, 73, 74, 75, 76, 77,
939 78, 79, 97, 102, 83, 102, 102, 97, 97, 101,
940 101, 97, 102, 97, 97, 83, 83, 101, 83, 83,
941 83, 84, 102, 83, 83, 83, 102, 83, 16, 16,
942 17, 16, 15, 15, 15, 91, 16, 16, 16, 16,
943 16, 16, 15, 16, 16, 16, 16, 16, 16, 16,
944 16, 15, 16, 15, 16, 15, 16, 15, 15, 16,
945 16, 15, 15, 16, 15, 16, 16, 16, 16, 16,
946 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
947 16, 16, 16, 102, 102, 84, 102, 5, 10, 14,
948 93, 93, 91, 102, 102, 102, 101, 101, 101, 12,
949 102, 102, 100, 101, 100, 100, 101, 101, 101, 83,
950 102, 84, 99, 101, 84, 102, 99, 83, 101, 101,
951 83, 83, 101, 83, 102, 101, 102, 101, 100, 101,
952 101, 101, 102, 101, 102, 102, 102, 17, 15, 16,
953 16, 16, 15, 16, 16, 16, 16, 84, 84, 102,
954 100, 102, 97, 101, 101, 101, 101, 17, 16, 16,
955 84, 102, 100, 17, 84, 17, 84
958 #define yyerrok (yyerrstatus = 0)
959 #define yyclearin (yychar = YYEMPTY)
963 #define YYACCEPT goto yyacceptlab
964 #define YYABORT goto yyabortlab
965 #define YYERROR goto yyerrorlab
968 /* Like YYERROR except do call yyerror. This remains here temporarily
969 to ease the transition to the new meaning of YYERROR, for GCC.
970 Once GCC version 2 has supplanted version 1, this can go. */
972 #define YYFAIL goto yyerrlab
974 #define YYRECOVERING() (!!yyerrstatus)
976 #define YYBACKUP(Token, Value) \
978 if (yychar == YYEMPTY && yylen == 1) \
982 yytoken = YYTRANSLATE (yychar); \
988 yyerror (YY_("syntax error: cannot back up")); \
995 #define YYERRCODE 256
998 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
999 If N is 0, then set CURRENT to the empty location which ends
1000 the previous symbol: RHS[0] (always defined). */
1002 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1003 #ifndef YYLLOC_DEFAULT
1004 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1008 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1009 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1010 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1011 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1015 (Current).first_line = (Current).last_line = \
1016 YYRHSLOC (Rhs, 0).last_line; \
1017 (Current).first_column = (Current).last_column = \
1018 YYRHSLOC (Rhs, 0).last_column; \
1024 /* YY_LOCATION_PRINT -- Print the location on the stream.
1025 This macro was not mandated originally: define only if we know
1026 we won't break user code: when these are the locations we know. */
1028 #ifndef YY_LOCATION_PRINT
1029 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1030 # define YY_LOCATION_PRINT(File, Loc) \
1031 fprintf (File, "%d.%d-%d.%d", \
1032 (Loc).first_line, (Loc).first_column, \
1033 (Loc).last_line, (Loc).last_column)
1035 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1040 /* YYLEX -- calling `yylex' with the right arguments. */
1043 # define YYLEX yylex (YYLEX_PARAM)
1045 # define YYLEX yylex ()
1048 /* Enable debugging if requested. */
1052 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1053 # define YYFPRINTF fprintf
1056 # define YYDPRINTF(Args) \
1062 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1066 YYFPRINTF (stderr, "%s ", Title); \
1067 yy_symbol_print (stderr, \
1069 YYFPRINTF (stderr, "\n"); \
1074 /*--------------------------------.
1075 | Print this symbol on YYOUTPUT. |
1076 `--------------------------------*/
1079 #if (defined __STDC__ || defined __C99__FUNC__ \
1080 || defined __cplusplus || defined _MSC_VER)
1082 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1085 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1088 YYSTYPE const * const yyvaluep;
1094 if (yytype < YYNTOKENS)
1095 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1107 /*--------------------------------.
1108 | Print this symbol on YYOUTPUT. |
1109 `--------------------------------*/
1111 #if (defined __STDC__ || defined __C99__FUNC__ \
1112 || defined __cplusplus || defined _MSC_VER)
1114 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1117 yy_symbol_print (yyoutput, yytype, yyvaluep)
1120 YYSTYPE const * const yyvaluep;
1123 if (yytype < YYNTOKENS)
1124 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1126 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1128 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1129 YYFPRINTF (yyoutput, ")");
1132 /*------------------------------------------------------------------.
1133 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1135 `------------------------------------------------------------------*/
1137 #if (defined __STDC__ || defined __C99__FUNC__ \
1138 || defined __cplusplus || defined _MSC_VER)
1140 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1143 yy_stack_print (bottom, top)
1144 yytype_int16 *bottom;
1148 YYFPRINTF (stderr, "Stack now");
1149 for (; bottom <= top; ++bottom)
1150 YYFPRINTF (stderr, " %d", *bottom);
1151 YYFPRINTF (stderr, "\n");
1154 # define YY_STACK_PRINT(Bottom, Top) \
1157 yy_stack_print ((Bottom), (Top)); \
1161 /*------------------------------------------------.
1162 | Report that the YYRULE is going to be reduced. |
1163 `------------------------------------------------*/
1165 #if (defined __STDC__ || defined __C99__FUNC__ \
1166 || defined __cplusplus || defined _MSC_VER)
1168 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1171 yy_reduce_print (yyvsp, yyrule)
1176 int yynrhs = yyr2[yyrule];
1178 unsigned long int yylno = yyrline[yyrule];
1179 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1181 /* The symbols being reduced. */
1182 for (yyi = 0; yyi < yynrhs; yyi++)
1184 fprintf (stderr, " $%d = ", yyi + 1);
1185 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1186 &(yyvsp[(yyi + 1) - (yynrhs)])
1188 fprintf (stderr, "\n");
1192 # define YY_REDUCE_PRINT(Rule) \
1195 yy_reduce_print (yyvsp, Rule); \
1198 /* Nonzero means print parse trace. It is left uninitialized so that
1199 multiple parsers can coexist. */
1201 #else /* !YYDEBUG */
1202 # define YYDPRINTF(Args)
1203 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1204 # define YY_STACK_PRINT(Bottom, Top)
1205 # define YY_REDUCE_PRINT(Rule)
1206 #endif /* !YYDEBUG */
1209 /* YYINITDEPTH -- initial size of the parser's stacks. */
1211 # define YYINITDEPTH 200
1214 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1215 if the built-in stack extension method is used).
1217 Do not make this value too large; the results are undefined if
1218 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1219 evaluated with infinite-precision integer arithmetic. */
1222 # define YYMAXDEPTH 10000
1230 # if defined __GLIBC__ && defined _STRING_H
1231 # define yystrlen strlen
1233 /* Return the length of YYSTR. */
1234 #if (defined __STDC__ || defined __C99__FUNC__ \
1235 || defined __cplusplus || defined _MSC_VER)
1237 yystrlen (const char *yystr)
1245 for (yylen = 0; yystr[yylen]; yylen++)
1253 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1254 # define yystpcpy stpcpy
1256 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1258 #if (defined __STDC__ || defined __C99__FUNC__ \
1259 || defined __cplusplus || defined _MSC_VER)
1261 yystpcpy (char *yydest, const char *yysrc)
1264 yystpcpy (yydest, yysrc)
1270 const char *yys = yysrc;
1272 while ((*yyd++ = *yys++) != '\0')
1281 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1282 quotes and backslashes, so that it's suitable for yyerror. The
1283 heuristic is that double-quoting is unnecessary unless the string
1284 contains an apostrophe, a comma, or backslash (other than
1285 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1286 null, do not copy; instead, return the length of what the result
1289 yytnamerr (char *yyres, const char *yystr)
1294 char const *yyp = yystr;
1301 goto do_not_strip_quotes;
1305 goto do_not_strip_quotes;
1318 do_not_strip_quotes: ;
1322 return yystrlen (yystr);
1324 return yystpcpy (yyres, yystr) - yyres;
1328 /* Copy into YYRESULT an error message about the unexpected token
1329 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1330 including the terminating null byte. If YYRESULT is null, do not
1331 copy anything; just return the number of bytes that would be
1332 copied. As a special case, return 0 if an ordinary "syntax error"
1333 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1334 size calculation. */
1336 yysyntax_error (char *yyresult, int yystate, int yychar)
1338 int yyn = yypact[yystate];
1340 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1344 int yytype = YYTRANSLATE (yychar);
1345 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1346 YYSIZE_T yysize = yysize0;
1348 int yysize_overflow = 0;
1349 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1350 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1354 /* This is so xgettext sees the translatable formats that are
1355 constructed on the fly. */
1356 YY_("syntax error, unexpected %s");
1357 YY_("syntax error, unexpected %s, expecting %s");
1358 YY_("syntax error, unexpected %s, expecting %s or %s");
1359 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1360 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1364 static char const yyunexpected[] = "syntax error, unexpected %s";
1365 static char const yyexpecting[] = ", expecting %s";
1366 static char const yyor[] = " or %s";
1367 char yyformat[sizeof yyunexpected
1368 + sizeof yyexpecting - 1
1369 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1370 * (sizeof yyor - 1))];
1371 char const *yyprefix = yyexpecting;
1373 /* Start YYX at -YYN if negative to avoid negative indexes in
1375 int yyxbegin = yyn < 0 ? -yyn : 0;
1377 /* Stay within bounds of both yycheck and yytname. */
1378 int yychecklim = YYLAST - yyn + 1;
1379 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1382 yyarg[0] = yytname[yytype];
1383 yyfmt = yystpcpy (yyformat, yyunexpected);
1385 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1386 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1388 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1392 yyformat[sizeof yyunexpected - 1] = '\0';
1395 yyarg[yycount++] = yytname[yyx];
1396 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1397 yysize_overflow |= (yysize1 < yysize);
1399 yyfmt = yystpcpy (yyfmt, yyprefix);
1403 yyf = YY_(yyformat);
1404 yysize1 = yysize + yystrlen (yyf);
1405 yysize_overflow |= (yysize1 < yysize);
1408 if (yysize_overflow)
1409 return YYSIZE_MAXIMUM;
1413 /* Avoid sprintf, as that infringes on the user's name space.
1414 Don't have undefined behavior even if the translation
1415 produced a string with the wrong number of "%s"s. */
1416 char *yyp = yyresult;
1418 while ((*yyp = *yyf) != '\0')
1420 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1422 yyp += yytnamerr (yyp, yyarg[yyi++]);
1435 #endif /* YYERROR_VERBOSE */
1438 /*-----------------------------------------------.
1439 | Release the memory associated to this symbol. |
1440 `-----------------------------------------------*/
1443 #if (defined __STDC__ || defined __C99__FUNC__ \
1444 || defined __cplusplus || defined _MSC_VER)
1446 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1449 yydestruct (yymsg, yytype, yyvaluep)
1459 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1470 /* Prevent warnings from -Wmissing-prototypes. */
1472 #ifdef YYPARSE_PARAM
1473 #if defined __STDC__ || defined __cplusplus
1474 int yyparse (void *YYPARSE_PARAM);
1478 #else /* ! YYPARSE_PARAM */
1479 #if defined __STDC__ || defined __cplusplus
1484 #endif /* ! YYPARSE_PARAM */
1488 /* The look-ahead symbol. */
1491 /* The semantic value of the look-ahead symbol. */
1494 /* Number of syntax errors so far. */
1503 #ifdef YYPARSE_PARAM
1504 #if (defined __STDC__ || defined __C99__FUNC__ \
1505 || defined __cplusplus || defined _MSC_VER)
1507 yyparse (void *YYPARSE_PARAM)
1510 yyparse (YYPARSE_PARAM)
1511 void *YYPARSE_PARAM;
1513 #else /* ! YYPARSE_PARAM */
1514 #if (defined __STDC__ || defined __C99__FUNC__ \
1515 || defined __cplusplus || defined _MSC_VER)
1529 /* Number of tokens to shift before error messages enabled. */
1531 /* Look-ahead token as an internal (translated) token number. */
1534 /* Buffer for error messages, and its allocated size. */
1536 char *yymsg = yymsgbuf;
1537 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1540 /* Three stacks and their tools:
1541 `yyss': related to states,
1542 `yyvs': related to semantic values,
1543 `yyls': related to locations.
1545 Refer to the stacks thru separate pointers, to allow yyoverflow
1546 to reallocate them elsewhere. */
1548 /* The state stack. */
1549 yytype_int16 yyssa[YYINITDEPTH];
1550 yytype_int16 *yyss = yyssa;
1551 yytype_int16 *yyssp;
1553 /* The semantic value stack. */
1554 YYSTYPE yyvsa[YYINITDEPTH];
1555 YYSTYPE *yyvs = yyvsa;
1560 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1562 YYSIZE_T yystacksize = YYINITDEPTH;
1564 /* The variables used to return semantic value and location from the
1569 /* The number of symbols on the RHS of the reduced rule.
1570 Keep to zero when no symbol should be popped. */
1573 YYDPRINTF ((stderr, "Starting parse\n"));
1578 yychar = YYEMPTY; /* Cause a token to be read. */
1580 /* Initialize stack pointers.
1581 Waste one element of value and location stack
1582 so that they stay on the same level as the state stack.
1583 The wasted elements are never initialized. */
1590 /*------------------------------------------------------------.
1591 | yynewstate -- Push a new state, which is found in yystate. |
1592 `------------------------------------------------------------*/
1594 /* In all cases, when you get here, the value and location stacks
1595 have just been pushed. So pushing a state here evens the stacks. */
1601 if (yyss + yystacksize - 1 <= yyssp)
1603 /* Get the current used size of the three stacks, in elements. */
1604 YYSIZE_T yysize = yyssp - yyss + 1;
1608 /* Give user a chance to reallocate the stack. Use copies of
1609 these so that the &'s don't force the real ones into
1611 YYSTYPE *yyvs1 = yyvs;
1612 yytype_int16 *yyss1 = yyss;
1615 /* Each stack pointer address is followed by the size of the
1616 data in use in that stack, in bytes. This used to be a
1617 conditional around just the two extra args, but that might
1618 be undefined if yyoverflow is a macro. */
1619 yyoverflow (YY_("memory exhausted"),
1620 &yyss1, yysize * sizeof (*yyssp),
1621 &yyvs1, yysize * sizeof (*yyvsp),
1628 #else /* no yyoverflow */
1629 # ifndef YYSTACK_RELOCATE
1630 goto yyexhaustedlab;
1632 /* Extend the stack our own way. */
1633 if (YYMAXDEPTH <= yystacksize)
1634 goto yyexhaustedlab;
1636 if (YYMAXDEPTH < yystacksize)
1637 yystacksize = YYMAXDEPTH;
1640 yytype_int16 *yyss1 = yyss;
1641 union yyalloc *yyptr =
1642 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1644 goto yyexhaustedlab;
1645 YYSTACK_RELOCATE (yyss);
1646 YYSTACK_RELOCATE (yyvs);
1648 # undef YYSTACK_RELOCATE
1650 YYSTACK_FREE (yyss1);
1653 #endif /* no yyoverflow */
1655 yyssp = yyss + yysize - 1;
1656 yyvsp = yyvs + yysize - 1;
1659 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1660 (unsigned long int) yystacksize));
1662 if (yyss + yystacksize - 1 <= yyssp)
1666 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1675 /* Do appropriate processing given the current state. Read a
1676 look-ahead token if we need one and don't already have one. */
1678 /* First try to decide what to do without reference to look-ahead token. */
1679 yyn = yypact[yystate];
1680 if (yyn == YYPACT_NINF)
1683 /* Not known => get a look-ahead token if don't already have one. */
1685 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1686 if (yychar == YYEMPTY)
1688 YYDPRINTF ((stderr, "Reading a token: "));
1692 if (yychar <= YYEOF)
1694 yychar = yytoken = YYEOF;
1695 YYDPRINTF ((stderr, "Now at end of input.\n"));
1699 yytoken = YYTRANSLATE (yychar);
1700 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1703 /* If the proper action on seeing token YYTOKEN is to reduce or to
1704 detect an error, take that action. */
1706 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1711 if (yyn == 0 || yyn == YYTABLE_NINF)
1720 /* Count tokens shifted since error; after three, turn off error
1725 /* Shift the look-ahead token. */
1726 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1728 /* Discard the shifted token unless it is eof. */
1729 if (yychar != YYEOF)
1738 /*-----------------------------------------------------------.
1739 | yydefault -- do the default action for the current state. |
1740 `-----------------------------------------------------------*/
1742 yyn = yydefact[yystate];
1748 /*-----------------------------.
1749 | yyreduce -- Do a reduction. |
1750 `-----------------------------*/
1752 /* yyn is the number of a rule to reduce with. */
1755 /* If YYLEN is nonzero, implement the default value of the action:
1758 Otherwise, the following line sets YYVAL to garbage.
1759 This behavior is undocumented and Bison
1760 users should not rely upon it. Assigning to YYVAL
1761 unconditionally makes the parser a bit smaller, and it avoids a
1762 GCC warning that YYVAL may be used uninitialized. */
1763 yyval = yyvsp[1-yylen];
1766 YY_REDUCE_PRINT (yyn);
1770 #line 132 "ftpcmd.y"
1772 fromname = (char *) 0;
1773 restart_point = (off_t) 0;
1778 #line 141 "ftpcmd.y"
1780 if ((yyvsp[(5) - (5)].i))
1781 user((yyvsp[(3) - (5)].s));
1782 free((yyvsp[(3) - (5)].s));
1787 #line 147 "ftpcmd.y"
1789 if ((yyvsp[(5) - (5)].i))
1790 pass((yyvsp[(3) - (5)].s));
1791 memset ((yyvsp[(3) - (5)].s), 0, strlen((yyvsp[(3) - (5)].s)));
1792 free((yyvsp[(3) - (5)].s));
1797 #line 155 "ftpcmd.y"
1799 if ((yyvsp[(5) - (5)].i)) {
1801 (data_dest->sa_family != his_addr->sa_family ||
1802 (socket_get_port(data_dest) < IPPORT_RESERVED) ||
1803 memcmp(socket_get_address(data_dest),
1804 socket_get_address(his_addr),
1805 socket_addr_size(his_addr)) != 0)) {
1807 reply(500, "Illegal PORT range rejected.");
1814 reply(200, "PORT command successful.");
1821 #line 176 "ftpcmd.y"
1823 if ((yyvsp[(5) - (5)].i))
1824 eprt ((yyvsp[(3) - (5)].s));
1825 free ((yyvsp[(3) - (5)].s));
1830 #line 182 "ftpcmd.y"
1832 if((yyvsp[(3) - (3)].i))
1838 #line 187 "ftpcmd.y"
1840 if((yyvsp[(3) - (3)].i))
1846 #line 192 "ftpcmd.y"
1848 if((yyvsp[(5) - (5)].i))
1849 epsv ((yyvsp[(3) - (5)].s));
1850 free ((yyvsp[(3) - (5)].s));
1855 #line 198 "ftpcmd.y"
1857 if ((yyvsp[(5) - (5)].i)) {
1861 if (cmd_form == FORM_N) {
1862 reply(200, "Type set to A.");
1866 reply(504, "Form must be N.");
1870 reply(504, "Type E not implemented.");
1874 reply(200, "Type set to I.");
1880 if (cmd_bytesz == 8) {
1882 "Type set to L (byte size 8).");
1885 reply(504, "Byte size must be 8.");
1886 #else /* NBBY == 8 */
1887 UNIMPLEMENTED for NBBY != 8
1888 #endif /* NBBY == 8 */
1895 #line 235 "ftpcmd.y"
1897 if ((yyvsp[(5) - (5)].i)) {
1898 switch ((yyvsp[(3) - (5)].i)) {
1901 reply(200, "STRU F ok.");
1905 reply(504, "Unimplemented STRU type.");
1912 #line 249 "ftpcmd.y"
1914 if ((yyvsp[(5) - (5)].i)) {
1915 switch ((yyvsp[(3) - (5)].i)) {
1918 reply(200, "MODE S ok.");
1922 reply(502, "Unimplemented MODE type.");
1929 #line 263 "ftpcmd.y"
1931 if ((yyvsp[(5) - (5)].i)) {
1932 reply(202, "ALLO command ignored.");
1938 #line 269 "ftpcmd.y"
1940 if ((yyvsp[(9) - (9)].i)) {
1941 reply(202, "ALLO command ignored.");
1947 #line 275 "ftpcmd.y"
1949 char *name = (yyvsp[(3) - (5)].s);
1951 if ((yyvsp[(5) - (5)].i) && name != NULL)
1959 #line 284 "ftpcmd.y"
1961 char *name = (yyvsp[(3) - (5)].s);
1963 if ((yyvsp[(5) - (5)].i) && name != NULL)
1964 do_store(name, "w", 0);
1971 #line 293 "ftpcmd.y"
1973 char *name = (yyvsp[(3) - (5)].s);
1975 if ((yyvsp[(5) - (5)].i) && name != NULL)
1976 do_store(name, "a", 0);
1983 #line 302 "ftpcmd.y"
1985 if ((yyvsp[(3) - (3)].i))
1986 send_file_list(".");
1991 #line 307 "ftpcmd.y"
1993 char *name = (yyvsp[(3) - (5)].s);
1995 if ((yyvsp[(5) - (5)].i) && name != NULL)
1996 send_file_list(name);
2003 #line 316 "ftpcmd.y"
2005 if((yyvsp[(3) - (3)].i))
2011 #line 321 "ftpcmd.y"
2013 if((yyvsp[(5) - (5)].i))
2014 list_file((yyvsp[(3) - (5)].s));
2015 free((yyvsp[(3) - (5)].s));
2020 #line 327 "ftpcmd.y"
2022 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2023 statfilecmd((yyvsp[(3) - (5)].s));
2024 if ((yyvsp[(3) - (5)].s) != NULL)
2025 free((yyvsp[(3) - (5)].s));
2030 #line 334 "ftpcmd.y"
2032 if ((yyvsp[(3) - (3)].i))
2038 #line 339 "ftpcmd.y"
2040 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2041 do_delete((yyvsp[(3) - (5)].s));
2042 if ((yyvsp[(3) - (5)].s) != NULL)
2043 free((yyvsp[(3) - (5)].s));
2048 #line 346 "ftpcmd.y"
2050 if((yyvsp[(5) - (5)].i)){
2052 renamecmd(fromname, (yyvsp[(3) - (5)].s));
2054 fromname = (char *) 0;
2056 reply(503, "Bad sequence of commands.");
2059 if ((yyvsp[(3) - (5)].s) != NULL)
2060 free((yyvsp[(3) - (5)].s));
2065 #line 360 "ftpcmd.y"
2067 if ((yyvsp[(3) - (3)].i))
2068 reply(225, "ABOR command successful.");
2073 #line 365 "ftpcmd.y"
2075 if ((yyvsp[(3) - (3)].i)) {
2076 const char *path = pw->pw_dir;
2077 if (dochroot || guest)
2085 #line 374 "ftpcmd.y"
2087 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2088 cwd((yyvsp[(3) - (5)].s));
2089 if ((yyvsp[(3) - (5)].s) != NULL)
2090 free((yyvsp[(3) - (5)].s));
2095 #line 381 "ftpcmd.y"
2097 if ((yyvsp[(3) - (3)].i))
2098 help(cmdtab, (char *) 0);
2103 #line 386 "ftpcmd.y"
2105 if ((yyvsp[(5) - (5)].i)) {
2106 char *cp = (yyvsp[(3) - (5)].s);
2108 if (strncasecmp(cp, "SITE", 4) == 0) {
2109 cp = (yyvsp[(3) - (5)].s) + 4;
2115 help(sitetab, (char *) 0);
2117 help(cmdtab, (yyvsp[(3) - (5)].s));
2123 #line 403 "ftpcmd.y"
2125 if ((yyvsp[(3) - (3)].i))
2126 reply(200, "NOOP command successful.");
2131 #line 408 "ftpcmd.y"
2133 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2134 makedir((yyvsp[(3) - (5)].s));
2135 if ((yyvsp[(3) - (5)].s) != NULL)
2136 free((yyvsp[(3) - (5)].s));
2141 #line 415 "ftpcmd.y"
2143 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2144 removedir((yyvsp[(3) - (5)].s));
2145 if ((yyvsp[(3) - (5)].s) != NULL)
2146 free((yyvsp[(3) - (5)].s));
2151 #line 422 "ftpcmd.y"
2153 if ((yyvsp[(3) - (3)].i))
2159 #line 427 "ftpcmd.y"
2161 if ((yyvsp[(3) - (3)].i))
2167 #line 432 "ftpcmd.y"
2169 if ((yyvsp[(3) - (3)].i)) {
2170 lreply(211, "Supported features:");
2172 lreply(0, " REST STREAM");
2180 #line 442 "ftpcmd.y"
2182 if ((yyvsp[(5) - (5)].i))
2183 reply(501, "Bad options");
2184 free ((yyvsp[(3) - (5)].s));
2189 #line 449 "ftpcmd.y"
2191 if ((yyvsp[(5) - (5)].i))
2192 help(sitetab, (char *) 0);
2197 #line 454 "ftpcmd.y"
2199 if ((yyvsp[(7) - (7)].i))
2200 help(sitetab, (yyvsp[(5) - (7)].s));
2205 #line 459 "ftpcmd.y"
2207 if ((yyvsp[(5) - (5)].i)) {
2208 int oldmask = umask(0);
2210 reply(200, "Current UMASK is %03o", oldmask);
2216 #line 467 "ftpcmd.y"
2218 if ((yyvsp[(7) - (7)].i)) {
2219 if (((yyvsp[(5) - (7)].i) == -1) || ((yyvsp[(5) - (7)].i) > 0777)) {
2220 reply(501, "Bad UMASK value");
2222 int oldmask = umask((yyvsp[(5) - (7)].i));
2224 "UMASK set to %03o (was %03o)",
2225 (yyvsp[(5) - (7)].i), oldmask);
2232 #line 480 "ftpcmd.y"
2234 if ((yyvsp[(9) - (9)].i) && (yyvsp[(7) - (9)].s) != NULL) {
2235 if ((yyvsp[(5) - (9)].i) > 0777)
2237 "CHMOD: Mode value must be between 0 and 0777");
2238 else if (chmod((yyvsp[(7) - (9)].s), (yyvsp[(5) - (9)].i)) < 0)
2239 perror_reply(550, (yyvsp[(7) - (9)].s));
2241 reply(200, "CHMOD command successful.");
2243 if ((yyvsp[(7) - (9)].s) != NULL)
2244 free((yyvsp[(7) - (9)].s));
2249 #line 494 "ftpcmd.y"
2251 if ((yyvsp[(5) - (5)].i))
2253 "Current IDLE time limit is %d seconds; max %d",
2254 ftpd_timeout, maxtimeout);
2259 #line 501 "ftpcmd.y"
2261 if ((yyvsp[(7) - (7)].i)) {
2262 if ((yyvsp[(5) - (7)].i) < 30 || (yyvsp[(5) - (7)].i) > maxtimeout) {
2264 "Maximum IDLE time must be between 30 and %d seconds",
2267 ftpd_timeout = (yyvsp[(5) - (7)].i);
2268 alarm((unsigned) ftpd_timeout);
2270 "Maximum IDLE time set to %d seconds",
2278 #line 518 "ftpcmd.y"
2280 reply(500, "Command not implemented.");
2285 #line 522 "ftpcmd.y"
2287 if((yyvsp[(5) - (5)].i))
2293 #line 527 "ftpcmd.y"
2295 reply(500, "Command not implemented.");
2300 #line 531 "ftpcmd.y"
2302 reply(500, "Command not implemented.");
2307 #line 535 "ftpcmd.y"
2311 reply(500, "Can't be done as guest.");
2312 else if((yyvsp[(5) - (5)].i))
2315 reply(500, "Command not implemented.");
2321 #line 546 "ftpcmd.y"
2325 reply(500, "Can't be done as guest.");
2326 else if((yyvsp[(7) - (7)].i))
2327 afslog((yyvsp[(5) - (7)].s), 0);
2328 if((yyvsp[(5) - (7)].s))
2329 free((yyvsp[(5) - (7)].s));
2331 reply(500, "Command not implemented.");
2337 #line 559 "ftpcmd.y"
2339 if((yyvsp[(7) - (7)].i) && (yyvsp[(5) - (7)].s) != NULL)
2340 find((yyvsp[(5) - (7)].s));
2341 if((yyvsp[(5) - (7)].s) != NULL)
2342 free((yyvsp[(5) - (7)].s));
2347 #line 566 "ftpcmd.y"
2349 if ((yyvsp[(5) - (5)].i))
2350 reply(200, "http://www.pdc.kth.se/heimdal/");
2355 #line 571 "ftpcmd.y"
2357 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2358 do_store((yyvsp[(3) - (5)].s), "w", 1);
2359 if ((yyvsp[(3) - (5)].s) != NULL)
2360 free((yyvsp[(3) - (5)].s));
2365 #line 578 "ftpcmd.y"
2367 if ((yyvsp[(3) - (3)].i)) {
2368 #if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)
2369 reply(215, "UNIX Type: L%d", NBBY);
2371 reply(215, "UNKNOWN Type: L%d", NBBY);
2378 #line 596 "ftpcmd.y"
2380 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2381 sizecmd((yyvsp[(3) - (5)].s));
2382 if ((yyvsp[(3) - (5)].s) != NULL)
2383 free((yyvsp[(3) - (5)].s));
2388 #line 613 "ftpcmd.y"
2390 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL) {
2392 if (stat((yyvsp[(3) - (5)].s), &stbuf) < 0)
2393 reply(550, "%s: %s",
2394 (yyvsp[(3) - (5)].s), strerror(errno));
2395 else if (!S_ISREG(stbuf.st_mode)) {
2397 "%s: not a plain file.", (yyvsp[(3) - (5)].s));
2400 time_t mtime = stbuf.st_mtime;
2404 "%04d%02d%02d%02d%02d%02d",
2413 if ((yyvsp[(3) - (5)].s) != NULL)
2414 free((yyvsp[(3) - (5)].s));
2419 #line 641 "ftpcmd.y"
2421 if ((yyvsp[(3) - (3)].i)) {
2422 reply(221, "Goodbye.");
2429 #line 648 "ftpcmd.y"
2436 #line 654 "ftpcmd.y"
2438 restart_point = (off_t) 0;
2439 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s)) {
2440 fromname = renamefrom((yyvsp[(3) - (5)].s));
2441 if (fromname == (char *) 0 && (yyvsp[(3) - (5)].s)) {
2442 free((yyvsp[(3) - (5)].s));
2449 #line 664 "ftpcmd.y"
2451 if ((yyvsp[(5) - (5)].i)) {
2452 fromname = (char *) 0;
2453 restart_point = (yyvsp[(3) - (5)].i); /* XXX $3 is only "int" */
2454 reply(350, "Restarting at %ld. %s",
2455 (long)restart_point,
2456 "Send STORE or RETRIEVE to initiate transfer.");
2462 #line 674 "ftpcmd.y"
2464 auth((yyvsp[(3) - (4)].s));
2465 free((yyvsp[(3) - (4)].s));
2470 #line 679 "ftpcmd.y"
2472 adat((yyvsp[(3) - (4)].s));
2473 free((yyvsp[(3) - (4)].s));
2478 #line 684 "ftpcmd.y"
2480 if ((yyvsp[(5) - (5)].i))
2481 pbsz((yyvsp[(3) - (5)].i));
2486 #line 689 "ftpcmd.y"
2488 if ((yyvsp[(5) - (5)].i))
2489 prot((yyvsp[(3) - (5)].s));
2494 #line 694 "ftpcmd.y"
2496 if ((yyvsp[(3) - (3)].i))
2502 #line 699 "ftpcmd.y"
2504 mec((yyvsp[(3) - (4)].s), prot_safe);
2505 free((yyvsp[(3) - (4)].s));
2510 #line 704 "ftpcmd.y"
2512 mec((yyvsp[(3) - (4)].s), prot_confidential);
2513 free((yyvsp[(3) - (4)].s));
2518 #line 709 "ftpcmd.y"
2520 mec((yyvsp[(3) - (4)].s), prot_private);
2521 free((yyvsp[(3) - (4)].s));
2526 #line 721 "ftpcmd.y"
2528 (yyval.s) = (char *)calloc(1, sizeof(char));
2533 #line 734 "ftpcmd.y"
2535 struct sockaddr_in *sin4 = (struct sockaddr_in *)data_dest;
2537 sin4->sin_family = AF_INET;
2538 sin4->sin_port = htons((yyvsp[(9) - (11)].i) * 256 + (yyvsp[(11) - (11)].i));
2539 sin4->sin_addr.s_addr =
2540 htonl(((yyvsp[(1) - (11)].i) << 24) | ((yyvsp[(3) - (11)].i) << 16) | ((yyvsp[(5) - (11)].i) << 8) | (yyvsp[(7) - (11)].i));
2545 #line 746 "ftpcmd.y"
2552 #line 750 "ftpcmd.y"
2559 #line 754 "ftpcmd.y"
2566 #line 761 "ftpcmd.y"
2574 #line 766 "ftpcmd.y"
2577 cmd_form = (yyvsp[(3) - (3)].i);
2582 #line 771 "ftpcmd.y"
2590 #line 776 "ftpcmd.y"
2593 cmd_form = (yyvsp[(3) - (3)].i);
2598 #line 781 "ftpcmd.y"
2605 #line 785 "ftpcmd.y"
2613 #line 790 "ftpcmd.y"
2616 cmd_bytesz = (yyvsp[(3) - (3)].i);
2621 #line 796 "ftpcmd.y"
2624 cmd_bytesz = (yyvsp[(2) - (2)].i);
2629 #line 804 "ftpcmd.y"
2636 #line 808 "ftpcmd.y"
2643 #line 812 "ftpcmd.y"
2650 #line 819 "ftpcmd.y"
2657 #line 823 "ftpcmd.y"
2664 #line 827 "ftpcmd.y"
2671 #line 834 "ftpcmd.y"
2674 * Problem: this production is used for all pathname
2675 * processing, but only gives a 550 error reply.
2676 * This is a valid reply in some cases but not in others.
2678 if (logged_in && (yyvsp[(1) - (1)].s) && *(yyvsp[(1) - (1)].s) == '~') {
2681 GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
2683 memset(&gl, 0, sizeof(gl));
2684 if (glob((yyvsp[(1) - (1)].s), flags, NULL, &gl) ||
2686 reply(550, "not found");
2689 (yyval.s) = strdup(gl.gl_pathv[0]);
2692 free((yyvsp[(1) - (1)].s));
2694 (yyval.s) = (yyvsp[(1) - (1)].s);
2699 #line 866 "ftpcmd.y"
2701 int ret, dec, multby, digit;
2704 * Convert a number that was read as decimal number
2705 * to what it would be if it had been read as octal.
2707 dec = (yyvsp[(1) - (1)].i);
2716 ret += digit * multby;
2725 #line 892 "ftpcmd.y"
2727 (yyval.i) = (yyvsp[(1) - (1)].i) && !guest;
2728 if((yyvsp[(1) - (1)].i) && !(yyval.i))
2729 reply(550, "Permission denied");
2734 #line 900 "ftpcmd.y"
2736 if((yyvsp[(1) - (1)].i)) {
2737 if(((yyval.i) = logged_in) == 0)
2738 reply(530, "Please login with USER and PASS.");
2745 #line 910 "ftpcmd.y"
2748 if(sec_complete && !ccc_passed && !secure_command()) {
2750 reply(533, "Command protection level denied "
2751 "for paranoid reasons.");
2757 /* Line 1267 of yacc.c. */
2758 #line 2759 "ftpcmd.c"
2761 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2765 YY_STACK_PRINT (yyss, yyssp);
2770 /* Now `shift' the result of the reduction. Determine what state
2771 that goes to, based on the state we popped back to and the rule
2772 number reduced by. */
2776 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2777 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2778 yystate = yytable[yystate];
2780 yystate = yydefgoto[yyn - YYNTOKENS];
2785 /*------------------------------------.
2786 | yyerrlab -- here on detecting error |
2787 `------------------------------------*/
2789 /* If not already recovering from an error, report this error. */
2793 #if ! YYERROR_VERBOSE
2794 yyerror (YY_("syntax error"));
2797 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2798 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2800 YYSIZE_T yyalloc = 2 * yysize;
2801 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2802 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2803 if (yymsg != yymsgbuf)
2804 YYSTACK_FREE (yymsg);
2805 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2807 yymsg_alloc = yyalloc;
2811 yymsg_alloc = sizeof yymsgbuf;
2815 if (0 < yysize && yysize <= yymsg_alloc)
2817 (void) yysyntax_error (yymsg, yystate, yychar);
2822 yyerror (YY_("syntax error"));
2824 goto yyexhaustedlab;
2832 if (yyerrstatus == 3)
2834 /* If just tried and failed to reuse look-ahead token after an
2835 error, discard it. */
2837 if (yychar <= YYEOF)
2839 /* Return failure if at end of input. */
2840 if (yychar == YYEOF)
2845 yydestruct ("Error: discarding",
2851 /* Else will try to reuse look-ahead token after shifting the error
2856 /*---------------------------------------------------.
2857 | yyerrorlab -- error raised explicitly by YYERROR. |
2858 `---------------------------------------------------*/
2861 /* Pacify compilers like GCC when the user code never invokes
2862 YYERROR and the label yyerrorlab therefore never appears in user
2864 if (/*CONSTCOND*/ 0)
2867 /* Do not reclaim the symbols of the rule which action triggered
2871 YY_STACK_PRINT (yyss, yyssp);
2876 /*-------------------------------------------------------------.
2877 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2878 `-------------------------------------------------------------*/
2880 yyerrstatus = 3; /* Each real token shifted decrements this. */
2884 yyn = yypact[yystate];
2885 if (yyn != YYPACT_NINF)
2888 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2896 /* Pop the current state because it cannot handle the error token. */
2901 yydestruct ("Error: popping",
2902 yystos[yystate], yyvsp);
2905 YY_STACK_PRINT (yyss, yyssp);
2914 /* Shift the error token. */
2915 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2921 /*-------------------------------------.
2922 | yyacceptlab -- YYACCEPT comes here. |
2923 `-------------------------------------*/
2928 /*-----------------------------------.
2929 | yyabortlab -- YYABORT comes here. |
2930 `-----------------------------------*/
2936 /*-------------------------------------------------.
2937 | yyexhaustedlab -- memory exhaustion comes here. |
2938 `-------------------------------------------------*/
2940 yyerror (YY_("memory exhausted"));
2946 if (yychar != YYEOF && yychar != YYEMPTY)
2947 yydestruct ("Cleanup: discarding lookahead",
2949 /* Do not reclaim the symbols of the rule which action triggered
2950 this YYABORT or YYACCEPT. */
2952 YY_STACK_PRINT (yyss, yyssp);
2953 while (yyssp != yyss)
2955 yydestruct ("Cleanup: popping",
2956 yystos[*yyssp], yyvsp);
2961 YYSTACK_FREE (yyss);
2964 if (yymsg != yymsgbuf)
2965 YYSTACK_FREE (yymsg);
2967 /* Make sure YYID is used. */
2968 return YYID (yyresult);
2972 #line 920 "ftpcmd.y"
2975 #define CMD 0 /* beginning of command */
2976 #define ARGS 1 /* expect miscellaneous arguments */
2977 #define STR1 2 /* expect SP followed by STRING */
2978 #define STR2 3 /* expect STRING */
2979 #define OSTR 4 /* optional SP then STRING */
2980 #define ZSTR1 5 /* SP then optional STRING */
2981 #define ZSTR2 6 /* optional STRING after SP */
2982 #define SITECMD 7 /* SITE command */
2983 #define NSTR 8 /* Number followed by a string */
2985 struct tab cmdtab[] = { /* In order defined in RFC 765 */
2986 { "USER", USER, STR1, 1, "<sp> username" },
2987 { "PASS", PASS, ZSTR1, 1, "<sp> password" },
2988 { "ACCT", ACCT, STR1, 0, "(specify account)" },
2989 { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
2990 { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
2991 { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
2992 { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
2993 { "EPRT", EPRT, STR1, 1, "<sp> string" },
2994 { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
2995 { "EPSV", EPSV, OSTR, 1, "[<sp> foo]" },
2996 { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
2997 { "STRU", STRU, ARGS, 1, "(specify file structure)" },
2998 { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
2999 { "RETR", RETR, STR1, 1, "<sp> file-name" },
3000 { "STOR", STOR, STR1, 1, "<sp> file-name" },
3001 { "APPE", APPE, STR1, 1, "<sp> file-name" },
3002 { "MLFL", MLFL, OSTR, 0, "(mail file)" },
3003 { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
3004 { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
3005 { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
3006 { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
3007 { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
3008 { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
3009 { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
3010 { "REST", REST, ARGS, 1, "<sp> offset (restart command)" },
3011 { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
3012 { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
3013 { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
3014 { "DELE", DELE, STR1, 1, "<sp> file-name" },
3015 { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
3016 { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
3017 { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
3018 { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
3019 { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
3020 { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
3021 { "STAT", sTAT, OSTR, 1, "[ <sp> path-name ]" },
3022 { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
3023 { "NOOP", NOOP, ARGS, 1, "" },
3024 { "MKD", MKD, STR1, 1, "<sp> path-name" },
3025 { "XMKD", MKD, STR1, 1, "<sp> path-name" },
3026 { "RMD", RMD, STR1, 1, "<sp> path-name" },
3027 { "XRMD", RMD, STR1, 1, "<sp> path-name" },
3028 { "PWD", PWD, ARGS, 1, "(return current directory)" },
3029 { "XPWD", PWD, ARGS, 1, "(return current directory)" },
3030 { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
3031 { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
3032 { "STOU", STOU, STR1, 1, "<sp> file-name" },
3033 { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
3034 { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
3036 /* extensions from RFC2228 */
3037 { "AUTH", AUTH, STR1, 1, "<sp> auth-type" },
3038 { "ADAT", ADAT, STR1, 1, "<sp> auth-data" },
3039 { "PBSZ", PBSZ, ARGS, 1, "<sp> buffer-size" },
3040 { "PROT", PROT, STR1, 1, "<sp> prot-level" },
3041 { "CCC", CCC, ARGS, 1, "" },
3042 { "MIC", MIC, STR1, 1, "<sp> integrity command" },
3043 { "CONF", CONF, STR1, 1, "<sp> confidentiality command" },
3044 { "ENC", ENC, STR1, 1, "<sp> privacy command" },
3047 { "FEAT", FEAT, ARGS, 1, "" },
3048 { "OPTS", OPTS, ARGS, 1, "<sp> command [<sp> options]" },
3050 { NULL, 0, 0, 0, 0 }
3053 struct tab sitetab[] = {
3054 { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
3055 { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
3056 { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
3057 { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
3059 { "KAUTH", KAUTH, STR1, 1, "<sp> principal [ <sp> ticket ]" },
3060 { "KLIST", KLIST, ARGS, 1, "(show ticket file)" },
3061 { "KDESTROY", KDESTROY, ARGS, 1, "(destroy tickets)" },
3062 { "KRBTKFILE", KRBTKFILE, STR1, 1, "<sp> ticket-file" },
3063 { "AFSLOG", AFSLOG, OSTR, 1, "[<sp> cell]" },
3065 { "LOCATE", LOCATE, STR1, 1, "<sp> globexpr" },
3066 { "FIND", LOCATE, STR1, 1, "<sp> globexpr" },
3068 { "URL", URL, ARGS, 1, "?" },
3070 { NULL, 0, 0, 0, 0 }
3074 lookup(struct tab *p, char *cmd)
3077 for (; p->name != NULL; p++)
3078 if (strcmp(cmd, p->name) == 0)
3084 * ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.
3087 ftpd_getline(char *s, int n)
3094 /* might still be data within the security MIC/CONF/ENC */
3096 strlcpy(s, ftp_command, n);
3098 syslog(LOG_DEBUG, "command: %s", s);
3101 while ((c = getc(stdin)) != EOF) {
3104 if ((c = getc(stdin)) != EOF) {
3110 printf("%c%c%c", IAC, DONT, 0377&c);
3116 printf("%c%c%c", IAC, WONT, 0377&c);
3122 continue; /* ignore command */
3127 if (--n <= 0 || c == '\n')
3130 if (c == EOF && cs == s)
3134 if (!guest && strncasecmp("pass ", s, 5) == 0) {
3135 /* Don't syslog passwords */
3136 syslog(LOG_DEBUG, "command: %.5s ???", s);
3141 /* Don't syslog trailing CR-LF */
3144 while (cp >= s && (*cp == '\n' || *cp == '\r')) {
3148 syslog(LOG_DEBUG, "command: %.*s", len, s);
3152 fprintf(stderr, "%s\n", s);
3162 "Timeout (%d seconds): closing control connection.",
3165 syslog(LOG_INFO, "User %s timed out after %d seconds",
3166 (pw ? pw -> pw_name : "unknown"), ftpd_timeout);
3174 static int cpos, state;
3186 signal(SIGALRM, toolong);
3187 alarm((unsigned) ftpd_timeout);
3188 if (ftpd_getline(cbuf, sizeof(cbuf)-1) == NULL) {
3189 reply(221, "You could at least say goodbye.");
3193 #ifdef HAVE_SETPROCTITLE
3194 if (strncasecmp(cbuf, "PASS", 4) != 0)
3195 setproctitle("%s: %s", proctitle, cbuf);
3196 #endif /* HAVE_SETPROCTITLE */
3197 if ((cp = strchr(cbuf, '\r'))) {
3201 if ((cp = strpbrk(cbuf, " \n")))
3208 p = lookup(cmdtab, cbuf);
3211 if (p->implemented == 0) {
3223 if (cbuf[cpos] == ' ') {
3228 if ((cp2 = strpbrk(cp, " \n")))
3233 p = lookup(sitetab, cp);
3236 if (p->implemented == 0) {
3250 if (cbuf[cpos] == '\n') {
3259 if (cbuf[cpos] == ' ') {
3270 if (cbuf[cpos] == '\n') {
3281 * Make sure the string is nonempty and \n terminated.
3283 if (n > 1 && cbuf[cpos] == '\n') {
3285 yylval.s = copy(cp);
3293 if (cbuf[cpos] == ' ') {
3297 if (isdigit((unsigned char)cbuf[cpos])) {
3299 while (isdigit((unsigned char)cbuf[++cpos]))
3303 yylval.i = atoi(cp);
3312 if (isdigit((unsigned char)cbuf[cpos])) {
3314 while (isdigit((unsigned char)cbuf[++cpos]))
3318 yylval.i = atoi(cp);
3322 switch (cbuf[cpos++]) {
3386 fatal("Unknown state in scanner.");
3403 if ((cp = strchr(cbuf,'\n')))
3405 reply(500, "'%s': command not understood.", cbuf);
3416 fatal("Ran out of memory.");
3421 help(struct tab *ctab, char *s)
3428 if (ctab == sitetab)
3432 width = 0, NCMDS = 0;
3433 for (c = ctab; c->name != NULL; c++) {
3434 int len = strlen(c->name);
3440 width = (width + 8) &~ 7;
3445 lreply(214, "The following %scommands are recognized %s.",
3446 t, "(* =>'s unimplemented)");
3447 columns = 76 / width;
3450 lines = (NCMDS + columns - 1) / columns;
3451 for (i = 0; i < lines; i++) {
3452 strlcpy (buf, " ", sizeof(buf));
3453 for (j = 0; j < columns; j++) {
3454 c = ctab + j * lines + i;
3455 snprintf (buf + strlen(buf),
3456 sizeof(buf) - strlen(buf),
3459 c->implemented ? ' ' : '*');
3460 if (c + lines >= &ctab[NCMDS])
3462 w = strlen(c->name) + 1;
3470 lreply(214, "%s", buf);
3472 reply(214, "Direct comments to kth-krb-bugs@pdc.kth.se");
3476 c = lookup(ctab, s);
3477 if (c == (struct tab *)0) {
3478 reply(502, "Unknown command %s.", s);
3482 reply(214, "Syntax: %s%s %s", t, c->name, c->help);
3484 reply(214, "%s%-*s\t%s; unimplemented.", t, width,
3489 sizecmd(char *filename)
3495 if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
3496 reply(550, "%s: not a plain file.", filename);
3498 reply(213, "%lu", (unsigned long)stbuf.st_size);
3506 fin = fopen(filename, "r");
3508 perror_reply(550, filename);
3511 if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
3512 reply(550, "%s: not a plain file.", filename);
3518 while((c=getc(fin)) != EOF) {
3519 if (c == '\n') /* will get expanded to \r\n */
3525 reply(213, "%lu", (unsigned long)count);
3529 reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);