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"
245 RCSID("$Id: ftpcmd.y 15677 2005-07-19 18:33:08Z lha $");
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, 153, 164, 170,
669 175, 180, 186, 223, 237, 251, 257, 263, 272, 281,
670 290, 295, 304, 309, 315, 322, 327, 334, 348, 353,
671 358, 365, 370, 387, 392, 399, 406, 411, 416, 426,
672 433, 438, 443, 451, 464, 478, 485, 502, 525, 530,
673 539, 552, 563, 576, 583, 588, 595, 613, 630, 658,
674 665, 671, 681, 691, 696, 701, 706, 711, 716, 721,
675 726, 734, 739, 742, 746, 750, 763, 767, 771, 778,
676 783, 788, 793, 798, 802, 807, 813, 821, 825, 829,
677 836, 840, 844, 851, 879, 883, 909, 917, 928
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 154 "ftpcmd.y"
1799 if ((yyvsp[(5) - (5)].i)) {
1805 reply(200, "PORT command successful.");
1811 #line 165 "ftpcmd.y"
1813 if ((yyvsp[(5) - (5)].i))
1814 eprt ((yyvsp[(3) - (5)].s));
1815 free ((yyvsp[(3) - (5)].s));
1820 #line 171 "ftpcmd.y"
1822 if((yyvsp[(3) - (3)].i))
1828 #line 176 "ftpcmd.y"
1830 if((yyvsp[(3) - (3)].i))
1836 #line 181 "ftpcmd.y"
1838 if((yyvsp[(5) - (5)].i))
1839 epsv ((yyvsp[(3) - (5)].s));
1840 free ((yyvsp[(3) - (5)].s));
1845 #line 187 "ftpcmd.y"
1847 if ((yyvsp[(5) - (5)].i)) {
1851 if (cmd_form == FORM_N) {
1852 reply(200, "Type set to A.");
1856 reply(504, "Form must be N.");
1860 reply(504, "Type E not implemented.");
1864 reply(200, "Type set to I.");
1870 if (cmd_bytesz == 8) {
1872 "Type set to L (byte size 8).");
1875 reply(504, "Byte size must be 8.");
1876 #else /* NBBY == 8 */
1877 UNIMPLEMENTED for NBBY != 8
1878 #endif /* NBBY == 8 */
1885 #line 224 "ftpcmd.y"
1887 if ((yyvsp[(5) - (5)].i)) {
1888 switch ((yyvsp[(3) - (5)].i)) {
1891 reply(200, "STRU F ok.");
1895 reply(504, "Unimplemented STRU type.");
1902 #line 238 "ftpcmd.y"
1904 if ((yyvsp[(5) - (5)].i)) {
1905 switch ((yyvsp[(3) - (5)].i)) {
1908 reply(200, "MODE S ok.");
1912 reply(502, "Unimplemented MODE type.");
1919 #line 252 "ftpcmd.y"
1921 if ((yyvsp[(5) - (5)].i)) {
1922 reply(202, "ALLO command ignored.");
1928 #line 258 "ftpcmd.y"
1930 if ((yyvsp[(9) - (9)].i)) {
1931 reply(202, "ALLO command ignored.");
1937 #line 264 "ftpcmd.y"
1939 char *name = (yyvsp[(3) - (5)].s);
1941 if ((yyvsp[(5) - (5)].i) && name != NULL)
1949 #line 273 "ftpcmd.y"
1951 char *name = (yyvsp[(3) - (5)].s);
1953 if ((yyvsp[(5) - (5)].i) && name != NULL)
1954 do_store(name, "w", 0);
1961 #line 282 "ftpcmd.y"
1963 char *name = (yyvsp[(3) - (5)].s);
1965 if ((yyvsp[(5) - (5)].i) && name != NULL)
1966 do_store(name, "a", 0);
1973 #line 291 "ftpcmd.y"
1975 if ((yyvsp[(3) - (3)].i))
1976 send_file_list(".");
1981 #line 296 "ftpcmd.y"
1983 char *name = (yyvsp[(3) - (5)].s);
1985 if ((yyvsp[(5) - (5)].i) && name != NULL)
1986 send_file_list(name);
1993 #line 305 "ftpcmd.y"
1995 if((yyvsp[(3) - (3)].i))
2001 #line 310 "ftpcmd.y"
2003 if((yyvsp[(5) - (5)].i))
2004 list_file((yyvsp[(3) - (5)].s));
2005 free((yyvsp[(3) - (5)].s));
2010 #line 316 "ftpcmd.y"
2012 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2013 statfilecmd((yyvsp[(3) - (5)].s));
2014 if ((yyvsp[(3) - (5)].s) != NULL)
2015 free((yyvsp[(3) - (5)].s));
2020 #line 323 "ftpcmd.y"
2022 if ((yyvsp[(3) - (3)].i))
2028 #line 328 "ftpcmd.y"
2030 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2031 do_delete((yyvsp[(3) - (5)].s));
2032 if ((yyvsp[(3) - (5)].s) != NULL)
2033 free((yyvsp[(3) - (5)].s));
2038 #line 335 "ftpcmd.y"
2040 if((yyvsp[(5) - (5)].i)){
2042 renamecmd(fromname, (yyvsp[(3) - (5)].s));
2044 fromname = (char *) 0;
2046 reply(503, "Bad sequence of commands.");
2049 if ((yyvsp[(3) - (5)].s) != NULL)
2050 free((yyvsp[(3) - (5)].s));
2055 #line 349 "ftpcmd.y"
2057 if ((yyvsp[(3) - (3)].i))
2058 reply(225, "ABOR command successful.");
2063 #line 354 "ftpcmd.y"
2065 if ((yyvsp[(3) - (3)].i))
2071 #line 359 "ftpcmd.y"
2073 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2074 cwd((yyvsp[(3) - (5)].s));
2075 if ((yyvsp[(3) - (5)].s) != NULL)
2076 free((yyvsp[(3) - (5)].s));
2081 #line 366 "ftpcmd.y"
2083 if ((yyvsp[(3) - (3)].i))
2084 help(cmdtab, (char *) 0);
2089 #line 371 "ftpcmd.y"
2091 if ((yyvsp[(5) - (5)].i)) {
2092 char *cp = (yyvsp[(3) - (5)].s);
2094 if (strncasecmp(cp, "SITE", 4) == 0) {
2095 cp = (yyvsp[(3) - (5)].s) + 4;
2101 help(sitetab, (char *) 0);
2103 help(cmdtab, (yyvsp[(3) - (5)].s));
2109 #line 388 "ftpcmd.y"
2111 if ((yyvsp[(3) - (3)].i))
2112 reply(200, "NOOP command successful.");
2117 #line 393 "ftpcmd.y"
2119 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2120 makedir((yyvsp[(3) - (5)].s));
2121 if ((yyvsp[(3) - (5)].s) != NULL)
2122 free((yyvsp[(3) - (5)].s));
2127 #line 400 "ftpcmd.y"
2129 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2130 removedir((yyvsp[(3) - (5)].s));
2131 if ((yyvsp[(3) - (5)].s) != NULL)
2132 free((yyvsp[(3) - (5)].s));
2137 #line 407 "ftpcmd.y"
2139 if ((yyvsp[(3) - (3)].i))
2145 #line 412 "ftpcmd.y"
2147 if ((yyvsp[(3) - (3)].i))
2153 #line 417 "ftpcmd.y"
2155 if ((yyvsp[(3) - (3)].i)) {
2156 lreply(211, "Supported features:");
2158 lreply(0, " REST STREAM");
2166 #line 427 "ftpcmd.y"
2168 if ((yyvsp[(5) - (5)].i))
2169 reply(501, "Bad options");
2170 free ((yyvsp[(3) - (5)].s));
2175 #line 434 "ftpcmd.y"
2177 if ((yyvsp[(5) - (5)].i))
2178 help(sitetab, (char *) 0);
2183 #line 439 "ftpcmd.y"
2185 if ((yyvsp[(7) - (7)].i))
2186 help(sitetab, (yyvsp[(5) - (7)].s));
2191 #line 444 "ftpcmd.y"
2193 if ((yyvsp[(5) - (5)].i)) {
2194 int oldmask = umask(0);
2196 reply(200, "Current UMASK is %03o", oldmask);
2202 #line 452 "ftpcmd.y"
2204 if ((yyvsp[(7) - (7)].i)) {
2205 if (((yyvsp[(5) - (7)].i) == -1) || ((yyvsp[(5) - (7)].i) > 0777)) {
2206 reply(501, "Bad UMASK value");
2208 int oldmask = umask((yyvsp[(5) - (7)].i));
2210 "UMASK set to %03o (was %03o)",
2211 (yyvsp[(5) - (7)].i), oldmask);
2218 #line 465 "ftpcmd.y"
2220 if ((yyvsp[(9) - (9)].i) && (yyvsp[(7) - (9)].s) != NULL) {
2221 if ((yyvsp[(5) - (9)].i) > 0777)
2223 "CHMOD: Mode value must be between 0 and 0777");
2224 else if (chmod((yyvsp[(7) - (9)].s), (yyvsp[(5) - (9)].i)) < 0)
2225 perror_reply(550, (yyvsp[(7) - (9)].s));
2227 reply(200, "CHMOD command successful.");
2229 if ((yyvsp[(7) - (9)].s) != NULL)
2230 free((yyvsp[(7) - (9)].s));
2235 #line 479 "ftpcmd.y"
2237 if ((yyvsp[(5) - (5)].i))
2239 "Current IDLE time limit is %d seconds; max %d",
2240 ftpd_timeout, maxtimeout);
2245 #line 486 "ftpcmd.y"
2247 if ((yyvsp[(7) - (7)].i)) {
2248 if ((yyvsp[(5) - (7)].i) < 30 || (yyvsp[(5) - (7)].i) > maxtimeout) {
2250 "Maximum IDLE time must be between 30 and %d seconds",
2253 ftpd_timeout = (yyvsp[(5) - (7)].i);
2254 alarm((unsigned) ftpd_timeout);
2256 "Maximum IDLE time set to %d seconds",
2264 #line 503 "ftpcmd.y"
2270 reply(500, "Can't be done as guest.");
2272 if((yyvsp[(7) - (7)].i) && (yyvsp[(5) - (7)].s) != NULL){
2273 p = strpbrk((yyvsp[(5) - (7)].s), " \t");
2276 kauth((yyvsp[(5) - (7)].s), p + strspn(p, " \t"));
2278 kauth((yyvsp[(5) - (7)].s), NULL);
2281 if((yyvsp[(5) - (7)].s) != NULL)
2282 free((yyvsp[(5) - (7)].s));
2284 reply(500, "Command not implemented.");
2290 #line 526 "ftpcmd.y"
2292 if((yyvsp[(5) - (5)].i))
2298 #line 531 "ftpcmd.y"
2301 if((yyvsp[(5) - (5)].i))
2304 reply(500, "Command not implemented.");
2310 #line 540 "ftpcmd.y"
2314 reply(500, "Can't be done as guest.");
2315 else if((yyvsp[(7) - (7)].i) && (yyvsp[(5) - (7)].s))
2316 krbtkfile((yyvsp[(5) - (7)].s));
2317 if((yyvsp[(5) - (7)].s))
2318 free((yyvsp[(5) - (7)].s));
2320 reply(500, "Command not implemented.");
2326 #line 553 "ftpcmd.y"
2328 #if defined(KRB4) || defined(KRB5)
2330 reply(500, "Can't be done as guest.");
2331 else if((yyvsp[(5) - (5)].i))
2334 reply(500, "Command not implemented.");
2340 #line 564 "ftpcmd.y"
2342 #if defined(KRB4) || defined(KRB5)
2344 reply(500, "Can't be done as guest.");
2345 else if((yyvsp[(7) - (7)].i))
2346 afslog((yyvsp[(5) - (7)].s), 0);
2347 if((yyvsp[(5) - (7)].s))
2348 free((yyvsp[(5) - (7)].s));
2350 reply(500, "Command not implemented.");
2356 #line 577 "ftpcmd.y"
2358 if((yyvsp[(7) - (7)].i) && (yyvsp[(5) - (7)].s) != NULL)
2359 find((yyvsp[(5) - (7)].s));
2360 if((yyvsp[(5) - (7)].s) != NULL)
2361 free((yyvsp[(5) - (7)].s));
2366 #line 584 "ftpcmd.y"
2368 if ((yyvsp[(5) - (5)].i))
2369 reply(200, "http://www.pdc.kth.se/heimdal/");
2374 #line 589 "ftpcmd.y"
2376 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2377 do_store((yyvsp[(3) - (5)].s), "w", 1);
2378 if ((yyvsp[(3) - (5)].s) != NULL)
2379 free((yyvsp[(3) - (5)].s));
2384 #line 596 "ftpcmd.y"
2386 if ((yyvsp[(3) - (3)].i)) {
2387 #if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)
2388 reply(215, "UNIX Type: L%d", NBBY);
2390 reply(215, "UNKNOWN Type: L%d", NBBY);
2397 #line 614 "ftpcmd.y"
2399 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)
2400 sizecmd((yyvsp[(3) - (5)].s));
2401 if ((yyvsp[(3) - (5)].s) != NULL)
2402 free((yyvsp[(3) - (5)].s));
2407 #line 631 "ftpcmd.y"
2409 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL) {
2411 if (stat((yyvsp[(3) - (5)].s), &stbuf) < 0)
2412 reply(550, "%s: %s",
2413 (yyvsp[(3) - (5)].s), strerror(errno));
2414 else if (!S_ISREG(stbuf.st_mode)) {
2416 "%s: not a plain file.", (yyvsp[(3) - (5)].s));
2419 time_t mtime = stbuf.st_mtime;
2423 "%04d%02d%02d%02d%02d%02d",
2432 if ((yyvsp[(3) - (5)].s) != NULL)
2433 free((yyvsp[(3) - (5)].s));
2438 #line 659 "ftpcmd.y"
2440 if ((yyvsp[(3) - (3)].i)) {
2441 reply(221, "Goodbye.");
2448 #line 666 "ftpcmd.y"
2455 #line 672 "ftpcmd.y"
2457 restart_point = (off_t) 0;
2458 if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s)) {
2459 fromname = renamefrom((yyvsp[(3) - (5)].s));
2460 if (fromname == (char *) 0 && (yyvsp[(3) - (5)].s)) {
2461 free((yyvsp[(3) - (5)].s));
2468 #line 682 "ftpcmd.y"
2470 if ((yyvsp[(5) - (5)].i)) {
2471 fromname = (char *) 0;
2472 restart_point = (yyvsp[(3) - (5)].i); /* XXX $3 is only "int" */
2473 reply(350, "Restarting at %ld. %s",
2474 (long)restart_point,
2475 "Send STORE or RETRIEVE to initiate transfer.");
2481 #line 692 "ftpcmd.y"
2483 auth((yyvsp[(3) - (4)].s));
2484 free((yyvsp[(3) - (4)].s));
2489 #line 697 "ftpcmd.y"
2491 adat((yyvsp[(3) - (4)].s));
2492 free((yyvsp[(3) - (4)].s));
2497 #line 702 "ftpcmd.y"
2499 if ((yyvsp[(5) - (5)].i))
2500 pbsz((yyvsp[(3) - (5)].i));
2505 #line 707 "ftpcmd.y"
2507 if ((yyvsp[(5) - (5)].i))
2508 prot((yyvsp[(3) - (5)].s));
2513 #line 712 "ftpcmd.y"
2515 if ((yyvsp[(3) - (3)].i))
2521 #line 717 "ftpcmd.y"
2523 mec((yyvsp[(3) - (4)].s), prot_safe);
2524 free((yyvsp[(3) - (4)].s));
2529 #line 722 "ftpcmd.y"
2531 mec((yyvsp[(3) - (4)].s), prot_confidential);
2532 free((yyvsp[(3) - (4)].s));
2537 #line 727 "ftpcmd.y"
2539 mec((yyvsp[(3) - (4)].s), prot_private);
2540 free((yyvsp[(3) - (4)].s));
2545 #line 739 "ftpcmd.y"
2547 (yyval.s) = (char *)calloc(1, sizeof(char));
2552 #line 752 "ftpcmd.y"
2554 struct sockaddr_in *sin4 = (struct sockaddr_in *)data_dest;
2556 sin4->sin_family = AF_INET;
2557 sin4->sin_port = htons((yyvsp[(9) - (11)].i) * 256 + (yyvsp[(11) - (11)].i));
2558 sin4->sin_addr.s_addr =
2559 htonl(((yyvsp[(1) - (11)].i) << 24) | ((yyvsp[(3) - (11)].i) << 16) | ((yyvsp[(5) - (11)].i) << 8) | (yyvsp[(7) - (11)].i));
2564 #line 764 "ftpcmd.y"
2571 #line 768 "ftpcmd.y"
2578 #line 772 "ftpcmd.y"
2585 #line 779 "ftpcmd.y"
2593 #line 784 "ftpcmd.y"
2596 cmd_form = (yyvsp[(3) - (3)].i);
2601 #line 789 "ftpcmd.y"
2609 #line 794 "ftpcmd.y"
2612 cmd_form = (yyvsp[(3) - (3)].i);
2617 #line 799 "ftpcmd.y"
2624 #line 803 "ftpcmd.y"
2632 #line 808 "ftpcmd.y"
2635 cmd_bytesz = (yyvsp[(3) - (3)].i);
2640 #line 814 "ftpcmd.y"
2643 cmd_bytesz = (yyvsp[(2) - (2)].i);
2648 #line 822 "ftpcmd.y"
2655 #line 826 "ftpcmd.y"
2662 #line 830 "ftpcmd.y"
2669 #line 837 "ftpcmd.y"
2676 #line 841 "ftpcmd.y"
2683 #line 845 "ftpcmd.y"
2690 #line 852 "ftpcmd.y"
2693 * Problem: this production is used for all pathname
2694 * processing, but only gives a 550 error reply.
2695 * This is a valid reply in some cases but not in others.
2697 if (logged_in && (yyvsp[(1) - (1)].s) && *(yyvsp[(1) - (1)].s) == '~') {
2700 GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;
2702 memset(&gl, 0, sizeof(gl));
2703 if (glob((yyvsp[(1) - (1)].s), flags, NULL, &gl) ||
2705 reply(550, "not found");
2708 (yyval.s) = strdup(gl.gl_pathv[0]);
2711 free((yyvsp[(1) - (1)].s));
2713 (yyval.s) = (yyvsp[(1) - (1)].s);
2718 #line 884 "ftpcmd.y"
2720 int ret, dec, multby, digit;
2723 * Convert a number that was read as decimal number
2724 * to what it would be if it had been read as octal.
2726 dec = (yyvsp[(1) - (1)].i);
2735 ret += digit * multby;
2744 #line 910 "ftpcmd.y"
2746 (yyval.i) = (yyvsp[(1) - (1)].i) && !guest;
2747 if((yyvsp[(1) - (1)].i) && !(yyval.i))
2748 reply(550, "Permission denied");
2753 #line 918 "ftpcmd.y"
2755 if((yyvsp[(1) - (1)].i)) {
2756 if(((yyval.i) = logged_in) == 0)
2757 reply(530, "Please login with USER and PASS.");
2764 #line 928 "ftpcmd.y"
2767 if(sec_complete && !ccc_passed && !secure_command()) {
2769 reply(533, "Command protection level denied "
2770 "for paranoid reasons.");
2776 /* Line 1267 of yacc.c. */
2777 #line 2778 "ftpcmd.c"
2780 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2784 YY_STACK_PRINT (yyss, yyssp);
2789 /* Now `shift' the result of the reduction. Determine what state
2790 that goes to, based on the state we popped back to and the rule
2791 number reduced by. */
2795 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2796 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2797 yystate = yytable[yystate];
2799 yystate = yydefgoto[yyn - YYNTOKENS];
2804 /*------------------------------------.
2805 | yyerrlab -- here on detecting error |
2806 `------------------------------------*/
2808 /* If not already recovering from an error, report this error. */
2812 #if ! YYERROR_VERBOSE
2813 yyerror (YY_("syntax error"));
2816 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2817 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2819 YYSIZE_T yyalloc = 2 * yysize;
2820 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2821 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2822 if (yymsg != yymsgbuf)
2823 YYSTACK_FREE (yymsg);
2824 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2826 yymsg_alloc = yyalloc;
2830 yymsg_alloc = sizeof yymsgbuf;
2834 if (0 < yysize && yysize <= yymsg_alloc)
2836 (void) yysyntax_error (yymsg, yystate, yychar);
2841 yyerror (YY_("syntax error"));
2843 goto yyexhaustedlab;
2851 if (yyerrstatus == 3)
2853 /* If just tried and failed to reuse look-ahead token after an
2854 error, discard it. */
2856 if (yychar <= YYEOF)
2858 /* Return failure if at end of input. */
2859 if (yychar == YYEOF)
2864 yydestruct ("Error: discarding",
2870 /* Else will try to reuse look-ahead token after shifting the error
2875 /*---------------------------------------------------.
2876 | yyerrorlab -- error raised explicitly by YYERROR. |
2877 `---------------------------------------------------*/
2880 /* Pacify compilers like GCC when the user code never invokes
2881 YYERROR and the label yyerrorlab therefore never appears in user
2883 if (/*CONSTCOND*/ 0)
2886 /* Do not reclaim the symbols of the rule which action triggered
2890 YY_STACK_PRINT (yyss, yyssp);
2895 /*-------------------------------------------------------------.
2896 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2897 `-------------------------------------------------------------*/
2899 yyerrstatus = 3; /* Each real token shifted decrements this. */
2903 yyn = yypact[yystate];
2904 if (yyn != YYPACT_NINF)
2907 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2915 /* Pop the current state because it cannot handle the error token. */
2920 yydestruct ("Error: popping",
2921 yystos[yystate], yyvsp);
2924 YY_STACK_PRINT (yyss, yyssp);
2933 /* Shift the error token. */
2934 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2940 /*-------------------------------------.
2941 | yyacceptlab -- YYACCEPT comes here. |
2942 `-------------------------------------*/
2947 /*-----------------------------------.
2948 | yyabortlab -- YYABORT comes here. |
2949 `-----------------------------------*/
2955 /*-------------------------------------------------.
2956 | yyexhaustedlab -- memory exhaustion comes here. |
2957 `-------------------------------------------------*/
2959 yyerror (YY_("memory exhausted"));
2965 if (yychar != YYEOF && yychar != YYEMPTY)
2966 yydestruct ("Cleanup: discarding lookahead",
2968 /* Do not reclaim the symbols of the rule which action triggered
2969 this YYABORT or YYACCEPT. */
2971 YY_STACK_PRINT (yyss, yyssp);
2972 while (yyssp != yyss)
2974 yydestruct ("Cleanup: popping",
2975 yystos[*yyssp], yyvsp);
2980 YYSTACK_FREE (yyss);
2983 if (yymsg != yymsgbuf)
2984 YYSTACK_FREE (yymsg);
2986 /* Make sure YYID is used. */
2987 return YYID (yyresult);
2991 #line 938 "ftpcmd.y"
2994 #define CMD 0 /* beginning of command */
2995 #define ARGS 1 /* expect miscellaneous arguments */
2996 #define STR1 2 /* expect SP followed by STRING */
2997 #define STR2 3 /* expect STRING */
2998 #define OSTR 4 /* optional SP then STRING */
2999 #define ZSTR1 5 /* SP then optional STRING */
3000 #define ZSTR2 6 /* optional STRING after SP */
3001 #define SITECMD 7 /* SITE command */
3002 #define NSTR 8 /* Number followed by a string */
3004 struct tab cmdtab[] = { /* In order defined in RFC 765 */
3005 { "USER", USER, STR1, 1, "<sp> username" },
3006 { "PASS", PASS, ZSTR1, 1, "<sp> password" },
3007 { "ACCT", ACCT, STR1, 0, "(specify account)" },
3008 { "SMNT", SMNT, ARGS, 0, "(structure mount)" },
3009 { "REIN", REIN, ARGS, 0, "(reinitialize server state)" },
3010 { "QUIT", QUIT, ARGS, 1, "(terminate service)", },
3011 { "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },
3012 { "EPRT", EPRT, STR1, 1, "<sp> string" },
3013 { "PASV", PASV, ARGS, 1, "(set server in passive mode)" },
3014 { "EPSV", EPSV, OSTR, 1, "[<sp> foo]" },
3015 { "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },
3016 { "STRU", STRU, ARGS, 1, "(specify file structure)" },
3017 { "MODE", MODE, ARGS, 1, "(specify transfer mode)" },
3018 { "RETR", RETR, STR1, 1, "<sp> file-name" },
3019 { "STOR", STOR, STR1, 1, "<sp> file-name" },
3020 { "APPE", APPE, STR1, 1, "<sp> file-name" },
3021 { "MLFL", MLFL, OSTR, 0, "(mail file)" },
3022 { "MAIL", MAIL, OSTR, 0, "(mail to user)" },
3023 { "MSND", MSND, OSTR, 0, "(mail send to terminal)" },
3024 { "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },
3025 { "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },
3026 { "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
3027 { "MRCP", MRCP, STR1, 0, "(mail recipient)" },
3028 { "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
3029 { "REST", REST, ARGS, 1, "<sp> offset (restart command)" },
3030 { "RNFR", RNFR, STR1, 1, "<sp> file-name" },
3031 { "RNTO", RNTO, STR1, 1, "<sp> file-name" },
3032 { "ABOR", ABOR, ARGS, 1, "(abort operation)" },
3033 { "DELE", DELE, STR1, 1, "<sp> file-name" },
3034 { "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
3035 { "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },
3036 { "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },
3037 { "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },
3038 { "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },
3039 { "SYST", SYST, ARGS, 1, "(get type of operating system)" },
3040 { "STAT", sTAT, OSTR, 1, "[ <sp> path-name ]" },
3041 { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
3042 { "NOOP", NOOP, ARGS, 1, "" },
3043 { "MKD", MKD, STR1, 1, "<sp> path-name" },
3044 { "XMKD", MKD, STR1, 1, "<sp> path-name" },
3045 { "RMD", RMD, STR1, 1, "<sp> path-name" },
3046 { "XRMD", RMD, STR1, 1, "<sp> path-name" },
3047 { "PWD", PWD, ARGS, 1, "(return current directory)" },
3048 { "XPWD", PWD, ARGS, 1, "(return current directory)" },
3049 { "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },
3050 { "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },
3051 { "STOU", STOU, STR1, 1, "<sp> file-name" },
3052 { "SIZE", SIZE, OSTR, 1, "<sp> path-name" },
3053 { "MDTM", MDTM, OSTR, 1, "<sp> path-name" },
3055 /* extensions from RFC2228 */
3056 { "AUTH", AUTH, STR1, 1, "<sp> auth-type" },
3057 { "ADAT", ADAT, STR1, 1, "<sp> auth-data" },
3058 { "PBSZ", PBSZ, ARGS, 1, "<sp> buffer-size" },
3059 { "PROT", PROT, STR1, 1, "<sp> prot-level" },
3060 { "CCC", CCC, ARGS, 1, "" },
3061 { "MIC", MIC, STR1, 1, "<sp> integrity command" },
3062 { "CONF", CONF, STR1, 1, "<sp> confidentiality command" },
3063 { "ENC", ENC, STR1, 1, "<sp> privacy command" },
3066 { "FEAT", FEAT, ARGS, 1, "" },
3067 { "OPTS", OPTS, ARGS, 1, "<sp> command [<sp> options]" },
3069 { NULL, 0, 0, 0, 0 }
3072 struct tab sitetab[] = {
3073 { "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },
3074 { "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },
3075 { "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },
3076 { "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },
3078 { "KAUTH", KAUTH, STR1, 1, "<sp> principal [ <sp> ticket ]" },
3079 { "KLIST", KLIST, ARGS, 1, "(show ticket file)" },
3080 { "KDESTROY", KDESTROY, ARGS, 1, "(destroy tickets)" },
3081 { "KRBTKFILE", KRBTKFILE, STR1, 1, "<sp> ticket-file" },
3082 { "AFSLOG", AFSLOG, OSTR, 1, "[<sp> cell]" },
3084 { "LOCATE", LOCATE, STR1, 1, "<sp> globexpr" },
3085 { "FIND", LOCATE, STR1, 1, "<sp> globexpr" },
3087 { "URL", URL, ARGS, 1, "?" },
3089 { NULL, 0, 0, 0, 0 }
3093 lookup(struct tab *p, char *cmd)
3096 for (; p->name != NULL; p++)
3097 if (strcmp(cmd, p->name) == 0)
3103 * ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.
3106 ftpd_getline(char *s, int n)
3113 /* might still be data within the security MIC/CONF/ENC */
3115 strlcpy(s, ftp_command, n);
3117 syslog(LOG_DEBUG, "command: %s", s);
3120 while ((c = getc(stdin)) != EOF) {
3123 if ((c = getc(stdin)) != EOF) {
3129 printf("%c%c%c", IAC, DONT, 0377&c);
3135 printf("%c%c%c", IAC, WONT, 0377&c);
3141 continue; /* ignore command */
3146 if (--n <= 0 || c == '\n')
3149 if (c == EOF && cs == s)
3153 if (!guest && strncasecmp("pass ", s, 5) == 0) {
3154 /* Don't syslog passwords */
3155 syslog(LOG_DEBUG, "command: %.5s ???", s);
3160 /* Don't syslog trailing CR-LF */
3163 while (cp >= s && (*cp == '\n' || *cp == '\r')) {
3167 syslog(LOG_DEBUG, "command: %.*s", len, s);
3171 fprintf(stderr, "%s\n", s);
3181 "Timeout (%d seconds): closing control connection.",
3184 syslog(LOG_INFO, "User %s timed out after %d seconds",
3185 (pw ? pw -> pw_name : "unknown"), ftpd_timeout);
3193 static int cpos, state;
3205 signal(SIGALRM, toolong);
3206 alarm((unsigned) ftpd_timeout);
3207 if (ftpd_getline(cbuf, sizeof(cbuf)-1) == NULL) {
3208 reply(221, "You could at least say goodbye.");
3212 #ifdef HAVE_SETPROCTITLE
3213 if (strncasecmp(cbuf, "PASS", 4) != 0)
3214 setproctitle("%s: %s", proctitle, cbuf);
3215 #endif /* HAVE_SETPROCTITLE */
3216 if ((cp = strchr(cbuf, '\r'))) {
3220 if ((cp = strpbrk(cbuf, " \n")))
3227 p = lookup(cmdtab, cbuf);
3230 if (p->implemented == 0) {
3242 if (cbuf[cpos] == ' ') {
3247 if ((cp2 = strpbrk(cp, " \n")))
3252 p = lookup(sitetab, cp);
3255 if (p->implemented == 0) {
3269 if (cbuf[cpos] == '\n') {
3278 if (cbuf[cpos] == ' ') {
3289 if (cbuf[cpos] == '\n') {
3300 * Make sure the string is nonempty and \n terminated.
3302 if (n > 1 && cbuf[cpos] == '\n') {
3304 yylval.s = copy(cp);
3312 if (cbuf[cpos] == ' ') {
3316 if (isdigit((unsigned char)cbuf[cpos])) {
3318 while (isdigit((unsigned char)cbuf[++cpos]))
3322 yylval.i = atoi(cp);
3331 if (isdigit((unsigned char)cbuf[cpos])) {
3333 while (isdigit((unsigned char)cbuf[++cpos]))
3337 yylval.i = atoi(cp);
3341 switch (cbuf[cpos++]) {
3405 fatal("Unknown state in scanner.");
3422 if ((cp = strchr(cbuf,'\n')))
3424 reply(500, "'%s': command not understood.", cbuf);
3435 fatal("Ran out of memory.");
3440 help(struct tab *ctab, char *s)
3447 if (ctab == sitetab)
3451 width = 0, NCMDS = 0;
3452 for (c = ctab; c->name != NULL; c++) {
3453 int len = strlen(c->name);
3459 width = (width + 8) &~ 7;
3464 lreply(214, "The following %scommands are recognized %s.",
3465 t, "(* =>'s unimplemented)");
3466 columns = 76 / width;
3469 lines = (NCMDS + columns - 1) / columns;
3470 for (i = 0; i < lines; i++) {
3471 strlcpy (buf, " ", sizeof(buf));
3472 for (j = 0; j < columns; j++) {
3473 c = ctab + j * lines + i;
3474 snprintf (buf + strlen(buf),
3475 sizeof(buf) - strlen(buf),
3478 c->implemented ? ' ' : '*');
3479 if (c + lines >= &ctab[NCMDS])
3481 w = strlen(c->name) + 1;
3489 lreply(214, "%s", buf);
3491 reply(214, "Direct comments to kth-krb-bugs@pdc.kth.se");
3495 c = lookup(ctab, s);
3496 if (c == (struct tab *)0) {
3497 reply(502, "Unknown command %s.", s);
3501 reply(214, "Syntax: %s%s %s", t, c->name, c->help);
3503 reply(214, "%s%-*s\t%s; unimplemented.", t, width,
3508 sizecmd(char *filename)
3514 if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
3515 reply(550, "%s: not a plain file.", filename);
3517 reply(213, "%lu", (unsigned long)stbuf.st_size);
3525 fin = fopen(filename, "r");
3527 perror_reply(550, filename);
3530 if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
3531 reply(550, "%s: not a plain file.", filename);
3537 while((c=getc(fin)) != EOF) {
3538 if (c == '\n') /* will get expanded to \r\n */
3544 reply(213, "%lu", (unsigned long)count);
3548 reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);