#include <config.h>
/* A Bison parser, made from p.y
by GNU bison 1.35. */
#define YYBISON 1 /* Identify Bison output. */
# define IF 257
# define ELSE 258
# define THEN 259
# define OR 260
# define FAILED 261
# define SET 262
# define LOGFILE 263
# define FACILITY 264
# define DAEMON 265
# define SYSLOG 266
# define MAILSERVER 267
# define HTTPD 268
# define ALLOW 269
# define ADDRESS 270
# define INIT 271
# define READONLY 272
# define CLEARTEXT 273
# define MD5HASH 274
# define SHA1HASH 275
# define CRYPT 276
# define PEMFILE 277
# define ENABLE 278
# define DISABLE 279
# define HTTPDSSL 280
# define CLIENTPEMFILE 281
# define ALLOWSELFCERTIFICATION 282
# define STATEFILE 283
# define SEND 284
# define EXPECT 285
# define CYCLE 286
# define COUNT 287
# define REMINDER 288
# define PIDFILE 289
# define START 290
# define STOP 291
# define PATHTOK 292
# define HOST 293
# define PORT 294
# define TYPE 295
# define UDP 296
# define TCP 297
# define TCPSSL 298
# define PROTOCOL 299
# define CONNECTION 300
# define ALERT 301
# define NOALERT 302
# define MAILFORMAT 303
# define UNIXSOCKET 304
# define SIGNATURE 305
# define TIMEOUT 306
# define RESTART 307
# define CHECKSUM 308
# define EVERY 309
# define DEFAULT 310
# define HTTP 311
# define APACHESTATUS 312
# define FTP 313
# define SMTP 314
# define POP 315
# define IMAP 316
# define CLAMAV 317
# define NNTP 318
# define NTP3 319
# define MYSQL 320
# define DNS 321
# define SSH 322
# define DWP 323
# define LDAP2 324
# define LDAP3 325
# define RDATE 326
# define RSYNC 327
# define TNS 328
# define PGSQL 329
# define POSTFIXPOLICY 330
# define STRING 331
# define PATH 332
# define MAILADDR 333
# define MAILFROM 334
# define MAILSUBJECT 335
# define MAILBODY 336
# define SERVICENAME 337
# define STRINGNAME 338
# define NUMBER 339
# define PERCENT 340
# define LOGLIMIT 341
# define CLOSELIMIT 342
# define DNSLIMIT 343
# define KEEPALIVELIMIT 344
# define REPLYLIMIT 345
# define REQUESTLIMIT 346
# define STARTLIMIT 347
# define WAITLIMIT 348
# define GRACEFULLIMIT 349
# define CLEANUPLIMIT 350
# define REAL 351
# define CHECKPROC 352
# define CHECKDEV 353
# define CHECKFILE 354
# define CHECKDIR 355
# define CHECKHOST 356
# define CHECKSYSTEM 357
# define CHECKFIFO 358
# define CHILDREN 359
# define SYSTEM 360
# define RESOURCE 361
# define MEMORY 362
# define TOTALMEMORY 363
# define LOADAVG1 364
# define LOADAVG5 365
# define LOADAVG15 366
# define MODE 367
# define ACTIVE 368
# define PASSIVE 369
# define MANUAL 370
# define CPU 371
# define CPUUSER 372
# define CPUSYSTEM 373
# define CPUWAIT 374
# define GROUP 375
# define REQUEST 376
# define DEPENDS 377
# define BASEDIR 378
# define SLOT 379
# define EVENTQUEUE 380
# define UID 381
# define GID 382
# define COLLECTOR 383
# define INSTANCE 384
# define USERNAME 385
# define PASSWORD 386
# define TIMESTAMP 387
# define CHANGED 388
# define SECOND 389
# define MINUTE 390
# define HOUR 391
# define DAY 392
# define SSLAUTO 393
# define SSLV2 394
# define SSLV3 395
# define TLSV1 396
# define CERTMD5 397
# define BYTE 398
# define KILOBYTE 399
# define MEGABYTE 400
# define GIGABYTE 401
# define INODE 402
# define SPACE 403
# define PERMISSION 404
# define SIZE 405
# define MATCH 406
# define NOT 407
# define IGNORE 408
# define EXEC 409
# define UNMONITOR 410
# define ICMP 411
# define ICMPECHO 412
# define NONEXIST 413
# define INVALID 414
# define DATA 415
# define RECOVERED 416
# define PASSED 417
# define URL 418
# define CONTENT 419
# define PID 420
# define PPID 421
# define FSFLAG 422
# define URLOBJECT 423
# define GREATER 424
# define LESS 425
# define EQUAL 426
# define NOTEQUAL 427
#line 20 "p.y"
/*
* DESCRIPTION
* Simple context-free grammar for parsing the control file.
*
* @author Jan-Henrik Haukeland, <hauk@tildeslash.com>
* @author Olivier Beyssac, <ob@r14.freenix.org>
* @author Kianusch Sayah Karadji <kianusch.sayah.karadji@sk-tech.net>
* @author Martin Pala <martinp@tildeslash.com>
* @author Christian Hopp <chopp@iei.tu-clausthal.de>
* @author Rory Toma <rory@digeo.com>
* @version \$Id: p.y,v 1.261 2007/10/17 11:09:55 hauk Exp $
*/
#include <config.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_ASM_PARAM_H
#include <asm/param.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#ifndef HAVE_SOL_IP
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#endif
#ifdef HAVE_NETINET_IP_ICMP_H
#include <netinet/ip_icmp.h>
#endif
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
#include "net.h"
#include "monitor.h"
#include "protocol.h"
#include "engine.h"
#include "alert.h"
#include "process.h"
#include "ssl.h"
#include "device.h"
/* ------------------------------------------------------------- Definitions */
struct IHavePrecedence {
int daemon;
int logfile;
int pidfile;
};
struct myrate {
unsigned count;
unsigned cycles;
};
/* yacc interface */
void yyerror(const char *,...);
void yyerror2(const char *,...);
void yywarning(const char *,...);
void yywarning2(const char *,...);
/* lexer interface */
int yylex(void);
extern FILE *yyin;
extern int lineno;
extern int arglineno;
extern char *yytext;
extern char *argyytext;
extern char *currentfile;
extern char *argcurrentfile;
extern int buffer_stack_ptr;
/* Local variables */
static int cfg_errflag= FALSE;
static Service_T tail= NULL;
static Service_T current= NULL;
static unsigned int eventset;
static Request_T urlrequest= NULL;
static Command_T command= NULL;
static Command_T command1= NULL;
static Command_T command2= NULL;
static Service_T depend_list= NULL;
static struct mygid gidset;
static struct myuid uidset;
static struct myperm permset;
static struct mysize sizeset;
static struct mymatch matchset;
static struct myicmp icmpset;
static struct mymail mailset;
static struct myport portset;
static struct mymailserver mailserverset;
static struct mydevice deviceset;
static struct myresource resourceset;
static struct mychecksum checksumset;
static struct mytimestamp timestampset;
static struct IHavePrecedence ihp= {FALSE, FALSE, FALSE};
static struct myrate rate1 = {1, 1};
static struct myrate rate2 = {1, 1};
static char * htpasswd_file= NULL;
static int digesttype= DIGEST_CLEARTEXT;
static int hassystem = FALSE;
#define BITMAP_MAX (sizeof(long long) * 8)
/* -------------------------------------------------------------- Prototypes */
static void preparse();
static void postparse();
static void addservice(Service_T);
static void addmail(char *, Mail_T, Mail_T *, unsigned int, unsigned int);
static void createservice(int, char *, char *, int (*)(Service_T));
static void adddependant(char *);
static void addport(Port_T);
static void addresource(Resource_T);
static void addtimestamp(Timestamp_T, int);
static void addsize(Size_T, int);
static void adddevice(Device_T);
static void addicmp(Icmp_T);
static void *addprotocol(int);
static void addgeneric(Port_T, char*, char*);
static void addcommand(int);
static void addargument(char *);
static void addcollector(URL_T, int, int, char *);
static void addmailserver(MailServer_T);
static int addcredentials(char *, char *, int, int);
static void addhtpasswdentry(char *, char *, int);
static uid_t get_uid(char *, uid_t);
static gid_t get_gid(char *, gid_t);
static void addchecksum(Checksum_T);
static void addperm(Perm_T);
static void addmatch(Match_T, int, int);
static void addmatchpath(Match_T, int);
static void adduid(Uid_T);
static void addgid(Gid_T);
static void addeuid(uid_t);
static void addegid(gid_t);
static void addeventaction(EventAction_T *, int, int);
static void seteventaction(EventAction_T *, int, int);
static void prepare_urlrequest(URL_T U);
static void seturlrequest(int, char *);
static void setlogfile(char *);
static void setpidfile(char *);
static void reset_mailset();
static void reset_mailserverset();
static void reset_portset();
static void reset_resourceset();
static void reset_timestampset();
static void reset_sizeset();
static void reset_checksumset();
static void reset_permset();
static void reset_uidset();
static void reset_gidset();
static void reset_deviceset();
static void reset_icmpset();
static void reset_rateset();
static void check_name(char *);
static void check_timeout(int, int);
static void check_every(int);
static int check_perm(int);
static void check_hostname (char *);
static void check_exec(char *);
static int cleanup_hash_string(char *);
static void check_depend();
static void setsyslog(char *);
static void describeAction(Action_T);
static Command_T copycommand(Command_T);
#line 241 "p.y"
#ifndef YYSTYPE
typedef union {
URL_T url;
float real;
int number;
char *string;
} yystype;
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#define YYFINAL 747
#define YYFLAG -32768
#define YYNTBASE 177
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 427 ? yytranslate[x] : 317)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const short yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 176, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 174, 2, 175, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
166, 167, 168, 169, 170, 171, 172, 173
};
#if YYDEBUG
static const short yyprhs[] =
{
0, 0, 1, 3, 5, 8, 10, 12, 14, 16,
18, 20, 22, 24, 26, 28, 30, 33, 36, 39,
42, 45, 48, 51, 52, 55, 57, 59, 61, 63,
65, 67, 69, 71, 73, 75, 77, 79, 81, 82,
85, 87, 89, 91, 93, 95, 97, 99, 101, 103,
105, 107, 109, 111, 113, 115, 116, 119, 121, 123,
125, 127, 129, 131, 133, 135, 137, 139, 141, 143,
145, 147, 148, 151, 153, 155, 157, 159, 161, 163,
165, 167, 169, 171, 173, 175, 177, 180, 182, 184,
186, 188, 190, 192, 194, 196, 198, 200, 201, 204,
206, 208, 210, 212, 214, 216, 217, 220, 222, 224,
226, 228, 230, 232, 234, 236, 238, 240, 242, 244,
252, 257, 266, 270, 273, 277, 281, 287, 292, 299,
304, 308, 312, 316, 318, 321, 326, 331, 337, 343,
345, 348, 354, 362, 363, 366, 368, 370, 372, 374,
376, 381, 383, 386, 389, 392, 395, 399, 403, 406,
408, 410, 413, 416, 419, 422, 425, 428, 429, 432,
433, 435, 441, 444, 448, 452, 456, 457, 462, 463,
469, 470, 476, 477, 483, 486, 488, 491, 493, 494,
496, 501, 506, 511, 516, 521, 526, 529, 534, 537,
541, 544, 548, 550, 553, 555, 558, 560, 562, 565,
568, 571, 574, 575, 578, 579, 582, 594, 605, 616,
627, 628, 631, 634, 637, 638, 641, 646, 649, 650,
653, 654, 656, 658, 660, 662, 663, 667, 670, 673,
676, 679, 683, 686, 689, 692, 695, 698, 701, 704,
707, 710, 713, 716, 719, 722, 725, 728, 730, 732,
735, 738, 741, 742, 745, 750, 752, 756, 761, 766,
771, 776, 781, 786, 791, 796, 801, 806, 813, 820,
821, 824, 825, 829, 837, 838, 842, 844, 846, 853,
857, 865, 867, 870, 873, 875, 878, 880, 882, 884,
886, 888, 890, 892, 894, 896, 898, 900, 902, 904,
906, 908, 910, 912, 914, 916, 918, 920, 921, 926,
928, 931, 933, 935, 937, 941, 944, 947, 950, 953,
956, 958, 961, 963, 970, 972, 975, 977, 979, 981,
983, 990, 992, 995, 997, 999, 1001, 1006, 1011, 1013,
1015, 1017, 1022, 1027, 1032, 1037, 1041, 1045, 1047, 1049,
1051, 1053, 1055, 1065, 1072, 1073, 1075, 1077, 1079, 1081,
1083, 1084, 1086, 1088, 1090, 1092, 1094, 1097, 1101, 1103,
1105, 1107, 1109, 1111, 1113, 1114, 1117, 1121, 1122, 1125,
1129, 1130, 1137, 1144, 1153, 1164, 1172, 1173, 1175, 1177,
1186, 1196, 1206, 1216, 1223, 1225, 1227, 1229, 1231, 1240,
1248, 1256, 1261, 1266, 1267, 1269, 1279, 1286, 1295, 1304,
1313, 1322, 1325, 1326, 1329
};
static const short yyrhs[] =
{
-1, 178, 0, 179, 0, 178, 179, 0, 194, 0,
195, 0, 197, 0, 198, 0, 201, 0, 204, 0,
205, 0, 206, 0, 200, 0, 199, 0, 196, 0,
229, 180, 0, 230, 182, 0, 231, 184, 0, 232,
186, 0, 233, 188, 0, 234, 190, 0, 235, 192,
0, 0, 180, 181, 0, 236, 0, 237, 0, 259,
0, 260, 0, 244, 0, 245, 0, 263, 0, 266,
0, 274, 0, 275, 0, 276, 0, 277, 0, 280,
0, 0, 182, 183, 0, 236, 0, 237, 0, 294,
0, 263, 0, 274, 0, 266, 0, 309, 0, 313,
0, 314, 0, 303, 0, 312, 0, 310, 0, 275,
0, 276, 0, 277, 0, 0, 184, 185, 0, 236,
0, 237, 0, 263, 0, 274, 0, 266, 0, 309,
0, 313, 0, 314, 0, 275, 0, 276, 0, 277,
0, 305, 0, 306, 0, 307, 0, 0, 186, 187,
0, 236, 0, 237, 0, 294, 0, 263, 0, 274,
0, 266, 0, 309, 0, 313, 0, 314, 0, 275,
0, 276, 0, 277, 0, 189, 0, 188, 189, 0,
236, 0, 237, 0, 244, 0, 246, 0, 263, 0,
266, 0, 274, 0, 275, 0, 276, 0, 277, 0,
0, 190, 191, 0, 263, 0, 266, 0, 274, 0,
276, 0, 277, 0, 283, 0, 0, 192, 193, 0,
236, 0, 237, 0, 294, 0, 263, 0, 274, 0,
266, 0, 309, 0, 313, 0, 314, 0, 275, 0,
276, 0, 277, 0, 8, 267, 174, 269, 175, 271,
316, 0, 8, 267, 271, 316, 0, 8, 267, 153,
174, 269, 175, 271, 316, 0, 8, 11, 85, 0,
8, 17, 0, 8, 9, 78, 0, 8, 9, 12,
0, 8, 9, 12, 10, 77, 0, 8, 126, 124,
78, 0, 8, 126, 124, 78, 125, 85, 0, 8,
126, 125, 85, 0, 8, 29, 78, 0, 8, 35,
78, 0, 8, 129, 202, 0, 203, 0, 202, 203,
0, 169, 262, 252, 251, 0, 8, 13, 207, 262,
0, 8, 49, 174, 272, 175, 0, 8, 14, 40,
85, 209, 0, 208, 0, 207, 208, 0, 77, 242,
243, 252, 251, 0, 77, 40, 85, 242, 243, 252,
251, 0, 0, 209, 210, 0, 211, 0, 214, 0,
217, 0, 221, 0, 213, 0, 212, 218, 219, 220,
0, 26, 0, 26, 24, 0, 24, 26, 0, 26,
25, 0, 25, 26, 0, 213, 23, 78, 0, 213,
27, 78, 0, 213, 28, 0, 215, 0, 216, 0,
51, 24, 0, 24, 51, 0, 51, 25, 0, 25,
51, 0, 16, 77, 0, 23, 78, 0, 0, 27,
78, 0, 0, 28, 0, 15, 77, 176, 77, 228,
0, 15, 78, 0, 15, 19, 78, 0, 15, 20,
78, 0, 15, 22, 78, 0, 0, 15, 78, 222,
226, 0, 0, 15, 19, 78, 223, 226, 0, 0,
15, 20, 78, 224, 226, 0, 0, 15, 22, 78,
225, 226, 0, 15, 77, 0, 227, 0, 226, 227,
0, 77, 0, 0, 18, 0, 98, 83, 35, 78,
0, 98, 83, 38, 78, 0, 100, 83, 38, 78,
0, 99, 83, 38, 78, 0, 101, 83, 38, 78,
0, 102, 83, 16, 77, 0, 103, 83, 0, 104,
83, 38, 78, 0, 36, 238, 0, 36, 238, 239,
0, 37, 238, 0, 37, 238, 239, 0, 240, 0,
238, 240, 0, 241, 0, 239, 241, 0, 77, 0,
78, 0, 127, 77, 0, 128, 77, 0, 127, 85,
0, 128, 85, 0, 0, 131, 77, 0, 0, 132,
77, 0, 3, 7, 247, 248, 250, 253, 262, 300,
5, 298, 302, 0, 3, 7, 164, 169, 264, 262,
300, 5, 298, 302, 0, 3, 7, 249, 250, 253,
262, 300, 5, 298, 302, 0, 3, 7, 157, 315,
261, 262, 300, 5, 298, 302, 0, 0, 39, 77,
0, 40, 85, 0, 50, 78, 0, 0, 41, 43,
0, 41, 44, 252, 251, 0, 41, 42, 0, 0,
143, 77, 0, 0, 140, 0, 141, 0, 142, 0,
139, 0, 0, 45, 58, 257, 0, 45, 56, 0,
45, 67, 0, 45, 69, 0, 45, 59, 0, 45,
57, 256, 0, 45, 62, 0, 45, 63, 0, 45,
70, 0, 45, 71, 0, 45, 66, 0, 45, 64,
0, 45, 65, 0, 45, 76, 0, 45, 61, 0,
45, 60, 0, 45, 68, 0, 45, 72, 0, 45,
73, 0, 45, 74, 0, 45, 75, 0, 254, 0,
255, 0, 254, 255, 0, 30, 77, 0, 31, 77,
0, 0, 122, 78, 0, 122, 78, 54, 77, 0,
258, 0, 257, 6, 258, 0, 87, 295, 85, 86,
0, 88, 295, 85, 86, 0, 89, 295, 85, 86,
0, 90, 295, 85, 86, 0, 91, 295, 85, 86,
0, 92, 295, 85, 86, 0, 93, 295, 85, 86,
0, 94, 295, 85, 86, 0, 95, 295, 85, 86,
0, 96, 295, 85, 86, 0, 3, 134, 166, 300,
5, 298, 0, 3, 134, 167, 300, 5, 298, 0,
0, 33, 85, 0, 0, 52, 85, 135, 0, 3,
85, 53, 85, 32, 5, 52, 0, 0, 165, 265,
77, 0, 172, 0, 173, 0, 267, 174, 269, 175,
271, 316, 0, 267, 271, 316, 0, 267, 153, 174,
269, 175, 271, 316, 0, 268, 0, 47, 79, 0,
48, 79, 0, 270, 0, 269, 270, 0, 134, 0,
54, 0, 46, 0, 161, 0, 155, 0, 128, 0,
157, 0, 130, 0, 160, 0, 152, 0, 159, 0,
150, 0, 107, 0, 151, 0, 52, 0, 133, 0,
127, 0, 36, 0, 37, 0, 53, 0, 156, 0,
0, 49, 174, 272, 175, 0, 273, 0, 272, 273,
0, 80, 0, 81, 0, 82, 0, 55, 85, 32,
0, 113, 114, 0, 113, 115, 0, 113, 116, 0,
121, 84, 0, 123, 278, 0, 279, 0, 278, 279,
0, 83, 0, 3, 281, 300, 5, 298, 302, 0,
282, 0, 281, 282, 0, 286, 0, 289, 0, 290,
0, 291, 0, 3, 284, 300, 5, 298, 302, 0,
285, 0, 284, 285, 0, 291, 0, 289, 0, 287,
0, 117, 295, 85, 86, 0, 288, 295, 85, 86,
0, 118, 0, 119, 0, 120, 0, 108, 295, 293,
308, 0, 108, 295, 85, 86, 0, 109, 295, 293,
308, 0, 109, 295, 85, 86, 0, 105, 295, 85,
0, 292, 295, 293, 0, 110, 0, 111, 0, 112,
0, 97, 0, 85, 0, 3, 133, 295, 85, 296,
300, 5, 298, 302, 0, 3, 134, 133, 300, 5,
298, 0, 0, 170, 0, 171, 0, 172, 0, 173,
0, 134, 0, 0, 135, 0, 136, 0, 137, 0,
138, 0, 47, 0, 155, 238, 0, 155, 238, 239,
0, 53, 0, 36, 0, 37, 0, 156, 0, 297,
0, 297, 0, 0, 85, 32, 0, 85, 85, 32,
0, 0, 85, 32, 0, 85, 85, 32, 0, 0,
4, 3, 162, 301, 5, 299, 0, 4, 3, 163,
301, 5, 299, 0, 3, 7, 304, 54, 300, 5,
298, 302, 0, 3, 7, 304, 54, 31, 77, 300,
5, 298, 302, 0, 3, 134, 304, 54, 300, 5,
298, 0, 0, 20, 0, 21, 0, 3, 148, 295,
85, 300, 5, 298, 302, 0, 3, 148, 295, 85,
86, 300, 5, 298, 302, 0, 3, 149, 295, 293,
308, 300, 5, 298, 302, 0, 3, 149, 295, 85,
86, 300, 5, 298, 302, 0, 3, 134, 168, 300,
5, 298, 0, 144, 0, 145, 0, 146, 0, 147,
0, 3, 7, 150, 85, 300, 5, 298, 302, 0,
3, 311, 152, 78, 300, 5, 298, 0, 3, 311,
152, 77, 300, 5, 298, 0, 154, 311, 152, 78,
0, 154, 311, 152, 77, 0, 0, 153, 0, 3,
151, 295, 85, 308, 300, 5, 298, 302, 0, 3,
134, 151, 300, 5, 298, 0, 3, 7, 127, 77,
300, 5, 298, 302, 0, 3, 7, 127, 85, 300,
5, 298, 302, 0, 3, 7, 128, 77, 300, 5,
298, 302, 0, 3, 7, 128, 85, 300, 5, 298,
302, 0, 41, 158, 0, 0, 34, 85, 0, 34,
85, 32, 0
};
#endif
#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
0, 283, 284, 287, 288, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
306, 307, 308, 311, 312, 315, 316, 317, 318, 319,
320, 321, 322, 323, 324, 325, 326, 327, 330, 331,
334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
344, 345, 346, 347, 348, 351, 352, 355, 356, 357,
358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
368, 371, 372, 375, 376, 377, 378, 379, 380, 381,
382, 383, 384, 385, 386, 389, 390, 393, 394, 395,
396, 397, 398, 399, 400, 401, 402, 405, 406, 409,
410, 411, 412, 413, 414, 417, 418, 421, 422, 423,
424, 425, 426, 427, 428, 429, 430, 431, 432, 435,
438, 441, 446, 455, 460, 468, 471, 476, 479, 483,
489, 494, 502, 505, 506, 509, 515, 520, 537, 543,
544, 547, 566, 585, 586, 589, 590, 591, 592, 595,
596, 604, 605, 606, 609, 610, 611, 612, 613, 616,
617, 620, 621, 624, 625, 628, 631, 640, 641, 651,
655, 661, 664, 668, 672, 676, 680, 680, 687, 687,
694, 694, 701, 701, 708, 716, 717, 720, 724, 725,
728, 732, 738, 744, 750, 757, 764, 772, 778, 779,
782, 783, 786, 787, 790, 791, 794, 795, 798, 799,
800, 801, 804, 805, 808, 809, 812, 818, 827, 835,
845, 851, 854, 857, 862, 865, 868, 876, 881, 882,
885, 886, 887, 888, 889, 892, 895, 898, 901, 904,
907, 910, 913, 916, 919, 922, 925, 928, 931, 935,
938, 941, 944, 947, 950, 953, 956, 959, 964, 965,
968, 969, 972, 973, 977, 983, 984, 987, 991, 995,
999, 1003, 1007, 1011, 1015, 1019, 1023, 1029, 1035, 1041,
1044, 1049, 1052, 1057, 1065, 1066, 1072, 1073, 1076, 1079,
1082, 1085, 1090, 1093, 1096, 1097, 1100, 1101, 1102, 1103,
1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113,
1114, 1115, 1116, 1119, 1120, 1121, 1122, 1125, 1126, 1129,
1130, 1133, 1134, 1135, 1138, 1145, 1148, 1151, 1157, 1161,
1164, 1165, 1168, 1171, 1178, 1179, 1182, 1183, 1184, 1185,
1188, 1195, 1196, 1199, 1200, 1201, 1204, 1211, 1218, 1219,
1220, 1223, 1229, 1234, 1240, 1247, 1254, 1261, 1262, 1263,
1266, 1267, 1270, 1278, 1286, 1287, 1288, 1289, 1290, 1291,
1294, 1295, 1296, 1297, 1298, 1301, 1302, 1303, 1304, 1305,
1306, 1307, 1310, 1319, 1328, 1329, 1337, 1351, 1352, 1360,
1374, 1377, 1380, 1385, 1390, 1397, 1404, 1405, 1406, 1409,
1416, 1425, 1440, 1449, 1455, 1456, 1457, 1458, 1461, 1468,
1475, 1481, 1488, 1496, 1499, 1505, 1511, 1519, 1525, 1532,
1538, 1545, 1548, 1549, 1550
};
#endif
#if (YYDEBUG) || defined YYERROR_VERBOSE
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
{
"$", "error", "$undefined.", "IF", "ELSE", "THEN", "OR", "FAILED", "SET",
"LOGFILE", "FACILITY", "DAEMON", "SYSLOG", "MAILSERVER", "HTTPD",
"ALLOW", "ADDRESS", "INIT", "READONLY", "CLEARTEXT", "MD5HASH",
"SHA1HASH", "CRYPT", "PEMFILE", "ENABLE", "DISABLE", "HTTPDSSL",
"CLIENTPEMFILE", "ALLOWSELFCERTIFICATION", "STATEFILE", "SEND",
"EXPECT", "CYCLE", "COUNT", "REMINDER", "PIDFILE", "START", "STOP",
"PATHTOK", "HOST", "PORT", "TYPE", "UDP", "TCP", "TCPSSL", "PROTOCOL",
"CONNECTION", "ALERT", "NOALERT", "MAILFORMAT", "UNIXSOCKET",
"SIGNATURE", "TIMEOUT", "RESTART", "CHECKSUM", "EVERY", "DEFAULT",
"HTTP", "APACHESTATUS", "FTP", "SMTP", "POP", "IMAP", "CLAMAV", "NNTP",
"NTP3", "MYSQL", "DNS", "SSH", "DWP", "LDAP2", "LDAP3", "RDATE",
"RSYNC", "TNS", "PGSQL", "POSTFIXPOLICY", "STRING", "PATH", "MAILADDR",
"MAILFROM", "MAILSUBJECT", "MAILBODY", "SERVICENAME", "STRINGNAME",
"NUMBER", "PERCENT", "LOGLIMIT", "CLOSELIMIT", "DNSLIMIT",
"KEEPALIVELIMIT", "REPLYLIMIT", "REQUESTLIMIT", "STARTLIMIT",
"WAITLIMIT", "GRACEFULLIMIT", "CLEANUPLIMIT", "REAL", "CHECKPROC",
"CHECKDEV", "CHECKFILE", "CHECKDIR", "CHECKHOST", "CHECKSYSTEM",
"CHECKFIFO", "CHILDREN", "SYSTEM", "RESOURCE", "MEMORY", "TOTALMEMORY",
"LOADAVG1", "LOADAVG5", "LOADAVG15", "MODE", "ACTIVE", "PASSIVE",
"MANUAL", "CPU", "CPUUSER", "CPUSYSTEM", "CPUWAIT", "GROUP", "REQUEST",
"DEPENDS", "BASEDIR", "SLOT", "EVENTQUEUE", "UID", "GID", "COLLECTOR",
"INSTANCE", "USERNAME", "PASSWORD", "TIMESTAMP", "CHANGED", "SECOND",
"MINUTE", "HOUR", "DAY", "SSLAUTO", "SSLV2", "SSLV3", "TLSV1",
"CERTMD5", "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE", "INODE", "SPACE",
"PERMISSION", "SIZE", "MATCH", "NOT", "IGNORE", "EXEC", "UNMONITOR",
"ICMP", "ICMPECHO", "NONEXIST", "INVALID", "DATA", "RECOVERED",
"PASSED", "URL", "CONTENT", "PID", "PPID", "FSFLAG", "URLOBJECT",
"GREATER", "LESS", "EQUAL", "NOTEQUAL", "'{'", "'}'", "':'", "cfgfile",
"statement_list", "statement", "optproclist", "optproc", "optfilelist",
"optfile", "optdevlist", "optdev", "optdirlist", "optdir",
"opthostlist", "opthost", "optsystemlist", "optsystem", "optfifolist",
"optfifo", "setalert", "setdaemon", "setinit", "setlog",
"seteventqueue", "setstate", "setpid", "setcollectors", "collectorlist",
"collector", "setmailservers", "setmailformat", "sethttpd",
"mailserverlist", "mailserver", "httpdlist", "httpdoption", "ssl",
"sslenable", "ssldisable", "signature", "sigenable", "sigdisable",
"bindaddress", "pemfile", "clientpemfile", "allowselfcert", "allow",
"@1", "@2", "@3", "@4", "allowuserlist", "allowuser", "readonly",
"checkproc", "checkfile", "checkdev", "checkdir", "checkhost",
"checksystem", "checkfifo", "start", "stop", "argumentlist",
"useroptionlist", "argument", "useroption", "username", "password",
"connection", "connectionunix", "icmp", "host", "port", "unixsocket",
"type", "certmd5", "sslversion", "protocol", "sendexpectlist",
"sendexpect", "request", "apache_stat_list", "apache_stat", "pid",
"ppid", "icmpcount", "nettimeout", "timeout", "urloption",
"urloperator", "alert", "alertmail", "noalertmail", "eventoptionlist",
"eventoption", "formatlist", "formatoptionlist", "formatoption",
"every", "mode", "group", "depend", "dependlist", "dependant",
"resourceprocess", "resourceprocesslist", "resourceprocessopt",
"resourcesystem", "resourcesystemlist", "resourcesystemopt",
"resourcecpuproc", "resourcecpu", "resourcecpuid", "resourcemem",
"resourcechild", "resourceload", "resourceloadavg", "value",
"timestamp", "operator", "time", "action", "action1", "action2",
"rate1", "rate2", "recovery", "checksum", "hashtype", "inode", "space",
"fsflag", "unit", "permission", "match", "matchflagnot", "size", "uid",
"gid", "icmptype", "reminder", 0
};
#endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] =
{
0, 177, 177, 178, 178, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 180, 180, 181, 181, 181, 181, 181,
181, 181, 181, 181, 181, 181, 181, 181, 182, 182,
183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
183, 183, 183, 183, 183, 184, 184, 185, 185, 185,
185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
185, 186, 186, 187, 187, 187, 187, 187, 187, 187,
187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 190, 190, 191,
191, 191, 191, 191, 191, 192, 192, 193, 193, 193,
193, 193, 193, 193, 193, 193, 193, 193, 193, 194,
194, 194, 195, 196, 197, 197, 197, 198, 198, 198,
199, 200, 201, 202, 202, 203, 204, 205, 206, 207,
207, 208, 208, 209, 209, 210, 210, 210, 210, 211,
211, 212, 212, 212, 213, 213, 213, 213, 213, 214,
214, 215, 215, 216, 216, 217, 218, 219, 219, 220,
220, 221, 221, 221, 221, 221, 222, 221, 223, 221,
224, 221, 225, 221, 221, 226, 226, 227, 228, 228,
229, 229, 230, 231, 232, 233, 234, 235, 236, 236,
237, 237, 238, 238, 239, 239, 240, 240, 241, 241,
241, 241, 242, 242, 243, 243, 244, 244, 245, 246,
247, 247, 248, 249, 250, 250, 250, 250, 251, 251,
252, 252, 252, 252, 252, 253, 253, 253, 253, 253,
253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
253, 253, 253, 253, 253, 253, 253, 253, 254, 254,
255, 255, 256, 256, 256, 257, 257, 258, 258, 258,
258, 258, 258, 258, 258, 258, 258, 259, 260, 261,
261, 262, 262, 263, 264, 264, 265, 265, 266, 266,
266, 266, 267, 268, 269, 269, 270, 270, 270, 270,
270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
270, 270, 270, 270, 270, 270, 270, 271, 271, 272,
272, 273, 273, 273, 274, 275, 275, 275, 276, 277,
278, 278, 279, 280, 281, 281, 282, 282, 282, 282,
283, 284, 284, 285, 285, 285, 286, 287, 288, 288,
288, 289, 289, 289, 289, 290, 291, 292, 292, 292,
293, 293, 294, 294, 295, 295, 295, 295, 295, 295,
296, 296, 296, 296, 296, 297, 297, 297, 297, 297,
297, 297, 298, 299, 300, 300, 300, 301, 301, 301,
302, 302, 302, 303, 303, 303, 304, 304, 304, 305,
305, 306, 306, 307, 308, 308, 308, 308, 309, 310,
310, 310, 310, 311, 311, 312, 312, 313, 313, 314,
314, 315, 316, 316, 316
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] =
{
0, 0, 1, 1, 2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 0, 2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 2, 1,
1, 1, 1, 1, 1, 0, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 7,
4, 8, 3, 2, 3, 3, 5, 4, 6, 4,
3, 3, 3, 1, 2, 4, 4, 5, 5, 1,
2, 5, 7, 0, 2, 1, 1, 1, 1, 1,
4, 1, 2, 2, 2, 2, 3, 3, 2, 1,
1, 2, 2, 2, 2, 2, 2, 0, 2, 0,
1, 5, 2, 3, 3, 3, 0, 4, 0, 5,
0, 5, 0, 5, 2, 1, 2, 1, 0, 1,
4, 4, 4, 4, 4, 4, 2, 4, 2, 3,
2, 3, 1, 2, 1, 2, 1, 1, 2, 2,
2, 2, 0, 2, 0, 2, 11, 10, 10, 10,
0, 2, 2, 2, 0, 2, 4, 2, 0, 2,
0, 1, 1, 1, 1, 0, 3, 2, 2, 2,
2, 3, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 1, 1, 2,
2, 2, 0, 2, 4, 1, 3, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 6, 6, 0,
2, 0, 3, 7, 0, 3, 1, 1, 6, 3,
7, 1, 2, 2, 1, 2, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 4, 1,
2, 1, 1, 1, 3, 2, 2, 2, 2, 2,
1, 2, 1, 6, 1, 2, 1, 1, 1, 1,
6, 1, 2, 1, 1, 1, 4, 4, 1, 1,
1, 4, 4, 4, 4, 3, 3, 1, 1, 1,
1, 1, 9, 6, 0, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 2, 3, 1, 1,
1, 1, 1, 1, 0, 2, 3, 0, 2, 3,
0, 6, 6, 8, 10, 7, 0, 1, 1, 8,
9, 9, 9, 6, 1, 1, 1, 1, 8, 7,
7, 4, 4, 0, 1, 9, 6, 8, 8, 8,
8, 2, 0, 2, 3
};
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
doesn't specify something else to do. Zero means the default is an
error. */
static const short yydefact[] =
{
1, 0, 0, 0, 0, 0, 0, 0, 0, 2,
3, 5, 6, 15, 7, 8, 14, 13, 9, 10,
11, 12, 23, 38, 55, 71, 0, 97, 105, 0,
0, 0, 0, 123, 0, 0, 0, 0, 0, 0,
317, 0, 0, 0, 0, 0, 196, 0, 4, 16,
17, 18, 19, 0, 0, 0, 0, 0, 0, 0,
0, 20, 85, 87, 88, 89, 90, 91, 92, 317,
291, 93, 94, 95, 96, 21, 22, 125, 124, 122,
212, 281, 139, 0, 130, 131, 292, 0, 0, 0,
281, 132, 133, 0, 0, 0, 422, 0, 0, 0,
0, 0, 0, 0, 0, 24, 25, 26, 29, 30,
27, 28, 31, 32, 33, 34, 35, 36, 37, 413,
413, 39, 40, 41, 43, 45, 44, 52, 53, 54,
42, 49, 46, 51, 50, 47, 48, 0, 56, 57,
58, 59, 61, 60, 65, 66, 67, 68, 69, 70,
62, 63, 64, 0, 72, 73, 74, 76, 78, 77,
82, 83, 84, 75, 79, 80, 81, 220, 0, 206,
207, 198, 202, 200, 293, 0, 325, 326, 327, 328,
332, 329, 330, 86, 0, 0, 422, 0, 98, 99,
100, 101, 102, 103, 104, 106, 107, 108, 110, 112,
111, 116, 117, 118, 109, 113, 114, 115, 0, 0,
0, 214, 0, 140, 136, 143, 321, 322, 323, 0,
319, 127, 129, 230, 134, 0, 0, 313, 314, 298,
310, 315, 297, 308, 312, 301, 303, 311, 296, 307,
309, 305, 300, 316, 302, 306, 304, 299, 0, 294,
0, 120, 190, 191, 193, 192, 194, 195, 197, 220,
364, 364, 364, 357, 358, 359, 364, 0, 384, 334,
336, 337, 338, 339, 364, 396, 364, 396, 364, 414,
0, 0, 0, 0, 364, 364, 0, 0, 0, 0,
0, 0, 0, 0, 199, 203, 204, 201, 324, 331,
0, 0, 289, 348, 349, 350, 384, 341, 345, 364,
344, 343, 126, 212, 213, 0, 230, 0, 138, 137,
320, 0, 234, 231, 232, 233, 228, 0, 0, 317,
295, 423, 0, 224, 369, 365, 366, 367, 368, 0,
0, 0, 0, 384, 384, 0, 335, 0, 0, 397,
398, 0, 0, 0, 0, 0, 384, 384, 0, 0,
0, 0, 384, 0, 0, 221, 0, 279, 284, 0,
224, 0, 208, 210, 209, 211, 205, 0, 317, 342,
0, 0, 214, 215, 228, 282, 0, 0, 0, 0,
151, 0, 144, 145, 0, 149, 146, 159, 160, 147,
148, 128, 0, 135, 318, 317, 422, 424, 223, 0,
235, 355, 361, 360, 0, 361, 0, 0, 0, 0,
385, 0, 0, 361, 356, 384, 384, 384, 384, 384,
384, 370, 0, 0, 384, 0, 384, 384, 412, 411,
0, 384, 361, 0, 421, 0, 281, 0, 281, 222,
235, 0, 317, 422, 0, 0, 230, 141, 0, 0,
0, 184, 172, 165, 153, 162, 155, 164, 152, 154,
161, 163, 0, 167, 0, 0, 158, 229, 422, 119,
227, 225, 230, 0, 0, 0, 281, 257, 258, 352,
404, 405, 406, 407, 351, 354, 353, 346, 0, 0,
386, 379, 380, 375, 378, 0, 381, 382, 390, 0,
0, 0, 0, 0, 0, 0, 371, 372, 373, 374,
384, 0, 0, 0, 384, 0, 0, 0, 384, 0,
384, 384, 280, 384, 286, 287, 0, 384, 281, 0,
422, 288, 390, 347, 228, 173, 174, 175, 0, 0,
166, 0, 169, 156, 157, 121, 228, 260, 261, 237,
262, 0, 240, 251, 250, 242, 243, 247, 248, 246,
238, 252, 239, 244, 245, 253, 254, 255, 256, 249,
384, 259, 277, 278, 376, 0, 333, 0, 0, 0,
0, 0, 384, 0, 0, 363, 416, 0, 0, 0,
0, 403, 0, 0, 0, 0, 0, 285, 0, 384,
283, 290, 340, 142, 0, 0, 0, 188, 187, 177,
185, 168, 170, 150, 226, 0, 241, 364, 364, 364,
364, 364, 364, 364, 364, 364, 364, 236, 265, 0,
377, 0, 390, 390, 390, 390, 390, 0, 390, 0,
395, 0, 410, 409, 0, 390, 0, 0, 0, 0,
0, 179, 181, 183, 189, 171, 186, 263, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
387, 387, 417, 418, 419, 420, 408, 0, 393, 390,
390, 390, 399, 390, 390, 390, 390, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 266,
390, 0, 0, 0, 390, 362, 415, 400, 402, 401,
219, 217, 390, 264, 267, 268, 269, 270, 271, 272,
273, 274, 275, 276, 218, 388, 0, 0, 0, 394,
216, 389, 383, 391, 392, 0, 0, 0
};
static const short yydefgoto[] =
{
745, 9, 10, 49, 105, 50, 121, 51, 138, 52,
154, 61, 62, 75, 188, 76, 195, 11, 12, 13,
14, 15, 16, 17, 18, 91, 92, 19, 20, 21,
81, 82, 318, 392, 393, 394, 395, 396, 397, 398,
399, 473, 552, 623, 400, 549, 614, 615, 616, 619,
620, 665, 22, 23, 24, 25, 26, 27, 28, 63,
64, 171, 294, 172, 296, 211, 316, 65, 109, 66,
290, 370, 333, 410, 403, 326, 486, 487, 488, 626,
637, 638, 110, 111, 446, 214, 67, 448, 536, 68,
69, 70, 248, 249, 96, 219, 220, 71, 72, 73,
74, 181, 182, 118, 268, 269, 194, 306, 307, 270,
308, 309, 271, 272, 273, 274, 414, 130, 339, 520,
507, 508, 743, 347, 712, 586, 131, 354, 147, 148,
149, 494, 132, 133, 280, 134, 135, 136, 367, 251
};
static const short yypact[] =
{
190, 61, -47, -18, -16, -3, 3, 12, 47, 190,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 214,-32768,-32768, 16,
34, 20, 172,-32768, 117, 130, 135, 49, 186, 56,
-32, 246, 192, 201, 205, 236,-32768, 216,-32768, 219,
45, 542, 569, 26, 243, 243, 222, 230, 182, 187,
174, 214,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -29,
-32768,-32768,-32768,-32768,-32768, 365, 569, 326,-32768,-32768,
-22, -28,-32768, 261,-32768,-32768,-32768, 289, 278, 267,
311, 56,-32768, 193, 208, 443, 355, 321, 327, 333,
351, 356, 361, 363, 168,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 30,
299,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 37,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768, 55,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 27, 401,-32768,
-32768, 155,-32768, 155,-32768, 438,-32768,-32768,-32768,-32768,
-32768, 174,-32768,-32768, 300, 443, 355, 408,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 400, 405,
417, 374, 430,-32768,-32768,-32768,-32768,-32768,-32768, 21,
-32768, 411,-32768, 371,-32768, 289, 443,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 276,-32768,
448,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -8,
134, 134, 134,-32768,-32768,-32768, 134, 167, 313,-32768,
-32768,-32768,-32768,-32768, 134, 19, 134, 6, 134,-32768,
386, 387, 136, 375, 134, 134, 409, 467, 519, 392,
525, 484, 218, 262, 233,-32768,-32768, 233,-32768,-32768,
443, 312,-32768,-32768,-32768,-32768, 500,-32768,-32768, 134,
-32768,-32768,-32768, 444,-32768, 497, 371, 445, 293,-32768,
-32768, 496,-32768,-32768,-32768,-32768, 440, 25, 348, 535,
-32768, 554, 509, 547,-32768,-32768,-32768,-32768,-32768, 506,
-40, 151, 507, 511, 511, 0,-32768, 596, 173,-32768,
-32768, 266, 268, 522, 559, 529, 511, 511, 561, 536,
309, 318, 511, 537, 175,-32768, 465, 605, 464, 562,
547, 616,-32768,-32768,-32768,-32768,-32768, 407, 535,-32768,
644, 565, 374,-32768, 440,-32768, 36, 577, 17, 178,
383, 423,-32768,-32768, 630, 89,-32768,-32768,-32768,-32768,
-32768,-32768, 582,-32768,-32768, 535, 355,-32768,-32768, 414,
179,-32768, 572,-32768, 402, 578, 402, 583, 657, 662,
-32768, 636, 51,-32768,-32768, 511, 511, 511, 511, 511,
-9, 416, 676, 678, 511, 402, 511, 511,-32768,-32768,
679, 380, 599, 402,-32768, 601, 311, 319, 311,-32768,
179, 682, 535, 355, 51, 602, 371,-32768, 611, 613,
638, 538, 640,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, 641, 688, 642, 643,-32768,-32768, 355,-32768,
-32768,-32768, 371, 645, 646, 637, 311, 471,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 51, 51,
-32768,-32768,-32768,-32768,-32768, 243,-32768,-32768, 714, 719,
720, 721, 722, 723, 652, 725,-32768,-32768,-32768,-32768,
511, 51, 51, 726, 511, 727, 728, 51, 511, 729,
511, 511,-32768, 511,-32768,-32768, 658, 511, 311, 684,
355,-32768, 714,-32768, 440, 660, 661, 663, 664, 665,
-32768, 666, 711,-32768,-32768,-32768, 440,-32768,-32768,-32768,
621, 584,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
511,-32768,-32768,-32768, 155, 742,-32768, 51, 51, 51,
51, 51, 511, 51, 741,-32768,-32768, 51, 743, 51,
51,-32768, 744, 51, 745, 746, 747,-32768, 748, 511,
-32768,-32768,-32768,-32768, 665, 665, 665, 736,-32768, 665,
-32768,-32768,-32768,-32768,-32768, 669,-32768, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 749,-32768, 751,
233, 359, 714, 714, 714, 714, 714, 752, 714, 51,
-32768, 51,-32768,-32768, 51, 714, 51, 51, 51, 51,
753, 665, 665, 665,-32768,-32768,-32768, 705, 675, 677,
680, 681, 683, 685, 686, 687, 689, 690, 584, 51,
691, 691,-32768,-32768,-32768,-32768,-32768, 51,-32768, 714,
714, 714,-32768, 714, 714, 714, 714, 51, 692, 693,
694, 695, 696, 697, 698, 699, 700, 701, 702,-32768,
714, 14, 756, 758, 714,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, 714,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 732, 51, 51,-32768,
-32768,-32768,-32768,-32768,-32768, 767, 773,-32768
};
static const short yypgoto[] =
{
-32768,-32768, 768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, 717,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 703,-32768,-32768,-32768,
-32768, 708,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -131,
-416,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 274,
590, -55, -170, -169, -285, 477, 410, 750,-32768,-32768,
-32768,-32768,-32768, 421, -374, -302, 343,-32768, 308,-32768,
-32768, 118,-32768,-32768,-32768, -89, 341,-32768,-32768, 480,
796,-32768, -106, -210, -64, 573, -204, 576, 594, 581,
585,-32768, 619,-32768,-32768, 533,-32768,-32768, 498,-32768,
-32768,-32768, -146,-32768, -114,-32768, -10, -5, -255,-32768,
-213, -438, 64, -293, 122, -517,-32768, 528,-32768,-32768,
-32768, -201, -17,-32768, 704,-32768, 1, 150,-32768, -178
};
#define YYLAST 824
static const short yytable[] =
{
173, 223, 295, 297, 295, 186, 340, 341, 302, 376,
457, 342, 376, 380, 384, 320, 542, 93, 209, 348,
93, 355, 514, 359, 212, 612, 349, 350, 77, 363,
364, 287, 420, 167, 150, 164, 41, 275, 330, 349,
350, 310, 332, 464, 282, 412, 735, 163, 119, 80,
418, 419, 151, 165, 381, 458, 459, 413, 460, 205,
582, 583, 282, 432, 433, 42, 287, 43, 465, 440,
29, 204, 30, 311, 31, 32, 345, 206, 33, 301,
44, 54, 55, 595, 596, 421, 45, 501, 502, 601,
34, 330, 36, 56, 78, 46, 35, 80, 503, 736,
57, 216, 217, 218, 504, 216, 217, 218, 36, 210,
37, 168, 474, 461, 462, 168, 475, 476, 330, 79,
328, 94, 168, 320, 184, 682, 683, 684, 685, 686,
47, 688, 509, 510, 511, 512, 513, 515, 692, 356,
168, 523, 95, 525, 526, 185, 351, 352, 529, 642,
643, 644, 645, 646, 544, 648, 289, 357, 58, 650,
310, 652, 653, 276, 277, 655, 59, 330, 60, 353,
613, 283, 715, 716, 717, 259, 718, 719, 720, 721,
556, 278, 624, 279, 288, 284, 285, 38, 276, 286,
39, 289, 311, 734, 377, 84, 319, 739, 1, 120,
404, 152, 166, 666, 466, 740, 505, 506, 85, 483,
484, 689, 83, 690, 86, 496, 691, 53, 693, 694,
695, 696, 104, 87, 485, 90, 207, 594, 479, 467,
99, 598, 169, 170, 524, 602, 415, 604, 605, 100,
606, 710, 531, 101, 608, 666, 666, 666, 413, 714,
54, 55, 102, 168, 103, 54, 55, 180, 423, 722,
442, 36, 56, 351, 352, 406, 36, 56, 334, 57,
413, 179, 413, 260, 57, 541, 261, 262, 263, 264,
265, 97, 292, 293, 98, 266, 353, 639, 2, 3,
4, 5, 6, 7, 8, 372, 176, 177, 178, 647,
555, 174, 267, 373, 335, 336, 337, 338, 386, 387,
88, 89, 227, 228, 453, 175, 660, 388, 389, 390,
169, 170, 229, 106, 122, 139, 155, 58, 230, 231,
232, 416, 58, 343, 344, 59, 208, 60, 424, 374,
59, 478, 60, 425, 391, 427, 215, 375, 227, 228,
196, 426, 222, 428, 443, 376, 221, 533, 229, 537,
292, 293, 611, 212, 230, 231, 232, 225, 187, 216,
217, 218, 668, 669, 670, 671, 672, 673, 674, 675,
676, 677, 226, 233, 227, 228, 436, 437, 540, 250,
112, 124, 141, 157, 229, 438, 439, 580, 345, 252,
230, 231, 232, 234, 235, 253, 236, 468, 469, 237,
238, 254, 36, 56, 640, 295, 189, 198, 260, 233,
57, 261, 262, 263, 264, 265, 239, 240, 241, 255,
266, 242, 243, 244, 256, 245, 246, 247, 257, 234,
235, 258, 236, 227, 228, 237, 238, 470, 471, 609,
584, 329, 279, 229, 291, 233, 480, 481, 482, 230,
231, 232, 239, 240, 241, 345, 528, 242, 243, 244,
298, 245, 246, 247, 300, 234, 235, 312, 236, 227,
228, 237, 238, 661, 662, 663, 59, 378, 60, 229,
313, 534, 535, 168, 314, 230, 231, 232, 239, 240,
241, 483, 484, 242, 243, 244, 315, 245, 246, 247,
322, 323, 324, 325, 233, 317, 261, 262, 263, 264,
265, 680, 681, 405, 742, 742, 303, 304, 305, 113,
125, 142, 158, 331, 234, 235, 321, 236, 360, 361,
237, 238, 356, 362, 365, 137, 490, 491, 492, 493,
233, 516, 517, 518, 519, 190, 199, 239, 240, 241,
366, 368, 242, 243, 244, 369, 245, 246, 247, 371,
234, 235, 153, 236, 383, 210, 237, 238, 54, 55,
385, 401, 452, 402, 93, 345, 407, 408, 409, 36,
56, 411, 417, 239, 240, 241, 345, 57, 242, 243,
244, 422, 245, 246, 247, 54, 55, 429, 261, 262,
263, 264, 265, 430, 431, 434, 36, 56, 303, 304,
305, 435, 441, 444, 57, 114, 126, 143, 159, 447,
116, 128, 145, 161, 117, 129, 146, 162, 445, 107,
123, 140, 156, 115, 127, 144, 160, 449, 451, 454,
455, 191, 200, 472, 463, 58, 192, 202, 489, 477,
193, 203, 498, 59, 495, 60, 197, 499, 500, 497,
201, 627, 628, 629, 630, 631, 632, 633, 634, 635,
636, 521, 58, 522, 527, 530, 532, 539, 543, 545,
59, 546, 60, 559, 560, 561, 562, 563, 564, 565,
566, 567, 568, 569, 570, 571, 572, 573, 574, 575,
576, 577, 578, 579, 548, 551, 547, -176, 585, 550,
553, 554, 557, 558, 587, 588, 589, 590, 591, 592,
593, 597, 599, 600, 603, 607, 610, -178, -180, 622,
-182, 617, 618, 625, 621, 641, 649, 667, 651, 654,
656, 657, 658, 659, 664, 678, 679, 687, 697, 698,
699, 737, 700, 738, 741, 701, 702, 746, 703, 723,
704, 705, 706, 747, 707, 708, 711, 48, 183, 724,
725, 726, 727, 728, 729, 730, 731, 732, 733, 213,
382, 450, 456, 538, 224, 581, 709, 40, 327, 108,
299, 346, 744, 713, 379, 358, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 281
};
static const short yycheck[] =
{
55, 90, 171, 173, 173, 69, 261, 262, 186, 294,
384, 266, 297, 306, 316, 219, 454, 49, 40, 274,
49, 276, 31, 278, 52, 542, 20, 21, 12, 284,
285, 39, 32, 7, 51, 52, 83, 7, 248, 20,
21, 187, 50, 26, 7, 85, 32, 52, 3, 77,
343, 344, 51, 52, 309, 19, 20, 97, 22, 76,
498, 499, 7, 356, 357, 83, 39, 83, 51, 362,
9, 76, 11, 187, 13, 14, 85, 76, 17, 185,
83, 36, 37, 521, 522, 85, 83, 36, 37, 527,
29, 301, 47, 48, 78, 83, 35, 77, 47, 85,
55, 80, 81, 82, 53, 80, 81, 82, 47, 131,
49, 85, 23, 77, 78, 85, 27, 28, 328, 85,
226, 153, 85, 327, 153, 642, 643, 644, 645, 646,
83, 648, 425, 426, 427, 428, 429, 430, 655, 133,
85, 434, 174, 436, 437, 174, 127, 128, 441, 587,
588, 589, 590, 591, 456, 593, 164, 151, 113, 597,
306, 599, 600, 133, 134, 603, 121, 377, 123, 150,
544, 134, 689, 690, 691, 7, 693, 694, 695, 696,
482, 151, 556, 153, 157, 148, 149, 126, 133, 134,
129, 164, 306, 710, 300, 78, 175, 714, 8, 154,
175, 51, 52, 619, 26, 722, 155, 156, 78, 30,
31, 649, 40, 651, 79, 416, 654, 3, 656, 657,
658, 659, 3, 174, 45, 169, 76, 520, 406, 51,
38, 524, 77, 78, 435, 528, 85, 530, 531, 38,
533, 679, 443, 38, 537, 661, 662, 663, 97, 687,
36, 37, 16, 85, 38, 36, 37, 83, 85, 697,
85, 47, 48, 127, 128, 329, 47, 48, 134, 55,
97, 84, 97, 105, 55, 453, 108, 109, 110, 111,
112, 35, 127, 128, 38, 117, 150, 580, 98, 99,
100, 101, 102, 103, 104, 77, 114, 115, 116, 592,
478, 79, 134, 85, 170, 171, 172, 173, 15, 16,
124, 125, 36, 37, 378, 85, 609, 24, 25, 26,
77, 78, 46, 49, 50, 51, 52, 113, 52, 53,
54, 341, 113, 166, 167, 121, 10, 123, 348, 77,
121, 405, 123, 77, 51, 77, 85, 85, 36, 37,
76, 85, 85, 85, 364, 640, 78, 446, 46, 448,
127, 128, 540, 52, 52, 53, 54, 174, 3, 80,
81, 82, 627, 628, 629, 630, 631, 632, 633, 634,
635, 636, 174, 107, 36, 37, 77, 78, 452, 34,
49, 50, 51, 52, 46, 77, 78, 486, 85, 78,
52, 53, 54, 127, 128, 78, 130, 24, 25, 133,
134, 78, 47, 48, 584, 584, 75, 76, 105, 107,
55, 108, 109, 110, 111, 112, 150, 151, 152, 78,
117, 155, 156, 157, 78, 159, 160, 161, 77, 127,
128, 78, 130, 36, 37, 133, 134, 24, 25, 538,
505, 175, 153, 46, 53, 107, 42, 43, 44, 52,
53, 54, 150, 151, 152, 85, 86, 155, 156, 157,
32, 159, 160, 161, 174, 127, 128, 77, 130, 36,
37, 133, 134, 614, 615, 616, 121, 175, 123, 46,
85, 172, 173, 85, 77, 52, 53, 54, 150, 151,
152, 30, 31, 155, 156, 157, 132, 159, 160, 161,
139, 140, 141, 142, 107, 85, 108, 109, 110, 111,
112, 162, 163, 175, 737, 738, 118, 119, 120, 49,
50, 51, 52, 85, 127, 128, 125, 130, 152, 152,
133, 134, 133, 168, 77, 3, 144, 145, 146, 147,
107, 135, 136, 137, 138, 75, 76, 150, 151, 152,
41, 169, 155, 156, 157, 40, 159, 160, 161, 85,
127, 128, 3, 130, 77, 131, 133, 134, 36, 37,
135, 85, 175, 143, 49, 85, 32, 78, 41, 47,
48, 85, 85, 150, 151, 152, 85, 55, 155, 156,
157, 5, 159, 160, 161, 36, 37, 85, 108, 109,
110, 111, 112, 54, 85, 54, 47, 48, 118, 119,
120, 85, 85, 158, 55, 49, 50, 51, 52, 165,
49, 50, 51, 52, 49, 50, 51, 52, 33, 49,
50, 51, 52, 49, 50, 51, 52, 85, 32, 5,
85, 75, 76, 23, 77, 113, 75, 76, 86, 77,
75, 76, 5, 121, 86, 123, 76, 5, 32, 86,
76, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 5, 113, 5, 5, 86, 85, 5, 86, 78,
121, 78, 123, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 176, 27, 78, 77, 4, 78,
78, 78, 77, 77, 5, 5, 5, 5, 5, 77,
5, 5, 5, 5, 5, 77, 52, 77, 77, 28,
77, 77, 77, 122, 78, 3, 5, 78, 5, 5,
5, 5, 5, 5, 18, 6, 5, 5, 5, 54,
85, 5, 85, 5, 32, 85, 85, 0, 85, 77,
85, 85, 85, 0, 85, 85, 85, 9, 61, 86,
86, 86, 86, 86, 86, 86, 86, 86, 86, 81,
313, 370, 382, 450, 91, 487, 678, 1, 225, 49,
181, 268, 738, 681, 306, 277, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 120
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/share/bison/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the h/* A Bison parser, made from p.y
by GNU bison 1.35. */
#define YYBISON 1 /* Identify Bison output. */
# define IF 257
# define ELSE 258
# define THEN 259
# define OR 260
# define FAILED 261
# define SET 262
# define LOGFILE 263
# define FACILITY 264
# define DAEMON 265
# define SYSLOG 266
# define MAILSERVER 267
# define HTTPD 268
# define ALLOW 269
# define ADDRESS 270
# define INIT 271
# define READONLY 272
# define CLEARTEXT 273
# define MD5HASH 274
# define SHA1HASH 275
# define CRYPT 276
# define PEMFILE 277
# define ENABLE 278
# define DISABLE 279
# define HTTPDSSL 280
# define CLIENTPEMFILE 281
# define ALLOWSELFCERTIFICATION 282
# define STATEFILE 283
# define SEND 284
# define EXPECT 285
# define CYCLE 286
# define COUNT 287
# define REMINDER 288
# define PIDFILE 289
# define START 290
# define STOP 291
# define PATHTOK 292
# define HOST 293
# define PORT 294
# define TYPE 295
# define UDP 296
# define TCP 297
# define TCPSSL 298
# define PROTOCOL 299
# define CONNECTION 300
# define ALERT 301
# define NOALERT 302
# define MAILFORMAT 303
# define UNIXSOCKET 304
# define SIGNATURE 305
# define TIMEOUT 306
# define RESTART 307
# define CHECKSUM 308
# define EVERY 309
# define DEFAULT 310
# define HTTP 311
# define APACHESTATUS 312
# define FTP 313
# define SMTP 314
# define POP 315
# define IMAP 316
# define CLAMAV 317
# define NNTP 318
# define NTP3 319
# define MYSQL 320
# define DNS 321
# define SSH 322
# define DWP 323
# define LDAP2 324
# define LDAP3 325
# define RDATE 326
# define RSYNC 327
# define TNS 328
# define PGSQL 329
# define POSTFIXPOLICY 330
# define STRING 331
# define PATH 332
# define MAILADDR 333
# define MAILFROM 334
# define MAILSUBJECT 335
# define MAILBODY 336
# define SERVICENAME 337
# define STRINGNAME 338
# define NUMBER 339
# define PERCENT 340
# define LOGLIMIT 341
# define CLOSELIMIT 342
# define DNSLIMIT 343
# define KEEPALIVELIMIT 344
# define REPLYLIMIT 345
# define REQUESTLIMIT 346
# define STARTLIMIT 347
# define WAITLIMIT 348
# define GRACEFULLIMIT 349
# define CLEANUPLIMIT 350
# define REAL 351
# define CHECKPROC 352
# define CHECKDEV 353
# define CHECKFILE 354
# define CHECKDIR 355
# define CHECKHOST 356
# define CHECKSYSTEM 357
# define CHECKFIFO 358
# define CHILDREN 359
# define SYSTEM 360
# define RESOURCE 361
# define MEMORY 362
# define TOTALMEMORY 363
# define LOADAVG1 364
# define LOADAVG5 365
# define LOADAVG15 366
# define MODE 367
# define ACTIVE 368
# define PASSIVE 369
# define MANUAL 370
# define CPU 371
# define CPUUSER 372
# define CPUSYSTEM 373
# define CPUWAIT 374
# define GROUP 375
# define REQUEST 376
# define DEPENDS 377
# define BASEDIR 378
# define SLOT 379
# define EVENTQUEUE 380
# define UID 381
# define GID 382
# define COLLECTOR 383
# define INSTANCE 384
# define USERNAME 385
# define PASSWORD 386
# define TIMESTAMP 387
# define CHANGED 388
# define SECOND 389
# define MINUTE 390
# define HOUR 391
# define DAY 392
# define SSLAUTO 393
# define SSLV2 394
# define SSLV3 395
# define TLSV1 396
# define CERTMD5 397
# define BYTE 398
# define KILOBYTE 399
# define MEGABYTE 400
# define GIGABYTE 401
# define INODE 402
# define SPACE 403
# define PERMISSION 404
# define SIZE 405
# define MATCH 406
# define NOT 407
# define IGNORE 408
# define EXEC 409
# define UNMONITOR 410
# define ICMP 411
# define ICMPECHO 412
# define NONEXIST 413
# define INVALID 414
# define DATA 415
# define RECOVERED 416
# define PASSED 417
# define URL 418
# define CONTENT 419
# define PID 420
# define PPID 421
# define FSFLAG 422
# define URLOBJECT 423
# define GREATER 424
# define LESS 425
# define EQUAL 426
# define NOTEQUAL 427
#line 20 "p.y"
/*
* DESCRIPTION
* Simple context-free grammar for parsing the control file.
*
* @author Jan-Henrik Haukeland, <hauk@tildeslash.com>
* @author Olivier Beyssac, <ob@r14.freenix.org>
* @author Kianusch Sayah Karadji <kianusch.sayah.karadji@sk-tech.net>
* @author Martin Pala <martinp@tildeslash.com>
* @author Christian Hopp <chopp@iei.tu-clausthal.de>
* @author Rory Toma <rory@digeo.com>
* @version \$Id: p.y,v 1.261 2007/10/17 11:09:55 hauk Exp $
*/
#include <config.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_ASM_PARAM_H
#include <asm/param.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
#ifndef HAVE_SOL_IP
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#endif
#ifdef HAVE_NETINET_IP_ICMP_H
#include <netinet/ip_icmp.h>
#endif
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
#include "net.h"
#include "monitor.h"
#include "protocol.h"
#include "engine.h"
#include "alert.h"
#include "process.h"
#include "ssl.h"
#include "device.h"
/* ------------------------------------------------------------- Definitions */
struct IHavePrecedence {
int daemon;
int logfile;
int pidfile;
};
struct myrate {
unsigned count;
unsigned cycles;
};
/* yacc interface */
void yyerror(const char *,...);
void yyerror2(const char *,...);
void yywarning(const char *,...);
void yywarning2(const char *,...);
/* lexer interface */
int yylex(void);
extern FILE *yyin;
extern int lineno;
extern int arglineno;
extern char *yytext;
extern char *argyytext;
extern char *currentfile;
extern char *argcurrentfile;
extern int buffer_stack_ptr;
/* Local variables */
static int cfg_errflag= FALSE;
static Service_T tail= NULL;
static Service_T current= NULL;
static unsigned int eventset;
static Request_T urlrequest= NULL;
static Command_T command= NULL;
static Command_T command1= NULL;
static Command_T command2= NULL;
static Service_T depend_list= NULL;
static struct mygid gidset;
static struct myuid uidset;
static struct myperm permset;
static struct mysize sizeset;
static struct mymatch matchset;
static struct myicmp icmpset;
static struct mymail mailset;
static struct myport portset;
static struct mymailserver mailserverset;
static struct mydevice deviceset;
static struct myresource resourceset;
static struct mychecksum checksumset;
static struct mytimestamp timestampset;
static struct IHavePrecedence ihp= {FALSE, FALSE, FALSE};
static struct myrate rate1 = {1, 1};
static struct myrate rate2 = {1, 1};
static char * htpasswd_file= NULL;
static int digesttype= DIGEST_CLEARTEXT;
static int hassystem = FALSE;
#define BITMAP_MAX (sizeof(long long) * 8)
/* -------------------------------------------------------------- Prototypes */
static void preparse();
static void postparse();
static void addservice(Service_T);
static void addmail(char *, Mail_T, Mail_T *, unsigned int, unsigned int);
static void createservice(int, char *, char *, int (*)(Service_T));
static void adddependant(char *);
static void addport(Port_T);
static void addresource(Resource_T);
static void addtimestamp(Timestamp_T, int);
static void addsize(Size_T, int);
static void adddevice(Device_T);
static void addicmp(Icmp_T);
static void *addprotocol(int);
static void addgeneric(Port_T, char*, char*);
static void addcommand(int);
static void addargument(char *);
static void addcollector(URL_T, int, int, char *);
static void addmailserver(MailServer_T);
static int addcredentials(char *, char *, int, int);
static void addhtpasswdentry(char *, char *, int);
static uid_t get_uid(char *, uid_t);
static gid_t get_gid(char *, gid_t);
static void addchecksum(Checksum_T);
static void addperm(Perm_T);
static void addmatch(Match_T, int, int);
static void addmatchpath(Match_T, int);
static void adduid(Uid_T);
static void addgid(Gid_T);
static void addeuid(uid_t);
static void addegid(gid_t);
static void addeventaction(EventAction_T *, int, int);
static void seteventaction(EventAction_T *, int, int);
static void prepare_urlrequest(URL_T U);
static void seturlrequest(int, char *);
static void setlogfile(char *);
static void setpidfile(char *);
static void reset_mailset();
static void reset_mailserverset();
static void reset_portset();
static void reset_resourceset();
static void reset_timestampset();
static void reset_sizeset();
static void reset_checksumset();
static void reset_permset();
static void reset_uidset();
static void reset_gidset();
static void reset_deviceset();
static void reset_icmpset();
static void reset_rateset();
static void check_name(char *);
static void check_timeout(int, int);
static void check_every(int);
static int check_perm(int);
static void check_hostname (char *);
static void check_exec(char *);
static int cleanup_hash_string(char *);
static void check_depend();
static void setsyslog(char *);
static void describeAction(Action_T);
static Command_T copycommand(Command_T);
#line 241 "p.y"
#ifndef YYSTYPE
typedef union {
URL_T url;
float real;
int number;
char *string;
} yystype;
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#define YYFINAL 747
#define YYFLAG -32768
#define YYNTBASE 177
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#define YYTRANSLATE(x) ((unsigned)(x) <= 427 ? yytranslate[x] : 317)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
static const short yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 176, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 174, 2, 175, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
166, 167, 168, 169, 170, 171, 172, 173
};
#if YYDEBUG
static const short yyprhs[] =
{
0, 0, 1, 3, 5, 8, 10, 12, 14, 16,
18, 20, 22, 24, 26, 28, 30, 33, 36, 39,
42, 45, 48, 51, 52, 55, 57, 59, 61, 63,
65, 67, 69, 71, 73, 75, 77, 79, 81, 82,
85, 87, 89, 91, 93, 95, 97, 99, 101, 103,
105, 107, 109, 111, 113, 115, 116, 119, 121, 123,
125, 127, 129, 131, 133, 135, 137, 139, 141, 143,
145, 147, 148, 151, 153, 155, 157, 159, 161, 163,
165, 167, 169, 171, 173, 175, 177, 180, 182, 184,
186, 188, 190, 192, 194, 196, 198, 200, 201, 204,
206, 208, 210, 212, 214, 216, 217, 220, 222, 224,
226, 228, 230, 232, 234, 236, 238, 240, 242, 244,
252, 257, 266, 270, 273, 277, 281, 287, 292, 299,
304, 308, 312, 316, 318, 321, 326, 331, 337, 343,
345, 348, 354, 362, 363, 366, 368, 370, 372, 374,
376, 381, 383, 386, 389, 392, 395, 399, 403, 406,
408, 410, 413, 416, 419, 422, 425, 428, 429, 432,
433, 435, 441, 444, 448, 452, 456, 457, 462, 463,
469, 470, 476, 477, 483, 486, 488, 491, 493, 494,
496, 501, 506, 511, 516, 521, 526, 529, 534, 537,
541, 544, 548, 550, 553, 555, 558, 560, 562, 565,
568, 571, 574, 575, 578, 579, 582, 594, 605, 616,
627, 628, 631, 634, 637, 638, 641, 646, 649, 650,
653, 654, 656, 658, 660, 662, 663, 667, 670, 673,
676, 679, 683, 686, 689, 692, 695, 698, 701, 704,
707, 710, 713, 716, 719, 722, 725, 728, 730, 732,
735, 738, 741, 742, 745, 750, 752, 756, 761, 766,
771, 776, 781, 786, 791, 796, 801, 806, 813, 820,
821, 824, 825, 829, 837, 838, 842, 844, 846, 853,
857, 865, 867, 870, 873, 875, 878, 880, 882, 884,
886, 888, 890, 892, 894, 896, 898, 900, 902, 904,
906, 908, 910, 912, 914, 916, 918, 920, 921, 926,
928, 931, 933, 935, 937, 941, 944, 947, 950, 953,
956, 958, 961, 963, 970, 972, 975, 977, 979, 981,
983, 990, 992, 995, 997, 999, 1001, 1006, 1011, 1013,
1015, 1017, 1022, 1027, 1032, 1037, 1041, 1045, 1047, 1049,
1051, 1053, 1055, 1065, 1072, 1073, 1075, 1077, 1079, 1081,
1083, 1084, 1086, 1088, 1090, 1092, 1094, 1097, 1101, 1103,
1105, 1107, 1109, 1111, 1113, 1114, 1117, 1121, 1122, 1125,
1129, 1130, 1137, 1144, 1153, 1164, 1172, 1173, 1175, 1177,
1186, 1196, 1206, 1216, 1223, 1225, 1227, 1229, 1231, 1240,
1248, 1256, 1261, 1266, 1267, 1269, 1279, 1286, 1295, 1304,
1313, 1322, 1325, 1326, 1329
};
static const short yyrhs[] =
{
-1, 178, 0, 179, 0, 178, 179, 0, 194, 0,
195, 0, 197, 0, 198, 0, 201, 0, 204, 0,
205, 0, 206, 0, 200,ope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* This is the parser code that is written into each bison parser when
the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
/* The parser invokes alloca or malloc; define the necessary symbols. */
# if YYSTACK_USE_ALLOCA
# define YYSTACK_ALLOC alloca
# else
# ifndef YYSTACK_USE_ALLOCA
# if defined (alloca) || defined (_ALLOCA_H)
# define YYSTACK_ALLOC alloca
# else
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
# if defined (__STDC__) || defined (__cplusplus)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
# define YYSTACK_ALLOC malloc
# define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
short yyss;
YYSTYPE yyvs;
# if YYLSP_NEEDED
YYLTYPE yyls;
# endif
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# if YYLSP_NEEDED
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAX)
# else
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAX)
# endif
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run).
When YYLLOC_DEFAULT is run, CURRENT is set the location of the
first token. By default, to implement support for ranges, extend
its range to the last symbol. */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
Current.last_line = Rhs[N].last_line; \
Current.last_column = Rhs[N].last_column;
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#if YYPURE
# if YYLSP_NEEDED
# ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
# else
# define YYLEX yylex (&yylval, &yylloc)
# endif
# else /* !YYLSP_NEEDED */
# ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, YYLEX_PARAM)
# else
# define YYLEX yylex (&yylval)
# endif
# endif /* !YYLSP_NEEDED */
#else /* !YYPURE */
# define YYLEX yylex ()
#endif /* !YYPURE */
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#ifdef YYERROR_VERBOSE
# ifndef yystrlen
# if defined (__GLIBC__) && defined (_STRING_H)
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
# if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
# else
yystrlen (yystr)
const char *yystr;
# endif
{
register const char *yys = yystr;
while (*yys++ != '\0')
continue;
return yys - yystr - 1;
}
# endif
# endif
# ifndef yystpcpy
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
# if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
# else
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
# endif
{
register char *yyd = yydest;
register const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
#endif
#line 315 "/usr/local/share/bison/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
It should actually point to an object.
Grammar actions can access the variable by casting it
to the proper pointer type. */
#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
# define YYPARSE_PARAM_DECL
# else
# define YYPARSE_PARAM_ARG YYPARSE_PARAM
# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
#else /* !YYPARSE_PARAM */
# define YYPARSE_PARAM_ARG
# define YYPARSE_PARAM_DECL
#endif /* !YYPARSE_PARAM */
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
# ifdef YYPARSE_PARAM
int yyparse (void *);
# else
int yyparse (void);
# endif
#endif
/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
variables are global, or local to YYPARSE. */
#define YY_DECL_NON_LSP_VARIABLES \
/* The lookahead symbol. */ \
int yychar; \
\
/* The semantic value of the lookahead symbol. */ \
YYSTYPE yylval; \
\
/* Number of parse errors so far. */ \
int yynerrs;
#if YYLSP_NEEDED
# define YY_DECL_VARIABLES \
YY_DECL_NON_LSP_VARIABLES \
\
/* Location data for the lookahead symbol. */ \
YYLTYPE yylloc;
#else
# define YY_DECL_VARIABLES \
YY_DECL_NON_LSP_VARIABLES
#endif
/* If nonreentrant, generate the variables here. */
#if !YYPURE
YY_DECL_VARIABLES
#endif /* !YYPURE */
int
yyparse (YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
{
/* If reentrant, generate the variables here. */
#if YYPURE
YY_DECL_VARIABLES
#endif /* !YYPURE */
register int yystate;
register int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */
int yychar1 = 0;
/* Three stacks and their tools:
`yyss': related to states,
`yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
register short *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
register YYSTYPE *yyvsp;
#if YYLSP_NEEDED
/* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
#endif
#if YYLSP_NEEDED
# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
# define YYPOPSTACK (yyvsp--, yyssp--)
#endif
YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
#if YYLSP_NEEDED
YYLTYPE yyloc;
#endif
/* When reducing, the number of symbols on the RHS of the reduced
rule. */
int yylen;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss;
yyvsp = yyvs;
#if YYLSP_NEEDED
yylsp = yyls;
#endif
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks.
*/
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. */
# if YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
yyls = yyls1;
# else
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
# endif
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyoverflowlab;
# else
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
goto yyoverflowlab;
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
{
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# if YYLSP_NEEDED
YYSTACK_RELOCATE (yyls);
# endif
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
#if YYLSP_NEEDED
yylsp = yyls + yysize - 1;
#endif
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yychar1 = YYTRANSLATE (yychar);
#if YYDEBUG
/* We have to keep this `#if YYDEBUG', since we use variables
which are defined only if `YYDEBUG' is set. */
if (yydebug)
{
YYFPRINTF (stderr, "Next token is %d (%s",
yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise
meaning of a token, for further debugging info. */
# ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
# endif
YYFPRINTF (stderr, ")\n");
}
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
YYDPRINTF ((stderr, "Shifting token %d (%s), ",
yychar, yytname[yychar1]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#if YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
yystate = yyn;
goto yynewstate;
/*------ 0, 199, 0, 196, 0,
229, 180, 0, 230, 182, 0, 231, 184, 0, 232,
186, 0, 233, 188, 0, 234, 190, 0, 235, 192,
0, 0, 180, 181, 0, 236, 0, 237, 0, 259,
0, 260, 0, 244, 0, 245, 0, 263, 0, 266,
0, 274, 0, 275, 0, 276, 0, 277, 0, 280,
0, 0, 182, 183, 0, 236, 0, 237, 0, 294,
0, 263, 0, 274, 0, 266, 0, 309, 0, 313,
0, 314, 0, 303, 0, 312, 0, 310, 0, 275,
0, 276, 0, 277, 0, 0, 184, 185, 0, 236,
0, 237, 0, 263, 0, 274, 0, 266, 0, 309,
0, 313, 0, 314, 0, 275, 0, 276, 0, 277,
0, 305, 0, 306, 0, 307, 0, 0, 186, 187,
0, 236, 0, 237, 0, 294, 0, 263, 0, 274,
0, 266, 0, 309, 0, 313, 0, 314, 0, 275,
0, 276, 0, 277, 0, 189, 0, 188, 189, 0,
236, 0, 237, 0, 244, 0, 246, 0, 263, 0,
266, 0, 274, 0, 275, 0, 276, 0, 277, 0,
0, 190, 191, 0, 263, 0, 266, 0, 274, 0,
276, 0, 277, 0, 283, 0, 0, 192, 193, 0,
236, 0, 237, 0, 294, 0, 263, 0, 274, 0,
266, 0, 309, 0, 313, 0, 314, 0, 275, 0,
276, 0, 277, 0, 8, 267, 174, 269, 175, 271,
316, 0, 8, 267, 271, 316, 0, 8, 267, 153,
174, 269, 175, 271, 316, 0, 8, 11, 85, 0,
8, 17, 0, 8, 9, 78, 0, 8, 9, 12,
0, 8, 9, 12, 10, 77, 0, 8, 126, 124,
78, 0, 8, 126, 124, 78, 125, 85, 0, 8,
126, 125, 85, 0, 8, 29, 78, 0, 8, 35,
78, 0, 8, 129, 202, 0, 203, 0, 202, 203,
0, 169, 262, 252, 251, 0, 8, 13, 207, 262,
0, 8, 49, 174, 272, 175, 0, 8, 14, 40,
85, 209, 0, 208, 0, 207, 208, 0, 77, 242,
243, 252, 251, 0, 77, 40, 85, 242, 243, 252,
251, 0, 0, 209, 210, 0, 211, 0, 214, 0,
217, 0, 221, 0, 213, 0, 212, 218, 219, 220,
0, 26, 0, 26, 24, 0, 24, 26, 0, 26,
25, 0, 25, 26, 0, 213, 23, 78, 0, 213,
27, 78, 0, 213, 28, 0, 215, 0, 216, 0,
51, 24, 0, 24, 51, 0, 51, 25, 0, 25,
51, 0, 16, 77, 0, 23, 78, 0, 0, 27,
78, 0, 0, 28, 0, 15, 77, 176, 77, 228,
0, 15, 78, 0, 15, 19, 78, 0, 15, 20,
78, 0, 15, 22, 78, 0, 0, 15, 78, 222,
226, 0, 0, 15, 19, 78, 223, 226, 0, 0,
15, 20, 78, 224, 226, 0, 0, 15, 22, 78,
225, 226, 0, 15, 77, 0, 227, 0, 226, 227,
0, 77, 0, 0, 18, 0, 98, 83, 35, 78,
0, 98, 83, 38, 78, 0, 100, 83, 38, 78,
0, 99, 83, 38, 78, 0, 101, 83, 38, 78,
0, 102, 83, 16, 77, 0, 103, 83, 0, 104,
83, 38, 78, 0, 36, 238, 0, 36, 238, 239,
0, 37, 238, 0, 37, 238, 239, 0, 240, 0,
238, 240, 0, 241, 0, 239, 241, 0, 77, 0,
78, 0, 127, 77, 0, 128, 77, 0, 127, 85,
0, 128, 85, 0, 0, 131, 77, 0, 0, 132,
77, 0, 3, 7, 247, 248, 250, 253, 262, 300,
5, 298, 302, 0, 3, 7, 164, 169, 264, 262,
300, 5, 298, 302, 0, 3, 7, 249, 250, 253,
262, 300, 5, 298, 302, 0, 3, 7, 157, 315,
261, 262, 300, 5, 298, 302, 0, 0, 39, 77,
0, 40, 85, 0, 50, 78, 0, 0, 41, 43,
0, 41, 44, 252, 251, 0, 41, 42, 0, 0,
143, 77, 0, 0, 140, 0, 141, 0, 142, 0,
139, 0, 0, 45, 58, 257, 0, 45, 56, 0,
45, 67, 0, 45, 69, 0, 45, 59, 0, 45,
57, 256, 0, 45, 62, 0, 45, 63, 0, 45,
70, 0, 45, 71, 0, 45, 66, 0, 45, 64,
0, 45, 65, 0, 45, 76, 0, 45, 61, 0,
45, 60, 0, 45, 68, 0, 45, 72, 0, 45,
73, 0, 45, 74, 0, 45, 75, 0, 254, 0,
255, 0, 254, 255, 0, 30, 77, 0, 31, 77,
0, 0, 122, 78, 0, 122, 78, 54, 77, 0,
258, 0, 257, 6, 258, 0, 87, 295, 85, 86,
0, 88, 295, 85, 86, 0, 89, 295, 85, 86,
0, 90, 295, 85, 86, 0, 91, 295, 85, 86,
0, 92, 295, 85, 86, 0, 93, 295, 85, 86,
0, 94, 295, 85, 86, 0, 95, 295, 85, 86,
0, 96, 295, 85, 86, 0, 3, 134, 166, 300,
5, 298, 0, 3, 134, 167, 300, 5, 298, 0,
0, 33, 85, 0, 0, 52, 85, 135, 0, 3,
85, 53, 85, 32, 5, 52, 0, 0, 165, 265,
77, 0, 172, 0, 173, 0, 267, 174, 269, 175,
271, 316, 0, 267, 271, 316, 0, 267, 153, 174,
269, 175, 271, 316, 0, 268, 0, 47, 79, 0,
48, 79, 0, 270, 0, 269, 270, 0, 134, 0,
54, 0, 46, 0, 161, 0, 155, 0, 128, 0,
157, 0, 130, 0, 160, 0, 152, 0, 159, 0,
150, 0, 107, 0, 151, 0, 52, 0, 133, 0,
127, 0, 36, 0, 37, 0, 53, 0, 156, 0,
0, 49, 174, 272, 175, 0, 273, 0, 272, 273,
0, 80, 0, 81, 0, 82, 0, 55, 85, 32,
0, 113, 114, 0, 113, 115, 0, 113, 116, 0,
121, 84, 0, 123, 278, 0, 279, 0, 278, 279,
0, 83, 0, 3, 281, 300, 5, 298, 302, 0,
282, 0, 281, 282, 0, 286, 0, 289, 0, 290,
0, 291, 0, 3, 284, 300, 5, 298, 302, 0,
285, 0, 284, 285, 0, 291, 0, 289, 0, 287,
0, 117, 295, 85, 86, 0, 288, 295, 85, 86,
0, 118, 0, 119, 0, 120, 0, 108, 295, 293,
308, 0, 108, 295, 85, 86, 0, 109, 295, 293,
308, 0, 109, 295, 85, 86, 0, 105, 295, 85,
0, 292, 295, 293, 0, 110, 0, 111, 0, 112,
0, 97, 0, 85, 0, 3, 133, 295, 85, 296,
300, 5, 298, 302, 0, 3, 134, 133, 300, 5,
298, 0, 0, 170, 0, 171, 0, 172, 0, 173,
0, 134, 0, 0, 135, 0, 136, 0, 137, 0,
138, 0, 47, 0, 155, 238, 0, 155, 238, 239,
0, 53, 0, 36, 0, 37, 0, 156, 0, 297,
0, 297, 0, 0, 85, 32, 0, 85, 85, 32,
0, 0, 85, 32, 0, 85, 85, 32, 0, 0,
4, 3, 162, 301, 5, 299, 0, 4, 3, 163,
301, 5, 299, 0, 3, 7, 304, 54, 300, 5,
298, 302, 0, 3, 7, 304, 54, 31, 77, 300,
5, 298, 302, 0, 3, 134, 304, 54, 300, 5,
298, 0, 0, 20, 0, 21, 0, 3, 148, 295,
85, 300, 5, 298, 302, 0, 3, 148, 295, 85,
86, 300, 5, 298, 302, 0, 3, 149, 295, 293,
308, 300, 5, 298, 302, 0, 3, 149, 295, 85,
86, 300, 5, 298, 302, 0, 3, 134, 168, 300,
5, 298, 0, 144, 0, 145, 0, 146, 0, 147,
0, 3, 7, 150, 85, 300, 5, 298, 302, 0,
3, 311, 152, 78, 300, 5, 298, 0, 3, 311,
152, 77, 300, 5, 298, 0, 154, 311, 152, 78,
0, 154, 311, 152, 77, 0, 0, 153, 0, 3,
151, 295, 85, 308, 300, 5, 298, 302, 0, 3,
134, 151, 300, 5, 298, 0, 3, 7, 127, 77,
300, 5, 298, 302, 0, 3, 7, 127, 85, 300,
5, 298, 302, 0, 3, 7, 128, 77, 300, 5,
298, 302, 0, 3, 7, 128, 85, 300, 5, 298,
302, 0, 41, 158, 0, 0, 34, 85, 0, 34,
85, 32, 0
};
#endif
#if YYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const short yyrline[] =
{
0, 283, 284, 287, 288, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
306, 307, 308, 311, 312, 315, 316, 317, 318, 319,
320, 321, 322, 323, 324, 325, 326, 327, 330, 331,
334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
344, 345, 346, 347, 348, 351, 352, 355, 356, 357,
358, 359, 360, 361, 362, 363, 364, 365, 366, 367,
368, 371, 372, 375, 376, 377, 378, 379, 380, 381,
382, 383, 384, 385, 386, 389, 390, 393, 394, 395,
396, 397, 398, 399, 400, 401, 402, 405, 406, 409,
410, 411, 412, 413, 414, 417, 418, 421, 422, 423,
424, 425, 426, 427, 428, 429, 430, 431, 432, 435,
438, 441, 446, 455, 460, 468, 471, 476, 479, 483,
489, 494, 502, 505, 506, 509, 515, 520, 537, 543,
544, 547, 566, 585, 586, 589, 590, 591, 592, 595,
596, 604, 605, 606, 609, 610, 611, 612, 613, 616,
617, 620, 621, 624, 625, 628, 631, 640, 641, 651,
655, 661, 664, 668, 672, 676, 680, 680, 687, 687,
694, 694, 701, 701, 708, 716, 717, 720, 724, 725,
728, 732, 738, 744, 750, 757, 764, 772, 778, 779,
782, 783, 786, 787, 790, 791, 794, 795, 798, 799,
800, 801, 804, 805, 808, 809, 812, 818, 827, 835,
845, 851, 854, 857, 862, 865, 868, 876, 881, 882,
885, 886, 887, 888, 889, 892, 895, 898, 901, 904,
907, 910, 913, 916, 919, 922, 925, 928, 931, 935,
938, 941, 944, 947, 950, 953, 956, 959, 964, 965,
968, 969, 972, 973, 977, 983, 984, 987, 991, 995,
999, 1003, 1007, 1011, 1015, 1019, 1023, 1029, 1035, 1041,
1044, 1049, 1052, 1057, 1065, 1066, 1072, 1073, 1076, 1079,
1082, 1085, 1090, 1093, 1096, 1097, 1100, 1101, 1102, 1103,
1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113,
1114, 1115, 1116, 1119, 1120, 1121, 1122, 1125, 1126, 1129,
1130, 1133, 1134, 1135, 1138, 1145, 1148, 1151, 1157, 1161,
1164, 1165, 1168, 1171, 1178, 1179, 1182, 1183, 1184, 1185,
1188, 1195, 1196, 1199, 1200, 1201, 1204, 1211, 1218, 1219,
1220, 1223, 1229, 1234, 1240, 1247, 1254, 1261, 1262, 1263,
1266, 1267, 1270, 1278, 1286, 1287, 1288, 1289, 1290, 1291,
1294, 1295, 1296, 1297, 1298, 1301, 1302, 1303, 1304, 1305,
1306, 1307, 1310, 1319, 1328, 1329, 1337, 1351, 1352, 1360,
1374, 1377, 1380, 1385, 1390, 1397, 1404, 1405, 1406, 1409,
1416, 1425, 1440, 1449, 1455, 1456, 1457, 1458, 1461, 1468,
1475, 1481, 1488, 1496, 1499, 1505, 1511, 1519, 1525, 1532,
1538, 1545, 1548, 1549, 1550
};
#endif
#if (YYDEBUG) || defined YYERROR_VERBOSE
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
{
"$", "error", "$undefined.", "IF", "ELSE", "THEN", "OR", "FAILED", "SET",
"LOGFILE", "FACILITY", "DAEMON", "SYSLOG", "MAILSERVER", "HTTPD",
"ALLOW", "ADDRESS", "INIT", "READONLY", "CLEARTEXT", "MD5HASH",
"SHA1HASH", "CRYPT", "PEMFILE", "ENABLE", "DISABLE", "HTTPDSSL",
"CLIENTPEMFILE", "ALLOWSELFCERTIFICATION", "STATEFILE", "SEND",
"EXPECT", "CYCLE", "COUNT", "REMINDER", "PIDFILE", "START", "STOP",
"PATHTOK", "HOST", "PORT", "TYPE", "UDP", "TCP", "TCPSSL", "PROTOCOL",
"CONNECTION", "ALERT", "NOALERT", "MAILFORMAT", "UNIXSOCKET",
"SIGNATURE", "TIMEOUT", "RESTART", "CHECKSUM", "EVERY", "DEFAULT",
"HTTP", "APACHESTATUS", "FTP", "SMTP", "POP", "IMAP", "CLAMAV", "NNTP",
"NTP3", "MYSQL", "DNS", "SSH", "DWP", "LDAP2", "LDAP3", "RDATE",
"RSYNC", "TNS", "PGSQL", "POSTFIXPOLICY", "STRING", "PATH", "MAILADDR",
"MAILFROM", "MAILSUBJECT", "MAILBODY", "SERVICENAME", "STRINGNAME",
"NUMBER", "PERCENT", "LOGLIMIT", "CLOSELIMIT", "DNSLIMIT",
"KEEPALIVELIMIT", "REPLYLIMIT", "REQUESTLIMIT", "STARTLIMIT",
"WAITLIMIT", "GRACEFULLIMIT", "CLEANUPLIMIT", "REAL", "CHECKPROC",
"CHECKDEV", "CHECKFILE", "CHECKDIR", "CHECKHOST", "CHECKSYSTEM",
"CHECKFIFO", "CHILDREN", "SYSTEM", "RESOURCE", "MEMORY", "TOTALMEMORY",
"LOADAVG1", "LOADAVG5", "LOADAVG15", "MODE", "ACTIVE", "PASSIVE",
"MANUAL", "CPU", "CPUUSER", "CPUSYSTEM", "CPUWAIT", "GROUP", "REQUEST",
"DEPENDS", "BASEDIR", "SLOT", "EVENTQUEUE", "UID", "GID", "COLLECTOR",
"INSTANCE", "USERNAME", "PASSWORD", "TIMESTAMP", "CHANGED", "SECOND",
"MINUTE", "HOUR", "DAY", "SSLAUTO", "SSLV2", "SSLV3", "TLSV1",
"CERTMD5", "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE", "INODE", "SPACE",
"PERMISSION", "SIZE", "MATCH", "NOT", "IGNORE", "EXEC", "UNMONITOR",
"ICMP", "ICMPECHO", "NONEXIST", "INVALID", "DATA", "RECOVERED",
"PASSED", "URL", "CONTENT", "PID", "PPID", "FSFLAG", "URLOBJECT",
"GREATER", "LESS", "EQUAL", "NOTEQUAL", "'{'", "'}'", "':'", "cfgfile",
"statement_list", "statement", "optproclist", "optproc", "optfilelist",
"optfile", "optdevlist", "optdev", "optdirlist", "optdir",
"opthostlist", "opthost", "optsystemlist", "optsystem", "optfifolist",
"optfifo", "setalert", "setdaemon", "setinit", "setlog",
"seteventqueue", "setstate", "setpid", "setcollectors", "collectorlist",
"collector", "setmailservers", "setmailformat", "sethttpd",
"mailserverlist", "mailserver", "httpdlist", "httpdoption", "ssl",
"sslenable", "ssldisable", "signature", "sigenable", "sigdisable",
"bindaddress", "pemfile", "clientpemfile", "allowselfcert", "allow",
"@1", "@2", "@3", "@4", "allowuserlist", "allowuser", "readonly",
"checkproc", "checkfile", "checkdev", "checkdir", "checkhost",
"checksystem", "checkfifo", "start", "stop", "argumentlist",
"useroptionlist", "argument", "useroption", "username", "password",
"connection", "connectionunix", "icmp", "host", "port", "unixsocket",
"type", "certmd5", "sslversion", "protocol", "sendexpectlist",
"sendexpect", "request", "apache_stat_list", "apache_stat", "pid",
"ppid", "icmpcount", "nettimeout", "timeout", "urloption",
"urloperator", "alert", "alertmail", "noalertmail", "eventoptionlist",
"eventoption", "formatlist", "formatoptionlist", "formatoption",
"every", "mode", "group", "depend", "dependlist", "dependant",
"resourceprocess", "resourceprocesslist", "resourceprocessopt",
"resourcesystem", "resourcesystemlis-----------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
Otherwise, the following line sets YYVAL to the semantic value of
the lookahead token. This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
#if YYLSP_NEEDED
/* Similarly for the default location. Let the user run additional
commands if for instance locations are ranges. */
yyloc = yylsp[1-yylen];
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif
#if YYDEBUG
/* We have to keep this `#if YYDEBUG', since we use variables which
are defined only if `YYDEBUG' is set. */
if (yydebug)
{
int yyi;
YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
switch (yyn) {
case 119:
#line 435 "p.y"
{
addmail(yyvsp[-5].string, &mailset, &Run.maillist, eventset, yyvsp[0].number);
}
break;
case 120:
#line 438 "p.y"
{
addmail(yyvsp[-2].string, &mailset, &Run.maillist, EVENT_ALL, yyvsp[0].number);
}
break;
case 121:
#line 441 "p.y"
{
addmail(yyvsp[-6].string, &mailset, &Run.maillist, ~eventset, yyvsp[0].number);
}
break;
case 122:
#line 446 "p.y"
{
if(!Run.isdaemon || ihp.daemon) {
ihp.daemon= TRUE;
Run.isdaemon= TRUE;
Run.polltime= yyvsp[0].number;
}
}
break;
case 123:
#line 455 "p.y"
{
Run.init= TRUE;
}
break;
case 124:
#line 460 "p.y"
{
if(!Run.logfile || ihp.logfile) {
ihp.logfile= TRUE;
setlogfile(yyvsp[0].string);
Run.use_syslog= FALSE;
Run.dolog=TRUE;
}
}
break;
case 125:
#line 468 "p.y"
{
setsyslog(NULL);
}
break;
case 126:
#line 471 "p.y"
{
setsyslog(yyvsp[0].string); FREE(yyvsp[0].string);
}
break;
case 127:
#line 476 "p.y"
{
Run.eventlist_dir= yyvsp[0].string;
}
break;
case 128:
#line 479 "p.y"
{
Run.eventlist_dir= yyvsp[-2].string;
Run.eventlist_slots= yyvsp[0].number;
}
break;
case 129:
#line 483 "p.y"
{
Run.eventlist_dir= xstrdup(MYEVENTLISTBASE);
Run.eventlist_slots= yyvsp[0].number;
}
break;
case 130:
#line 489 "p.y"
{
Run.statefile= yyvsp[0].string;
}
break;
case 131:
#line 494 "p.y"
{
if(!Run.pidfile || ihp.pidfile) {
ihp.pidfile= TRUE;
setpidfile(yyvsp[0].string);
}
}
break;
case 135:
#line 509 "p.y"
{
check_hostname((yyvsp[-3].url)->hostname);
addcollector(yyvsp[-3].url, yyvsp[-2].number, yyvsp[-1].number, yyvsp[0].string);
}
break;
case 136:
#line 515 "p.y"
{
Run.mailserver_timeout= yyvsp[0].number;
}
break;
case 137:
#line 520 "p.y"
{
Run.MailFormat.from=
mailset.from?
mailset.from:
xstrdup(ALERT_FROM);
Run.MailFormat.subject=
mailset.subject?
mailset.subject:
xstrdup(ALERT_SUBJECT);
Run.MailFormat.message=
mailset.message?
mailset.message:
xstrdup(ALERT_MESSAGE);
reset_mailset();
}
break;
case 138:
#line 537 "p.y"
{
Run.dohttpd= TRUE;
Run.httpdport= yyvsp[-1].number;
}
break;
case 141:
#line 547 "p.y"
{
/* Restore the current text overriden by lookahead */
FREE(argyytext);
argyytext= xstrdup(yyvsp[-4].string);
check_hostname(yyvsp[-4].string);
mailserverset.host = yyvsp[-4].string;
mailserverset.username = yyvsp[-3].string;
mailserverset.password = yyvsp[-2].string;
mailserverset.ssl.version= yyvsp[-1].number;
if(mailserverset.ssl.version != SSL_VERSION_NONE) {
mailserverset.ssl.use_ssl= TRUE;
if(mailserverset.ssl.version == SSL_VERSION_SSLV2 ||
mailserverset.ssl.version == SSL_VERSION_SSLV3)
mailserverset.port = PORT_SMTPS;
mailserverset.ssl.certmd5= yyvsp[0].string;
}
addmailserver(&mailserverset);
}
break;
case 142:
#line 566 "p.y"
{
/* Restore the current text overriden by lookahead */
FREE(argyytext);
argyytext= xstrdup(yyvsp[-6].string);
check_hostname(yyvsp[-6].string);
mailserverset.host = yyvsp[-6].string;
mailserverset.port = yyvsp[-4].number;
mailserverset.username = yyvsp[-3].string;
mailserverset.password = yyvsp[-2].string;
mailserverset.ssl.version= yyvsp[-1].number;
if(mailserverset.ssl.version != SSL_VERSION_NONE) {
mailserverset.ssl.use_ssl= TRUE;
mailserverset.ssl.certmd5= yyvsp[0].string;
}
addmailserver(&mailserverset);
}
break;
case 149:
#line 595 "p.y"
{ Run.httpdssl= FALSE; }
break;
case 150:
#line 596 "p.y"
{
Run.httpdssl= TRUE;
if(!have_ssl()) {
yyerror("SSL is not supported");
}
}
break;
case 156:
#line 611 "p.y"
{ FREE(yyvsp[0].string); }
break;
case 157:
#line 612 "p.y"
{ FREE(yyvsp[0].string); }
break;
case 159:
#line 616 "p.y"
{ Run.httpdsig= TRUE; }
break;
case 160:
#line 617 "p.y"
{ Run.httpdsig= FALSE; }
break;
case 165:
#line 628 "p.y"
{ Run.bind_addr= yyvsp[0].string; }
break;
case 166:
#line 631 "p.y"
{
Run.httpsslpem= yyvsp[0].string;
if(!File_checkStat(Run.httpsslpem,
"SSL server PEM file", S_IRWXU)) {
yyerror2("SSL server PEM file has too loose permissions");
}
}
break;
case 168:
#line 641 "p.y"
{
Run.httpsslclientpem= yyvsp[0].string;
Run.clientssl= TRUE;
if(!File_checkStat(Run.httpsslclientpem,
"SSL client PEM file", S_IRWXU | S_IRGRP | S_IROTH)) {
yyerror2("SSL client PEM file has too loose permissions");
}
}
break;
case 169:
#line 651 "p.y"
{
Run.allowselfcert= FALSE;
config_ssl(Run.allowselfcert);
}
break;
case 170:
#line 655 "p.y"
{
Run.allowselfcert= TRUE;
config_ssl(Run.allowselfcert);
}
break;
case 171:
#line 661 "p.y"
{
addcredentials(yyvsp[-3].string,yyvsp[-1].string, DIGEST_CLEARTEXT, yyvsp[0].number);
}
break;
case 172:
#line 664 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_CLEARTEXT);
FREE(yyvsp[0].string);
}
break;
case 173:
#line 668 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_CLEARTEXT);
FREE(yyvsp[0].string);
}
break;
case 174:
#line 672 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_MD5);
FREE(yyvsp[0].string);
}
break;
case 175:
#line 676 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_CRYPT);
FREE(yyvsp[0].string);
}
break;
case 176:
#line 680 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= CLEARTEXT;
}
break;
case 177:
#line 684 "p.y"
{
FREE(htpasswd_file);
}
break;
case 178:
#line 687 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= DIGEST_CLEARTEXT;
}
break;
case 179:
#line 691 "p.y"
{
FREE(htpasswd_file);
}
break;
case 180:
#line 694 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= DIGEST_MD5;
}
break;
case 181:
#line 698 "p.y"
{
FREE(htpasswd_file);
}
break;
case 182:
#line 701 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= DIGEST_CRYPT;
}
break;
case 183:
#line 705 "p.y"
{
FREE(htpasswd_file);
}
break;
case 184:
#line 708 "p.y"
{
if(! (add_net_allow(yyvsp[0].string) || add_host_allow(yyvsp[0].string))) {
yyerror2("erroneous network or host identifier %s", yyvsp[0].string);
}
FREE(yyvsp[0].string);
}
break;
case 187:
#line 720 "p.y"
{ addhtpasswdentry(htpasswd_file, yyvsp[0].string, digesttype);
FREE(yyvsp[0].string); }
break;
case 188:
#line 724 "p.y"
{ yyval.number= FALSE; }
break;
case 189:
#line 725 "p.y"
{ yyval.number= TRUE; }
break;
case 190:
#line 728 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_PROCESS, yyvsp[-2].string, yyvsp[0].string, check_process);
}
break;
case 191:
#line 732 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_PROCESS, yyvsp[-2].string, yyvsp[0].string, check_process);
}
break;
case 192:
#line 738 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_FILE, yyvsp[-2].string, yyvsp[0].string, check_file);
}
break;
case 193:
#line 744 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_DEVICE, yyvsp[-2].string, yyvsp[0].string, check_device);
}
break;
case 194:
#line 750 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_DIRECTORY, yyvsp[-2].string, yyvsp[0].string,
check_directory);
}
break;
case 195:
#line 757 "p.y"
{
check_hostname(yyvsp[0].string);
check_name(yyvsp[-2].string);
createservice(TYPE_HOST, yyvsp[-2].string, yyvsp[0].string, check_remote_host);
}
break;
case 196:
#line 764 "p.y"
{
check_name(yyvsp[0].string);
createservice(TYPE_SYSTEM, yyvsp[0].string, xstrdup(""),
check_system);
hassystem = TRUE;
}
break;
case 197:
#line 772 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_FIFO, yyvsp[-2].string, yyvsp[0].string, check_fifo);
}
break;
case 198:
#line 778 "p.y"
{ addcommand(START); }
break;
case 199:
#line 779 "p.y"
{ addcommand(START); }
break;
case 200:
#line 782 "p.y"
{ addcommand(STOP); }
break;
case 201:
#line 783 "p.y"
{ addcommand(STOP); }
break;
case 206:
#line 794 "p.y"
{ addargument(yyvsp[0].string); }
break;
case 207:
#line 795 "p.y"
{ addargument(yyvsp[0].string); }
break;
case 208:
#line 798 "p.y"
{ addeuid( get_uid(yyvsp[0].string, 0) ); FREE(yyvsp[0].string); }
break;
case 209:
#line 799 "p.y"
{ addegid( get_gid(yyvsp[0].string, 0) ); FREE(yyvsp[0].string); }
break;
case 210:
#line 800 "p.y"
{ addeuid( get_uid(NULL, yyvsp[0].number) ); }
break;
case 211:
#line 801 "p.y"
{ addegid( get_gid(NULL, yyvsp[0].number) ); }
break;
case 212:
#line 804 "p.y"
{ yyval.string= NULL; }
break;
case 213:
#line 805 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 214:
#line 808 "p.y"
{ yyval.string= NULL; }
break;
case 215:
#line 809 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 216:
#line 813 "p.y"
{
portset.timeout= yyvsp[-4].number;
addeventaction(&(portset).action, yyvsp[-1].number, yyvsp[0].number);
addport(&portset);
}
break;
case 217:
#line 819 "p.y"
{
prepare_urlrequest(yyvsp[-6].url);
portset.timeout= yyvsp[-4].number;
addeventaction(&(portset).action, yyvsp[-1].number, yyvsp[0].number);
addport(&portset);
}
break;
case 218:
#line 828 "p.y"
{
portset.timeout= yyvsp[-4].number;
addeventaction(&(portset).action, yyvsp[-1].number, yyvsp[0].number);
addport(&portset);
}
break;
case 219:
#line 836 "p.y"
{
icmpset.type= yyvsp[-6].number;
icmpset.count= yyvsp[-5].number;
icmpset.timeout= yyvsp[-4].number;
addeventaction(&(icmpset).action, yyvsp[-1].number, yyvsp[0].number);
addicmp(&icmpset);
}
break;
case 220:
#line 845 "p.y"
{
if(current->type == TYPE_HOST)
portset.hostname= xstrdup(current->path);
else
portset.hostname= xstrdup(LOCALHOST);
}
break;
case 221:
#line 851 "p.y"
{ check_hostname(yyvsp[0].string); portset.hostname= yyvsp[0].string; }
break;
case 222:
#line 854 "p.y"
{ portset.port= yyvsp[0].number; portset.family= AF_INET; }
break;
case 223:
#line 857 "p.y"
{
portset.pathname= yyvsp[0].string; portset.family= AF_UNIX;
}
break;
case 224:
#line 862 "p.y"
{
portset.type= SOCK_STREAM;
}
break;
case 225:
#line 865 "p.y"
{
portset.type= SOCK_STREAM;
}
break;
case 226:
#line 868 "p.y"
{
portset.type= SOCK_STREAM;
portset.SSL.use_ssl= TRUE;
portset.SSL.version= yyvsp[-1].number;
if(portset.SSL.version == SSL_VERSION_NONE)
portset.SSL.version = SSL_VERSION_AUTO;
portset.SSL.certmd5= yyvsp[0].string;
}
break;
case 227:
#line 876 "p.y"
{
portset.type= SOCK_DGRAM;
}
break;
case 228:
#line 881 "p.y"
{ yyval.string= NULL; }
break;
case 229:
#line 882 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 230:
#line 885 "p.y"
{ yyval.number= SSL_VERSION_NONE; }
break;
case 231:
#line 886 "p.y"
{t", "resourcesystemopt",
"resourcecpuproc", "resourcecpu", "resourcecpuid", "resourcemem",
"resourcechild", "resourceload", "resourceloadavg", "value",
"timestamp", "operator", "time", "action", "action1", "action2",
"rate1", "rate2", "recovery", "checksum", "hashtype", "inode", "space",
"fsflag", "unit", "permission", "match", "matchflagnot", "size", "uid",
"gid", "icmptype", "reminder", 0
};
#endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const short yyr1[] =
{
0, 177, 177, 178, 178, 179, 179, 179, 179, 179,
179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
179, 179, 179, 180, 180, 181, 181, 181, 181, 181,
181, 181, 181, 181, 181, 181, 181, 181, 182, 182,
183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
183, 183, 183, 183, 183, 184, 184, 185, 185, 185,
185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
185, 186, 186, 187, 187, 187, 187, 187, 187, 187,
187, 187, 187, 187, 187, 188, 188, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 190, 190, 191,
191, 191, 191, 191, 191, 192, 192, 193, 193, 193,
193, 193, 193, 193, 193, 193, 193, 193, 193, 194,
194, 194, 195, 196, 197, 197, 197, 198, 198, 198,
199, 200, 201, 202, 202, 203, 204, 205, 206, 207,
207, 208, 208, 209, 209, 210, 210, 210, 210, 211,
211, 212, 212, 212, 213, 213, 213, 213, 213, 214,
214, 215, 215, 216, 216, 217, 218, 219, 219, 220,
220, 221, 221, 221, 221, 221, 222, 221, 223, 221,
224, 221, 225, 221, 221, 226, 226, 227, 228, 228,
229, 229, 230, 231, 232, 233, 234, 235, 236, 236,
237, 237, 238, 238, 239, 239, 240, 240, 241, 241,
241, 241, 242, 242, 243, 243, 244, 244, 245, 246,
247, 247, 248, 249, 250, 250, 250, 250, 251, 251,
252, 252, 252, 252, 252, 253, 253, 253, 253, 253,
253, 253, 253, 253, 253, 253, 253, 253, 253, 253,
253, 253, 253, 253, 253, 253, 253, 253, 254, 254,
255, 255, 256, 256, 256, 257, 257, 258, 258, 258,
258, 258, 258, 258, 258, 258, 258, 259, 260, 261,
261, 262, 262, 263, 264, 264, 265, 265, 266, 266,
266, 266, 267, 268, 269, 269, 270, 270, 270, 270,
270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
270, 270, 270, 270, 270, 270, 270, 271, 271, 272,
272, 273, 273, 273, 274, 275, 275, 275, 276, 277,
278, 278, 279, 280, 281, 281, 282, 282, 282, 282,
283, 284, 284, 285, 285, 285, 286, 287, 288, 288,
288, 289, 289, 289, 289, 290, 291, 292, 292, 292,
293, 293, 294, 294, 295, 295, 295, 295, 295, 295,
296, 296, 296, 296, 296, 297, 297, 297, 297, 297,
297, 297, 298, 299, 300, 300, 300, 301, 301, 301,
302, 302, 302, 303, 303, 303, 304, 304, 304, 305,
305, 306, 306, 307, 308, 308, 308, 308, 309, 310,
310, 310, 310, 311, 311, 312, 312, 313, 313, 314,
314, 315, 316, 316, 316
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const short yyr2[] =
{
0, 0, 1, 1, 2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 2, 2, 0, 2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 2, 1,
1, 1, 1, 1, 1, 0, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 7,
4, 8, 3, 2, 3, 3, 5, 4, 6, 4,
3, 3, 3, 1, 2, 4, 4, 5, 5, 1,
2, 5, 7, 0, 2, 1, 1, 1, 1, 1,
4, 1, 2, 2, 2, 2, 3, 3, 2, 1,
1, 2, 2, 2, 2, 2, 2, 0, 2, 0,
1, 5, 2, 3, 3, 3, 0, 4, 0, 5,
0, 5, 0, 5, 2, 1, 2, 1, 0, 1,
4, 4, 4, 4, 4, 4, 2, 4, 2, 3,
2, 3, 1, 2, 1, 2, 1, 1, 2, 2,
2, 2, 0, 2, 0, 2, 11, 10, 10, 10,
0, 2, 2, 2, 0, 2, 4, 2, 0, 2,
0, 1, 1, 1, 1, 0, 3, 2, 2, 2,
2, 3, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 1, 1, 2,
2, 2, 0, 2, 4, 1, 3, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 6, 6, 0,
2, 0, 3, 7, 0, 3, 1, 1, 6, 3,
7, 1, 2, 2, 1, 2, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 4, 1,
2, 1, 1, 1, 3, 2, 2, 2, 2, 2,
1, 2, 1, 6, 1, 2, 1, 1, 1, 1,
6, 1, 2, 1, 1, 1, 4, 4, 1, 1,
1, 4, 4, 4, 4, 3, 3, 1, 1, 1,
1, 1, 9, 6, 0, 1, 1, 1, 1, 1,
0, 1, 1, 1, 1, 1, 2, 3, 1, 1,
1, 1, 1, 1, 0, 2, 3, 0, 2, 3,
0, 6, 6, 8, 10, 7, 0, 1, 1, 8,
9, 9, 9, 6, 1, 1, 1, 1, 8, 7,
7, 4, 4, 0, 1, 9, 6, 8, 8, 8,
8, 2, 0, 2, 3
};
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
doesn't specify something else to do. Zero means the default is an
error. */
static const short yydefact[] =
{
1, 0, 0, 0, 0, 0, 0, 0, 0, 2,
3, 5, 6, 15, 7, 8, 14, 13, 9, 10,
11, 12, 23, 38, 55, 71, 0, 97, 105, 0,
0, 0, 0, 123, 0, 0, 0, 0, 0, 0,
317, 0, 0, 0, 0, 0, 196, 0, 4, 16,
17, 18, 19, 0, 0, 0, 0, 0, 0, 0,
0, 20, 85, 87, 88, 89, 90, 91, 92, 317,
291, 93, 94, 95, 96, 21, 22, 125, 124, 122,
212, 281, 139, 0, 130, 131, 292, 0, 0, 0,
281, 132, 133, 0, 0, 0, 422, 0, 0, 0,
0, 0, 0, 0, 0, 24, 25, 26, 29, 30,
27, 28, 31, 32, 33, 34, 35, 36, 37, 413,
413, 39, 40, 41, 43, 45, 44, 52, 53, 54,
42, 49, 46, 51, 50, 47, 48, 0, 56, 57,
58, 59, 61, 60, 65, 66, 67, 68, 69, 70,
62, 63, 64, 0, 72, 73, 74, 76, 78, 77,
82, 83, 84, 75, 79, 80, 81, 220, 0, 206,
207, 198, 202, 200, 293, 0, 325, 326, 327, 328,
332, 329, 330, 86, 0, 0, 422, 0, 98, 99,
100, 101, 102, 103, 104, 106, 107, 108, 110, 112,
111, 116, 117, 118, 109, 113, 114, 115, 0, 0,
0, 214, 0, 140, 136, 143, 321, 322, 323, 0,
319, 127, 129, 230, 134, 0, 0, 313, 314, 298,
310, 315, 297, 308, 312, 301, 303, 311, 296, 307,
309, 305, 300, 316, 302, 306, 304, 299, 0, 294,
0, 120, 190, 191, 193, 192, 194, 195, 197, 220,
364, 364, 364, 357, 358, 359, 364, 0, 384, 334,
336, 337, 338, 339, 364, 396, 364, 396, 364, 414,
0, 0, 0, 0, 364, 364, 0, 0, 0, 0,
0, 0, 0, 0, 199, 203, 204, 201, 324, 331,
0, 0, 289, 348, 349, 350, 384, 341, 345, 364,
344, 343, 126, 212, 213, 0, 230, 0, 138, 137,
320, 0, 234, 231, 232, 233, 228, 0, 0, 317,
295, 423, 0, 224, 369, 365, 366, 367, 368, 0,
0, 0, 0, 384, 384, 0, 335, 0, 0, 397,
398, 0, 0, 0, 0, 0, 384, 384, 0, 0,
0, 0, 384, 0, 0, 221, 0, 279, 284, 0,
224, 0, 208, 210, 209, 211, 205, 0, 317, 342,
0, 0, 214, 215, 228, 282, 0, 0, 0, 0,
151, 0, 144, 145, 0, 149, 146, 159, 160, 147,
148, 128, 0, 135, 318, 317, 422, 424, 223, 0,
235, 355, 361, 360, 0, 361, 0, 0, 0, 0,
385, 0, 0, 361, 356, 384, 384, 384, 384, 384,
384, 370, 0, 0, 384, 0, 384, 384, 412, 411,
0, 384, 361, 0, 421, 0, 281, 0, 281, 222,
235, 0, 317, 422, 0, 0, 230, 141, 0, 0,
0, 184, 172, 165, 153, 162, 155, 164, 152, 154,
161, 163, 0, 167, 0, 0, 158, 229, 422, 119,
227, 225, 230, 0, 0, 0, 281, 257, 258, 352,
404, 405, 406, 407, 351, 354, 353, 346, 0, 0,
386, 379, 380, 375, 378, 0, 381, 382, 390, 0,
0, 0, 0, 0, 0, 0, 371, 372, 373, 374,
384, 0, 0, 0, 384, 0, 0, 0, 384, 0,
384, 384, 280, 384, 286, 287, 0, 384, 281, 0,
422, 288, 390, 347, 228, 173, 174, 175, 0, 0,
166, 0, 169, 156, 157, 121, 228, 260, 261, 237,
262, 0, 240, 251, 250, 242, 243, 247, 248, 246,
238, 252, 239, 244, 245, 253, 254, 255, 256, 249,
384, 259, 277, 278, 376, 0, 333, 0, 0, 0,
0, 0, 384, 0, 0, 363, 416, 0, 0, 0,
0, 403, 0, 0, 0, 0, 0, 285, 0, 384,
283, 290, 340, 142, 0, 0, 0, 188, 187, 177,
185, 168, 170, 150, 226, 0, 241, 364, 364, 364,
364, 364, 364, 364, 364, 364, 364, 236, 265, 0,
377, 0, 390, 390, 390, 390, 390, 0, 390, 0,
395, 0, 410, 409, 0, 390, 0, 0, 0, 0,
0, 179, 181, 183, 189, 171, 186, 263, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
387, 387, 417, 418, 419, 420, 408, 0, 393, 390,
390, 390, 399, 390, 390, 390, 390, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 266,
390, 0, 0, 0, 390, 362, 415, 400, 402, 401,
219, 217, 390, 264, 267, 268, 269, 270, 271, 272,
273, 274, 275, 276, 218, 388, 0, 0, 0, 394,
216, 389, 383, 391, 392, 0, 0, 0
};
static const short yydefgoto[] =
{
745, 9, 10, 49, 105, 50, 121, 51, 138, 52,
154, 61, 62, 75, 188, 76, 195, 11, 12, 13,
14, 15, 16, 17, 18, 91, 92, 19, 20, 21,
81, 82, 318, 392, 393, 394, 395, 396, 397, 398,
399, 473, 552, 623, 400, 549, 614, 615, 616, 619,
620, 665, 22, 23, 24, 25, 26, 27, 28, 63,
64, 171, 294, 172, 296, 211, 316, 65, 109, 66,
290, 370, 333, 410, 403, 326, 486, 487, 488, 626,
637, 638, 110, 111, 446, 214, 67, 448, 536, 68,
69, 70, 248, 249, 96, 219, 220, 71, 72, 73,
74, 181, 182, 118, 268, 269, 194, 306, 307, 270,
308, 309, 271, 272, 273, 274, 414, 130, 339, 520,
507, 508, 743, 347, 712, 586, 131, 354, 147, 148,
149, 494, 132, 133, 280, 134, 135, 136, 367, 251
};
static const short yypact[] =
{
190, 61, -47, -18, -16, -3, 3, 12, 47, 190,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 214,-32768,-32768, 16,
34, 20, 172,-32768, 117, 130, 135, 49, 186, 56,
-32, 246, 192, 201, 205, 236,-32768, 216,-32768, 219,
45, 542, 569, 26, 243, 243, 222, 230, 182, 187,
174, 214,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -29,
-32768,-32768,-32768,-32768,-32768, 365, 569, 326,-32768,-32768,
-22, -28,-32768, 261,-32768,-32768,-32768, 289, 278, 267,
311, 56,-32768, 193, 208, 443, 355, 321, 327, 333,
351, 356, 361, 363, 168,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 30,
299,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 37,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768, 55,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 27, 401,-32768,
-32768, 155,-32768, 155,-32768, 438,-32768,-32768,-32768,-32768,
-32768, 174,-32768,-32768, 300, 443, 355, 408,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 400, 405,
417, 374, 430,-32768,-32768,-32768,-32768,-32768,-32768, 21,
-32768, 411,-32768, 371,-32768, 289, 443,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 276,-32768,
448,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -8,
134, 134, 134,-32768,-32768,-32768, 134, 167, 313,-32768,
-32768,-32768,-32768,-32768, 134, 19, 134, 6, 134,-32768,
386, 387, 136, 375, 134, 134, 409, 467, 519, 392,
525, 484, 218, 262, 233,-32768,-32768, 233,-32768,-32768,
443, 312,-32768,-32768,-32768,-32768, 500,-32768,-32768, 134,
-32768,-32768,-32768, 444,-32768, 497, 371, 445, 293,-32768,
-32768, 496,-32768,-32768,-32768,-32768, 440, 25, 348, 535,
-32768, 554, 509, 547,-32768,-32768,-32768,-32768,-32768, 506,
-40, 151, 507, 511, 511, 0,-32768, 596, 173,-32768,
-32768, 266, 268, 522, 559, 529, 511, 511, 561, 536,
309, 318, 511, 537, 175,-32768, 465, 605, 464, 562,
547, 616,-32768,-32768,-32768,-32768,-32768, 407, 535,-32768,
644, 565, 374,-327 yyval.number= SSL_VERSION_SSLV2; }
break;
case 232:
#line 887 "p.y"
{ yyval.number= SSL_VERSION_SSLV3; }
break;
case 233:
#line 888 "p.y"
{ yyval.number= SSL_VERSION_TLS; }
break;
case 234:
#line 889 "p.y"
{ yyval.number= SSL_VERSION_AUTO; }
break;
case 235:
#line 892 "p.y"
{
portset.protocol= addprotocol(P_DEFAULT);
}
break;
case 236:
#line 895 "p.y"
{
portset.protocol= addprotocol(P_APACHESTATUS);
}
break;
case 237:
#line 898 "p.y"
{
portset.protocol= addprotocol(P_DEFAULT);
}
break;
case 238:
#line 901 "p.y"
{
portset.protocol= addprotocol(P_DNS);
}
break;
case 239:
#line 904 "p.y"
{
portset.protocol= addprotocol(P_DWP);
}
break;
case 240:
#line 907 "p.y"
{
portset.protocol= addprotocol(P_FTP);
}
break;
case 241:
#line 910 "p.y"
{
portset.protocol= addprotocol(P_HTTP);
}
break;
case 242:
#line 913 "p.y"
{
portset.protocol= addprotocol(P_IMAP);
}
break;
case 243:
#line 916 "p.y"
{
portset.protocol= addprotocol(P_CLAMAV);
}
break;
case 244:
#line 919 "p.y"
{
portset.protocol= addprotocol(P_LDAP2);
}
break;
case 245:
#line 922 "p.y"
{
portset.protocol= addprotocol(P_LDAP3);
}
break;
case 246:
#line 925 "p.y"
{
portset.protocol= addprotocol(P_MYSQL);
}
break;
case 247:
#line 928 "p.y"
{
portset.protocol= addprotocol(P_NNTP);
}
break;
case 248:
#line 931 "p.y"
{
portset.protocol= addprotocol(P_NTP3);
portset.type= SOCK_DGRAM;
}
break;
case 249:
#line 935 "p.y"
{
portset.protocol= addprotocol(P_POSTFIXPOLICY);
}
break;
case 250:
#line 938 "p.y"
{
portset.protocol= addprotocol(P_POP);
}
break;
case 251:
#line 941 "p.y"
{
portset.protocol= addprotocol(P_SMTP);
}
break;
case 252:
#line 944 "p.y"
{
portset.protocol= addprotocol(P_SSH);
}
break;
case 253:
#line 947 "p.y"
{
portset.protocol= addprotocol(P_RDATE);
}
break;
case 254:
#line 950 "p.y"
{
portset.protocol= addprotocol(P_RSYNC);
}
break;
case 255:
#line 953 "p.y"
{
portset.protocol= addprotocol(P_TNS);
}
break;
case 256:
#line 956 "p.y"
{
portset.protocol= addprotocol(P_PGSQL);
}
break;
case 257:
#line 959 "p.y"
{
portset.protocol= addprotocol(P_GENERIC);
}
break;
case 260:
#line 968 "p.y"
{ addgeneric(&portset, yyvsp[0].string, NULL); FREE(yyvsp[0].string);}
break;
case 261:
#line 969 "p.y"
{ addgeneric(&portset, NULL, yyvsp[0].string); FREE(yyvsp[0].string);}
break;
case 263:
#line 973 "p.y"
{
portset.request= Util_urlEncode(yyvsp[0].string);
FREE(yyvsp[0].string);
}
break;
case 264:
#line 977 "p.y"
{
portset.request= Util_urlEncode(yyvsp[-2].string); FREE(yyvsp[-2].string);
portset.request_checksum= yyvsp[0].string;
}
break;
case 267:
#line 987 "p.y"
{
portset.ApacheStatus.loglimitOP= yyvsp[-2].number;
portset.ApacheStatus.loglimit= (int)yyvsp[-1].number;
}
break;
case 268:
#line 991 "p.y"
{
portset.ApacheStatus.closelimitOP= yyvsp[-2].number;
portset.ApacheStatus.closelimit= (int)(yyvsp[-1].number);
}
break;
case 269:
#line 995 "p.y"
{
portset.ApacheStatus.dnslimitOP= yyvsp[-2].number;
portset.ApacheStatus.dnslimit= (int)(yyvsp[-1].number);
}
break;
case 270:
#line 999 "p.y"
{
portset.ApacheStatus.keepalivelimitOP= yyvsp[-2].number;
portset.ApacheStatus.keepalivelimit= (int)(yyvsp[-1].number);
}
break;
case 271:
#line 1003 "p.y"
{
portset.ApacheStatus.replylimitOP= yyvsp[-2].number;
portset.ApacheStatus.replylimit= (int)(yyvsp[-1].number);
}
break;
case 272:
#line 1007 "p.y"
{
portset.ApacheStatus.requestlimitOP= yyvsp[-2].number;
portset.ApacheStatus.requestlimit= (int)(yyvsp[-1].number);
}
break;
case 273:
#line 1011 "p.y"
{
portset.ApacheStatus.startlimitOP= yyvsp[-2].number;
portset.ApacheStatus.startlimit= (int)(yyvsp[-1].number);
}
break;
case 274:
#line 1015 "p.y"
{
portset.ApacheStatus.waitlimitOP= yyvsp[-2].number;
portset.ApacheStatus.waitlimit= (int)(yyvsp[-1].number);
}
break;
case 275:
#line 1019 "p.y"
{
portset.ApacheStatus.gracefullimitOP= yyvsp[-2].number;
portset.ApacheStatus.gracefullimit= (int)(yyvsp[-1].number);
}
break;
case 276:
#line 1023 "p.y"
{
portset.ApacheStatus.cleanuplimitOP= yyvsp[-2].number;
portset.ApacheStatus.cleanuplimit= (int)(yyvsp[-1].number);
}
break;
case 277:
#line 1029 "p.y"
{
seteventaction(&(current)->action_PID, yyvsp[0].number,
ACTION_IGNORE);
}
break;
case 278:
#line 1035 "p.y"
{
seteventaction(&(current)->action_PPID, yyvsp[0].number,
ACTION_IGNORE);
}
break;
case 279:
#line 1041 "p.y"
{
yyval.number= ICMP_ATTEMPT_COUNT;
}
break;
case 280:
#line 1044 "p.y"
{
yyval.number= yyvsp[0].number;
}
break;
case 281:
#line 1049 "p.y"
{
yyval.number= NET_TIMEOUT;
}
break;
case 282:
#line 1052 "p.y"
{
yyval.number= yyvsp[-1].number;
}
break;
case 283:
#line 1057 "p.y"
{
check_timeout(yyvsp[-5].number, yyvsp[-3].number);
current->def_timeout= TRUE;
current->to_start= yyvsp[-5].number;
current->to_cycle= yyvsp[-3].number;
}
break;
case 285:
#line 1066 "p.y"
{
seturlrequest(yyvsp[-1].number, yyvsp[0].string);
FREE(yyvsp[0].string);
}
break;
case 286:
#line 1072 "p.y"
{ yyval.number= OPERATOR_EQUAL; }
break;
case 287:
#line 1073 "p.y"
{ yyval.number= OPERATOR_NOTEQUAL; }
break;
case 288:
#line 1076 "p.y"
{
addmail(yyvsp[-5].string, &mailset, ¤t->maillist, eventset, yyvsp[0].number);
}
break;
case 289:
#line 1079 "p.y"
{
addmail(yyvsp[-2].string, &mailset, ¤t->maillist, EVENT_ALL, yyvsp[0].number);
}
break;
case 290:
#line 1082 "p.y"
{
addmail(yyvsp[-6].string, &mailset, ¤t->maillist, ~eventset, yyvsp[0].number);
}
break;
case 291:
#line 1085 "p.y"
{
addmail(yyvsp[0].string, &mailset, ¤t->maillist, EVENT_NULL, 0);
}
break;
case 292:
#line 1090 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 293:
#line 1093 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 296:
#line 1100 "p.y"
{ eventset |= EVENT_CHANGED; }
break;
case 297:
#line 1101 "p.y"
{ eventset |= EVENT_CHECKSUM; }
break;
case 298:
#line 1102 "p.y"
{ eventset |= EVENT_CONNECTION; }
break;
case 299:
#line 1103 "p.y"
{ eventset |= EVENT_DATA; }
break;
case 300:
#line 1104 "p.y"
{ eventset |= EVENT_EXEC; }
break;
case 301:
#line 1105 "p.y"
{ eventset |= EVENT_GID; }
break;
case 302:
#line 1106 "p.y"
{ eventset |= EVENT_ICMP; }
break;
case 303:
#line 1107 "p.y"
{ eventset |= EVENT_INSTANCE; }
break;
case 304:
#line 1108 "p.y"
{ eventset |= EVENT_INVALID; }
break;
case 305:
#line 1109 "p.y"
{ eventset |= EVENT_MATCH; }
break;
case 306:
#line 1110 "p.y"
{ eventset |= EVENT_NONEXIST; }
break;
case 307:
#line 1111 "p.y"
{ eventset |= EVENT_PERMISSION; }
break;
case 308:
#line 1112 "p.y"
{ eventset |= EVENT_RESOURCE; }
break;
case 309:
#line 1113 "p.y"
{ eventset |= EVENT_SIZE; }
break;
case 310:
#line 1114 "p.y"
{ eventset |= EVENT_TIMEOUT; }
break;
case 311:
#line 1115 "p.y"
{ eventset |= EVENT_TIMESTAMP; }
break;
case 312:
#line 1116 "p.y"
{ eventset |= EVENT_UID; }
break;
case 313:
#line 1119 "p.y"
{ eventset |= EVENT_NONEXIST|EVENT_INVALID; }
break;
case 314:
#line 1120 "p.y"
{ eventset |= EVENT_NONEXIST|EVENT_INVALID; }
break;
case 315:
#line 1121 "p.y"
{ eventset |= EVENT_NONEXIST|EVENT_INVALID; }
break;
case 316:
#line 1122 "p.y"
{ eventset |= EVENT_TIMEOUT; }
break;
case 321:
#line 1133 "p.y"
{ mailset.from= yyvsp[0].string; }
break;
case 322:
#line 1134 "p.y"
{ mailset.subject= yyvsp[0].string; }
break;
case 323:
#line 1135 "p.y"
{ mailset.message= yyvsp[0].string; }
break;
case 324:
#line 1138 "p.y"
{
check_every(yyvsp[-1].number);
current->def_every= TRUE;
current->every= yyvsp[-1].number;
}
break;
case 325:
#line 1145 "p.y"
{
current->mode= MODE_ACTIVE;
}
break;
case 326:
#line 1148 "p.y"
{
current->mode= MODE_PASSIVE;
}
break;
case 327:
#line 1151 "p.y"
{
current->mode= MODE_MANUAL;
current->monitor= MONITOR_NOT;
}
break;
case 328:
#line 1157 "p.y"
{ current->group= yyvsp[0].string; }
break;
case 332:
#line 1168 "p.y"
{ adddependant(yyvsp[0].string); }
break;
case 333:
#line 1171 "p.y"
{
addeventaction(&(resourceset).action,
yyvsp[-1].number, yyvsp[0].number);
addresource(&resourceset);
}
break;
case 340:
#line 1188 "p.y"
{
addeventaction(&(resourceset).action,
yyvsp[-1].number, yyvsp[0].number);
addresource(&resourceset);
}
break;
case 346:
#line 1204 "p.y"
{
resourceset.resource_id= RESOURCE_ID_CPU_PERCENT;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 347:
#line 1211 "p.y"
{
resourceset.resource_id= yyvsp[-3].number;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 348:
#line 1218 "p.y"
{ yyval.number= RESOURCE_ID_CPUUSER; }
break;
case 349:
#line 1219 "p.y"
{ yyval.number= RESOURCE_ID_CPUSYSTEM; }
break;
case 350:
#line 1220 "p.y"
{ yyval.number= RESOURCE_ID_CPUWAIT; }
break;
case 351:
#line 1223 "p.y"
{
resourceset.resource_id= RESOURCE_ID_MEM_KBYTE;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (int) (yyvsp[-1].real *
(yyvsp[0].number / 1024.0));
}
break;
case 352:
#line 1229 "p.y"
{
resourceset.resource_id= RESOURCE_ID_MEM_PERCENT;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 353:
#line 1234 "p.y"
{
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_KBYTE;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (int) (yyvsp[-1].real *
(yyvsp[0].number / 1024.0));
}
break;
case 354:
#line 1240 "p.y"
{
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_PERCENT;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 355:
#line 1247 "p.y"
{
resourceset.resource_id= RESOURCE_ID_CHILDREN;
resourceset.operator= yyvsp[-1].number;
resourceset.limit= (int) yyvsp[0].number;
}
break;
case 356:
#line 1254 "p.y"
{
resourceset.resource_id= yyvsp[-2].number;
resourceset.operator= yyvsp[-1].number;
resourceset.limit= (int) (yyvsp[0].real * 10.0);
}
break;
case 357:
#line 1261 "p.y"
{ yyval.number= RESOURCE_ID_LOAD1; }
break;
case 358:
#line 1262 "p.y"
{ yyval.number= RESOURCE_ID_LOAD5; }
break;
case 359:
#line 1263 "p.y"
{ yyval.number= RESOURCE_ID_LOAD15; }
break;
case 360:
#line 1266 "p.y"
{ yyval.real = yyvsp[0].real; }
break;
case 361:
#line 1267 "p.y"
{ yyval.real = (float) yyvsp[0].number; }
break;
case 362:
#line 1271 "p.y"
{
timestampset.operator= yyvsp[-6].number;
timestampset.time= (yyvsp[-5].number * yyvsp[-4].number);
addeventaction(&(timestampset).action, yyvsp[-1].number,
yyvsp[0].number);
addtimestamp(×tampset, FALSE);
}
break;
case 363:
#line 1278 "p.y"
{
timestampset.test_changes= TRUE;
addeventaction(&(timestampset).action, yyvsp[0].number,
ACTION_IGNORE);
addtimestamp(×tampset, TRUE);
}
break;
case 364:
#line 1286 "p.y"
{ yyval.number= OPERATOR_EQUAL; }
break;
case 365:
#line 1287 "p.y"
{ yyval.number= OPERATOR_GREATER; }
break;
case 366:
#line 1288 "p.y"
{ yyval.number= OPERATOR_LESS; }
break;
case 367:
#line 1289 "p.y"
{ yyval.number= OPERATOR_EQUAL; }
break;
case 368:
#line 1290 "p.y"
{ yyval.number= OPERATOR_NOTEQUAL; }
break;
case 369:
#line 1291 "p.y"
{ yyval.number= OPERATOR_NOTEQUAL; }
break;
case 370:
#line 1294 "p.y"
{ yyval.number= TIME_SECOND; }
break;
case 371:
#line 1295 "p.y"
{ yyval.number= TIME_SECOND; }
break;
case 372:
#line 1296 "p.y"
{ yyval.number= TIME_MINUTE; }
break;
case 373:
#line 1297 "p.y"
{ yyval.number= TIME_HOUR; }
break;
case 374:
#line 1298 "p.y"
{ yyval.number= TIME_DAY; }
break;
case 375:
#line 1301 "p.y"
{ yyval.number= ACTION_ALERT; }
break;
case 376:
#line 1302 "p.y"
{ yyval.number= ACTION_EXEC; }
break;
case 377:
#line 1303 "p.y"
{ yyval.number= ACTION_EXEC; }
break;
case 378:
#line 1304 "p.y"
{ yyval.number= ACTION_RESTART; }
break;
case 379:
#line 1305 "p.y"
{ yyval.number= ACTION_START; }
break;
case 380:
#line 1306 "p.y"
{ yyval.number= ACTION_STOP; }
break;
case 381:
#line 1307 "p.y"
{ yyval.number= ACTION_UNMONITOR; }
break;
case 382:
#line 1310 "p.y"
{
yyval.number= yyvsp[0].number;
if(yyvsp[0].number == ACTION_EXEC && command) {
command1= command;
command= NULL;
}
}
break;
case 383:
#line 1319 "p.y"
{
yyval.number= yyvsp[0].number;
if(yyvsp[0].number == ACTION_EXEC && command) {
command2= command;
command= NULL;
}
}
break;
case 385:
#line 1329 "p.y"
{
rate1.count = yyvsp[-1].number;
rate1.cycles = yyvsp[-1].number;
if(rate1.cycles < 1 || rate1.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must 68, 440,-32768, 36, 577, 17, 178,
383, 423,-32768,-32768, 630, 89,-32768,-32768,-32768,-32768,
-32768,-32768, 582,-32768,-32768, 535, 355,-32768,-32768, 414,
179,-32768, 572,-32768, 402, 578, 402, 583, 657, 662,
-32768, 636, 51,-32768,-32768, 511, 511, 511, 511, 511,
-9, 416, 676, 678, 511, 402, 511, 511,-32768,-32768,
679, 380, 599, 402,-32768, 601, 311, 319, 311,-32768,
179, 682, 535, 355, 51, 602, 371,-32768, 611, 613,
638, 538, 640,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, 641, 688, 642, 643,-32768,-32768, 355,-32768,
-32768,-32768, 371, 645, 646, 637, 311, 471,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 51, 51,
-32768,-32768,-32768,-32768,-32768, 243,-32768,-32768, 714, 719,
720, 721, 722, 723, 652, 725,-32768,-32768,-32768,-32768,
511, 51, 51, 726, 511, 727, 728, 51, 511, 729,
511, 511,-32768, 511,-32768,-32768, 658, 511, 311, 684,
355,-32768, 714,-32768, 440, 660, 661, 663, 664, 665,
-32768, 666, 711,-32768,-32768,-32768, 440,-32768,-32768,-32768,
621, 584,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
511,-32768,-32768,-32768, 155, 742,-32768, 51, 51, 51,
51, 51, 511, 51, 741,-32768,-32768, 51, 743, 51,
51,-32768, 744, 51, 745, 746, 747,-32768, 748, 511,
-32768,-32768,-32768,-32768, 665, 665, 665, 736,-32768, 665,
-32768,-32768,-32768,-32768,-32768, 669,-32768, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 749,-32768, 751,
233, 359, 714, 714, 714, 714, 714, 752, 714, 51,
-32768, 51,-32768,-32768, 51, 714, 51, 51, 51, 51,
753, 665, 665, 665,-32768,-32768,-32768, 705, 675, 677,
680, 681, 683, 685, 686, 687, 689, 690, 584, 51,
691, 691,-32768,-32768,-32768,-32768,-32768, 51,-32768, 714,
714, 714,-32768, 714, 714, 714, 714, 51, 692, 693,
694, 695, 696, 697, 698, 699, 700, 701, 702,-32768,
714, 14, 756, 758, 714,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, 714,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 732, 51, 51,-32768,
-32768,-32768,-32768,-32768,-32768, 767, 773,-32768
};
static const short yypgoto[] =
{
-32768,-32768, 768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, 717,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768, 703,-32768,-32768,-32768,
-32768, 708,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -131,
-416,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 274,
590, -55, -170, -169, -285, 477, 410, 750,-32768,-32768,
-32768,-32768,-32768, 421, -374, -302, 343,-32768, 308,-32768,
-32768, 118,-32768,-32768,-32768, -89, 341,-32768,-32768, 480,
796,-32768, -106, -210, -64, 573, -204, 576, 594, 581,
585,-32768, 619,-32768,-32768, 533,-32768,-32768, 498,-32768,
-32768,-32768, -146,-32768, -114,-32768, -10, -5, -255,-32768,
-213, -438, 64, -293, 122, -517,-32768, 528,-32768,-32768,
-32768, -201, -17,-32768, 704,-32768, 1, 150,-32768, -178
};
#define YYLAST 824
static const short yytable[] =
{
173, 223, 295, 297, 295, 186, 340, 341, 302, 376,
457, 342, 376, 380, 384, 320, 542, 93, 209, 348,
93, 355, 514, 359, 212, 612, 349, 350, 77, 363,
364, 287, 420, 167, 150, 164, 41, 275, 330, 349,
350, 310, 332, 464, 282, 412, 735, 163, 119, 80,
418, 419, 151, 165, 381, 458, 459, 413, 460, 205,
582, 583, 282, 432, 433, 42, 287, 43, 465, 440,
29, 204, 30, 311, 31, 32, 345, 206, 33, 301,
44, 54, 55, 595, 596, 421, 45, 501, 502, 601,
34, 330, 36, 56, 78, 46, 35, 80, 503, 736,
57, 216, 217, 218, 504, 216, 217, 218, 36, 210,
37, 168, 474, 461, 462, 168, 475, 476, 330, 79,
328, 94, 168, 320, 184, 682, 683, 684, 685, 686,
47, 688, 509, 510, 511, 512, 513, 515, 692, 356,
168, 523, 95, 525, 526, 185, 351, 352, 529, 642,
643, 644, 645, 646, 544, 648, 289, 357, 58, 650,
310, 652, 653, 276, 277, 655, 59, 330, 60, 353,
613, 283, 715, 716, 717, 259, 718, 719, 720, 721,
556, 278, 624, 279, 288, 284, 285, 38, 276, 286,
39, 289, 311, 734, 377, 84, 319, 739, 1, 120,
404, 152, 166, 666, 466, 740, 505, 506, 85, 483,
484, 689, 83, 690, 86, 496, 691, 53, 693, 694,
695, 696, 104, 87, 485, 90, 207, 594, 479, 467,
99, 598, 169, 170, 524, 602, 415, 604, 605, 100,
606, 710, 531, 101, 608, 666, 666, 666, 413, 714,
54, 55, 102, 168, 103, 54, 55, 180, 423, 722,
442, 36, 56, 351, 352, 406, 36, 56, 334, 57,
413, 179, 413, 260, 57, 541, 261, 262, 263, 264,
265, 97, 292, 293, 98, 266, 353, 639, 2, 3,
4, 5, 6, 7, 8, 372, 176, 177, 178, 647,
555, 174, 267, 373, 335, 336, 337, 338, 386, 387,
88, 89, 227, 228, 453, 175, 660, 388, 389, 390,
169, 170, 229, 106, 122, 139, 155, 58, 230, 231,
232, 416, 58, 343, 344, 59, 208, 60, 424, 374,
59, 478, 60, 425, 391, 427, 215, 375, 227, 228,
196, 426, 222, 428, 443, 376, 221, 533, 229, 537,
292, 293, 611, 212, 230, 231, 232, 225, 187, 216,
217, 218, 668, 669, 670, 671, 672, 673, 674, 675,
676, 677, 226, 233, 227, 228, 436, 437, 540, 250,
112, 124, 141, 157, 229, 438, 439, 580, 345, 252,
230, 231, 232, 234, 235, 253, 236, 468, 469, 237,
238, 254, 36, 56, 640, 295, 189, 198, 260, 233,
57, 261, 262, 263, 264, 265, 239, 240, 241, 255,
266, 242, 243, 244, 256, 245, 246, 247, 257, 234,
235, 258, 236, 227, 228, 237, 238, 470, 471, 609,
584, 329, 279, 229, 291, 233, 480, 481, 482, 230,
231, 232, 239, 240, 241, 345, 528, 242, 243, 244,
298, 245, 246, 247, 300, 234, 235, 312, 236, 227,
228, 237, 238, 661, 662, 663, 59, 378, 60, 229,
313, 534, 535, 168, 314, 230, 231, 232, 239, 240,
241, 483, 484, 242, 243, 244, 315, 245, 246, 247,
322, 323, 324, 325, 233, 317, 261, 262, 263, 264,
265, 680, 681, 405, 742, 742, 303, 304, 305, 113,
125, 142, 158, 331, 234, 235, 321, 236, 360, 361,
237, 238, 356, 362, 365, 137, 490, 491, 492, 493,
233, 516, 517, 518, 519, 190, 199, 239, 240, 241,
366, 368, 242, 243, 244, 369, 245, 246, 247, 371,
234, 235, 153, 236, 383, 210, 237, 238, 54, 55,
385, 401, 452, 402, 93, 345, 407, 408, 409, 36,
56, 411, 417, 239, 240, 241, 345, 57, 242, 243,
244, 422, 245, 246, 247, 54, 55, 429, 261, 262,
263, 264, 265, 430, 431, 434, 36, 56, 303, 304,
305, 435, 441, 444, 57, 114, 126, 143, 159, 447,
116, 128, 145, 161, 117, 129, 146, 162, 445, 107,
123, 140, 156, 115, 127, 144, 160, 449, 451, 454,
455, 191, 200, 472, 463, 58, 192, 202, 489, 477,
193, 203, 498, 59, 495, 60, 197, 499, 500, 497,
201, 627, 628, 629, 630, 631, 632, 633, 634, 635,
636, 521, 58, 522, 527, 530, 532, 539, 543, 545,
59, 546, 60, 559, 560, 561, 562, 563, 564, 565,
566, 567, 568, 569, 570, 571, 572, 573, 574, 575,
576, 577, 578, 579, 548, 551, 547, -176, 585, 550,
553, 554, 557, 558, 587, 588, 589, 590, 591, 592,
593, 597, 599, 600, 603, 607, 610, -178, -180, 622,
-182, 617, 618, 625, 621, 641, 649, 667, 651, 654,
656, 657, 658, 659, 664, 678, 679, 687, 697, 698,
699, 737, 700, 738, 741, 701, 702, 746, 703, 723,
704, 705, 706, 747, 707, 708, 711, 48, 183, 724,
725, 726, 727, 728, 729, 730, 731, 732, 733, 213,
382, 450, 456, 538, 224, 581, 709, 40, 327, 108,
299, 346, 744, 713, 379, 358, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 281
};
static const short yycheck[] =
{
55, 90, 171, 173, 173, 69, 261, 262, 186, 294,
384, 266, 297, 306, 316, 219, 454, 49, 40, 274,
49, 276, 31, 278, 52, 542, 20, 21, 12, 284,
285, 39, 32, 7, 51, 52, 83, 7, 248, 20,
21, 187, 50, 26, 7, 85, 32, 52, 3, 77,
343, 344, 51, 52, 309, 19, 20, 97, 22, 76,
498, 499, 7, 356, 357, 83, 39, 83, 51, 362,
9, 76, 11, 187, 13, 14, 85, 76, 17, 185,
83, 36, 37, 521, 522, 85, 83, 36, 37, 527,
29, 301, 47, 48, 78, 83, 35, 77, 47, 85,
55, 80, 81, 82, 53, 80, 81, 82, 47, 131,
49, 85, 23, 77, 78, 85, 27, 28, 328, 85,
226, 153, 85, 327, 153, 642, 643, 644, 645, 646,
83, 648, 425, 426, 427, 428, 429, 430, 655, 133,
85, 434, 174, 436, 437, 174, 127, 128, 441, 587,
588, 589, 590, 591, 456, 593, 164, 151, 113, 597,
306, 599, 600, 133, 134, 603, 121, 377, 123, 150,
544, 134, 689, 690, 691, 7, 693, 694, 695, 696,
482, 151, 556, 153, 157, 148, 149, 126, 133, 134,
129, 164, 306, 710, 300, 78, 175, 714, 8, 154,
175, 51, 52, 619, 26, 722, 155, 156, 78, 30,
31, 649, 40, 651, 79, 416, 654, 3, 656, 657,
658, 659, 3, 174, 45, 169, 76, 520, 406, 51,
38, 524, 77, 78, 435, 528, 85, 530, 531, 38,
533, 679, 443, 38, 537, 661, 662, 663, 97, 687,
36, 37, 16, 85, 38, 36, 37, 83, 85, 697,
85, 47, 48, 127, 128, 329, 47, 48, 134, 55,
97, 84, 97, 105, 55, 453, 108, 109, 110, 111,
112, 35, 127, 128, 38, 117, 150, 580, 98, 99,
100, 101, 102, 103, 104, 77, 114, 115, 116, 592,
478, 79, 134, 85, 170, 171, 172, 173, 15, 16,
124, 125, 36, 37, 378, 85, 609, 24, 25, 26,
77, 78, 46, 49, 50, 51, 52, 113, 52, 53,
54, 341, 113, 166, 167, 121, 10, 123, 348, 77,
121, 405, 123, 77, 51, 77, 85, 85, 36, 37,
76, 85, 85, 85, 364, 640, 78, 446, 46, 448,
127, 128, 540, 52, 52, 53, 54, 174, 3, 80,
81, 82, 627, 628, 629, 630, 631, 632, 633, 634,
635, 636, 174, 107, 36, 37, 77, 78, 452, 34,
49, 50, 51, 52, 46, 77, 78, 486, 85, 78,
52, 53, 54, 127, 128, 78, 130, 24, 25, 133,
134, 78, 47, 48, 584, 584, 75, 76, 105, 107,
55, 108, 109, 110, 111, 112, 150, 151, 152, 78,
117, 155, 156, 157, 78, 159, 160, 161, 77, 127,
128, 78, 130, 36, 37, 133, 134, 24, 25, 538,
505, 175, 153, 46, 53, 107, 42, 43, 44, 52,
53, 54, 150, 151, 152, 85, 86, 155, 156, 157,
32, 159, 160, 161, 174, 127, 128, 77, 130, 36,
37, 133, 134, 614, 615, 616, 121, 175, 123, 46,
85, 172, 173, 85, 77, 52, 53, 54, 150, 151,
152, 30, 31, 155, 156, 157, 132, 159, 160, 161,
139, 140, 141, 142, 107, 85, 108, 109, 110, 111,
112, 162, 163, 175, 737, 738, 118, 119, 120, 49,
50, 51, 52, 85, 127, 128, 125, 130, 152, 152,
133, 134, 133, 168, 77, 3, 144, 145, 146, 147,
107, 135, 136, 137, 138, 75, 76, 150, 151, 152,
41, 169, 155, 156, 157, 40, 159, 160, 161, 85,
127, 128, 3, 130, 77, 131, 133, 134, 36, 37,
135, 85, 175, 143, 49, 85, 32, 78, 41, 47,
48, 85, 85, 150, 151, 152, 85, 55, 155, 156,
157, 5, 159, 160, 161, 36, 37, 85, 108, 109,
110, 111, 112, 54, 85, 54, 47, 48, 118, 119,
120, 85, 85, 158, 55, 49, 50, 51, 52, 165,
49, 50, 51, 52, 49, 50, 51, 52, 33, 49,
50, 51, 52, 49, 50, 51, 52, 85, 32, 5,
85, 75, 76, 23, 77, 113, 75, 76, 86, 77,
75, 76, 5, 121, 86, 123, 76, 5, 32, 86,
76, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 5, 113, 5, 5, 86, 85, 5, 86, 78,
121, 78, 123, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 176, 27, 78, 77, 4, 78,
78, 78, 77, 77, 5, 5, 5, 5, 5, 77,
5, 5, 5, 5, 5, 77, 52, 77, 77, 28,
77, 77, 77, 122, 78, 3, 5, 78, 5, 5,
5, 5, 5, 5, 18, 6, 5, 5, 5, 54,
85, 5, 85, 5, 32, 85, 85, 0, 85, 77,
85, 85, 85, 0, 85, 85, 85, 9, 61, 86,
86, 86, 86, 86, 86, 86, 86, 86, 86, 81,
313, 370, 382, 450, 91, 487, 678, 1, 225, 49,
181, 268, 738, 681, 306, 277, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 120
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/share/bison/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hbe between 1 and %d",
BITMAP_MAX);
}
}
break;
case 386:
#line 1337 "p.y"
{
rate1.count = yyvsp[-2].number;
rate1.cycles = yyvsp[-1].number;
if(rate1.cycles < 1 || rate1.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must be between 1 and %d",
BITMAP_MAX);
}
if(rate1.count < 1 || rate1.count > rate1.cycles) {
yyerror2("the number of events must be bigger then 0 and "
"less than poll cycles");
}
}
break;
case 388:
#line 1352 "p.y"
{
rate2.count = yyvsp[-1].number;
rate2.cycles = yyvsp[-1].number;
if(rate2.cycles < 1 || rate2.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must be between 1 and %d",
BITMAP_MAX);
}
}
break;
case 389:
#line 1360 "p.y"
{
rate2.count = yyvsp[-2].number;
rate2.cycles = yyvsp[-1].number;
if(rate2.cycles < 1 || rate2.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must be between 1 and %d",
BITMAP_MAX);
}
if(rate2.count < 1 || rate2.count > rate2.cycles) {
yyerror2("the number of events must be bigger then 0 and "
"less than poll cycles");
}
}
break;
case 390:
#line 1374 "p.y"
{
yyval.number= ACTION_ALERT;
}
break;
case 391:
#line 1377 "p.y"
{
yyval.number= yyvsp[0].number;
}
break;
case 392:
#line 1380 "p.y"
{
yyval.number= yyvsp[0].number;
}
break;
case 393:
#line 1385 "p.y"
{
addeventaction(&(checksumset).action, yyvsp[-1].number,
yyvsp[0].number);
addchecksum(&checksumset);
}
break;
case 394:
#line 1391 "p.y"
{
checksumset.hash= yyvsp[-4].string;
addeventaction(&(checksumset).action, yyvsp[-1].number,
yyvsp[0].number);
addchecksum(&checksumset);
}
break;
case 395:
#line 1397 "p.y"
{
checksumset.test_changes= TRUE;
addeventaction(&(checksumset).action, yyvsp[0].number,
ACTION_IGNORE);
addchecksum(&checksumset);
}
break;
case 396:
#line 1404 "p.y"
{ checksumset.type= HASH_UNKNOWN; }
break;
case 397:
#line 1405 "p.y"
{ checksumset.type= HASH_MD5; }
break;
case 398:
#line 1406 "p.y"
{ checksumset.type= HASH_SHA1; }
break;
case 399:
#line 1409 "p.y"
{
deviceset.resource= RESOURCE_ID_INODE;
deviceset.operator= yyvsp[-5].number;
deviceset.limit_absolute= yyvsp[-4].number;
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 400:
#line 1416 "p.y"
{
deviceset.resource= RESOURCE_ID_INODE;
deviceset.operator= yyvsp[-6].number;
deviceset.limit_percent= (int)(yyvsp[-5].number * 10);
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 401:
#line 1425 "p.y"
{
if(!device_usage(current->inf, current->path)) {
yyerror2("cannot read usage of device %s",
current->path);
}
deviceset.resource= RESOURCE_ID_SPACE;
deviceset.operator= yyvsp[-6].number;
deviceset.limit_absolute=
(int)(
(float)yyvsp[-5].real /
(float)current->inf->f_bsize * (float)yyvsp[-4].number
);
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 402:
#line 1440 "p.y"
{
deviceset.resource= RESOURCE_ID_SPACE;
deviceset.operator= yyvsp[-6].number;
deviceset.limit_percent= (int)(yyvsp[-5].number * 10);
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 403:
#line 1449 "p.y"
{
seteventaction(&(current)->action_FSFLAG, yyvsp[0].number,
ACTION_IGNORE);
}
break;
case 404:
#line 1455 "p.y"
{ yyval.number= UNIT_BYTE; }
break;
case 405:
#line 1456 "p.y"
{ yyval.number= UNIT_KILOBYTE; }
break;
case 406:
#line 1457 "p.y"
{ yyval.number= UNIT_MEGABYTE; }
break;
case 407:
#line 1458 "p.y"
{ yyval.number= UNIT_GIGABYTE; }
break;
case 408:
#line 1461 "p.y"
{
permset.perm= check_perm(yyvsp[-4].number);
addeventaction(&(permset).action, yyvsp[-1].number, yyvsp[0].number);
addperm(&permset);
}
break;
case 409:
#line 1468 "p.y"
{
matchset.ignore= FALSE;
matchset.match_path= yyvsp[-3].string;
matchset.match_string= NULL;
addmatchpath(&matchset, yyvsp[0].number);
FREE(yyvsp[-3].string);
}
break;
case 410:
#line 1475 "p.y"
{
matchset.ignore= FALSE;
matchset.match_path= NULL;
matchset.match_string= xstrdup(yyvsp[-3].string);
addmatch(&matchset, yyvsp[0].number, 0);
}
break;
case 411:
#line 1481 "p.y"
{
matchset.ignore= TRUE;
matchset.match_path= yyvsp[0].string;
matchset.match_string= NULL;
addmatchpath(&matchset, ACTION_IGNORE);
FREE(yyvsp[0].string);
}
break;
case 412:
#line 1488 "p.y"
{
matchset.ignore= TRUE;
matchset.match_path= NULL;
matchset.match_string= xstrdup(yyvsp[0].string);
addmatch(&matchset, ACTION_IGNORE, 0);
}
break;
case 413:
#line 1496 "p.y"
{
matchset.not= FALSE;
}
break;
case 414:
#line 1499 "p.y"
{
matchset.not= TRUE;
}
break;
case 415:
#line 1505 "p.y"
{
sizeset.operator= yyvsp[-6].number;
sizeset.size= ((unsigned long long)yyvsp[-5].number * yyvsp[-4].number);
addeventaction(&(sizeset).action, yyvsp[-1].number, yyvsp[0].number);
addsize(&sizeset, FALSE);
}
break;
case 416:
#line 1511 "p.y"
{
sizeset.test_changes= TRUE;
addeventaction(&(sizeset).action, yyvsp[0].number,
ACTION_IGNORE);
addsize(&sizeset, TRUE);
}
break;
case 417:
#line 1519 "p.y"
{
uidset.uid= get_uid(yyvsp[-4].string, 0);
addeventaction(&(uidset).action, yyvsp[-1].number, yyvsp[0].number);
adduid(&uidset);
FREE(yyvsp[-4].string);
}
break;
case 418:
#line 1525 "p.y"
{
uidset.uid= get_uid(NULL, yyvsp[-4].number);
addeventaction(&(uidset).action, yyvsp[-1].number, yyvsp[0].number);
adduid(&uidset);
}
break;
case 419:
#line 1532 "p.y"
{
gidset.gid= get_gid(yyvsp[-4].string, 0);
addeventaction(&(gidset).action, yyvsp[-1].number, yyvsp[0].number);
addgid(&gidset);
FREE(yyvsp[-4].string);
}
break;
case 420:
#line 1538 "p.y"
{
gidset.gid= get_gid(NULL, yyvsp[-4].number);
addeventaction(&(gidset).action, yyvsp[-1].number, yyvsp[0].number);
addgid(&gidset);
}
break;
case 421:
#line 1545 "p.y"
{ yyval.number= ICMP_ECHO; }
break;
case 422:
#line 1548 "p.y"
{ yyval.number = 0; }
break;
case 423:
#line 1549 "p.y"
{ yyval.number = yyvsp[0].number; }
break;
case 424:
#line 1550 "p.y"
{ yyval.number = yyvsp[-1].number; }
break;
}
#line 705 "/usr/local/share/bison/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#if YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#if YYLSP_NEEDED
*++yylsp = yyloc;
#endif
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
YYSIZE_T yysize = 0;
char *yymsg;
int yyx, yycount;
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("parse error, unexpected ") + 1;
yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("parse error; also virtual memory exhausted");
}
else
#endif /* defined (YYERROR_VERBOSE) */
yyerror ("parse error");
}
goto yyerrlab1;
/*--------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action |
`--------------------------------------------------*/
yyerrlab1:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
yychar, yytname[yychar1]));
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
/*-------------------------------------------------------------------.
| yyerrdefault -- current state does not do anything special for the |
| error token. |
`-------------------------------------------------------------------*/
yyerrdefault:
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
/* If its default is to accept any token, ok. Otherwise pop it. */
yyn = yydefact[yystate];
if (yyn)
goto yydefault;
#endif
/*---------------------------------------------------------------.
| yyerrpop -- pop the current state because it cannot handle the |
| error token |
`---------------------------------------------------------------*/
yyerrpop:
if (yyssp == yyss)
YYABORT;
yyvsp--;
yystate = *--yyssp;
#if YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "Error: state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
/*--------------.
| yyerrhandle. |
`--------------*/
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval;
#if YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
/*---------------------------------------------.
| yyoverflowab -- parser overflow comes here. |
`---------------------------------------------*/
yyoverflowlab:
yyerror ("parser stack overflow");
yyresult = 2;
/* Fall through. */
yyreturn:
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
return yyresult;
}
#line 1553 "p.y"
/* -------------------------------------------------------- Parser interface */
/**
* Syntactic error routine
*
* This routine is automatically called by the lexer!
*/
void yyerror(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogError("%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
cfg_errflag++;
FREE(msg);
}
/**
* Syntactical warning routine
*/
void yywarning(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogWarning("%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
FREE(msg);
}
/**
* Argument error routine
*/
void yyerror2(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogError("%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
cfg_errflag++;
FREE(msg);
}
/**
* Argument warning routine
*/
void yywarning2(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogWarning("%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
FREE(msg);
}
/*
* The Parser hook - start parsing the control file
* Returns TRUE if parsing succeeded, otherwise FALSE
*/
int parse(char *controlfile) {
ASSERT(controlfile);
servicelist= tail= current= NULL;
/*
* Secure check the monitrc file. The run control file must have the
* same uid as the REAL uid of this process, it must have permissions
* no greater than 700 and it must not be a sope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* This is the parser code that is written into each bison parser when
the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
/* The parser invokes alloca or malloc; define the necessary symbols. */
# if YYSTACK_USE_ALLOCA
# define YYSTACK_ALLOC alloca
# else
# ifndef YYSTACK_USE_ALLOCA
# if defined (alloca) || defined (_ALLOCA_H)
# define YYSTACK_ALLOC alloca
# else
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
# if defined (__STDC__) || defined (__cplusplus)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
# define YYSTACK_ALLOC malloc
# define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
short yyss;
YYSTYPE yyvs;
# if YYLSP_NEEDED
YYLTYPE yyls;
# endif
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# if YYLSP_NEEDED
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAX)
# else
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAX)
# endif
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run).
When YYLLOC_DEFAULT is run, CURRENT is set the location of the
first token. By default, to implement support for ranges, extend
its range to the last symbol. */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
Current.last_line = Rhs[N].last_line; \
Current.last_column = Rhs[N].last_column;
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#if YYPURE
# if YYLSP_NEEDED
# ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
# else
# define YYLEX yylex (&yylval, &yylloc)
# endif
# else /* !YYLSP_NEEDED */
# ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, YYLEX_PARAM)
# else
# define YYLEX yylex (&yylval)
# endif
# endif /* !YYLSP_NEEDED */
#else /* !YYPURE */
# define YYLEX yylex ()
#endif /* !YYPURE */
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#ifdef YYERROR_VERBOSE
# ifndef yystrlen
# if defined (__GLIBC__) && defined (_STRING_H)
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
static YYSIZE_T
# if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
# else
yystrlen (yystr)
const char *yystr;
# endif
{
register const char *yys = yystr;
while (*yys++ != '\0')
continue;
return yys - yystr - 1;
}
# endif
# endif
# ifndef yystpcpy
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
static char *
# if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
# else
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
# endif
{
register char *yyd = yydest;
register const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
#endif
#line 315 "/usr/local/share/bison/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
It should actually point to an object.
Grammar actions can access the variable by casting it
to the proper pointer type. */
#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
# define YYPARSE_PARAM_DECL
# else
# define YYPARSE_PARAM_ARG YYPARSE_PARAM
# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
#else /* !YYPARSE_PARAM */
# define YYPARSE_PARAM_ARG
# define YYPARSE_PARAM_DECL
#endif /* !YYPARSE_PARAM */
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
# ifdef YYPARSE_PARAM
int yyparse (void *);
# else
int yyparse (void);
# endif
#endif
/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
variables are global, or local to YYPARSE. */
#define YY_DECL_NON_LSP_VARIABLES \
/* The lookahead symbol. */ \
int yychar; \
\
/* The semantic value of the lookahead symbol. */ \
YYSTYPE yylval; \
\
/* Number of parse errors so far. */ \
int yynerrs;
#if YYLSP_NEEDED
# define YY_DECL_VARIABLES \
YY_DECL_NON_LSP_VARIABLES \
\
/* Location data for the lookahead symbol. */ \
YYLTYPE yylloc;
#else
# define YY_DECL_VARIABLES \
YY_DECL_NON_LSP_VARIABLES
#endif
/* If nonreentrant, generate the variables here. */
#if !YYPURE
YY_DECL_VARIABLES
#endif /* !YYPURE */
int
yyparse (YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
{
/* If reentrant, generate the variables here. */
#if YYPURE
YY_DECL_VARIABLES
#endif /* !YYPURE */
register int yystate;
register int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Lookahead token as an internal (translated) token number. */
int yychar1 = 0;
/* Three stacks and their tools:
`yyss': related to states,
`yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
register short *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
register YYSTYPE *yyvsp;
#if YYLSP_NEEDED
/* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
#endif
#if YYLSP_NEEDED
# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
# define YYPOPSTACK (yyvsp--, yyssp--)
#endif
YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
#if YYLSP_NEEDED
YYLTYPE yyloc;
#endif
/* When reducing, the number of symbols on the RHS of the reduced
rule. */
int yylen;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss;
yyvsp = yyvs;
#if YYLSP_NEEDED
yylsp = yyls;
#endif
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks.
*/
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. */
# if YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
yyls = yyls1;
# else
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
# endif
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyoverflowlab;
# else
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
goto yyoverflowlab;
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
{
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# if YYLSP_NEEDED
YYSTACK_RELOCATE (yyls);
# endif
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
#if YYLSP_NEEDED
yylsp = yyls + yysize - 1;
#endif
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yychar1 = YYTRANSLATE (yychar);
#if YYDEBUG
/* We have to keep this `#if YYDEBUG', since we use variables
which are defined only if `YYDEBUG' is set. */
if (yydebug)
{
YYFPRINTF (stderr, "Next token is %d (%s",
yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise
meaning of a token, for further debugging info. */
# ifdef YYPRINT
YYPRINT (stderr, yychar, yylval);
# endif
YYFPRINTF (stderr, ")\n");
}
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
YYDPRINTF ((stderr, "Shifting token %d (%s), ",
yychar, yytname[yychar1]));
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#if YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
yystate = yyn;
goto yynewstate;
/*------ymbolic link.
*/
if (! File_checkStat(controlfile, "control file", S_IRUSR|S_IWUSR|S_IXUSR)) {
return FALSE;
}
if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
LogError("%s: Error: cannot open the control file '%s' -- %s\n",
prog, controlfile, STRERROR);
return FALSE;
}
currentfile=xstrdup(controlfile);
/*
* Creation of the global service list is synchronized
*/
LOCK(Run.mutex)
preparse();
yyparse();
fclose(yyin);
/* Add the default general system service if not specified explicitly */
if(!hassystem) {
createservice(TYPE_SYSTEM, xstrdup(Run.localhostname), xstrdup(""), check_system);
}
/* If defined - add the last service to the service list */
if(current) {
addservice(current);
FREE(current);
}
postparse();
END_LOCK;
FREE(currentfile);
if (argyytext!=NULL)
FREE(argyytext);
return(cfg_errflag == 0);
}
/* ----------------------------------------------------------------- Private */
/**
* Initialize objects used by the parser.
*/
static void preparse() {
int i;
char localhost[STRLEN];
/*
* Get the localhost name
*/
if(gethostname(localhost, sizeof(localhost)) < 0) {
snprintf(localhost, STRLEN, "%s", LOCALHOST);
}
/* Set instance incarnation ID */
time(&Run.incarnation);
/* Reset lexer */
buffer_stack_ptr=0;
lineno= 1;
arglineno= 1;
argcurrentfile=NULL;
argyytext=NULL;
/* Reset parser */
Run.wait_start= 0;
Run.stopped= FALSE;
Run.dolog= FALSE;
Run.dohttpd= FALSE;
Run.doaction= FALSE;
Run.httpdsig= TRUE;
Run.credentials= NULL;
Run.httpdssl= FALSE;
Run.httpsslpem= NULL;
Run.httpsslclientpem= NULL;
Run.clientssl= FALSE;
Run.mailserver_timeout= NET_TIMEOUT;
Run.bind_addr= NULL;
Run.eventlist= NULL;
Run.eventlist_dir= NULL;
Run.eventlist_slots= -1;
Run.system= NULL;
Run.maillist= NULL;
Run.mailservers= NULL;
Run.MailFormat.from= NULL;
Run.MailFormat.subject= NULL;
Run.MailFormat.message= NULL;
Run.localhostname= xstrdup(localhost);
depend_list= NULL;
Run.handler_init= TRUE;
for(i=0; i<=HANDLER_MAX; i++) {
Run.handler_queue[i] = 0;
}
/*
* Initialize objects
*/
reset_uidset();
reset_gidset();
reset_sizeset();
reset_mailset();
reset_mailserverset();
reset_portset();
reset_permset();
reset_icmpset();
reset_rateset();
reset_deviceset();
reset_resourceset();
reset_checksumset();
reset_timestampset();
}
/*
* Check that values are reasonable after parsing
*/
static void postparse() {
Service_T s;
if(cfg_errflag || (servicelist==NULL)) {
return;
}
/* Check the sanity of any dependency graph */
check_depend();
/* Check that we do not start monit in daemon mode without having a
* poll time */
if(!Run.polltime && (Run.isdaemon || Run.init)) {
LogError("%s: Error: Poll time not defined. Please define poll time"
" in the\n control file or use the -d option when starting monit\n",
prog);
cfg_errflag++;
}
if(Run.logfile) {
Run.dolog = TRUE;
}
for(s= servicelist; s; s= s->next) {
/* Set the general system service shortcut */
if(s->type == TYPE_SYSTEM)
Run.system = s;
if(s->type != TYPE_HOST)
continue;
/* Verify that a remote service has a port or an icmp list */
if(!s->portlist && !s->icmplist) {
LogError("%s: Error: 'check host' statement is incomplete; Please"
" specify a port number to test\n or an icmp test at the remote"
" host: '%s'\n",
prog, s->name);
cfg_errflag++;
}
}
}
/*
* Create a new service object and add any current objects to the
* service list.
*/
static void createservice(int type, char *name, char *value,
int (*check)(Service_T s)) {
ASSERT(name);
ASSERT(value);
if(current) {
addservice(current);
} else {
NEW(current);
}
/* Reset the current object */
memset(current, 0, sizeof(*current));
NEW(current->inf);
Util_resetInfo(current);
/* Set default values */
current->monitor= MONITOR_INIT;
current->mode= MODE_ACTIVE;
current->name= name;
current->type= type;
current->check= check;
current->path= value;
/* Initialize general event handlers */
addeventaction(&(current)->action_DATA, ACTION_ALERT, ACTION_ALERT);
addeventaction(&(current)->action_EXEC, ACTION_ALERT, ACTION_ALERT);
addeventaction(&(current)->action_INVALID, ACTION_RESTART, ACTION_ALERT);
addeventaction(&(current)->action_NONEXIST, ACTION_RESTART, ACTION_ALERT);
addeventaction(&(current)->action_TIMEOUT, ACTION_UNMONITOR, ACTION_ALERT);
addeventaction(&(current)->action_PID, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_PPID, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_FSFLAG, ACTION_ALERT, ACTION_IGNORE);
/* Initialize internal event handlers */
addeventaction(&(current)->action_MONIT_START, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_MONIT_STOP, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_MONIT_RELOAD, ACTION_ALERT, ACTION_IGNORE);
pthread_mutex_init(¤t->mutex, NULL);
time(¤t->collected);
}
/*
* Add a service object to the servicelist
*/
static void addservice(Service_T s) {
Service_T n;
ASSERT(s);
NEW(n);
memcpy(n, s, sizeof(*s));
/* Add the service to the end of the service list */
if(tail != NULL) {
tail->next= n;
tail->next_conf= n;
} else {
servicelist= n;
servicelist_conf= n;
}
tail= n;
}
/*
* Add a dependant entry to the current service dependant list
*
*/
static void adddependant(char *dependant) {
Dependant_T d;
ASSERT(dependant);
NEW(d);
if (current->dependantlist != NULL) {
d->next= current->dependantlist;
}
d->dependant=dependant;
current->dependantlist= d;
}
/*
* Add the given mailaddress with the apropriate alert notification
* values and mail attributes to the given mailinglist.
*/
static void addmail(char *mailto, Mail_T f, Mail_T *l, unsigned int events, unsigned int reminder) {
Mail_T m;
ASSERT(mailto);
NEW(m);
m->events= events;
m->to= mailto;
m->from= f->from;
m->subject= f->subject;
m->message= f->message;
m->reminder= reminder;
m->next= *l;
*l= m;
reset_mailset();
}
/*
* Add the given portset to the current service's portlist
*/
static void addport(Port_T port) {
Port_T p;
char address[STRLEN];
ASSERT(port);
NEW(p);
p->port= port->port;
p->type= port->type;
p->socket= port->socket;
p->family= port->family;
p->action= port->action;
p->timeout= port->timeout;
p->request= port->request;
p->generic= port->generic;
p->protocol= port->protocol;
p->pathname= port->pathname;
p->hostname= port->hostname;
p->url_request= port->url_request;
p->request_checksum= port->request_checksum;
memcpy(&p->ApacheStatus, &port->ApacheStatus, sizeof(struct apache_status));
if (p->request_checksum) {
cleanup_hash_string(p->request_checksum);
if (strlen(p->request_checksum)==32) {
p->request_hashtype=HASH_MD5;
} else if (strlen(p->request_checksum)==40) {
p->request_hashtype=HASH_SHA1;
} else {
yyerror2("invalid checksum [%s]", p->request_checksum);
}
} else {
p->request_hashtype=0;
}
if(port->family == AF_INET) {
snprintf(address, STRLEN, "INET[%s:%d]", port->hostname, port->port);
} else if(port->family == AF_UNIX) {
snprintf(address, STRLEN, "UNIX[%s]", port->pathname);
}
p->address= xstrdup(address);
if(port->SSL.use_ssl == TRUE) {
if(!have_ssl()) {
yyerror("ssl check cannot be activated. SSL is not supported");
} else {
if (port->SSL.certmd5 != NULL) {
p->SSL.certmd5= port->SSL.certmd5;
cleanup_hash_string(p->SSL.certmd5);
}
p->SSL.use_ssl= TRUE;
p->SSL.version= port->SSL.version;
}
}
p->next= current->portlist;
current->portlist= p;
reset_portset();
}
/*
* Add a new resource object to the current service resource list
*/
static void addresource(Resource_T rr) {
Resource_T r;
ASSERT(rr);
NEW(r);
if(! Run.doprocess) {
yyerror("cannot activate service check.\n"
"\t(The process status engine was disabled. On certain"
" systems you must\n\trun monit as root to utilize this"
" feature)\n\t");
}
r->resource_id= rr->resource_id;
r->limit= rr->limit;
r->action= rr->action;
r->operator= rr->operator;
r->next= current->resourcelist;
current->resourcelist= r;
reset_resourceset();
}
/*
* Add a new file object to the current service timestamp list
*/
static void addtimestamp(Timestamp_T ts, int notime) {
Timestamp_T t;
ASSERT(ts);
NEW(t);
t->operator= ts->operator;
t->time= ts->time;
t->action= ts->action;
t->test_changes= ts->test_changes;
if(t->test_changes || notime) {
if(!File_exist(current->path)) {
DEBUG("%s: Debug: the path '%s' used in the TIMESTAMP statement"
" refer to a non-existing object\n", prog, current->path);
} else if(!(t->timestamp=
File_getTimestamp(current->path, S_IFDIR|S_IFREG))) {
yyerror2("cannot get the timestamp for '%s'", current->path);
}
}
t->next= current->timestamplist;
current->timestamplist= t;
reset_timestampset();
}
/*
* Add a new Size object to the current service size list
*/
static void addsize(Size_T ss, int nosize) {
Size_T s;
struct stat buf;
ASSERT(ss);
/*
In the case that we are testig changes, get the initial
size for future comparision. In the case that we are not
testing changes, we don't need the initial size nor require
file to exist in the time of configuration file parsing
*/
if(ss->test_changes != 0 && stat(current->path, &buf) != 0) {
yyerror2("cannot get size for '%s'", current->path);
reset_sizeset();
return;
}
NEW(s);
s->operator= ss->operator;
s->size= ss->size;
s->action= ss->action;
s->test_changes= ss->test_changes;
if(ss->test_changes || nosize)
s->size= (unsigned long long)buf.st_size;
s->next= current->sizelist;
current->sizelist= s;
reset_sizeset();
}
/*
* Set Checksum object in the current service
*/
static void addchecksum(Checksum_T cs) {
int len;
Checksum_T c;
ASSERT(cs);
if(!cs->hash) {
if(cs->type == HASH_UNKNOWN) {
cs->type=DEFAULT_HASH;
}
if( !(cs->hash= Util_getChecksum(current->path, cs->type))) {
yyerror2("cannot compute a checksum for file %s", current->path);
reset_checksumset();
return;
}
}
len= cleanup_hash_string(cs->hash);
if(cs->type == HASH_UNKNOWN) {
if (len==32) {
cs->type=HASH_MD5;
} else if (len==40) {
cs->type=HASH_SHA1;
} else {
yyerror2("invalid checksum [%s] for file %s", cs->hash, current->path);
reset_checksumset();
return;
}
} else if (( cs->type==HASH_MD5 && len!=32 ) ||
( cs->type==HASH_SHA1 && len!=40 )) {
yyerror2("invalid checksum [%s] for file %s", cs->hash, current->path);
reset_checksumset();
return;
}
NEW(c);
c->type=cs->type;
c->hash= cs->hash;
c->test_changes= cs->test_changes;
c->action= cs->action;
current->checksum= c;
reset_checksumset();
}
/*
* Set Perm object in the current service
*/
static void addperm(Perm_T ps) {
Perm_T p;
ASSERT(ps);
NEW(p);
p->perm= ps->perm;
p->action= ps->action;
current->perm= p;
reset_permset();
}
/*
* Set Match object in the current service
*/
static void addmatch(Match_T ms, int actionnumber, int linenumber) {
Match_T m;
Match_T ml;
int reg_return;
ASSERT(ms);
NEW(m);
#ifdef HAVE_REGEX_H
NEW(m->regex_comp);
#endif
m->match_string= ms->match_string;
m->match_path= ms->match_path?xstrdup(ms->match_path):NULL;
m->action= ms->action;
m->not= ms->not;
m->ignore= ms->ignore;
m->next=NULL;
addeventaction(&(m->action), actionnumber, ACTION_IGNORE);
#ifdef HAVE_REGEX_H
reg_return= regcomp(m->regex_comp, ms->match_string, REG_NOSUB|REG_EXTENDED);
if (reg_return!=0) {
char errbuf[STRLEN];
regerror(reg_return, ms->regex_comp, errbuf, STRLEN);
if (m->match_path != NULL)
yyerror2("regex parsing error:%s on line %i of", errbuf, linenumber);
else
yyerror2("regex parsing error:%s", errbuf);
}
#endif
if (current->matchlist) {
/* Find the end of the list */
for(ml=current->matchlist; ml->next; ml=ml->next);
ml->next= m;
} else {
current->matchlist= m;
}
}
static void addmatchpath(Match_T ms, int actionnumber) {
FILE *handle;
Command_T savecommand = NULL;
char buf[2048];
int linenumber=0;
ASSERT(ms->match_path);
handle = fopen(ms->match_path, "r");
if(handle == NULL) {
yyerror2("cannot read regex match file (%s)", ms->match_path);
return;
}
while(!feof(handle)) {
linenumber++;
if(! fgets(buf, 2048, handle))
continue;
if(strlen(buf)==0 || buf[0]=='\n')
continue;
if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = 0;
ms->match_string = xstrdup(buf);
/* The addeventaction() called from addmatch() will reset the
* command1 to NULL, but we need to duplicate the command for
* each line, thus need to save it here */
if(actionnumber == ACTION_EXEC) {
if(command1 == NULL) {
ASSERT(savecommand);
command1 = savecommand;
}
ASSERT(command1);
savecommand = copycommand(command1);
}
addmatch(ms, actionnumber, linenumber);
}
if(actionnumber == ACTION_EXEC && savecommand)
_gccmd(&savecommand);
fclose(handle);
}
/*
* Set Uid object in the current service
*/
static void adduid(Uid_T us) {
Uid_T u;
ASSERT(us);
NEW(u);
u->uid= us->uid;
u->action= us->action;
current->uid= u;
reset_uidset();
}
/*
* Set Gid object in the current service
*/
static void addgid(Gid_T gs) {
Gid_T g;
ASSERT(gs);
NEW(g);
g->gid= gs->gid;
g->action= gs->action;
current->gid= g;
reset_gidset();
}
/*
* Add a new device to the current service's device list
*/
static void adddevice(Device_T ds) {
Device_T dev;
ASSERT(ds);
NEW(dev);
dev->resource= ds->resource;
dev->operator= ds->operator;
dev->limit_absolute= ds->limit_absolute;
dev->limit_percent= ds->limit_percent;
dev->action= ds->action;
dev->next= current->devicelist;
current->devicelist= dev;
reset_deviceset();
}
/*
* Add a new icmp object to the current service's icmp list
*/
static void addicmp(Icmp_T is) {
if(!getuid()) {
Icmp_T icmp;
ASSERT(is);
NEW(icmp);
icmp->type= is->type;
icmp->count= is->count > ICMP_MAX_COUNT ? ICMP_MAX_COUNT : is->count;
icmp->timeout= is->timeout;
icmp->action= is->action;
icmp->is_available= FALSE;
icmp->response= -1;
icmp->next= current->icmplist;
current->icmplist= icmp;
} else {
yyerror("icmp statements must be run as root");
}
reset_icmpset();
}
/*
* Set EventAction object
*/
static void addeventaction(EventAction_T *_ea, int failed, int passed) {
EventAction_T ea;
ASSERT(_ea);
NEW(ea);
NEW(ea->failed);
NEW(ea->passed);
ea->failed->id= failed;
ea->failed->count= rate1.count;
ea->failed->cycles= rate1.cycles;
if(failed == ACTION_EXEC) {
ASSERT(command1);
ea->failed->exec = command1;
command1 = NULL;
}
describeAction(ea->failed);
ea->passed->id= passed;
ea->passed->count= rate2.count;
ea->passed->cycles= rate2.cycles;
if(passed == ACTION_EXEC) {
ASSERT(command2);
ea->passed->exec = command2;
command2 = NULL;
}
describeAction(ea->passed);
*_ea= ea;
reset_rateset();
}
/*
* Redefine EventAction object (used for default action overloading)
*/
static void seteventaction(EventAction_T *_ea, int failed, int passed) {
EventAction_T ea = *_ea;
ASSERT(ea);
ASSERT(ea->failed);
ASSERT(ea->passed);
ea->failed->id= failed;
ea->failed->count= rate1.count;
ea->failed->cycles= rate1.cycles;
if(failed == ACTION_EXEC) {
ASSERT(command1);
ea->failed->exec = command1;
command1 = NULL;
}
describeAction(ea->failed);
ea->passed->id= passe-----------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
Otherwise, the following line sets YYVAL to the semantic value of
the lookahead token. This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
#if YYLSP_NEEDED
/* Similarly for the default location. Let the user run additional
commands if for instance locations are ranges. */
yyloc = yylsp[1-yylen];
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
#endif
#if YYDEBUG
/* We have to keep this `#if YYDEBUG', since we use variables which
are defined only if `YYDEBUG' is set. */
if (yydebug)
{
int yyi;
YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
yyn, yyrline[yyn]);
/* Print the symbols being reduced, and their result. */
for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
}
#endif
switch (yyn) {
case 119:
#line 435 "p.y"
{
addmail(yyvsp[-5].string, &mailset, &Run.maillist, eventset, yyvsp[0].number);
}
break;
case 120:
#line 438 "p.y"
{
addmail(yyvsp[-2].string, &mailset, &Run.maillist, EVENT_ALL, yyvsp[0].number);
}
break;
case 121:
#line 441 "p.y"
{
addmail(yyvsp[-6].string, &mailset, &Run.maillist, ~eventset, yyvsp[0].number);
}
break;
case 122:
#line 446 "p.y"
{
if(!Run.isdaemon || ihp.daemon) {
ihp.daemon= TRUE;
Run.isdaemon= TRUE;
Run.polltime= yyvsp[0].number;
}
}
break;
case 123:
#line 455 "p.y"
{
Run.init= TRUE;
}
break;
case 124:
#line 460 "p.y"
{
if(!Run.logfile || ihp.logfile) {
ihp.logfile= TRUE;
setlogfile(yyvsp[0].string);
Run.use_syslog= FALSE;
Run.dolog=TRUE;
}
}
break;
case 125:
#line 468 "p.y"
{
setsyslog(NULL);
}
break;
case 126:
#line 471 "p.y"
{
setsyslog(yyvsp[0].string); FREE(yyvsp[0].string);
}
break;
case 127:
#line 476 "p.y"
{
Run.eventlist_dir= yyvsp[0].string;
}
break;
case 128:
#line 479 "p.y"
{
Run.eventlist_dir= yyvsp[-2].string;
Run.eventlist_slots= yyvsp[0].number;
}
break;
case 129:
#line 483 "p.y"
{
Run.eventlist_dir= xstrdup(MYEVENTLISTBASE);
Run.eventlist_slots= yyvsp[0].number;
}
break;
case 130:
#line 489 "p.y"
{
Run.statefile= yyvsp[0].string;
}
break;
case 131:
#line 494 "p.y"
{
if(!Run.pidfile || ihp.pidfile) {
ihp.pidfile= TRUE;
setpidfile(yyvsp[0].string);
}
}
break;
case 135:
#line 509 "p.y"
{
check_hostname((yyvsp[-3].url)->hostname);
addcollector(yyvsp[-3].url, yyvsp[-2].number, yyvsp[-1].number, yyvsp[0].string);
}
break;
case 136:
#line 515 "p.y"
{
Run.mailserver_timeout= yyvsp[0].number;
}
break;
case 137:
#line 520 "p.y"
{
Run.MailFormat.from=
mailset.from?
mailset.from:
xstrdup(ALERT_FROM);
Run.MailFormat.subject=
mailset.subject?
mailset.subject:
xstrdup(ALERT_SUBJECT);
Run.MailFormat.message=
mailset.message?
mailset.message:
xstrdup(ALERT_MESSAGE);
reset_mailset();
}
break;
case 138:
#line 537 "p.y"
{
Run.dohttpd= TRUE;
Run.httpdport= yyvsp[-1].number;
}
break;
case 141:
#line 547 "p.y"
{
/* Restore the current text overriden by lookahead */
FREE(argyytext);
argyytext= xstrdup(yyvsp[-4].string);
check_hostname(yyvsp[-4].string);
mailserverset.host = yyvsp[-4].string;
mailserverset.username = yyvsp[-3].string;
mailserverset.password = yyvsp[-2].string;
mailserverset.ssl.version= yyvsp[-1].number;
if(mailserverset.ssl.version != SSL_VERSION_NONE) {
mailserverset.ssl.use_ssl= TRUE;
if(mailserverset.ssl.version == SSL_VERSION_SSLV2 ||
mailserverset.ssl.version == SSL_VERSION_SSLV3)
mailserverset.port = PORT_SMTPS;
mailserverset.ssl.certmd5= yyvsp[0].string;
}
addmailserver(&mailserverset);
}
break;
case 142:
#line 566 "p.y"
{
/* Restore the current text overriden by lookahead */
FREE(argyytext);
argyytext= xstrdup(yyvsp[-6].string);
check_hostname(yyvsp[-6].string);
mailserverset.host = yyvsp[-6].string;
mailserverset.port = yyvsp[-4].number;
mailserverset.username = yyvsp[-3].string;
mailserverset.password = yyvsp[-2].string;
mailserverset.ssl.version= yyvsp[-1].number;
if(mailserverset.ssl.version != SSL_VERSION_NONE) {
mailserverset.ssl.use_ssl= TRUE;
mailserverset.ssl.certmd5= yyvsp[0].string;
}
addmailserver(&mailserverset);
}
break;
case 149:
#line 595 "p.y"
{ Run.httpdssl= FALSE; }
break;
case 150:
#line 596 "p.y"
{
Run.httpdssl= TRUE;
if(!have_ssl()) {
yyerror("SSL is not supported");
}
}
break;
case 156:
#line 611 "p.y"
{ FREE(yyvsp[0].string); }
break;
case 157:
#line 612 "p.y"
{ FREE(yyvsp[0].string); }
break;
case 159:
#line 616 "p.y"
{ Run.httpdsig= TRUE; }
break;
case 160:
#line 617 "p.y"
{ Run.httpdsig= FALSE; }
break;
case 165:
#line 628 "p.y"
{ Run.bind_addr= yyvsp[0].string; }
break;
case 166:
#line 631 "p.y"
{
Run.httpsslpem= yyvsp[0].string;
if(!File_checkStat(Run.httpsslpem,
"SSL server PEM file", S_IRWXU)) {
yyerror2("SSL server PEM file has too loose permissions");
}
}
break;
case 168:
#line 641 "p.y"
{
Run.httpsslclientpem= yyvsp[0].string;
Run.clientssl= TRUE;
if(!File_checkStat(Run.httpsslclientpem,
"SSL client PEM file", S_IRWXU | S_IRGRP | S_IROTH)) {
yyerror2("SSL client PEM file has too loose permissions");
}
}
break;
case 169:
#line 651 "p.y"
{
Run.allowselfcert= FALSE;
config_ssl(Run.allowselfcert);
}
break;
case 170:
#line 655 "p.y"
{
Run.allowselfcert= TRUE;
config_ssl(Run.allowselfcert);
}
break;
case 171:
#line 661 "p.y"
{
addcredentials(yyvsp[-3].string,yyvsp[-1].string, DIGEST_CLEARTEXT, yyvsp[0].number);
}
break;
case 172:
#line 664 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_CLEARTEXT);
FREE(yyvsp[0].string);
}
break;
case 173:
#line 668 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_CLEARTEXT);
FREE(yyvsp[0].string);
}
break;
case 174:
#line 672 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_MD5);
FREE(yyvsp[0].string);
}
break;
case 175:
#line 676 "p.y"
{
addhtpasswdentry(yyvsp[0].string, NULL, DIGEST_CRYPT);
FREE(yyvsp[0].string);
}
break;
case 176:
#line 680 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= CLEARTEXT;
}
break;
case 177:
#line 684 "p.y"
{
FREE(htpasswd_file);
}
break;
case 178:
#line 687 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= DIGEST_CLEARTEXT;
}
break;
case 179:
#line 691 "p.y"
{
FREE(htpasswd_file);
}
break;
case 180:
#line 694 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= DIGEST_MD5;
}
break;
case 181:
#line 698 "p.y"
{
FREE(htpasswd_file);
}
break;
case 182:
#line 701 "p.y"
{
htpasswd_file= yyvsp[0].string;
digesttype= DIGEST_CRYPT;
}
break;
case 183:
#line 705 "p.y"
{
FREE(htpasswd_file);
}
break;
case 184:
#line 708 "p.y"
{
if(! (add_net_allow(yyvsp[0].string) || add_host_allow(yyvsp[0].string))) {
yyerror2("erroneous network or host identifier %s", yyvsp[0].string);
}
FREE(yyvsp[0].string);
}
break;
case 187:
#line 720 "p.y"
{ addhtpasswdentry(htpasswd_file, yyvsp[0].string, digesttype);
FREE(yyvsp[0].string); }
break;
case 188:
#line 724 "p.y"
{ yyval.number= FALSE; }
break;
case 189:
#line 725 "p.y"
{ yyval.number= TRUE; }
break;
case 190:
#line 728 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_PROCESS, yyvsp[-2].string, yyvsp[0].string, check_process);
}
break;
case 191:
#line 732 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_PROCESS, yyvsp[-2].string, yyvsp[0].string, check_process);
}
break;
case 192:
#line 738 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_FILE, yyvsp[-2].string, yyvsp[0].string, check_file);
}
break;
case 193:
#line 744 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_DEVICE, yyvsp[-2].string, yyvsp[0].string, check_device);
}
break;
case 194:
#line 750 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_DIRECTORY, yyvsp[-2].string, yyvsp[0].string,
check_directory);
}
break;
case 195:
#line 757 "p.y"
{
check_hostname(yyvsp[0].string);
check_name(yyvsp[-2].string);
createservice(TYPE_HOST, yyvsp[-2].string, yyvsp[0].string, check_remote_host);
}
break;
case 196:
#line 764 "p.y"
{
check_name(yyvsp[0].string);
createservice(TYPE_SYSTEM, yyvsp[0].string, xstrdup(""),
check_system);
hassystem = TRUE;
}
break;
case 197:
#line 772 "p.y"
{
check_name(yyvsp[-2].string);
createservice(TYPE_FIFO, yyvsp[-2].string, yyvsp[0].string, check_fifo);
}
break;
case 198:
#line 778 "p.y"
{ addcommand(START); }
break;
case 199:
#line 779 "p.y"
{ addcommand(START); }
break;
case 200:
#line 782 "p.y"
{ addcommand(STOP); }
break;
case 201:
#line 783 "p.y"
{ addcommand(STOP); }
break;
case 206:
#line 794 "p.y"
{ addargument(yyvsp[0].string); }
break;
case 207:
#line 795 "p.y"
{ addargument(yyvsp[0].string); }
break;
case 208:
#line 798 "p.y"
{ addeuid( get_uid(yyvsp[0].string, 0) ); FREE(yyvsp[0].string); }
break;
case 209:
#line 799 "p.y"
{ addegid( get_gid(yyvsp[0].string, 0) ); FREE(yyvsp[0].string); }
break;
case 210:
#line 800 "p.y"
{ addeuid( get_uid(NULL, yyvsp[0].number) ); }
break;
case 211:
#line 801 "p.y"
{ addegid( get_gid(NULL, yyvsp[0].number) ); }
break;
case 212:
#line 804 "p.y"
{ yyval.string= NULL; }
break;
case 213:
#line 805 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 214:
#line 808 "p.y"
{ yyval.string= NULL; }
break;
case 215:
#line 809 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 216:
#line 813 "p.y"
{
portset.timeout= yyvsp[-4].number;
addeventaction(&(portset).action, yyvsp[-1].number, yyvsp[0].number);
addport(&portset);
}
break;
case 217:
#line 819 "p.y"
{
prepare_urlrequest(yyvsp[-6].url);
portset.timeout= yyvsp[-4].number;
addeventaction(&(portset).action, yyvsp[-1].number, yyvsp[0].number);
addport(&portset);
}
break;
case 218:
#line 828 "p.y"
{
portset.timeout= yyvsp[-4].number;
addeventaction(&(portset).action, yyvsp[-1].number, yyvsp[0].number);
addport(&portset);
}
break;
case 219:
#line 836 "p.y"
{
icmpset.type= yyvsp[-6].number;
icmpset.count= yyvsp[-5].number;
icmpset.timeout= yyvsp[-4].number;
addeventaction(&(icmpset).action, yyvsp[-1].number, yyvsp[0].number);
addicmp(&icmpset);
}
break;
case 220:
#line 845 "p.y"
{
if(current->type == TYPE_HOST)
portset.hostname= xstrdup(current->path);
else
portset.hostname= xstrdup(LOCALHOST);
}
break;
case 221:
#line 851 "p.y"
{ check_hostname(yyvsp[0].string); portset.hostname= yyvsp[0].string; }
break;
case 222:
#line 854 "p.y"
{ portset.port= yyvsp[0].number; portset.family= AF_INET; }
break;
case 223:
#line 857 "p.y"
{
portset.pathname= yyvsp[0].string; portset.family= AF_UNIX;
}
break;
case 224:
#line 862 "p.y"
{
portset.type= SOCK_STREAM;
}
break;
case 225:
#line 865 "p.y"
{
portset.type= SOCK_STREAM;
}
break;
case 226:
#line 868 "p.y"
{
portset.type= SOCK_STREAM;
portset.SSL.use_ssl= TRUE;
portset.SSL.version= yyvsp[-1].number;
if(portset.SSL.version == SSL_VERSION_NONE)
portset.SSL.version = SSL_VERSION_AUTO;
portset.SSL.certmd5= yyvsp[0].string;
}
break;
case 227:
#line 876 "p.y"
{
portset.type= SOCK_DGRAM;
}
break;
case 228:
#line 881 "p.y"
{ yyval.string= NULL; }
break;
case 229:
#line 882 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 230:
#line 885 "p.y"
{ yyval.number= SSL_VERSION_NONE; }
break;
case 231:
#line 886 "p.y"
{d;
ea->passed->count= rate2.count;
ea->passed->cycles= rate2.cycles;
if(passed == ACTION_EXEC) {
ASSERT(command2);
ea->passed->exec = command2;
command2 = NULL;
}
describeAction(ea->passed);
}
/*
* Return a protocol object for the given protocol
*/
static void *addprotocol(int protocol) {
switch (protocol) {
case P_APACHESTATUS: return create_apache_status();
case P_DNS: return create_dns();
case P_DWP: return create_dwp();
case P_FTP: return create_ftp();
case P_GENERIC: return create_generic();
case P_HTTP: return create_http();
case P_IMAP: return create_imap();
case P_CLAMAV: return create_clamav();
case P_LDAP2: return create_ldap2();
case P_LDAP3: return create_ldap3();
case P_MYSQL: return create_mysql();
case P_NNTP: return create_nntp();
case P_NTP3: return create_ntp3();
case P_POSTFIXPOLICY: return create_postfix_policy();
case P_POP: return create_pop();
case P_SMTP: return create_smtp();
case P_SSH: return create_ssh();
case P_RDATE: return create_rdate();
case P_RSYNC: return create_rsync();
case P_TNS: return create_tns();
case P_PGSQL: return create_pgsql();
}
return create_default();
}
/*
* Add a generic protocol handler to
*/
static void addgeneric(Port_T port, char *send, char *expect) {
Generic_T g= port->generic;
if (g == NULL) {
NEW(g);
port->generic= g;
} else {
while (g->next != NULL) {
g= g->next;
}
NEW(g->next);
g=g->next;
}
if (send != NULL) {
g->send=xstrdup(send);
g->expect=NULL;
} else if (expect != NULL) {
#ifdef HAVE_REGEX_H
int reg_return;
NEW(g->expect);
reg_return= regcomp(g->expect, expect, REG_NOSUB|REG_EXTENDED);
if (reg_return!=0) {
char errbuf[STRLEN];
regerror(reg_return, g->expect, errbuf, STRLEN);
yyerror2("regex parsing error:%s", errbuf);
}
#else
g->expect=xstrdup(expect);
#endif
g->send=NULL;
}
}
/*
* Add the current command object to the current service object's
* start or stop program.
*/
static void addcommand(int what) {
switch(what) {
case START: current->start= command; break;
case STOP: current->stop= command; break;
}
command= NULL;
}
/*
* Add a new argument to the argument list
*/
static void addargument(char *argument) {
ASSERT(argument);
if(! command) {
NEW(command);
check_exec(argument);
command->timeout = 1;
}
command->arg[command->length++]= argument;
command->arg[command->length]= NULL;
if(command->length >= ARGMAX) {
yyerror("exceeded maximum number of program arguments");
}
}
/*
* Setup a url request for the current port object
*/
static void prepare_urlrequest(URL_T U) {
ASSERT(U);
portset.protocol= addprotocol(P_HTTP);
if(urlrequest==NULL)
NEW(urlrequest);
urlrequest->url= U;
portset.hostname= xstrdup(U->hostname);
check_hostname(portset.hostname);
portset.port= U->port;
portset.url_request= urlrequest;
portset.type= SOCK_STREAM;
portset.request= Util_getString("%s%s%s", U->path, U->query?"?":"",
U->query?U->query:"");
/* Only the HTTP protocol is supported for URLs.
See also the lexer if this is to be changed in
the future */
portset.protocol= addprotocol(P_HTTP);
if(IS(U->protocol, "https")) {
portset.SSL.use_ssl= TRUE;
}
}
/*
* Set the url request for a port
*/
static void seturlrequest(int operator, char *regex) {
ASSERT(regex);
if(! urlrequest)
NEW(urlrequest);
urlrequest->operator= operator;
#ifdef HAVE_REGEX_H
{
int reg_return;
NEW(urlrequest->regex);
reg_return= regcomp(urlrequest->regex, regex, REG_NOSUB|REG_EXTENDED);
if (reg_return!=0) {
char errbuf[STRLEN];
regerror(reg_return, urlrequest->regex, errbuf, STRLEN);
yyerror2("regex parsing error: %s", errbuf);
}
}
#else
urlrequest->regex= xstrdup(regex);
#endif
}
/*
* Add a new data recipient server to the collector server list
*/
static void addcollector(URL_T url, int timeout, int sslversion,
char *certmd5) {
Collector_T c;
ASSERT(url);
NEW(c);
c->url = url;
if(!strcmp(c->url->protocol, "https")) {
if(!have_ssl()) {
yyerror("ssl check cannot be activated. SSL is not supported");
} else {
c->ssl.use_ssl= TRUE;
c->ssl.version= sslversion;
if (certmd5) {
c->ssl.certmd5= certmd5;
cleanup_hash_string(c->ssl.certmd5);
}
}
}
c->timeout = timeout;
c->next = NULL;
if(Run.collectors) {
Collector_T C;
for(C = Run.collectors; C->next; C = C->next)
/* Empty */ ;
C->next = c;
}
else {
Run.collectors = c;
}
}
/*
* Add a new smtp server to the mail server list
*/
static void addmailserver(MailServer_T mailserver) {
MailServer_T s;
ASSERT(mailserver->host);
NEW(s);
s->host = mailserver->host;
s->port = mailserver->port;
s->username = mailserver->username;
s->password = mailserver->password;
s->ssl.use_ssl = mailserver->ssl.use_ssl;
s->ssl.version = mailserver->ssl.version;
s->ssl.certmd5 = mailserver->ssl.certmd5;
s->next= NULL;
if(Run.mailservers) {
MailServer_T l;
for(l= Run.mailservers; l->next; l= l->next) /* empty */;
l->next= s;
} else {
Run.mailservers= s;
}
reset_mailserverset();
}
/*
* Return uid if found on the system. If the parameter user is NULL
* the uid parameter is used for looking up the user id on the system,
* otherwise the user parameter is used.
*/
static uid_t get_uid(char *user, uid_t uid) {
struct passwd *pwd;
if(user) {
pwd= getpwnam(user);
if(pwd == NULL) {
yyerror2("requested user not found on the system");
return(0);
}
} else {
if( (pwd= getpwuid(uid)) == NULL ) {
yyerror2("requested uid not found on the system");
return(0);
}
}
return(pwd->pw_uid);
}
/*
* Return gid if found on the system. If the parameter group is NULL
* the gid parameter is used for looking up the group id on the system,
* otherwise the group parameter is used.
*/
static gid_t get_gid(char *group, gid_t gid) {
struct group *grd;
if(group) {
grd= getgrnam(group);
if(grd == NULL) {
yyerror2("requested group not found on the system");
return(0);
}
} else {
if( (grd= getgrgid(gid)) == NULL ) {
yyerror2("requested gid not found on the system");
return(0);
}
}
return(grd->gr_gid);
}
/*
* Add a new user id to the current command object.
*/
static void addeuid(uid_t uid) {
if(!getuid()) {
command->has_uid= TRUE;
command->uid= uid;
} else {
yyerror("uid statement requires root privileges");
}
}
/*
* Add a new group id to the current command object.
*/
static void addegid(gid_t gid) {
if(!getuid()) {
command->has_gid= TRUE;
command->gid= gid;
} else {
yyerror("gid statement requires root privileges");
}
}
/*
* Reset the logfile if changed
*/
static void setlogfile(char *logfile) {
if(Run.logfile) {
if(IS(Run.logfile, logfile)) {
FREE(logfile);
return;
} else {
FREE(Run.logfile);
}
}
Run.logfile= logfile;
}
/*
* Reset the pidfile if changed
*/
static void setpidfile(char *pidfile) {
if(Run.pidfile) {
if(IS(Run.pidfile, pidfile)) {
FREE(pidfile);
return;
} else {
FREE(Run.pidfile);
}
}
Run.pidfile= pidfile;
}
/*
* Read a apache htpasswd file and add credentials found for username
*/
static void addhtpasswdentry(char *filename, char *username, int dtype) {
char *ht_username= NULL;
char *ht_passwd= NULL;
char buf[STRLEN];
FILE *handle= NULL;
int credentials_added= 0;
ASSERT(filename);
handle=fopen(filename, "r");
if ( handle==NULL ) {
if (username!=NULL) {
yyerror2("cannot read htpasswd (%s)", filename);
} else {
yyerror2("cannot read htpasswd", filename);
}
return;
}
while (!feof(handle)) {
char *colonindex= NULL;
int i;
if (! fgets(buf, STRLEN, handle)) {
continue;
}
/* strip trailing non visible characters */
for (i=strlen(buf)-1; i >= 0; i--) {
if ( buf[i] == ' ' || buf[i] == '\r' ||
buf[i] == '\n' || buf[i] == '\t' ) {
buf[i]='\0';
} else {
break;
}
}
if ( NULL == (colonindex=strchr(buf, ':'))) {
continue;
}
ht_passwd=xstrdup(colonindex+1);
*colonindex='\0';
/* Incase we have a file in /etc/passwd or /etc/shadow style we
* want to remove ":.*$" and Crypt and MD5 hashed dont have a colon
*/
if ( (NULL != (colonindex=strchr(ht_passwd, ':'))) &&
( dtype != DIGEST_CLEARTEXT) ) {
*colonindex='\0';
}
ht_username=xstrdup(buf);
if (username==NULL) {
if (addcredentials(ht_username, ht_passwd, dtype, FALSE)) {
credentials_added++;
}
} else if (strcmp(username, ht_username) == 0) {
if (addcredentials(ht_username, ht_passwd, dtype, FALSE)) {
credentials_added++;
}
} else {
FREE(ht_passwd);
FREE(ht_username);
}
}
if (credentials_added==0) {
if ( username == NULL ) {
yywarning2("htpasswd file (%s) has no usable credentials",
filename);
} else {
yywarning2("htpasswd file (%s) has no usable credentials "
"for user %s", filename, username);
}
}
fclose(handle);
}
/*
* Add Basic Authentication credentials
*/
static int addcredentials(char *uname, char *passwd, int dtype, int readonly) {
Auth_T c;
ASSERT(uname);
ASSERT(passwd);
if (Run.credentials == NULL) {
NEW(Run.credentials);
c=Run.credentials;
} else {
if (Util_getUserCredentials(uname) != NULL) {
yywarning2("credentials for user %s were already added, entry ignored",
uname);
FREE(uname);
FREE(passwd);
return FALSE;
}
c=Run.credentials;
while ( c->next != NULL ) {
c=c->next;
}
NEW(c->next);
c=c->next;
}
c->next=NULL;
c->uname=uname;
c->passwd=passwd;
c->digesttype=dtype;
c->is_readonly= readonly;
DEBUG("%s: Debug: Adding credentials for user '%s'.\n", prog, uname);
return TRUE;
}
/*
* Set the syslog and the facilities to be used
*/
static void setsyslog(char *facility) {
if (!Run.logfile || ihp.logfile) {
ihp.logfile= TRUE;
setlogfile(xstrdup("syslog"));
Run.use_syslog= TRUE;
Run.dolog=TRUE;
}
if(facility) {
if(IS(facility,"log_local0")) {
Run.facility = LOG_LOCAL0;
} else if(IS(facility, "log_local1")) {
Run.facility = LOG_LOCAL1;
} else if(IS(facility, "log_local2")) {
Run.facility = LOG_LOCAL2;
} else if(IS(facility, "log_local3")) {
Run.facility = LOG_LOCAL3;
} else if(IS(facility, "log_local4")) {
Run.facility = LOG_LOCAL4;
} else if(IS(facility, "log_local5")) {
Run.facility = LOG_LOCAL5;
} else if(IS(facility, "log_local6")) {
Run.facility = LOG_LOCAL6;
} else if(IS(facility, "log_local7")) {
Run.facility = LOG_LOCAL7;
} else if(IS(facility, "log_daemon")) {
Run.facility = LOG_DAEMON;
} else {
yyerror2("invalid syslog facility");
}
} else {
Run.facility= LOG_USER;
}
}
/*
* Reset the current mailset, eventset and reminder for reuse
*/
static void reset_mailset() {
memset(&mailset, 0, sizeof(struct mymail));
eventset= EVENT_NULL;
}
/*
* Reset the mailserver set to default values
*/
static void reset_mailserverset() {
memset(&mailserverset, 0, sizeof(struct mymailserver));
mailserverset.port = PORT_SMTP;
mailserverset.ssl.use_ssl = FALSE;
mailserverset.ssl.version= SSL_VERSION_AUTO;
}
/*
* Reset the Port set to default values
*/
static void reset_portset() {
memset(&portset, 0, sizeof(struct myport));
portset.socket= -1;
portset.type= SOCK_STREAM;
portset.family= AF_INET;
portset.SSL.version= SSL_VERSION_AUTO;
portset.timeout= NET_TIMEOUT;
urlrequest= NULL;
}
/*
* Reset the Proc set to default values
*/
static void reset_resourceset() {
resourceset.resource_id= 0;
resourceset.limit= 0;
resourceset.action= NULL;
resourceset.operator= OPERATOR_EQUAL;
}
/*
* Reset the Timestamp set to default values
*/
static void reset_timestampset() {
timestampset.operator= OPERATOR_EQUAL;
timestampset.time= 0;
timestampset.test_changes= FALSE;
timestampset.action= NULL;
}
/*
* Reset the Size set to default values
*/
static void reset_sizeset() {
sizeset.operator= OPERATOR_EQUAL;
sizeset.size= 0;
sizeset.test_changes= FALSE;
sizeset.action= NULL;
}
/*
* Reset the Checksum set to default values
*/
static void reset_checksumset() {
checksumset.type= HASH_UNKNOWN;
checksumset.hash= NULL;
checksumset.test_changes= FALSE;
checksumset.action= NULL;
}
/*
* Reset the Perm set to default values
*/
static void reset_permset() {
permset.perm= 0;
permset.action= NULL;
}
/*
* Reset the Uid set to default values
*/
static void reset_uidset() {
uidset.uid= 0;
uidset.action= NULL;
}
/*
* Reset the Gid set to default values
*/
static void reset_gidset() {
gidset.gid= 0;
gidset.action= NULL;
}
/*
* Reset the Device set to default values
*/
static void reset_deviceset() {
deviceset.resource= 0;
deviceset.operator= OPERATOR_EQUAL;
deviceset.limit_absolute= -1;
deviceset.limit_percent= -1;
deviceset.action= NULL;
}
/*
* Reset the ICMP set to default values
*/
static void reset_icmpset() {
icmpset.type= ICMP_ECHO;
icmpset.count= ICMP_ATTEMPT_COUNT;
icmpset.timeout= NET_TIMEOUT;
icmpset.action= NULL;
}
/*
* Reset the Rate set to default values
*/
static void reset_rateset() {
rate1.count = 1;
rate1.cycles = 1;
rate2.count = 1;
rate2.cycles = 1;
}
/* ---------------------------------------------------------------- Checkers */
/*
* Check for unique service name
*/
static void check_name(char *name) {
ASSERT(name);
if(Util_existService(name) || (current && IS(name, current->name))) {
yyerror2("service name conflict, %s already defined", name);
}
if(name && *name=='/') {
yyerror2("service name must not start with '/' -- ", name);
}
}
/*
* Permission statement semantic check
*/
static int check_perm(int perm) {
long result;
char *status;
char buf[STRLEN];
snprintf(buf, STRLEN, "%d", perm);
result= strtol(buf, &status, 8);
if( *status != '\0' || result < 0 || result > 07777 ) {
yyerror2("permission statements must have an octal value "
"between 0 and 7777");
}
return result;
}
/*
* Timeout statement semantic check
*/
static void check_timeout(int s, int c) {
if(s > c) {
yyerror2("the number of restarts must be less than poll cycles");
}
if(s <= 0 || c <= 0) {
yyerror2("zero or negative values not allowed in a timeout statement");
}
}
/*
* Every statement semantic check
*/
static void check_every(int every) {
if(every <= 1) {
yyerror2("an EVERY statement must have a value greater than 1");
}
}
/*
* Check hostname
*/
static void check_hostname(char *hostname) {
ASSERT(hostname);
if(!check_host(hostname)) {
yywarning2("hostname did not resolve");
}
}
/*
* Check the dependency graph for errors
* by doing a topological sort, thereby finding any cycles.
* Assures that graph is a Directed Acyclic Graph (DAG).
*/
static void check_depend() {
Service_T s;
Service_T depends_on= NULL;
Service_T* dlt = &depend_list; /* the current tail of it */
int done; /* no unvisited nodes left? */
int found_some; /* last iteration found anything new ? yyval.number= SSL_VERSION_SSLV2; }
break;
case 232:
#line 887 "p.y"
{ yyval.number= SSL_VERSION_SSLV3; }
break;
case 233:
#line 888 "p.y"
{ yyval.number= SSL_VERSION_TLS; }
break;
case 234:
#line 889 "p.y"
{ yyval.number= SSL_VERSION_AUTO; }
break;
case 235:
#line 892 "p.y"
{
portset.protocol= addprotocol(P_DEFAULT);
}
break;
case 236:
#line 895 "p.y"
{
portset.protocol= addprotocol(P_APACHESTATUS);
}
break;
case 237:
#line 898 "p.y"
{
portset.protocol= addprotocol(P_DEFAULT);
}
break;
case 238:
#line 901 "p.y"
{
portset.protocol= addprotocol(P_DNS);
}
break;
case 239:
#line 904 "p.y"
{
portset.protocol= addprotocol(P_DWP);
}
break;
case 240:
#line 907 "p.y"
{
portset.protocol= addprotocol(P_FTP);
}
break;
case 241:
#line 910 "p.y"
{
portset.protocol= addprotocol(P_HTTP);
}
break;
case 242:
#line 913 "p.y"
{
portset.protocol= addprotocol(P_IMAP);
}
break;
case 243:
#line 916 "p.y"
{
portset.protocol= addprotocol(P_CLAMAV);
}
break;
case 244:
#line 919 "p.y"
{
portset.protocol= addprotocol(P_LDAP2);
}
break;
case 245:
#line 922 "p.y"
{
portset.protocol= addprotocol(P_LDAP3);
}
break;
case 246:
#line 925 "p.y"
{
portset.protocol= addprotocol(P_MYSQL);
}
break;
case 247:
#line 928 "p.y"
{
portset.protocol= addprotocol(P_NNTP);
}
break;
case 248:
#line 931 "p.y"
{
portset.protocol= addprotocol(P_NTP3);
portset.type= SOCK_DGRAM;
}
break;
case 249:
#line 935 "p.y"
{
portset.protocol= addprotocol(P_POSTFIXPOLICY);
}
break;
case 250:
#line 938 "p.y"
{
portset.protocol= addprotocol(P_POP);
}
break;
case 251:
#line 941 "p.y"
{
portset.protocol= addprotocol(P_SMTP);
}
break;
case 252:
#line 944 "p.y"
{
portset.protocol= addprotocol(P_SSH);
}
break;
case 253:
#line 947 "p.y"
{
portset.protocol= addprotocol(P_RDATE);
}
break;
case 254:
#line 950 "p.y"
{
portset.protocol= addprotocol(P_RSYNC);
}
break;
case 255:
#line 953 "p.y"
{
portset.protocol= addprotocol(P_TNS);
}
break;
case 256:
#line 956 "p.y"
{
portset.protocol= addprotocol(P_PGSQL);
}
break;
case 257:
#line 959 "p.y"
{
portset.protocol= addprotocol(P_GENERIC);
}
break;
case 260:
#line 968 "p.y"
{ addgeneric(&portset, yyvsp[0].string, NULL); FREE(yyvsp[0].string);}
break;
case 261:
#line 969 "p.y"
{ addgeneric(&portset, NULL, yyvsp[0].string); FREE(yyvsp[0].string);}
break;
case 263:
#line 973 "p.y"
{
portset.request= Util_urlEncode(yyvsp[0].string);
FREE(yyvsp[0].string);
}
break;
case 264:
#line 977 "p.y"
{
portset.request= Util_urlEncode(yyvsp[-2].string); FREE(yyvsp[-2].string);
portset.request_checksum= yyvsp[0].string;
}
break;
case 267:
#line 987 "p.y"
{
portset.ApacheStatus.loglimitOP= yyvsp[-2].number;
portset.ApacheStatus.loglimit= (int)yyvsp[-1].number;
}
break;
case 268:
#line 991 "p.y"
{
portset.ApacheStatus.closelimitOP= yyvsp[-2].number;
portset.ApacheStatus.closelimit= (int)(yyvsp[-1].number);
}
break;
case 269:
#line 995 "p.y"
{
portset.ApacheStatus.dnslimitOP= yyvsp[-2].number;
portset.ApacheStatus.dnslimit= (int)(yyvsp[-1].number);
}
break;
case 270:
#line 999 "p.y"
{
portset.ApacheStatus.keepalivelimitOP= yyvsp[-2].number;
portset.ApacheStatus.keepalivelimit= (int)(yyvsp[-1].number);
}
break;
case 271:
#line 1003 "p.y"
{
portset.ApacheStatus.replylimitOP= yyvsp[-2].number;
portset.ApacheStatus.replylimit= (int)(yyvsp[-1].number);
}
break;
case 272:
#line 1007 "p.y"
{
portset.ApacheStatus.requestlimitOP= yyvsp[-2].number;
portset.ApacheStatus.requestlimit= (int)(yyvsp[-1].number);
}
break;
case 273:
#line 1011 "p.y"
{
portset.ApacheStatus.startlimitOP= yyvsp[-2].number;
portset.ApacheStatus.startlimit= (int)(yyvsp[-1].number);
}
break;
case 274:
#line 1015 "p.y"
{
portset.ApacheStatus.waitlimitOP= yyvsp[-2].number;
portset.ApacheStatus.waitlimit= (int)(yyvsp[-1].number);
}
break;
case 275:
#line 1019 "p.y"
{
portset.ApacheStatus.gracefullimitOP= yyvsp[-2].number;
portset.ApacheStatus.gracefullimit= (int)(yyvsp[-1].number);
}
break;
case 276:
#line 1023 "p.y"
{
portset.ApacheStatus.cleanuplimitOP= yyvsp[-2].number;
portset.ApacheStatus.cleanuplimit= (int)(yyvsp[-1].number);
}
break;
case 277:
#line 1029 "p.y"
{
seteventaction(&(current)->action_PID, yyvsp[0].number,
ACTION_IGNORE);
}
break;
case 278:
#line 1035 "p.y"
{
seteventaction(&(current)->action_PPID, yyvsp[0].number,
ACTION_IGNORE);
}
break;
case 279:
#line 1041 "p.y"
{
yyval.number= ICMP_ATTEMPT_COUNT;
}
break;
case 280:
#line 1044 "p.y"
{
yyval.number= yyvsp[0].number;
}
break;
case 281:
#line 1049 "p.y"
{
yyval.number= NET_TIMEOUT;
}
break;
case 282:
#line 1052 "p.y"
{
yyval.number= yyvsp[-1].number;
}
break;
case 283:
#line 1057 "p.y"
{
check_timeout(yyvsp[-5].number, yyvsp[-3].number);
current->def_timeout= TRUE;
current->to_start= yyvsp[-5].number;
current->to_cycle= yyvsp[-3].number;
}
break;
case 285:
#line 1066 "p.y"
{
seturlrequest(yyvsp[-1].number, yyvsp[0].string);
FREE(yyvsp[0].string);
}
break;
case 286:
#line 1072 "p.y"
{ yyval.number= OPERATOR_EQUAL; }
break;
case 287:
#line 1073 "p.y"
{ yyval.number= OPERATOR_NOTEQUAL; }
break;
case 288:
#line 1076 "p.y"
{
addmail(yyvsp[-5].string, &mailset, ¤t->maillist, eventset, yyvsp[0].number);
}
break;
case 289:
#line 1079 "p.y"
{
addmail(yyvsp[-2].string, &mailset, ¤t->maillist, EVENT_ALL, yyvsp[0].number);
}
break;
case 290:
#line 1082 "p.y"
{
addmail(yyvsp[-6].string, &mailset, ¤t->maillist, ~eventset, yyvsp[0].number);
}
break;
case 291:
#line 1085 "p.y"
{
addmail(yyvsp[0].string, &mailset, ¤t->maillist, EVENT_NULL, 0);
}
break;
case 292:
#line 1090 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 293:
#line 1093 "p.y"
{ yyval.string= yyvsp[0].string; }
break;
case 296:
#line 1100 "p.y"
{ eventset |= EVENT_CHANGED; }
break;
case 297:
#line 1101 "p.y"
{ eventset |= EVENT_CHECKSUM; }
break;
case 298:
#line 1102 "p.y"
{ eventset |= EVENT_CONNECTION; }
break;
case 299:
#line 1103 "p.y"
{ eventset |= EVENT_DATA; }
break;
case 300:
#line 1104 "p.y"
{ eventset |= EVENT_EXEC; }
break;
case 301:
#line 1105 "p.y"
{ eventset |= EVENT_GID; }
break;
case 302:
#line 1106 "p.y"
{ eventset |= EVENT_ICMP; }
break;
case 303:
#line 1107 "p.y"
{ eventset |= EVENT_INSTANCE; }
break;
case 304:
#line 1108 "p.y"
{ eventset |= EVENT_INVALID; }
break;
case 305:
#line 1109 "p.y"
{ eventset |= EVENT_MATCH; }
break;
case 306:
#line 1110 "p.y"
{ eventset |= EVENT_NONEXIST; }
break;
case 307:
#line 1111 "p.y"
{ eventset |= EVENT_PERMISSION; }
break;
case 308:
#line 1112 "p.y"
{ eventset |= EVENT_RESOURCE; }
break;
case 309:
#line 1113 "p.y"
{ eventset |= EVENT_SIZE; }
break;
case 310:
#line 1114 "p.y"
{ eventset |= EVENT_TIMEOUT; }
break;
case 311:
#line 1115 "p.y"
{ eventset |= EVENT_TIMESTAMP; }
break;
case 312:
#line 1116 "p.y"
{ eventset |= EVENT_UID; }
break;
case 313:
#line 1119 "p.y"
{ eventset |= EVENT_NONEXIST|EVENT_INVALID; }
break;
case 314:
#line 1120 "p.y"
{ eventset |= EVENT_NONEXIST|EVENT_INVALID; }
break;
case 315:
#line 1121 "p.y"
{ eventset |= EVENT_NONEXIST|EVENT_INVALID; }
break;
case 316:
#line 1122 "p.y"
{ eventset |= EVENT_TIMEOUT; }
break;
case 321:
#line 1133 "p.y"
{ mailset.from= yyvsp[0].string; }
break;
case 322:
#line 1134 "p.y"
{ mailset.subject= yyvsp[0].string; }
break;
case 323:
#line 1135 "p.y"
{ mailset.message= yyvsp[0].string; }
break;
case 324:
#line 1138 "p.y"
{
check_every(yyvsp[-1].number);
current->def_every= TRUE;
current->every= yyvsp[-1].number;
}
break;
case 325:
#line 1145 "p.y"
{
current->mode= MODE_ACTIVE;
}
break;
case 326:
#line 1148 "p.y"
{
current->mode= MODE_PASSIVE;
}
break;
case 327:
#line 1151 "p.y"
{
current->mode= MODE_MANUAL;
current->monitor= MONITOR_NOT;
}
break;
case 328:
#line 1157 "p.y"
{ current->group= yyvsp[0].string; }
break;
case 332:
#line 1168 "p.y"
{ adddependant(yyvsp[0].string); }
break;
case 333:
#line 1171 "p.y"
{
addeventaction(&(resourceset).action,
yyvsp[-1].number, yyvsp[0].number);
addresource(&resourceset);
}
break;
case 340:
#line 1188 "p.y"
{
addeventaction(&(resourceset).action,
yyvsp[-1].number, yyvsp[0].number);
addresource(&resourceset);
}
break;
case 346:
#line 1204 "p.y"
{
resourceset.resource_id= RESOURCE_ID_CPU_PERCENT;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 347:
#line 1211 "p.y"
{
resourceset.resource_id= yyvsp[-3].number;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 348:
#line 1218 "p.y"
{ yyval.number= RESOURCE_ID_CPUUSER; }
break;
case 349:
#line 1219 "p.y"
{ yyval.number= RESOURCE_ID_CPUSYSTEM; }
break;
case 350:
#line 1220 "p.y"
{ yyval.number= RESOURCE_ID_CPUWAIT; }
break;
case 351:
#line 1223 "p.y"
{
resourceset.resource_id= RESOURCE_ID_MEM_KBYTE;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (int) (yyvsp[-1].real *
(yyvsp[0].number / 1024.0));
}
break;
case 352:
#line 1229 "p.y"
{
resourceset.resource_id= RESOURCE_ID_MEM_PERCENT;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 353:
#line 1234 "p.y"
{
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_KBYTE;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (int) (yyvsp[-1].real *
(yyvsp[0].number / 1024.0));
}
break;
case 354:
#line 1240 "p.y"
{
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_PERCENT;
resourceset.operator= yyvsp[-2].number;
resourceset.limit= (yyvsp[-1].number * 10);
}
break;
case 355:
#line 1247 "p.y"
{
resourceset.resource_id= RESOURCE_ID_CHILDREN;
resourceset.operator= yyvsp[-1].number;
resourceset.limit= (int) yyvsp[0].number;
}
break;
case 356:
#line 1254 "p.y"
{
resourceset.resource_id= yyvsp[-2].number;
resourceset.operator= yyvsp[-1].number;
resourceset.limit= (int) (yyvsp[0].real * 10.0);
}
break;
case 357:
#line 1261 "p.y"
{ yyval.number= RESOURCE_ID_LOAD1; }
break;
case 358:
#line 1262 "p.y"
{ yyval.number= RESOURCE_ID_LOAD5; }
break;
case 359:
#line 1263 "p.y"
{ yyval.number= RESOURCE_ID_LOAD15; }
break;
case 360:
#line 1266 "p.y"
{ yyval.real = yyvsp[0].real; }
break;
case 361:
#line 1267 "p.y"
{ yyval.real = (float) yyvsp[0].number; }
break;
case 362:
#line 1271 "p.y"
{
timestampset.operator= yyvsp[-6].number;
timestampset.time= (yyvsp[-5].number * yyvsp[-4].number);
addeventaction(&(timestampset).action, yyvsp[-1].number,
yyvsp[0].number);
addtimestamp(×tampset, FALSE);
}
break;
case 363:
#line 1278 "p.y"
{
timestampset.test_changes= TRUE;
addeventaction(&(timestampset).action, yyvsp[0].number,
ACTION_IGNORE);
addtimestamp(×tampset, TRUE);
}
break;
case 364:
#line 1286 "p.y"
{ yyval.number= OPERATOR_EQUAL; }
break;
case 365:
#line 1287 "p.y"
{ yyval.number= OPERATOR_GREATER; }
break;
case 366:
#line 1288 "p.y"
{ yyval.number= OPERATOR_LESS; }
break;
case 367:
#line 1289 "p.y"
{ yyval.number= OPERATOR_EQUAL; }
break;
case 368:
#line 1290 "p.y"
{ yyval.number= OPERATOR_NOTEQUAL; }
break;
case 369:
#line 1291 "p.y"
{ yyval.number= OPERATOR_NOTEQUAL; }
break;
case 370:
#line 1294 "p.y"
{ yyval.number= TIME_SECOND; }
break;
case 371:
#line 1295 "p.y"
{ yyval.number= TIME_SECOND; }
break;
case 372:
#line 1296 "p.y"
{ yyval.number= TIME_MINUTE; }
break;
case 373:
#line 1297 "p.y"
{ yyval.number= TIME_HOUR; }
break;
case 374:
#line 1298 "p.y"
{ yyval.number= TIME_DAY; }
break;
case 375:
#line 1301 "p.y"
{ yyval.number= ACTION_ALERT; }
break;
case 376:
#line 1302 "p.y"
{ yyval.number= ACTION_EXEC; }
break;
case 377:
#line 1303 "p.y"
{ yyval.number= ACTION_EXEC; }
break;
case 378:
#line 1304 "p.y"
{ yyval.number= ACTION_RESTART; }
break;
case 379:
#line 1305 "p.y"
{ yyval.number= ACTION_START; }
break;
case 380:
#line 1306 "p.y"
{ yyval.number= ACTION_STOP; }
break;
case 381:
#line 1307 "p.y"
{ yyval.number= ACTION_UNMONITOR; }
break;
case 382:
#line 1310 "p.y"
{
yyval.number= yyvsp[0].number;
if(yyvsp[0].number == ACTION_EXEC && command) {
command1= command;
command= NULL;
}
}
break;
case 383:
#line 1319 "p.y"
{
yyval.number= yyvsp[0].number;
if(yyvsp[0].number == ACTION_EXEC && command) {
command2= command;
command= NULL;
}
}
break;
case 385:
#line 1329 "p.y"
{
rate1.count = yyvsp[-1].number;
rate1.cycles = yyvsp[-1].number;
if(rate1.cycles < 1 || rate1.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must */
depend_list = NULL; /* depend_list will be the topological sorted servicelist */
do {
done = TRUE;
found_some = FALSE;
for(s= servicelist; s; s= s->next) {
Dependant_T d;
if(s->visited)
continue;
done = FALSE; // still unvisited nodes
depends_on = NULL;
for(d= s->dependantlist; d; d= d->next) {
Service_T dp = Util_getService(d->dependant);
if(!dp) {
LogError("%s: Error: Depend service '%s' is not defined in the "
"control file\n", prog, d->dependant);
exit(1);
}
if (!dp->visited) {
depends_on = dp;
}
}
if (!depends_on) {
s->visited = TRUE;
found_some = TRUE;
*dlt = s;
dlt = &s->next_depend;
}
}
} while(found_some && !done);
if (!done)
{
ASSERT(depends_on);
LogError("%s: Error: Found a depend loop in the control file "
"involving the service '%s'\n", prog, depends_on->name);
exit(1);
}
ASSERT(depend_list);
servicelist= depend_list;
for(s= depend_list; s; s= s->next_depend)
s->next= s->next_depend;
reset_depend();
}
/*
* Check if the executable exist
*/
static void check_exec(char *exec) {
if(! File_exist(exec)) {
yyerror2("the executable does not exist");
}
}
/* -------------------------------------------------------------------- Misc */
/*
* Cleans up an md5 string, tolower and remove byte separators
*/
static int cleanup_hash_string(char *hashstring) {
int i= 0, j= 0;
ASSERT(hashstring);
while (hashstring[i] != '\0') {
if (isxdigit((int) hashstring[i])) {
hashstring[j]=tolower((int)hashstring[i]);
j++;
}
i++;
}
hashstring[j]='\0';
return j;
}
static void describeAction(Action_T A) {
#define BUF_CURSOR (A->description + strlen(A->description))
#define BUF_AVAILABLE (sizeof(A->description) - strlen(A->description))
snprintf(BUF_CURSOR, BUF_AVAILABLE, "%s", actionnames[A->id]);
if(A->id == ACTION_EXEC) {
int i = 0;
Command_T C = A->exec;
while(C->arg[i]) {
snprintf(BUF_CURSOR, BUF_AVAILABLE, "%s%s", i?" ":" '", C->arg[i]);
i++;
}
snprintf(BUF_CURSOR, BUF_AVAILABLE, "'");
if(C->has_uid)
snprintf(BUF_CURSOR, BUF_AVAILABLE, " as uid %d", C->uid);
if(C->has_gid)
snprintf(BUF_CURSOR, BUF_AVAILABLE, " as gid %d", C->gid);
snprintf(BUF_CURSOR, BUF_AVAILABLE, " timeout %d cycle(s)", C->timeout);
}
#undef BUF_CURSOR
#undef BUF_AVAILABLE
}
/* Return deep copy of the command */
static Command_T copycommand(Command_T source) {
int i;
Command_T copy = NULL;
NEW(copy);
copy->length = source->length;
copy->has_uid = source->has_uid;
copy->uid = source->uid;
copy->has_gid = source->has_gid;
copy->gid = source->gid;
copy->timeout = source->timeout;
for(i = 0; i < copy->length; i++) {
copy->arg[i] = xstrdup(source->arg[i]);
}
copy->arg[copy->length]= NULL;
return copy;
}
be between 1 and %d",
BITMAP_MAX);
}
}
break;
case 386:
#line 1337 "p.y"
{
rate1.count = yyvsp[-2].number;
rate1.cycles = yyvsp[-1].number;
if(rate1.cycles < 1 || rate1.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must be between 1 and %d",
BITMAP_MAX);
}
if(rate1.count < 1 || rate1.count > rate1.cycles) {
yyerror2("the number of events must be bigger then 0 and "
"less than poll cycles");
}
}
break;
case 388:
#line 1352 "p.y"
{
rate2.count = yyvsp[-1].number;
rate2.cycles = yyvsp[-1].number;
if(rate2.cycles < 1 || rate2.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must be between 1 and %d",
BITMAP_MAX);
}
}
break;
case 389:
#line 1360 "p.y"
{
rate2.count = yyvsp[-2].number;
rate2.cycles = yyvsp[-1].number;
if(rate2.cycles < 1 || rate2.cycles > BITMAP_MAX) {
yyerror2("the number of cycles must be between 1 and %d",
BITMAP_MAX);
}
if(rate2.count < 1 || rate2.count > rate2.cycles) {
yyerror2("the number of events must be bigger then 0 and "
"less than poll cycles");
}
}
break;
case 390:
#line 1374 "p.y"
{
yyval.number= ACTION_ALERT;
}
break;
case 391:
#line 1377 "p.y"
{
yyval.number= yyvsp[0].number;
}
break;
case 392:
#line 1380 "p.y"
{
yyval.number= yyvsp[0].number;
}
break;
case 393:
#line 1385 "p.y"
{
addeventaction(&(checksumset).action, yyvsp[-1].number,
yyvsp[0].number);
addchecksum(&checksumset);
}
break;
case 394:
#line 1391 "p.y"
{
checksumset.hash= yyvsp[-4].string;
addeventaction(&(checksumset).action, yyvsp[-1].number,
yyvsp[0].number);
addchecksum(&checksumset);
}
break;
case 395:
#line 1397 "p.y"
{
checksumset.test_changes= TRUE;
addeventaction(&(checksumset).action, yyvsp[0].number,
ACTION_IGNORE);
addchecksum(&checksumset);
}
break;
case 396:
#line 1404 "p.y"
{ checksumset.type= HASH_UNKNOWN; }
break;
case 397:
#line 1405 "p.y"
{ checksumset.type= HASH_MD5; }
break;
case 398:
#line 1406 "p.y"
{ checksumset.type= HASH_SHA1; }
break;
case 399:
#line 1409 "p.y"
{
deviceset.resource= RESOURCE_ID_INODE;
deviceset.operator= yyvsp[-5].number;
deviceset.limit_absolute= yyvsp[-4].number;
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 400:
#line 1416 "p.y"
{
deviceset.resource= RESOURCE_ID_INODE;
deviceset.operator= yyvsp[-6].number;
deviceset.limit_percent= (int)(yyvsp[-5].number * 10);
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 401:
#line 1425 "p.y"
{
if(!device_usage(current->inf, current->path)) {
yyerror2("cannot read usage of device %s",
current->path);
}
deviceset.resource= RESOURCE_ID_SPACE;
deviceset.operator= yyvsp[-6].number;
deviceset.limit_absolute=
(int)(
(float)yyvsp[-5].real /
(float)current->inf->f_bsize * (float)yyvsp[-4].number
);
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 402:
#line 1440 "p.y"
{
deviceset.resource= RESOURCE_ID_SPACE;
deviceset.operator= yyvsp[-6].number;
deviceset.limit_percent= (int)(yyvsp[-5].number * 10);
addeventaction(&(deviceset).action, yyvsp[-1].number, yyvsp[0].number);
adddevice(&deviceset);
}
break;
case 403:
#line 1449 "p.y"
{
seteventaction(&(current)->action_FSFLAG, yyvsp[0].number,
ACTION_IGNORE);
}
break;
case 404:
#line 1455 "p.y"
{ yyval.number= UNIT_BYTE; }
break;
case 405:
#line 1456 "p.y"
{ yyval.number= UNIT_KILOBYTE; }
break;
case 406:
#line 1457 "p.y"
{ yyval.number= UNIT_MEGABYTE; }
break;
case 407:
#line 1458 "p.y"
{ yyval.number= UNIT_GIGABYTE; }
break;
case 408:
#line 1461 "p.y"
{
permset.perm= check_perm(yyvsp[-4].number);
addeventaction(&(permset).action, yyvsp[-1].number, yyvsp[0].number);
addperm(&permset);
}
break;
case 409:
#line 1468 "p.y"
{
matchset.ignore= FALSE;
matchset.match_path= yyvsp[-3].string;
matchset.match_string= NULL;
addmatchpath(&matchset, yyvsp[0].number);
FREE(yyvsp[-3].string);
}
break;
case 410:
#line 1475 "p.y"
{
matchset.ignore= FALSE;
matchset.match_path= NULL;
matchset.match_string= xstrdup(yyvsp[-3].string);
addmatch(&matchset, yyvsp[0].number, 0);
}
break;
case 411:
#line 1481 "p.y"
{
matchset.ignore= TRUE;
matchset.match_path= yyvsp[0].string;
matchset.match_string= NULL;
addmatchpath(&matchset, ACTION_IGNORE);
FREE(yyvsp[0].string);
}
break;
case 412:
#line 1488 "p.y"
{
matchset.ignore= TRUE;
matchset.match_path= NULL;
matchset.match_string= xstrdup(yyvsp[0].string);
addmatch(&matchset, ACTION_IGNORE, 0);
}
break;
case 413:
#line 1496 "p.y"
{
matchset.not= FALSE;
}
break;
case 414:
#line 1499 "p.y"
{
matchset.not= TRUE;
}
break;
case 415:
#line 1505 "p.y"
{
sizeset.operator= yyvsp[-6].number;
sizeset.size= ((unsigned long long)yyvsp[-5].number * yyvsp[-4].number);
addeventaction(&(sizeset).action, yyvsp[-1].number, yyvsp[0].number);
addsize(&sizeset, FALSE);
}
break;
case 416:
#line 1511 "p.y"
{
sizeset.test_changes= TRUE;
addeventaction(&(sizeset).action, yyvsp[0].number,
ACTION_IGNORE);
addsize(&sizeset, TRUE);
}
break;
case 417:
#line 1519 "p.y"
{
uidset.uid= get_uid(yyvsp[-4].string, 0);
addeventaction(&(uidset).action, yyvsp[-1].number, yyvsp[0].number);
adduid(&uidset);
FREE(yyvsp[-4].string);
}
break;
case 418:
#line 1525 "p.y"
{
uidset.uid= get_uid(NULL, yyvsp[-4].number);
addeventaction(&(uidset).action, yyvsp[-1].number, yyvsp[0].number);
adduid(&uidset);
}
break;
case 419:
#line 1532 "p.y"
{
gidset.gid= get_gid(yyvsp[-4].string, 0);
addeventaction(&(gidset).action, yyvsp[-1].number, yyvsp[0].number);
addgid(&gidset);
FREE(yyvsp[-4].string);
}
break;
case 420:
#line 1538 "p.y"
{
gidset.gid= get_gid(NULL, yyvsp[-4].number);
addeventaction(&(gidset).action, yyvsp[-1].number, yyvsp[0].number);
addgid(&gidset);
}
break;
case 421:
#line 1545 "p.y"
{ yyval.number= ICMP_ECHO; }
break;
case 422:
#line 1548 "p.y"
{ yyval.number = 0; }
break;
case 423:
#line 1549 "p.y"
{ yyval.number = yyvsp[0].number; }
break;
case 424:
#line 1550 "p.y"
{ yyval.number = yyvsp[-1].number; }
break;
}
#line 705 "/usr/local/share/bison/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
#if YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#if YYLSP_NEEDED
*++yylsp = yyloc;
#endif
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
YYSIZE_T yysize = 0;
char *yymsg;
int yyx, yycount;
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("parse error, unexpected ") + 1;
yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("parse error; also virtual memory exhausted");
}
else
#endif /* defined (YYERROR_VERBOSE) */
yyerror ("parse error");
}
goto yyerrlab1;
/*--------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action |
`--------------------------------------------------*/
yyerrlab1:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
yychar, yytname[yychar1]));
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
/*-------------------------------------------------------------------.
| yyerrdefault -- current state does not do anything special for the |
| error token. |
`-------------------------------------------------------------------*/
yyerrdefault:
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
/* If its default is to accept any token, ok. Otherwise pop it. */
yyn = yydefact[yystate];
if (yyn)
goto yydefault;
#endif
/*---------------------------------------------------------------.
| yyerrpop -- pop the current state because it cannot handle the |
| error token |
`---------------------------------------------------------------*/
yyerrpop:
if (yyssp == yyss)
YYABORT;
yyvsp--;
yystate = *--yyssp;
#if YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG
if (yydebug)
{
short *yyssp1 = yyss - 1;
YYFPRINTF (stderr, "Error: state stack now");
while (yyssp1 != yyssp)
YYFPRINTF (stderr, " %d", *++yyssp1);
YYFPRINTF (stderr, "\n");
}
#endif
/*--------------.
| yyerrhandle. |
`--------------*/
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
YYDPRINTF ((stderr, "Shifting error token, "));
*++yyvsp = yylval;
#if YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
/*---------------------------------------------.
| yyoverflowab -- parser overflow comes here. |
`---------------------------------------------*/
yyoverflowlab:
yyerror ("parser stack overflow");
yyresult = 2;
/* Fall through. */
yyreturn:
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
return yyresult;
}
#line 1553 "p.y"
/* -------------------------------------------------------- Parser interface */
/**
* Syntactic error routine
*
* This routine is automatically called by the lexer!
*/
void yyerror(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogError("%s:%i: Error: %s '%s'\n", currentfile, lineno, msg, yytext);
cfg_errflag++;
FREE(msg);
}
/**
* Syntactical warning routine
*/
void yywarning(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogWarning("%s:%i: Warning: %s '%s'\n", currentfile, lineno, msg, yytext);
FREE(msg);
}
/**
* Argument error routine
*/
void yyerror2(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogError("%s:%i: Error: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
cfg_errflag++;
FREE(msg);
}
/**
* Argument warning routine
*/
void yywarning2(const char *s, ...) {
long len;
va_list ap;
char *msg= NULL;
ASSERT(s);
va_start(ap,s);
msg= Util_formatString(s, ap, &len);
va_end(ap);
LogWarning("%s:%i: Warning: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
FREE(msg);
}
/*
* The Parser hook - start parsing the control file
* Returns TRUE if parsing succeeded, otherwise FALSE
*/
int parse(char *controlfile) {
ASSERT(controlfile);
servicelist= tail= current= NULL;
/*
* Secure check the monitrc file. The run control file must have the
* same uid as the REAL uid of this process, it must have permissions
* no greater than 700 and it must not be a symbolic link.
*/
if (! File_checkStat(controlfile, "control file", S_IRUSR|S_IWUSR|S_IXUSR)) {
return FALSE;
}
if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
LogError("%s: Error: cannot open the control file '%s' -- %s\n",
prog, controlfile, STRERROR);
return FALSE;
}
currentfile=xstrdup(controlfile);
/*
* Creation of the global service list is synchronized
*/
LOCK(Run.mutex)
preparse();
yyparse();
fclose(yyin);
/* Add the default general system service if not specified explicitly */
if(!hassystem) {
createservice(TYPE_SYSTEM, xstrdup(Run.localhostname), xstrdup(""), check_system);
}
/* If defined - add the last service to the service list */
if(current) {
addservice(current);
FREE(current);
}
postparse();
END_LOCK;
FREE(currentfile);
if (argyytext!=NULL)
FREE(argyytext);
return(cfg_errflag == 0);
}
/* ----------------------------------------------------------------- Private */
/**
* Initialize objects used by the parser.
*/
static void preparse() {
int i;
char localhost[STRLEN];
/*
* Get the localhost name
*/
if(gethostname(localhost, sizeof(localhost)) < 0) {
snprintf(localhost, STRLEN, "%s", LOCALHOST);
}
/* Set instance incarnation ID */
time(&Run.incarnation);
/* Reset lexer */
buffer_stack_ptr=0;
lineno= 1;
arglineno= 1;
argcurrentfile=NULL;
argyytext=NULL;
/* Reset parser */
Run.wait_start= 0;
Run.stopped= FALSE;
Run.dolog= FALSE;
Run.dohttpd= FALSE;
Run.doaction= FALSE;
Run.httpdsig= TRUE;
Run.credentials= NULL;
Run.httpdssl= FALSE;
Run.httpsslpem= NULL;
Run.httpsslclientpem= NULL;
Run.clientssl= FALSE;
Run.mailserver_timeout= NET_TIMEOUT;
Run.bind_addr= NULL;
Run.eventlist= NULL;
Run.eventlist_dir= NULL;
Run.eventlist_slots= -1;
Run.system= NULL;
Run.maillist= NULL;
Run.mailservers= NULL;
Run.MailFormat.from= NULL;
Run.MailFormat.subject= NULL;
Run.MailFormat.message= NULL;
Run.localhostname= xstrdup(localhost);
depend_list= NULL;
Run.handler_init= TRUE;
for(i=0; i<=HANDLER_MAX; i++) {
Run.handler_queue[i] = 0;
}
/*
* Initialize objects
*/
reset_uidset();
reset_gidset();
reset_sizeset();
reset_mailset();
reset_mailserverset();
reset_portset();
reset_permset();
reset_icmpset();
reset_rateset();
reset_deviceset();
reset_resourceset();
reset_checksumset();
reset_timestampset();
}
/*
* Check that values are reasonable after parsing
*/
static void postparse() {
Service_T s;
if(cfg_errflag || (servicelist==NULL)) {
return;
}
/* Check the sanity of any dependency graph */
check_depend();
/* Check that we do not start monit in daemon mode without having a
* poll time */
if(!Run.polltime && (Run.isdaemon || Run.init)) {
LogError("%s: Error: Poll time not defined. Please define poll time"
" in the\n control file or use the -d option when starting monit\n",
prog);
cfg_errflag++;
}
if(Run.logfile) {
Run.dolog = TRUE;
}
for(s= servicelist; s; s= s->next) {
/* Set the general system service shortcut */
if(s->type == TYPE_SYSTEM)
Run.system = s;
if(s->type != TYPE_HOST)
continue;
/* Verify that a remote service has a port or an icmp list */
if(!s->portlist && !s->icmplist) {
LogError("%s: Error: 'check host' statement is incomplete; Please"
" specify a port number to test\n or an icmp test at the remote"
" host: '%s'\n",
prog, s->name);
cfg_errflag++;
}
}
}
/*
* Create a new service object and add any current objects to the
* service list.
*/
static void createservice(int type, char *name, char *value,
int (*check)(Service_T s)) {
ASSERT(name);
ASSERT(value);
if(current) {
addservice(current);
} else {
NEW(current);
}
/* Reset the current object */
memset(current, 0, sizeof(*current));
NEW(current->inf);
Util_resetInfo(current);
/* Set default values */
current->monitor= MONITOR_INIT;
current->mode= MODE_ACTIVE;
current->name= name;
current->type= type;
current->check= check;
current->path= value;
/* Initialize general event handlers */
addeventaction(&(current)->action_DATA, ACTION_ALERT, ACTION_ALERT);
addeventaction(&(current)->action_EXEC, ACTION_ALERT, ACTION_ALERT);
addeventaction(&(current)->action_INVALID, ACTION_RESTART, ACTION_ALERT);
addeventaction(&(current)->action_NONEXIST, ACTION_RESTART, ACTION_ALERT);
addeventaction(&(current)->action_TIMEOUT, ACTION_UNMONITOR, ACTION_ALERT);
addeventaction(&(current)->action_PID, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_PPID, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_FSFLAG, ACTION_ALERT, ACTION_IGNORE);
/* Initialize internal event handlers */
addeventaction(&(current)->action_MONIT_START, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_MONIT_STOP, ACTION_ALERT, ACTION_IGNORE);
addeventaction(&(current)->action_MONIT_RELOAD, ACTION_ALERT, ACTION_IGNORE);
pthread_mutex_init(¤t->mutex, NULL);
time(¤t->collected);
}
/*
* Add a service object to the servicelist
*/
static void addservice(Service_T s) {
Service_T n;
ASSERT(s);
NEW(n);
memcpy(n, s, sizeof(*s));
/* Add the service to the end of the service list */
if(tail != NULL) {
tail->next= n;
tail->next_conf= n;
} else {
servicelist= n;
servicelist_conf= n;
}
tail= n;
}
/*
* Add a dependant entry to the current service dependant list
*
*/
static void adddependant(char *dependant) {
Dependant_T d;
ASSERT(dependant);
NEW(d);
if (current->dependantlist != NULL) {
d->next= current->dependantlist;
}
d->dependant=dependant;
current->dependantlist= d;
}
/*
* Add the given mailaddress with the apropriate alert notification
* values and mail attributes to the given mailinglist.
*/
static void addmail(char *mailto, Mail_T f, Mail_T *l, unsigned int events, unsigned int reminder) {
Mail_T m;
ASSERT(mailto);
NEW(m);
m->events= events;
m->to= mailto;
m->from= f->from;
m->subject= f->subject;
m->message= f->message;
m->reminder= reminder;
m->next= *l;
*l= m;
reset_mailset();
}
/*
* Add the given portset to the current service's portlist
*/
static void addport(Port_T port) {
Port_T p;
char address[STRLEN];
ASSERT(port);
NEW(p);
p->port= port->port;
p->type= port->type;
p->socket= port->socket;
p->family= port->family;
p->action= port->action;
p->timeout= port->timeout;
p->request= port->request;
p->generic= port->generic;
p->protocol= port->protocol;
p->pathname= port->pathname;
p->hostname= port->hostname;
p->url_request= port->url_request;
p->request_checksum= port->request_checksum;
memcpy(&p->ApacheStatus, &port->ApacheStatus, sizeof(struct apache_status));
if (p->request_checksum) {
cleanup_hash_string(p->request_checksum);
if (strlen(p->request_checksum)==32) {
p->request_hashtype=HASH_MD5;
} else if (strlen(p->request_checksum)==40) {
p->request_hashtype=HASH_SHA1;
} else {
yyerror2("invalid checksum [%s]", p->request_checksum);
}
} else {
p->request_hashtype=0;
}
if(port->family == AF_INET) {
snprintf(address, STRLEN, "INET[%s:%d]", port->hostname, port->port);
} else if(port->family == AF_UNIX) {
snprintf(address, STRLEN, "UNIX[%s]", port->pathname);
}
p->address= xstrdup(address);
if(port->SSL.use_ssl == TRUE) {
if(!have_ssl()) {
yyerror("ssl check cannot be activated. SSL is not supported");
} else {
if (port->SSL.certmd5 != NULL) {
p->SSL.certmd5= port->SSL.certmd5;
cleanup_hash_string(p->SSL.certmd5);
}
p->SSL.use_ssl= TRUE;
p->SSL.version= port->SSL.version;
}
}
p->next= current->portlist;
current->portlist= p;
reset_portset();
}
/*
* Add a new resource object to the current service resource list
*/
static void addresource(Resource_T rr) {
Resource_T r;
ASSERT(rr);
NEW(r);
if(! Run.doprocess) {
yyerror("cannot activate service check.\n"
"\t(The process status engine was disabled. On certain"
" systems you must\n\trun monit as root to utilize this"
" feature)\n\t");
}
r->resource_id= rr->resource_id;
r->limit= rr->limit;
r->action= rr->action;
r->operator= rr->operator;
r->next= current->resourcelist;
current->resourcelist= r;
reset_resourceset();
}
/*
* Add a new file object to the current service timestamp list
*/
static void addtimestamp(Timestamp_T ts, int notime) {
Timestamp_T t;
ASSERT(ts);
NEW(t);
t->operator= ts->operator;
t->time= ts->time;
t->action= ts->action;
t->test_changes= ts->test_changes;
if(t->test_changes || notime) {
if(!File_exist(current->path)) {
DEBUG("%s: Debug: the path '%s' used in the TIMESTAMP statement"
" refer to a non-existing object\n", prog, current->path);
} else if(!(t->timestamp=
File_getTimestamp(current->path, S_IFDIR|S_IFREG))) {
yyerror2("cannot get the timestamp for '%s'", current->path);
}
}
t->next= current->timestamplist;
current->timestamplist= t;
reset_timestampset();
}
/*
* Add a new Size object to the current service size list
*/
static void addsize(Size_T ss, int nosize) {
Size_T s;
struct stat buf;
ASSERT(ss);
/*
In the case that we are testig changes, get the initial
size for future comparision. In the case that we are not
testing changes, we don't need the initial size nor require
file to exist in the time of configuration file parsing
*/
if(ss->test_changes != 0 && stat(current->path, &buf) != 0) {
yyerror2("cannot get size for '%s'", current->path);
reset_sizeset();
return;
}
NEW(s);
s->operator= ss->operator;
s->size= ss->size;
s->action= ss->action;
s->test_changes= ss->test_changes;
if(ss->test_changes || nosize)
s->size= (unsigned long long)buf.st_size;
s->next= current->sizelist;
current->sizelist= s;
reset_sizeset();
}
/*
* Set Checksum object in the current service
*/
static void addchecksum(Checksum_T cs) {
int len;
Checksum_T c;
ASSERT(cs);
if(!cs->hash) {
if(cs->type == HASH_UNKNOWN) {
cs->type=DEFAULT_HASH;
}
if( !(cs->hash= Util_getChecksum(current->path, cs->type))) {
yyerror2("cannot compute a checksum for file %s", current->path);
reset_checksumset();
return;
}
}
len= cleanup_hash_string(cs->hash);
if(cs->type == HASH_UNKNOWN) {
if (len==32) {
cs->type=HASH_MD5;
} else if (len==40) {
cs->type=HASH_SHA1;
} else {
yyerror2("invalid checksum [%s] for file %s", cs->hash, current->path);
reset_checksumset();
return;
}
} else if (( cs->type==HASH_MD5 && len!=32 ) ||
( cs->type==HASH_SHA1 && len!=40 )) {
yyerror2("invalid checksum [%s] for file %s", cs->hash, current->path);
reset_checksumset();
return;
}
NEW(c);
c->type=cs->type;
c->hash= cs->hash;
c->test_changes= cs->test_changes;
c->action= cs->action;
current->checksum= c;
reset_checksumset();
}
/*
* Set Perm object in the current service
*/
static void addperm(Perm_T ps) {
Perm_T p;
ASSERT(ps);
NEW(p);
p->perm= ps->perm;
p->action= ps->action;
current->perm= p;
reset_permset();
}
/*
* Set Match object in the current service
*/
static void addmatch(Match_T ms, int actionnumber, int linenumber) {
Match_T m;
Match_T ml;
int reg_return;
ASSERT(ms);
NEW(m);
#ifdef HAVE_REGEX_H
NEW(m->regex_comp);
#endif
m->match_string= ms->match_string;
m->match_path= ms->match_path?xstrdup(ms->match_path):NULL;
m->action= ms->action;
m->not= ms->not;
m->ignore= ms->ignore;
m->next=NULL;
addeventaction(&(m->action), actionnumber, ACTION_IGNORE);
#ifdef HAVE_REGEX_H
reg_return= regcomp(m->regex_comp, ms->match_string, REG_NOSUB|REG_EXTENDED);
if (reg_return!=0) {
char errbuf[STRLEN];
regerror(reg_return, ms->regex_comp, errbuf, STRLEN);
if (m->match_path != NULL)
yyerror2("regex parsing error:%s on line %i of", errbuf, linenumber);
else
yyerror2("regex parsing error:%s", errbuf);
}
#endif
if (current->matchlist) {
/* Find the end of the list */
for(ml=current->matchlist; ml->next; ml=ml->next);
ml->next= m;
} else {
current->matchlist= m;
}
}
static void addmatchpath(Match_T ms, int actionnumber) {
FILE *handle;
Command_T savecommand = NULL;
char buf[2048];
int linenumber=0;
ASSERT(ms->match_path);
handle = fopen(ms->match_path, "r");
if(handle == NULL) {
yyerror2("cannot read regex match file (%s)", ms->match_path);
return;
}
while(!feof(handle)) {
linenumber++;
if(! fgets(buf, 2048, handle))
continue;
if(strlen(buf)==0 || buf[0]=='\n')
continue;
if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = 0;
ms->match_string = xstrdup(buf);
/* The addeventaction() called from addmatch() will reset the
* command1 to NULL, but we need to duplicate the command for
* each line, thus need to save it here */
if(actionnumber == ACTION_EXEC) {
if(command1 == NULL) {
ASSERT(savecommand);
command1 = savecommand;
}
ASSERT(command1);
savecommand = copycommand(command1);
}
addmatch(ms, actionnumber, linenumber);
}
if(actionnumber == ACTION_EXEC && savecommand)
_gccmd(&savecommand);
fclose(handle);
}
/*
* Set Uid object in the current service
*/
static void adduid(Uid_T us) {
Uid_T u;
ASSERT(us);
NEW(u);
u->uid= us->uid;
u->action= us->action;
current->uid= u;
reset_uidset();
}
/*
* Set Gid object in the current service
*/
static void addgid(Gid_T gs) {
Gid_T g;
ASSERT(gs);
NEW(g);
g->gid= gs->gid;
g->action= gs->action;
current->gid= g;
reset_gidset();
}
/*
* Add a new device to the current service's device list
*/
static void adddevice(Device_T ds) {
Device_T dev;
ASSERT(ds);
NEW(dev);
dev->resource= ds->resource;
dev->operator= ds->operator;
dev->limit_absolute= ds->limit_absolute;
dev->limit_percent= ds->limit_percent;
dev->action= ds->action;
dev->next= current->devicelist;
current->devicelist= dev;
reset_deviceset();
}
/*
* Add a new icmp object to the current service's icmp list
*/
static void addicmp(Icmp_T is) {
if(!getuid()) {
Icmp_T icmp;
ASSERT(is);
NEW(icmp);
icmp->type= is->type;
icmp->count= is->count > ICMP_MAX_COUNT ? ICMP_MAX_COUNT : is->count;
icmp->timeout= is->timeout;
icmp->action= is->action;
icmp->is_available= FALSE;
icmp->response= -1;
icmp->next= current->icmplist;
current->icmplist= icmp;
} else {
yyerror("icmp statements must be run as root");
}
reset_icmpset();
}
/*
* Set EventAction object
*/
static void addeventaction(EventAction_T *_ea, int failed, int passed) {
EventAction_T ea;
ASSERT(_ea);
NEW(ea);
NEW(ea->failed);
NEW(ea->passed);
ea->failed->id= failed;
ea->failed->count= rate1.count;
ea->failed->cycles= rate1.cycles;
if(failed == ACTION_EXEC) {
ASSERT(command1);
ea->failed->exec = command1;
command1 = NULL;
}
describeAction(ea->failed);
ea->passed->id= passed;
ea->passed->count= rate2.count;
ea->passed->cycles= rate2.cycles;
if(passed == ACTION_EXEC) {
ASSERT(command2);
ea->passed->exec = command2;
command2 = NULL;
}
describeAction(ea->passed);
*_ea= ea;
reset_rateset();
}
/*
* Redefine EventAction object (used for default action overloading)
*/
static void seteventaction(EventAction_T *_ea, int failed, int passed) {
EventAction_T ea = *_ea;
ASSERT(ea);
ASSERT(ea->failed);
ASSERT(ea->passed);
ea->failed->id= failed;
ea->failed->count= rate1.count;
ea->failed->cycles= rate1.cycles;
if(failed == ACTION_EXEC) {
ASSERT(command1);
ea->failed->exec = command1;
command1 = NULL;
}
describeAction(ea->failed);
ea->passed->id= passed;
ea->passed->count= rate2.count;
ea->passed->cycles= rate2.cycles;
if(passed == ACTION_EXEC) {
ASSERT(command2);
ea->passed->exec = command2;
command2 = NULL;
}
describeAction(ea->passed);
}
/*
* Return a protocol object for the given protocol
*/
static void *addprotocol(int protocol) {
switch (protocol) {
case P_APACHESTATUS: return create_apache_status();
case P_DNS: return create_dns();
case P_DWP: return create_dwp();
case P_FTP: return create_ftp();
case P_GENERIC: return create_generic();
case P_HTTP: return create_http();
case P_IMAP: return create_imap();
case P_CLAMAV: return create_clamav();
case P_LDAP2: return create_ldap2();
case P_LDAP3: return create_ldap3();
case P_MYSQL: return create_mysql();
case P_NNTP: return create_nntp();
case P_NTP3: return create_ntp3();
case P_POSTFIXPOLICY: return create_postfix_policy();
case P_POP: return create_pop();
case P_SMTP: return create_smtp();
case P_SSH: return create_ssh();
case P_RDATE: return create_rdate();
case P_RSYNC: return create_rsync();
case P_TNS: return create_tns();
case P_PGSQL: return create_pgsql();
}
return create_default();
}
/*
* Add a generic protocol handler to
*/
static void addgeneric(Port_T port, char *send, char *expect) {
Generic_T g= port->generic;
if (g == NULL) {
NEW(g);
port->generic= g;
} else {
while (g->next != NULL) {
g= g->next;
}
NEW(g->next);
g=g->next;
}
if (send != NULL) {
g->send=xstrdup(send);
g->expect=NULL;
} else if (expect != NULL) {
#ifdef HAVE_REGEX_H
int reg_return;
NEW(g->expect);
reg_return= regcomp(g->expect, expect, REG_NOSUB|REG_EXTENDED);
if (reg_return!=0) {
char errbuf[STRLEN];
regerror(reg_return, g->expect, errbuf, STRLEN);
yyerror2("regex parsing error:%s", errbuf);
}
#else
g->expect=xstrdup(expect);
#endif
g->send=NULL;
}
}
/*
* Add the current command object to the current service object's
* start or stop program.
*/
static void addcommand(int what) {
switch(what) {
case START: current->start= command; break;
case STOP: current->stop= command; break;
}
command= NULL;
}
/*
* Add a new argument to the argument list
*/
static void addargument(char *argument) {
ASSERT(argument);
if(! command) {
NEW(command);
check_exec(argument);
command->timeout = 1;
}
command->arg[command->length++]= argument;
command->arg[command->length]= NULL;
if(command->length >= ARGMAX) {
yyerror("exceeded maximum number of program arguments");
}
}
/*
* Setup a url request for the current port object
*/
static void prepare_urlrequest(URL_T U) {
ASSERT(U);
portset.protocol= addprotocol(P_HTTP);
if(urlrequest==NULL)
NEW(urlrequest);
urlrequest->url= U;
portset.hostname= xstrdup(U->hostname);
check_hostname(portset.hostname);
portset.port= U->port;
portset.url_request= urlrequest;
portset.type= SOCK_STREAM;
portset.request= Util_getString("%s%s%s", U->path, U->query?"?":"",
U->query?U->query:"");
/* Only the HTTP protocol is supported for URLs.
See also the lexer if this is to be changed in
the future */
portset.protocol= addprotocol(P_HTTP);
if(IS(U->protocol, "https")) {
portset.SSL.use_ssl= TRUE;
}
}
/*
* Set the url request for a port
*/
static void seturlrequest(int operator, char *regex) {
ASSERT(regex);
if(! urlrequest)
NEW(urlrequest);
urlrequest->operator= operator;
#ifdef HAVE_REGEX_H
{
int reg_return;
NEW(urlrequest->regex);
reg_return= regcomp(urlrequest->regex, regex, REG_NOSUB|REG_EXTENDED);
if (reg_return!=0) {
char errbuf[STRLEN];
regerror(reg_return, urlrequest->regex, errbuf, STRLEN);
yyerror2("regex parsing error: %s", errbuf);
}
}
#else
urlrequest->regex= xstrdup(regex);
#endif
}
/*
* Add a new data recipient server to the collector server list
*/
static void addcollector(URL_T url, int timeout, int sslversion,
char *certmd5) {
Collector_T c;
ASSERT(url);
NEW(c);
c->url = url;
if(!strcmp(c->url->protocol, "https")) {
if(!have_ssl()) {
yyerror("ssl check cannot be activated. SSL is not supported");
} else {
c->ssl.use_ssl= TRUE;
c->ssl.version= sslversion;
if (certmd5) {
c->ssl.certmd5= certmd5;
cleanup_hash_string(c->ssl.certmd5);
}
}
}
c->timeout = timeout;
c->next = NULL;
if(Run.collectors) {
Collector_T C;
for(C = Run.collectors; C->next; C = C->next)
/* Empty */ ;
C->next = c;
}
else {
Run.collectors = c;
}
}
/*
* Add a new smtp server to the mail server list
*/
static void addmailserver(MailServer_T mailserver) {
MailServer_T s;
ASSERT(mailserver->host);
NEW(s);
s->host = mailserver->host;
s->port = mailserver->port;
s->username = mailserver->username;
s->password = mailserver->password;
s->ssl.use_ssl = mailserver->ssl.use_ssl;
s->ssl.version = mailserver->ssl.version;
s->ssl.certmd5 = mailserver->ssl.certmd5;
s->next= NULL;
if(Run.mailservers) {
MailServer_T l;
for(l= Run.mailservers; l->next; l= l->next) /* empty */;
l->next= s;
} else {
Run.mailservers= s;
}
reset_mailserverset();
}
/*
* Return uid if found on the system. If the parameter user is NULL
* the uid parameter is used for looking up the user id on the system,
* otherwise the user parameter is used.
*/
static uid_t get_uid(char *user, uid_t uid) {
struct passwd *pwd;
if(user) {
pwd= getpwnam(user);
if(pwd == NULL) {
yyerror2("requested user not found on the system");
return(0);
}
} else {
if( (pwd= getpwuid(uid)) == NULL ) {
yyerror2("requested uid not found on the system");
return(0);
}
}
return(pwd->pw_uid);
}
/*
* Return gid if found on the system. If the parameter group is NULL
* the gid parameter is used for looking up the group id on the system,
* otherwise the group parameter is used.
*/
static gid_t get_gid(char *group, gid_t gid) {
struct group *grd;
if(group) {
grd= getgrnam(group);
if(grd == NULL) {
yyerror2("requested group not found on the system");
return(0);
}
} else {
if( (grd= getgrgid(gid)) == NULL ) {
yyerror2("requested gid not found on the system");
return(0);
}
}
return(grd->gr_gid);
}
/*
* Add a new user id to the current command object.
*/
static void addeuid(uid_t uid) {
if(!getuid()) {
command->has_uid= TRUE;
command->uid= uid;
} else {
yyerror("uid statement requires root privileges");
}
}
/*
* Add a new group id to the current command object.
*/
static void addegid(gid_t gid) {
if(!getuid()) {
command->has_gid= TRUE;
command->gid= gid;
} else {
yyerror("gid statement requires root privileges");
}
}
/*
* Reset the logfile if changed
*/
static void setlogfile(char *logfile) {
if(Run.logfile) {
if(IS(Run.logfile, logfile)) {
FREE(logfile);
return;
} else {
FREE(Run.logfile);
}
}
Run.logfile= logfile;
}
/*
* Reset the pidfile if changed
*/
static void setpidfile(char *pidfile) {
if(Run.pidfile) {
if(IS(Run.pidfile, pidfile)) {
FREE(pidfile);
return;
} else {
FREE(Run.pidfile);
}
}
Run.pidfile= pidfile;
}
/*
* Read a apache htpasswd file and add credentials found for username
*/
static void addhtpasswdentry(char *filename, char *username, int dtype) {
char *ht_username= NULL;
char *ht_passwd= NULL;
char buf[STRLEN];
FILE *handle= NULL;
int credentials_added= 0;
ASSERT(filename);
handle=fopen(filename, "r");
if ( handle==NULL ) {
if (username!=NULL) {
yyerror2("cannot read htpasswd (%s)", filename);
} else {
yyerror2("cannot read htpasswd", filename);
}
return;
}
while (!feof(handle)) {
char *colonindex= NULL;
int i;
if (! fgets(buf, STRLEN, handle)) {
continue;
}
/* strip trailing non visible characters */
for (i=strlen(buf)-1; i >= 0; i--) {
if ( buf[i] == ' ' || buf[i] == '\r' ||
buf[i] == '\n' || buf[i] == '\t' ) {
buf[i]='\0';
} else {
break;
}
}
if ( NULL == (colonindex=strchr(buf, ':'))) {
continue;
}
ht_passwd=xstrdup(colonindex+1);
*colonindex='\0';
/* Incase we have a file in /etc/passwd or /etc/shadow style we
* want to remove ":.*$" and Crypt and MD5 hashed dont have a colon
*/
if ( (NULL != (colonindex=strchr(ht_passwd, ':'))) &&
( dtype != DIGEST_CLEARTEXT) ) {
*colonindex='\0';
}
ht_username=xstrdup(buf);
if (username==NULL) {
if (addcredentials(ht_username, ht_passwd, dtype, FALSE)) {
credentials_added++;
}
} else if (strcmp(username, ht_username) == 0) {
if (addcredentials(ht_username, ht_passwd, dtype, FALSE)) {
credentials_added++;
}
} else {
FREE(ht_passwd);
FREE(ht_username);
}
}
if (credentials_added==0) {
if ( username == NULL ) {
yywarning2("htpasswd file (%s) has no usable credentials",
filename);
} else {
yywarning2("htpasswd file (%s) has no usable credentials "
"for user %s", filename, username);
}
}
fclose(handle);
}
/*
* Add Basic Authentication credentials
*/
static int addcredentials(char *uname, char *passwd, int dtype, int readonly) {
Auth_T c;
ASSERT(uname);
ASSERT(passwd);
if (Run.credentials == NULL) {
NEW(Run.credentials);
c=Run.credentials;
} else {
if (Util_getUserCredentials(uname) != NULL) {
yywarning2("credentials for user %s were already added, entry ignored",
uname);
FREE(uname);
FREE(passwd);
return FALSE;
}
c=Run.credentials;
while ( c->next != NULL ) {
c=c->next;
}
NEW(c->next);
c=c->next;
}
c->next=NULL;
c->uname=uname;
c->passwd=passwd;
c->digesttype=dtype;
c->is_readonly= readonly;
DEBUG("%s: Debug: Adding credentials for user '%s'.\n", prog, uname);
return TRUE;
}
/*
* Set the syslog and the facilities to be used
*/
static void setsyslog(char *facility) {
if (!Run.logfile || ihp.logfile) {
ihp.logfile= TRUE;
setlogfile(xstrdup("syslog"));
Run.use_syslog= TRUE;
Run.dolog=TRUE;
}
if(facility) {
if(IS(facility,"log_local0")) {
Run.facility = LOG_LOCAL0;
} else if(IS(facility, "log_local1")) {
Run.facility = LOG_LOCAL1;
} else if(IS(facility, "log_local2")) {
Run.facility = LOG_LOCAL2;
} else if(IS(facility, "log_local3")) {
Run.facility = LOG_LOCAL3;
} else if(IS(facility, "log_local4")) {
Run.facility = LOG_LOCAL4;
} else if(IS(facility, "log_local5")) {
Run.facility = LOG_LOCAL5;
} else if(IS(facility, "log_local6")) {
Run.facility = LOG_LOCAL6;
} else if(IS(facility, "log_local7")) {
Run.facility = LOG_LOCAL7;
} else if(IS(facility, "log_daemon")) {
Run.facility = LOG_DAEMON;
} else {
yyerror2("invalid syslog facility");
}
} else {
Run.facility= LOG_USER;
}
}
/*
* Reset the current mailset, eventset and reminder for reuse
*/
static void reset_mailset() {
memset(&mailset, 0, sizeof(struct mymail));
eventset= EVENT_NULL;
}
/*
* Reset the mailserver set to default values
*/
static void reset_mailserverset() {
memset(&mailserverset, 0, sizeof(struct mymailserver));
mailserverset.port = PORT_SMTP;
mailserverset.ssl.use_ssl = FALSE;
mailserverset.ssl.version= SSL_VERSION_AUTO;
}
/*
* Reset the Port set to default values
*/
static void reset_portset() {
memset(&portset, 0, sizeof(struct myport));
portset.socket= -1;
portset.type= SOCK_STREAM;
portset.family= AF_INET;
portset.SSL.version= SSL_VERSION_AUTO;
portset.timeout= NET_TIMEOUT;
urlrequest= NULL;
}
/*
* Reset the Proc set to default values
*/
static void reset_resourceset() {
resourceset.resource_id= 0;
resourceset.limit= 0;
resourceset.action= NULL;
resourceset.operator= OPERATOR_EQUAL;
}
/*
* Reset the Timestamp set to default values
*/
static void reset_timestampset() {
timestampset.operator= OPERATOR_EQUAL;
timestampset.time= 0;
timestampset.test_changes= FALSE;
timestampset.action= NULL;
}
/*
* Reset the Size set to default values
*/
static void reset_sizeset() {
sizeset.operator= OPERATOR_EQUAL;
sizeset.size= 0;
sizeset.test_changes= FALSE;
sizeset.action= NULL;
}
/*
* Reset the Checksum set to default values
*/
static void reset_checksumset() {
checksumset.type= HASH_UNKNOWN;
checksumset.hash= NULL;
checksumset.test_changes= FALSE;
checksumset.action= NULL;
}
/*
* Reset the Perm set to default values
*/
static void reset_permset() {
permset.perm= 0;
permset.action= NULL;
}
/*
* Reset the Uid set to default values
*/
static void reset_uidset() {
uidset.uid= 0;
uidset.action= NULL;
}
/*
* Reset the Gid set to default values
*/
static void reset_gidset() {
gidset.gid= 0;
gidset.action= NULL;
}
/*
* Reset the Device set to default values
*/
static void reset_deviceset() {
deviceset.resource= 0;
deviceset.operator= OPERATOR_EQUAL;
deviceset.limit_absolute= -1;
deviceset.limit_percent= -1;
deviceset.action= NULL;
}
/*
* Reset the ICMP set to default values
*/
static void reset_icmpset() {
icmpset.type= ICMP_ECHO;
icmpset.count= ICMP_ATTEMPT_COUNT;
icmpset.timeout= NET_TIMEOUT;
icmpset.action= NULL;
}
/*
* Reset the Rate set to default values
*/
static void reset_rateset() {
rate1.count = 1;
rate1.cycles = 1;
rate2.count = 1;
rate2.cycles = 1;
}
/* ---------------------------------------------------------------- Checkers */
/*
* Check for unique service name
*/
static void check_name(char *name) {
ASSERT(name);
if(Util_existService(name) || (current && IS(name, current->name))) {
yyerror2("service name conflict, %s already defined", name);
}
if(name && *name=='/') {
yyerror2("service name must not start with '/' -- ", name);
}
}
/*
* Permission statement semantic check
*/
static int check_perm(int perm) {
long result;
char *status;
char buf[STRLEN];
snprintf(buf, STRLEN, "%d", perm);
result= strtol(buf, &status, 8);
if( *status != '\0' || result < 0 || result > 07777 ) {
yyerror2("permission statements must have an octal value "
"between 0 and 7777");
}
return result;
}
/*
* Timeout statement semantic check
*/
static void check_timeout(int s, int c) {
if(s > c) {
yyerror2("the number of restarts must be less than poll cycles");
}
if(s <= 0 || c <= 0) {
yyerror2("zero or negative values not allowed in a timeout statement");
}
}
/*
* Every statement semantic check
*/
static void check_every(int every) {
if(every <= 1) {
yyerror2("an EVERY statement must have a value greater than 1");
}
}
/*
* Check hostname
*/
static void check_hostname(char *hostname) {
ASSERT(hostname);
if(!check_host(hostname)) {
yywarning2("hostname did not resolve");
}
}
/*
* Check the dependency graph for errors
* by doing a topological sort, thereby finding any cycles.
* Assures that graph is a Directed Acyclic Graph (DAG).
*/
static void check_depend() {
Service_T s;
Service_T depends_on= NULL;
Service_T* dlt = &depend_list; /* the current tail of it */
int done; /* no unvisited nodes left? */
int found_some; /* last iteration found anything new ? */
depend_list = NULL; /* depend_list will be the topological sorted servicelist */
do {
done = TRUE;
found_some = FALSE;
for(s= servicelist; s; s= s->next) {
Dependant_T d;
if(s->visited)
continue;
done = FALSE; // still unvisited nodes
depends_on = NULL;
for(d= s->dependantlist; d; d= d->next) {
Service_T dp = Util_getService(d->dependant);
if(!dp) {
LogError("%s: Error: Depend service '%s' is not defined in the "
"control file\n", prog, d->dependant);
exit(1);
}
if (!dp->visited) {
depends_on = dp;
}
}
if (!depends_on) {
s->visited = TRUE;
found_some = TRUE;
*dlt = s;
dlt = &s->next_depend;
}
}
} while(found_some && !done);
if (!done)
{
ASSERT(depends_on);
LogError("%s: Error: Found a depend loop in the control file "
"involving the service '%s'\n", prog, depends_on->name);
exit(1);
}
ASSERT(depend_list);
servicelist= depend_list;
for(s= depend_list; s; s= s->next_depend)
s->next= s->next_depend;
reset_depend();
}
/*
* Check if the executable exist
*/
static void check_exec(char *exec) {
if(! File_exist(exec)) {
yyerror2("the executable does not exist");
}
}
/* -------------------------------------------------------------------- Misc */
/*
* Cleans up an md5 string, tolower and remove byte separators
*/
static int cleanup_hash_string(char *hashstring) {
int i= 0, j= 0;
ASSERT(hashstring);
while (hashstring[i] != '\0') {
if (isxdigit((int) hashstring[i])) {
hashstring[j]=tolower((int)hashstring[i]);
j++;
}
i++;
}
hashstring[j]='\0';
return j;
}
static void describeAction(Action_T A) {
#define BUF_CURSOR (A->description + strlen(A->description))
#define BUF_AVAILABLE (sizeof(A->description) - strlen(A->description))
snprintf(BUF_CURSOR, BUF_AVAILABLE, "%s", actionnames[A->id]);
if(A->id == ACTION_EXEC) {
int i = 0;
Command_T C = A->exec;
while(C->arg[i]) {
snprintf(BUF_CURSOR, BUF_AVAILABLE, "%s%s", i?" ":" '", C->arg[i]);
i++;
}
snprintf(BUF_CURSOR, BUF_AVAILABLE, "'");
if(C->has_uid)
snprintf(BUF_CURSOR, BUF_AVAILABLE, " as uid %d", C->uid);
if(C->has_gid)
snprintf(BUF_CURSOR, BUF_AVAILABLE, " as gid %d", C->gid);
snprintf(BUF_CURSOR, BUF_AVAILABLE, " timeout %d cycle(s)", C->timeout);
}
#undef BUF_CURSOR
#undef BUF_AVAILABLE
}
/* Return deep copy of the command */
static Command_T copycommand(Command_T source) {
int i;
Command_T copy = NULL;
NEW(copy);
copy->length = source->length;
copy->has_uid = source->has_uid;
copy->uid = source->uid;
copy->has_gid = source->has_gid;
copy->gid = source->gid;
copy->timeout = source->timeout;
for(i = 0; i < copy->length; i++) {
copy->arg[i] = xstrdup(source->arg[i]);
}
copy->arg[copy->length]= NULL;
return copy;
}
syntax highlighted by Code2HTML, v. 0.9.1