[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[LDM #DPV-961741]: Fw: LDM Compile issue
- Subject: [LDM #DPV-961741]: Fw: LDM Compile issue
- Date: Thu, 12 Mar 2009 09:01:54 -0600
Joel,
It appears that your bison(1) parser-generator is creating
a bad parser --- or at least one that doesn't play well with the
other code files.
I've attached the file "parser.c", which is the parser generated
by my system here. Try replacing your file "src/server/parser.c"
with it and rebuilding. Note that, if you execute a "make clean",
then the file "parser.c" will disappear (I recommend saving a copy
under a different name).
Regards,
Steve Emmerson
Ticket Details
===================
Ticket ID: DPV-961741
Department: Support LDM
Priority: Normal
Status: Closed
#include "ldmconfig.h"
#ifndef lint
static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
#include <stdlib.h>
#include <string.h>
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYPATCH 20070509
#define YYEMPTY (-1)
#define yyclearin (yychar = YYEMPTY)
#define yyerrok (yyerrflag = 0)
#define YYRECOVERING (yyerrflag != 0)
extern int yyparse(void);
static int yygrowstack(void);
#define YYPREFIX "yy"
#line 6 "parser.y"
/*
* Copyright 1995, University Corporation for Atmospheric Research
* See ../COPYRIGHT file for copying and redistribution conditions.
*/
/* $Id: parser.y,v 1.1.2.2 2008/05/15 21:26:41 steve Exp $ */
#include "ldmconfig.h"
#include "acl.h"
#include "atofeedt.h"
#include "error.h"
#include "globals.h"
#include "ldm.h"
#include "ldmprint.h"
#include "RegularExpressions.h"
#include "ulog.h"
#include "wordexp.h"
#include <limits.h>
#include <regex.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#if YYDEBUG
extern int yydebug;
#endif
static int line = 0;
static unsigned ldmPort = LDM_PORT;
static int execute = 1;
static const char* scannerGetPath(void);
static int scannerPush(const char*);
static int scannerPop(void);
static void
yyerror(const char *msg)
{
err_log_and_free(
ERR_NEW3(0, NULL,
"Error near line %d, file \"%s\": %s",
line, scannerGetPath(), msg),
ERR_FAILURE);
}
#if __STDC__
extern int yyparse(void);
#endif
static int
decodeFeedtype(
feedtypet* ftp,
const char* string)
{
feedtypet ft;
int error;
int status = strfeedtypet(string, &ft);
if (status == FEEDTYPE_OK) {
#if YYDEBUG
if(yydebug)
udebug("feedtype: %#x", ft);
#endif
*ftp = ft;
error = 0;
}
else {
err_log_and_free(
ERR_NEW4(0, NULL,
"Invalid feedtype expression \"%s\" near line %d, file \"%s\": "
"%s",
string, line, scannerGetPath(), strfeederr(status)),
ERR_FAILURE);
error = 1;
}
return error;
}
static int
decodeRegEx(
regex_t** const regexpp,
const char* string)
{
int error = 1; /* failure */
char* const clone = strdup(string);
if (NULL == clone) {
err_log_and_free(
ERR_NEW4(0, NULL,
"Couldn't clone regular-expression \"%s\" near line %d, "
"file \"%s\": %s",
string, line, scannerGetPath(), strerror(errno)),
ERR_FAILURE);
}
else {
regex_t* regexp = (regex_t*)malloc(sizeof(regex_t));
if (NULL == regexp) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Couldn't allocate %lu bytes for \"regex_t\""
"near line %d, file \"%s\"",
(unsigned long)sizeof(regex_t), line, scannerGetPath()),
ERR_FAILURE);
}
else {
if (re_vetSpec(clone)) {
/*
* Pathological regular expression.
*/
err_log_and_free(
ERR_NEW3(0, NULL,
"Adjusted pathological regular expression \"%s\" "
"near line %d, file \"%s\"",
string, line, scannerGetPath()),
ERR_WARNING);
}
error = regcomp(regexp, clone, REG_EXTENDED|REG_ICASE|REG_NOSUB);
if (!error) {
*regexpp = regexp;
}
else {
char buf[132];
(void)regerror(error, regexp, buf, sizeof(buf));
err_log_and_free(
ERR_NEW4(0, NULL,
"Couldn't compile regular-expression \"%s\" near "
" line %d, file \"%s\": %s",
clone, line, scannerGetPath(), buf),
ERR_FAILURE);
}
if (error)
free(regexp);
} /* "regexp" set */
free(clone);
} /* "clone" set */
return error;
}
static int
decodeHostSet(
host_set** const hspp,
const char* string)
{
regex_t* regexp;
int error = decodeRegEx(®exp, string);
if (!error) {
char* dup = strdup(string);
if (NULL == dup) {
err_log_and_free(
ERR_NEW4(0, NULL,
"Couldn't clone string \"%s\" near line %d, "
"file \"%s\": %s",
string, line, scannerGetPath(), strerror(errno)),
ERR_FAILURE);
}
else {
host_set* hsp = new_host_set(HS_REGEXP, dup, regexp);
if (NULL == hsp) {
err_log_and_free(
ERR_NEW4(0, NULL,
"Couldn't create host-set for "
"\"%s\" near line %d, file \"%s\": %s",
dup, line, scannerGetPath(), strerror(errno)),
ERR_FAILURE);
error = 1;
}
else {
#if YYDEBUG
if(yydebug)
udebug("hostset: \"%s\"", dup);
#endif
*hspp = hsp;
error = 0;
}
if (error)
free(dup);
} /* "dup" set */
if (error)
regfree(regexp);
free(regexp);
} /* "regexp" set */
return error;
}
static int
decodeSelection(
feedtypet* const ftp,
regex_t** const regexpp,
const char* const ftString,
const char* const regexString)
{
feedtypet ft;
int error;
error = decodeFeedtype(&ft, ftString);
if (!error) {
error = decodeRegEx(regexpp, regexString);
if (!error) {
#if YYDEBUG
if(yydebug)
udebug("prodIdPat: \"%s\"", regexString);
#endif
*ftp = ft;
}
} /* feedtype decoded */
return error;
}
static void
warnIfPathological(
const char* const re)
{
if (re_isPathological(re)) {
/*
* Pathological regular expression.
*/
err_log_and_free(
ERR_NEW3(0, NULL,
"Pathological regular expression \"%s\" "
"near line %d, file \"%s\"",
re, line, scannerGetPath()),
ERR_WARNING);
}
}
/*
* Arguments:
* feedtypeSpec String specification of feedtype. May not be NULL.
* Caller may free upon return.
* hostPattern ERE of allowed hosts. May not be NULL. Caller may
* free upon return.
* okPattern ERE that product-identifiers must match in order for
* the associated data-products to be transferred. Caller
* may free upon return.
* notPattern ERE that product-identifiers must NOT match in order for
* the associated data-products to be transferred. May
* be null to indicate that such matching should be
* disabled. Caller may free upon return.
* Returns:
* 0 Success.
* else Failure.
*/
static int
decodeAllowEntry(
const char* const feedtypeSpec,
const char* const hostPattern,
const char* const okPattern,
const char* const notPattern)
{
feedtypet ft;
int errCode = decodeFeedtype(&ft, feedtypeSpec);
if (!errCode) {
host_set* hsp;
errCode = decodeHostSet(&hsp, hostPattern);
if (!errCode) {
ErrorObj* errObj;
warnIfPathological(okPattern);
if (notPattern)
warnIfPathological(notPattern);
errObj = acl_addAllow(ft, hsp, okPattern, notPattern);
if (errObj) {
err_log_and_free(
ERR_NEW2(0, errObj,
"Couldn't add ALLOW entry near line %d, file \"%s\"",
line, scannerGetPath()),
ERR_FAILURE);
errCode = -1;
}
if (errCode)
free_host_set(hsp);
} /* "hsp" allocated */
} /* "ft" set */
return errCode;
}
static int
decodeRequestEntry(
const char* const feedtypeSpec,
const char* const prodPattern,
char* const hostSpec)
{
feedtypet ft;
regex_t* regexp;
int errCode =
decodeSelection(&ft, ®exp, feedtypeSpec, prodPattern);
if (!errCode) {
RequestEntry* entry;
if (errCode = requestEntry_get(&entry, ft, prodPattern, regexp)) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Couldn't get request-entry near line %d, file \"%s\": %s",
line, scannerGetPath(), strerror(errCode)),
ERR_FAILURE);
}
else {
const char* hostId = strtok(hostSpec, ":");
if (NULL == hostId) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Invalid hostname specification \"%s\" near "
"line %d, file \"%s\"",
hostSpec, line, scannerGetPath()),
ERR_FAILURE);
errCode = EINVAL;
}
else {
unsigned localPort;
const char* portSpec = strtok(NULL, ":");
if (NULL == portSpec) {
localPort = ldmPort;
}
else {
char* suffix = "";
long port;
errno = 0;
port = strtol(portSpec, &suffix, 0);
if (0 == errno && 0 == *suffix &&
0 < port && 0xffff >= port) {
localPort = (unsigned)port;
}
else {
err_log_and_free(
ERR_NEW3(0, NULL,
"Invalid port specification \"%s\" near "
"line %d, file \"%s\"",
portSpec, line, scannerGetPath()),
ERR_FAILURE);
errCode = EINVAL;
}
} /* have port specification */
if (0 == errCode) {
if ((errCode =
requestEntry_addHost(entry, hostId, localPort))) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Couldn't add host to request-entry near "
"line %d, file \"%s\": %s",
line, scannerGetPath(), strerror(errCode)),
ERR_FAILURE);
}
} /* "localPort" set */
} /* valid hostname */
} /* got request "entry" */
if (errCode)
regfree(regexp);
free(regexp);
} /* "ft" & "regexp" set */
return errCode;
}
#if YYDEBUG
#define printf udebug
#endif
#ifdef __hpux
/* otherwise, they define it to 'int' in spite of the union typedef */
#define YYSTYPE YYSTYPE
#endif
#line 421 "parser.y"
typedef union {
char string[2000];
} YYSTYPE;
#line 441 "y.tab.c"
#define ALLOW_K 257
#define ACCEPT_K 258
#define REQUEST_K 259
#define EXEC_K 260
#define INCLUDE_K 261
#define STRING 262
#define YYERRCODE 256
short yylhs[] = { -1,
0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
3, 4, 4, 5, 6,
};
short yylen[] = { 2,
0, 2, 1, 1, 1, 1, 1, 3, 4, 5,
4, 4, 5, 2, 2,
};
short yydefred[] = { 1,
0, 0, 0, 0, 0, 0, 2, 3, 4, 5,
6, 7, 0, 0, 0, 14, 15, 0, 0, 0,
0, 11, 0, 10, 13,
};
short yydgoto[] = { 1,
7, 8, 9, 10, 11, 12,
};
short yysindex[] = { 0,
-245, -262, -260, -259, -258, -257, 0, 0, 0, 0,
0, 0, -255, -254, -253, 0, 0, -252, -244, -243,
-242, 0, -241, 0, 0,
};
short yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
6, 0, 11, 0, 0,
};
short yygindex[] = { 0,
0, 0, 0, 0, 0, 0,
};
#define YYTABLESIZE 272
short yytable[] = { 13,
8, 14, 15, 16, 17, 9, 18, 19, 20, 21,
12, 2, 3, 4, 5, 6, 0, 22, 23, 24,
25, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 8, 8, 8,
8, 8, 9, 9, 9, 9, 9, 12, 12, 12,
12, 12,
};
short yycheck[] = { 262,
0, 262, 262, 262, 262, 0, 262, 262, 262, 262,
0, 257, 258, 259, 260, 261, -1, 262, 262, 262,
262, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 257, 258, 259,
260, 261, 257, 258, 259, 260, 261, 257, 258, 259,
260, 261,
};
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 262
#if YYDEBUG
char *yyname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"ALLOW_K","ACCEPT_K","REQUEST_K",
"EXEC_K","INCLUDE_K","STRING",
};
char *yyrule[] = {
"$accept : table",
"table :",
"table : table entry",
"entry : allow_entry",
"entry : accept_entry",
"entry : request_entry",
"entry : exec_entry",
"entry : include_stmt",
"allow_entry : ALLOW_K STRING STRING",
"allow_entry : ALLOW_K STRING STRING STRING",
"allow_entry : ALLOW_K STRING STRING STRING STRING",
"accept_entry : ACCEPT_K STRING STRING STRING",
"request_entry : REQUEST_K STRING STRING STRING",
"request_entry : REQUEST_K STRING STRING STRING STRING",
"exec_entry : EXEC_K STRING",
"include_stmt : INCLUDE_K STRING",
};
#endif
#if YYDEBUG
#include <stdio.h>
#endif
/* define the initial stack-sizes */
#ifdef YYSTACKSIZE
#undef YYMAXDEPTH
#define YYMAXDEPTH YYSTACKSIZE
#else
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 500
#define YYMAXDEPTH 500
#endif
#endif
#define YYINITSTACKSIZE 500
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
/* variables for the parser stack */
static short *yyss;
static short *yysslim;
static YYSTYPE *yyvs;
static int yystacksize;
#line 594 "parser.y"
#include "scanner.c"
/*
* Returns:
* 0 More input
* !0 No more input
*/
int
yywrap(void)
{
return scannerPop();
}
/*
* Arguments:
* conf_path Pathname of configuration-file.
* doSomething Whether or not to actually do something or just
* parse the configuration-file.
* defaultPort The default LDM port.
* Returns:
* 0 Success.
* !0 Failure.
*/
int
read_conf(
const char* const conf_path,
int doSomething,
unsigned defaultPort)
{
int status = -1; /* failure */
if (scannerPush(conf_path)) {
log_add("Couldn't open LDM configuration-file");
}
else {
/* yydebug = 1; */
ldmPort = defaultPort;
execute = doSomething;
status = yyparse();
if (status != 0) {
udebug("yyparse returns %d", status);
}
else {
if (doSomething) {
status = invert_request_acl(defaultPort);
if (status != 0) {
log_errno();
log_add("Problem requesting data");
}
}
}
}
return status;
}
#line 666 "y.tab.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack(void)
{
int newsize, i;
short *newss;
YYSTYPE *newvs;
if ((newsize = yystacksize) == 0)
newsize = YYINITSTACKSIZE;
else if (newsize >= YYMAXDEPTH)
return -1;
else if ((newsize *= 2) > YYMAXDEPTH)
newsize = YYMAXDEPTH;
i = yyssp - yyss;
newss = (yyss != 0)
? (short *)realloc(yyss, newsize * sizeof(*newss))
: (short *)malloc(newsize * sizeof(*newss));
if (newss == 0)
return -1;
yyss = newss;
yyssp = newss + i;
newvs = (yyvs != 0)
? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
: (YYSTYPE *)malloc(newsize * sizeof(*newvs));
if (newvs == 0)
return -1;
yyvs = newvs;
yyvsp = newvs + i;
yystacksize = newsize;
yysslim = yyss + newsize - 1;
return 0;
}
#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
yyparse(void)
{
register int yym, yyn, yystate;
#if YYDEBUG
register const char *yys;
if ((yys = getenv("YYDEBUG")) != 0)
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
yynerrs = 0;
yyerrflag = 0;
yychar = YYEMPTY;
if (yyss == NULL && yygrowstack()) goto yyoverflow;
yyssp = yyss;
yyvsp = yyvs;
*yyssp = yystate = 0;
yyloop:
if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
}
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, shifting to state %d\n",
YYPREFIX, yystate, yytable[yyn]);
#endif
if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
yychar = YYEMPTY;
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
yyn = yytable[yyn];
goto yyreduce;
}
if (yyerrflag) goto yyinrecovery;
yyerror("syntax error");
#ifdef lint
goto yyerrlab;
#endif
yyerrlab:
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
{
yyerrflag = 3;
for (;;)
{
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, error recovery shifting\
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
goto yyloop;
}
else
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: error recovery discarding state %d\n",
YYPREFIX, *yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
--yyvsp;
}
}
}
else
{
if (yychar == 0) goto yyabort;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
YYPREFIX, yystate, yychar, yys);
}
#endif
yychar = YYEMPTY;
goto yyloop;
}
yyreduce:
#if YYDEBUG
if (yydebug)
printf("%sdebug: state %d, reducing by rule %d (%s)\n",
YYPREFIX, yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
if (yym)
yyval = yyvsp[1-yym];
else
memset(&yyval, 0, sizeof yyval);
switch (yyn)
{
case 8:
#line 449 "parser.y"
{
int errCode = decodeAllowEntry(yyvsp[-1].string,
yyvsp[0].string, ".*", NULL);
if (errCode)
return errCode;
}
break;
case 9:
#line 456 "parser.y"
{
int errCode = decodeAllowEntry(yyvsp[-2].string,
yyvsp[-1].string, yyvsp[0].string, NULL);
if (errCode)
return errCode;
}
break;
case 10:
#line 463 "parser.y"
{
int errCode = decodeAllowEntry(yyvsp[-3].string,
yyvsp[-2].string, yyvsp[-1].string, yyvsp[0].string);
if (errCode)
return errCode;
}
break;
case 11:
#line 472 "parser.y"
{
feedtypet ft;
regex_t* regexp;
int error = decodeSelection(&ft, ®exp,
yyvsp[-2].string, yyvsp[-1].string);
if (!error) {
host_set* hsp;
error = decodeHostSet(&hsp, yyvsp[0].string);
if (!error) {
char* patp = strdup(yyvsp[-1].string);
if (NULL == patp) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Couldn't clone string \"%s\" "
"near line %d, file \"%s\": %s",
yyvsp[-1].string, scannerGetPath(),
strerror(errno)),
ERR_FAILURE);
error = 1;
}
else {
error =
accept_acl_add(ft, patp, regexp, hsp, 1);
if (error) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Couldn't add ACCEPT entry "
"near line %d, file \"%s\": %s",
line, scannerGetPath(),
strerror(error)),
ERR_FAILURE);
}
if (error)
free(patp);
} /* "patp" set */
if (error)
free_host_set(hsp);
} /* "*hsp" set */
if (error)
regfree(regexp);
free(regexp);
} /* "ft" & "regexp" set */
if (error)
return error;
}
break;
case 12:
#line 529 "parser.y"
{
int errCode = decodeRequestEntry(yyvsp[-2].string,
yyvsp[-1].string, yyvsp[0].string);
if (errCode)
return errCode;
}
break;
case 13:
#line 536 "parser.y"
{
int errCode = decodeRequestEntry(yyvsp[-3].string,
yyvsp[-2].string, yyvsp[-1].string);
if (errCode)
return errCode;
}
break;
case 14:
#line 545 "parser.y"
{
wordexp_t words;
int error;
(void)memset(&words, 0, sizeof(words));
error = wordexp(yyvsp[0].string, &words, 0);
if (error) {
err_log_and_free(
ERR_NEW4(0, NULL,
"Couldn't decode command \"%s\" near "
" line %d, file \"%s\": %s",
yyvsp[0].string, line, scannerGetPath(),
strerror(errno)),
ERR_FAILURE);
}
else {
#if YYDEBUG
if(yydebug)
udebug("command: \"%s\"", yyvsp[0].string);
#endif
if (execute) {
error = exec_add(&words);
if (error) {
err_log_and_free(
ERR_NEW3(0, NULL,
"Couldn't add EXEC entry near "
" line %d, file \"%s\": %s",
line, scannerGetPath(),
strerror(errno)),
ERR_FAILURE);
wordfree(&words);
}
}
} /* "words" set */
if (error)
return error;
}
break;
case 15:
#line 588 "parser.y"
{
if (scannerPush(yyvsp[0].string))
return -1;
}
break;
#line 999 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state 0 to\
state %d\n", YYPREFIX, YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
*++yyvsp = yyval;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("%sdebug: state %d, reading %d (%s)\n",
YYPREFIX, YYFINAL, yychar, yys);
}
#endif
}
if (yychar == 0) goto yyaccept;
goto yyloop;
}
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#if YYDEBUG
if (yydebug)
printf("%sdebug: after reduction, shifting from state %d \
to state %d\n", YYPREFIX, *yyssp, yystate);
#endif
if (yyssp >= yysslim && yygrowstack())
{
goto yyoverflow;
}
*++yyssp = yystate;
*++yyvsp = yyval;
goto yyloop;
yyoverflow:
yyerror("yacc stack overflow");
yyabort:
return (1);
yyaccept:
return (0);
}