Path: blob/main/crypto/heimdal/appl/ftp/ftpd/ftpcmd.c
34890 views
/* A Bison parser, made by GNU Bison 2.3. */12/* Skeleton implementation for Bison's Yacc-like parsers in C34Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 20065Free Software Foundation, Inc.67This program is free software; you can redistribute it and/or modify8it under the terms of the GNU General Public License as published by9the Free Software Foundation; either version 2, or (at your option)10any later version.1112This program is distributed in the hope that it will be useful,13but WITHOUT ANY WARRANTY; without even the implied warranty of14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15GNU General Public License for more details.1617You should have received a copy of the GNU General Public License18along with this program; if not, write to the Free Software19Foundation, Inc., 51 Franklin Street, Fifth Floor,20Boston, MA 02110-1301, USA. */2122/* As a special exception, you may create a larger work that contains23part or all of the Bison parser skeleton and distribute that work24under terms of your choice, so long as that work isn't itself a25parser generator using the skeleton or a modified version thereof26as a parser skeleton. Alternatively, if you modify or redistribute27the parser skeleton itself, you may (at your option) remove this28special exception, which will cause the skeleton and the resulting29Bison output files to be licensed under the GNU General Public30License without this special exception.3132This special exception was added by the Free Software Foundation in33version 2.2 of Bison. */3435/* C LALR(1) parser skeleton written by Richard Stallman, by36simplifying the original so-called "semantic" parser. */3738/* All symbols defined below should begin with yy or YY, to avoid39infringing on user name space. This should be done even for local40variables, as they might otherwise be expanded by user macros.41There are some unavoidable exceptions within include files to42define necessary library symbols; they are noted "INFRINGES ON43USER NAME SPACE" below. */4445/* Identify Bison output. */46#define YYBISON 14748/* Bison version. */49#define YYBISON_VERSION "2.3"5051/* Skeleton name. */52#define YYSKELETON_NAME "yacc.c"5354/* Pure parsers. */55#define YYPURE 05657/* Using locations. */58#define YYLSP_NEEDED 059606162/* Tokens. */63#ifndef YYTOKENTYPE64# define YYTOKENTYPE65/* Put the tokens into the symbol table, so that GDB and other debuggers66know about them. */67enum yytokentype {68A = 258,69B = 259,70C = 260,71E = 261,72F = 262,73I = 263,74L = 264,75N = 265,76P = 266,77R = 267,78S = 268,79T = 269,80SP = 270,81CRLF = 271,82COMMA = 272,83USER = 273,84PASS = 274,85ACCT = 275,86REIN = 276,87QUIT = 277,88PORT = 278,89PASV = 279,90TYPE = 280,91STRU = 281,92MODE = 282,93RETR = 283,94STOR = 284,95APPE = 285,96MLFL = 286,97MAIL = 287,98MSND = 288,99MSOM = 289,100MSAM = 290,101MRSQ = 291,102MRCP = 292,103ALLO = 293,104REST = 294,105RNFR = 295,106RNTO = 296,107ABOR = 297,108DELE = 298,109CWD = 299,110LIST = 300,111NLST = 301,112SITE = 302,113sTAT = 303,114HELP = 304,115NOOP = 305,116MKD = 306,117RMD = 307,118PWD = 308,119CDUP = 309,120STOU = 310,121SMNT = 311,122SYST = 312,123SIZE = 313,124MDTM = 314,125EPRT = 315,126EPSV = 316,127UMASK = 317,128IDLE = 318,129CHMOD = 319,130AUTH = 320,131ADAT = 321,132PROT = 322,133PBSZ = 323,134CCC = 324,135MIC = 325,136CONF = 326,137ENC = 327,138KAUTH = 328,139KLIST = 329,140KDESTROY = 330,141KRBTKFILE = 331,142AFSLOG = 332,143LOCATE = 333,144URL = 334,145FEAT = 335,146OPTS = 336,147LEXERR = 337,148STRING = 338,149NUMBER = 339150};151#endif152/* Tokens. */153#define A 258154#define B 259155#define C 260156#define E 261157#define F 262158#define I 263159#define L 264160#define N 265161#define P 266162#define R 267163#define S 268164#define T 269165#define SP 270166#define CRLF 271167#define COMMA 272168#define USER 273169#define PASS 274170#define ACCT 275171#define REIN 276172#define QUIT 277173#define PORT 278174#define PASV 279175#define TYPE 280176#define STRU 281177#define MODE 282178#define RETR 283179#define STOR 284180#define APPE 285181#define MLFL 286182#define MAIL 287183#define MSND 288184#define MSOM 289185#define MSAM 290186#define MRSQ 291187#define MRCP 292188#define ALLO 293189#define REST 294190#define RNFR 295191#define RNTO 296192#define ABOR 297193#define DELE 298194#define CWD 299195#define LIST 300196#define NLST 301197#define SITE 302198#define sTAT 303199#define HELP 304200#define NOOP 305201#define MKD 306202#define RMD 307203#define PWD 308204#define CDUP 309205#define STOU 310206#define SMNT 311207#define SYST 312208#define SIZE 313209#define MDTM 314210#define EPRT 315211#define EPSV 316212#define UMASK 317213#define IDLE 318214#define CHMOD 319215#define AUTH 320216#define ADAT 321217#define PROT 322218#define PBSZ 323219#define CCC 324220#define MIC 325221#define CONF 326222#define ENC 327223#define KAUTH 328224#define KLIST 329225#define KDESTROY 330226#define KRBTKFILE 331227#define AFSLOG 332228#define LOCATE 333229#define URL 334230#define FEAT 335231#define OPTS 336232#define LEXERR 337233#define STRING 338234#define NUMBER 339235236237238239/* Copy the first part of user declarations. */240#line 43 "ftpcmd.y"241242243#include "ftpd_locl.h"244RCSID("$Id$");245246off_t restart_point;247248static int hasyyerrored;249250251static int cmd_type;252static int cmd_form;253static int cmd_bytesz;254char cbuf[64*1024];255char *fromname;256257struct tab {258char *name;259short token;260short state;261short implemented; /* 1 if command is implemented */262char *help;263};264265extern struct tab cmdtab[];266extern struct tab sitetab[];267268static char *copy (char *);269static void help (struct tab *, char *);270static struct tab *271lookup (struct tab *, char *);272static void sizecmd (char *);273static RETSIGTYPE toolong (int);274static int yylex (void);275276/* This is for bison */277278#if !defined(alloca) && !defined(HAVE_ALLOCA)279#define alloca(x) malloc(x)280#endif281282283284/* Enabling traces. */285#ifndef YYDEBUG286# define YYDEBUG 0287#endif288289/* Enabling verbose error messages. */290#ifdef YYERROR_VERBOSE291# undef YYERROR_VERBOSE292# define YYERROR_VERBOSE 1293#else294# define YYERROR_VERBOSE 0295#endif296297/* Enabling the token table. */298#ifndef YYTOKEN_TABLE299# define YYTOKEN_TABLE 0300#endif301302#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED303typedef union YYSTYPE304#line 86 "ftpcmd.y"305{306int i;307char *s;308}309/* Line 193 of yacc.c. */310#line 312 "ftpcmd.c"311YYSTYPE;312# define yystype YYSTYPE /* obsolescent; will be withdrawn */313# define YYSTYPE_IS_DECLARED 1314# define YYSTYPE_IS_TRIVIAL 1315#endif316317318319/* Copy the second part of user declarations. */320321322/* Line 216 of yacc.c. */323#line 325 "ftpcmd.c"324325#ifdef short326# undef short327#endif328329#ifdef YYTYPE_UINT8330typedef YYTYPE_UINT8 yytype_uint8;331#else332typedef unsigned char yytype_uint8;333#endif334335#ifdef YYTYPE_INT8336typedef YYTYPE_INT8 yytype_int8;337#elif (defined __STDC__ || defined __C99__FUNC__ \338|| defined __cplusplus || defined _MSC_VER)339typedef signed char yytype_int8;340#else341typedef short int yytype_int8;342#endif343344#ifdef YYTYPE_UINT16345typedef YYTYPE_UINT16 yytype_uint16;346#else347typedef unsigned short int yytype_uint16;348#endif349350#ifdef YYTYPE_INT16351typedef YYTYPE_INT16 yytype_int16;352#else353typedef short int yytype_int16;354#endif355356#ifndef YYSIZE_T357# ifdef __SIZE_TYPE__358# define YYSIZE_T __SIZE_TYPE__359# elif defined size_t360# define YYSIZE_T size_t361# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \362|| defined __cplusplus || defined _MSC_VER)363# include <stddef.h> /* INFRINGES ON USER NAME SPACE */364# define YYSIZE_T size_t365# else366# define YYSIZE_T unsigned int367# endif368#endif369370#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)371372#ifndef YY_373# if defined YYENABLE_NLS && YYENABLE_NLS374# if ENABLE_NLS375# include <libintl.h> /* INFRINGES ON USER NAME SPACE */376# define YY_(msgid) dgettext ("bison-runtime", msgid)377# endif378# endif379# ifndef YY_380# define YY_(msgid) msgid381# endif382#endif383384/* Suppress unused-variable warnings by "using" E. */385#if ! defined lint || defined __GNUC__386# define YYUSE(e) ((void) (e))387#else388# define YYUSE(e) /* empty */389#endif390391/* Identity function, used to suppress warnings about constant conditions. */392#ifndef lint393# define YYID(n) (n)394#else395#if (defined __STDC__ || defined __C99__FUNC__ \396|| defined __cplusplus || defined _MSC_VER)397static int398YYID (int i)399#else400static int401YYID (i)402int i;403#endif404{405return i;406}407#endif408409#if ! defined yyoverflow || YYERROR_VERBOSE410411/* The parser invokes alloca or malloc; define the necessary symbols. */412413# ifdef YYSTACK_USE_ALLOCA414# if YYSTACK_USE_ALLOCA415# ifdef __GNUC__416# define YYSTACK_ALLOC __builtin_alloca417# elif defined __BUILTIN_VA_ARG_INCR418# include <alloca.h> /* INFRINGES ON USER NAME SPACE */419# elif defined _AIX420# define YYSTACK_ALLOC __alloca421# elif defined _MSC_VER422# include <malloc.h> /* INFRINGES ON USER NAME SPACE */423# define alloca _alloca424# else425# define YYSTACK_ALLOC alloca426# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \427|| defined __cplusplus || defined _MSC_VER)428# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */429# ifndef _STDLIB_H430# define _STDLIB_H 1431# endif432# endif433# endif434# endif435# endif436437# ifdef YYSTACK_ALLOC438/* Pacify GCC's `empty if-body' warning. */439# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))440# ifndef YYSTACK_ALLOC_MAXIMUM441/* The OS might guarantee only one guard page at the bottom of the stack,442and a page size can be as small as 4096 bytes. So we cannot safely443invoke alloca (N) if N exceeds 4096. Use a slightly smaller number444to allow for a few compiler-allocated temporary stack slots. */445# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */446# endif447# else448# define YYSTACK_ALLOC YYMALLOC449# define YYSTACK_FREE YYFREE450# ifndef YYSTACK_ALLOC_MAXIMUM451# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM452# endif453# if (defined __cplusplus && ! defined _STDLIB_H \454&& ! ((defined YYMALLOC || defined malloc) \455&& (defined YYFREE || defined free)))456# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */457# ifndef _STDLIB_H458# define _STDLIB_H 1459# endif460# endif461# ifndef YYMALLOC462# define YYMALLOC malloc463# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \464|| defined __cplusplus || defined _MSC_VER)465void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */466# endif467# endif468# ifndef YYFREE469# define YYFREE free470# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \471|| defined __cplusplus || defined _MSC_VER)472void free (void *); /* INFRINGES ON USER NAME SPACE */473# endif474# endif475# endif476#endif /* ! defined yyoverflow || YYERROR_VERBOSE */477478479#if (! defined yyoverflow \480&& (! defined __cplusplus \481|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))482483/* A type that is properly aligned for any stack member. */484union yyalloc485{486yytype_int16 yyss;487YYSTYPE yyvs;488};489490/* The size of the maximum gap between one aligned stack and the next. */491# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)492493/* The size of an array large to enough to hold all stacks, each with494N elements. */495# define YYSTACK_BYTES(N) \496((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \497+ YYSTACK_GAP_MAXIMUM)498499/* Copy COUNT objects from FROM to TO. The source and destination do500not overlap. */501# ifndef YYCOPY502# if defined __GNUC__ && 1 < __GNUC__503# define YYCOPY(To, From, Count) \504__builtin_memcpy (To, From, (Count) * sizeof (*(From)))505# else506# define YYCOPY(To, From, Count) \507do \508{ \509YYSIZE_T yyi; \510for (yyi = 0; yyi < (Count); yyi++) \511(To)[yyi] = (From)[yyi]; \512} \513while (YYID (0))514# endif515# endif516517/* Relocate STACK from its old location to the new one. The518local variables YYSIZE and YYSTACKSIZE give the old and new number of519elements in the stack, and YYPTR gives the new location of the520stack. Advance YYPTR to a properly aligned location for the next521stack. */522# define YYSTACK_RELOCATE(Stack) \523do \524{ \525YYSIZE_T yynewbytes; \526YYCOPY (&yyptr->Stack, Stack, yysize); \527Stack = &yyptr->Stack; \528yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \529yyptr += yynewbytes / sizeof (*yyptr); \530} \531while (YYID (0))532533#endif534535/* YYFINAL -- State number of the termination state. */536#define YYFINAL 2537/* YYLAST -- Last index in YYTABLE. */538#define YYLAST 327539540/* YYNTOKENS -- Number of terminals. */541#define YYNTOKENS 85542/* YYNNTS -- Number of nonterminals. */543#define YYNNTS 18544/* YYNRULES -- Number of rules. */545#define YYNRULES 98546/* YYNRULES -- Number of states. */547#define YYNSTATES 317548549/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */550#define YYUNDEFTOK 2551#define YYMAXUTOK 339552553#define YYTRANSLATE(YYX) \554((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)555556/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */557static const yytype_uint8 yytranslate[] =558{5590, 2, 2, 2, 2, 2, 2, 2, 2, 2,5602, 2, 2, 2, 2, 2, 2, 2, 2, 2,5612, 2, 2, 2, 2, 2, 2, 2, 2, 2,5622, 2, 2, 2, 2, 2, 2, 2, 2, 2,5632, 2, 2, 2, 2, 2, 2, 2, 2, 2,5642, 2, 2, 2, 2, 2, 2, 2, 2, 2,5652, 2, 2, 2, 2, 2, 2, 2, 2, 2,5662, 2, 2, 2, 2, 2, 2, 2, 2, 2,5672, 2, 2, 2, 2, 2, 2, 2, 2, 2,5682, 2, 2, 2, 2, 2, 2, 2, 2, 2,5692, 2, 2, 2, 2, 2, 2, 2, 2, 2,5702, 2, 2, 2, 2, 2, 2, 2, 2, 2,5712, 2, 2, 2, 2, 2, 2, 2, 2, 2,5722, 2, 2, 2, 2, 2, 2, 2, 2, 2,5732, 2, 2, 2, 2, 2, 2, 2, 2, 2,5742, 2, 2, 2, 2, 2, 2, 2, 2, 2,5752, 2, 2, 2, 2, 2, 2, 2, 2, 2,5762, 2, 2, 2, 2, 2, 2, 2, 2, 2,5772, 2, 2, 2, 2, 2, 2, 2, 2, 2,5782, 2, 2, 2, 2, 2, 2, 2, 2, 2,5792, 2, 2, 2, 2, 2, 2, 2, 2, 2,5802, 2, 2, 2, 2, 2, 2, 2, 2, 2,5812, 2, 2, 2, 2, 2, 2, 2, 2, 2,5822, 2, 2, 2, 2, 2, 2, 2, 2, 2,5832, 2, 2, 2, 2, 2, 2, 2, 2, 2,5842, 2, 2, 2, 2, 2, 1, 2, 3, 4,5855, 6, 7, 8, 9, 10, 11, 12, 13, 14,58615, 16, 17, 18, 19, 20, 21, 22, 23, 24,58725, 26, 27, 28, 29, 30, 31, 32, 33, 34,58835, 36, 37, 38, 39, 40, 41, 42, 43, 44,58945, 46, 47, 48, 49, 50, 51, 52, 53, 54,59055, 56, 57, 58, 59, 60, 61, 62, 63, 64,59165, 66, 67, 68, 69, 70, 71, 72, 73, 74,59275, 76, 77, 78, 79, 80, 81, 82, 83, 84593};594595#if YYDEBUG596/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in597YYRHS. */598static const yytype_uint16 yyprhs[] =599{6000, 0, 3, 4, 7, 10, 16, 22, 28, 34,60138, 42, 48, 54, 60, 66, 72, 82, 88, 94,602100, 104, 110, 114, 120, 126, 130, 136, 142, 146,603150, 156, 160, 166, 170, 176, 182, 186, 190, 194,604200, 206, 214, 220, 228, 238, 244, 252, 260, 266,605272, 280, 286, 294, 302, 308, 314, 318, 324, 330,606334, 337, 343, 349, 354, 359, 365, 371, 375, 380,607385, 390, 392, 393, 395, 397, 409, 411, 413, 415,608417, 421, 423, 427, 429, 431, 435, 438, 440, 442,609444, 446, 448, 450, 452, 454, 456, 458, 460610};611612/* YYRHS -- A `-1'-separated list of the rules' RHS. */613static const yytype_int8 yyrhs[] =614{61586, 0, -1, -1, 86, 87, -1, 86, 88, -1,61618, 15, 89, 16, 102, -1, 19, 15, 90, 16,617102, -1, 23, 15, 92, 16, 102, -1, 60, 15,61883, 16, 102, -1, 24, 16, 101, -1, 61, 16,619101, -1, 61, 15, 83, 16, 101, -1, 25, 15,62094, 16, 102, -1, 26, 15, 95, 16, 102, -1,62127, 15, 96, 16, 102, -1, 38, 15, 84, 16,622102, -1, 38, 15, 84, 15, 12, 15, 84, 16,623102, -1, 28, 15, 97, 16, 101, -1, 29, 15,62497, 16, 101, -1, 30, 15, 97, 16, 101, -1,62546, 16, 101, -1, 46, 15, 83, 16, 101, -1,62645, 16, 101, -1, 45, 15, 97, 16, 101, -1,62748, 15, 97, 16, 101, -1, 48, 16, 102, -1,62843, 15, 97, 16, 100, -1, 41, 15, 97, 16,629100, -1, 42, 16, 102, -1, 44, 16, 101, -1,63044, 15, 97, 16, 101, -1, 49, 16, 102, -1,63149, 15, 83, 16, 102, -1, 50, 16, 102, -1,63251, 15, 97, 16, 101, -1, 52, 15, 97, 16,633100, -1, 53, 16, 101, -1, 54, 16, 101, -1,63480, 16, 102, -1, 81, 15, 83, 16, 102, -1,63547, 15, 49, 16, 102, -1, 47, 15, 49, 15,63683, 16, 102, -1, 47, 15, 62, 16, 101, -1,63747, 15, 62, 15, 99, 16, 100, -1, 47, 15,63864, 15, 99, 15, 97, 16, 100, -1, 47, 15,63963, 16, 102, -1, 47, 15, 63, 15, 84, 16,640102, -1, 47, 15, 73, 15, 83, 16, 101, -1,64147, 15, 74, 16, 101, -1, 47, 15, 75, 16,642101, -1, 47, 15, 76, 15, 83, 16, 101, -1,64347, 15, 77, 16, 101, -1, 47, 15, 77, 15,64483, 16, 101, -1, 47, 15, 78, 15, 83, 16,645101, -1, 47, 15, 79, 16, 102, -1, 55, 15,64697, 16, 101, -1, 57, 16, 102, -1, 58, 15,64797, 16, 101, -1, 59, 15, 97, 16, 101, -1,64822, 16, 102, -1, 1, 16, -1, 40, 15, 97,64916, 100, -1, 39, 15, 91, 16, 102, -1, 65,65015, 83, 16, -1, 66, 15, 83, 16, -1, 68,65115, 84, 16, 102, -1, 67, 15, 83, 16, 102,652-1, 69, 16, 102, -1, 70, 15, 83, 16, -1,65371, 15, 83, 16, -1, 72, 15, 83, 16, -1,65483, -1, -1, 83, -1, 84, -1, 84, 17, 84,65517, 84, 17, 84, 17, 84, 17, 84, -1, 10,656-1, 14, -1, 5, -1, 3, -1, 3, 15, 93,657-1, 6, -1, 6, 15, 93, -1, 8, -1, 9,658-1, 9, 15, 91, -1, 9, 91, -1, 7, -1,65912, -1, 11, -1, 13, -1, 4, -1, 5, -1,66098, -1, 83, -1, 84, -1, 101, -1, 102, -1,661-1662};663664/* YYRLINE[YYN] -- source line where rule number YYN was defined. */665static const yytype_uint16 yyrline[] =666{6670, 129, 129, 131, 136, 140, 146, 154, 175, 181,668186, 191, 197, 234, 248, 262, 268, 274, 283, 292,669301, 306, 315, 320, 326, 333, 338, 345, 359, 364,670373, 380, 385, 402, 407, 414, 421, 426, 431, 441,671448, 453, 458, 466, 479, 493, 500, 517, 521, 526,672530, 534, 545, 558, 565, 570, 577, 595, 612, 640,673647, 653, 663, 673, 678, 683, 688, 693, 698, 703,674708, 716, 721, 724, 728, 732, 745, 749, 753, 760,675765, 770, 775, 780, 784, 789, 795, 803, 807, 811,676818, 822, 826, 833, 861, 865, 891, 899, 910677};678#endif679680#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE681/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.682First, the terminals, then, starting at YYNTOKENS, nonterminals. */683static const char *const yytname[] =684{685"$end", "error", "$undefined", "A", "B", "C", "E", "F", "I", "L", "N",686"P", "R", "S", "T", "SP", "CRLF", "COMMA", "USER", "PASS", "ACCT",687"REIN", "QUIT", "PORT", "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR",688"APPE", "MLFL", "MAIL", "MSND", "MSOM", "MSAM", "MRSQ", "MRCP", "ALLO",689"REST", "RNFR", "RNTO", "ABOR", "DELE", "CWD", "LIST", "NLST", "SITE",690"sTAT", "HELP", "NOOP", "MKD", "RMD", "PWD", "CDUP", "STOU", "SMNT",691"SYST", "SIZE", "MDTM", "EPRT", "EPSV", "UMASK", "IDLE", "CHMOD", "AUTH",692"ADAT", "PROT", "PBSZ", "CCC", "MIC", "CONF", "ENC", "KAUTH", "KLIST",693"KDESTROY", "KRBTKFILE", "AFSLOG", "LOCATE", "URL", "FEAT", "OPTS",694"LEXERR", "STRING", "NUMBER", "$accept", "cmd_list", "cmd", "rcmd",695"username", "password", "byte_size", "host_port", "form_code",696"type_code", "struct_code", "mode_code", "pathname", "pathstring",697"octal_number", "check_login_no_guest", "check_login", "check_secure", 0698};699#endif700701# ifdef YYPRINT702/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to703token YYLEX-NUM. */704static const yytype_uint16 yytoknum[] =705{7060, 256, 257, 258, 259, 260, 261, 262, 263, 264,707265, 266, 267, 268, 269, 270, 271, 272, 273, 274,708275, 276, 277, 278, 279, 280, 281, 282, 283, 284,709285, 286, 287, 288, 289, 290, 291, 292, 293, 294,710295, 296, 297, 298, 299, 300, 301, 302, 303, 304,711305, 306, 307, 308, 309, 310, 311, 312, 313, 314,712315, 316, 317, 318, 319, 320, 321, 322, 323, 324,713325, 326, 327, 328, 329, 330, 331, 332, 333, 334,714335, 336, 337, 338, 339715};716# endif717718/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */719static const yytype_uint8 yyr1[] =720{7210, 85, 86, 86, 86, 87, 87, 87, 87, 87,72287, 87, 87, 87, 87, 87, 87, 87, 87, 87,72387, 87, 87, 87, 87, 87, 87, 87, 87, 87,72487, 87, 87, 87, 87, 87, 87, 87, 87, 87,72587, 87, 87, 87, 87, 87, 87, 87, 87, 87,72687, 87, 87, 87, 87, 87, 87, 87, 87, 87,72787, 88, 88, 88, 88, 88, 88, 88, 88, 88,72888, 89, 90, 90, 91, 92, 93, 93, 93, 94,72994, 94, 94, 94, 94, 94, 94, 95, 95, 95,73096, 96, 96, 97, 98, 99, 100, 101, 102731};732733/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */734static const yytype_uint8 yyr2[] =735{7360, 2, 0, 2, 2, 5, 5, 5, 5, 3,7373, 5, 5, 5, 5, 5, 9, 5, 5, 5,7383, 5, 3, 5, 5, 3, 5, 5, 3, 3,7395, 3, 5, 3, 5, 5, 3, 3, 3, 5,7405, 7, 5, 7, 9, 5, 7, 7, 5, 5,7417, 5, 7, 7, 5, 5, 3, 5, 5, 3,7422, 5, 5, 4, 4, 5, 5, 3, 4, 4,7434, 1, 0, 1, 1, 11, 1, 1, 1, 1,7443, 1, 3, 1, 1, 3, 2, 1, 1, 1,7451, 1, 1, 1, 1, 1, 1, 1, 0746};747748/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state749STATE-NUM when YYTABLE doesn't specify something else to do. Zero750means the default is an error. */751static const yytype_uint8 yydefact[] =752{7532, 0, 1, 0, 0, 0, 0, 0, 0, 0,7540, 0, 0, 0, 0, 0, 0, 0, 0, 0,7550, 0, 0, 0, 0, 0, 0, 0, 0, 0,7560, 0, 0, 0, 0, 0, 0, 0, 0, 0,7570, 0, 0, 0, 0, 0, 0, 0, 3, 4,75860, 0, 72, 98, 0, 98, 0, 0, 0, 0,7590, 0, 0, 0, 0, 0, 98, 0, 0, 98,7600, 98, 0, 98, 0, 0, 98, 0, 98, 98,7610, 0, 98, 98, 0, 98, 0, 0, 0, 0,76298, 0, 0, 0, 0, 98, 0, 0, 0, 98,7630, 71, 0, 73, 0, 59, 0, 0, 9, 97,76479, 81, 83, 84, 0, 87, 89, 88, 0, 91,76592, 90, 0, 94, 0, 93, 0, 0, 0, 74,7660, 0, 0, 28, 0, 0, 29, 0, 22, 0,76720, 0, 0, 0, 0, 0, 0, 0, 0, 0,7680, 0, 0, 25, 0, 31, 33, 0, 0, 36,76937, 0, 56, 0, 0, 0, 0, 10, 0, 0,7700, 0, 67, 0, 0, 0, 38, 0, 98, 98,7710, 98, 0, 0, 0, 86, 98, 98, 98, 98,77298, 98, 0, 98, 98, 98, 98, 98, 98, 98,77398, 0, 98, 0, 98, 0, 98, 0, 0, 98,77498, 0, 0, 98, 0, 98, 98, 98, 98, 98,77598, 98, 98, 98, 98, 63, 64, 98, 98, 68,77669, 70, 98, 5, 6, 0, 7, 78, 76, 77,77780, 82, 85, 12, 13, 14, 17, 18, 19, 0,77815, 62, 61, 96, 27, 26, 30, 23, 21, 0,77940, 95, 0, 42, 0, 45, 0, 0, 48, 49,7800, 0, 51, 0, 54, 24, 32, 34, 35, 55,78157, 58, 8, 11, 66, 65, 39, 0, 0, 98,78298, 98, 0, 98, 98, 98, 98, 0, 0, 41,78343, 46, 0, 47, 50, 52, 53, 0, 98, 98,7840, 16, 44, 0, 0, 0, 75785};786787/* YYDEFGOTO[NTERM-NUM]. */788static const yytype_int16 yydefgoto[] =789{790-1, 1, 48, 49, 102, 104, 130, 107, 240, 114,791118, 122, 124, 125, 262, 252, 253, 109792};793794/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing795STATE-NUM. */796#define YYPACT_NINF -196797static const yytype_int16 yypact[] =798{799-196, 246, -196, 3, 13, 20, 11, 24, 21, 26,80030, 45, 66, 67, 68, 69, 70, 71, 72, 76,80173, -7, -5, 15, 78, 28, 32, 80, 79, 82,80283, 91, 93, 94, 96, 97, 98, 38, 100, 101,803102, 103, 104, 106, 107, 108, 111, 109, -196, -196,804-196, -66, 36, -196, 14, -196, 12, 22, 1, 46,80546, 46, 25, 48, 46, 46, -196, 46, 46, -196,80646, -196, 53, -196, 27, 46, -196, 55, -196, -196,80746, 46, -196, -196, 46, -196, 46, 46, 56, 59,808-196, 60, 61, 62, 63, -196, 65, 77, 85, -196,80986, -196, 114, -196, 115, -196, 120, 130, -196, -196,810135, 136, -196, -11, 138, -196, -196, -196, 139, -196,811-196, -196, 143, -196, 145, -196, 147, 156, 47, -196,812157, 162, 165, -196, 166, 168, -196, 170, -196, 174,813-196, 49, 52, 54, 137, 177, 178, 179, 181, 64,814182, 183, 184, -196, 185, -196, -196, 186, 187, -196,815-196, 188, -196, 189, 190, 191, 192, -196, 193, 194,816195, 196, -196, 197, 198, 199, -196, 200, -196, -196,817133, -196, 2, 2, 48, -196, -196, -196, -196, -196,818-196, -196, 206, -196, -196, -196, -196, -196, -196, -196,819-196, 110, -196, 140, -196, 141, -196, 140, 144, -196,820-196, 146, 148, -196, 149, -196, -196, -196, -196, -196,821-196, -196, -196, -196, -196, -196, -196, -196, -196, -196,822-196, -196, -196, -196, -196, 202, -196, -196, -196, -196,823-196, -196, -196, -196, -196, -196, -196, -196, -196, 205,824-196, -196, -196, -196, -196, -196, -196, -196, -196, 207,825-196, -196, 210, -196, 212, -196, 215, 217, -196, -196,826218, 219, -196, 221, -196, -196, -196, -196, -196, -196,827-196, -196, -196, -196, -196, -196, -196, 155, 158, -196,828-196, -196, 46, -196, -196, -196, -196, 204, 224, -196,829-196, -196, 225, -196, -196, -196, -196, 159, -196, -196,830227, -196, -196, 161, 231, 167, -196831};832833/* YYPGOTO[NTERM-NUM]. */834static const yytype_int16 yypgoto[] =835{836-196, -196, -196, -196, -196, -196, -110, -196, 39, -196,837-196, -196, -9, -196, 42, -195, -33, -53838};839840/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If841positive, shift that token. If negative, reduce the rule which842number is the opposite. If zero, do what YYDEFACT says.843If YYTABLE_NINF, syntax error. */844#define YYTABLE_NINF -1845static const yytype_uint16 yytable[] =846{847105, 254, 255, 185, 184, 119, 120, 237, 68, 69,84870, 71, 238, 133, 121, 110, 239, 101, 111, 50,849112, 113, 108, 153, 278, 155, 156, 53, 51, 115,85072, 73, 162, 116, 117, 52, 136, 55, 138, 54,851140, 56, 172, 75, 76, 57, 176, 77, 78, 159,852160, 126, 127, 89, 90, 131, 132, 167, 134, 135,85358, 137, 192, 193, 201, 202, 152, 203, 204, 205,854206, 157, 158, 129, 242, 161, 141, 163, 164, 212,855213, 59, 60, 61, 62, 63, 64, 65, 67, 142,856143, 144, 66, 74, 80, 300, 79, 81, 106, 82,857145, 146, 147, 148, 149, 150, 151, 83, 84, 128,85885, 86, 87, 88, 312, 91, 92, 93, 94, 103,85995, 96, 97, 98, 100, 233, 234, 99, 236, 123,860178, 179, 129, 243, 244, 245, 139, 180, 154, 165,861250, 251, 166, 168, 169, 170, 181, 171, 173, 260,862182, 183, 207, 265, 186, 187, 246, 247, 248, 188,863174, 189, 274, 190, 276, 256, 257, 258, 175, 177,864282, 263, 191, 194, 284, 285, 268, 269, 195, 286,865272, 196, 197, 275, 198, 277, 199, 279, 280, 281,866200, 283, 208, 259, 209, 210, 211, 214, 0, 215,867216, 217, 218, 219, 220, 221, 222, 223, 224, 225,868226, 227, 228, 229, 230, 231, 232, 235, 249, 287,869288, 307, 241, 289, 261, 264, 290, 267, 291, 270,870292, 271, 273, 293, 294, 295, 299, 296, 301, 297,871308, 309, 298, 310, 313, 314, 2, 3, 315, 266,8720, 316, 0, 0, 0, 311, 0, 0, 0, 0,873303, 304, 305, 306, 4, 5, 0, 0, 6, 7,8748, 9, 10, 11, 12, 13, 14, 0, 0, 0,8750, 0, 0, 302, 15, 16, 17, 18, 19, 20,87621, 22, 23, 24, 25, 26, 27, 28, 29, 30,87731, 32, 0, 33, 34, 35, 36, 37, 0, 0,8780, 38, 39, 40, 41, 42, 43, 44, 45, 0,8790, 0, 0, 0, 0, 0, 46, 47880};881882static const yytype_int16 yycheck[] =883{88453, 196, 197, 113, 15, 4, 5, 5, 15, 16,88515, 16, 10, 66, 13, 3, 14, 83, 6, 16,8868, 9, 55, 76, 219, 78, 79, 16, 15, 7,88715, 16, 85, 11, 12, 15, 69, 16, 71, 15,88873, 15, 95, 15, 16, 15, 99, 15, 16, 82,88983, 60, 61, 15, 16, 64, 65, 90, 67, 68,89015, 70, 15, 16, 15, 16, 75, 15, 16, 15,89116, 80, 81, 84, 184, 84, 49, 86, 87, 15,89216, 15, 15, 15, 15, 15, 15, 15, 15, 62,89363, 64, 16, 15, 15, 290, 16, 15, 84, 16,89473, 74, 75, 76, 77, 78, 79, 16, 15, 84,89516, 15, 15, 15, 309, 15, 15, 15, 15, 83,89616, 15, 15, 15, 15, 178, 179, 16, 181, 83,89716, 16, 84, 186, 187, 188, 83, 17, 83, 83,898193, 194, 83, 83, 83, 83, 16, 84, 83, 202,89915, 15, 15, 206, 16, 16, 189, 190, 191, 16,90083, 16, 215, 16, 217, 198, 199, 200, 83, 83,901223, 204, 16, 16, 227, 228, 209, 210, 16, 232,902213, 16, 16, 216, 16, 218, 16, 220, 221, 222,90316, 224, 15, 83, 16, 16, 15, 15, -1, 16,90416, 16, 16, 16, 16, 16, 16, 16, 16, 16,90516, 16, 16, 16, 16, 16, 16, 84, 12, 17,90615, 17, 183, 16, 84, 84, 16, 83, 16, 83,90715, 83, 83, 16, 16, 16, 289, 16, 291, 84,90816, 16, 84, 84, 17, 84, 0, 1, 17, 207,909-1, 84, -1, -1, -1, 308, -1, -1, -1, -1,910293, 294, 295, 296, 18, 19, -1, -1, 22, 23,91124, 25, 26, 27, 28, 29, 30, -1, -1, -1,912-1, -1, -1, 292, 38, 39, 40, 41, 42, 43,91344, 45, 46, 47, 48, 49, 50, 51, 52, 53,91454, 55, -1, 57, 58, 59, 60, 61, -1, -1,915-1, 65, 66, 67, 68, 69, 70, 71, 72, -1,916-1, -1, -1, -1, -1, -1, 80, 81917};918919/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing920symbol of state STATE-NUM. */921static const yytype_uint8 yystos[] =922{9230, 86, 0, 1, 18, 19, 22, 23, 24, 25,92426, 27, 28, 29, 30, 38, 39, 40, 41, 42,92543, 44, 45, 46, 47, 48, 49, 50, 51, 52,92653, 54, 55, 57, 58, 59, 60, 61, 65, 66,92767, 68, 69, 70, 71, 72, 80, 81, 87, 88,92816, 15, 15, 16, 15, 16, 15, 15, 15, 15,92915, 15, 15, 15, 15, 15, 16, 15, 15, 16,93015, 16, 15, 16, 15, 15, 16, 15, 16, 16,93115, 15, 16, 16, 15, 16, 15, 15, 15, 15,93216, 15, 15, 15, 15, 16, 15, 15, 15, 16,93315, 83, 89, 83, 90, 102, 84, 92, 101, 102,9343, 6, 8, 9, 94, 7, 11, 12, 95, 4,9355, 13, 96, 83, 97, 98, 97, 97, 84, 84,93691, 97, 97, 102, 97, 97, 101, 97, 101, 83,937101, 49, 62, 63, 64, 73, 74, 75, 76, 77,93878, 79, 97, 102, 83, 102, 102, 97, 97, 101,939101, 97, 102, 97, 97, 83, 83, 101, 83, 83,94083, 84, 102, 83, 83, 83, 102, 83, 16, 16,94117, 16, 15, 15, 15, 91, 16, 16, 16, 16,94216, 16, 15, 16, 16, 16, 16, 16, 16, 16,94316, 15, 16, 15, 16, 15, 16, 15, 15, 16,94416, 15, 15, 16, 15, 16, 16, 16, 16, 16,94516, 16, 16, 16, 16, 16, 16, 16, 16, 16,94616, 16, 16, 102, 102, 84, 102, 5, 10, 14,94793, 93, 91, 102, 102, 102, 101, 101, 101, 12,948102, 102, 100, 101, 100, 100, 101, 101, 101, 83,949102, 84, 99, 101, 84, 102, 99, 83, 101, 101,95083, 83, 101, 83, 102, 101, 102, 101, 100, 101,951101, 101, 102, 101, 102, 102, 102, 17, 15, 16,95216, 16, 15, 16, 16, 16, 16, 84, 84, 102,953100, 102, 97, 101, 101, 101, 101, 17, 16, 16,95484, 102, 100, 17, 84, 17, 84955};956957#define yyerrok (yyerrstatus = 0)958#define yyclearin (yychar = YYEMPTY)959#define YYEMPTY (-2)960#define YYEOF 0961962#define YYACCEPT goto yyacceptlab963#define YYABORT goto yyabortlab964#define YYERROR goto yyerrorlab965966967/* Like YYERROR except do call yyerror. This remains here temporarily968to ease the transition to the new meaning of YYERROR, for GCC.969Once GCC version 2 has supplanted version 1, this can go. */970971#define YYFAIL goto yyerrlab972973#define YYRECOVERING() (!!yyerrstatus)974975#define YYBACKUP(Token, Value) \976do \977if (yychar == YYEMPTY && yylen == 1) \978{ \979yychar = (Token); \980yylval = (Value); \981yytoken = YYTRANSLATE (yychar); \982YYPOPSTACK (1); \983goto yybackup; \984} \985else \986{ \987yyerror (YY_("syntax error: cannot back up")); \988YYERROR; \989} \990while (YYID (0))991992993#define YYTERROR 1994#define YYERRCODE 256995996997/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].998If N is 0, then set CURRENT to the empty location which ends999the previous symbol: RHS[0] (always defined). */10001001#define YYRHSLOC(Rhs, K) ((Rhs)[K])1002#ifndef YYLLOC_DEFAULT1003# define YYLLOC_DEFAULT(Current, Rhs, N) \1004do \1005if (YYID (N)) \1006{ \1007(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \1008(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \1009(Current).last_line = YYRHSLOC (Rhs, N).last_line; \1010(Current).last_column = YYRHSLOC (Rhs, N).last_column; \1011} \1012else \1013{ \1014(Current).first_line = (Current).last_line = \1015YYRHSLOC (Rhs, 0).last_line; \1016(Current).first_column = (Current).last_column = \1017YYRHSLOC (Rhs, 0).last_column; \1018} \1019while (YYID (0))1020#endif102110221023/* YY_LOCATION_PRINT -- Print the location on the stream.1024This macro was not mandated originally: define only if we know1025we won't break user code: when these are the locations we know. */10261027#ifndef YY_LOCATION_PRINT1028# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL1029# define YY_LOCATION_PRINT(File, Loc) \1030fprintf (File, "%d.%d-%d.%d", \1031(Loc).first_line, (Loc).first_column, \1032(Loc).last_line, (Loc).last_column)1033# else1034# define YY_LOCATION_PRINT(File, Loc) ((void) 0)1035# endif1036#endif103710381039/* YYLEX -- calling `yylex' with the right arguments. */10401041#ifdef YYLEX_PARAM1042# define YYLEX yylex (YYLEX_PARAM)1043#else1044# define YYLEX yylex ()1045#endif10461047/* Enable debugging if requested. */1048#if YYDEBUG10491050# ifndef YYFPRINTF1051# include <stdio.h> /* INFRINGES ON USER NAME SPACE */1052# define YYFPRINTF fprintf1053# endif10541055# define YYDPRINTF(Args) \1056do { \1057if (yydebug) \1058YYFPRINTF Args; \1059} while (YYID (0))10601061# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \1062do { \1063if (yydebug) \1064{ \1065YYFPRINTF (stderr, "%s ", Title); \1066yy_symbol_print (stderr, \1067Type, Value); \1068YYFPRINTF (stderr, "\n"); \1069} \1070} while (YYID (0))107110721073/*--------------------------------.1074| Print this symbol on YYOUTPUT. |1075`--------------------------------*/10761077/*ARGSUSED*/1078#if (defined __STDC__ || defined __C99__FUNC__ \1079|| defined __cplusplus || defined _MSC_VER)1080static void1081yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)1082#else1083static void1084yy_symbol_value_print (yyoutput, yytype, yyvaluep)1085FILE *yyoutput;1086int yytype;1087YYSTYPE const * const yyvaluep;1088#endif1089{1090if (!yyvaluep)1091return;1092# ifdef YYPRINT1093if (yytype < YYNTOKENS)1094YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);1095# else1096YYUSE (yyoutput);1097# endif1098switch (yytype)1099{1100default:1101break;1102}1103}110411051106/*--------------------------------.1107| Print this symbol on YYOUTPUT. |1108`--------------------------------*/11091110#if (defined __STDC__ || defined __C99__FUNC__ \1111|| defined __cplusplus || defined _MSC_VER)1112static void1113yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)1114#else1115static void1116yy_symbol_print (yyoutput, yytype, yyvaluep)1117FILE *yyoutput;1118int yytype;1119YYSTYPE const * const yyvaluep;1120#endif1121{1122if (yytype < YYNTOKENS)1123YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);1124else1125YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);11261127yy_symbol_value_print (yyoutput, yytype, yyvaluep);1128YYFPRINTF (yyoutput, ")");1129}11301131/*------------------------------------------------------------------.1132| yy_stack_print -- Print the state stack from its BOTTOM up to its |1133| TOP (included). |1134`------------------------------------------------------------------*/11351136#if (defined __STDC__ || defined __C99__FUNC__ \1137|| defined __cplusplus || defined _MSC_VER)1138static void1139yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)1140#else1141static void1142yy_stack_print (bottom, top)1143yytype_int16 *bottom;1144yytype_int16 *top;1145#endif1146{1147YYFPRINTF (stderr, "Stack now");1148for (; bottom <= top; ++bottom)1149YYFPRINTF (stderr, " %d", *bottom);1150YYFPRINTF (stderr, "\n");1151}11521153# define YY_STACK_PRINT(Bottom, Top) \1154do { \1155if (yydebug) \1156yy_stack_print ((Bottom), (Top)); \1157} while (YYID (0))115811591160/*------------------------------------------------.1161| Report that the YYRULE is going to be reduced. |1162`------------------------------------------------*/11631164#if (defined __STDC__ || defined __C99__FUNC__ \1165|| defined __cplusplus || defined _MSC_VER)1166static void1167yy_reduce_print (YYSTYPE *yyvsp, int yyrule)1168#else1169static void1170yy_reduce_print (yyvsp, yyrule)1171YYSTYPE *yyvsp;1172int yyrule;1173#endif1174{1175int yynrhs = yyr2[yyrule];1176int yyi;1177unsigned long int yylno = yyrline[yyrule];1178YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",1179yyrule - 1, yylno);1180/* The symbols being reduced. */1181for (yyi = 0; yyi < yynrhs; yyi++)1182{1183fprintf (stderr, " $%d = ", yyi + 1);1184yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],1185&(yyvsp[(yyi + 1) - (yynrhs)])1186);1187fprintf (stderr, "\n");1188}1189}11901191# define YY_REDUCE_PRINT(Rule) \1192do { \1193if (yydebug) \1194yy_reduce_print (yyvsp, Rule); \1195} while (YYID (0))11961197/* Nonzero means print parse trace. It is left uninitialized so that1198multiple parsers can coexist. */1199int yydebug;1200#else /* !YYDEBUG */1201# define YYDPRINTF(Args)1202# define YY_SYMBOL_PRINT(Title, Type, Value, Location)1203# define YY_STACK_PRINT(Bottom, Top)1204# define YY_REDUCE_PRINT(Rule)1205#endif /* !YYDEBUG */120612071208/* YYINITDEPTH -- initial size of the parser's stacks. */1209#ifndef YYINITDEPTH1210# define YYINITDEPTH 2001211#endif12121213/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only1214if the built-in stack extension method is used).12151216Do not make this value too large; the results are undefined if1217YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)1218evaluated with infinite-precision integer arithmetic. */12191220#ifndef YYMAXDEPTH1221# define YYMAXDEPTH 100001222#endif1223122412251226#if YYERROR_VERBOSE12271228# ifndef yystrlen1229# if defined __GLIBC__ && defined _STRING_H1230# define yystrlen strlen1231# else1232/* Return the length of YYSTR. */1233#if (defined __STDC__ || defined __C99__FUNC__ \1234|| defined __cplusplus || defined _MSC_VER)1235static YYSIZE_T1236yystrlen (const char *yystr)1237#else1238static YYSIZE_T1239yystrlen (yystr)1240const char *yystr;1241#endif1242{1243YYSIZE_T yylen;1244for (yylen = 0; yystr[yylen]; yylen++)1245continue;1246return yylen;1247}1248# endif1249# endif12501251# ifndef yystpcpy1252# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE1253# define yystpcpy stpcpy1254# else1255/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in1256YYDEST. */1257#if (defined __STDC__ || defined __C99__FUNC__ \1258|| defined __cplusplus || defined _MSC_VER)1259static char *1260yystpcpy (char *yydest, const char *yysrc)1261#else1262static char *1263yystpcpy (yydest, yysrc)1264char *yydest;1265const char *yysrc;1266#endif1267{1268char *yyd = yydest;1269const char *yys = yysrc;12701271while ((*yyd++ = *yys++) != '\0')1272continue;12731274return yyd - 1;1275}1276# endif1277# endif12781279# ifndef yytnamerr1280/* Copy to YYRES the contents of YYSTR after stripping away unnecessary1281quotes and backslashes, so that it's suitable for yyerror. The1282heuristic is that double-quoting is unnecessary unless the string1283contains an apostrophe, a comma, or backslash (other than1284backslash-backslash). YYSTR is taken from yytname. If YYRES is1285null, do not copy; instead, return the length of what the result1286would have been. */1287static YYSIZE_T1288yytnamerr (char *yyres, const char *yystr)1289{1290if (*yystr == '"')1291{1292YYSIZE_T yyn = 0;1293char const *yyp = yystr;12941295for (;;)1296switch (*++yyp)1297{1298case '\'':1299case ',':1300goto do_not_strip_quotes;13011302case '\\':1303if (*++yyp != '\\')1304goto do_not_strip_quotes;1305/* Fall through. */1306default:1307if (yyres)1308yyres[yyn] = *yyp;1309yyn++;1310break;13111312case '"':1313if (yyres)1314yyres[yyn] = '\0';1315return yyn;1316}1317do_not_strip_quotes: ;1318}13191320if (! yyres)1321return yystrlen (yystr);13221323return yystpcpy (yyres, yystr) - yyres;1324}1325# endif13261327/* Copy into YYRESULT an error message about the unexpected token1328YYCHAR while in state YYSTATE. Return the number of bytes copied,1329including the terminating null byte. If YYRESULT is null, do not1330copy anything; just return the number of bytes that would be1331copied. As a special case, return 0 if an ordinary "syntax error"1332message will do. Return YYSIZE_MAXIMUM if overflow occurs during1333size calculation. */1334static YYSIZE_T1335yysyntax_error (char *yyresult, int yystate, int yychar)1336{1337int yyn = yypact[yystate];13381339if (! (YYPACT_NINF < yyn && yyn <= YYLAST))1340return 0;1341else1342{1343int yytype = YYTRANSLATE (yychar);1344YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);1345YYSIZE_T yysize = yysize0;1346YYSIZE_T yysize1;1347int yysize_overflow = 0;1348enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };1349char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];1350int yyx;13511352# if 01353/* This is so xgettext sees the translatable formats that are1354constructed on the fly. */1355YY_("syntax error, unexpected %s");1356YY_("syntax error, unexpected %s, expecting %s");1357YY_("syntax error, unexpected %s, expecting %s or %s");1358YY_("syntax error, unexpected %s, expecting %s or %s or %s");1359YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");1360# endif1361char *yyfmt;1362char const *yyf;1363static char const yyunexpected[] = "syntax error, unexpected %s";1364static char const yyexpecting[] = ", expecting %s";1365static char const yyor[] = " or %s";1366char yyformat[sizeof yyunexpected1367+ sizeof yyexpecting - 11368+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)1369* (sizeof yyor - 1))];1370char const *yyprefix = yyexpecting;13711372/* Start YYX at -YYN if negative to avoid negative indexes in1373YYCHECK. */1374int yyxbegin = yyn < 0 ? -yyn : 0;13751376/* Stay within bounds of both yycheck and yytname. */1377int yychecklim = YYLAST - yyn + 1;1378int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;1379int yycount = 1;13801381yyarg[0] = yytname[yytype];1382yyfmt = yystpcpy (yyformat, yyunexpected);13831384for (yyx = yyxbegin; yyx < yyxend; ++yyx)1385if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)1386{1387if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)1388{1389yycount = 1;1390yysize = yysize0;1391yyformat[sizeof yyunexpected - 1] = '\0';1392break;1393}1394yyarg[yycount++] = yytname[yyx];1395yysize1 = yysize + yytnamerr (0, yytname[yyx]);1396yysize_overflow |= (yysize1 < yysize);1397yysize = yysize1;1398yyfmt = yystpcpy (yyfmt, yyprefix);1399yyprefix = yyor;1400}14011402yyf = YY_(yyformat);1403yysize1 = yysize + yystrlen (yyf);1404yysize_overflow |= (yysize1 < yysize);1405yysize = yysize1;14061407if (yysize_overflow)1408return YYSIZE_MAXIMUM;14091410if (yyresult)1411{1412/* Avoid sprintf, as that infringes on the user's name space.1413Don't have undefined behavior even if the translation1414produced a string with the wrong number of "%s"s. */1415char *yyp = yyresult;1416int yyi = 0;1417while ((*yyp = *yyf) != '\0')1418{1419if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)1420{1421yyp += yytnamerr (yyp, yyarg[yyi++]);1422yyf += 2;1423}1424else1425{1426yyp++;1427yyf++;1428}1429}1430}1431return yysize;1432}1433}1434#endif /* YYERROR_VERBOSE */143514361437/*-----------------------------------------------.1438| Release the memory associated to this symbol. |1439`-----------------------------------------------*/14401441/*ARGSUSED*/1442#if (defined __STDC__ || defined __C99__FUNC__ \1443|| defined __cplusplus || defined _MSC_VER)1444static void1445yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)1446#else1447static void1448yydestruct (yymsg, yytype, yyvaluep)1449const char *yymsg;1450int yytype;1451YYSTYPE *yyvaluep;1452#endif1453{1454YYUSE (yyvaluep);14551456if (!yymsg)1457yymsg = "Deleting";1458YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);14591460switch (yytype)1461{14621463default:1464break;1465}1466}146714681469/* Prevent warnings from -Wmissing-prototypes. */14701471#ifdef YYPARSE_PARAM1472#if defined __STDC__ || defined __cplusplus1473int yyparse (void *YYPARSE_PARAM);1474#else1475int yyparse ();1476#endif1477#else /* ! YYPARSE_PARAM */1478#if defined __STDC__ || defined __cplusplus1479int yyparse (void);1480#else1481int yyparse ();1482#endif1483#endif /* ! YYPARSE_PARAM */1484148514861487/* The look-ahead symbol. */1488int yychar;14891490/* The semantic value of the look-ahead symbol. */1491YYSTYPE yylval;14921493/* Number of syntax errors so far. */1494int yynerrs;1495149614971498/*----------.1499| yyparse. |1500`----------*/15011502#ifdef YYPARSE_PARAM1503#if (defined __STDC__ || defined __C99__FUNC__ \1504|| defined __cplusplus || defined _MSC_VER)1505int1506yyparse (void *YYPARSE_PARAM)1507#else1508int1509yyparse (YYPARSE_PARAM)1510void *YYPARSE_PARAM;1511#endif1512#else /* ! YYPARSE_PARAM */1513#if (defined __STDC__ || defined __C99__FUNC__ \1514|| defined __cplusplus || defined _MSC_VER)1515int1516yyparse (void)1517#else1518int1519yyparse ()15201521#endif1522#endif1523{15241525int yystate;1526int yyn;1527int yyresult;1528/* Number of tokens to shift before error messages enabled. */1529int yyerrstatus;1530/* Look-ahead token as an internal (translated) token number. */1531int yytoken = 0;1532#if YYERROR_VERBOSE1533/* Buffer for error messages, and its allocated size. */1534char yymsgbuf[128];1535char *yymsg = yymsgbuf;1536YYSIZE_T yymsg_alloc = sizeof yymsgbuf;1537#endif15381539/* Three stacks and their tools:1540`yyss': related to states,1541`yyvs': related to semantic values,1542`yyls': related to locations.15431544Refer to the stacks thru separate pointers, to allow yyoverflow1545to reallocate them elsewhere. */15461547/* The state stack. */1548yytype_int16 yyssa[YYINITDEPTH];1549yytype_int16 *yyss = yyssa;1550yytype_int16 *yyssp;15511552/* The semantic value stack. */1553YYSTYPE yyvsa[YYINITDEPTH];1554YYSTYPE *yyvs = yyvsa;1555YYSTYPE *yyvsp;1556155715581559#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))15601561YYSIZE_T yystacksize = YYINITDEPTH;15621563/* The variables used to return semantic value and location from the1564action routines. */1565YYSTYPE yyval;156615671568/* The number of symbols on the RHS of the reduced rule.1569Keep to zero when no symbol should be popped. */1570int yylen = 0;15711572YYDPRINTF ((stderr, "Starting parse\n"));15731574yystate = 0;1575yyerrstatus = 0;1576yynerrs = 0;1577yychar = YYEMPTY; /* Cause a token to be read. */15781579/* Initialize stack pointers.1580Waste one element of value and location stack1581so that they stay on the same level as the state stack.1582The wasted elements are never initialized. */15831584yyssp = yyss;1585yyvsp = yyvs;15861587goto yysetstate;15881589/*------------------------------------------------------------.1590| yynewstate -- Push a new state, which is found in yystate. |1591`------------------------------------------------------------*/1592yynewstate:1593/* In all cases, when you get here, the value and location stacks1594have just been pushed. So pushing a state here evens the stacks. */1595yyssp++;15961597yysetstate:1598*yyssp = yystate;15991600if (yyss + yystacksize - 1 <= yyssp)1601{1602/* Get the current used size of the three stacks, in elements. */1603YYSIZE_T yysize = yyssp - yyss + 1;16041605#ifdef yyoverflow1606{1607/* Give user a chance to reallocate the stack. Use copies of1608these so that the &'s don't force the real ones into1609memory. */1610YYSTYPE *yyvs1 = yyvs;1611yytype_int16 *yyss1 = yyss;161216131614/* Each stack pointer address is followed by the size of the1615data in use in that stack, in bytes. This used to be a1616conditional around just the two extra args, but that might1617be undefined if yyoverflow is a macro. */1618yyoverflow (YY_("memory exhausted"),1619&yyss1, yysize * sizeof (*yyssp),1620&yyvs1, yysize * sizeof (*yyvsp),16211622&yystacksize);16231624yyss = yyss1;1625yyvs = yyvs1;1626}1627#else /* no yyoverflow */1628# ifndef YYSTACK_RELOCATE1629goto yyexhaustedlab;1630# else1631/* Extend the stack our own way. */1632if (YYMAXDEPTH <= yystacksize)1633goto yyexhaustedlab;1634yystacksize *= 2;1635if (YYMAXDEPTH < yystacksize)1636yystacksize = YYMAXDEPTH;16371638{1639yytype_int16 *yyss1 = yyss;1640union yyalloc *yyptr =1641(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));1642if (! yyptr)1643goto yyexhaustedlab;1644YYSTACK_RELOCATE (yyss);1645YYSTACK_RELOCATE (yyvs);16461647# undef YYSTACK_RELOCATE1648if (yyss1 != yyssa)1649YYSTACK_FREE (yyss1);1650}1651# endif1652#endif /* no yyoverflow */16531654yyssp = yyss + yysize - 1;1655yyvsp = yyvs + yysize - 1;165616571658YYDPRINTF ((stderr, "Stack size increased to %lu\n",1659(unsigned long int) yystacksize));16601661if (yyss + yystacksize - 1 <= yyssp)1662YYABORT;1663}16641665YYDPRINTF ((stderr, "Entering state %d\n", yystate));16661667goto yybackup;16681669/*-----------.1670| yybackup. |1671`-----------*/1672yybackup:16731674/* Do appropriate processing given the current state. Read a1675look-ahead token if we need one and don't already have one. */16761677/* First try to decide what to do without reference to look-ahead token. */1678yyn = yypact[yystate];1679if (yyn == YYPACT_NINF)1680goto yydefault;16811682/* Not known => get a look-ahead token if don't already have one. */16831684/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */1685if (yychar == YYEMPTY)1686{1687YYDPRINTF ((stderr, "Reading a token: "));1688yychar = YYLEX;1689}16901691if (yychar <= YYEOF)1692{1693yychar = yytoken = YYEOF;1694YYDPRINTF ((stderr, "Now at end of input.\n"));1695}1696else1697{1698yytoken = YYTRANSLATE (yychar);1699YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);1700}17011702/* If the proper action on seeing token YYTOKEN is to reduce or to1703detect an error, take that action. */1704yyn += yytoken;1705if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)1706goto yydefault;1707yyn = yytable[yyn];1708if (yyn <= 0)1709{1710if (yyn == 0 || yyn == YYTABLE_NINF)1711goto yyerrlab;1712yyn = -yyn;1713goto yyreduce;1714}17151716if (yyn == YYFINAL)1717YYACCEPT;17181719/* Count tokens shifted since error; after three, turn off error1720status. */1721if (yyerrstatus)1722yyerrstatus--;17231724/* Shift the look-ahead token. */1725YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);17261727/* Discard the shifted token unless it is eof. */1728if (yychar != YYEOF)1729yychar = YYEMPTY;17301731yystate = yyn;1732*++yyvsp = yylval;17331734goto yynewstate;173517361737/*-----------------------------------------------------------.1738| yydefault -- do the default action for the current state. |1739`-----------------------------------------------------------*/1740yydefault:1741yyn = yydefact[yystate];1742if (yyn == 0)1743goto yyerrlab;1744goto yyreduce;174517461747/*-----------------------------.1748| yyreduce -- Do a reduction. |1749`-----------------------------*/1750yyreduce:1751/* yyn is the number of a rule to reduce with. */1752yylen = yyr2[yyn];17531754/* If YYLEN is nonzero, implement the default value of the action:1755`$$ = $1'.17561757Otherwise, the following line sets YYVAL to garbage.1758This behavior is undocumented and Bison1759users should not rely upon it. Assigning to YYVAL1760unconditionally makes the parser a bit smaller, and it avoids a1761GCC warning that YYVAL may be used uninitialized. */1762yyval = yyvsp[1-yylen];176317641765YY_REDUCE_PRINT (yyn);1766switch (yyn)1767{1768case 3:1769#line 132 "ftpcmd.y"1770{1771fromname = (char *) 0;1772restart_point = (off_t) 0;1773}1774break;17751776case 5:1777#line 141 "ftpcmd.y"1778{1779if ((yyvsp[(5) - (5)].i))1780user((yyvsp[(3) - (5)].s));1781free((yyvsp[(3) - (5)].s));1782}1783break;17841785case 6:1786#line 147 "ftpcmd.y"1787{1788if ((yyvsp[(5) - (5)].i))1789pass((yyvsp[(3) - (5)].s));1790memset ((yyvsp[(3) - (5)].s), 0, strlen((yyvsp[(3) - (5)].s)));1791free((yyvsp[(3) - (5)].s));1792}1793break;17941795case 7:1796#line 155 "ftpcmd.y"1797{1798if ((yyvsp[(5) - (5)].i)) {1799if (paranoid &&1800(data_dest->sa_family != his_addr->sa_family ||1801(socket_get_port(data_dest) < IPPORT_RESERVED) ||1802memcmp(socket_get_address(data_dest),1803socket_get_address(his_addr),1804socket_addr_size(his_addr)) != 0)) {1805usedefault = 1;1806reply(500, "Illegal PORT range rejected.");1807} else {1808usedefault = 0;1809if (pdata >= 0) {1810close(pdata);1811pdata = -1;1812}1813reply(200, "PORT command successful.");1814}1815}1816}1817break;18181819case 8:1820#line 176 "ftpcmd.y"1821{1822if ((yyvsp[(5) - (5)].i))1823eprt ((yyvsp[(3) - (5)].s));1824free ((yyvsp[(3) - (5)].s));1825}1826break;18271828case 9:1829#line 182 "ftpcmd.y"1830{1831if((yyvsp[(3) - (3)].i))1832pasv ();1833}1834break;18351836case 10:1837#line 187 "ftpcmd.y"1838{1839if((yyvsp[(3) - (3)].i))1840epsv (NULL);1841}1842break;18431844case 11:1845#line 192 "ftpcmd.y"1846{1847if((yyvsp[(5) - (5)].i))1848epsv ((yyvsp[(3) - (5)].s));1849free ((yyvsp[(3) - (5)].s));1850}1851break;18521853case 12:1854#line 198 "ftpcmd.y"1855{1856if ((yyvsp[(5) - (5)].i)) {1857switch (cmd_type) {18581859case TYPE_A:1860if (cmd_form == FORM_N) {1861reply(200, "Type set to A.");1862type = cmd_type;1863form = cmd_form;1864} else1865reply(504, "Form must be N.");1866break;18671868case TYPE_E:1869reply(504, "Type E not implemented.");1870break;18711872case TYPE_I:1873reply(200, "Type set to I.");1874type = cmd_type;1875break;18761877case TYPE_L:1878#if NBBY == 81879if (cmd_bytesz == 8) {1880reply(200,1881"Type set to L (byte size 8).");1882type = cmd_type;1883} else1884reply(504, "Byte size must be 8.");1885#else /* NBBY == 8 */1886UNIMPLEMENTED for NBBY != 81887#endif /* NBBY == 8 */1888}1889}1890}1891break;18921893case 13:1894#line 235 "ftpcmd.y"1895{1896if ((yyvsp[(5) - (5)].i)) {1897switch ((yyvsp[(3) - (5)].i)) {18981899case STRU_F:1900reply(200, "STRU F ok.");1901break;19021903default:1904reply(504, "Unimplemented STRU type.");1905}1906}1907}1908break;19091910case 14:1911#line 249 "ftpcmd.y"1912{1913if ((yyvsp[(5) - (5)].i)) {1914switch ((yyvsp[(3) - (5)].i)) {19151916case MODE_S:1917reply(200, "MODE S ok.");1918break;19191920default:1921reply(502, "Unimplemented MODE type.");1922}1923}1924}1925break;19261927case 15:1928#line 263 "ftpcmd.y"1929{1930if ((yyvsp[(5) - (5)].i)) {1931reply(202, "ALLO command ignored.");1932}1933}1934break;19351936case 16:1937#line 269 "ftpcmd.y"1938{1939if ((yyvsp[(9) - (9)].i)) {1940reply(202, "ALLO command ignored.");1941}1942}1943break;19441945case 17:1946#line 275 "ftpcmd.y"1947{1948char *name = (yyvsp[(3) - (5)].s);19491950if ((yyvsp[(5) - (5)].i) && name != NULL)1951retrieve(0, name);1952if (name != NULL)1953free(name);1954}1955break;19561957case 18:1958#line 284 "ftpcmd.y"1959{1960char *name = (yyvsp[(3) - (5)].s);19611962if ((yyvsp[(5) - (5)].i) && name != NULL)1963do_store(name, "w", 0);1964if (name != NULL)1965free(name);1966}1967break;19681969case 19:1970#line 293 "ftpcmd.y"1971{1972char *name = (yyvsp[(3) - (5)].s);19731974if ((yyvsp[(5) - (5)].i) && name != NULL)1975do_store(name, "a", 0);1976if (name != NULL)1977free(name);1978}1979break;19801981case 20:1982#line 302 "ftpcmd.y"1983{1984if ((yyvsp[(3) - (3)].i))1985send_file_list(".");1986}1987break;19881989case 21:1990#line 307 "ftpcmd.y"1991{1992char *name = (yyvsp[(3) - (5)].s);19931994if ((yyvsp[(5) - (5)].i) && name != NULL)1995send_file_list(name);1996if (name != NULL)1997free(name);1998}1999break;20002001case 22:2002#line 316 "ftpcmd.y"2003{2004if((yyvsp[(3) - (3)].i))2005list_file(".");2006}2007break;20082009case 23:2010#line 321 "ftpcmd.y"2011{2012if((yyvsp[(5) - (5)].i))2013list_file((yyvsp[(3) - (5)].s));2014free((yyvsp[(3) - (5)].s));2015}2016break;20172018case 24:2019#line 327 "ftpcmd.y"2020{2021if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2022statfilecmd((yyvsp[(3) - (5)].s));2023if ((yyvsp[(3) - (5)].s) != NULL)2024free((yyvsp[(3) - (5)].s));2025}2026break;20272028case 25:2029#line 334 "ftpcmd.y"2030{2031if ((yyvsp[(3) - (3)].i))2032statcmd();2033}2034break;20352036case 26:2037#line 339 "ftpcmd.y"2038{2039if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2040do_delete((yyvsp[(3) - (5)].s));2041if ((yyvsp[(3) - (5)].s) != NULL)2042free((yyvsp[(3) - (5)].s));2043}2044break;20452046case 27:2047#line 346 "ftpcmd.y"2048{2049if((yyvsp[(5) - (5)].i)){2050if (fromname) {2051renamecmd(fromname, (yyvsp[(3) - (5)].s));2052free(fromname);2053fromname = (char *) 0;2054} else {2055reply(503, "Bad sequence of commands.");2056}2057}2058if ((yyvsp[(3) - (5)].s) != NULL)2059free((yyvsp[(3) - (5)].s));2060}2061break;20622063case 28:2064#line 360 "ftpcmd.y"2065{2066if ((yyvsp[(3) - (3)].i))2067reply(225, "ABOR command successful.");2068}2069break;20702071case 29:2072#line 365 "ftpcmd.y"2073{2074if ((yyvsp[(3) - (3)].i)) {2075const char *path = pw->pw_dir;2076if (dochroot || guest)2077path = "/";2078cwd(path);2079}2080}2081break;20822083case 30:2084#line 374 "ftpcmd.y"2085{2086if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2087cwd((yyvsp[(3) - (5)].s));2088if ((yyvsp[(3) - (5)].s) != NULL)2089free((yyvsp[(3) - (5)].s));2090}2091break;20922093case 31:2094#line 381 "ftpcmd.y"2095{2096if ((yyvsp[(3) - (3)].i))2097help(cmdtab, (char *) 0);2098}2099break;21002101case 32:2102#line 386 "ftpcmd.y"2103{2104if ((yyvsp[(5) - (5)].i)) {2105char *cp = (yyvsp[(3) - (5)].s);21062107if (strncasecmp(cp, "SITE", 4) == 0) {2108cp = (yyvsp[(3) - (5)].s) + 4;2109if (*cp == ' ')2110cp++;2111if (*cp)2112help(sitetab, cp);2113else2114help(sitetab, (char *) 0);2115} else2116help(cmdtab, (yyvsp[(3) - (5)].s));2117}2118}2119break;21202121case 33:2122#line 403 "ftpcmd.y"2123{2124if ((yyvsp[(3) - (3)].i))2125reply(200, "NOOP command successful.");2126}2127break;21282129case 34:2130#line 408 "ftpcmd.y"2131{2132if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2133makedir((yyvsp[(3) - (5)].s));2134if ((yyvsp[(3) - (5)].s) != NULL)2135free((yyvsp[(3) - (5)].s));2136}2137break;21382139case 35:2140#line 415 "ftpcmd.y"2141{2142if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2143removedir((yyvsp[(3) - (5)].s));2144if ((yyvsp[(3) - (5)].s) != NULL)2145free((yyvsp[(3) - (5)].s));2146}2147break;21482149case 36:2150#line 422 "ftpcmd.y"2151{2152if ((yyvsp[(3) - (3)].i))2153pwd();2154}2155break;21562157case 37:2158#line 427 "ftpcmd.y"2159{2160if ((yyvsp[(3) - (3)].i))2161cwd("..");2162}2163break;21642165case 38:2166#line 432 "ftpcmd.y"2167{2168if ((yyvsp[(3) - (3)].i)) {2169lreply(211, "Supported features:");2170lreply(0, " MDTM");2171lreply(0, " REST STREAM");2172lreply(0, " SIZE");2173reply(211, "End");2174}2175}2176break;21772178case 39:2179#line 442 "ftpcmd.y"2180{2181if ((yyvsp[(5) - (5)].i))2182reply(501, "Bad options");2183free ((yyvsp[(3) - (5)].s));2184}2185break;21862187case 40:2188#line 449 "ftpcmd.y"2189{2190if ((yyvsp[(5) - (5)].i))2191help(sitetab, (char *) 0);2192}2193break;21942195case 41:2196#line 454 "ftpcmd.y"2197{2198if ((yyvsp[(7) - (7)].i))2199help(sitetab, (yyvsp[(5) - (7)].s));2200}2201break;22022203case 42:2204#line 459 "ftpcmd.y"2205{2206if ((yyvsp[(5) - (5)].i)) {2207int oldmask = umask(0);2208umask(oldmask);2209reply(200, "Current UMASK is %03o", oldmask);2210}2211}2212break;22132214case 43:2215#line 467 "ftpcmd.y"2216{2217if ((yyvsp[(7) - (7)].i)) {2218if (((yyvsp[(5) - (7)].i) == -1) || ((yyvsp[(5) - (7)].i) > 0777)) {2219reply(501, "Bad UMASK value");2220} else {2221int oldmask = umask((yyvsp[(5) - (7)].i));2222reply(200,2223"UMASK set to %03o (was %03o)",2224(yyvsp[(5) - (7)].i), oldmask);2225}2226}2227}2228break;22292230case 44:2231#line 480 "ftpcmd.y"2232{2233if ((yyvsp[(9) - (9)].i) && (yyvsp[(7) - (9)].s) != NULL) {2234if ((yyvsp[(5) - (9)].i) > 0777)2235reply(501,2236"CHMOD: Mode value must be between 0 and 0777");2237else if (chmod((yyvsp[(7) - (9)].s), (yyvsp[(5) - (9)].i)) < 0)2238perror_reply(550, (yyvsp[(7) - (9)].s));2239else2240reply(200, "CHMOD command successful.");2241}2242if ((yyvsp[(7) - (9)].s) != NULL)2243free((yyvsp[(7) - (9)].s));2244}2245break;22462247case 45:2248#line 494 "ftpcmd.y"2249{2250if ((yyvsp[(5) - (5)].i))2251reply(200,2252"Current IDLE time limit is %d seconds; max %d",2253ftpd_timeout, maxtimeout);2254}2255break;22562257case 46:2258#line 501 "ftpcmd.y"2259{2260if ((yyvsp[(7) - (7)].i)) {2261if ((yyvsp[(5) - (7)].i) < 30 || (yyvsp[(5) - (7)].i) > maxtimeout) {2262reply(501,2263"Maximum IDLE time must be between 30 and %d seconds",2264maxtimeout);2265} else {2266ftpd_timeout = (yyvsp[(5) - (7)].i);2267alarm((unsigned) ftpd_timeout);2268reply(200,2269"Maximum IDLE time set to %d seconds",2270ftpd_timeout);2271}2272}2273}2274break;22752276case 47:2277#line 518 "ftpcmd.y"2278{2279reply(500, "Command not implemented.");2280}2281break;22822283case 48:2284#line 522 "ftpcmd.y"2285{2286if((yyvsp[(5) - (5)].i))2287klist();2288}2289break;22902291case 49:2292#line 527 "ftpcmd.y"2293{2294reply(500, "Command not implemented.");2295}2296break;22972298case 50:2299#line 531 "ftpcmd.y"2300{2301reply(500, "Command not implemented.");2302}2303break;23042305case 51:2306#line 535 "ftpcmd.y"2307{2308#if defined(KRB5)2309if(guest)2310reply(500, "Can't be done as guest.");2311else if((yyvsp[(5) - (5)].i))2312afslog(NULL, 0);2313#else2314reply(500, "Command not implemented.");2315#endif2316}2317break;23182319case 52:2320#line 546 "ftpcmd.y"2321{2322#if defined(KRB5)2323if(guest)2324reply(500, "Can't be done as guest.");2325else if((yyvsp[(7) - (7)].i))2326afslog((yyvsp[(5) - (7)].s), 0);2327if((yyvsp[(5) - (7)].s))2328free((yyvsp[(5) - (7)].s));2329#else2330reply(500, "Command not implemented.");2331#endif2332}2333break;23342335case 53:2336#line 559 "ftpcmd.y"2337{2338if((yyvsp[(7) - (7)].i) && (yyvsp[(5) - (7)].s) != NULL)2339find((yyvsp[(5) - (7)].s));2340if((yyvsp[(5) - (7)].s) != NULL)2341free((yyvsp[(5) - (7)].s));2342}2343break;23442345case 54:2346#line 566 "ftpcmd.y"2347{2348if ((yyvsp[(5) - (5)].i))2349reply(200, "http://www.pdc.kth.se/heimdal/");2350}2351break;23522353case 55:2354#line 571 "ftpcmd.y"2355{2356if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2357do_store((yyvsp[(3) - (5)].s), "w", 1);2358if ((yyvsp[(3) - (5)].s) != NULL)2359free((yyvsp[(3) - (5)].s));2360}2361break;23622363case 56:2364#line 578 "ftpcmd.y"2365{2366if ((yyvsp[(3) - (3)].i)) {2367#if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__)2368reply(215, "UNIX Type: L%d", NBBY);2369#else2370reply(215, "UNKNOWN Type: L%d", NBBY);2371#endif2372}2373}2374break;23752376case 57:2377#line 596 "ftpcmd.y"2378{2379if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL)2380sizecmd((yyvsp[(3) - (5)].s));2381if ((yyvsp[(3) - (5)].s) != NULL)2382free((yyvsp[(3) - (5)].s));2383}2384break;23852386case 58:2387#line 613 "ftpcmd.y"2388{2389if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s) != NULL) {2390struct stat stbuf;2391if (stat((yyvsp[(3) - (5)].s), &stbuf) < 0)2392reply(550, "%s: %s",2393(yyvsp[(3) - (5)].s), strerror(errno));2394else if (!S_ISREG(stbuf.st_mode)) {2395reply(550,2396"%s: not a plain file.", (yyvsp[(3) - (5)].s));2397} else {2398struct tm *t;2399time_t mtime = stbuf.st_mtime;24002401t = gmtime(&mtime);2402reply(213,2403"%04d%02d%02d%02d%02d%02d",2404t->tm_year + 1900,2405t->tm_mon + 1,2406t->tm_mday,2407t->tm_hour,2408t->tm_min,2409t->tm_sec);2410}2411}2412if ((yyvsp[(3) - (5)].s) != NULL)2413free((yyvsp[(3) - (5)].s));2414}2415break;24162417case 59:2418#line 641 "ftpcmd.y"2419{2420if ((yyvsp[(3) - (3)].i)) {2421reply(221, "Goodbye.");2422dologout(0);2423}2424}2425break;24262427case 60:2428#line 648 "ftpcmd.y"2429{2430yyerrok;2431}2432break;24332434case 61:2435#line 654 "ftpcmd.y"2436{2437restart_point = (off_t) 0;2438if ((yyvsp[(5) - (5)].i) && (yyvsp[(3) - (5)].s)) {2439fromname = renamefrom((yyvsp[(3) - (5)].s));2440if (fromname == (char *) 0 && (yyvsp[(3) - (5)].s)) {2441free((yyvsp[(3) - (5)].s));2442}2443}2444}2445break;24462447case 62:2448#line 664 "ftpcmd.y"2449{2450if ((yyvsp[(5) - (5)].i)) {2451fromname = (char *) 0;2452restart_point = (yyvsp[(3) - (5)].i); /* XXX $3 is only "int" */2453reply(350, "Restarting at %ld. %s",2454(long)restart_point,2455"Send STORE or RETRIEVE to initiate transfer.");2456}2457}2458break;24592460case 63:2461#line 674 "ftpcmd.y"2462{2463auth((yyvsp[(3) - (4)].s));2464free((yyvsp[(3) - (4)].s));2465}2466break;24672468case 64:2469#line 679 "ftpcmd.y"2470{2471adat((yyvsp[(3) - (4)].s));2472free((yyvsp[(3) - (4)].s));2473}2474break;24752476case 65:2477#line 684 "ftpcmd.y"2478{2479if ((yyvsp[(5) - (5)].i))2480pbsz((yyvsp[(3) - (5)].i));2481}2482break;24832484case 66:2485#line 689 "ftpcmd.y"2486{2487if ((yyvsp[(5) - (5)].i))2488prot((yyvsp[(3) - (5)].s));2489}2490break;24912492case 67:2493#line 694 "ftpcmd.y"2494{2495if ((yyvsp[(3) - (3)].i))2496ccc();2497}2498break;24992500case 68:2501#line 699 "ftpcmd.y"2502{2503mec((yyvsp[(3) - (4)].s), prot_safe);2504free((yyvsp[(3) - (4)].s));2505}2506break;25072508case 69:2509#line 704 "ftpcmd.y"2510{2511mec((yyvsp[(3) - (4)].s), prot_confidential);2512free((yyvsp[(3) - (4)].s));2513}2514break;25152516case 70:2517#line 709 "ftpcmd.y"2518{2519mec((yyvsp[(3) - (4)].s), prot_private);2520free((yyvsp[(3) - (4)].s));2521}2522break;25232524case 72:2525#line 721 "ftpcmd.y"2526{2527(yyval.s) = (char *)calloc(1, sizeof(char));2528}2529break;25302531case 75:2532#line 734 "ftpcmd.y"2533{2534struct sockaddr_in *sin4 = (struct sockaddr_in *)data_dest;25352536sin4->sin_family = AF_INET;2537sin4->sin_port = htons((yyvsp[(9) - (11)].i) * 256 + (yyvsp[(11) - (11)].i));2538sin4->sin_addr.s_addr =2539htonl(((yyvsp[(1) - (11)].i) << 24) | ((yyvsp[(3) - (11)].i) << 16) | ((yyvsp[(5) - (11)].i) << 8) | (yyvsp[(7) - (11)].i));2540}2541break;25422543case 76:2544#line 746 "ftpcmd.y"2545{2546(yyval.i) = FORM_N;2547}2548break;25492550case 77:2551#line 750 "ftpcmd.y"2552{2553(yyval.i) = FORM_T;2554}2555break;25562557case 78:2558#line 754 "ftpcmd.y"2559{2560(yyval.i) = FORM_C;2561}2562break;25632564case 79:2565#line 761 "ftpcmd.y"2566{2567cmd_type = TYPE_A;2568cmd_form = FORM_N;2569}2570break;25712572case 80:2573#line 766 "ftpcmd.y"2574{2575cmd_type = TYPE_A;2576cmd_form = (yyvsp[(3) - (3)].i);2577}2578break;25792580case 81:2581#line 771 "ftpcmd.y"2582{2583cmd_type = TYPE_E;2584cmd_form = FORM_N;2585}2586break;25872588case 82:2589#line 776 "ftpcmd.y"2590{2591cmd_type = TYPE_E;2592cmd_form = (yyvsp[(3) - (3)].i);2593}2594break;25952596case 83:2597#line 781 "ftpcmd.y"2598{2599cmd_type = TYPE_I;2600}2601break;26022603case 84:2604#line 785 "ftpcmd.y"2605{2606cmd_type = TYPE_L;2607cmd_bytesz = NBBY;2608}2609break;26102611case 85:2612#line 790 "ftpcmd.y"2613{2614cmd_type = TYPE_L;2615cmd_bytesz = (yyvsp[(3) - (3)].i);2616}2617break;26182619case 86:2620#line 796 "ftpcmd.y"2621{2622cmd_type = TYPE_L;2623cmd_bytesz = (yyvsp[(2) - (2)].i);2624}2625break;26262627case 87:2628#line 804 "ftpcmd.y"2629{2630(yyval.i) = STRU_F;2631}2632break;26332634case 88:2635#line 808 "ftpcmd.y"2636{2637(yyval.i) = STRU_R;2638}2639break;26402641case 89:2642#line 812 "ftpcmd.y"2643{2644(yyval.i) = STRU_P;2645}2646break;26472648case 90:2649#line 819 "ftpcmd.y"2650{2651(yyval.i) = MODE_S;2652}2653break;26542655case 91:2656#line 823 "ftpcmd.y"2657{2658(yyval.i) = MODE_B;2659}2660break;26612662case 92:2663#line 827 "ftpcmd.y"2664{2665(yyval.i) = MODE_C;2666}2667break;26682669case 93:2670#line 834 "ftpcmd.y"2671{2672/*2673* Problem: this production is used for all pathname2674* processing, but only gives a 550 error reply.2675* This is a valid reply in some cases but not in others.2676*/2677if (logged_in && (yyvsp[(1) - (1)].s) && *(yyvsp[(1) - (1)].s) == '~') {2678glob_t gl;2679int flags =2680GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE;26812682memset(&gl, 0, sizeof(gl));2683if (glob((yyvsp[(1) - (1)].s), flags, NULL, &gl) ||2684gl.gl_pathc == 0) {2685reply(550, "not found");2686(yyval.s) = NULL;2687} else {2688(yyval.s) = strdup(gl.gl_pathv[0]);2689}2690globfree(&gl);2691free((yyvsp[(1) - (1)].s));2692} else2693(yyval.s) = (yyvsp[(1) - (1)].s);2694}2695break;26962697case 95:2698#line 866 "ftpcmd.y"2699{2700int ret, dec, multby, digit;27012702/*2703* Convert a number that was read as decimal number2704* to what it would be if it had been read as octal.2705*/2706dec = (yyvsp[(1) - (1)].i);2707multby = 1;2708ret = 0;2709while (dec) {2710digit = dec%10;2711if (digit > 7) {2712ret = -1;2713break;2714}2715ret += digit * multby;2716multby *= 8;2717dec /= 10;2718}2719(yyval.i) = ret;2720}2721break;27222723case 96:2724#line 892 "ftpcmd.y"2725{2726(yyval.i) = (yyvsp[(1) - (1)].i) && !guest;2727if((yyvsp[(1) - (1)].i) && !(yyval.i))2728reply(550, "Permission denied");2729}2730break;27312732case 97:2733#line 900 "ftpcmd.y"2734{2735if((yyvsp[(1) - (1)].i)) {2736if(((yyval.i) = logged_in) == 0)2737reply(530, "Please login with USER and PASS.");2738} else2739(yyval.i) = 0;2740}2741break;27422743case 98:2744#line 910 "ftpcmd.y"2745{2746(yyval.i) = 1;2747if(sec_complete && !ccc_passed && !secure_command()) {2748(yyval.i) = 0;2749reply(533, "Command protection level denied "2750"for paranoid reasons.");2751}2752}2753break;275427552756/* Line 1267 of yacc.c. */2757#line 2759 "ftpcmd.c"2758default: break;2759}2760YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);27612762YYPOPSTACK (yylen);2763yylen = 0;2764YY_STACK_PRINT (yyss, yyssp);27652766*++yyvsp = yyval;276727682769/* Now `shift' the result of the reduction. Determine what state2770that goes to, based on the state we popped back to and the rule2771number reduced by. */27722773yyn = yyr1[yyn];27742775yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;2776if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)2777yystate = yytable[yystate];2778else2779yystate = yydefgoto[yyn - YYNTOKENS];27802781goto yynewstate;278227832784/*------------------------------------.2785| yyerrlab -- here on detecting error |2786`------------------------------------*/2787yyerrlab:2788/* If not already recovering from an error, report this error. */2789if (!yyerrstatus)2790{2791++yynerrs;2792#if ! YYERROR_VERBOSE2793yyerror (YY_("syntax error"));2794#else2795{2796YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);2797if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)2798{2799YYSIZE_T yyalloc = 2 * yysize;2800if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))2801yyalloc = YYSTACK_ALLOC_MAXIMUM;2802if (yymsg != yymsgbuf)2803YYSTACK_FREE (yymsg);2804yymsg = (char *) YYSTACK_ALLOC (yyalloc);2805if (yymsg)2806yymsg_alloc = yyalloc;2807else2808{2809yymsg = yymsgbuf;2810yymsg_alloc = sizeof yymsgbuf;2811}2812}28132814if (0 < yysize && yysize <= yymsg_alloc)2815{2816(void) yysyntax_error (yymsg, yystate, yychar);2817yyerror (yymsg);2818}2819else2820{2821yyerror (YY_("syntax error"));2822if (yysize != 0)2823goto yyexhaustedlab;2824}2825}2826#endif2827}2828282928302831if (yyerrstatus == 3)2832{2833/* If just tried and failed to reuse look-ahead token after an2834error, discard it. */28352836if (yychar <= YYEOF)2837{2838/* Return failure if at end of input. */2839if (yychar == YYEOF)2840YYABORT;2841}2842else2843{2844yydestruct ("Error: discarding",2845yytoken, &yylval);2846yychar = YYEMPTY;2847}2848}28492850/* Else will try to reuse look-ahead token after shifting the error2851token. */2852goto yyerrlab1;285328542855/*---------------------------------------------------.2856| yyerrorlab -- error raised explicitly by YYERROR. |2857`---------------------------------------------------*/2858yyerrorlab:28592860/* Pacify compilers like GCC when the user code never invokes2861YYERROR and the label yyerrorlab therefore never appears in user2862code. */2863if (/*CONSTCOND*/ 0)2864goto yyerrorlab;28652866/* Do not reclaim the symbols of the rule which action triggered2867this YYERROR. */2868YYPOPSTACK (yylen);2869yylen = 0;2870YY_STACK_PRINT (yyss, yyssp);2871yystate = *yyssp;2872goto yyerrlab1;287328742875/*-------------------------------------------------------------.2876| yyerrlab1 -- common code for both syntax error and YYERROR. |2877`-------------------------------------------------------------*/2878yyerrlab1:2879yyerrstatus = 3; /* Each real token shifted decrements this. */28802881for (;;)2882{2883yyn = yypact[yystate];2884if (yyn != YYPACT_NINF)2885{2886yyn += YYTERROR;2887if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)2888{2889yyn = yytable[yyn];2890if (0 < yyn)2891break;2892}2893}28942895/* Pop the current state because it cannot handle the error token. */2896if (yyssp == yyss)2897YYABORT;289828992900yydestruct ("Error: popping",2901yystos[yystate], yyvsp);2902YYPOPSTACK (1);2903yystate = *yyssp;2904YY_STACK_PRINT (yyss, yyssp);2905}29062907if (yyn == YYFINAL)2908YYACCEPT;29092910*++yyvsp = yylval;291129122913/* Shift the error token. */2914YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);29152916yystate = yyn;2917goto yynewstate;291829192920/*-------------------------------------.2921| yyacceptlab -- YYACCEPT comes here. |2922`-------------------------------------*/2923yyacceptlab:2924yyresult = 0;2925goto yyreturn;29262927/*-----------------------------------.2928| yyabortlab -- YYABORT comes here. |2929`-----------------------------------*/2930yyabortlab:2931yyresult = 1;2932goto yyreturn;29332934#ifndef yyoverflow2935/*-------------------------------------------------.2936| yyexhaustedlab -- memory exhaustion comes here. |2937`-------------------------------------------------*/2938yyexhaustedlab:2939yyerror (YY_("memory exhausted"));2940yyresult = 2;2941/* Fall through. */2942#endif29432944yyreturn:2945if (yychar != YYEOF && yychar != YYEMPTY)2946yydestruct ("Cleanup: discarding lookahead",2947yytoken, &yylval);2948/* Do not reclaim the symbols of the rule which action triggered2949this YYABORT or YYACCEPT. */2950YYPOPSTACK (yylen);2951YY_STACK_PRINT (yyss, yyssp);2952while (yyssp != yyss)2953{2954yydestruct ("Cleanup: popping",2955yystos[*yyssp], yyvsp);2956YYPOPSTACK (1);2957}2958#ifndef yyoverflow2959if (yyss != yyssa)2960YYSTACK_FREE (yyss);2961#endif2962#if YYERROR_VERBOSE2963if (yymsg != yymsgbuf)2964YYSTACK_FREE (yymsg);2965#endif2966/* Make sure YYID is used. */2967return YYID (yyresult);2968}296929702971#line 920 "ftpcmd.y"297229732974#define CMD 0 /* beginning of command */2975#define ARGS 1 /* expect miscellaneous arguments */2976#define STR1 2 /* expect SP followed by STRING */2977#define STR2 3 /* expect STRING */2978#define OSTR 4 /* optional SP then STRING */2979#define ZSTR1 5 /* SP then optional STRING */2980#define ZSTR2 6 /* optional STRING after SP */2981#define SITECMD 7 /* SITE command */2982#define NSTR 8 /* Number followed by a string */29832984struct tab cmdtab[] = { /* In order defined in RFC 765 */2985{ "USER", USER, STR1, 1, "<sp> username" },2986{ "PASS", PASS, ZSTR1, 1, "<sp> password" },2987{ "ACCT", ACCT, STR1, 0, "(specify account)" },2988{ "SMNT", SMNT, ARGS, 0, "(structure mount)" },2989{ "REIN", REIN, ARGS, 0, "(reinitialize server state)" },2990{ "QUIT", QUIT, ARGS, 1, "(terminate service)", },2991{ "PORT", PORT, ARGS, 1, "<sp> b0, b1, b2, b3, b4" },2992{ "EPRT", EPRT, STR1, 1, "<sp> string" },2993{ "PASV", PASV, ARGS, 1, "(set server in passive mode)" },2994{ "EPSV", EPSV, OSTR, 1, "[<sp> foo]" },2995{ "TYPE", TYPE, ARGS, 1, "<sp> [ A | E | I | L ]" },2996{ "STRU", STRU, ARGS, 1, "(specify file structure)" },2997{ "MODE", MODE, ARGS, 1, "(specify transfer mode)" },2998{ "RETR", RETR, STR1, 1, "<sp> file-name" },2999{ "STOR", STOR, STR1, 1, "<sp> file-name" },3000{ "APPE", APPE, STR1, 1, "<sp> file-name" },3001{ "MLFL", MLFL, OSTR, 0, "(mail file)" },3002{ "MAIL", MAIL, OSTR, 0, "(mail to user)" },3003{ "MSND", MSND, OSTR, 0, "(mail send to terminal)" },3004{ "MSOM", MSOM, OSTR, 0, "(mail send to terminal or mailbox)" },3005{ "MSAM", MSAM, OSTR, 0, "(mail send to terminal and mailbox)" },3006{ "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },3007{ "MRCP", MRCP, STR1, 0, "(mail recipient)" },3008{ "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },3009{ "REST", REST, ARGS, 1, "<sp> offset (restart command)" },3010{ "RNFR", RNFR, STR1, 1, "<sp> file-name" },3011{ "RNTO", RNTO, STR1, 1, "<sp> file-name" },3012{ "ABOR", ABOR, ARGS, 1, "(abort operation)" },3013{ "DELE", DELE, STR1, 1, "<sp> file-name" },3014{ "CWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },3015{ "XCWD", CWD, OSTR, 1, "[ <sp> directory-name ]" },3016{ "LIST", LIST, OSTR, 1, "[ <sp> path-name ]" },3017{ "NLST", NLST, OSTR, 1, "[ <sp> path-name ]" },3018{ "SITE", SITE, SITECMD, 1, "site-cmd [ <sp> arguments ]" },3019{ "SYST", SYST, ARGS, 1, "(get type of operating system)" },3020{ "STAT", sTAT, OSTR, 1, "[ <sp> path-name ]" },3021{ "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },3022{ "NOOP", NOOP, ARGS, 1, "" },3023{ "MKD", MKD, STR1, 1, "<sp> path-name" },3024{ "XMKD", MKD, STR1, 1, "<sp> path-name" },3025{ "RMD", RMD, STR1, 1, "<sp> path-name" },3026{ "XRMD", RMD, STR1, 1, "<sp> path-name" },3027{ "PWD", PWD, ARGS, 1, "(return current directory)" },3028{ "XPWD", PWD, ARGS, 1, "(return current directory)" },3029{ "CDUP", CDUP, ARGS, 1, "(change to parent directory)" },3030{ "XCUP", CDUP, ARGS, 1, "(change to parent directory)" },3031{ "STOU", STOU, STR1, 1, "<sp> file-name" },3032{ "SIZE", SIZE, OSTR, 1, "<sp> path-name" },3033{ "MDTM", MDTM, OSTR, 1, "<sp> path-name" },30343035/* extensions from RFC2228 */3036{ "AUTH", AUTH, STR1, 1, "<sp> auth-type" },3037{ "ADAT", ADAT, STR1, 1, "<sp> auth-data" },3038{ "PBSZ", PBSZ, ARGS, 1, "<sp> buffer-size" },3039{ "PROT", PROT, STR1, 1, "<sp> prot-level" },3040{ "CCC", CCC, ARGS, 1, "" },3041{ "MIC", MIC, STR1, 1, "<sp> integrity command" },3042{ "CONF", CONF, STR1, 1, "<sp> confidentiality command" },3043{ "ENC", ENC, STR1, 1, "<sp> privacy command" },30443045/* RFC2389 */3046{ "FEAT", FEAT, ARGS, 1, "" },3047{ "OPTS", OPTS, ARGS, 1, "<sp> command [<sp> options]" },30483049{ NULL, 0, 0, 0, 0 }3050};30513052struct tab sitetab[] = {3053{ "UMASK", UMASK, ARGS, 1, "[ <sp> umask ]" },3054{ "IDLE", IDLE, ARGS, 1, "[ <sp> maximum-idle-time ]" },3055{ "CHMOD", CHMOD, NSTR, 1, "<sp> mode <sp> file-name" },3056{ "HELP", HELP, OSTR, 1, "[ <sp> <string> ]" },30573058{ "KAUTH", KAUTH, STR1, 1, "<sp> principal [ <sp> ticket ]" },3059{ "KLIST", KLIST, ARGS, 1, "(show ticket file)" },3060{ "KDESTROY", KDESTROY, ARGS, 1, "(destroy tickets)" },3061{ "KRBTKFILE", KRBTKFILE, STR1, 1, "<sp> ticket-file" },3062{ "AFSLOG", AFSLOG, OSTR, 1, "[<sp> cell]" },30633064{ "LOCATE", LOCATE, STR1, 1, "<sp> globexpr" },3065{ "FIND", LOCATE, STR1, 1, "<sp> globexpr" },30663067{ "URL", URL, ARGS, 1, "?" },30683069{ NULL, 0, 0, 0, 0 }3070};30713072static struct tab *3073lookup(struct tab *p, char *cmd)3074{30753076for (; p->name != NULL; p++)3077if (strcmp(cmd, p->name) == 0)3078return (p);3079return (0);3080}30813082/*3083* ftpd_getline - a hacked up version of fgets to ignore TELNET escape codes.3084*/3085char *3086ftpd_getline(char *s, int n)3087{3088int c;3089char *cs;30903091cs = s;30923093/* might still be data within the security MIC/CONF/ENC */3094if(ftp_command){3095strlcpy(s, ftp_command, n);3096if (debug)3097syslog(LOG_DEBUG, "command: %s", s);3098return s;3099}3100while ((c = getc(stdin)) != EOF) {3101c &= 0377;3102if (c == IAC) {3103if ((c = getc(stdin)) != EOF) {3104c &= 0377;3105switch (c) {3106case WILL:3107case WONT:3108c = getc(stdin);3109printf("%c%c%c", IAC, DONT, 0377&c);3110fflush(stdout);3111continue;3112case DO:3113case DONT:3114c = getc(stdin);3115printf("%c%c%c", IAC, WONT, 0377&c);3116fflush(stdout);3117continue;3118case IAC:3119break;3120default:3121continue; /* ignore command */3122}3123}3124}3125*cs++ = c;3126if (--n <= 0 || c == '\n')3127break;3128}3129if (c == EOF && cs == s)3130return (NULL);3131*cs++ = '\0';3132if (debug) {3133if (!guest && strncasecmp("pass ", s, 5) == 0) {3134/* Don't syslog passwords */3135syslog(LOG_DEBUG, "command: %.5s ???", s);3136} else {3137char *cp;3138int len;31393140/* Don't syslog trailing CR-LF */3141len = strlen(s);3142cp = s + len - 1;3143while (cp >= s && (*cp == '\n' || *cp == '\r')) {3144--cp;3145--len;3146}3147syslog(LOG_DEBUG, "command: %.*s", len, s);3148}3149}3150#ifdef XXX3151fprintf(stderr, "%s\n", s);3152#endif3153return (s);3154}31553156static RETSIGTYPE3157toolong(int signo)3158{31593160reply(421,3161"Timeout (%d seconds): closing control connection.",3162ftpd_timeout);3163if (logging)3164syslog(LOG_INFO, "User %s timed out after %d seconds",3165(pw ? pw -> pw_name : "unknown"), ftpd_timeout);3166dologout(1);3167SIGRETURN(0);3168}31693170static int3171yylex(void)3172{3173static int cpos, state;3174char *cp, *cp2;3175struct tab *p;3176int n;3177char c;31783179for (;;) {3180switch (state) {31813182case CMD:3183hasyyerrored = 0;31843185signal(SIGALRM, toolong);3186alarm((unsigned) ftpd_timeout);3187if (ftpd_getline(cbuf, sizeof(cbuf)-1) == NULL) {3188reply(221, "You could at least say goodbye.");3189dologout(0);3190}3191alarm(0);3192#ifdef HAVE_SETPROCTITLE3193if (strncasecmp(cbuf, "PASS", 4) != 0)3194setproctitle("%s: %s", proctitle, cbuf);3195#endif /* HAVE_SETPROCTITLE */3196if ((cp = strchr(cbuf, '\r'))) {3197*cp++ = '\n';3198*cp = '\0';3199}3200if ((cp = strpbrk(cbuf, " \n")))3201cpos = cp - cbuf;3202if (cpos == 0)3203cpos = 4;3204c = cbuf[cpos];3205cbuf[cpos] = '\0';3206strupr(cbuf);3207p = lookup(cmdtab, cbuf);3208cbuf[cpos] = c;3209if (p != 0) {3210if (p->implemented == 0) {3211nack(p->name);3212hasyyerrored = 1;3213break;3214}3215state = p->state;3216yylval.s = p->name;3217return (p->token);3218}3219break;32203221case SITECMD:3222if (cbuf[cpos] == ' ') {3223cpos++;3224return (SP);3225}3226cp = &cbuf[cpos];3227if ((cp2 = strpbrk(cp, " \n")))3228cpos = cp2 - cbuf;3229c = cbuf[cpos];3230cbuf[cpos] = '\0';3231strupr(cp);3232p = lookup(sitetab, cp);3233cbuf[cpos] = c;3234if (p != 0) {3235if (p->implemented == 0) {3236state = CMD;3237nack(p->name);3238hasyyerrored = 1;3239break;3240}3241state = p->state;3242yylval.s = p->name;3243return (p->token);3244}3245state = CMD;3246break;32473248case OSTR:3249if (cbuf[cpos] == '\n') {3250state = CMD;3251return (CRLF);3252}3253/* FALLTHROUGH */32543255case STR1:3256case ZSTR1:3257dostr1:3258if (cbuf[cpos] == ' ') {3259cpos++;3260if(state == OSTR)3261state = STR2;3262else3263state++;3264return (SP);3265}3266break;32673268case ZSTR2:3269if (cbuf[cpos] == '\n') {3270state = CMD;3271return (CRLF);3272}3273/* FALLTHROUGH */32743275case STR2:3276cp = &cbuf[cpos];3277n = strlen(cp);3278cpos += n - 1;3279/*3280* Make sure the string is nonempty and \n terminated.3281*/3282if (n > 1 && cbuf[cpos] == '\n') {3283cbuf[cpos] = '\0';3284yylval.s = copy(cp);3285cbuf[cpos] = '\n';3286state = ARGS;3287return (STRING);3288}3289break;32903291case NSTR:3292if (cbuf[cpos] == ' ') {3293cpos++;3294return (SP);3295}3296if (isdigit((unsigned char)cbuf[cpos])) {3297cp = &cbuf[cpos];3298while (isdigit((unsigned char)cbuf[++cpos]))3299;3300c = cbuf[cpos];3301cbuf[cpos] = '\0';3302yylval.i = atoi(cp);3303cbuf[cpos] = c;3304state = STR1;3305return (NUMBER);3306}3307state = STR1;3308goto dostr1;33093310case ARGS:3311if (isdigit((unsigned char)cbuf[cpos])) {3312cp = &cbuf[cpos];3313while (isdigit((unsigned char)cbuf[++cpos]))3314;3315c = cbuf[cpos];3316cbuf[cpos] = '\0';3317yylval.i = atoi(cp);3318cbuf[cpos] = c;3319return (NUMBER);3320}3321switch (cbuf[cpos++]) {33223323case '\n':3324state = CMD;3325return (CRLF);33263327case ' ':3328return (SP);33293330case ',':3331return (COMMA);33323333case 'A':3334case 'a':3335return (A);33363337case 'B':3338case 'b':3339return (B);33403341case 'C':3342case 'c':3343return (C);33443345case 'E':3346case 'e':3347return (E);33483349case 'F':3350case 'f':3351return (F);33523353case 'I':3354case 'i':3355return (I);33563357case 'L':3358case 'l':3359return (L);33603361case 'N':3362case 'n':3363return (N);33643365case 'P':3366case 'p':3367return (P);33683369case 'R':3370case 'r':3371return (R);33723373case 'S':3374case 's':3375return (S);33763377case 'T':3378case 't':3379return (T);33803381}3382break;33833384default:3385fatal("Unknown state in scanner.");3386}3387yyerror(NULL);3388state = CMD;3389return (0);3390}3391}33923393/* ARGSUSED */3394void3395yyerror(char *s)3396{3397char *cp;33983399if (hasyyerrored)3400return;34013402if ((cp = strchr(cbuf,'\n')))3403*cp = '\0';3404reply(500, "'%s': command not understood.", cbuf);3405hasyyerrored = 1;3406}34073408static char *3409copy(char *s)3410{3411char *p;34123413p = strdup(s);3414if (p == NULL)3415fatal("Ran out of memory.");3416return p;3417}34183419static void3420help(struct tab *ctab, char *s)3421{3422struct tab *c;3423int width, NCMDS;3424char *t;3425char buf[1024];34263427if (ctab == sitetab)3428t = "SITE ";3429else3430t = "";3431width = 0, NCMDS = 0;3432for (c = ctab; c->name != NULL; c++) {3433int len = strlen(c->name);34343435if (len > width)3436width = len;3437NCMDS++;3438}3439width = (width + 8) &~ 7;3440if (s == 0) {3441int i, j, w;3442int columns, lines;34433444lreply(214, "The following %scommands are recognized %s.",3445t, "(* =>'s unimplemented)");3446columns = 76 / width;3447if (columns == 0)3448columns = 1;3449lines = (NCMDS + columns - 1) / columns;3450for (i = 0; i < lines; i++) {3451strlcpy (buf, " ", sizeof(buf));3452for (j = 0; j < columns; j++) {3453c = ctab + j * lines + i;3454snprintf (buf + strlen(buf),3455sizeof(buf) - strlen(buf),3456"%s%c",3457c->name,3458c->implemented ? ' ' : '*');3459if (c + lines >= &ctab[NCMDS])3460break;3461w = strlen(c->name) + 1;3462while (w < width) {3463strlcat (buf,3464" ",3465sizeof(buf));3466w++;3467}3468}3469lreply(214, "%s", buf);3470}3471reply(214, "Direct comments to [email protected]");3472return;3473}3474strupr(s);3475c = lookup(ctab, s);3476if (c == (struct tab *)0) {3477reply(502, "Unknown command %s.", s);3478return;3479}3480if (c->implemented)3481reply(214, "Syntax: %s%s %s", t, c->name, c->help);3482else3483reply(214, "%s%-*s\t%s; unimplemented.", t, width,3484c->name, c->help);3485}34863487static void3488sizecmd(char *filename)3489{3490switch (type) {3491case TYPE_L:3492case TYPE_I: {3493struct stat stbuf;3494if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))3495reply(550, "%s: not a plain file.", filename);3496else3497reply(213, "%lu", (unsigned long)stbuf.st_size);3498break;3499}3500case TYPE_A: {3501FILE *fin;3502int c;3503size_t count;3504struct stat stbuf;3505fin = fopen(filename, "r");3506if (fin == NULL) {3507perror_reply(550, filename);3508return;3509}3510if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {3511reply(550, "%s: not a plain file.", filename);3512fclose(fin);3513return;3514}35153516count = 0;3517while((c=getc(fin)) != EOF) {3518if (c == '\n') /* will get expanded to \r\n */3519count++;3520count++;3521}3522fclose(fin);35233524reply(213, "%lu", (unsigned long)count);3525break;3526}3527default:3528reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);3529}3530}3531353235333534