1 /* A Bison parser, made by GNU Bison 3.5.1.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
6    Inc.
7 
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30 
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36 
37 /* All symbols defined below should begin with yy or YY, to avoid
38    infringing on user name space.  This should be done even for local
39    variables, as they might otherwise be expanded by user macros.
40    There are some unavoidable exceptions within include files to
41    define necessary library symbols; they are noted "INFRINGES ON
42    USER NAME SPACE" below.  */
43 
44 /* Undocumented macros, especially those whose name start with YY_,
45    are private implementation details.  Do not rely on them.  */
46 
47 /* Identify Bison output.  */
48 #define YYBISON 1
49 
50 /* Bison version.  */
51 #define YYBISON_VERSION "3.5.1"
52 
53 /* Skeleton name.  */
54 #define YYSKELETON_NAME "yacc.c"
55 
56 /* Pure parsers.  */
57 #define YYPURE 0
58 
59 /* Push parsers.  */
60 #define YYPUSH 0
61 
62 /* Pull parsers.  */
63 #define YYPULL 1
64 
65 
66 
67 
68 /* First part of user prologue.  */
69 #line 26 "src/p.y"
70 
71 
72 /*
73  * DESCRIPTION
74  *   Simple context-free grammar for parsing the control file.
75  *
76  */
77 
78 #include "config.h"
79 
80 #ifdef HAVE_STDIO_H
81 #include <stdio.h>
82 #endif
83 
84 #ifdef HAVE_STDLIB_H
85 #include <stdlib.h>
86 #endif
87 
88 #ifdef HAVE_ERRNO_H
89 #include <errno.h>
90 #endif
91 
92 #ifdef HAVE_CTYPE_H
93 #include <ctype.h>
94 #endif
95 
96 #ifdef HAVE_PWD_H
97 #include <pwd.h>
98 #endif
99 
100 #ifdef HAVE_GRP_H
101 #include <grp.h>
102 #endif
103 
104 #ifdef HAVE_SYS_TYPES_H
105 #include <sys/types.h>
106 #endif
107 
108 #ifdef HAVE_SYS_TIME_H
109 #include <sys/time.h>
110 #endif
111 
112 #ifdef HAVE_TIME_H
113 #include <time.h>
114 #endif
115 
116 #ifdef HAVE_SYS_SOCKET_H
117 #include <sys/socket.h>
118 #endif
119 
120 #ifdef HAVE_ASM_PARAM_H
121 #include <asm/param.h>
122 #endif
123 
124 #ifdef HAVE_STRING_H
125 #include <string.h>
126 #endif
127 
128 #ifdef HAVE_STRINGS_H
129 #include <strings.h>
130 #endif
131 
132 #ifdef HAVE_NETDB_H
133 #include <netdb.h>
134 #endif
135 
136 #ifdef HAVE_SYSLOG_H
137 #include <syslog.h>
138 #endif
139 
140 #ifdef HAVE_NETINET_IN_SYSTM_H
141 #include <netinet/in_systm.h>
142 #endif
143 
144 #ifdef HAVE_NETINET_IN_H
145 #include <netinet/in.h>
146 #endif
147 
148 #ifdef HAVE_NETINET_IP_H
149 #include <netinet/ip.h>
150 #endif
151 
152 #ifdef HAVE_NETINET_IP_ICMP_H
153 #include <netinet/ip_icmp.h>
154 #endif
155 
156 #ifdef HAVE_REGEX_H
157 #include <regex.h>
158 #endif
159 
160 #ifdef HAVE_UNISTD_H
161 #include <unistd.h>
162 #endif
163 
164 #ifdef HAVE_OPENSSL
165 #include <openssl/ssl.h>
166 #endif
167 
168 #include "monit.h"
169 #include "protocol.h"
170 #include "engine.h"
171 #include "alert.h"
172 #include "ProcessTree.h"
173 #include "device.h"
174 #include "processor.h"
175 #include "md5.h"
176 #include "sha1.h"
177 #include "checksum.h"
178 #include "process_sysdep.h"
179 
180 // libmonit
181 #include "io/File.h"
182 #include "util/Str.h"
183 #include "thread/Thread.h"
184 
185 
186 /* ------------------------------------------------------------- Definitions */
187 
188 
189 struct precedence_t {
190         bool daemon;
191         bool logfile;
192         bool pidfile;
193 };
194 
195 struct rate_t {
196         unsigned int count;
197         unsigned int cycles;
198 };
199 
200 /* yacc interface */
201 void  yyerror(const char *,...) __attribute__((format (printf, 1, 2)));
202 void  yyerror2(const char *,...) __attribute__((format (printf, 1, 2)));
203 void  yywarning(const char *,...) __attribute__((format (printf, 1, 2)));
204 void  yywarning2(const char *,...) __attribute__((format (printf, 1, 2)));
205 
206 /* lexer interface */
207 int yylex(void);
208 extern FILE *yyin;
209 extern int lineno;
210 extern int arglineno;
211 extern char *yytext;
212 extern char *argyytext;
213 extern char *currentfile;
214 extern char *argcurrentfile;
215 extern int buffer_stack_ptr;
216 
217 /* Local variables */
218 static int cfg_errflag = 0;
219 static Service_T tail = NULL;
220 static Service_T current = NULL;
221 static Request_T urlrequest = NULL;
222 static command_t command = NULL;
223 static command_t command1 = NULL;
224 static command_t command2 = NULL;
225 static Service_T depend_list = NULL;
226 static struct Uid_T uidset = {};
227 static struct Gid_T gidset = {};
228 static struct Pid_T pidset = {};
229 static struct Pid_T ppidset = {};
230 static struct FsFlag_T fsflagset = {};
231 static struct NonExist_T nonexistset = {};
232 static struct Exist_T existset = {};
233 static struct Status_T statusset = {};
234 static struct Perm_T permset = {};
235 static struct Size_T sizeset = {};
236 static struct Uptime_T uptimeset = {};
237 static struct ResponseTime_T responsetimeset = {};
238 static struct LinkStatus_T linkstatusset = {};
239 static struct LinkSpeed_T linkspeedset = {};
240 static struct LinkSaturation_T linksaturationset = {};
241 static struct Bandwidth_T bandwidthset = {};
242 static struct Match_T matchset = {};
243 static struct Icmp_T icmpset = {};
244 static struct Mail_T mailset = {};
245 static struct SslOptions_T sslset = {};
246 static struct Port_T portset = {};
247 static struct MailServer_T mailserverset = {};
248 static struct Mmonit_T mmonitset = {};
249 static struct FileSystem_T filesystemset = {};
250 static struct Resource_T resourceset = {};
251 static struct Checksum_T checksumset = {};
252 static struct Timestamp_T timestampset = {};
253 static struct ActionRate_T actionrateset = {};
254 static struct precedence_t ihp = {false, false, false};
255 static struct rate_t rate = {1, 1};
256 static struct rate_t rate1 = {1, 1};
257 static struct rate_t rate2 = {1, 1};
258 static char * htpasswd_file = NULL;
259 static unsigned int repeat = 0;
260 static unsigned int repeat1 = 0;
261 static unsigned int repeat2 = 0;
262 static Digest_Type digesttype = Digest_Cleartext;
263 
264 #define BITMAP_MAX (sizeof(long long) * 8)
265 
266 
267 /* -------------------------------------------------------------- Prototypes */
268 
269 static void  preparse(void);
270 static void  postparse(void);
271 static bool _parseOutgoingAddress(char *ip, Outgoing_T *outgoing);
272 static void  addmail(char *, Mail_T, Mail_T *);
273 static Service_T createservice(Service_Type, char *, char *, State_Type (*)(Service_T));
274 static void  addservice(Service_T);
275 static void  adddependant(char *);
276 static void  addservicegroup(char *);
277 static void  addport(Port_T *, Port_T);
278 static void  addhttpheader(Port_T, char *);
279 static void  addresource(Resource_T);
280 static void  addtimestamp(Timestamp_T);
281 static void  addactionrate(ActionRate_T);
282 static void  addsize(Size_T);
283 static void  adduptime(Uptime_T);
284 static void  addpid(Pid_T);
285 static void  addppid(Pid_T);
286 static void  addfsflag(FsFlag_T);
287 static void  addnonexist(NonExist_T);
288 static void  addexist(Exist_T);
289 static void  addlinkstatus(Service_T, LinkStatus_T);
290 static void  addlinkspeed(Service_T, LinkSpeed_T);
291 static void  addlinksaturation(Service_T, LinkSaturation_T);
292 static void  addbandwidth(Bandwidth_T *, Bandwidth_T);
293 static void  addfilesystem(FileSystem_T);
294 static void  addicmp(Icmp_T);
295 static void  addgeneric(Port_T, char*, char*);
296 static void  addcommand(int, unsigned);
297 static void  addargument(char *);
298 static void  addmmonit(Mmonit_T);
299 static void  addmailserver(MailServer_T);
300 static bool addcredentials(char *, char *, Digest_Type, bool);
301 #ifdef HAVE_LIBPAM
302 static void  addpamauth(char *, int);
303 #endif
304 static void  addhtpasswdentry(char *, char *, Digest_Type);
305 static uid_t get_uid(char *, uid_t);
306 static gid_t get_gid(char *, gid_t);
307 static void  addchecksum(Checksum_T);
308 static void  addperm(Perm_T);
309 static void  addmatch(Match_T, int, int);
310 static void  addmatchpath(Match_T, Action_Type);
311 static void  addstatus(Status_T);
312 static Uid_T adduid(Uid_T);
313 static Gid_T addgid(Gid_T);
314 static void  addeuid(uid_t);
315 static void  addegid(gid_t);
316 static void  addeventaction(EventAction_T *, Action_Type, Action_Type);
317 static void  prepare_urlrequest(URL_T U);
318 static void  seturlrequest(int, char *);
319 static void  setlogfile(char *);
320 static void  setpidfile(char *);
321 static void  reset_sslset(void);
322 static void  reset_mailset(void);
323 static void  reset_mailserverset(void);
324 static void  reset_mmonitset(void);
325 static void  reset_portset(void);
326 static void  reset_resourceset(void);
327 static void  reset_timestampset(void);
328 static void  reset_actionrateset(void);
329 static void  reset_sizeset(void);
330 static void  reset_uptimeset(void);
331 static void  reset_responsetimeset(void);
332 static void  reset_pidset(void);
333 static void  reset_ppidset(void);
334 static void  reset_fsflagset(void);
335 static void  reset_nonexistset(void);
336 static void  reset_existset(void);
337 static void  reset_linkstatusset(void);
338 static void  reset_linkspeedset(void);
339 static void  reset_linksaturationset(void);
340 static void  reset_bandwidthset(void);
341 static void  reset_checksumset(void);
342 static void  reset_permset(void);
343 static void  reset_uidset(void);
344 static void  reset_gidset(void);
345 static void  reset_statusset(void);
346 static void  reset_filesystemset(void);
347 static void  reset_icmpset(void);
348 static void  reset_rateset(struct rate_t *);
349 static void  check_name(char *);
350 static int   check_perm(int);
351 static void  check_exec(char *);
352 static int   cleanup_hash_string(char *);
353 static void  check_depend(void);
354 static void  setsyslog(char *);
355 static command_t copycommand(command_t);
356 static int verifyMaxForward(int);
357 static void _setPEM(char **store, char *path, const char *description, bool isFile);
358 static void _setSSLOptions(SslOptions_T options);
359 #ifdef HAVE_OPENSSL
360 static void _setSSLVersion(short version);
361 #endif
362 static void _unsetSSLVersion(short version);
363 static void addsecurityattribute(char *, Action_Type, Action_Type);
364 static void addfiledescriptors(Operator_Type, bool, long long, float, Action_Type, Action_Type);
365 static void _sanityCheckEveryStatement(Service_T s);
366 
367 
368 #line 369 "src/y.tab.c"
369 
370 # ifndef YY_CAST
371 #  ifdef __cplusplus
372 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
373 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
374 #  else
375 #   define YY_CAST(Type, Val) ((Type) (Val))
376 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
377 #  endif
378 # endif
379 # ifndef YY_NULLPTR
380 #  if defined __cplusplus
381 #   if 201103L <= __cplusplus
382 #    define YY_NULLPTR nullptr
383 #   else
384 #    define YY_NULLPTR 0
385 #   endif
386 #  else
387 #   define YY_NULLPTR ((void*)0)
388 #  endif
389 # endif
390 
391 /* Enabling verbose error messages.  */
392 #ifdef YYERROR_VERBOSE
393 # undef YYERROR_VERBOSE
394 # define YYERROR_VERBOSE 1
395 #else
396 # define YYERROR_VERBOSE 0
397 #endif
398 
399 /* Use api.header.include to #include this header
400    instead of duplicating it here.  */
401 #ifndef YY_YY_SRC_Y_TAB_H_INCLUDED
402 # define YY_YY_SRC_Y_TAB_H_INCLUDED
403 /* Debug traces.  */
404 #ifndef YYDEBUG
405 # define YYDEBUG 1
406 #endif
407 #if YYDEBUG
408 extern int yydebug;
409 #endif
410 
411 /* Token type.  */
412 #ifndef YYTOKENTYPE
413 # define YYTOKENTYPE
414   enum yytokentype
415   {
416     IF = 258,
417     ELSE = 259,
418     THEN = 260,
419     FAILED = 261,
420     SET = 262,
421     LOGFILE = 263,
422     FACILITY = 264,
423     DAEMON = 265,
424     SYSLOG = 266,
425     MAILSERVER = 267,
426     HTTPD = 268,
427     ALLOW = 269,
428     REJECTOPT = 270,
429     ADDRESS = 271,
430     INIT = 272,
431     TERMINAL = 273,
432     BATCH = 274,
433     READONLY = 275,
434     CLEARTEXT = 276,
435     MD5HASH = 277,
436     SHA1HASH = 278,
437     CRYPT = 279,
438     DELAY = 280,
439     PEMFILE = 281,
440     PEMKEY = 282,
441     PEMCHAIN = 283,
442     ENABLE = 284,
443     DISABLE = 285,
444     SSLTOKEN = 286,
445     CIPHER = 287,
446     CLIENTPEMFILE = 288,
447     ALLOWSELFCERTIFICATION = 289,
448     SELFSIGNED = 290,
449     VERIFY = 291,
450     CERTIFICATE = 292,
451     CACERTIFICATEFILE = 293,
452     CACERTIFICATEPATH = 294,
453     VALID = 295,
454     INTERFACE = 296,
455     LINK = 297,
456     PACKET = 298,
457     BYTEIN = 299,
458     BYTEOUT = 300,
459     PACKETIN = 301,
460     PACKETOUT = 302,
461     SPEED = 303,
462     SATURATION = 304,
463     UPLOAD = 305,
464     DOWNLOAD = 306,
465     TOTAL = 307,
466     UP = 308,
467     DOWN = 309,
468     IDFILE = 310,
469     STATEFILE = 311,
470     SEND = 312,
471     EXPECT = 313,
472     CYCLE = 314,
473     COUNT = 315,
474     REMINDER = 316,
475     REPEAT = 317,
476     LIMITS = 318,
477     SENDEXPECTBUFFER = 319,
478     EXPECTBUFFER = 320,
479     FILECONTENTBUFFER = 321,
480     HTTPCONTENTBUFFER = 322,
481     PROGRAMOUTPUT = 323,
482     NETWORKTIMEOUT = 324,
483     PROGRAMTIMEOUT = 325,
484     STARTTIMEOUT = 326,
485     STOPTIMEOUT = 327,
486     RESTARTTIMEOUT = 328,
487     PIDFILE = 329,
488     START = 330,
489     STOP = 331,
490     PATHTOK = 332,
491     RSAKEY = 333,
492     HOST = 334,
493     HOSTNAME = 335,
494     PORT = 336,
495     IPV4 = 337,
496     IPV6 = 338,
497     TYPE = 339,
498     UDP = 340,
499     TCP = 341,
500     TCPSSL = 342,
501     PROTOCOL = 343,
502     CONNECTION = 344,
503     ALERT = 345,
504     NOALERT = 346,
505     MAILFORMAT = 347,
506     UNIXSOCKET = 348,
507     SIGNATURE = 349,
508     TIMEOUT = 350,
509     RETRY = 351,
510     RESTART = 352,
511     CHECKSUM = 353,
512     EVERY = 354,
513     NOTEVERY = 355,
514     DEFAULT = 356,
515     HTTP = 357,
516     HTTPS = 358,
517     APACHESTATUS = 359,
518     FTP = 360,
519     SMTP = 361,
520     SMTPS = 362,
521     POP = 363,
522     POPS = 364,
523     IMAP = 365,
524     IMAPS = 366,
525     CLAMAV = 367,
526     NNTP = 368,
527     NTP3 = 369,
528     MYSQL = 370,
529     MYSQLS = 371,
530     DNS = 372,
531     WEBSOCKET = 373,
532     MQTT = 374,
533     SSH = 375,
534     DWP = 376,
535     LDAP2 = 377,
536     LDAP3 = 378,
537     RDATE = 379,
538     RSYNC = 380,
539     TNS = 381,
540     PGSQL = 382,
541     POSTFIXPOLICY = 383,
542     SIP = 384,
543     LMTP = 385,
544     GPS = 386,
545     RADIUS = 387,
546     MEMCACHE = 388,
547     REDIS = 389,
548     MONGODB = 390,
549     SIEVE = 391,
550     SPAMASSASSIN = 392,
551     FAIL2BAN = 393,
552     STRING = 394,
553     PATH = 395,
554     MAILADDR = 396,
555     MAILFROM = 397,
556     MAILREPLYTO = 398,
557     MAILSUBJECT = 399,
558     MAILBODY = 400,
559     SERVICENAME = 401,
560     STRINGNAME = 402,
561     NUMBER = 403,
562     PERCENT = 404,
563     LOGLIMIT = 405,
564     CLOSELIMIT = 406,
565     DNSLIMIT = 407,
566     KEEPALIVELIMIT = 408,
567     REPLYLIMIT = 409,
568     REQUESTLIMIT = 410,
569     STARTLIMIT = 411,
570     WAITLIMIT = 412,
571     GRACEFULLIMIT = 413,
572     CLEANUPLIMIT = 414,
573     REAL = 415,
574     CHECKPROC = 416,
575     CHECKFILESYS = 417,
576     CHECKFILE = 418,
577     CHECKDIR = 419,
578     CHECKHOST = 420,
579     CHECKSYSTEM = 421,
580     CHECKFIFO = 422,
581     CHECKPROGRAM = 423,
582     CHECKNET = 424,
583     THREADS = 425,
584     CHILDREN = 426,
585     METHOD = 427,
586     GET = 428,
587     HEAD = 429,
588     STATUS = 430,
589     ORIGIN = 431,
590     VERSIONOPT = 432,
591     READ = 433,
592     WRITE = 434,
593     OPERATION = 435,
594     SERVICETIME = 436,
595     DISK = 437,
596     RESOURCE = 438,
597     MEMORY = 439,
598     TOTALMEMORY = 440,
599     LOADAVG1 = 441,
600     LOADAVG5 = 442,
601     LOADAVG15 = 443,
602     SWAP = 444,
603     MODE = 445,
604     ACTIVE = 446,
605     PASSIVE = 447,
606     MANUAL = 448,
607     ONREBOOT = 449,
608     NOSTART = 450,
609     LASTSTATE = 451,
610     CORE = 452,
611     CPU = 453,
612     TOTALCPU = 454,
613     CPUUSER = 455,
614     CPUSYSTEM = 456,
615     CPUWAIT = 457,
616     CPUNICE = 458,
617     CPUHARDIRQ = 459,
618     CPUSOFTIRQ = 460,
619     CPUSTEAL = 461,
620     CPUGUEST = 462,
621     CPUGUESTNICE = 463,
622     GROUP = 464,
623     REQUEST = 465,
624     DEPENDS = 466,
625     BASEDIR = 467,
626     SLOT = 468,
627     EVENTQUEUE = 469,
628     SECRET = 470,
629     HOSTHEADER = 471,
630     UID = 472,
631     EUID = 473,
632     GID = 474,
633     MMONIT = 475,
634     INSTANCE = 476,
635     USERNAME = 477,
636     PASSWORD = 478,
637     DATABASE = 479,
638     TIME = 480,
639     ATIME = 481,
640     CTIME = 482,
641     MTIME = 483,
642     CHANGED = 484,
643     MILLISECOND = 485,
644     SECOND = 486,
645     MINUTE = 487,
646     HOUR = 488,
647     DAY = 489,
648     MONTH = 490,
649     SSLV2 = 491,
650     SSLV3 = 492,
651     TLSV1 = 493,
652     TLSV11 = 494,
653     TLSV12 = 495,
654     TLSV13 = 496,
655     CERTMD5 = 497,
656     AUTO = 498,
657     NOSSLV2 = 499,
658     NOSSLV3 = 500,
659     NOTLSV1 = 501,
660     NOTLSV11 = 502,
661     NOTLSV12 = 503,
662     NOTLSV13 = 504,
663     BYTE = 505,
664     KILOBYTE = 506,
665     MEGABYTE = 507,
666     GIGABYTE = 508,
667     INODE = 509,
668     SPACE = 510,
669     TFREE = 511,
670     PERMISSION = 512,
671     SIZE = 513,
672     MATCH = 514,
673     NOT = 515,
674     IGNORE = 516,
675     ACTION = 517,
676     UPTIME = 518,
677     RESPONSETIME = 519,
678     EXEC = 520,
679     UNMONITOR = 521,
680     PING = 522,
681     PING4 = 523,
682     PING6 = 524,
683     ICMP = 525,
684     ICMPECHO = 526,
685     NONEXIST = 527,
686     EXIST = 528,
687     INVALID = 529,
688     DATA = 530,
689     RECOVERED = 531,
690     PASSED = 532,
691     SUCCEEDED = 533,
692     URL = 534,
693     CONTENT = 535,
694     PID = 536,
695     PPID = 537,
696     FSFLAG = 538,
697     REGISTER = 539,
698     CREDENTIALS = 540,
699     URLOBJECT = 541,
700     ADDRESSOBJECT = 542,
701     TARGET = 543,
702     TIMESPEC = 544,
703     HTTPHEADER = 545,
704     MAXFORWARD = 546,
705     FIPS = 547,
706     SECURITY = 548,
707     ATTRIBUTE = 549,
708     FILEDESCRIPTORS = 550,
709     GREATER = 551,
710     GREATEROREQUAL = 552,
711     LESS = 553,
712     LESSOREQUAL = 554,
713     EQUAL = 555,
714     NOTEQUAL = 556
715   };
716 #endif
717 /* Tokens.  */
718 #define IF 258
719 #define ELSE 259
720 #define THEN 260
721 #define FAILED 261
722 #define SET 262
723 #define LOGFILE 263
724 #define FACILITY 264
725 #define DAEMON 265
726 #define SYSLOG 266
727 #define MAILSERVER 267
728 #define HTTPD 268
729 #define ALLOW 269
730 #define REJECTOPT 270
731 #define ADDRESS 271
732 #define INIT 272
733 #define TERMINAL 273
734 #define BATCH 274
735 #define READONLY 275
736 #define CLEARTEXT 276
737 #define MD5HASH 277
738 #define SHA1HASH 278
739 #define CRYPT 279
740 #define DELAY 280
741 #define PEMFILE 281
742 #define PEMKEY 282
743 #define PEMCHAIN 283
744 #define ENABLE 284
745 #define DISABLE 285
746 #define SSLTOKEN 286
747 #define CIPHER 287
748 #define CLIENTPEMFILE 288
749 #define ALLOWSELFCERTIFICATION 289
750 #define SELFSIGNED 290
751 #define VERIFY 291
752 #define CERTIFICATE 292
753 #define CACERTIFICATEFILE 293
754 #define CACERTIFICATEPATH 294
755 #define VALID 295
756 #define INTERFACE 296
757 #define LINK 297
758 #define PACKET 298
759 #define BYTEIN 299
760 #define BYTEOUT 300
761 #define PACKETIN 301
762 #define PACKETOUT 302
763 #define SPEED 303
764 #define SATURATION 304
765 #define UPLOAD 305
766 #define DOWNLOAD 306
767 #define TOTAL 307
768 #define UP 308
769 #define DOWN 309
770 #define IDFILE 310
771 #define STATEFILE 311
772 #define SEND 312
773 #define EXPECT 313
774 #define CYCLE 314
775 #define COUNT 315
776 #define REMINDER 316
777 #define REPEAT 317
778 #define LIMITS 318
779 #define SENDEXPECTBUFFER 319
780 #define EXPECTBUFFER 320
781 #define FILECONTENTBUFFER 321
782 #define HTTPCONTENTBUFFER 322
783 #define PROGRAMOUTPUT 323
784 #define NETWORKTIMEOUT 324
785 #define PROGRAMTIMEOUT 325
786 #define STARTTIMEOUT 326
787 #define STOPTIMEOUT 327
788 #define RESTARTTIMEOUT 328
789 #define PIDFILE 329
790 #define START 330
791 #define STOP 331
792 #define PATHTOK 332
793 #define RSAKEY 333
794 #define HOST 334
795 #define HOSTNAME 335
796 #define PORT 336
797 #define IPV4 337
798 #define IPV6 338
799 #define TYPE 339
800 #define UDP 340
801 #define TCP 341
802 #define TCPSSL 342
803 #define PROTOCOL 343
804 #define CONNECTION 344
805 #define ALERT 345
806 #define NOALERT 346
807 #define MAILFORMAT 347
808 #define UNIXSOCKET 348
809 #define SIGNATURE 349
810 #define TIMEOUT 350
811 #define RETRY 351
812 #define RESTART 352
813 #define CHECKSUM 353
814 #define EVERY 354
815 #define NOTEVERY 355
816 #define DEFAULT 356
817 #define HTTP 357
818 #define HTTPS 358
819 #define APACHESTATUS 359
820 #define FTP 360
821 #define SMTP 361
822 #define SMTPS 362
823 #define POP 363
824 #define POPS 364
825 #define IMAP 365
826 #define IMAPS 366
827 #define CLAMAV 367
828 #define NNTP 368
829 #define NTP3 369
830 #define MYSQL 370
831 #define MYSQLS 371
832 #define DNS 372
833 #define WEBSOCKET 373
834 #define MQTT 374
835 #define SSH 375
836 #define DWP 376
837 #define LDAP2 377
838 #define LDAP3 378
839 #define RDATE 379
840 #define RSYNC 380
841 #define TNS 381
842 #define PGSQL 382
843 #define POSTFIXPOLICY 383
844 #define SIP 384
845 #define LMTP 385
846 #define GPS 386
847 #define RADIUS 387
848 #define MEMCACHE 388
849 #define REDIS 389
850 #define MONGODB 390
851 #define SIEVE 391
852 #define SPAMASSASSIN 392
853 #define FAIL2BAN 393
854 #define STRING 394
855 #define PATH 395
856 #define MAILADDR 396
857 #define MAILFROM 397
858 #define MAILREPLYTO 398
859 #define MAILSUBJECT 399
860 #define MAILBODY 400
861 #define SERVICENAME 401
862 #define STRINGNAME 402
863 #define NUMBER 403
864 #define PERCENT 404
865 #define LOGLIMIT 405
866 #define CLOSELIMIT 406
867 #define DNSLIMIT 407
868 #define KEEPALIVELIMIT 408
869 #define REPLYLIMIT 409
870 #define REQUESTLIMIT 410
871 #define STARTLIMIT 411
872 #define WAITLIMIT 412
873 #define GRACEFULLIMIT 413
874 #define CLEANUPLIMIT 414
875 #define REAL 415
876 #define CHECKPROC 416
877 #define CHECKFILESYS 417
878 #define CHECKFILE 418
879 #define CHECKDIR 419
880 #define CHECKHOST 420
881 #define CHECKSYSTEM 421
882 #define CHECKFIFO 422
883 #define CHECKPROGRAM 423
884 #define CHECKNET 424
885 #define THREADS 425
886 #define CHILDREN 426
887 #define METHOD 427
888 #define GET 428
889 #define HEAD 429
890 #define STATUS 430
891 #define ORIGIN 431
892 #define VERSIONOPT 432
893 #define READ 433
894 #define WRITE 434
895 #define OPERATION 435
896 #define SERVICETIME 436
897 #define DISK 437
898 #define RESOURCE 438
899 #define MEMORY 439
900 #define TOTALMEMORY 440
901 #define LOADAVG1 441
902 #define LOADAVG5 442
903 #define LOADAVG15 443
904 #define SWAP 444
905 #define MODE 445
906 #define ACTIVE 446
907 #define PASSIVE 447
908 #define MANUAL 448
909 #define ONREBOOT 449
910 #define NOSTART 450
911 #define LASTSTATE 451
912 #define CORE 452
913 #define CPU 453
914 #define TOTALCPU 454
915 #define CPUUSER 455
916 #define CPUSYSTEM 456
917 #define CPUWAIT 457
918 #define CPUNICE 458
919 #define CPUHARDIRQ 459
920 #define CPUSOFTIRQ 460
921 #define CPUSTEAL 461
922 #define CPUGUEST 462
923 #define CPUGUESTNICE 463
924 #define GROUP 464
925 #define REQUEST 465
926 #define DEPENDS 466
927 #define BASEDIR 467
928 #define SLOT 468
929 #define EVENTQUEUE 469
930 #define SECRET 470
931 #define HOSTHEADER 471
932 #define UID 472
933 #define EUID 473
934 #define GID 474
935 #define MMONIT 475
936 #define INSTANCE 476
937 #define USERNAME 477
938 #define PASSWORD 478
939 #define DATABASE 479
940 #define TIME 480
941 #define ATIME 481
942 #define CTIME 482
943 #define MTIME 483
944 #define CHANGED 484
945 #define MILLISECOND 485
946 #define SECOND 486
947 #define MINUTE 487
948 #define HOUR 488
949 #define DAY 489
950 #define MONTH 490
951 #define SSLV2 491
952 #define SSLV3 492
953 #define TLSV1 493
954 #define TLSV11 494
955 #define TLSV12 495
956 #define TLSV13 496
957 #define CERTMD5 497
958 #define AUTO 498
959 #define NOSSLV2 499
960 #define NOSSLV3 500
961 #define NOTLSV1 501
962 #define NOTLSV11 502
963 #define NOTLSV12 503
964 #define NOTLSV13 504
965 #define BYTE 505
966 #define KILOBYTE 506
967 #define MEGABYTE 507
968 #define GIGABYTE 508
969 #define INODE 509
970 #define SPACE 510
971 #define TFREE 511
972 #define PERMISSION 512
973 #define SIZE 513
974 #define MATCH 514
975 #define NOT 515
976 #define IGNORE 516
977 #define ACTION 517
978 #define UPTIME 518
979 #define RESPONSETIME 519
980 #define EXEC 520
981 #define UNMONITOR 521
982 #define PING 522
983 #define PING4 523
984 #define PING6 524
985 #define ICMP 525
986 #define ICMPECHO 526
987 #define NONEXIST 527
988 #define EXIST 528
989 #define INVALID 529
990 #define DATA 530
991 #define RECOVERED 531
992 #define PASSED 532
993 #define SUCCEEDED 533
994 #define URL 534
995 #define CONTENT 535
996 #define PID 536
997 #define PPID 537
998 #define FSFLAG 538
999 #define REGISTER 539
1000 #define CREDENTIALS 540
1001 #define URLOBJECT 541
1002 #define ADDRESSOBJECT 542
1003 #define TARGET 543
1004 #define TIMESPEC 544
1005 #define HTTPHEADER 545
1006 #define MAXFORWARD 546
1007 #define FIPS 547
1008 #define SECURITY 548
1009 #define ATTRIBUTE 549
1010 #define FILEDESCRIPTORS 550
1011 #define GREATER 551
1012 #define GREATEROREQUAL 552
1013 #define LESS 553
1014 #define LESSOREQUAL 554
1015 #define EQUAL 555
1016 #define NOTEQUAL 556
1017 
1018 /* Value type.  */
1019 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
1020 union YYSTYPE
1021 {
1022 #line 325 "src/p.y"
1023 
1024         URL_T url;
1025         Address_T address;
1026         float real;
1027         int   number;
1028         char *string;
1029 
1030 #line 1031 "src/y.tab.c"
1031 
1032 };
1033 typedef union YYSTYPE YYSTYPE;
1034 # define YYSTYPE_IS_TRIVIAL 1
1035 # define YYSTYPE_IS_DECLARED 1
1036 #endif
1037 
1038 
1039 extern YYSTYPE yylval;
1040 
1041 int yyparse (void);
1042 
1043 #endif /* !YY_YY_SRC_Y_TAB_H_INCLUDED  */
1044 
1045 
1046 
1047 #ifdef short
1048 # undef short
1049 #endif
1050 
1051 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
1052    <limits.h> and (if available) <stdint.h> are included
1053    so that the code can choose integer types of a good width.  */
1054 
1055 #ifndef __PTRDIFF_MAX__
1056 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
1057 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
1058 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
1059 #  define YY_STDINT_H
1060 # endif
1061 #endif
1062 
1063 /* Narrow types that promote to a signed type and that can represent a
1064    signed or unsigned integer of at least N bits.  In tables they can
1065    save space and decrease cache pressure.  Promoting to a signed type
1066    helps avoid bugs in integer arithmetic.  */
1067 
1068 #ifdef __INT_LEAST8_MAX__
1069 typedef __INT_LEAST8_TYPE__ yytype_int8;
1070 #elif defined YY_STDINT_H
1071 typedef int_least8_t yytype_int8;
1072 #else
1073 typedef signed char yytype_int8;
1074 #endif
1075 
1076 #ifdef __INT_LEAST16_MAX__
1077 typedef __INT_LEAST16_TYPE__ yytype_int16;
1078 #elif defined YY_STDINT_H
1079 typedef int_least16_t yytype_int16;
1080 #else
1081 typedef short yytype_int16;
1082 #endif
1083 
1084 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
1085 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
1086 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
1087        && UINT_LEAST8_MAX <= INT_MAX)
1088 typedef uint_least8_t yytype_uint8;
1089 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
1090 typedef unsigned char yytype_uint8;
1091 #else
1092 typedef short yytype_uint8;
1093 #endif
1094 
1095 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
1096 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
1097 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
1098        && UINT_LEAST16_MAX <= INT_MAX)
1099 typedef uint_least16_t yytype_uint16;
1100 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
1101 typedef unsigned short yytype_uint16;
1102 #else
1103 typedef int yytype_uint16;
1104 #endif
1105 
1106 #ifndef YYPTRDIFF_T
1107 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
1108 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
1109 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
1110 # elif defined PTRDIFF_MAX
1111 #  ifndef ptrdiff_t
1112 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1113 #  endif
1114 #  define YYPTRDIFF_T ptrdiff_t
1115 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
1116 # else
1117 #  define YYPTRDIFF_T long
1118 #  define YYPTRDIFF_MAXIMUM LONG_MAX
1119 # endif
1120 #endif
1121 
1122 #ifndef YYSIZE_T
1123 # ifdef __SIZE_TYPE__
1124 #  define YYSIZE_T __SIZE_TYPE__
1125 # elif defined size_t
1126 #  define YYSIZE_T size_t
1127 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
1128 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1129 #  define YYSIZE_T size_t
1130 # else
1131 #  define YYSIZE_T unsigned
1132 # endif
1133 #endif
1134 
1135 #define YYSIZE_MAXIMUM                                  \
1136   YY_CAST (YYPTRDIFF_T,                                 \
1137            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
1138             ? YYPTRDIFF_MAXIMUM                         \
1139             : YY_CAST (YYSIZE_T, -1)))
1140 
1141 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
1142 
1143 /* Stored state numbers (used for stacks). */
1144 typedef yytype_int16 yy_state_t;
1145 
1146 /* State numbers in computations.  */
1147 typedef int yy_state_fast_t;
1148 
1149 #ifndef YY_
1150 # if defined YYENABLE_NLS && YYENABLE_NLS
1151 #  if ENABLE_NLS
1152 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1153 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
1154 #  endif
1155 # endif
1156 # ifndef YY_
1157 #  define YY_(Msgid) Msgid
1158 # endif
1159 #endif
1160 
1161 #ifndef YY_ATTRIBUTE_PURE
1162 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
1163 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
1164 # else
1165 #  define YY_ATTRIBUTE_PURE
1166 # endif
1167 #endif
1168 
1169 #ifndef YY_ATTRIBUTE_UNUSED
1170 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
1171 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
1172 # else
1173 #  define YY_ATTRIBUTE_UNUSED
1174 # endif
1175 #endif
1176 
1177 /* Suppress unused-variable warnings by "using" E.  */
1178 #if ! defined lint || defined __GNUC__
1179 # define YYUSE(E) ((void) (E))
1180 #else
1181 # define YYUSE(E) /* empty */
1182 #endif
1183 
1184 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1185 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
1186 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
1187     _Pragma ("GCC diagnostic push")                                     \
1188     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
1189     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1190 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
1191     _Pragma ("GCC diagnostic pop")
1192 #else
1193 # define YY_INITIAL_VALUE(Value) Value
1194 #endif
1195 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1196 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1197 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1198 #endif
1199 #ifndef YY_INITIAL_VALUE
1200 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1201 #endif
1202 
1203 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
1204 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
1205     _Pragma ("GCC diagnostic push")                            \
1206     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
1207 # define YY_IGNORE_USELESS_CAST_END            \
1208     _Pragma ("GCC diagnostic pop")
1209 #endif
1210 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
1211 # define YY_IGNORE_USELESS_CAST_BEGIN
1212 # define YY_IGNORE_USELESS_CAST_END
1213 #endif
1214 
1215 
1216 #define YY_ASSERT(E) ((void) (0 && (E)))
1217 
1218 #if ! defined yyoverflow || YYERROR_VERBOSE
1219 
1220 /* The parser invokes alloca or malloc; define the necessary symbols.  */
1221 
1222 # ifdef YYSTACK_USE_ALLOCA
1223 #  if YYSTACK_USE_ALLOCA
1224 #   ifdef __GNUC__
1225 #    define YYSTACK_ALLOC __builtin_alloca
1226 #   elif defined __BUILTIN_VA_ARG_INCR
1227 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1228 #   elif defined _AIX
1229 #    define YYSTACK_ALLOC __alloca
1230 #   elif defined _MSC_VER
1231 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1232 #    define alloca _alloca
1233 #   else
1234 #    define YYSTACK_ALLOC alloca
1235 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1236 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1237       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
1238 #     ifndef EXIT_SUCCESS
1239 #      define EXIT_SUCCESS 0
1240 #     endif
1241 #    endif
1242 #   endif
1243 #  endif
1244 # endif
1245 
1246 # ifdef YYSTACK_ALLOC
1247    /* Pacify GCC's 'empty if-body' warning.  */
1248 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1249 #  ifndef YYSTACK_ALLOC_MAXIMUM
1250     /* The OS might guarantee only one guard page at the bottom of the stack,
1251        and a page size can be as small as 4096 bytes.  So we cannot safely
1252        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
1253        to allow for a few compiler-allocated temporary stack slots.  */
1254 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1255 #  endif
1256 # else
1257 #  define YYSTACK_ALLOC YYMALLOC
1258 #  define YYSTACK_FREE YYFREE
1259 #  ifndef YYSTACK_ALLOC_MAXIMUM
1260 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1261 #  endif
1262 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
1263        && ! ((defined YYMALLOC || defined malloc) \
1264              && (defined YYFREE || defined free)))
1265 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1266 #   ifndef EXIT_SUCCESS
1267 #    define EXIT_SUCCESS 0
1268 #   endif
1269 #  endif
1270 #  ifndef YYMALLOC
1271 #   define YYMALLOC malloc
1272 #   if ! defined malloc && ! defined EXIT_SUCCESS
1273 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1274 #   endif
1275 #  endif
1276 #  ifndef YYFREE
1277 #   define YYFREE free
1278 #   if ! defined free && ! defined EXIT_SUCCESS
1279 void free (void *); /* INFRINGES ON USER NAME SPACE */
1280 #   endif
1281 #  endif
1282 # endif
1283 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1284 
1285 
1286 #if (! defined yyoverflow \
1287      && (! defined __cplusplus \
1288          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1289 
1290 /* A type that is properly aligned for any stack member.  */
1291 union yyalloc
1292 {
1293   yy_state_t yyss_alloc;
1294   YYSTYPE yyvs_alloc;
1295 };
1296 
1297 /* The size of the maximum gap between one aligned stack and the next.  */
1298 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
1299 
1300 /* The size of an array large to enough to hold all stacks, each with
1301    N elements.  */
1302 # define YYSTACK_BYTES(N) \
1303      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
1304       + YYSTACK_GAP_MAXIMUM)
1305 
1306 # define YYCOPY_NEEDED 1
1307 
1308 /* Relocate STACK from its old location to the new one.  The
1309    local variables YYSIZE and YYSTACKSIZE give the old and new number of
1310    elements in the stack, and YYPTR gives the new location of the
1311    stack.  Advance YYPTR to a properly aligned location for the next
1312    stack.  */
1313 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
1314     do                                                                  \
1315       {                                                                 \
1316         YYPTRDIFF_T yynewbytes;                                         \
1317         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
1318         Stack = &yyptr->Stack_alloc;                                    \
1319         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
1320         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
1321       }                                                                 \
1322     while (0)
1323 
1324 #endif
1325 
1326 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1327 /* Copy COUNT objects from SRC to DST.  The source and destination do
1328    not overlap.  */
1329 # ifndef YYCOPY
1330 #  if defined __GNUC__ && 1 < __GNUC__
1331 #   define YYCOPY(Dst, Src, Count) \
1332       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
1333 #  else
1334 #   define YYCOPY(Dst, Src, Count)              \
1335       do                                        \
1336         {                                       \
1337           YYPTRDIFF_T yyi;                      \
1338           for (yyi = 0; yyi < (Count); yyi++)   \
1339             (Dst)[yyi] = (Src)[yyi];            \
1340         }                                       \
1341       while (0)
1342 #  endif
1343 # endif
1344 #endif /* !YYCOPY_NEEDED */
1345 
1346 /* YYFINAL -- State number of the termination state.  */
1347 #define YYFINAL  69
1348 /* YYLAST -- Last index in YYTABLE.  */
1349 #define YYLAST   2009
1350 
1351 /* YYNTOKENS -- Number of terminals.  */
1352 #define YYNTOKENS  308
1353 /* YYNNTS -- Number of nonterminals.  */
1354 #define YYNNTS  251
1355 /* YYNRULES -- Number of rules.  */
1356 #define YYNRULES  837
1357 /* YYNSTATES -- Number of states.  */
1358 #define YYNSTATES  1624
1359 
1360 #define YYUNDEFTOK  2
1361 #define YYMAXUTOK   556
1362 
1363 
1364 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
1365    as returned by yylex, with out-of-bounds checking.  */
1366 #define YYTRANSLATE(YYX)                                                \
1367   (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1368 
1369 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1370    as returned by yylex.  */
1371 static const yytype_int16 yytranslate[] =
1372 {
1373        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1374        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1375        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1376        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1377        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1378        2,     2,     2,     2,     2,     2,     2,     2,   304,     2,
1379        2,     2,     2,     2,   305,     2,     2,     2,     2,     2,
1380        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1381        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1382        2,   306,     2,   307,     2,     2,     2,     2,     2,     2,
1383        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1384        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1385        2,     2,     2,   302,     2,   303,     2,     2,     2,     2,
1386        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1387        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1388        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1389        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1390        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1391        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1392        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1393        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1394        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1395        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1396        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1397        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1398        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1399        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1400       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1401       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
1402       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
1403       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
1404       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1405       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
1406       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
1407       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
1408       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
1409      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
1410      115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
1411      125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
1412      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
1413      145,   146,   147,   148,   149,   150,   151,   152,   153,   154,
1414      155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
1415      165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
1416      175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
1417      185,   186,   187,   188,   189,   190,   191,   192,   193,   194,
1418      195,   196,   197,   198,   199,   200,   201,   202,   203,   204,
1419      205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
1420      215,   216,   217,   218,   219,   220,   221,   222,   223,   224,
1421      225,   226,   227,   228,   229,   230,   231,   232,   233,   234,
1422      235,   236,   237,   238,   239,   240,   241,   242,   243,   244,
1423      245,   246,   247,   248,   249,   250,   251,   252,   253,   254,
1424      255,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1425      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1426      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1427      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1428      295,   296,   297,   298,   299,   300,   301
1429 };
1430 
1431 #if YYDEBUG
1432   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
1433 static const yytype_int16 yyrline[] =
1434 {
1435        0,   379,   379,   380,   383,   384,   387,   388,   389,   390,
1436      391,   392,   393,   394,   395,   396,   397,   398,   399,   400,
1437      401,   402,   403,   404,   405,   406,   407,   408,   409,   410,
1438      411,   412,   413,   416,   417,   420,   421,   422,   423,   424,
1439      425,   426,   427,   428,   429,   430,   431,   432,   433,   434,
1440      435,   436,   437,   438,   439,   440,   441,   442,   443,   446,
1441      447,   450,   451,   452,   453,   454,   455,   456,   457,   458,
1442      459,   460,   461,   462,   463,   464,   465,   466,   467,   470,
1443      471,   474,   475,   476,   477,   478,   479,   480,   481,   482,
1444      483,   484,   485,   486,   487,   488,   489,   490,   491,   492,
1445      493,   496,   497,   500,   501,   502,   503,   504,   505,   506,
1446      507,   508,   509,   510,   511,   512,   513,   514,   517,   518,
1447      521,   522,   523,   524,   525,   526,   527,   528,   529,   530,
1448      531,   532,   533,   536,   537,   540,   541,   542,   543,   544,
1449      545,   546,   547,   548,   549,   550,   551,   552,   553,   554,
1450      557,   558,   561,   562,   563,   564,   565,   566,   567,   568,
1451      569,   570,   571,   572,   573,   576,   577,   580,   581,   582,
1452      583,   584,   585,   586,   587,   588,   589,   590,   591,   592,
1453      593,   594,   597,   598,   601,   602,   603,   604,   605,   606,
1454      607,   608,   609,   610,   611,   612,   615,   619,   622,   628,
1455      638,   643,   646,   651,   656,   659,   662,   667,   673,   676,
1456      677,   680,   683,   686,   689,   692,   695,   698,   701,   704,
1457      707,   710,   713,   716,   719,   724,   729,   737,   740,   745,
1458      748,   752,   758,   763,   768,   776,   779,   780,   783,   789,
1459      790,   793,   796,   797,   798,   799,   802,   803,   808,   813,
1460      816,   819,   820,   823,   827,   831,   835,   839,   842,   846,
1461      849,   852,   855,   858,   861,   866,   872,   873,   876,   890,
1462      897,   906,   907,   910,   911,   914,   921,   924,   931,   934,
1463      941,   944,   951,   954,   961,   964,   971,   974,   985,   994,
1464     1001,  1016,  1017,  1020,  1029,  1040,  1041,  1044,  1047,  1050,
1465     1051,  1052,  1053,  1056,  1083,  1084,  1087,  1088,  1089,  1090,
1466     1091,  1092,  1093,  1094,  1095,  1099,  1105,  1111,  1117,  1123,
1467     1129,  1130,  1133,  1138,  1143,  1147,  1151,  1157,  1158,  1161,
1468     1162,  1165,  1168,  1173,  1178,  1181,  1189,  1193,  1197,  1201,
1469     1205,  1205,  1212,  1212,  1219,  1219,  1226,  1226,  1233,  1240,
1470     1241,  1244,  1250,  1253,  1258,  1261,  1264,  1271,  1280,  1285,
1471     1288,  1293,  1298,  1303,  1311,  1317,  1332,  1337,  1343,  1351,
1472     1354,  1359,  1362,  1368,  1371,  1376,  1377,  1380,  1381,  1384,
1473     1387,  1392,  1396,  1400,  1403,  1408,  1411,  1416,  1421,  1426,
1474     1429,  1434,  1444,  1454,  1455,  1458,  1459,  1460,  1461,  1462,
1475     1463,  1464,  1465,  1466,  1467,  1468,  1469,  1472,  1480,  1490,
1476     1491,  1494,  1495,  1496,  1497,  1498,  1499,  1502,  1509,  1518,
1477     1519,  1522,  1523,  1524,  1525,  1526,  1527,  1530,  1539,  1545,
1478     1551,  1557,  1566,  1572,  1578,  1586,  1587,  1590,  1591,  1592,
1479     1593,  1596,  1599,  1604,  1609,  1615,  1618,  1623,  1626,  1630,
1480     1635,  1636,  1639,  1640,  1643,  1648,  1651,  1654,  1657,  1660,
1481     1663,  1666,  1669,  1672,  1675,  1680,  1683,  1688,  1691,  1694,
1482     1697,  1700,  1703,  1706,  1709,  1713,  1716,  1720,  1723,  1726,
1483     1731,  1734,  1737,  1740,  1743,  1746,  1749,  1752,  1755,  1760,
1484     1763,  1766,  1769,  1774,  1782,  1792,  1793,  1796,  1799,  1802,
1485     1805,  1810,  1811,  1814,  1817,  1822,  1823,  1826,  1829,  1834,
1486     1835,  1838,  1841,  1844,  1857,  1863,  1871,  1872,  1875,  1878,
1487     1881,  1886,  1889,  1894,  1899,  1900,  1903,  1906,  1911,  1912,
1488     1915,  1918,  1921,  1922,  1923,  1924,  1925,  1926,  1929,  1939,
1489     1942,  1947,  1951,  1957,  1962,  1968,  1969,  1974,  1979,  1980,
1490     1983,  1988,  1989,  1992,  1995,  1998,  2001,  2005,  2009,  2013,
1491     2017,  2021,  2025,  2029,  2033,  2037,  2043,  2047,  2054,  2060,
1492     2066,  2074,  2078,  2084,  2089,  2099,  2104,  2109,  2112,  2117,
1493     2120,  2125,  2128,  2133,  2136,  2141,  2144,  2149,  2154,  2159,
1494     2165,  2173,  2179,  2180,  2183,  2187,  2190,  2194,  2199,  2202,
1495     2205,  2206,  2209,  2210,  2211,  2212,  2213,  2214,  2215,  2216,
1496     2217,  2218,  2219,  2220,  2221,  2222,  2223,  2224,  2225,  2226,
1497     2227,  2228,  2229,  2230,  2231,  2232,  2233,  2234,  2235,  2236,
1498     2237,  2238,  2241,  2242,  2245,  2246,  2249,  2250,  2251,  2252,
1499     2255,  2260,  2265,  2272,  2275,  2278,  2284,  2287,  2291,  2296,
1500     2303,  2306,  2307,  2310,  2313,  2320,  2329,  2335,  2336,  2339,
1501     2340,  2341,  2342,  2343,  2344,  2345,  2348,  2354,  2355,  2358,
1502     2359,  2360,  2361,  2364,  2369,  2376,  2383,  2389,  2395,  2401,
1503     2407,  2413,  2419,  2425,  2431,  2437,  2442,  2447,  2454,  2459,
1504     2464,  2469,  2476,  2481,  2488,  2495,  2502,  2522,  2523,  2524,
1505     2527,  2528,  2532,  2537,  2542,  2549,  2554,  2559,  2566,  2567,
1506     2570,  2571,  2572,  2573,  2576,  2583,  2591,  2592,  2593,  2594,
1507     2595,  2596,  2597,  2598,  2601,  2602,  2603,  2604,  2605,  2606,
1508     2609,  2610,  2611,  2613,  2614,  2616,  2619,  2622,  2630,  2633,
1509     2636,  2640,  2643,  2646,  2649,  2654,  2665,  2676,  2686,  2698,
1510     2699,  2704,  2711,  2712,  2717,  2724,  2727,  2730,  2733,  2736,
1511     2741,  2744,  2747,  2752,  2756,  2763,  2769,  2770,  2771,  2774,
1512     2781,  2788,  2795,  2804,  2811,  2818,  2825,  2834,  2841,  2850,
1513     2857,  2866,  2873,  2882,  2888,  2889,  2890,  2891,  2892,  2895,
1514     2900,  2907,  2916,  2924,  2931,  2939,  2947,  2954,  2960,  2967,
1515     2975,  2978,  2984,  2990,  2997,  3003,  3010,  3016,  3023,  3026,
1516     3031,  3037,  3045,  3051,  3059,  3067,  3073,  3080,  3084,  3089,
1517     3096,  3101,  3109,  3117,  3125,  3133,  3141,  3149,  3159,  3167,
1518     3175,  3183,  3191,  3199,  3209,  3212,  3213,  3214
1519 };
1520 #endif
1521 
1522 #if YYDEBUG || YYERROR_VERBOSE || 0
1523 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1524    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
1525 static const char *const yytname[] =
1526 {
1527   "$end", "error", "$undefined", "IF", "ELSE", "THEN", "FAILED", "SET",
1528   "LOGFILE", "FACILITY", "DAEMON", "SYSLOG", "MAILSERVER", "HTTPD",
1529   "ALLOW", "REJECTOPT", "ADDRESS", "INIT", "TERMINAL", "BATCH", "READONLY",
1530   "CLEARTEXT", "MD5HASH", "SHA1HASH", "CRYPT", "DELAY", "PEMFILE",
1531   "PEMKEY", "PEMCHAIN", "ENABLE", "DISABLE", "SSLTOKEN", "CIPHER",
1532   "CLIENTPEMFILE", "ALLOWSELFCERTIFICATION", "SELFSIGNED", "VERIFY",
1533   "CERTIFICATE", "CACERTIFICATEFILE", "CACERTIFICATEPATH", "VALID",
1534   "INTERFACE", "LINK", "PACKET", "BYTEIN", "BYTEOUT", "PACKETIN",
1535   "PACKETOUT", "SPEED", "SATURATION", "UPLOAD", "DOWNLOAD", "TOTAL", "UP",
1536   "DOWN", "IDFILE", "STATEFILE", "SEND", "EXPECT", "CYCLE", "COUNT",
1537   "REMINDER", "REPEAT", "LIMITS", "SENDEXPECTBUFFER", "EXPECTBUFFER",
1538   "FILECONTENTBUFFER", "HTTPCONTENTBUFFER", "PROGRAMOUTPUT",
1539   "NETWORKTIMEOUT", "PROGRAMTIMEOUT", "STARTTIMEOUT", "STOPTIMEOUT",
1540   "RESTARTTIMEOUT", "PIDFILE", "START", "STOP", "PATHTOK", "RSAKEY",
1541   "HOST", "HOSTNAME", "PORT", "IPV4", "IPV6", "TYPE", "UDP", "TCP",
1542   "TCPSSL", "PROTOCOL", "CONNECTION", "ALERT", "NOALERT", "MAILFORMAT",
1543   "UNIXSOCKET", "SIGNATURE", "TIMEOUT", "RETRY", "RESTART", "CHECKSUM",
1544   "EVERY", "NOTEVERY", "DEFAULT", "HTTP", "HTTPS", "APACHESTATUS", "FTP",
1545   "SMTP", "SMTPS", "POP", "POPS", "IMAP", "IMAPS", "CLAMAV", "NNTP",
1546   "NTP3", "MYSQL", "MYSQLS", "DNS", "WEBSOCKET", "MQTT", "SSH", "DWP",
1547   "LDAP2", "LDAP3", "RDATE", "RSYNC", "TNS", "PGSQL", "POSTFIXPOLICY",
1548   "SIP", "LMTP", "GPS", "RADIUS", "MEMCACHE", "REDIS", "MONGODB", "SIEVE",
1549   "SPAMASSASSIN", "FAIL2BAN", "STRING", "PATH", "MAILADDR", "MAILFROM",
1550   "MAILREPLYTO", "MAILSUBJECT", "MAILBODY", "SERVICENAME", "STRINGNAME",
1551   "NUMBER", "PERCENT", "LOGLIMIT", "CLOSELIMIT", "DNSLIMIT",
1552   "KEEPALIVELIMIT", "REPLYLIMIT", "REQUESTLIMIT", "STARTLIMIT",
1553   "WAITLIMIT", "GRACEFULLIMIT", "CLEANUPLIMIT", "REAL", "CHECKPROC",
1554   "CHECKFILESYS", "CHECKFILE", "CHECKDIR", "CHECKHOST", "CHECKSYSTEM",
1555   "CHECKFIFO", "CHECKPROGRAM", "CHECKNET", "THREADS", "CHILDREN", "METHOD",
1556   "GET", "HEAD", "STATUS", "ORIGIN", "VERSIONOPT", "READ", "WRITE",
1557   "OPERATION", "SERVICETIME", "DISK", "RESOURCE", "MEMORY", "TOTALMEMORY",
1558   "LOADAVG1", "LOADAVG5", "LOADAVG15", "SWAP", "MODE", "ACTIVE", "PASSIVE",
1559   "MANUAL", "ONREBOOT", "NOSTART", "LASTSTATE", "CORE", "CPU", "TOTALCPU",
1560   "CPUUSER", "CPUSYSTEM", "CPUWAIT", "CPUNICE", "CPUHARDIRQ", "CPUSOFTIRQ",
1561   "CPUSTEAL", "CPUGUEST", "CPUGUESTNICE", "GROUP", "REQUEST", "DEPENDS",
1562   "BASEDIR", "SLOT", "EVENTQUEUE", "SECRET", "HOSTHEADER", "UID", "EUID",
1563   "GID", "MMONIT", "INSTANCE", "USERNAME", "PASSWORD", "DATABASE", "TIME",
1564   "ATIME", "CTIME", "MTIME", "CHANGED", "MILLISECOND", "SECOND", "MINUTE",
1565   "HOUR", "DAY", "MONTH", "SSLV2", "SSLV3", "TLSV1", "TLSV11", "TLSV12",
1566   "TLSV13", "CERTMD5", "AUTO", "NOSSLV2", "NOSSLV3", "NOTLSV1", "NOTLSV11",
1567   "NOTLSV12", "NOTLSV13", "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE",
1568   "INODE", "SPACE", "TFREE", "PERMISSION", "SIZE", "MATCH", "NOT",
1569   "IGNORE", "ACTION", "UPTIME", "RESPONSETIME", "EXEC", "UNMONITOR",
1570   "PING", "PING4", "PING6", "ICMP", "ICMPECHO", "NONEXIST", "EXIST",
1571   "INVALID", "DATA", "RECOVERED", "PASSED", "SUCCEEDED", "URL", "CONTENT",
1572   "PID", "PPID", "FSFLAG", "REGISTER", "CREDENTIALS", "URLOBJECT",
1573   "ADDRESSOBJECT", "TARGET", "TIMESPEC", "HTTPHEADER", "MAXFORWARD",
1574   "FIPS", "SECURITY", "ATTRIBUTE", "FILEDESCRIPTORS", "GREATER",
1575   "GREATEROREQUAL", "LESS", "LESSOREQUAL", "EQUAL", "NOTEQUAL", "'{'",
1576   "'}'", "':'", "'@'", "'['", "']'", "$accept", "cfgfile",
1577   "statement_list", "statement", "optproclist", "optproc", "optfilelist",
1578   "optfile", "optfilesyslist", "optfilesys", "optdirlist", "optdir",
1579   "opthostlist", "opthost", "optnetlist", "optnet", "optsystemlist",
1580   "optsystem", "optfifolist", "optfifo", "optprogramlist", "optprogram",
1581   "setalert", "setdaemon", "setterminal", "startdelay", "setinit",
1582   "setonreboot", "setexpectbuffer", "setlimits", "limitlist", "limit",
1583   "setfips", "setlog", "seteventqueue", "setidfile", "setstatefile",
1584   "setpid", "setmmonits", "mmonitlist", "mmonit", "mmonitoptlist",
1585   "mmonitopt", "credentials", "setssl", "ssl", "ssloptionlist",
1586   "ssloption", "sslexpire", "expireoperator", "sslchecksum",
1587   "checksumoperator", "sslversionlist", "sslversion", "certmd5",
1588   "setmailservers", "setmailformat", "mailserverlist", "mailserver",
1589   "mailserveroptlist", "mailserveropt", "sethttpd", "httpdlist",
1590   "httpdoption", "pemfile", "clientpemfile", "allowselfcert", "httpdport",
1591   "httpdsocket", "httpdsocketoptionlist", "httpdsocketoption", "sigenable",
1592   "sigdisable", "signature", "bindaddress", "allow", "$@1", "$@2", "$@3",
1593   "$@4", "allowuserlist", "allowuser", "readonly", "checkproc",
1594   "checkfile", "checkfilesys", "checkdir", "checkhost", "checknet",
1595   "checksystem", "checkfifo", "checkprogram", "start", "stop", "restart",
1596   "argumentlist", "useroptionlist", "argument", "useroption", "username",
1597   "password", "database", "hostname", "connection", "connectionoptlist",
1598   "connectionopt", "connectionurl", "connectionurloptlist",
1599   "connectionurlopt", "connectionunix", "connectionuxoptlist",
1600   "connectionuxopt", "icmp", "icmpoptlist", "icmpopt", "host", "port",
1601   "unixsocket", "ip", "type", "typeoptlist", "typeopt", "outgoing",
1602   "protocol", "sendexpect", "websocketlist", "websocket", "smtplist",
1603   "smtp", "mqttlist", "mqtt", "mysqllist", "mysql", "postgresqllist",
1604   "postgresql", "target", "maxforward", "siplist", "sip", "httplist",
1605   "http", "status", "method", "request", "responsesum", "hostheader",
1606   "httpheaderlist", "secret", "radiuslist", "radius", "apache_stat_list",
1607   "apache_stat", "exist", "pid", "ppid", "uptime", "responsetime",
1608   "icmpcount", "icmpsize", "icmptimeout", "icmpoutgoing", "stoptimeout",
1609   "starttimeout", "restarttimeout", "programtimeout", "nettimeout",
1610   "connectiontimeout", "retry", "actionrate", "urloption", "urloperator",
1611   "alert", "alertmail", "noalertmail", "eventoptionlist", "eventoption",
1612   "formatlist", "formatoptionlist", "formatoption", "every", "mode",
1613   "onreboot", "group", "depend", "dependlist", "dependant", "statusvalue",
1614   "resourceprocess", "resourceprocesslist", "resourceprocessopt",
1615   "resourcesystem", "resourcesystemlist", "resourcesystemopt",
1616   "resourcecpuproc", "resourcecpu", "resourcecpuid", "resourcemem",
1617   "resourcememproc", "resourceswap", "resourcethreads", "resourcechild",
1618   "resourceload", "resourceloadavg", "coremultiplier", "resourceread",
1619   "resourcewrite", "value", "timestamptype", "timestamp", "operator",
1620   "time", "totaltime", "currenttime", "repeat", "action", "action1",
1621   "action2", "rateXcycles", "rateXYcycles", "rate1", "rate2",
1622   "recovery_success", "recovery_failure", "checksum", "hashtype", "inode",
1623   "space", "read", "write", "servicetime", "fsflag", "unit", "permission",
1624   "programmatch", "match", "matchflagnot", "size", "uid", "euid",
1625   "secattr", "filedescriptorssystem", "filedescriptorsprocess",
1626   "filedescriptorsprocesstotal", "gid", "linkstatus", "linkspeed",
1627   "linksaturation", "upload", "download", "icmptype", "reminder", YY_NULLPTR
1628 };
1629 #endif
1630 
1631 # ifdef YYPRINT
1632 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
1633    (internal) symbol number NUM (which must be that of a token).  */
1634 static const yytype_int16 yytoknum[] =
1635 {
1636        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1637      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1638      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1639      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1640      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1641      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1642      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1643      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1644      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1645      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1646      355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
1647      365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
1648      375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
1649      385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
1650      395,   396,   397,   398,   399,   400,   401,   402,   403,   404,
1651      405,   406,   407,   408,   409,   410,   411,   412,   413,   414,
1652      415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
1653      425,   426,   427,   428,   429,   430,   431,   432,   433,   434,
1654      435,   436,   437,   438,   439,   440,   441,   442,   443,   444,
1655      445,   446,   447,   448,   449,   450,   451,   452,   453,   454,
1656      455,   456,   457,   458,   459,   460,   461,   462,   463,   464,
1657      465,   466,   467,   468,   469,   470,   471,   472,   473,   474,
1658      475,   476,   477,   478,   479,   480,   481,   482,   483,   484,
1659      485,   486,   487,   488,   489,   490,   491,   492,   493,   494,
1660      495,   496,   497,   498,   499,   500,   501,   502,   503,   504,
1661      505,   506,   507,   508,   509,   510,   511,   512,   513,   514,
1662      515,   516,   517,   518,   519,   520,   521,   522,   523,   524,
1663      525,   526,   527,   528,   529,   530,   531,   532,   533,   534,
1664      535,   536,   537,   538,   539,   540,   541,   542,   543,   544,
1665      545,   546,   547,   548,   549,   550,   551,   552,   553,   554,
1666      555,   556,   123,   125,    58,    64,    91,    93
1667 };
1668 # endif
1669 
1670 #define YYPACT_NINF (-1344)
1671 
1672 #define yypact_value_is_default(Yyn) \
1673   ((Yyn) == YYPACT_NINF)
1674 
1675 #define YYTABLE_NINF (-750)
1676 
1677 #define yytable_value_is_error(Yyn) \
1678   0
1679 
1680   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1681      STATE-NUM.  */
1682 static const yytype_int16 yypact[] =
1683 {
1684      803,    42,  -101,   -35,   -16,    84,   107,   115,   139,   147,
1685      166,   141,   803, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1686    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1687    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1688    -1344,    55,   175,   204, -1344, -1344,   346,  -140,   239,   247,
1689       91,   276,   297,   290,   146,   150,   461,   190, -1344,   -43,
1690       48,   422,   432,   445,   468, -1344,   452,   462,    92, -1344,
1691    -1344,  1051,   603,  1483,  1644,  1680,  1685,  1711,  1644,  1724,
1692      533, -1344,   472,   482,    20, -1344,  1209, -1344, -1344, -1344,
1693    -1344, -1344,   745, -1344, -1344,   858, -1344, -1344, -1344,   431,
1694      425, -1344,   190,   300,   284,   310,  1443,   559,   483,   487,
1695      549,   566,   502,   519,   499,   531,   584,   537,   553,   775,
1696      584,   584,   578,   584,   -71,   450,   218,   291,   594,   567,
1697    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1698    -1344, -1344, -1344,    62, -1344, -1344, -1344, -1344, -1344, -1344,
1699    -1344, -1344, -1344, -1344, -1344, -1344, -1344,   100,  -142, -1344,
1700    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1701    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,   196, -1344,
1702    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1703    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1704      123, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1705    -1344, -1344, -1344, -1344, -1344, -1344, -1344,    17, -1344, -1344,
1706    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1707    -1344, -1344,   161, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1708    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,  1026,
1709    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1710    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1711    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1712      -56, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1713    -1344, -1344, -1344, -1344,   622,   741, -1344,   621,   673,   626,
1714    -1344,   697,    10,   641,   644,   693,   696,   511,   671, -1344,
1715      670,   689,   777, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1716    -1344, -1344, -1344, -1344, -1344,   125,   118, -1344, -1344, -1344,
1717    -1344, -1344,   550,   561, -1344, -1344,    54, -1344,   665, -1344,
1718      860,   300,   605, -1344,   858,  1443, -1344, -1344, -1344, -1344,
1719    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1720    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1721    -1344, -1344, -1344, -1344, -1344, -1344,  1088, -1344,   752, -1344,
1722    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1723    -1344, -1344,   443, -1344, -1344, -1344,   136,   610,   811,   814,
1724      814,   814,   814,   666,   814,   814, -1344, -1344, -1344,   814,
1725      814,   571,   654,   814,   782,    11,   814,  1758, -1344, -1344,
1726    -1344, -1344, -1344, -1344,   735, -1344, -1344,   490,   509, -1344,
1727      572,   875, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1728    -1344, -1344,   567, -1344,   642,  1443,   559,    41, -1344, -1344,
1729    -1344, -1344,    78,   814,   654,   624,   814,   699, -1344,   624,
1730      724,   424,   814,   814,   814,  -155,   790,   893,   438,   203,
1731      282,   914,   831,   814,   814,   814,   886,   943,   814,   814,
1732    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1733      814,  1641, -1344, -1344,   814, -1344, -1344, -1344,   814,   812,
1734      624, -1344,   845, -1344,   912,   265,   884, -1344, -1344, -1344,
1735    -1344, -1344, -1344,   888, -1344, -1344, -1344, -1344, -1344, -1344,
1736    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,   794,   895,
1737    -1344,   892,   899,   907,   755,   924,   926, -1344, -1344, -1344,
1738    -1344, -1344, -1344, -1344, -1344, -1344, -1344,   757,   815,   816,
1739      817,   824,   834,   835,   839,   848,   849, -1344, -1344,   850,
1740      851,   852,   854,   855,   856,   866,   867,   874, -1344, -1344,
1741    -1344, -1344, -1344, -1344,   970,   975, -1344, -1344, -1344, -1344,
1742    -1344, -1344, -1344,   315,  1160,  1032, -1344,  1066,   981,    87,
1743       89,   186, -1344, -1344, -1344,   992,  1024,   377,   480,   581,
1744      880,   846,  1092, -1344,   814,  1031, -1344, -1344, -1344, -1344,
1745    -1344, -1344, -1344,  1033,  1034,    -5,    -5,   814,   814,    -5,
1746       -5,    -5,    -5,   782,   782,   782,  1036,    -3, -1344, -1344,
1747     1180,   902,  1092, -1344,    23, -1344,  1190, -1344,   814,  1048,
1748      286, -1344,  1049,   339, -1344,  1050,   407, -1344, -1344, -1344,
1749     1443,  1236, -1344, -1344, -1344,  1052,  1101,   782,   782,   782,
1750     1105,  1063, -1344, -1344,   836,  1068,   869,   873,   878,   287,
1751      331,   366,   782,   814,   400,   814,    -5, -1344, -1344, -1344,
1752     1133, -1344, -1344, -1344,  1133,   782,   782,   782,  1070,  1071,
1753     1072,   814,   814,   782,    -5,    -5,   449, -1344,  1216,    -5,
1754     1074,   782,  1097, -1344,   673,    13, -1344, -1344, -1344, -1344,
1755    -1344, -1344,  1098,  1107,  1108,  1112,  1113,  1233,   142,   535,
1756     1119,  1121,  1128,  1130,  1132,  1006,  1000,  1134,  1135, -1344,
1757     1122,  1125,  1129,  1131,  1138,  1139,  1140,  1151,  1152, -1344,
1758     1045, -1344,  1032,   559, -1344,  1073, -1344, -1344, -1344, -1344,
1759    -1344, -1344, -1344, -1344,   782,   782,   782,   782,   782,   782,
1760    -1344,   897,  1153, -1344,   143,  1158,  1249, -1344, -1344, -1344,
1761    -1344,   745,   745,   474,   496,   446,   465,  1162,  1166,  1312,
1762     1313,  1314,   708, -1344,  1261,   157, -1344, -1344,   143,    46,
1763     1173,   157,    -5,  1096, -1344,  1102, -1344,  1106, -1344,  1350,
1764     1032,   782,    28,  1318,  1324,  1327,   782,   745,   782,   782,
1765      708,   782,   782, -1344, -1344, -1344, -1344,  1156,   745,  1159,
1766      745,  1110,  1111,  1333,   498,    46,  1192,    -5,   552,    31,
1767       31,    31,  1076, -1344,    31,    31,    31, -1344,  1339,  1343,
1768     1344,  1203,    -1,    14,  1206,  1207,  1351,   615,   727,    46,
1769     1208,   157,  1210,   782,  1359,   782,  1065,  1065, -1344,  1227,
1770     1113,  1113,  1113,  1233, -1344,  1113, -1344, -1344, -1344, -1344,
1771      597,   614,  1224, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1772    -1344, -1344, -1344, -1344, -1344,  1760,   745,   745,   745,   745,
1773      819,   821,   825,   827,   837, -1344,   559, -1344, -1344,  1362,
1774     1368,  1369,  1370,  1371,  1373,    44,   782,   782, -1344,   751,
1775     1241,  1243,   368,  1857,  1235,  1238,   814, -1344, -1344, -1344,
1776    -1344, -1344, -1344, -1344,  1379,   782,  1382,  1157,  1157,  1213,
1777      745,  1228,   745, -1344, -1344, -1344, -1344, -1344, -1344,   157,
1778      157,   157, -1344, -1344, -1344, -1344, -1344,   782, -1344, -1344,
1779    -1344, -1344, -1344,   584, -1344, -1344,  1385,    44,   751,  1404,
1780     1405,   782,  1385, -1344, -1344, -1344, -1344,  1032,   559,  1407,
1781     1251,  1408,   157,   157,   157,  1409,   782,  1410,  1411,   782,
1782     1415,  1416,   782,  1157,   782,  1157,   782,   782,   157,    46,
1783     1275,  1421,   782,   739,   782,   782,  1288,  1280,  1281,  1283,
1784    -1344, -1344, -1344, -1344, -1344,  1431,  1432,  1433, -1344,    31,
1785     1439,  1441,  1442,    31,   157,   157,   157,   782,  1157,  1157,
1786     1157,  1157,    22,    80,   157, -1344, -1344, -1344, -1344,  1444,
1787      782,  1385, -1344,  1445,   157,  1446,  1315,  1317, -1344,  1113,
1788     1113,  1113, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1789    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1790    -1344, -1344, -1344, -1344, -1344,   157,   157,   157,   157,   157,
1791      157,    74,   624, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1792     1447,  1453,  1454,  1321, -1344, -1344, -1344, -1344, -1344, -1344,
1793    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,  1457,
1794    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,   922, -1344,
1795    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1796    -1344, -1344,   347, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1797    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1798    -1344, -1344, -1344,  1242, -1344,  1326,   157,  1467,   388, -1344,
1799    -1344, -1344, -1344,  1157, -1344,  1157, -1344, -1344,  1385,  1470,
1800      326,    34, -1344,  1471,  1474,   157,   157,  1475, -1344,   559,
1801    -1344,   157,   782,   157,  1385, -1344, -1344,   157,  1478,   157,
1802      157,  1479,   157,   157,  1490,   782,  1491,   782,  1492,  1495,
1803    -1344,  1497,   782,   157,  1498,   782,   782,  1499,  1500, -1344,
1804    -1344,  1276, -1344,   157,   157,   157,  1507,   157,   157,   157,
1805     1509,  1385,  1511,  1385,  1515,   782,   782,   782,   782,   -86,
1806      356,   539,   583,  1385,   157,  1516, -1344,   157, -1344,   157,
1807    -1344, -1344,  1385,  1385,  1385,  1385,  1385,  1385,  1226,  1384,
1808      157,   157,   157, -1344,   157,  1620,   258,   258,  1387,   814,
1809      814,   814,   814,   814,   814,   814,   814,   814,   814, -1344,
1810    -1344,   922, -1344,   822,   822,    -2,    -2,  1389,  1390,  1383,
1811     1395,   347, -1344,   822,   647,    29,  1322, -1344,   862,  1385,
1812      157, -1344, -1344, -1344, -1344, -1344,   157,  1437,    75, -1344,
1813      518, -1344, -1344,   157,   157,  1511,  1385,   157, -1344,  1385,
1814     1525,  1385, -1344, -1344,   157, -1344, -1344,   157, -1344, -1344,
1815      157,  1535,   157,  1537,   157,   157,   157,  1538,  1385,   157,
1816     1539,  1540,   157,   157, -1344,  1385,  1385,  1385,   157,  1511,
1817     1511,  1511,   157, -1344,    45, -1344, -1344,   157,  1541,  1542,
1818     1545,  1546,   648, -1344, -1344, -1344,   782,   648,   782,   648,
1819      782,   648,   782, -1344,  1385,   157,  1385, -1344, -1344, -1344,
1820    -1344, -1344, -1344, -1344, -1344,  1412, -1344,  1385,  1385,  1385,
1821     1385, -1344, -1344, -1344,  1413,   921,   814,   977,  1417, -1344,
1822    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,  1414,
1823     1418,  1420,  1422,  1424,  1428,  1429,  1430,  1449,  1450, -1344,
1824    -1344, -1344, -1344,  1459, -1344, -1344, -1344, -1344, -1344, -1344,
1825    -1344, -1344, -1344, -1344, -1344,  1425, -1344, -1344, -1344, -1344,
1826      427,  1455, -1344, -1344, -1344,  1426, -1344, -1344, -1344, -1344,
1827    -1344,  1385,  1385,    68, -1344,   782,   782,   782,  1511,  1511,
1828    -1344, -1344,  1385, -1344,   157, -1344,  1385,  1385,  1385,   157,
1829     1385,   157,  1385,  1385,  1385,   157, -1344,  1385,   157,   157,
1830     1385,  1385, -1344, -1344, -1344,  1385, -1344, -1344, -1344,  1511,
1831     1549, -1344,  1385,   157,   157,   157,   157,   782,  1556,   782,
1832     1558,   782,  1574,   782,  1576, -1344,  1385, -1344,  1372, -1344,
1833    -1344, -1344, -1344, -1344, -1344, -1344,  1456, -1344, -1344, -1344,
1834       69,  1460,  1461,  1462,  1468,  1472,  1480,  1485,  1486,  1488,
1835     1503,    16, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1836     1557, -1344, -1344,  1600,  1614,  1622, -1344, -1344, -1344,  1385,
1837    -1344, -1344, -1344,  1385, -1344,  1385, -1344, -1344, -1344,  1385,
1838    -1344,  1385,  1385, -1344, -1344, -1344, -1344,   782, -1344,  1385,
1839     1385,  1385,  1385,  1623,   157,  1643,   157,  1650,   157,  1652,
1840      157, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
1841    -1344, -1344, -1344, -1344, -1344, -1344,  1065,  1065,  1519, -1344,
1842      157,   157,   157, -1344, -1344, -1344, -1344, -1344, -1344,  1654,
1843    -1344, -1344, -1344, -1344,   157,  1385,   157,  1385,   157,  1385,
1844      157,  1385,  1522,  1524, -1344, -1344, -1344, -1344,   157,  1385,
1845    -1344,  1385, -1344,  1385, -1344,  1385, -1344, -1344, -1344, -1344,
1846    -1344, -1344, -1344, -1344
1847 };
1848 
1849   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1850      Performed when YYTABLE does not specify something else to do.  Zero
1851      means the default is an error.  */
1852 static const yytype_int16 yydefact[] =
1853 {
1854        2,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1855        0,     0,     3,     4,     6,     8,     9,    20,    22,    19,
1856       21,    23,    10,    11,    17,    18,    16,    12,     7,    13,
1857       14,    15,    33,    59,    79,   101,   118,   133,   150,   165,
1858      182,     0,     0,     0,   304,   203,     0,     0,     0,     0,
1859        0,     0,     0,     0,     0,     0,     0,     0,   225,   632,
1860        0,     0,     0,     0,     0,   365,     0,     0,     0,     1,
1861        5,    24,    25,    26,    27,    28,    32,    29,    30,    31,
1862      227,   226,   201,   295,   585,   291,   303,   200,   251,   232,
1863      233,   209,   784,   234,   598,     0,   204,   205,   206,     0,
1864        0,   239,   235,   246,     0,     0,     0,   835,     0,     0,
1865        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1866        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1867       34,    35,    36,    37,    48,    49,    50,    38,    39,    40,
1868       47,    51,    52,   632,   597,    53,    54,    55,    56,    57,
1869       58,    41,    42,    43,    44,    45,    46,   800,   800,    60,
1870       61,    62,    63,    64,    66,    68,    67,    75,    76,    77,
1871       78,    65,    72,    69,    74,    73,    70,    71,     0,    80,
1872       81,    82,    83,    84,    85,    87,    86,    91,    92,    93,
1873       94,    95,    96,    97,    98,    99,   100,    88,    89,    90,
1874        0,   102,   103,   104,   105,   106,   108,   110,   109,   114,
1875      115,   116,   117,   107,   111,   112,   113,     0,   119,   120,
1876      121,   122,   123,   124,   125,   126,   127,   128,   129,   130,
1877      131,   132,     0,   134,   135,   136,   137,   143,   147,   144,
1878      145,   146,   148,   149,   138,   139,   140,   141,   142,     0,
1879      151,   152,   153,   154,   163,   155,   156,   157,   158,   159,
1880      160,   161,   162,   164,   166,   167,   168,   169,   170,   172,
1881      174,   173,   178,   179,   180,   181,   171,   175,   176,   177,
1882        0,   183,   184,   185,   186,   187,   188,   189,   190,   191,
1883      192,   193,   194,   195,     0,     0,   199,     0,   293,     0,
1884      292,   389,     0,     0,     0,     0,     0,   249,     0,   317,
1885        0,     0,     0,   306,   305,   307,   308,   309,   313,   314,
1886      331,   332,   310,   311,   312,     0,     0,   785,   786,   787,
1887      788,   207,     0,     0,   638,   639,     0,   634,   229,   231,
1888      238,   246,     0,   236,     0,     0,   616,   603,   604,   618,
1889      619,   626,   624,   606,   628,   605,   627,   623,   630,   612,
1890      614,   629,   620,   625,   602,   631,   609,   613,   617,   610,
1891      615,   608,   607,   621,   622,   611,     0,   600,     0,   196,
1892      354,   355,   356,   357,   360,   359,   358,   361,   362,   366,
1893      379,   380,   583,   375,   363,   364,   441,     0,     0,   716,
1894      716,   716,   716,     0,   716,   716,   697,   698,   699,   716,
1895      716,     0,     0,   716,   749,   441,   716,   749,   657,   659,
1896      660,   661,   662,   663,   700,   664,   665,   579,   577,   599,
1897      581,     0,   641,   642,   643,   644,   645,   646,   647,   648,
1898      649,   653,   650,   651,     0,     0,   835,   766,   710,   711,
1899      712,   713,   766,   716,   801,     0,   716,     0,   801,     0,
1900        0,     0,   716,   716,   716,     0,   716,   716,     0,   441,
1901      441,     0,     0,   716,   716,   716,     0,     0,   716,   716,
1902      685,   676,   677,   678,   679,   680,   681,   682,   683,   684,
1903      716,   749,   667,   672,   716,   670,   671,   669,   716,     0,
1904        0,   228,     0,   295,     0,     0,     0,   275,   277,   279,
1905      281,   283,   285,     0,   287,   276,   278,   280,   282,   284,
1906      286,   299,   300,   301,   302,   296,   297,   298,     0,     0,
1907      289,     0,     0,     0,   348,   336,     0,   333,   315,   328,
1908      330,   251,   316,   318,   320,   327,   329,     0,     0,     0,
1909        0,     0,     0,     0,     0,     0,     0,   248,   252,     0,
1910        0,     0,     0,     0,     0,     0,     0,     0,   208,   210,
1911      636,   637,   290,   635,     0,     0,   240,   242,   243,   244,
1912      245,   237,   247,     0,     0,   632,   601,   836,     0,     0,
1913        0,   583,   376,   377,   367,     0,     0,     0,     0,     0,
1914        0,     0,     0,   419,   716,     0,   723,   717,   718,   719,
1915      720,   721,   722,     0,     0,     0,     0,   716,   716,     0,
1916        0,     0,     0,   749,   749,   749,     0,     0,   750,   751,
1917        0,     0,     0,   419,     0,   658,     0,   701,   716,     0,
1918      579,   369,     0,   577,   371,     0,   581,   373,   640,   652,
1919        0,     0,   594,   767,   768,     0,     0,   749,   749,   749,
1920        0,     0,   592,   593,     0,     0,     0,     0,     0,     0,
1921        0,     0,   749,   716,     0,   716,     0,   435,   435,   435,
1922        0,   435,   435,   435,     0,   749,   749,   749,     0,     0,
1923        0,   716,   716,   749,     0,     0,     0,   668,     0,     0,
1924        0,   749,     0,   202,   294,   271,   386,   385,   387,   288,
1925      586,   390,   337,   338,   339,     0,     0,   352,     0,   319,
1926        0,     0,     0,     0,     0,     0,     0,     0,     0,   273,
1927        0,     0,     0,     0,     0,     0,     0,     0,     0,   230,
1928        0,   633,   632,   835,   837,     0,   381,   383,   382,   384,
1929      378,   368,   442,   444,   749,   749,   749,   749,   749,   749,
1930      409,     0,     0,   393,   749,     0,     0,   694,   695,   709,
1931      708,   784,   784,     0,     0,   784,   784,     0,     0,     0,
1932        0,     0,   724,   747,     0,     0,   409,   393,   749,   709,
1933        0,     0,     0,     0,   370,     0,   372,     0,   374,     0,
1934      632,   749,   749,     0,     0,     0,   749,   784,   749,   749,
1935      724,   749,   749,   795,   794,   799,   798,   709,   784,   709,
1936      784,   709,     0,     0,     0,   709,     0,     0,   784,   749,
1937      749,   749,     0,   435,   749,   749,   749,   435,     0,     0,
1938        0,     0,   784,   784,     0,     0,     0,   784,   784,   709,
1939        0,     0,     0,   749,     0,   749,   271,   271,   272,     0,
1940        0,     0,     0,   352,   351,   341,   349,   353,   335,   250,
1941        0,     0,     0,   321,   259,   261,   260,   258,   262,   255,
1942      256,   253,   254,   263,   264,   257,   784,   784,   784,   784,
1943        0,     0,     0,     0,     0,   241,   835,   197,   584,     0,
1944        0,     0,     0,     0,     0,   749,   749,   749,   443,   749,
1945        0,     0,     0,     0,     0,     0,   716,   420,   421,   422,
1946      423,   425,   424,   426,     0,   749,     0,   733,   733,   709,
1947      784,   709,   784,   689,   688,   691,   690,   673,   674,     0,
1948        0,     0,   725,   726,   727,   728,   729,   749,   748,   742,
1949      743,   738,   741,     0,   744,   745,   755,   749,   749,     0,
1950        0,   749,   755,   696,   580,   578,   582,   632,   835,     0,
1951        0,     0,     0,     0,     0,     0,   749,     0,     0,   749,
1952        0,     0,   749,   733,   749,   733,   749,   749,     0,   709,
1953        0,     0,   749,   784,   749,   749,     0,     0,     0,     0,
1954      436,   437,   438,   439,   440,     0,     0,     0,   834,   749,
1955        0,     0,     0,   749,     0,     0,     0,   749,   733,   733,
1956      733,   733,   784,   784,     0,   687,   686,   693,   692,     0,
1957      749,   755,   675,     0,     0,     0,     0,     0,   268,   343,
1958      345,   347,   334,   350,   322,   324,   323,   325,   326,   274,
1959      211,   212,   213,   214,   215,   216,   217,   218,   221,   222,
1960      219,   220,   223,   224,   198,     0,     0,     0,     0,     0,
1961        0,     0,     0,   414,   416,   415,   410,   412,   413,   411,
1962        0,     0,     0,     0,   445,   446,   404,   406,   405,   394,
1963      395,   396,   402,   397,   398,   401,   400,   403,   399,     0,
1964      493,   494,   449,   447,   450,   457,   528,   528,     0,   461,
1965      501,   501,   478,   479,   465,   466,   456,   475,   476,   509,
1966      509,   458,     0,   505,   490,   459,   467,   468,   482,   484,
1967      491,   516,   480,   524,   469,   462,   548,   470,   483,   471,
1968      485,   489,   460,     0,   588,     0,     0,     0,     0,   734,
1969      702,   705,   704,   733,   707,   733,   568,   569,   755,     0,
1970      735,     0,   567,     0,     0,     0,     0,     0,   656,   835,
1971      595,     0,   749,     0,   755,   803,   715,     0,     0,     0,
1972        0,     0,     0,     0,     0,   749,     0,   749,     0,     0,
1973      783,     0,   749,     0,     0,   749,   749,     0,     0,   576,
1974      573,     0,   574,     0,     0,     0,     0,     0,     0,     0,
1975        0,   755,   760,   755,     0,   749,   749,   749,   749,     0,
1976        0,     0,     0,   755,     0,     0,   666,     0,   655,     0,
1977      269,   270,   755,   755,   755,   755,   755,   755,   266,     0,
1978        0,     0,     0,   454,     0,   448,   463,   464,     0,   716,
1979      716,   716,   716,   716,   716,   716,   716,   716,   716,   553,
1980      554,   455,   551,   487,   488,   473,   474,     0,     0,     0,
1981        0,   492,   495,   472,   477,   486,   481,   587,     0,   755,
1982        0,   590,   589,   703,   706,   566,     0,     0,   735,   739,
1983        0,   746,   756,     0,     0,   760,   755,     0,   596,   755,
1984        0,   755,   790,   765,     0,   793,   792,     0,   797,   796,
1985        0,     0,     0,     0,     0,     0,     0,     0,   755,     0,
1986        0,     0,     0,     0,   575,   755,   755,   755,     0,   760,
1987      760,   760,     0,   817,     0,   819,   818,     0,     0,     0,
1988        0,     0,     0,   730,   731,   732,   749,     0,   749,     0,
1989      749,     0,   749,   820,   755,     0,   755,   791,   804,   805,
1990      806,   807,   815,   816,   267,     0,   591,   755,   755,   755,
1991      755,   452,   453,   451,     0,     0,   716,     0,     0,   545,
1992      530,   531,   529,   534,   535,   532,   533,   536,   555,     0,
1993        0,     0,     0,     0,     0,     0,     0,     0,     0,   552,
1994      503,   504,   502,     0,   511,   512,   510,   499,   497,   500,
1995      498,   496,   507,   508,   506,     0,   518,   519,   520,   517,
1996        0,     0,   526,   527,   525,     0,   550,   549,   571,   572,
1997      417,   755,   755,     0,   740,   752,   752,   752,   760,   760,
1998      418,   812,   755,   789,     0,   763,   755,   755,   755,     0,
1999      755,     0,   755,   755,   755,     0,   769,   755,     0,     0,
2000      755,   755,   428,   429,   430,   755,   432,   433,   434,   760,
2001        0,   761,   755,     0,     0,     0,     0,   749,     0,   749,
2002        0,   749,     0,   749,     0,   810,   755,   654,     0,   407,
2003      808,   809,   391,   543,   539,   540,     0,   542,   541,   544,
2004        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
2005        0,   271,   388,   522,   521,   523,   547,   814,   570,   736,
2006        0,   753,   754,     0,     0,     0,   408,   392,   813,   755,
2007      802,   714,   778,   755,   780,   755,   781,   782,   771,   755,
2008      770,   755,   755,   774,   773,   427,   431,   752,   821,   755,
2009      755,   755,   755,     0,     0,     0,     0,     0,     0,     0,
2010        0,   811,   265,   538,   546,   537,   556,   557,   558,   559,
2011      560,   561,   562,   563,   564,   565,   271,   271,     0,   737,
2012        0,     0,     0,   764,   777,   779,   772,   776,   775,     0,
2013      825,   822,   831,   828,     0,   755,     0,   755,     0,   755,
2014        0,   755,     0,     0,   513,   757,   758,   759,     0,   755,
2015      826,   755,   823,   755,   832,   755,   829,   514,   515,   762,
2016      827,   824,   833,   830
2017 };
2018 
2019   /* YYPGOTO[NTERM-NUM].  */
2020 static const yytype_int16 yypgoto[] =
2021 {
2022    -1344, -1344, -1344,  1653, -1344, -1344, -1344, -1344, -1344, -1344,
2023    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2024    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2025    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2026     1564, -1344, -1344,  1329, -1344,   -83,  1126, -1344,  -822, -1344,
2027     -318,  -828, -1344,  -339,  -338, -1344, -1344, -1344,  1585,  1168,
2028    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2029    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2030      145,  -795,   809, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2031    -1344, -1344,  1219,  1328,  1392,  -104,  -403,  -384,  -558,  -746,
2032     -423, -1344, -1344,  1603,   894, -1344,  1605,   896, -1344, -1344,
2033     1053, -1344, -1344,  -147, -1344,  -326,  1055,  1269, -1344,  -792,
2034    -1344, -1344, -1344,  -753,  -695, -1344,   414,   579, -1344, -1344,
2035    -1344,   569, -1344, -1344, -1344, -1344, -1344, -1344, -1344,   586,
2036    -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2037    -1344,   430,   747, -1344, -1344,  1618,  -588, -1344, -1344, -1344,
2038    -1344,  1054,  1056,  1057,  1116, -1344,  -307,  -172,  1512,  -531,
2039     -447,  1567,  1697, -1344,  -332,  -350,  -139,  1358,  -306,  1673,
2040     1690,  1718,  1808,  1875, -1344,  1262, -1344, -1344, -1344,  1292,
2041    -1344, -1344,  1220, -1344, -1344, -1344, -1344, -1344, -1344, -1344,
2042    -1344,  -208, -1344, -1344, -1344, -1344,   980,  -356,   308,  -395,
2043      900,  -667,  -508,   433, -1141,  -572, -1294,  -856,  -820,  -417,
2044    -1343,  -285,  -932, -1344,  1260, -1344, -1344, -1344, -1344, -1344,
2045    -1344,   706,   685, -1344, -1344,  1572, -1344,   758, -1344, -1344,
2046    -1344, -1344, -1344,   820, -1344, -1344, -1344, -1344, -1344,  1038,
2047     -435
2048 };
2049 
2050   /* YYDEFGOTO[NTERM-NUM].  */
2051 static const yytype_int16 yydefgoto[] =
2052 {
2053       -1,    11,    12,    13,    71,   130,    72,   159,    73,   179,
2054       74,   201,    75,   218,    76,   233,    77,   250,    78,   264,
2055       79,   281,    14,    15,    16,   296,    17,    18,    19,    20,
2056      326,   569,    21,    22,    23,    24,    25,    26,    27,   102,
2057      103,   340,   576,   343,    28,   521,   325,   558,  1074,  1365,
2058      522,   859,   885,   523,   524,    29,    30,    84,    85,   298,
2059      525,    31,    86,   314,   315,   316,   317,   318,   319,   719,
2060      873,   320,   321,   322,   323,   324,   716,   860,   861,   862,
2061      865,   866,   868,    32,    33,    34,    35,    36,    37,    38,
2062       39,    40,   131,   132,   133,   392,   591,   393,   593,   526,
2063      527,  1418,   530,   134,   909,  1089,   135,   905,  1076,   136,
2064      764,   917,   224,   829,  1000,   602,   763,   603,  1090,   918,
2065     1245,  1373,  1092,   919,   920,  1271,  1272,  1263,  1402,  1273,
2066     1414,  1265,  1406,  1274,  1419,  1422,  1423,  1275,  1424,  1246,
2067     1382,  1383,  1384,  1385,  1386,  1387,  1500,  1426,  1276,  1427,
2068     1261,  1262,   137,   138,   139,   140,   921,  1001,  1002,  1003,
2069     1004,   644,   641,   647,   594,   301,   922,   923,   141,  1079,
2070      664,   142,   143,   144,   376,   377,   107,   336,   337,   145,
2071      146,   147,   148,   149,   442,   443,   292,   150,   417,   418,
2072      262,   491,   492,   419,   493,   494,   495,   420,   496,   421,
2073      422,   423,   424,   638,   425,   426,   771,   456,   171,   613,
2074      947,  1346,  1150,  1289,   955,   956,  1292,   628,   629,   630,
2075     1523,  1162,  1335,   172,   656,   191,   192,   193,   194,   195,
2076      196,   331,   173,   293,   174,   457,   175,   151,   152,   153,
2077      263,   154,   155,   156,   244,   245,   246,   247,   248,   833,
2078      379
2079 };
2080 
2081   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
2082      positive, shift that token.  If negative, reduce the rule whose
2083      number is the opposite.  If YYTABLE_NINF, syntax error.  */
2084 static const yytype_int16 yytable[] =
2085 {
2086      636,   579,   580,   313,   446,   614,   615,   616,   592,   619,
2087      620,   652,   667,   584,   621,   622,   427,   428,   626,   430,
2088     1291,   634,   578,   469,   640,   643,   586,   646,  1036,  1037,
2089      573,   531,   532,   750,   533,   856,   857,  1290,  1576,  1577,
2090     1471,   497,  1018,   592,   592,    60,   592,   996,  1470,   104,
2091       41,  -749,    42,   702,    43,    44,   783,  1020,   661,    45,
2092       46,   665,  1342,   653,   654,  1219,    80,   669,   670,   671,
2093     1043,   674,   676,    47,   698,   307,  1403,   431,   688,   689,
2094      690,  1071,   750,   694,   695,   750,   970,  1087,   750,   632,
2095      595,   997,   398,  1524,  1525,   696,   659,    48,    49,   699,
2096      653,   654,   657,   700,   596,    50,   447,    51,   117,   949,
2097      950,    61,   659,   651,  1238,   299,    52,  1091,   458,   498,
2098      949,   950,   108,  1221,   951,   109,   998,  1519,   672,   461,
2099       62,   952,    53,   118,    54,   951,  1087,  1287,   459,   914,
2100      915,    69,   952,   769,   632,   784,  1343,  1344,  1345,   534,
2101      535,   547,   548,   549,   104,   770,  1093,   550,   551,    83,
2102      552,   553,    88,   554,   555,   398,  1091,   471,   547,   548,
2103      549,   789,   705,   499,   550,   551,   627,   552,   553,   627,
2104      554,   555,   559,   770,   560,   561,   562,   563,   564,   565,
2105      566,   567,   627,  1291,   627,    81,   332,   333,   334,   335,
2106      910,   911,   461,   472,  1589,  1093,   779,   780,   781,   765,
2107      473,   474,   475,   476,  1094,   595,  1520,   105,   432,   962,
2108      505,   506,   773,   774,   500,    96,   746,   912,   748,   596,
2109       63,   913,   949,   950,   586,   747,    55,   749,   914,   915,
2110      803,   804,   805,   792,  1043,  1043,  1043,   951,   398,   327,
2111      328,   329,   330,    64,   952,   823,    56,   577,   597,   106,
2112      599,    65,    57,  1094,   327,   328,   329,   330,   838,   839,
2113      840,   398,   327,   328,   329,   330,   846,   573,   824,  1031,
2114      827,   588,   595,   497,   854,    66,  1605,  1606,  1607,   999,
2115      631,   627,   589,    67,   590,   470,   844,   845,   655,   953,
2116      954,   586,   556,   448,   449,   450,   451,   110,   897,   398,
2117      953,   954,    68,   858,  1619,   536,   858,  1420,   799,   556,
2118     1421,  1095,   444,    82,  1072,   448,   449,   450,   451,   452,
2119      327,   328,   329,   330,    58,   657,   658,   899,   900,   901,
2120      902,   903,   904,    83,   398,    97,    98,   924,   448,   449,
2121      450,   451,   468,   597,   598,   599,  1374,   572,   453,  1564,
2122      454,   595,  1259,  1440,   445,    87,   437,  1156,  1157,  1158,
2123     1095,   959,   960,   414,   462,   463,  1565,   464,  1098,    89,
2124      455,   639,   213,   412,   969,   971,   276,    90,  1287,   975,
2125      477,   977,   978,    91,   980,   981,   414,  1466,  1467,  1468,
2126     1174,  1175,  1176,   589,   706,   590,   707,   916,   991,   434,
2127      435,   436,  1005,  1006,  1007,   600,  1190,  1010,  1011,  1012,
2128     1151,   568,   953,   954,    92,   465,  1267,  1098,   557,   601,
2129     1375,    94,  1029,  1376,   642,   817,  1033,    93,  1035,  1291,
2130     1291,  1291,  1211,  1212,  1213,   869,   743,   770,    95,   586,
2131      466,   467,  1223,  1102,  1103,  1104,   412,   332,   333,   334,
2132      335,  1064,  1228,   949,   950,   390,   391,  1291,  1377,   414,
2133      677,   678,   679,   680,  1378,  1185,   101,  1187,   951,   819,
2134      505,   506,   600,  1281,   114,   952,   438,   439,  1080,  1081,
2135     1082,   770,  1099,  1232,  1233,  1234,  1235,  1236,  1237,   111,
2136     1380,  1380,   645,   589,  1347,   590,  1526,  1527,  1147,   112,
2137     1215,  1216,  1217,  1218,   821,  1259,   754,  1400,  1400,  1404,
2138     1404,  1145,   113,  1268,  1269,   755,   770,  1412,  1416,   115,
2139     1159,   830,   831,  1170,   834,   835,   836,  1546,   588,   116,
2140     1163,  1164,   294,   589,  1167,   590,  1049,   295,   825,   681,
2141      682,   683,   684,  1348,  1350,  1352,   589,  1270,   590,  1178,
2142      770,   631,  1181,   297,  1379,  1184,  1513,  1186,  1514,  1188,
2143     1189,   338,  1191,   339,  1279,  1194,  1282,  1197,  1198,  1521,
2144     1521,  1521,   390,   391,   342,   639,   344,  1075,  1343,  1344,
2145     1345,  1088,  1206,  1295,  1296,   933,  1210,   849,  1077,  1299,
2146     1214,  1301,  1096,   896,   642,  1303,   157,  1305,  1306,   770,
2147     1308,  1309,   345,  1225,   935,  1522,  1522,  1522,   741,   756,
2148      378,  1318,   929,   380,   589,  1239,   590,   381,   757,   390,
2149      391,  1325,  1326,  1327,   770,  1329,  1330,  1331,   388,  1075,
2150     1088,   597,   386,   599,   931,  1283,   989,  1284,   390,   391,
2151     1077,  1096,  1354,   953,   954,  1356,   770,  1357,   770,   387,
2152      589,   968,   590,   448,   449,   450,   451,   645,  1367,  1368,
2153     1369,   389,  1370,    99,   100,  1477,   394,  1168,   120,   121,
2154     1479,   655,  1481,  1578,  1483,  1260,  1009,  1349,   382,   383,
2155     1013,  1521,   395,    53,   122,   657,   327,   328,   329,   330,
2156      123,   994,   124,   125,   307,   384,   385,   589,  1431,   590,
2157      504,   390,   391,   441,  1432,   327,   328,   329,   330,   429,
2158      758,  1438,  1439,   390,   391,  1442,   589,  1522,   590,   759,
2159      750,  1351,  1446,  1078,  1298,  1447,  1044,  1097,  1448,   433,
2160     1450,   440,  1452,  1453,  1454,  1045,  1226,  1457,  1602,  1603,
2161     1460,  1461,   870,  1046,   871,  1300,  1465,  1288,   197,   214,
2162     1469,   501,  1047,   277,  1025,  1472,   502,  1083,  1311,   503,
2163     1313,  1343,  1344,  1345,   528,  1317,   592,   529,  1320,  1321,
2164      537,   396,   307,  1486,   538,  1078,  1097,   539,  1071,   589,
2165      540,   590,   872,   126,  1435,  1436,  1437,   127,  1338,  1339,
2166     1340,  1341,   327,   328,   329,   330,   545,   546,   910,   911,
2167        1,   542,   128,   541,   129,  1343,  1344,  1345,   543,   163,
2168      183,   205,  1073,  1381,  1381,   268,  1086,   397,  1169,   544,
2169      176,   198,   215,  1084,  1085,   912,   278,   570,  1260,   913,
2170     1401,  1401,  1405,  1405,   617,   618,   914,   915,   571,  1160,
2171     1413,  1417,   623,   624,  1389,  1390,  1391,  1392,  1393,  1394,
2172     1395,  1396,  1397,  1398,   158,   327,   328,   329,   330,   505,
2173      506,  1415,  1529,  1285,  1073,  1086,  1027,  1533,   574,  1535,
2174     1343,  1344,  1345,  1539,   686,   687,  1541,  1542,  1195,  1302,
2175      582,   307,   177,   199,   216,   505,   506,   504,   279,   627,
2176      587,  1549,  1550,  1551,  1552,   604,  1371,  1372,   605,   507,
2177      508,   509,   510,   511,   512,   513,   514,   515,   516,   517,
2178      518,   519,   520,   398,   662,   663,  1333,   625,  1336,  1478,
2179      627,  1480,   637,  1482,   648,  1484,   691,   692,  1353,   942,
2180      943,   944,   945,   946,   650,   399,   400,  1358,  1359,  1360,
2181     1361,  1362,  1363,   401,   402,   575,   685,   403,   666,   404,
2182      405,   406,   407,   408,     2,     3,     4,     5,     6,     7,
2183        8,     9,    10,   409,   410,   808,   809,   327,   328,   329,
2184      330,  1496,  1595,   668,  1597,   693,  1599,   701,  1601,   327,
2185      328,   329,   330,   703,  1430,   327,   328,   329,   330,  1248,
2186      332,   333,   334,   335,   411,  1039,  1040,  1041,   811,   812,
2187      705,  1441,   813,   814,  1443,   916,  1445,   815,   816,   606,
2188      879,   880,  1609,   708,  1611,   710,  1613,   709,  1615,   881,
2189      882,  1072,   712,  1456,   711,   412,   906,   907,   413,   713,
2190     1462,  1463,  1464,   606,   505,   506,   673,   714,   414,  1054,
2191     1055,  1056,  1057,   415,   119,  1058,  1059,  1060,  1061,   715,
2192     1553,   720,  1555,  -340,  1557,   717,  1559,  1062,  1063,  1485,
2193      416,  1487,  1249,  1250,  1251,  1252,  1253,  1254,  1255,  1256,
2194     1257,  1258,  1489,  1490,  1491,  1492,   607,   608,   609,   610,
2195      611,   612,  1428,  1429,  1494,  1495,   507,   508,   509,   510,
2196      511,   512,   513,   514,   515,   516,   517,   518,   519,   520,
2197      607,   608,   609,   610,   611,   612,  1497,  1498,   739,   721,
2198      722,   723,   606,   740,   104,   744,   120,   121,   724,   745,
2199      346,   752,   347,   348,   349,   350,   351,   352,   725,   726,
2200      761,    53,   122,   727,   505,   506,  1517,  1518,   123,   675,
2201      124,   125,   728,   729,   730,   731,   732,  1528,   733,   734,
2202      735,  1530,  1531,  1532,   753,  1534,   760,  1536,  1537,  1538,
2203      736,   737,  1540,   762,   398,  1543,  1544,   353,   738,   766,
2204     1545,   767,   768,   354,   782,   785,   355,  1548,   786,   607,
2205      608,   609,   610,   611,   612,   791,   793,   795,   797,   802,
2206      801,  1561,   346,   806,   347,   348,   349,   350,   351,   352,
2207      478,   807,   406,   407,   408,   479,   810,   832,   841,   842,
2208      843,   851,   853,   302,   480,   303,   481,   482,   483,   484,
2209      485,   486,   487,   488,   489,   304,   855,  -342,   305,   306,
2210      307,   126,   308,   309,  1583,   127,  -344,  -346,  1584,   353,
2211     1585,   863,   864,   867,  1586,   354,  1587,  1588,   355,   874,
2212      128,   875,   129,   356,  1590,  1591,  1592,  1593,   876,   877,
2213      886,   357,   878,   887,   883,   884,   895,   888,   346,   889,
2214      347,   348,   349,   350,   351,   352,   890,   891,   892,   413,
2215      310,   160,   180,   202,   219,   234,   251,   265,   282,   893,
2216      894,   908,   311,   312,   898,   358,   925,   359,   926,   360,
2217     1610,   937,  1612,   361,  1614,   938,  1616,   939,   940,   941,
2218      948,   490,   961,   972,  1620,   353,  1621,   964,  1622,   973,
2219     1623,   354,   974,   965,   355,   356,   982,   966,   988,   984,
2220      986,   992,   987,   357,  1014,   362,   363,  1008,  1015,  1016,
2221      364,   365,  1017,   366,  1022,  1023,  1024,  1030,   367,  1032,
2222      368,   369,   370,   371,  1034,   858,  1038,  1065,   372,   373,
2223      374,   375,  1048,  1066,  1067,  1068,  1069,   358,  1070,   359,
2224     1100,   360,  1101,  1143,  1146,   361,  1144,  1148,  1149,  1161,
2225     1172,   585,   346,  1152,   347,   348,   349,   350,   351,   352,
2226      161,   181,   203,   220,   235,   252,   266,   283,  1154,  1165,
2227     1166,   356,  1171,  1173,  1177,  1179,  1180,   362,   363,   357,
2228     1182,  1183,   364,   365,  1192,   366,  1193,  1199,  1200,  1201,
2229      367,  1202,   368,   369,   370,   371,  1203,  1204,  1205,   353,
2230      372,   373,   374,   375,  1207,   354,  1208,  1209,   355,  1224,
2231     1227,  1229,  1240,   358,  1230,   359,  1231,   360,  1241,  1242,
2232     1243,   361,  1244,   742,   162,   182,   204,   221,   236,   253,
2233      267,   284,  1280,  1277,  1278,  1286,  1293,   927,   928,  1294,
2234     1297,   934,   936,  1304,  1307,   346,   178,   347,   348,   349,
2235      350,   351,   352,   362,   363,  1310,  1312,  1314,   364,   365,
2236     1315,   366,  1316,  1319,  1322,  1323,   367,  1324,   368,   369,
2237      370,   371,  1328,   976,  1332,  1334,   372,   373,   374,   375,
2238     1337,  1355,  1364,  1366,   983,   356,   985,  1388,  1407,  1408,
2239     1444,  1409,   353,   357,   995,  1410,  1433,  1425,   354,   800,
2240     1449,   355,  1451,  1455,  1458,  1459,  1473,  1474,  1019,  1021,
2241     1475,  1476,  1493,  1026,  1028,  1547,  1499,  1511,   120,   121,
2242     1488,  1554,  1501,  1556,  1512,  1516,  1502,   358,  1503,   359,
2243     1504,   360,  1505,    53,   122,   361,  1506,  1507,  1508,  1558,
2244      123,  1560,   124,   125,   164,   184,   206,   225,   237,   255,
2245      269,   285,  1050,  1051,  1052,  1053,   772,  1509,  1510,   775,
2246      776,   777,   778,  1515,  1563,  1580,  1562,   362,   363,  1566,
2247     1567,  1568,   364,   365,   790,   366,  1579,  1569,   356,  1581,
2248      367,  1570,   368,   369,   370,   371,   357,  1582,  1594,  1571,
2249      372,   373,   374,   375,  1572,  1573,  1153,  1574,  1155,   165,
2250      185,   207,   226,   238,   256,   270,   286,   200,  1596,   818,
2251      820,   822,  1575,   967,   826,  1598,   828,  1600,  1604,  1608,
2252      358,  1617,   359,  1618,   360,    70,   341,   718,   361,   300,
2253      581,   704,  1042,   126,   847,   848,   850,   127,   222,   852,
2254      223,   958,   957,   217,   633,  1411,   788,   787,   232,  1266,
2255     1264,  1399,   128,  1247,   129,   254,   794,   796,    59,  1196,
2256      362,   363,   583,   798,   649,   364,   365,   751,   366,   635,
2257      979,   697,   660,   367,   249,   368,   369,   370,   371,   120,
2258      121,  1434,   837,   372,   373,   374,   375,   280,  1220,  1222,
2259      460,     0,     0,     0,    53,   122,     0,     0,     0,     0,
2260        0,   123,     0,   124,   125,   166,   186,   208,   227,   239,
2261      257,   271,   287,   930,   932,   120,   121,     0,     0,     0,
2262      120,   121,   167,   187,   209,   228,   240,   258,   272,   288,
2263       53,   122,   963,     0,     0,    53,   122,   123,     0,   124,
2264      125,     0,   123,     0,   124,   125,   120,   121,     0,   627,
2265      168,   188,   210,   229,   241,   259,   273,   289,     0,   120,
2266      121,    53,   122,     0,   990,     0,     0,   993,   123,     0,
2267      124,   125,     0,     0,    53,   122,     0,     0,     0,     0,
2268        0,   123,     0,   124,   125,   478,     0,   406,   407,   408,
2269      479,     0,     0,     0,   126,     0,     0,     0,   127,   480,
2270        0,   481,   482,   483,   484,   485,   486,   487,   488,   489,
2271        0,     0,     0,   128,     0,   129,   507,   508,   509,   510,
2272      511,   512,   513,   514,   515,   516,   517,   518,   519,   520,
2273      126,     0,     0,     0,   127,   126,     0,     0,     0,   127,
2274      169,   189,   211,   230,   242,   260,   274,   290,     0,   128,
2275        0,   129,     0,     0,   128,     0,   129,     0,     0,     0,
2276        0,   126,     0,     0,     0,   127,   627,     0,     0,     0,
2277        0,     0,     0,     0,   126,     0,     0,     0,   127,     0,
2278      128,     0,   129,     0,     0,     0,     0,     0,   399,   400,
2279        0,     0,     0,   128,     0,   129,   401,   402,     0,     0,
2280      403,     0,   404,   405,   406,   407,   408,   170,   190,   212,
2281      231,   243,   261,   275,   291,     0,   409,   410,  1105,  1106,
2282     1107,  1108,  1109,  1110,  1111,  1112,  1113,  1114,  1115,  1116,
2283     1117,  1118,  1119,  1120,  1121,  1122,  1123,  1124,  1125,  1126,
2284     1127,  1128,  1129,  1130,  1131,  1132,  1133,  1134,  1135,  1136,
2285     1137,  1138,  1139,  1140,  1141,  1142,   507,   508,   509,   510,
2286      511,   512,     0,   514,   515,   516,   517,   518,   519,   520
2287 };
2288 
2289 static const yytype_int16 yycheck[] =
2290 {
2291      417,   340,   340,    86,   143,   400,   401,   402,   392,   404,
2292      405,   446,   459,   345,   409,   410,   120,   121,   413,   123,
2293     1161,   416,   340,     6,   427,   428,   376,   430,   856,   857,
2294      336,    21,    22,   591,    24,    22,    23,     3,    22,    23,
2295     1334,   249,    43,   427,   428,   146,   430,    16,     3,    92,
2296        8,     5,    10,   500,    12,    13,    59,    43,   453,    17,
2297       18,   456,   148,    22,    23,    43,    11,   462,   463,   464,
2298      865,   466,   467,    31,   491,    31,    78,   148,   473,   474,
2299      475,    37,   640,   478,   479,   643,    58,   909,   646,   415,
2300       79,    60,   148,  1436,  1437,   490,   452,    55,    56,   494,
2301       22,    23,   257,   498,    93,    63,     6,    65,    16,    75,
2302       76,   146,   468,   445,    40,    95,    74,   909,   260,   175,
2303       75,    76,    74,    43,    90,    77,    95,    59,   283,     6,
2304      146,    97,    90,    41,    92,    90,   958,    62,   280,    95,
2305       96,     0,    97,   148,   470,   148,   232,   233,   234,   139,
2306      140,    26,    27,    28,    92,   160,   909,    32,    33,   139,
2307       35,    36,   302,    38,    39,   148,   958,     6,    26,    27,
2308       28,   148,    98,   229,    32,    33,   148,    35,    36,   148,
2309       38,    39,    64,   160,    66,    67,    68,    69,    70,    71,
2310       72,    73,   148,  1334,   148,   140,   142,   143,   144,   145,
2311       57,    58,     6,    42,  1547,   958,   623,   624,   625,   604,
2312       49,    50,    51,    52,   909,    79,   148,   260,   289,   791,
2313      222,   223,   617,   618,   280,    75,   139,    84,   139,    93,
2314      146,    88,    75,    76,   584,   148,   194,   148,    95,    96,
2315      657,   658,   659,   638,  1039,  1040,  1041,    90,   148,   250,
2316      251,   252,   253,   146,    97,   672,   214,   340,   217,   302,
2317      219,   146,   220,   958,   250,   251,   252,   253,   685,   686,
2318      687,   148,   250,   251,   252,   253,   693,   583,   673,   851,
2319      675,    95,    79,   491,   701,   146,  1580,  1581,  1582,   258,
2320      279,   148,   217,   146,   219,   278,   691,   692,   257,   265,
2321      266,   651,   177,   225,   226,   227,   228,   259,   743,   148,
2322      265,   266,   146,   300,  1608,   305,   300,   288,   650,   177,
2323      291,   909,   260,   148,   280,   225,   226,   227,   228,   229,
2324      250,   251,   252,   253,   292,   257,   258,   754,   755,   756,
2325      757,   758,   759,   139,   148,   195,   196,   764,   225,   226,
2326      227,   228,   229,   217,   218,   219,    98,   303,   258,   290,
2327      260,    79,  1108,  1295,   302,    19,    75,   939,   940,   941,
2328      958,   788,   789,   273,   178,   179,   307,   181,   909,   140,
2329      280,    95,    74,   260,   801,   802,    78,   140,    62,   806,
2330      229,   808,   809,   302,   811,   812,   273,  1329,  1330,  1331,
2331      972,   973,   974,   217,   139,   219,   141,   264,   825,   191,
2332      192,   193,   829,   830,   831,   279,   988,   834,   835,   836,
2333      928,   303,   265,   266,   148,   229,    79,   958,   303,   293,
2334      172,   141,   849,   175,    95,   148,   853,   140,   855,  1580,
2335     1581,  1582,  1014,  1015,  1016,   303,   585,   160,   302,   799,
2336      254,   255,  1024,    85,    86,    87,   260,   142,   143,   144,
2337      145,   896,  1034,    75,    76,   139,   140,  1608,   210,   273,
2338      267,   268,   269,   270,   216,   983,   286,   985,    90,   148,
2339      222,   223,   279,    95,    16,    97,   195,   196,   905,   906,
2340      907,   160,   909,  1065,  1066,  1067,  1068,  1069,  1070,    77,
2341     1246,  1247,    95,   217,   148,   219,  1438,  1439,   925,    77,
2342     1018,  1019,  1020,  1021,   148,  1261,   139,  1263,  1264,  1265,
2343     1266,   916,    77,   176,   177,   148,   160,  1273,  1274,    77,
2344      947,   678,   679,   968,   681,   682,   683,  1469,    95,    77,
2345      957,   958,     9,   217,   961,   219,   885,    75,   148,   267,
2346      268,   269,   270,  1220,  1221,  1222,   217,   210,   219,   976,
2347      160,   279,   979,    81,   306,   982,   139,   984,   141,   986,
2348      987,   140,   989,   148,  1146,   992,  1148,   994,   995,  1435,
2349     1436,  1437,   139,   140,   284,    95,   302,   905,   232,   233,
2350      234,   909,  1009,  1165,  1166,   149,  1013,   148,   905,  1171,
2351     1017,  1173,   909,   742,    95,  1177,     3,  1179,  1180,   160,
2352     1182,  1183,   302,  1030,   149,  1435,  1436,  1437,   303,   139,
2353       61,  1193,   148,   140,   217,  1072,   219,   140,   148,   139,
2354      140,  1203,  1204,  1205,   160,  1207,  1208,  1209,   139,   957,
2355      958,   217,   140,   219,   148,  1153,   148,  1155,   139,   140,
2356      957,   958,  1224,   265,   266,  1227,   160,  1229,   160,   140,
2357      217,   800,   219,   225,   226,   227,   228,    95,  1240,  1241,
2358     1242,   140,  1244,   212,   213,  1342,   139,   962,    75,    76,
2359     1347,   257,  1349,  1511,  1351,  1108,   833,   148,   139,   140,
2360      837,  1547,   139,    90,    91,   257,   250,   251,   252,   253,
2361       97,   149,    99,   100,    31,   139,   140,   217,  1280,   219,
2362       37,   139,   140,   146,  1286,   250,   251,   252,   253,   141,
2363      139,  1293,  1294,   139,   140,  1297,   217,  1547,   219,   148,
2364     1288,   148,  1304,   905,  1169,  1307,   139,   909,  1310,   289,
2365     1312,   147,  1314,  1315,  1316,   148,  1031,  1319,  1576,  1577,
2366     1322,  1323,   217,   139,   219,  1172,  1328,  1160,    73,    74,
2367     1332,   139,   148,    78,   149,  1337,    25,    16,  1185,   148,
2368     1187,   232,   233,   234,   148,  1192,  1160,    80,  1195,  1196,
2369      139,     6,    31,  1355,   140,   957,   958,    94,    37,   217,
2370       94,   219,   257,   190,   276,   277,   278,   194,  1215,  1216,
2371     1217,  1218,   250,   251,   252,   253,    29,    30,    57,    58,
2372        7,   140,   209,   302,   211,   232,   233,   234,   148,    72,
2373       73,    74,   905,  1246,  1247,    78,   909,    52,   967,   140,
2374       72,    73,    74,    82,    83,    84,    78,   287,  1261,    88,
2375     1263,  1264,  1265,  1266,   178,   179,    95,    96,   287,   953,
2376     1273,  1274,   281,   282,  1249,  1250,  1251,  1252,  1253,  1254,
2377     1255,  1256,  1257,  1258,   261,   250,   251,   252,   253,   222,
2378      223,   224,  1444,  1158,   957,   958,   149,  1449,   213,  1451,
2379      232,   233,   234,  1455,    53,    54,  1458,  1459,   149,  1174,
2380      285,    31,    72,    73,    74,   222,   223,    37,    78,   148,
2381      148,  1473,  1474,  1475,  1476,   295,  1245,  1245,    97,   236,
2382      237,   238,   239,   240,   241,   242,   243,   244,   245,   246,
2383      247,   248,   249,   148,   300,   301,  1211,   273,  1213,  1346,
2384      148,  1348,   197,  1350,    59,  1352,    50,    51,  1223,   231,
2385      232,   233,   234,   235,   302,   170,   171,  1232,  1233,  1234,
2386     1235,  1236,  1237,   178,   179,    95,    42,   182,   259,   184,
2387      185,   186,   187,   188,   161,   162,   163,   164,   165,   166,
2388      167,   168,   169,   198,   199,   139,   140,   250,   251,   252,
2389      253,  1376,  1554,   259,  1556,    42,  1558,   175,  1560,   250,
2390      251,   252,   253,   148,  1279,   250,   251,   252,   253,    77,
2391      142,   143,   144,   145,   229,   860,   861,   862,   139,   140,
2392       98,  1296,   139,   140,  1299,   264,  1301,   139,   140,   229,
2393       14,    15,  1594,   139,  1596,   231,  1598,   139,  1600,    29,
2394       30,   280,   140,  1318,   139,   260,   139,   140,   263,   140,
2395     1325,  1326,  1327,   229,   222,   223,   256,   140,   273,   230,
2396      231,   230,   231,   278,     3,   230,   231,   230,   231,   304,
2397     1477,   304,  1479,   139,  1481,   139,  1483,   230,   231,  1354,
2398      295,  1356,   150,   151,   152,   153,   154,   155,   156,   157,
2399      158,   159,  1367,  1368,  1369,  1370,   296,   297,   298,   299,
2400      300,   301,   230,   231,   173,   174,   236,   237,   238,   239,
2401      240,   241,   242,   243,   244,   245,   246,   247,   248,   249,
2402      296,   297,   298,   299,   300,   301,   139,   140,   148,   304,
2403      304,   304,   229,   148,    92,    59,    75,    76,   304,   148,
2404       42,   139,    44,    45,    46,    47,    48,    49,   304,   304,
2405      294,    90,    91,   304,   222,   223,  1431,  1432,    97,   256,
2406       99,   100,   304,   304,   304,   304,   304,  1442,   304,   304,
2407      304,  1446,  1447,  1448,   140,  1450,   286,  1452,  1453,  1454,
2408      304,   304,  1457,    81,   148,  1460,  1461,    89,   304,   148,
2409     1465,   148,   148,    95,   148,     5,    98,  1472,   286,   296,
2410      297,   298,   299,   300,   301,     5,   148,   148,   148,    98,
2411      148,  1486,    42,    98,    44,    45,    46,    47,    48,    49,
2412      184,   148,   186,   187,   188,   189,   148,    84,   148,   148,
2413      148,     5,   148,    14,   198,    16,   200,   201,   202,   203,
2414      204,   205,   206,   207,   208,    26,   139,   139,    29,    30,
2415       31,   190,    33,    34,  1529,   194,   139,   139,  1533,    89,
2416     1535,   139,   139,    20,  1539,    95,  1541,  1542,    98,   140,
2417      209,   140,   211,   175,  1549,  1550,  1551,  1552,   140,   139,
2418      148,   183,   140,   148,   140,   140,   231,   148,    42,   148,
2419       44,    45,    46,    47,    48,    49,   148,   148,   148,   263,
2420       81,    72,    73,    74,    75,    76,    77,    78,    79,   148,
2421      148,   148,    93,    94,   231,   217,   148,   219,    59,   221,
2422     1595,   149,  1597,   225,  1599,   149,  1601,     5,     5,     5,
2423       59,   295,   149,     5,  1609,    89,  1611,   231,  1613,     5,
2424     1615,    95,     5,   231,    98,   175,   180,   231,     5,   180,
2425      230,   149,   231,   183,     5,   257,   258,   271,     5,     5,
2426      262,   263,   149,   265,   148,   148,     5,   149,   270,   149,
2427      272,   273,   274,   275,     5,   300,   139,     5,   280,   281,
2428      282,   283,   148,     5,     5,     5,     5,   217,     5,   219,
2429      139,   221,   139,   148,     5,   225,   148,     5,   231,     4,
2430      139,   303,    42,   180,    44,    45,    46,    47,    48,    49,
2431       72,    73,    74,    75,    76,    77,    78,    79,   180,     5,
2432        5,   175,     5,     5,     5,     5,     5,   257,   258,   183,
2433        5,     5,   262,   263,   149,   265,     5,   139,   148,   148,
2434      270,   148,   272,   273,   274,   275,     5,     5,     5,    89,
2435      280,   281,   282,   283,     5,    95,     5,     5,    98,     5,
2436        5,     5,     5,   217,   139,   219,   139,   221,     5,     5,
2437      139,   225,     5,   303,    72,    73,    74,    75,    76,    77,
2438       78,    79,     5,   231,   148,     5,     5,   771,   772,     5,
2439        5,   775,   776,     5,     5,    42,     3,    44,    45,    46,
2440       47,    48,    49,   257,   258,     5,     5,     5,   262,   263,
2441        5,   265,     5,     5,     5,     5,   270,   231,   272,   273,
2442      274,   275,     5,   807,     5,     4,   280,   281,   282,   283,
2443        5,     5,   296,   139,   818,   175,   820,   140,   139,   139,
2444        5,   148,    89,   183,   828,   140,    99,   215,    95,   303,
2445        5,    98,     5,     5,     5,     5,     5,     5,   842,   843,
2446        5,     5,   139,   847,   848,     6,   139,    98,    75,    76,
2447      148,     5,   148,     5,   139,   139,   148,   217,   148,   219,
2448      148,   221,   148,    90,    91,   225,   148,   148,   148,     5,
2449       97,     5,    99,   100,    72,    73,    74,    75,    76,    77,
2450       78,    79,   886,   887,   888,   889,   616,   148,   148,   619,
2451      620,   621,   622,   148,   148,     5,   234,   257,   258,   149,
2452      149,   149,   262,   263,   634,   265,    59,   149,   175,     5,
2453      270,   149,   272,   273,   274,   275,   183,     5,     5,   149,
2454      280,   281,   282,   283,   149,   149,   930,   149,   932,    72,
2455       73,    74,    75,    76,    77,    78,    79,     3,     5,   669,
2456      670,   671,   149,   303,   674,     5,   676,     5,   139,     5,
2457      217,   139,   219,   139,   221,    12,   102,   541,   225,    84,
2458      341,   503,   863,   190,   694,   695,   696,   194,    75,   699,
2459       75,   787,   786,     3,   415,  1271,   633,   632,     3,  1120,
2460     1111,  1261,   209,  1107,   211,    77,   640,   643,     1,   993,
2461      257,   258,   344,   646,   442,   262,   263,   591,   265,   417,
2462      810,   491,   452,   270,     3,   272,   273,   274,   275,    75,
2463       76,  1288,   684,   280,   281,   282,   283,     3,  1022,  1023,
2464      158,    -1,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
2465       -1,    97,    -1,    99,   100,    72,    73,    74,    75,    76,
2466       77,    78,    79,   773,   774,    75,    76,    -1,    -1,    -1,
2467       75,    76,    72,    73,    74,    75,    76,    77,    78,    79,
2468       90,    91,   792,    -1,    -1,    90,    91,    97,    -1,    99,
2469      100,    -1,    97,    -1,    99,   100,    75,    76,    -1,   148,
2470       72,    73,    74,    75,    76,    77,    78,    79,    -1,    75,
2471       76,    90,    91,    -1,   824,    -1,    -1,   827,    97,    -1,
2472       99,   100,    -1,    -1,    90,    91,    -1,    -1,    -1,    -1,
2473       -1,    97,    -1,    99,   100,   184,    -1,   186,   187,   188,
2474      189,    -1,    -1,    -1,   190,    -1,    -1,    -1,   194,   198,
2475       -1,   200,   201,   202,   203,   204,   205,   206,   207,   208,
2476       -1,    -1,    -1,   209,    -1,   211,   236,   237,   238,   239,
2477      240,   241,   242,   243,   244,   245,   246,   247,   248,   249,
2478      190,    -1,    -1,    -1,   194,   190,    -1,    -1,    -1,   194,
2479       72,    73,    74,    75,    76,    77,    78,    79,    -1,   209,
2480       -1,   211,    -1,    -1,   209,    -1,   211,    -1,    -1,    -1,
2481       -1,   190,    -1,    -1,    -1,   194,   148,    -1,    -1,    -1,
2482       -1,    -1,    -1,    -1,   190,    -1,    -1,    -1,   194,    -1,
2483      209,    -1,   211,    -1,    -1,    -1,    -1,    -1,   170,   171,
2484       -1,    -1,    -1,   209,    -1,   211,   178,   179,    -1,    -1,
2485      182,    -1,   184,   185,   186,   187,   188,    72,    73,    74,
2486       75,    76,    77,    78,    79,    -1,   198,   199,   101,   102,
2487      103,   104,   105,   106,   107,   108,   109,   110,   111,   112,
2488      113,   114,   115,   116,   117,   118,   119,   120,   121,   122,
2489      123,   124,   125,   126,   127,   128,   129,   130,   131,   132,
2490      133,   134,   135,   136,   137,   138,   236,   237,   238,   239,
2491      240,   241,    -1,   243,   244,   245,   246,   247,   248,   249
2492 };
2493 
2494   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2495      symbol of state STATE-NUM.  */
2496 static const yytype_int16 yystos[] =
2497 {
2498        0,     7,   161,   162,   163,   164,   165,   166,   167,   168,
2499      169,   309,   310,   311,   330,   331,   332,   334,   335,   336,
2500      337,   340,   341,   342,   343,   344,   345,   346,   352,   363,
2501      364,   369,   391,   392,   393,   394,   395,   396,   397,   398,
2502      399,     8,    10,    12,    13,    17,    18,    31,    55,    56,
2503       63,    65,    74,    90,    92,   194,   214,   220,   292,   480,
2504      146,   146,   146,   146,   146,   146,   146,   146,   146,     0,
2505      311,   312,   314,   316,   318,   320,   322,   324,   326,   328,
2506       11,   140,   148,   139,   365,   366,   370,    19,   302,   140,
2507      140,   302,   148,   140,   141,   302,    75,   195,   196,   212,
2508      213,   286,   347,   348,    92,   260,   302,   484,    74,    77,
2509      259,    77,    77,    77,    16,    77,    77,    16,    41,     3,
2510       75,    76,    91,    97,    99,   100,   190,   194,   209,   211,
2511      313,   400,   401,   402,   411,   414,   417,   460,   461,   462,
2512      463,   476,   479,   480,   481,   487,   488,   489,   490,   491,
2513      495,   545,   546,   547,   549,   550,   551,     3,   261,   315,
2514      400,   401,   402,   460,   476,   479,   487,   488,   489,   490,
2515      491,   516,   531,   540,   542,   544,   545,   551,     3,   317,
2516      400,   401,   402,   460,   476,   479,   487,   488,   489,   490,
2517      491,   533,   534,   535,   536,   537,   538,   540,   545,   551,
2518        3,   319,   400,   401,   402,   460,   476,   479,   487,   488,
2519      489,   490,   491,   516,   540,   545,   551,     3,   321,   400,
2520      401,   402,   411,   414,   420,   476,   479,   487,   488,   489,
2521      490,   491,     3,   323,   400,   401,   402,   476,   479,   487,
2522      488,   489,   490,   491,   552,   553,   554,   555,   556,     3,
2523      325,   400,   401,   402,   463,   476,   479,   487,   488,   489,
2524      490,   491,   498,   548,   327,   400,   401,   402,   460,   476,
2525      479,   487,   488,   489,   490,   491,   516,   540,   545,   551,
2526        3,   329,   400,   401,   402,   476,   479,   487,   488,   489,
2527      490,   491,   494,   541,     9,    75,   333,    81,   367,    95,
2528      366,   473,    14,    16,    26,    29,    30,    31,    33,    34,
2529       81,    93,    94,   353,   371,   372,   373,   374,   375,   376,
2530      379,   380,   381,   382,   383,   354,   338,   250,   251,   252,
2531      253,   539,   142,   143,   144,   145,   485,   486,   140,   148,
2532      349,   348,   284,   351,   302,   302,    42,    44,    45,    46,
2533       47,    48,    49,    89,    95,    98,   175,   183,   217,   219,
2534      221,   225,   257,   258,   262,   263,   265,   270,   272,   273,
2535      274,   275,   280,   281,   282,   283,   482,   483,    61,   558,
2536      140,   140,   139,   140,   139,   140,   140,   140,   139,   140,
2537      139,   140,   403,   405,   139,   139,     6,    52,   148,   170,
2538      171,   178,   179,   182,   184,   185,   186,   187,   188,   198,
2539      199,   229,   260,   263,   273,   278,   295,   496,   497,   501,
2540      505,   507,   508,   509,   510,   512,   513,   403,   403,   141,
2541      403,   148,   289,   289,   191,   192,   193,    75,   195,   196,
2542      147,   146,   492,   493,   260,   302,   484,     6,   225,   226,
2543      227,   228,   229,   258,   260,   280,   515,   543,   260,   280,
2544      543,     6,   178,   179,   181,   229,   254,   255,   229,     6,
2545      278,     6,    42,    49,    50,    51,    52,   229,   184,   189,
2546      198,   200,   201,   202,   203,   204,   205,   206,   207,   208,
2547      295,   499,   500,   502,   503,   504,   506,   509,   175,   229,
2548      280,   139,    25,   148,    37,   222,   223,   236,   237,   238,
2549      239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
2550      249,   353,   358,   361,   362,   368,   407,   408,   148,    80,
2551      410,    21,    22,    24,   139,   140,   305,   139,   140,    94,
2552       94,   302,   140,   148,   140,    29,    30,    26,    27,    28,
2553       32,    33,    35,    36,    38,    39,   177,   303,   355,    64,
2554       66,    67,    68,    69,    70,    71,    72,    73,   303,   339,
2555      287,   287,   303,   486,   213,    95,   350,   353,   358,   361,
2556      362,   351,   285,   485,   482,   303,   483,   148,    95,   217,
2557      219,   404,   405,   406,   472,    79,    93,   217,   218,   219,
2558      279,   293,   423,   425,   295,    97,   229,   296,   297,   298,
2559      299,   300,   301,   517,   517,   517,   517,   178,   179,   517,
2560      517,   517,   517,   281,   282,   273,   517,   148,   525,   526,
2561      527,   279,   423,   425,   517,   497,   527,   197,   511,    95,
2562      404,   470,    95,   404,   469,    95,   404,   471,    59,   493,
2563      302,   482,   558,    22,    23,   257,   532,   257,   258,   515,
2564      532,   517,   300,   301,   478,   517,   259,   478,   259,   517,
2565      517,   517,   283,   256,   517,   256,   517,   267,   268,   269,
2566      270,   267,   268,   269,   270,    42,    53,    54,   517,   517,
2567      517,    50,    51,    42,   517,   517,   517,   500,   527,   517,
2568      517,   175,   478,   148,   367,    98,   139,   141,   139,   139,
2569      231,   139,   140,   140,   140,   304,   384,   139,   354,   377,
2570      304,   304,   304,   304,   304,   304,   304,   304,   304,   304,
2571      304,   304,   304,   304,   304,   304,   304,   304,   304,   148,
2572      148,   303,   303,   484,    59,   148,   139,   148,   139,   148,
2573      406,   472,   139,   140,   139,   148,   139,   148,   139,   148,
2574      286,   294,    81,   424,   418,   517,   148,   148,   148,   148,
2575      160,   514,   514,   517,   517,   514,   514,   514,   514,   527,
2576      527,   527,   148,    59,   148,     5,   286,   424,   418,   148,
2577      514,     5,   517,   148,   470,   148,   469,   148,   471,   482,
2578      303,   148,    98,   527,   527,   527,    98,   148,   139,   140,
2579      148,   139,   140,   139,   140,   139,   140,   148,   514,   148,
2580      514,   148,   514,   527,   517,   148,   514,   517,   514,   421,
2581      421,   421,    84,   557,   421,   421,   421,   557,   527,   527,
2582      527,   148,   148,   148,   517,   517,   527,   514,   514,   148,
2583      514,     5,   514,   148,   527,   139,    22,    23,   300,   359,
2584      385,   386,   387,   139,   139,   388,   389,    20,   390,   303,
2585      217,   219,   257,   378,   140,   140,   140,   139,   140,    14,
2586       15,    29,    30,   140,   140,   360,   148,   148,   148,   148,
2587      148,   148,   148,   148,   148,   231,   484,   558,   231,   527,
2588      527,   527,   527,   527,   527,   415,   139,   140,   148,   412,
2589       57,    58,    84,    88,    95,    96,   264,   419,   427,   431,
2590      432,   464,   474,   475,   527,   148,    59,   539,   539,   148,
2591      514,   148,   514,   149,   539,   149,   539,   149,   149,     5,
2592        5,     5,   231,   232,   233,   234,   235,   518,    59,    75,
2593       76,    90,    97,   265,   266,   522,   523,   415,   412,   527,
2594      527,   149,   523,   514,   231,   231,   231,   303,   484,   527,
2595       58,   527,     5,     5,     5,   527,   539,   527,   527,   518,
2596      527,   527,   180,   539,   180,   539,   230,   231,     5,   148,
2597      514,   527,   149,   514,   149,   539,    16,    60,    95,   258,
2598      422,   465,   466,   467,   468,   527,   527,   527,   271,   421,
2599      527,   527,   527,   421,     5,     5,     5,   149,    43,   539,
2600       43,   539,   148,   148,     5,   149,   539,   149,   539,   527,
2601      149,   523,   149,   527,     5,   527,   359,   359,   139,   388,
2602      388,   388,   390,   389,   139,   148,   139,   148,   148,   361,
2603      539,   539,   539,   539,   230,   231,   230,   231,   230,   231,
2604      230,   231,   230,   231,   558,     5,     5,     5,     5,     5,
2605        5,    37,   280,   353,   356,   358,   416,   474,   475,   477,
2606      527,   527,   527,    16,    82,    83,   353,   356,   358,   413,
2607      426,   427,   430,   431,   432,   464,   474,   475,   477,   527,
2608      139,   139,    85,    86,    87,   101,   102,   103,   104,   105,
2609      106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
2610      116,   117,   118,   119,   120,   121,   122,   123,   124,   125,
2611      126,   127,   128,   129,   130,   131,   132,   133,   134,   135,
2612      136,   137,   138,   148,   148,   517,     5,   527,     5,   231,
2613      520,   520,   180,   539,   180,   539,   523,   523,   523,   527,
2614      403,     4,   529,   527,   527,     5,     5,   527,   529,   484,
2615      558,     5,   139,     5,   523,   523,   523,     5,   527,     5,
2616        5,   527,     5,     5,   527,   520,   527,   520,   527,   527,
2617      523,   527,   149,     5,   527,   149,   539,   527,   527,   139,
2618      148,   148,   148,     5,     5,     5,   527,     5,     5,     5,
2619      527,   523,   523,   523,   527,   520,   520,   520,   520,    43,
2620      539,    43,   539,   523,     5,   527,   529,     5,   523,     5,
2621      139,   139,   523,   523,   523,   523,   523,   523,    40,   478,
2622        5,     5,     5,   139,     5,   428,   447,   447,    77,   150,
2623      151,   152,   153,   154,   155,   156,   157,   158,   159,   407,
2624      408,   458,   459,   435,   435,   439,   439,    79,   176,   177,
2625      210,   433,   434,   437,   441,   445,   456,   231,   148,   523,
2626        5,    95,   523,   520,   520,   529,     5,    62,   404,   521,
2627        3,   522,   524,     5,     5,   523,   523,     5,   558,   523,
2628      527,   523,   529,   523,     5,   523,   523,     5,   523,   523,
2629        5,   527,     5,   527,     5,     5,     5,   527,   523,     5,
2630      527,   527,     5,     5,   231,   523,   523,   523,     5,   523,
2631      523,   523,     5,   529,     4,   530,   529,     5,   527,   527,
2632      527,   527,   148,   232,   233,   234,   519,   148,   519,   148,
2633      519,   148,   519,   529,   523,     5,   523,   523,   529,   529,
2634      529,   529,   529,   529,   296,   357,   139,   523,   523,   523,
2635      523,   361,   362,   429,    98,   172,   175,   210,   216,   306,
2636      407,   408,   448,   449,   450,   451,   452,   453,   140,   517,
2637      517,   517,   517,   517,   517,   517,   517,   517,   517,   459,
2638      407,   408,   436,    78,   407,   408,   440,   139,   139,   148,
2639      140,   434,   407,   408,   438,   224,   407,   408,   409,   442,
2640      288,   291,   443,   444,   446,   215,   455,   457,   230,   231,
2641      529,   523,   523,    99,   521,   276,   277,   278,   523,   523,
2642      530,   529,   523,   529,     5,   529,   523,   523,   523,     5,
2643      523,     5,   523,   523,   523,     5,   529,   523,     5,     5,
2644      523,   523,   529,   529,   529,   523,   530,   530,   530,   523,
2645        3,   524,   523,     5,     5,     5,     5,   519,   527,   519,
2646      527,   519,   527,   519,   527,   529,   523,   529,   148,   529,
2647      529,   529,   529,   139,   173,   174,   517,   139,   140,   139,
2648      454,   148,   148,   148,   148,   148,   148,   148,   148,   148,
2649      148,    98,   139,   139,   141,   148,   139,   529,   529,    59,
2650      148,   525,   526,   528,   528,   528,   530,   530,   529,   523,
2651      529,   529,   529,   523,   529,   523,   529,   529,   529,   523,
2652      529,   523,   523,   529,   529,   529,   530,     6,   529,   523,
2653      523,   523,   523,   527,     5,   527,     5,   527,     5,   527,
2654        5,   529,   234,   148,   290,   307,   149,   149,   149,   149,
2655      149,   149,   149,   149,   149,   149,    22,    23,   359,    59,
2656        5,     5,     5,   529,   529,   529,   529,   529,   529,   528,
2657      529,   529,   529,   529,     5,   523,     5,   523,     5,   523,
2658        5,   523,   359,   359,   139,   524,   524,   524,     5,   523,
2659      529,   523,   529,   523,   529,   523,   529,   139,   139,   524,
2660      529,   529,   529,   529
2661 };
2662 
2663   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
2664 static const yytype_int16 yyr1[] =
2665 {
2666        0,   308,   309,   309,   310,   310,   311,   311,   311,   311,
2667      311,   311,   311,   311,   311,   311,   311,   311,   311,   311,
2668      311,   311,   311,   311,   311,   311,   311,   311,   311,   311,
2669      311,   311,   311,   312,   312,   313,   313,   313,   313,   313,
2670      313,   313,   313,   313,   313,   313,   313,   313,   313,   313,
2671      313,   313,   313,   313,   313,   313,   313,   313,   313,   314,
2672      314,   315,   315,   315,   315,   315,   315,   315,   315,   315,
2673      315,   315,   315,   315,   315,   315,   315,   315,   315,   316,
2674      316,   317,   317,   317,   317,   317,   317,   317,   317,   317,
2675      317,   317,   317,   317,   317,   317,   317,   317,   317,   317,
2676      317,   318,   318,   319,   319,   319,   319,   319,   319,   319,
2677      319,   319,   319,   319,   319,   319,   319,   319,   320,   320,
2678      321,   321,   321,   321,   321,   321,   321,   321,   321,   321,
2679      321,   321,   321,   322,   322,   323,   323,   323,   323,   323,
2680      323,   323,   323,   323,   323,   323,   323,   323,   323,   323,
2681      324,   324,   325,   325,   325,   325,   325,   325,   325,   325,
2682      325,   325,   325,   325,   325,   326,   326,   327,   327,   327,
2683      327,   327,   327,   327,   327,   327,   327,   327,   327,   327,
2684      327,   327,   328,   328,   329,   329,   329,   329,   329,   329,
2685      329,   329,   329,   329,   329,   329,   330,   330,   330,   331,
2686      332,   333,   333,   334,   335,   335,   335,   336,   337,   338,
2687      338,   339,   339,   339,   339,   339,   339,   339,   339,   339,
2688      339,   339,   339,   339,   339,   340,   341,   341,   341,   342,
2689      342,   342,   343,   344,   345,   346,   347,   347,   348,   349,
2690      349,   350,   350,   350,   350,   350,   351,   351,   352,   353,
2691      353,   354,   354,   355,   355,   355,   355,   355,   355,   355,
2692      355,   355,   355,   355,   355,   356,   357,   357,   358,   358,
2693      358,   359,   359,   360,   360,   361,   361,   361,   361,   361,
2694      361,   361,   361,   361,   361,   361,   361,   361,   362,   363,
2695      364,   365,   365,   366,   366,   367,   367,   368,   368,   368,
2696      368,   368,   368,   369,   370,   370,   371,   371,   371,   371,
2697      371,   371,   371,   371,   371,   372,   373,   374,   375,   376,
2698      377,   377,   378,   378,   378,   378,   378,   379,   379,   380,
2699      380,   381,   381,   382,   383,   383,   383,   383,   383,   383,
2700      384,   383,   385,   383,   386,   383,   387,   383,   383,   388,
2701      388,   389,   390,   390,   391,   391,   391,   391,   392,   393,
2702      393,   394,   395,   396,   396,   397,   398,   399,   399,   400,
2703      400,   401,   401,   402,   402,   403,   403,   404,   404,   405,
2704      405,   406,   406,   406,   406,   407,   407,   408,   409,   410,
2705      410,   411,   411,   412,   412,   413,   413,   413,   413,   413,
2706      413,   413,   413,   413,   413,   413,   413,   414,   414,   415,
2707      415,   416,   416,   416,   416,   416,   416,   417,   417,   418,
2708      418,   419,   419,   419,   419,   419,   419,   420,   420,   420,
2709      420,   420,   420,   420,   420,   421,   421,   422,   422,   422,
2710      422,   423,   423,   424,   425,   426,   426,   427,   427,   427,
2711      428,   428,   429,   429,   430,   431,   431,   431,   431,   431,
2712      431,   431,   431,   431,   431,   431,   431,   431,   431,   431,
2713      431,   431,   431,   431,   431,   431,   431,   431,   431,   431,
2714      431,   431,   431,   431,   431,   431,   431,   431,   431,   431,
2715      431,   431,   431,   432,   432,   433,   433,   434,   434,   434,
2716      434,   435,   435,   436,   436,   437,   437,   438,   438,   439,
2717      439,   440,   440,   440,   440,   440,   441,   441,   442,   442,
2718      442,   443,   443,   444,   445,   445,   446,   446,   447,   447,
2719      448,   448,   448,   448,   448,   448,   448,   448,   449,   450,
2720      450,   451,   451,   452,   453,   454,   454,   455,   456,   456,
2721      457,   458,   458,   459,   459,   459,   459,   459,   459,   459,
2722      459,   459,   459,   459,   459,   459,   460,   460,   461,   462,
2723      463,   464,   464,   465,   466,   467,   468,   469,   469,   470,
2724      470,   471,   471,   472,   472,   473,   473,   474,   475,   476,
2725      476,   477,   478,   478,   479,   479,   479,   479,   480,   481,
2726      482,   482,   483,   483,   483,   483,   483,   483,   483,   483,
2727      483,   483,   483,   483,   483,   483,   483,   483,   483,   483,
2728      483,   483,   483,   483,   483,   483,   483,   483,   483,   483,
2729      483,   483,   484,   484,   485,   485,   486,   486,   486,   486,
2730      487,   487,   487,   488,   488,   488,   489,   489,   489,   490,
2731      491,   492,   492,   493,   494,   494,   495,   496,   496,   497,
2732      497,   497,   497,   497,   497,   497,   498,   499,   499,   500,
2733      500,   500,   500,   501,   501,   502,   503,   503,   503,   503,
2734      503,   503,   503,   503,   503,   503,   504,   504,   505,   505,
2735      505,   505,   506,   506,   507,   508,   509,   510,   510,   510,
2736      511,   511,   512,   512,   512,   513,   513,   513,   514,   514,
2737      515,   515,   515,   515,   516,   516,   517,   517,   517,   517,
2738      517,   517,   517,   517,   518,   518,   518,   518,   518,   518,
2739      519,   519,   519,   520,   520,   521,   521,   521,   522,   522,
2740      522,   522,   522,   522,   522,   523,   524,   525,   526,   527,
2741      527,   527,   528,   528,   528,   529,   529,   529,   529,   529,
2742      530,   530,   530,   531,   531,   531,   532,   532,   532,   533,
2743      533,   533,   533,   534,   534,   534,   534,   535,   535,   536,
2744      536,   537,   537,   538,   539,   539,   539,   539,   539,   540,
2745      540,   541,   542,   542,   542,   542,   542,   542,   542,   542,
2746      543,   543,   544,   544,   545,   545,   546,   546,   547,   547,
2747      548,   548,   549,   549,   550,   551,   551,   552,   552,   552,
2748      553,   554,   555,   555,   555,   555,   555,   555,   556,   556,
2749      556,   556,   556,   556,   557,   558,   558,   558
2750 };
2751 
2752   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
2753 static const yytype_int8 yyr2[] =
2754 {
2755        0,     2,     0,     1,     1,     2,     1,     1,     1,     1,
2756        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2757        1,     1,     1,     1,     2,     2,     2,     2,     2,     2,
2758        2,     2,     2,     0,     2,     1,     1,     1,     1,     1,
2759        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2760        1,     1,     1,     1,     1,     1,     1,     1,     1,     0,
2761        2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2762        1,     1,     1,     1,     1,     1,     1,     1,     1,     0,
2763        2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2764        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2765        1,     0,     2,     1,     1,     1,     1,     1,     1,     1,
2766        1,     1,     1,     1,     1,     1,     1,     1,     0,     2,
2767        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2768        1,     1,     1,     0,     2,     1,     1,     1,     1,     1,
2769        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2770        0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
2771        1,     1,     1,     1,     1,     0,     2,     1,     1,     1,
2772        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2773        1,     1,     0,     2,     1,     1,     1,     1,     1,     1,
2774        1,     1,     1,     1,     1,     1,     4,     7,     8,     4,
2775        3,     0,     3,     2,     3,     3,     3,     4,     5,     0,
2776        2,     4,     4,     4,     4,     4,     4,     4,     4,     4,
2777        4,     4,     4,     4,     4,     2,     3,     3,     5,     4,
2778        6,     4,     3,     3,     3,     3,     2,     3,     2,     0,
2779        2,     3,     1,     1,     1,     1,     0,     2,     5,     1,
2780        4,     0,     2,     3,     3,     3,     3,     3,     3,     3,
2781        3,     3,     3,     3,     3,     5,     0,     1,     4,     5,
2782        5,     0,     1,     0,     2,     1,     1,     1,     1,     1,
2783        1,     1,     1,     1,     1,     1,     1,     1,     2,     5,
2784        5,     1,     2,     2,     4,     0,     2,     1,     1,     1,
2785        1,     1,     1,     3,     0,     2,     1,     1,     1,     1,
2786        1,     1,     1,     1,     1,     2,     2,     1,     2,     3,
2787        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2788        2,     1,     1,     2,     5,     4,     2,     3,     3,     3,
2789        0,     4,     0,     5,     0,     5,     0,     5,     2,     1,
2790        2,     1,     0,     1,     4,     4,     4,     4,     4,     4,
2791        4,     4,     4,     4,     4,     2,     4,     5,     6,     3,
2792        4,     3,     4,     3,     4,     1,     2,     1,     2,     1,
2793        1,     2,     2,     2,     2,     2,     2,     2,     2,     0,
2794        2,     9,     9,     0,     2,     1,     1,     1,     1,     1,
2795        1,     1,     1,     1,     1,     1,     1,     9,     9,     0,
2796        2,     1,     1,     1,     1,     1,     1,     8,     8,     0,
2797        2,     1,     1,     1,     1,     1,     1,     9,     8,     8,
2798        8,     9,     8,     8,     8,     0,     2,     1,     1,     1,
2799        1,     0,     2,     2,     2,     1,     1,     2,     3,     2,
2800        0,     2,     1,     1,     2,     3,     2,     2,     2,     2,
2801        2,     2,     2,     3,     3,     2,     2,     2,     2,     2,
2802        2,     2,     3,     3,     3,     2,     2,     3,     2,     2,
2803        2,     3,     2,     2,     2,     2,     3,     3,     3,     2,
2804        2,     2,     3,     2,     2,     1,     2,     2,     2,     2,
2805        2,     0,     2,     1,     1,     0,     2,     1,     1,     0,
2806        2,     1,     1,     4,     5,     5,     0,     2,     1,     1,
2807        1,     2,     2,     2,     0,     2,     1,     1,     0,     2,
2808        1,     1,     1,     1,     1,     1,     1,     3,     3,     2,
2809        2,     2,     2,     2,     2,     0,     2,     2,     0,     2,
2810        1,     1,     2,     1,     1,     2,     4,     4,     4,     4,
2811        4,     4,     4,     4,     4,     4,     7,     6,     6,     6,
2812        9,     4,     4,     2,     2,     3,     2,     0,     3,     0,
2813        3,     0,     3,     0,     3,     0,     3,     3,     2,     7,
2814        7,     3,     1,     1,     3,     6,     7,     1,     2,     2,
2815        1,     2,     1,     1,     1,     1,     1,     1,     1,     1,
2816        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2817        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2818        1,     1,     0,     4,     1,     2,     2,     2,     1,     1,
2819        3,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2820        2,     1,     2,     1,     8,     6,     6,     1,     2,     1,
2821        1,     1,     1,     1,     1,     1,     6,     1,     2,     1,
2822        1,     1,     1,     4,     4,     4,     1,     1,     1,     1,
2823        1,     1,     1,     1,     1,     1,     4,     4,     4,     4,
2824        4,     4,     4,     4,     3,     3,     4,     1,     1,     1,
2825        0,     1,     5,     6,     5,     5,     6,     5,     1,     1,
2826        1,     1,     1,     1,     9,     6,     0,     1,     1,     1,
2827        1,     1,     1,     1,     0,     1,     1,     1,     1,     1,
2828        1,     1,     1,     0,     1,     0,     3,     4,     1,     3,
2829        4,     1,     1,     1,     1,     1,     1,     2,     3,     0,
2830        1,     1,     0,     1,     1,     0,     2,     6,     6,     6,
2831        0,     2,     6,     8,    10,     7,     0,     1,     1,     8,
2832        9,     9,    10,     9,     9,    10,    10,    10,     9,    10,
2833        9,     9,     9,     6,     0,     1,     1,     1,     1,     8,
2834        7,     7,     7,     7,     4,     4,     7,     7,     4,     4,
2835        0,     1,     9,     6,     8,     8,     8,     8,     9,     9,
2836        8,     9,     8,     9,     9,     8,     8,     7,     7,     7,
2837        7,     9,    10,    11,    12,    10,    11,    12,    10,    11,
2838       12,    10,    11,    12,     2,     0,     2,     3
2839 };
2840 
2841 
2842 #define yyerrok         (yyerrstatus = 0)
2843 #define yyclearin       (yychar = YYEMPTY)
2844 #define YYEMPTY         (-2)
2845 #define YYEOF           0
2846 
2847 #define YYACCEPT        goto yyacceptlab
2848 #define YYABORT         goto yyabortlab
2849 #define YYERROR         goto yyerrorlab
2850 
2851 
2852 #define YYRECOVERING()  (!!yyerrstatus)
2853 
2854 #define YYBACKUP(Token, Value)                                    \
2855   do                                                              \
2856     if (yychar == YYEMPTY)                                        \
2857       {                                                           \
2858         yychar = (Token);                                         \
2859         yylval = (Value);                                         \
2860         YYPOPSTACK (yylen);                                       \
2861         yystate = *yyssp;                                         \
2862         goto yybackup;                                            \
2863       }                                                           \
2864     else                                                          \
2865       {                                                           \
2866         yyerror (YY_("syntax error: cannot back up")); \
2867         YYERROR;                                                  \
2868       }                                                           \
2869   while (0)
2870 
2871 /* Error token number */
2872 #define YYTERROR        1
2873 #define YYERRCODE       256
2874 
2875 
2876 
2877 /* Enable debugging if requested.  */
2878 #if YYDEBUG
2879 
2880 # ifndef YYFPRINTF
2881 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2882 #  define YYFPRINTF fprintf
2883 # endif
2884 
2885 # define YYDPRINTF(Args)                        \
2886 do {                                            \
2887   if (yydebug)                                  \
2888     YYFPRINTF Args;                             \
2889 } while (0)
2890 
2891 /* This macro is provided for backward compatibility. */
2892 #ifndef YY_LOCATION_PRINT
2893 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2894 #endif
2895 
2896 
2897 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
2898 do {                                                                      \
2899   if (yydebug)                                                            \
2900     {                                                                     \
2901       YYFPRINTF (stderr, "%s ", Title);                                   \
2902       yy_symbol_print (stderr,                                            \
2903                   Type, Value); \
2904       YYFPRINTF (stderr, "\n");                                           \
2905     }                                                                     \
2906 } while (0)
2907 
2908 
2909 /*-----------------------------------.
2910 | Print this symbol's value on YYO.  |
2911 `-----------------------------------*/
2912 
2913 static void
yy_symbol_value_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)2914 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
2915 {
2916   FILE *yyoutput = yyo;
2917   YYUSE (yyoutput);
2918   if (!yyvaluep)
2919     return;
2920 # ifdef YYPRINT
2921   if (yytype < YYNTOKENS)
2922     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
2923 # endif
2924   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2925   YYUSE (yytype);
2926   YY_IGNORE_MAYBE_UNINITIALIZED_END
2927 }
2928 
2929 
2930 /*---------------------------.
2931 | Print this symbol on YYO.  |
2932 `---------------------------*/
2933 
2934 static void
yy_symbol_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)2935 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
2936 {
2937   YYFPRINTF (yyo, "%s %s (",
2938              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2939 
2940   yy_symbol_value_print (yyo, yytype, yyvaluep);
2941   YYFPRINTF (yyo, ")");
2942 }
2943 
2944 /*------------------------------------------------------------------.
2945 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2946 | TOP (included).                                                   |
2947 `------------------------------------------------------------------*/
2948 
2949 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)2950 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
2951 {
2952   YYFPRINTF (stderr, "Stack now");
2953   for (; yybottom <= yytop; yybottom++)
2954     {
2955       int yybot = *yybottom;
2956       YYFPRINTF (stderr, " %d", yybot);
2957     }
2958   YYFPRINTF (stderr, "\n");
2959 }
2960 
2961 # define YY_STACK_PRINT(Bottom, Top)                            \
2962 do {                                                            \
2963   if (yydebug)                                                  \
2964     yy_stack_print ((Bottom), (Top));                           \
2965 } while (0)
2966 
2967 
2968 /*------------------------------------------------.
2969 | Report that the YYRULE is going to be reduced.  |
2970 `------------------------------------------------*/
2971 
2972 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule)2973 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
2974 {
2975   int yylno = yyrline[yyrule];
2976   int yynrhs = yyr2[yyrule];
2977   int yyi;
2978   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
2979              yyrule - 1, yylno);
2980   /* The symbols being reduced.  */
2981   for (yyi = 0; yyi < yynrhs; yyi++)
2982     {
2983       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
2984       yy_symbol_print (stderr,
2985                        yystos[+yyssp[yyi + 1 - yynrhs]],
2986                        &yyvsp[(yyi + 1) - (yynrhs)]
2987                                               );
2988       YYFPRINTF (stderr, "\n");
2989     }
2990 }
2991 
2992 # define YY_REDUCE_PRINT(Rule)          \
2993 do {                                    \
2994   if (yydebug)                          \
2995     yy_reduce_print (yyssp, yyvsp, Rule); \
2996 } while (0)
2997 
2998 /* Nonzero means print parse trace.  It is left uninitialized so that
2999    multiple parsers can coexist.  */
3000 int yydebug;
3001 #else /* !YYDEBUG */
3002 # define YYDPRINTF(Args)
3003 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
3004 # define YY_STACK_PRINT(Bottom, Top)
3005 # define YY_REDUCE_PRINT(Rule)
3006 #endif /* !YYDEBUG */
3007 
3008 
3009 /* YYINITDEPTH -- initial size of the parser's stacks.  */
3010 #ifndef YYINITDEPTH
3011 # define YYINITDEPTH 200
3012 #endif
3013 
3014 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3015    if the built-in stack extension method is used).
3016 
3017    Do not make this value too large; the results are undefined if
3018    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3019    evaluated with infinite-precision integer arithmetic.  */
3020 
3021 #ifndef YYMAXDEPTH
3022 # define YYMAXDEPTH 10000
3023 #endif
3024 
3025 
3026 #if YYERROR_VERBOSE
3027 
3028 # ifndef yystrlen
3029 #  if defined __GLIBC__ && defined _STRING_H
3030 #   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
3031 #  else
3032 /* Return the length of YYSTR.  */
3033 static YYPTRDIFF_T
yystrlen(const char * yystr)3034 yystrlen (const char *yystr)
3035 {
3036   YYPTRDIFF_T yylen;
3037   for (yylen = 0; yystr[yylen]; yylen++)
3038     continue;
3039   return yylen;
3040 }
3041 #  endif
3042 # endif
3043 
3044 # ifndef yystpcpy
3045 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3046 #   define yystpcpy stpcpy
3047 #  else
3048 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3049    YYDEST.  */
3050 static char *
yystpcpy(char * yydest,const char * yysrc)3051 yystpcpy (char *yydest, const char *yysrc)
3052 {
3053   char *yyd = yydest;
3054   const char *yys = yysrc;
3055 
3056   while ((*yyd++ = *yys++) != '\0')
3057     continue;
3058 
3059   return yyd - 1;
3060 }
3061 #  endif
3062 # endif
3063 
3064 # ifndef yytnamerr
3065 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3066    quotes and backslashes, so that it's suitable for yyerror.  The
3067    heuristic is that double-quoting is unnecessary unless the string
3068    contains an apostrophe, a comma, or backslash (other than
3069    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
3070    null, do not copy; instead, return the length of what the result
3071    would have been.  */
3072 static YYPTRDIFF_T
yytnamerr(char * yyres,const char * yystr)3073 yytnamerr (char *yyres, const char *yystr)
3074 {
3075   if (*yystr == '"')
3076     {
3077       YYPTRDIFF_T yyn = 0;
3078       char const *yyp = yystr;
3079 
3080       for (;;)
3081         switch (*++yyp)
3082           {
3083           case '\'':
3084           case ',':
3085             goto do_not_strip_quotes;
3086 
3087           case '\\':
3088             if (*++yyp != '\\')
3089               goto do_not_strip_quotes;
3090             else
3091               goto append;
3092 
3093           append:
3094           default:
3095             if (yyres)
3096               yyres[yyn] = *yyp;
3097             yyn++;
3098             break;
3099 
3100           case '"':
3101             if (yyres)
3102               yyres[yyn] = '\0';
3103             return yyn;
3104           }
3105     do_not_strip_quotes: ;
3106     }
3107 
3108   if (yyres)
3109     return yystpcpy (yyres, yystr) - yyres;
3110   else
3111     return yystrlen (yystr);
3112 }
3113 # endif
3114 
3115 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
3116    about the unexpected token YYTOKEN for the state stack whose top is
3117    YYSSP.
3118 
3119    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
3120    not large enough to hold the message.  In that case, also set
3121    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
3122    required number of bytes is too large to store.  */
3123 static int
yysyntax_error(YYPTRDIFF_T * yymsg_alloc,char ** yymsg,yy_state_t * yyssp,int yytoken)3124 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
3125                 yy_state_t *yyssp, int yytoken)
3126 {
3127   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3128   /* Internationalized format string. */
3129   const char *yyformat = YY_NULLPTR;
3130   /* Arguments of yyformat: reported tokens (one for the "unexpected",
3131      one per "expected"). */
3132   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3133   /* Actual size of YYARG. */
3134   int yycount = 0;
3135   /* Cumulated lengths of YYARG.  */
3136   YYPTRDIFF_T yysize = 0;
3137 
3138   /* There are many possibilities here to consider:
3139      - If this state is a consistent state with a default action, then
3140        the only way this function was invoked is if the default action
3141        is an error action.  In that case, don't check for expected
3142        tokens because there are none.
3143      - The only way there can be no lookahead present (in yychar) is if
3144        this state is a consistent state with a default action.  Thus,
3145        detecting the absence of a lookahead is sufficient to determine
3146        that there is no unexpected or expected token to report.  In that
3147        case, just report a simple "syntax error".
3148      - Don't assume there isn't a lookahead just because this state is a
3149        consistent state with a default action.  There might have been a
3150        previous inconsistent state, consistent state with a non-default
3151        action, or user semantic action that manipulated yychar.
3152      - Of course, the expected token list depends on states to have
3153        correct lookahead information, and it depends on the parser not
3154        to perform extra reductions after fetching a lookahead from the
3155        scanner and before detecting a syntax error.  Thus, state merging
3156        (from LALR or IELR) and default reductions corrupt the expected
3157        token list.  However, the list is correct for canonical LR with
3158        one exception: it will still contain any token that will not be
3159        accepted due to an error action in a later state.
3160   */
3161   if (yytoken != YYEMPTY)
3162     {
3163       int yyn = yypact[+*yyssp];
3164       YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
3165       yysize = yysize0;
3166       yyarg[yycount++] = yytname[yytoken];
3167       if (!yypact_value_is_default (yyn))
3168         {
3169           /* Start YYX at -YYN if negative to avoid negative indexes in
3170              YYCHECK.  In other words, skip the first -YYN actions for
3171              this state because they are default actions.  */
3172           int yyxbegin = yyn < 0 ? -yyn : 0;
3173           /* Stay within bounds of both yycheck and yytname.  */
3174           int yychecklim = YYLAST - yyn + 1;
3175           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3176           int yyx;
3177 
3178           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3179             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
3180                 && !yytable_value_is_error (yytable[yyx + yyn]))
3181               {
3182                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3183                   {
3184                     yycount = 1;
3185                     yysize = yysize0;
3186                     break;
3187                   }
3188                 yyarg[yycount++] = yytname[yyx];
3189                 {
3190                   YYPTRDIFF_T yysize1
3191                     = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
3192                   if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
3193                     yysize = yysize1;
3194                   else
3195                     return 2;
3196                 }
3197               }
3198         }
3199     }
3200 
3201   switch (yycount)
3202     {
3203 # define YYCASE_(N, S)                      \
3204       case N:                               \
3205         yyformat = S;                       \
3206       break
3207     default: /* Avoid compiler warnings. */
3208       YYCASE_(0, YY_("syntax error"));
3209       YYCASE_(1, YY_("syntax error, unexpected %s"));
3210       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
3211       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
3212       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
3213       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
3214 # undef YYCASE_
3215     }
3216 
3217   {
3218     /* Don't count the "%s"s in the final size, but reserve room for
3219        the terminator.  */
3220     YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
3221     if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
3222       yysize = yysize1;
3223     else
3224       return 2;
3225   }
3226 
3227   if (*yymsg_alloc < yysize)
3228     {
3229       *yymsg_alloc = 2 * yysize;
3230       if (! (yysize <= *yymsg_alloc
3231              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
3232         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
3233       return 1;
3234     }
3235 
3236   /* Avoid sprintf, as that infringes on the user's name space.
3237      Don't have undefined behavior even if the translation
3238      produced a string with the wrong number of "%s"s.  */
3239   {
3240     char *yyp = *yymsg;
3241     int yyi = 0;
3242     while ((*yyp = *yyformat) != '\0')
3243       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
3244         {
3245           yyp += yytnamerr (yyp, yyarg[yyi++]);
3246           yyformat += 2;
3247         }
3248       else
3249         {
3250           ++yyp;
3251           ++yyformat;
3252         }
3253   }
3254   return 0;
3255 }
3256 #endif /* YYERROR_VERBOSE */
3257 
3258 /*-----------------------------------------------.
3259 | Release the memory associated to this symbol.  |
3260 `-----------------------------------------------*/
3261 
3262 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)3263 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
3264 {
3265   YYUSE (yyvaluep);
3266   if (!yymsg)
3267     yymsg = "Deleting";
3268   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3269 
3270   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3271   YYUSE (yytype);
3272   YY_IGNORE_MAYBE_UNINITIALIZED_END
3273 }
3274 
3275 
3276 
3277 
3278 /* The lookahead symbol.  */
3279 int yychar;
3280 
3281 /* The semantic value of the lookahead symbol.  */
3282 YYSTYPE yylval;
3283 /* Number of syntax errors so far.  */
3284 int yynerrs;
3285 
3286 
3287 /*----------.
3288 | yyparse.  |
3289 `----------*/
3290 
3291 int
yyparse(void)3292 yyparse (void)
3293 {
3294     yy_state_fast_t yystate;
3295     /* Number of tokens to shift before error messages enabled.  */
3296     int yyerrstatus;
3297 
3298     /* The stacks and their tools:
3299        'yyss': related to states.
3300        'yyvs': related to semantic values.
3301 
3302        Refer to the stacks through separate pointers, to allow yyoverflow
3303        to reallocate them elsewhere.  */
3304 
3305     /* The state stack.  */
3306     yy_state_t yyssa[YYINITDEPTH];
3307     yy_state_t *yyss;
3308     yy_state_t *yyssp;
3309 
3310     /* The semantic value stack.  */
3311     YYSTYPE yyvsa[YYINITDEPTH];
3312     YYSTYPE *yyvs;
3313     YYSTYPE *yyvsp;
3314 
3315     YYPTRDIFF_T yystacksize;
3316 
3317   int yyn;
3318   int yyresult;
3319   /* Lookahead token as an internal (translated) token number.  */
3320   int yytoken = 0;
3321   /* The variables used to return semantic value and location from the
3322      action routines.  */
3323   YYSTYPE yyval;
3324 
3325 #if YYERROR_VERBOSE
3326   /* Buffer for error messages, and its allocated size.  */
3327   char yymsgbuf[128];
3328   char *yymsg = yymsgbuf;
3329   YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
3330 #endif
3331 
3332 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
3333 
3334   /* The number of symbols on the RHS of the reduced rule.
3335      Keep to zero when no symbol should be popped.  */
3336   int yylen = 0;
3337 
3338   yyssp = yyss = yyssa;
3339   yyvsp = yyvs = yyvsa;
3340   yystacksize = YYINITDEPTH;
3341 
3342   YYDPRINTF ((stderr, "Starting parse\n"));
3343 
3344   yystate = 0;
3345   yyerrstatus = 0;
3346   yynerrs = 0;
3347   yychar = YYEMPTY; /* Cause a token to be read.  */
3348   goto yysetstate;
3349 
3350 
3351 /*------------------------------------------------------------.
3352 | yynewstate -- push a new state, which is found in yystate.  |
3353 `------------------------------------------------------------*/
3354 yynewstate:
3355   /* In all cases, when you get here, the value and location stacks
3356      have just been pushed.  So pushing a state here evens the stacks.  */
3357   yyssp++;
3358 
3359 
3360 /*--------------------------------------------------------------------.
3361 | yysetstate -- set current state (the top of the stack) to yystate.  |
3362 `--------------------------------------------------------------------*/
3363 yysetstate:
3364   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3365   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
3366   YY_IGNORE_USELESS_CAST_BEGIN
3367   *yyssp = YY_CAST (yy_state_t, yystate);
3368   YY_IGNORE_USELESS_CAST_END
3369 
3370   if (yyss + yystacksize - 1 <= yyssp)
3371 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
3372     goto yyexhaustedlab;
3373 #else
3374     {
3375       /* Get the current used size of the three stacks, in elements.  */
3376       YYPTRDIFF_T yysize = yyssp - yyss + 1;
3377 
3378 # if defined yyoverflow
3379       {
3380         /* Give user a chance to reallocate the stack.  Use copies of
3381            these so that the &'s don't force the real ones into
3382            memory.  */
3383         yy_state_t *yyss1 = yyss;
3384         YYSTYPE *yyvs1 = yyvs;
3385 
3386         /* Each stack pointer address is followed by the size of the
3387            data in use in that stack, in bytes.  This used to be a
3388            conditional around just the two extra args, but that might
3389            be undefined if yyoverflow is a macro.  */
3390         yyoverflow (YY_("memory exhausted"),
3391                     &yyss1, yysize * YYSIZEOF (*yyssp),
3392                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
3393                     &yystacksize);
3394         yyss = yyss1;
3395         yyvs = yyvs1;
3396       }
3397 # else /* defined YYSTACK_RELOCATE */
3398       /* Extend the stack our own way.  */
3399       if (YYMAXDEPTH <= yystacksize)
3400         goto yyexhaustedlab;
3401       yystacksize *= 2;
3402       if (YYMAXDEPTH < yystacksize)
3403         yystacksize = YYMAXDEPTH;
3404 
3405       {
3406         yy_state_t *yyss1 = yyss;
3407         union yyalloc *yyptr =
3408           YY_CAST (union yyalloc *,
3409                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
3410         if (! yyptr)
3411           goto yyexhaustedlab;
3412         YYSTACK_RELOCATE (yyss_alloc, yyss);
3413         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
3414 # undef YYSTACK_RELOCATE
3415         if (yyss1 != yyssa)
3416           YYSTACK_FREE (yyss1);
3417       }
3418 # endif
3419 
3420       yyssp = yyss + yysize - 1;
3421       yyvsp = yyvs + yysize - 1;
3422 
3423       YY_IGNORE_USELESS_CAST_BEGIN
3424       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
3425                   YY_CAST (long, yystacksize)));
3426       YY_IGNORE_USELESS_CAST_END
3427 
3428       if (yyss + yystacksize - 1 <= yyssp)
3429         YYABORT;
3430     }
3431 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
3432 
3433   if (yystate == YYFINAL)
3434     YYACCEPT;
3435 
3436   goto yybackup;
3437 
3438 
3439 /*-----------.
3440 | yybackup.  |
3441 `-----------*/
3442 yybackup:
3443   /* Do appropriate processing given the current state.  Read a
3444      lookahead token if we need one and don't already have one.  */
3445 
3446   /* First try to decide what to do without reference to lookahead token.  */
3447   yyn = yypact[yystate];
3448   if (yypact_value_is_default (yyn))
3449     goto yydefault;
3450 
3451   /* Not known => get a lookahead token if don't already have one.  */
3452 
3453   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
3454   if (yychar == YYEMPTY)
3455     {
3456       YYDPRINTF ((stderr, "Reading a token: "));
3457       yychar = yylex ();
3458     }
3459 
3460   if (yychar <= YYEOF)
3461     {
3462       yychar = yytoken = YYEOF;
3463       YYDPRINTF ((stderr, "Now at end of input.\n"));
3464     }
3465   else
3466     {
3467       yytoken = YYTRANSLATE (yychar);
3468       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3469     }
3470 
3471   /* If the proper action on seeing token YYTOKEN is to reduce or to
3472      detect an error, take that action.  */
3473   yyn += yytoken;
3474   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3475     goto yydefault;
3476   yyn = yytable[yyn];
3477   if (yyn <= 0)
3478     {
3479       if (yytable_value_is_error (yyn))
3480         goto yyerrlab;
3481       yyn = -yyn;
3482       goto yyreduce;
3483     }
3484 
3485   /* Count tokens shifted since error; after three, turn off error
3486      status.  */
3487   if (yyerrstatus)
3488     yyerrstatus--;
3489 
3490   /* Shift the lookahead token.  */
3491   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3492   yystate = yyn;
3493   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3494   *++yyvsp = yylval;
3495   YY_IGNORE_MAYBE_UNINITIALIZED_END
3496 
3497   /* Discard the shifted token.  */
3498   yychar = YYEMPTY;
3499   goto yynewstate;
3500 
3501 
3502 /*-----------------------------------------------------------.
3503 | yydefault -- do the default action for the current state.  |
3504 `-----------------------------------------------------------*/
3505 yydefault:
3506   yyn = yydefact[yystate];
3507   if (yyn == 0)
3508     goto yyerrlab;
3509   goto yyreduce;
3510 
3511 
3512 /*-----------------------------.
3513 | yyreduce -- do a reduction.  |
3514 `-----------------------------*/
3515 yyreduce:
3516   /* yyn is the number of a rule to reduce with.  */
3517   yylen = yyr2[yyn];
3518 
3519   /* If YYLEN is nonzero, implement the default value of the action:
3520      '$$ = $1'.
3521 
3522      Otherwise, the following line sets YYVAL to garbage.
3523      This behavior is undocumented and Bison
3524      users should not rely upon it.  Assigning to YYVAL
3525      unconditionally makes the parser a bit smaller, and it avoids a
3526      GCC warning that YYVAL may be used uninitialized.  */
3527   yyval = yyvsp[1-yylen];
3528 
3529 
3530   YY_REDUCE_PRINT (yyn);
3531   switch (yyn)
3532     {
3533   case 196:
3534 #line 615 "src/p.y"
3535                                                     {
3536                         mailset.events = Event_All;
3537                         addmail((yyvsp[-2].string), &mailset, &Run.maillist);
3538                   }
3539 #line 3540 "src/y.tab.c"
3540     break;
3541 
3542   case 197:
3543 #line 619 "src/p.y"
3544                                                                             {
3545                         addmail((yyvsp[-5].string), &mailset, &Run.maillist);
3546                   }
3547 #line 3548 "src/y.tab.c"
3548     break;
3549 
3550   case 198:
3551 #line 622 "src/p.y"
3552                                                                                 {
3553                         mailset.events = ~mailset.events;
3554                         addmail((yyvsp[-6].string), &mailset, &Run.maillist);
3555                   }
3556 #line 3557 "src/y.tab.c"
3557     break;
3558 
3559   case 199:
3560 #line 628 "src/p.y"
3561                                                {
3562                         if (! (Run.flags & Run_Daemon) || ihp.daemon) {
3563                                 ihp.daemon     = true;
3564                                 Run.flags      |= Run_Daemon;
3565                                 Run.polltime   = (yyvsp[-1].number);
3566                                 Run.startdelay = (yyvsp[0].number);
3567                         }
3568                   }
3569 #line 3570 "src/y.tab.c"
3570     break;
3571 
3572   case 200:
3573 #line 638 "src/p.y"
3574                                      {
3575                         Run.flags |= Run_Batch;
3576                   }
3577 #line 3578 "src/y.tab.c"
3578     break;
3579 
3580   case 201:
3581 #line 643 "src/p.y"
3582                               {
3583                         (yyval.number) = 0;
3584                   }
3585 #line 3586 "src/y.tab.c"
3586     break;
3587 
3588   case 202:
3589 #line 646 "src/p.y"
3590                                      {
3591                         (yyval.number) = (yyvsp[0].number);
3592                   }
3593 #line 3594 "src/y.tab.c"
3594     break;
3595 
3596   case 203:
3597 #line 651 "src/p.y"
3598                            {
3599                         Run.flags |= Run_Foreground;
3600                   }
3601 #line 3602 "src/y.tab.c"
3602     break;
3603 
3604   case 204:
3605 #line 656 "src/p.y"
3606                                      {
3607                         Run.onreboot = Onreboot_Start;
3608                   }
3609 #line 3610 "src/y.tab.c"
3610     break;
3611 
3612   case 205:
3613 #line 659 "src/p.y"
3614                                        {
3615                         Run.onreboot = Onreboot_Nostart;
3616                   }
3617 #line 3618 "src/y.tab.c"
3618     break;
3619 
3620   case 206:
3621 #line 662 "src/p.y"
3622                                          {
3623                         Run.onreboot = Onreboot_Laststate;
3624                   }
3625 #line 3626 "src/y.tab.c"
3626     break;
3627 
3628   case 207:
3629 #line 667 "src/p.y"
3630                                                {
3631                         // Note: deprecated (replaced by "set limits" statement's "sendExpectBuffer" option)
3632                         Run.limits.sendExpectBuffer = (yyvsp[-1].number) * (yyvsp[0].number);
3633                   }
3634 #line 3635 "src/y.tab.c"
3635     break;
3636 
3637   case 211:
3638 #line 680 "src/p.y"
3639                                                    {
3640                         Run.limits.sendExpectBuffer = (yyvsp[-1].number) * (yyvsp[0].number);
3641                   }
3642 #line 3643 "src/y.tab.c"
3643     break;
3644 
3645   case 212:
3646 #line 683 "src/p.y"
3647                                                     {
3648                         Run.limits.fileContentBuffer = (yyvsp[-1].number) * (yyvsp[0].number);
3649                   }
3650 #line 3651 "src/y.tab.c"
3651     break;
3652 
3653   case 213:
3654 #line 686 "src/p.y"
3655                                                     {
3656                         Run.limits.httpContentBuffer = (yyvsp[-1].number) * (yyvsp[0].number);
3657                   }
3658 #line 3659 "src/y.tab.c"
3659     break;
3660 
3661   case 214:
3662 #line 689 "src/p.y"
3663                                                 {
3664                         Run.limits.programOutput = (yyvsp[-1].number) * (yyvsp[0].number);
3665                   }
3666 #line 3667 "src/y.tab.c"
3667     break;
3668 
3669   case 215:
3670 #line 692 "src/p.y"
3671                                                         {
3672                         Run.limits.networkTimeout = (yyvsp[-1].number);
3673                   }
3674 #line 3675 "src/y.tab.c"
3675     break;
3676 
3677   case 216:
3678 #line 695 "src/p.y"
3679                                                    {
3680                         Run.limits.networkTimeout = (yyvsp[-1].number) * 1000;
3681                   }
3682 #line 3683 "src/y.tab.c"
3683     break;
3684 
3685   case 217:
3686 #line 698 "src/p.y"
3687                                                         {
3688                         Run.limits.programTimeout = (yyvsp[-1].number);
3689                   }
3690 #line 3691 "src/y.tab.c"
3691     break;
3692 
3693   case 218:
3694 #line 701 "src/p.y"
3695                                                    {
3696                         Run.limits.programTimeout = (yyvsp[-1].number) * 1000;
3697                   }
3698 #line 3699 "src/y.tab.c"
3699     break;
3700 
3701   case 219:
3702 #line 704 "src/p.y"
3703                                                      {
3704                         Run.limits.stopTimeout = (yyvsp[-1].number);
3705                   }
3706 #line 3707 "src/y.tab.c"
3707     break;
3708 
3709   case 220:
3710 #line 707 "src/p.y"
3711                                                 {
3712                         Run.limits.stopTimeout = (yyvsp[-1].number) * 1000;
3713                   }
3714 #line 3715 "src/y.tab.c"
3715     break;
3716 
3717   case 221:
3718 #line 710 "src/p.y"
3719                                                       {
3720                         Run.limits.startTimeout = (yyvsp[-1].number);
3721                   }
3722 #line 3723 "src/y.tab.c"
3723     break;
3724 
3725   case 222:
3726 #line 713 "src/p.y"
3727                                                  {
3728                         Run.limits.startTimeout = (yyvsp[-1].number) * 1000;
3729                   }
3730 #line 3731 "src/y.tab.c"
3731     break;
3732 
3733   case 223:
3734 #line 716 "src/p.y"
3735                                                         {
3736                         Run.limits.restartTimeout = (yyvsp[-1].number);
3737                   }
3738 #line 3739 "src/y.tab.c"
3739     break;
3740 
3741   case 224:
3742 #line 719 "src/p.y"
3743                                                    {
3744                         Run.limits.restartTimeout = (yyvsp[-1].number) * 1000;
3745                   }
3746 #line 3747 "src/y.tab.c"
3747     break;
3748 
3749   case 225:
3750 #line 724 "src/p.y"
3751                            {
3752                         Run.flags |= Run_FipsEnabled;
3753                   }
3754 #line 3755 "src/y.tab.c"
3755     break;
3756 
3757   case 226:
3758 #line 729 "src/p.y"
3759                                      {
3760                         if (! Run.files.log || ihp.logfile) {
3761                                 ihp.logfile = true;
3762                                 setlogfile((yyvsp[0].string));
3763                                 Run.flags &= ~Run_UseSyslog;
3764                                 Run.flags |= Run_Log;
3765                         }
3766                   }
3767 #line 3768 "src/y.tab.c"
3768     break;
3769 
3770   case 227:
3771 #line 737 "src/p.y"
3772                                      {
3773                         setsyslog(NULL);
3774                   }
3775 #line 3776 "src/y.tab.c"
3776     break;
3777 
3778   case 228:
3779 #line 740 "src/p.y"
3780                                                      {
3781                         setsyslog((yyvsp[0].string)); FREE((yyvsp[0].string));
3782                   }
3783 #line 3784 "src/y.tab.c"
3784     break;
3785 
3786   case 229:
3787 #line 745 "src/p.y"
3788                                               {
3789                         Run.eventlist_dir = (yyvsp[0].string);
3790                   }
3791 #line 3792 "src/y.tab.c"
3792     break;
3793 
3794   case 230:
3795 #line 748 "src/p.y"
3796                                                           {
3797                         Run.eventlist_dir = (yyvsp[-2].string);
3798                         Run.eventlist_slots = (yyvsp[0].number);
3799                   }
3800 #line 3801 "src/y.tab.c"
3801     break;
3802 
3803   case 231:
3804 #line 752 "src/p.y"
3805                                              {
3806                         Run.eventlist_dir = Str_dup(MYEVENTLISTBASE);
3807                         Run.eventlist_slots = (yyvsp[0].number);
3808                   }
3809 #line 3810 "src/y.tab.c"
3810     break;
3811 
3812   case 232:
3813 #line 758 "src/p.y"
3814                                   {
3815                         Run.files.id = (yyvsp[0].string);
3816                   }
3817 #line 3818 "src/y.tab.c"
3818     break;
3819 
3820   case 233:
3821 #line 763 "src/p.y"
3822                                      {
3823                         Run.files.state = (yyvsp[0].string);
3824                   }
3825 #line 3826 "src/y.tab.c"
3826     break;
3827 
3828   case 234:
3829 #line 768 "src/p.y"
3830                                    {
3831                         if (! Run.files.pid || ihp.pidfile) {
3832                                 ihp.pidfile = true;
3833                                 setpidfile((yyvsp[0].string));
3834                         }
3835                   }
3836 #line 3837 "src/y.tab.c"
3837     break;
3838 
3839   case 238:
3840 #line 783 "src/p.y"
3841                                           {
3842                         mmonitset.url = (yyvsp[-1].url);
3843                         addmmonit(&mmonitset);
3844                   }
3845 #line 3846 "src/y.tab.c"
3846     break;
3847 
3848   case 241:
3849 #line 793 "src/p.y"
3850                                         {
3851                         mmonitset.timeout = (yyvsp[-1].number) * 1000; // net timeout is in milliseconds internally
3852                   }
3853 #line 3854 "src/y.tab.c"
3854     break;
3855 
3856   case 247:
3857 #line 803 "src/p.y"
3858                                        {
3859                         Run.flags &= ~Run_MmonitCredentials;
3860                   }
3861 #line 3862 "src/y.tab.c"
3862     break;
3863 
3864   case 248:
3865 #line 808 "src/p.y"
3866                                                      {
3867                         _setSSLOptions(&(Run.ssl));
3868                   }
3869 #line 3870 "src/y.tab.c"
3870     break;
3871 
3872   case 249:
3873 #line 813 "src/p.y"
3874                            {
3875                         sslset.flags = SSL_Enabled;
3876                   }
3877 #line 3878 "src/y.tab.c"
3878     break;
3879 
3880   case 253:
3881 #line 823 "src/p.y"
3882                                     {
3883                         sslset.flags = SSL_Enabled;
3884                         sslset.verify = true;
3885                   }
3886 #line 3887 "src/y.tab.c"
3887     break;
3888 
3889   case 254:
3890 #line 827 "src/p.y"
3891                                      {
3892                         sslset.flags = SSL_Enabled;
3893                         sslset.verify = false;
3894                   }
3895 #line 3896 "src/y.tab.c"
3896     break;
3897 
3898   case 255:
3899 #line 831 "src/p.y"
3900                                        {
3901                         sslset.flags = SSL_Enabled;
3902                         sslset.allowSelfSigned = true;
3903                   }
3904 #line 3905 "src/y.tab.c"
3905     break;
3906 
3907   case 256:
3908 #line 835 "src/p.y"
3909                                            {
3910                         sslset.flags = SSL_Enabled;
3911                         sslset.allowSelfSigned = false;
3912                   }
3913 #line 3914 "src/y.tab.c"
3914     break;
3915 
3916   case 257:
3917 #line 839 "src/p.y"
3918                                                 {
3919                         sslset.flags = SSL_Enabled;
3920                   }
3921 #line 3922 "src/y.tab.c"
3922     break;
3923 
3924   case 258:
3925 #line 842 "src/p.y"
3926                                     {
3927                         FREE(sslset.ciphers);
3928                         sslset.ciphers = (yyvsp[0].string);
3929                   }
3930 #line 3931 "src/y.tab.c"
3931     break;
3932 
3933   case 259:
3934 #line 846 "src/p.y"
3935                                    {
3936                         _setPEM(&(sslset.pemfile), (yyvsp[0].string), "SSL server PEM file", true);
3937                   }
3938 #line 3939 "src/y.tab.c"
3939     break;
3940 
3941   case 260:
3942 #line 849 "src/p.y"
3943                                     {
3944                         _setPEM(&(sslset.pemchain), (yyvsp[0].string), "SSL certificate chain PEM file", true);
3945                   }
3946 #line 3947 "src/y.tab.c"
3947     break;
3948 
3949   case 261:
3950 #line 852 "src/p.y"
3951                                   {
3952                         _setPEM(&(sslset.pemkey), (yyvsp[0].string), "SSL server private key PEM file", true);
3953                   }
3954 #line 3955 "src/y.tab.c"
3955     break;
3956 
3957   case 262:
3958 #line 855 "src/p.y"
3959                                          {
3960                         _setPEM(&(sslset.clientpemfile), (yyvsp[0].string), "SSL client PEM file", true);
3961                   }
3962 #line 3963 "src/y.tab.c"
3963     break;
3964 
3965   case 263:
3966 #line 858 "src/p.y"
3967                                              {
3968                         _setPEM(&(sslset.CACertificateFile), (yyvsp[0].string), "SSL CA certificates file", true);
3969                   }
3970 #line 3971 "src/y.tab.c"
3971     break;
3972 
3973   case 264:
3974 #line 861 "src/p.y"
3975                                              {
3976                         _setPEM(&(sslset.CACertificatePath), (yyvsp[0].string), "SSL CA certificates directory", false);
3977                   }
3978 #line 3979 "src/y.tab.c"
3979     break;
3980 
3981   case 265:
3982 #line 866 "src/p.y"
3983                                                               {
3984                         sslset.flags = SSL_Enabled;
3985                         portset.target.net.ssl.certificate.minimumDays = (yyvsp[-1].number);
3986                   }
3987 #line 3988 "src/y.tab.c"
3988     break;
3989 
3990   case 268:
3991 #line 876 "src/p.y"
3992                                                                {
3993                         sslset.flags = SSL_Enabled;
3994                         sslset.checksum = (yyvsp[0].string);
3995                         switch (cleanup_hash_string(sslset.checksum)) {
3996                                 case 32:
3997                                         sslset.checksumType = Hash_Md5;
3998                                         break;
3999                                 case 40:
4000                                         sslset.checksumType = Hash_Sha1;
4001                                         break;
4002                                 default:
4003                                         yyerror2("Unknown checksum type: [%s] is not MD5 nor SHA1", sslset.checksum);
4004                         }
4005                   }
4006 #line 4007 "src/y.tab.c"
4007     break;
4008 
4009   case 269:
4010 #line 890 "src/p.y"
4011                                                                        {
4012                         sslset.flags = SSL_Enabled;
4013                         sslset.checksum = (yyvsp[0].string);
4014                         if (cleanup_hash_string(sslset.checksum) != 32)
4015                                 yyerror2("Unknown checksum type: [%s] is not MD5", sslset.checksum);
4016                         sslset.checksumType = Hash_Md5;
4017                   }
4018 #line 4019 "src/y.tab.c"
4019     break;
4020 
4021   case 270:
4022 #line 897 "src/p.y"
4023                                                                         {
4024                         sslset.flags = SSL_Enabled;
4025                         sslset.checksum = (yyvsp[0].string);
4026                         if (cleanup_hash_string(sslset.checksum) != 40)
4027                                 yyerror2("Unknown checksum type: [%s] is not SHA1", sslset.checksum);
4028                         sslset.checksumType = Hash_Sha1;
4029                   }
4030 #line 4031 "src/y.tab.c"
4031     break;
4032 
4033   case 275:
4034 #line 914 "src/p.y"
4035                         {
4036 #if defined OPENSSL_NO_SSL2 || ! defined HAVE_SSLV2 || ! defined HAVE_OPENSSL
4037                         yyerror("Your SSL Library does not support SSL version 2");
4038 #else
4039                         _setSSLVersion(SSL_V2);
4040 #endif
4041                   }
4042 #line 4043 "src/y.tab.c"
4043     break;
4044 
4045   case 276:
4046 #line 921 "src/p.y"
4047                           {
4048                         _unsetSSLVersion(SSL_V2);
4049                   }
4050 #line 4051 "src/y.tab.c"
4051     break;
4052 
4053   case 277:
4054 #line 924 "src/p.y"
4055                         {
4056 #if defined OPENSSL_NO_SSL3 || ! defined HAVE_OPENSSL
4057                         yyerror("Your SSL Library does not support SSL version 3");
4058 #else
4059                         _setSSLVersion(SSL_V3);
4060 #endif
4061                   }
4062 #line 4063 "src/y.tab.c"
4063     break;
4064 
4065   case 278:
4066 #line 931 "src/p.y"
4067                           {
4068                         _unsetSSLVersion(SSL_V3);
4069                   }
4070 #line 4071 "src/y.tab.c"
4071     break;
4072 
4073   case 279:
4074 #line 934 "src/p.y"
4075                         {
4076 #if defined OPENSSL_NO_TLS1_METHOD || ! defined HAVE_OPENSSL
4077                         yyerror("Your SSL Library does not support TLS version 1.0");
4078 #else
4079                         _setSSLVersion(SSL_TLSV1);
4080 #endif
4081                   }
4082 #line 4083 "src/y.tab.c"
4083     break;
4084 
4085   case 280:
4086 #line 941 "src/p.y"
4087                           {
4088                         _unsetSSLVersion(SSL_TLSV1);
4089                   }
4090 #line 4091 "src/y.tab.c"
4091     break;
4092 
4093   case 281:
4094 #line 944 "src/p.y"
4095                          {
4096 #if defined OPENSSL_NO_TLS1_1_METHOD || ! defined HAVE_TLSV1_1 || ! defined HAVE_OPENSSL
4097                         yyerror("Your SSL Library does not support TLS version 1.1");
4098 #else
4099                         _setSSLVersion(SSL_TLSV11);
4100 #endif
4101                 }
4102 #line 4103 "src/y.tab.c"
4103     break;
4104 
4105   case 282:
4106 #line 951 "src/p.y"
4107                            {
4108                         _unsetSSLVersion(SSL_TLSV11);
4109                   }
4110 #line 4111 "src/y.tab.c"
4111     break;
4112 
4113   case 283:
4114 #line 954 "src/p.y"
4115                          {
4116 #if defined OPENSSL_NO_TLS1_2_METHOD || ! defined HAVE_TLSV1_2 || ! defined HAVE_OPENSSL
4117                         yyerror("Your SSL Library does not support TLS version 1.2");
4118 #else
4119                         _setSSLVersion(SSL_TLSV12);
4120 #endif
4121                 }
4122 #line 4123 "src/y.tab.c"
4123     break;
4124 
4125   case 284:
4126 #line 961 "src/p.y"
4127                            {
4128                         _unsetSSLVersion(SSL_TLSV12);
4129                   }
4130 #line 4131 "src/y.tab.c"
4131     break;
4132 
4133   case 285:
4134 #line 964 "src/p.y"
4135                          {
4136 #if defined OPENSSL_NO_TLS1_3_METHOD || ! defined HAVE_TLSV1_3 || ! defined HAVE_OPENSSL
4137                         yyerror("Your SSL Library does not support TLS version 1.3");
4138 #else
4139                         _setSSLVersion(SSL_TLSV13);
4140 #endif
4141                 }
4142 #line 4143 "src/y.tab.c"
4143     break;
4144 
4145   case 286:
4146 #line 971 "src/p.y"
4147                            {
4148                         _unsetSSLVersion(SSL_TLSV13);
4149                   }
4150 #line 4151 "src/y.tab.c"
4151     break;
4152 
4153   case 287:
4154 #line 974 "src/p.y"
4155                        {
4156                         // Enable just TLS 1.2 and 1.3 by default
4157 #if ! defined OPENSSL_NO_TLS1_2_METHOD && defined HAVE_TLSV1_2 && defined HAVE_OPENSSL
4158                         _setSSLVersion(SSL_TLSV12);
4159 #endif
4160 #if ! defined OPENSSL_NO_TLS1_3_METHOD && defined HAVE_TLSV1_3 && defined HAVE_OPENSSL
4161                         _setSSLVersion(SSL_TLSV13);
4162 #endif
4163                   }
4164 #line 4165 "src/y.tab.c"
4165     break;
4166 
4167   case 288:
4168 #line 985 "src/p.y"
4169                                  { // Backward compatibility
4170                         sslset.flags = SSL_Enabled;
4171                         sslset.checksum = (yyvsp[0].string);
4172                         if (cleanup_hash_string(sslset.checksum) != 32)
4173                                 yyerror2("Unknown checksum type: [%s] is not MD5", sslset.checksum);
4174                         sslset.checksumType = Hash_Md5;
4175                   }
4176 #line 4177 "src/y.tab.c"
4177     break;
4178 
4179   case 289:
4180 #line 994 "src/p.y"
4181                                                                     {
4182                         if (((yyvsp[-1].number)) > SMTP_TIMEOUT)
4183                                 Run.mailserver_timeout = (yyvsp[-1].number);
4184                         Run.mail_hostname = (yyvsp[0].string);
4185                   }
4186 #line 4187 "src/y.tab.c"
4187     break;
4188 
4189   case 290:
4190 #line 1001 "src/p.y"
4191                                                           {
4192                         if (mailset.from) {
4193                                 Run.MailFormat.from = mailset.from;
4194                         } else {
4195                                 Run.MailFormat.from = Address_new();
4196                                 Run.MailFormat.from->address = Str_dup(ALERT_FROM);
4197                         }
4198                         if (mailset.replyto)
4199                                 Run.MailFormat.replyto = mailset.replyto;
4200                         Run.MailFormat.subject = mailset.subject ?  mailset.subject : Str_dup(ALERT_SUBJECT);
4201                         Run.MailFormat.message = mailset.message ?  mailset.message : Str_dup(ALERT_MESSAGE);
4202                         reset_mailset();
4203                   }
4204 #line 4205 "src/y.tab.c"
4205     break;
4206 
4207   case 293:
4208 #line 1020 "src/p.y"
4209                                            {
4210                         /* Restore the current text overridden by lookahead */
4211                         FREE(argyytext);
4212                         argyytext = Str_dup((yyvsp[-1].string));
4213 
4214                         mailserverset.host = (yyvsp[-1].string);
4215                         mailserverset.port = PORT_SMTP;
4216                         addmailserver(&mailserverset);
4217                   }
4218 #line 4219 "src/y.tab.c"
4219     break;
4220 
4221   case 294:
4222 #line 1029 "src/p.y"
4223                                                        {
4224                         /* Restore the current text overridden by lookahead */
4225                         FREE(argyytext);
4226                         argyytext = Str_dup((yyvsp[-3].string));
4227 
4228                         mailserverset.host = (yyvsp[-3].string);
4229                         mailserverset.port = (yyvsp[-1].number);
4230                         addmailserver(&mailserverset);
4231                   }
4232 #line 4233 "src/y.tab.c"
4233     break;
4234 
4235   case 297:
4236 #line 1044 "src/p.y"
4237                            {
4238                         mailserverset.username = (yyvsp[0].string);
4239                   }
4240 #line 4241 "src/y.tab.c"
4241     break;
4242 
4243   case 298:
4244 #line 1047 "src/p.y"
4245                            {
4246                         mailserverset.password = (yyvsp[0].string);
4247                   }
4248 #line 4249 "src/y.tab.c"
4249     break;
4250 
4251   case 303:
4252 #line 1056 "src/p.y"
4253                                       {
4254                         if (sslset.flags & SSL_Enabled) {
4255 #ifdef HAVE_OPENSSL
4256                                 if (sslset.pemfile) {
4257                                         if (sslset.pemchain || sslset.pemkey) {
4258                                                 yyerror("SSL server option pemfile and pemchain|pemkey are mutually exclusive");
4259                                         } else if (! file_checkStat(sslset.pemfile, "SSL server PEM file", S_IRWXU | S_IRGRP | S_IXGRP)) {
4260                                                 yyerror("SSL server PEM file permissions check failed");
4261                                         } else {
4262                                                 _setSSLOptions(&(Run.httpd.socket.net.ssl));
4263                                         }
4264                                 } else if (sslset.pemchain && sslset.pemkey) {
4265                                         if (! file_checkStat(sslset.pemkey, "SSL server private key PEM file", S_IRWXU | S_IRGRP | S_IXGRP)) {
4266                                                 yyerror("SSL server private key PEM file permissions check failed");
4267                                         } else {
4268                                                 _setSSLOptions(&(Run.httpd.socket.net.ssl));
4269                                         }
4270                                 } else {
4271                                         yyerror("SSL server PEM file is required (please use ssl pemfile option)");
4272                                 }
4273 #else
4274                                 yyerror("SSL is not supported");
4275 #endif
4276                         }
4277                   }
4278 #line 4279 "src/y.tab.c"
4279     break;
4280 
4281   case 315:
4282 #line 1099 "src/p.y"
4283                                {
4284                         _setPEM(&(sslset.pemfile), (yyvsp[0].string), "SSL server PEM file", true);
4285                   }
4286 #line 4287 "src/y.tab.c"
4287     break;
4288 
4289   case 316:
4290 #line 1105 "src/p.y"
4291                                      {
4292                         _setPEM(&(sslset.clientpemfile), (yyvsp[0].string), "SSL client PEM file", true);
4293                   }
4294 #line 4295 "src/y.tab.c"
4295     break;
4296 
4297   case 317:
4298 #line 1111 "src/p.y"
4299                                          {
4300                         sslset.flags = SSL_Enabled;
4301                         sslset.allowSelfSigned = true;
4302                   }
4303 #line 4304 "src/y.tab.c"
4304     break;
4305 
4306   case 318:
4307 #line 1117 "src/p.y"
4308                               {
4309                         Run.httpd.flags |= Httpd_Net;
4310                         Run.httpd.socket.net.port = (yyvsp[0].number);
4311                   }
4312 #line 4313 "src/y.tab.c"
4313     break;
4314 
4315   case 319:
4316 #line 1123 "src/p.y"
4317                                                         {
4318                         Run.httpd.flags |= Httpd_Unix;
4319                         Run.httpd.socket.unix.path = (yyvsp[-1].string);
4320                   }
4321 #line 4322 "src/y.tab.c"
4322     break;
4323 
4324   case 322:
4325 #line 1133 "src/p.y"
4326                                {
4327                         Run.httpd.flags |= Httpd_UnixUid;
4328                         Run.httpd.socket.unix.uid = get_uid((yyvsp[0].string), 0);
4329                         FREE((yyvsp[0].string));
4330                     }
4331 #line 4332 "src/y.tab.c"
4332     break;
4333 
4334   case 323:
4335 #line 1138 "src/p.y"
4336                                {
4337                         Run.httpd.flags |= Httpd_UnixGid;
4338                         Run.httpd.socket.unix.gid = get_gid((yyvsp[0].string), 0);
4339                         FREE((yyvsp[0].string));
4340                     }
4341 #line 4342 "src/y.tab.c"
4342     break;
4343 
4344   case 324:
4345 #line 1143 "src/p.y"
4346                                {
4347                         Run.httpd.flags |= Httpd_UnixUid;
4348                         Run.httpd.socket.unix.uid = get_uid(NULL, (yyvsp[0].number));
4349                     }
4350 #line 4351 "src/y.tab.c"
4351     break;
4352 
4353   case 325:
4354 #line 1147 "src/p.y"
4355                                {
4356                         Run.httpd.flags |= Httpd_UnixGid;
4357                         Run.httpd.socket.unix.gid = get_gid(NULL, (yyvsp[0].number));
4358                     }
4359 #line 4360 "src/y.tab.c"
4360     break;
4361 
4362   case 326:
4363 #line 1151 "src/p.y"
4364                                       {
4365                         Run.httpd.flags |= Httpd_UnixPermission;
4366                         Run.httpd.socket.unix.permission = check_perm((yyvsp[0].number));
4367                     }
4368 #line 4369 "src/y.tab.c"
4369     break;
4370 
4371   case 331:
4372 #line 1165 "src/p.y"
4373                              {
4374                         Run.httpd.flags |= Httpd_Signature;
4375                   }
4376 #line 4377 "src/y.tab.c"
4377     break;
4378 
4379   case 332:
4380 #line 1168 "src/p.y"
4381                              {
4382                         Run.httpd.flags &= ~Httpd_Signature;
4383                   }
4384 #line 4385 "src/y.tab.c"
4385     break;
4386 
4387   case 333:
4388 #line 1173 "src/p.y"
4389                                  {
4390                         Run.httpd.socket.net.address = (yyvsp[0].string);
4391                   }
4392 #line 4393 "src/y.tab.c"
4393     break;
4394 
4395   case 334:
4396 #line 1178 "src/p.y"
4397                                                  {
4398                         addcredentials((yyvsp[-3].string), (yyvsp[-1].string), Digest_Cleartext, (yyvsp[0].number));
4399                   }
4400 #line 4401 "src/y.tab.c"
4401     break;
4402 
4403   case 335:
4404 #line 1181 "src/p.y"
4405                                            {
4406 #ifdef HAVE_LIBPAM
4407                         addpamauth((yyvsp[-1].string), (yyvsp[0].number));
4408 #else
4409                         yyerror("PAM is not supported");
4410                         FREE((yyvsp[-1].string));
4411 #endif
4412                   }
4413 #line 4414 "src/y.tab.c"
4414     break;
4415 
4416   case 336:
4417 #line 1189 "src/p.y"
4418                              {
4419                         addhtpasswdentry((yyvsp[0].string), NULL, Digest_Cleartext);
4420                         FREE((yyvsp[0].string));
4421                   }
4422 #line 4423 "src/y.tab.c"
4423     break;
4424 
4425   case 337:
4426 #line 1193 "src/p.y"
4427                                        {
4428                         addhtpasswdentry((yyvsp[0].string), NULL, Digest_Cleartext);
4429                         FREE((yyvsp[0].string));
4430                   }
4431 #line 4432 "src/y.tab.c"
4432     break;
4433 
4434   case 338:
4435 #line 1197 "src/p.y"
4436                                      {
4437                         addhtpasswdentry((yyvsp[0].string), NULL, Digest_Md5);
4438                         FREE((yyvsp[0].string));
4439                   }
4440 #line 4441 "src/y.tab.c"
4441     break;
4442 
4443   case 339:
4444 #line 1201 "src/p.y"
4445                                    {
4446                         addhtpasswdentry((yyvsp[0].string), NULL, Digest_Crypt);
4447                         FREE((yyvsp[0].string));
4448                   }
4449 #line 4450 "src/y.tab.c"
4450     break;
4451 
4452   case 340:
4453 #line 1205 "src/p.y"
4454                              {
4455                         htpasswd_file = (yyvsp[0].string);
4456                         digesttype = Digest_Cleartext;
4457                   }
4458 #line 4459 "src/y.tab.c"
4459     break;
4460 
4461   case 341:
4462 #line 1209 "src/p.y"
4463                                 {
4464                         FREE(htpasswd_file);
4465                   }
4466 #line 4467 "src/y.tab.c"
4467     break;
4468 
4469   case 342:
4470 #line 1212 "src/p.y"
4471                                        {
4472                         htpasswd_file = (yyvsp[0].string);
4473                         digesttype = Digest_Cleartext;
4474                   }
4475 #line 4476 "src/y.tab.c"
4476     break;
4477 
4478   case 343:
4479 #line 1216 "src/p.y"
4480                                 {
4481                         FREE(htpasswd_file);
4482                   }
4483 #line 4484 "src/y.tab.c"
4484     break;
4485 
4486   case 344:
4487 #line 1219 "src/p.y"
4488                                      {
4489                         htpasswd_file = (yyvsp[0].string);
4490                         digesttype = Digest_Md5;
4491                   }
4492 #line 4493 "src/y.tab.c"
4493     break;
4494 
4495   case 345:
4496 #line 1223 "src/p.y"
4497                                 {
4498                         FREE(htpasswd_file);
4499                   }
4500 #line 4501 "src/y.tab.c"
4501     break;
4502 
4503   case 346:
4504 #line 1226 "src/p.y"
4505                                    {
4506                         htpasswd_file = (yyvsp[0].string);
4507                         digesttype = Digest_Crypt;
4508                   }
4509 #line 4510 "src/y.tab.c"
4510     break;
4511 
4512   case 347:
4513 #line 1230 "src/p.y"
4514                                 {
4515                         FREE(htpasswd_file);
4516                   }
4517 #line 4518 "src/y.tab.c"
4518     break;
4519 
4520   case 348:
4521 #line 1233 "src/p.y"
4522                                {
4523                         if (! Engine_addAllow((yyvsp[0].string)))
4524                                 yywarning2("invalid allow option: %s", (yyvsp[0].string));
4525                         FREE((yyvsp[0].string));
4526                   }
4527 #line 4528 "src/y.tab.c"
4528     break;
4529 
4530   case 351:
4531 #line 1244 "src/p.y"
4532                          {
4533                         addhtpasswdentry(htpasswd_file, (yyvsp[0].string), digesttype);
4534                         FREE((yyvsp[0].string));
4535                   }
4536 #line 4537 "src/y.tab.c"
4537     break;
4538 
4539   case 352:
4540 #line 1250 "src/p.y"
4541                               {
4542                         (yyval.number) = false;
4543                   }
4544 #line 4545 "src/y.tab.c"
4545     break;
4546 
4547   case 353:
4548 #line 1253 "src/p.y"
4549                            {
4550                         (yyval.number) = true;
4551                   }
4552 #line 4553 "src/y.tab.c"
4553     break;
4554 
4555   case 354:
4556 #line 1258 "src/p.y"
4557                                                      {
4558                         createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process);
4559                   }
4560 #line 4561 "src/y.tab.c"
4561     break;
4562 
4563   case 355:
4564 #line 1261 "src/p.y"
4565                                                      {
4566                         createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process);
4567                   }
4568 #line 4569 "src/y.tab.c"
4569     break;
4570 
4571   case 356:
4572 #line 1264 "src/p.y"
4573                                                      {
4574                         createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process);
4575                         matchset.ignore = false;
4576                         matchset.match_path = NULL;
4577                         matchset.match_string = Str_dup((yyvsp[0].string));
4578                         addmatch(&matchset, Action_Ignored, 0);
4579                   }
4580 #line 4581 "src/y.tab.c"
4581     break;
4582 
4583   case 357:
4584 #line 1271 "src/p.y"
4585                                                    {
4586                         createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process);
4587                         matchset.ignore = false;
4588                         matchset.match_path = NULL;
4589                         matchset.match_string = Str_dup((yyvsp[0].string));
4590                         addmatch(&matchset, Action_Ignored, 0);
4591                   }
4592 #line 4593 "src/y.tab.c"
4593     break;
4594 
4595   case 358:
4596 #line 1280 "src/p.y"
4597                                                      {
4598                         createservice(Service_File, (yyvsp[-2].string), (yyvsp[0].string), check_file);
4599                   }
4600 #line 4601 "src/y.tab.c"
4601     break;
4602 
4603   case 359:
4604 #line 1285 "src/p.y"
4605                                                         {
4606                         createservice(Service_Filesystem, (yyvsp[-2].string), (yyvsp[0].string), check_filesystem);
4607                   }
4608 #line 4609 "src/y.tab.c"
4609     break;
4610 
4611   case 360:
4612 #line 1288 "src/p.y"
4613                                                           {
4614                         createservice(Service_Filesystem, (yyvsp[-2].string), (yyvsp[0].string), check_filesystem);
4615                   }
4616 #line 4617 "src/y.tab.c"
4617     break;
4618 
4619   case 361:
4620 #line 1293 "src/p.y"
4621                                                     {
4622                         createservice(Service_Directory, (yyvsp[-2].string), (yyvsp[0].string), check_directory);
4623                   }
4624 #line 4625 "src/y.tab.c"
4625     break;
4626 
4627   case 362:
4628 #line 1298 "src/p.y"
4629                                                        {
4630                         createservice(Service_Host, (yyvsp[-2].string), (yyvsp[0].string), check_remote_host);
4631                   }
4632 #line 4633 "src/y.tab.c"
4633     break;
4634 
4635   case 363:
4636 #line 1303 "src/p.y"
4637                                                       {
4638                         if (Link_isGetByAddressSupported()) {
4639                                 createservice(Service_Net, (yyvsp[-2].string), (yyvsp[0].string), check_net);
4640                                 current->inf.net->stats = Link_createForAddress((yyvsp[0].string));
4641                         } else {
4642                                 yyerror("Network monitoring by IP address is not supported on this platform, please use 'check network <foo> with interface <bar>' instead");
4643                         }
4644                   }
4645 #line 4646 "src/y.tab.c"
4646     break;
4647 
4648   case 364:
4649 #line 1311 "src/p.y"
4650                                                         {
4651                         createservice(Service_Net, (yyvsp[-2].string), (yyvsp[0].string), check_net);
4652                         current->inf.net->stats = Link_createForInterface((yyvsp[0].string));
4653                   }
4654 #line 4655 "src/y.tab.c"
4655     break;
4656 
4657   case 365:
4658 #line 1317 "src/p.y"
4659                                           {
4660                         char *servicename = (yyvsp[0].string);
4661                         if (Str_sub(servicename, "$HOST")) {
4662                                 char hostname[STRLEN];
4663                                 if (gethostname(hostname, sizeof(hostname))) {
4664                                         Log_error("System hostname error -- %s\n", STRERROR);
4665                                         cfg_errflag++;
4666                                 } else {
4667                                         Util_replaceString(&servicename, "$HOST", hostname);
4668                                 }
4669                         }
4670                         Run.system = createservice(Service_System, servicename, NULL, check_system); // The name given in the 'check system' statement overrides system hostname
4671                   }
4672 #line 4673 "src/y.tab.c"
4673     break;
4674 
4675   case 366:
4676 #line 1332 "src/p.y"
4677                                                      {
4678                         createservice(Service_Fifo, (yyvsp[-2].string), (yyvsp[0].string), check_fifo);
4679                   }
4680 #line 4681 "src/y.tab.c"
4681     break;
4682 
4683   case 367:
4684 #line 1337 "src/p.y"
4685                                                                                {
4686                         createservice(Service_Program, (yyvsp[-3].string), NULL, check_program);
4687                         current->program->timeout = (yyvsp[0].number);
4688                         current->program->lastOutput = StringBuffer_create(64);
4689                         current->program->inprogressOutput = StringBuffer_create(64);
4690                  }
4691 #line 4692 "src/y.tab.c"
4692     break;
4693 
4694   case 368:
4695 #line 1343 "src/p.y"
4696                                                                                               {
4697                         createservice(Service_Program, (yyvsp[-4].string), NULL, check_program);
4698                         current->program->timeout = (yyvsp[0].number);
4699                         current->program->lastOutput = StringBuffer_create(64);
4700                         current->program->inprogressOutput = StringBuffer_create(64);
4701                  }
4702 #line 4703 "src/y.tab.c"
4703     break;
4704 
4705   case 369:
4706 #line 1351 "src/p.y"
4707                                                   {
4708                         addcommand(START, (yyvsp[0].number));
4709                   }
4710 #line 4711 "src/y.tab.c"
4711     break;
4712 
4713   case 370:
4714 #line 1354 "src/p.y"
4715                                                                  {
4716                         addcommand(START, (yyvsp[0].number));
4717                   }
4718 #line 4719 "src/y.tab.c"
4719     break;
4720 
4721   case 371:
4722 #line 1359 "src/p.y"
4723                                                 {
4724                         addcommand(STOP, (yyvsp[0].number));
4725                   }
4726 #line 4727 "src/y.tab.c"
4727     break;
4728 
4729   case 372:
4730 #line 1362 "src/p.y"
4731                                                                {
4732                         addcommand(STOP, (yyvsp[0].number));
4733                   }
4734 #line 4735 "src/y.tab.c"
4735     break;
4736 
4737   case 373:
4738 #line 1368 "src/p.y"
4739                                                       {
4740                         addcommand(RESTART, (yyvsp[0].number));
4741                   }
4742 #line 4743 "src/y.tab.c"
4743     break;
4744 
4745   case 374:
4746 #line 1371 "src/p.y"
4747                                                                      {
4748                         addcommand(RESTART, (yyvsp[0].number));
4749                   }
4750 #line 4751 "src/y.tab.c"
4751     break;
4752 
4753   case 379:
4754 #line 1384 "src/p.y"
4755                          {
4756                         addargument((yyvsp[0].string));
4757                   }
4758 #line 4759 "src/y.tab.c"
4759     break;
4760 
4761   case 380:
4762 #line 1387 "src/p.y"
4763                        {
4764                         addargument((yyvsp[0].string));
4765                   }
4766 #line 4767 "src/y.tab.c"
4767     break;
4768 
4769   case 381:
4770 #line 1392 "src/p.y"
4771                              {
4772                         addeuid(get_uid((yyvsp[0].string), 0));
4773                         FREE((yyvsp[0].string));
4774                   }
4775 #line 4776 "src/y.tab.c"
4776     break;
4777 
4778   case 382:
4779 #line 1396 "src/p.y"
4780                              {
4781                         addegid(get_gid((yyvsp[0].string), 0));
4782                         FREE((yyvsp[0].string));
4783                   }
4784 #line 4785 "src/y.tab.c"
4785     break;
4786 
4787   case 383:
4788 #line 1400 "src/p.y"
4789                              {
4790                         addeuid(get_uid(NULL, (yyvsp[0].number)));
4791                   }
4792 #line 4793 "src/y.tab.c"
4793     break;
4794 
4795   case 384:
4796 #line 1403 "src/p.y"
4797                              {
4798                         addegid(get_gid(NULL, (yyvsp[0].number)));
4799                   }
4800 #line 4801 "src/y.tab.c"
4801     break;
4802 
4803   case 385:
4804 #line 1408 "src/p.y"
4805                                     {
4806                         (yyval.string) = (yyvsp[0].string);
4807                   }
4808 #line 4809 "src/y.tab.c"
4809     break;
4810 
4811   case 386:
4812 #line 1411 "src/p.y"
4813                                   {
4814                         (yyval.string) = (yyvsp[0].string);
4815                   }
4816 #line 4817 "src/y.tab.c"
4817     break;
4818 
4819   case 387:
4820 #line 1416 "src/p.y"
4821                                   {
4822                         (yyval.string) = (yyvsp[0].string);
4823                   }
4824 #line 4825 "src/y.tab.c"
4825     break;
4826 
4827   case 388:
4828 #line 1421 "src/p.y"
4829                                   {
4830                         (yyval.string) = (yyvsp[0].string);
4831                   }
4832 #line 4833 "src/y.tab.c"
4833     break;
4834 
4835   case 389:
4836 #line 1426 "src/p.y"
4837                                   {
4838                         (yyval.string) = NULL;
4839                   }
4840 #line 4841 "src/y.tab.c"
4841     break;
4842 
4843   case 390:
4844 #line 1429 "src/p.y"
4845                                   {
4846                         (yyval.string) = (yyvsp[0].string);
4847                   }
4848 #line 4849 "src/y.tab.c"
4849     break;
4850 
4851   case 391:
4852 #line 1434 "src/p.y"
4853                                                                                             {
4854                         /* This is a workaround to support content match without having to create an URL object. 'urloption' creates the Request_T object we need minus the URL object, but with enough information to perform content test.
4855                            TODO: Parser is in need of refactoring */
4856                         portset.url_request = urlrequest;
4857                         portset.check_invers = false;
4858                         portset.responsetime.operator = responsetimeset.operator;
4859                         portset.responsetime.limit = responsetimeset.limit;
4860                         addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number));
4861                         addport(&(current->portlist), &portset);
4862                   }
4863 #line 4864 "src/y.tab.c"
4864     break;
4865 
4866   case 392:
4867 #line 1444 "src/p.y"
4868                                                                                                {
4869                         portset.url_request = urlrequest;
4870                         portset.check_invers = true;
4871                         portset.responsetime.operator = responsetimeset.operator;
4872                         portset.responsetime.limit = responsetimeset.limit;
4873                         addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number));
4874                         addport(&(current->portlist), &portset);
4875                   }
4876 #line 4877 "src/y.tab.c"
4877     break;
4878 
4879   case 407:
4880 #line 1472 "src/p.y"
4881                                                                                                    {
4882                         portset.check_invers = false;
4883                         portset.responsetime.operator = responsetimeset.operator;
4884                         portset.responsetime.limit = responsetimeset.limit;
4885                         prepare_urlrequest((yyvsp[-5].url));
4886                         addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number));
4887                         addport(&(current->portlist), &portset);
4888                   }
4889 #line 4890 "src/y.tab.c"
4890     break;
4891 
4892   case 408:
4893 #line 1480 "src/p.y"
4894                                                                                                       {
4895                         portset.check_invers = true;
4896                         portset.responsetime.operator = responsetimeset.operator;
4897                         portset.responsetime.limit = responsetimeset.limit;
4898                         prepare_urlrequest((yyvsp[-5].url));
4899                         addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number));
4900                         addport(&(current->portlist), &portset);
4901                   }
4902 #line 4903 "src/y.tab.c"
4903     break;
4904 
4905   case 417:
4906 #line 1502 "src/p.y"
4907                                                                                                {
4908                         portset.check_invers = false;
4909                         portset.responsetime.operator = responsetimeset.operator;
4910                         portset.responsetime.limit = responsetimeset.limit;
4911                         addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number));
4912                         addport(&(current->socketlist), &portset);
4913                   }
4914 #line 4915 "src/y.tab.c"
4915     break;
4916 
4917   case 418:
4918 #line 1509 "src/p.y"
4919                                                                                                   {
4920                         portset.check_invers = true;
4921                         portset.responsetime.operator = responsetimeset.operator;
4922                         portset.responsetime.limit = responsetimeset.limit;
4923                         addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number));
4924                         addport(&(current->socketlist), &portset);
4925                   }
4926 #line 4927 "src/y.tab.c"
4927     break;
4928 
4929   case 427:
4930 #line 1530 "src/p.y"
4931                                                                                           {
4932                         icmpset.family = Socket_Ip;
4933                         icmpset.check_invers = false;
4934                         icmpset.type = (yyvsp[-5].number);
4935                         icmpset.responsetime.operator = responsetimeset.operator;
4936                         icmpset.responsetime.limit = responsetimeset.limit;
4937                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
4938                         addicmp(&icmpset);
4939                   }
4940 #line 4941 "src/y.tab.c"
4941     break;
4942 
4943   case 428:
4944 #line 1539 "src/p.y"
4945                                                                                  {
4946                         icmpset.family = Socket_Ip;
4947                         icmpset.check_invers = false;
4948                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
4949                         addicmp(&icmpset);
4950                  }
4951 #line 4952 "src/y.tab.c"
4952     break;
4953 
4954   case 429:
4955 #line 1545 "src/p.y"
4956                                                                                   {
4957                         icmpset.family = Socket_Ip4;
4958                         icmpset.check_invers = false;
4959                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
4960                         addicmp(&icmpset);
4961                  }
4962 #line 4963 "src/y.tab.c"
4963     break;
4964 
4965   case 430:
4966 #line 1551 "src/p.y"
4967                                                                                   {
4968                         icmpset.family = Socket_Ip6;
4969                         icmpset.check_invers = false;
4970                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
4971                         addicmp(&icmpset);
4972                  }
4973 #line 4974 "src/y.tab.c"
4974     break;
4975 
4976   case 431:
4977 #line 1557 "src/p.y"
4978                                                                                              {
4979                         icmpset.family = Socket_Ip;
4980                         icmpset.check_invers = true;
4981                         icmpset.type = (yyvsp[-5].number);
4982                         icmpset.responsetime.operator = responsetimeset.operator;
4983                         icmpset.responsetime.limit = responsetimeset.limit;
4984                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
4985                         addicmp(&icmpset);
4986                   }
4987 #line 4988 "src/y.tab.c"
4988     break;
4989 
4990   case 432:
4991 #line 1566 "src/p.y"
4992                                                                                     {
4993                         icmpset.family = Socket_Ip;
4994                         icmpset.check_invers = true;
4995                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
4996                         addicmp(&icmpset);
4997                  }
4998 #line 4999 "src/y.tab.c"
4999     break;
5000 
5001   case 433:
5002 #line 1572 "src/p.y"
5003                                                                                      {
5004                         icmpset.family = Socket_Ip4;
5005                         icmpset.check_invers = true;
5006                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
5007                         addicmp(&icmpset);
5008                  }
5009 #line 5010 "src/y.tab.c"
5010     break;
5011 
5012   case 434:
5013 #line 1578 "src/p.y"
5014                                                                                      {
5015                         icmpset.family = Socket_Ip6;
5016                         icmpset.check_invers = true;
5017                         addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number));
5018                         addicmp(&icmpset);
5019                  }
5020 #line 5021 "src/y.tab.c"
5021     break;
5022 
5023   case 441:
5024 #line 1596 "src/p.y"
5025                               {
5026                         portset.hostname = Str_dup(current->type == Service_Host ? current->path : LOCALHOST);
5027                   }
5028 #line 5029 "src/y.tab.c"
5029     break;
5030 
5031   case 442:
5032 #line 1599 "src/p.y"
5033                               {
5034                         portset.hostname = (yyvsp[0].string);
5035                   }
5036 #line 5037 "src/y.tab.c"
5037     break;
5038 
5039   case 443:
5040 #line 1604 "src/p.y"
5041                               {
5042                         portset.target.net.port = (yyvsp[0].number);
5043                   }
5044 #line 5045 "src/y.tab.c"
5045     break;
5046 
5047   case 444:
5048 #line 1609 "src/p.y"
5049                                   {
5050                         portset.family = Socket_Unix;
5051                         portset.target.unix.pathname = (yyvsp[0].string);
5052                   }
5053 #line 5054 "src/y.tab.c"
5054     break;
5055 
5056   case 445:
5057 #line 1615 "src/p.y"
5058                        {
5059                         portset.family = Socket_Ip4;
5060                   }
5061 #line 5062 "src/y.tab.c"
5062     break;
5063 
5064   case 446:
5065 #line 1618 "src/p.y"
5066                        {
5067                         portset.family = Socket_Ip6;
5068                   }
5069 #line 5070 "src/y.tab.c"
5070     break;
5071 
5072   case 447:
5073 #line 1623 "src/p.y"
5074                            {
5075                         portset.type = Socket_Tcp;
5076                   }
5077 #line 5078 "src/y.tab.c"
5078     break;
5079 
5080   case 448:
5081 #line 1626 "src/p.y"
5082                                           { // The typelist is kept for backward compatibility (replaced by ssloptionlist)
5083                         portset.type = Socket_Tcp;
5084                         sslset.flags = SSL_Enabled;
5085                   }
5086 #line 5087 "src/y.tab.c"
5087     break;
5088 
5089   case 449:
5090 #line 1630 "src/p.y"
5091                            {
5092                         portset.type = Socket_Udp;
5093                   }
5094 #line 5095 "src/y.tab.c"
5095     break;
5096 
5097   case 454:
5098 #line 1643 "src/p.y"
5099                                  {
5100                         _parseOutgoingAddress((yyvsp[0].string), &(portset.outgoing));
5101                   }
5102 #line 5103 "src/y.tab.c"
5103     break;
5104 
5105   case 455:
5106 #line 1648 "src/p.y"
5107                                                          {
5108                         portset.protocol = Protocol_get(Protocol_APACHESTATUS);
5109                   }
5110 #line 5111 "src/y.tab.c"
5111     break;
5112 
5113   case 456:
5114 #line 1651 "src/p.y"
5115                                   {
5116                         portset.protocol = Protocol_get(Protocol_CLAMAV);
5117                   }
5118 #line 5119 "src/y.tab.c"
5119     break;
5120 
5121   case 457:
5122 #line 1654 "src/p.y"
5123                                    {
5124                         portset.protocol = Protocol_get(Protocol_DEFAULT);
5125                   }
5126 #line 5127 "src/y.tab.c"
5127     break;
5128 
5129   case 458:
5130 #line 1657 "src/p.y"
5131                                {
5132                         portset.protocol = Protocol_get(Protocol_DNS);
5133                   }
5134 #line 5135 "src/y.tab.c"
5135     break;
5136 
5137   case 459:
5138 #line 1660 "src/p.y"
5139                                 {
5140                         portset.protocol = Protocol_get(Protocol_DWP);
5141                   }
5142 #line 5143 "src/y.tab.c"
5143     break;
5144 
5145   case 460:
5146 #line 1663 "src/p.y"
5147                                     {
5148                         portset.protocol = Protocol_get(Protocol_FAIL2BAN);
5149                 }
5150 #line 5151 "src/y.tab.c"
5151     break;
5152 
5153   case 461:
5154 #line 1666 "src/p.y"
5155                                {
5156                         portset.protocol = Protocol_get(Protocol_FTP);
5157                   }
5158 #line 5159 "src/y.tab.c"
5159     break;
5160 
5161   case 462:
5162 #line 1669 "src/p.y"
5163                                {
5164                         portset.protocol = Protocol_get(Protocol_GPS);
5165                   }
5166 #line 5167 "src/y.tab.c"
5167     break;
5168 
5169   case 463:
5170 #line 1672 "src/p.y"
5171                                          {
5172                         portset.protocol = Protocol_get(Protocol_HTTP);
5173                   }
5174 #line 5175 "src/y.tab.c"
5175     break;
5176 
5177   case 464:
5178 #line 1675 "src/p.y"
5179                                           {
5180                         sslset.flags = SSL_Enabled;
5181                         portset.type = Socket_Tcp;
5182                         portset.protocol = Protocol_get(Protocol_HTTP);
5183                  }
5184 #line 5185 "src/y.tab.c"
5185     break;
5186 
5187   case 465:
5188 #line 1680 "src/p.y"
5189                                 {
5190                         portset.protocol = Protocol_get(Protocol_IMAP);
5191                   }
5192 #line 5193 "src/y.tab.c"
5193     break;
5194 
5195   case 466:
5196 #line 1683 "src/p.y"
5197                                  {
5198                         sslset.flags = SSL_Enabled;
5199                         portset.type = Socket_Tcp;
5200                         portset.protocol = Protocol_get(Protocol_IMAP);
5201                   }
5202 #line 5203 "src/y.tab.c"
5203     break;
5204 
5205   case 467:
5206 #line 1688 "src/p.y"
5207                                  {
5208                         portset.protocol = Protocol_get(Protocol_LDAP2);
5209                   }
5210 #line 5211 "src/y.tab.c"
5211     break;
5212 
5213   case 468:
5214 #line 1691 "src/p.y"
5215                                  {
5216                         portset.protocol = Protocol_get(Protocol_LDAP3);
5217                   }
5218 #line 5219 "src/y.tab.c"
5219     break;
5220 
5221   case 469:
5222 #line 1694 "src/p.y"
5223                                 {
5224                         portset.protocol = Protocol_get(Protocol_LMTP);
5225                   }
5226 #line 5227 "src/y.tab.c"
5227     break;
5228 
5229   case 470:
5230 #line 1697 "src/p.y"
5231                                     {
5232                         portset.protocol = Protocol_get(Protocol_MEMCACHE);
5233                   }
5234 #line 5235 "src/y.tab.c"
5235     break;
5236 
5237   case 471:
5238 #line 1700 "src/p.y"
5239                                     {
5240                         portset.protocol = Protocol_get(Protocol_MONGODB);
5241                   }
5242 #line 5243 "src/y.tab.c"
5243     break;
5244 
5245   case 472:
5246 #line 1703 "src/p.y"
5247                                          {
5248                         portset.protocol = Protocol_get(Protocol_MQTT);
5249                   }
5250 #line 5251 "src/y.tab.c"
5251     break;
5252 
5253   case 473:
5254 #line 1706 "src/p.y"
5255                                            {
5256                         portset.protocol = Protocol_get(Protocol_MYSQL);
5257                   }
5258 #line 5259 "src/y.tab.c"
5259     break;
5260 
5261   case 474:
5262 #line 1709 "src/p.y"
5263                                             {
5264                         sslset.flags = SSL_StartTLS;
5265                         portset.protocol = Protocol_get(Protocol_MYSQL);
5266                   }
5267 #line 5268 "src/y.tab.c"
5268     break;
5269 
5270   case 475:
5271 #line 1713 "src/p.y"
5272                                 {
5273                         portset.protocol = Protocol_get(Protocol_NNTP);
5274                   }
5275 #line 5276 "src/y.tab.c"
5276     break;
5277 
5278   case 476:
5279 #line 1716 "src/p.y"
5280                                  {
5281                         portset.protocol = Protocol_get(Protocol_NTP3);
5282                         portset.type = Socket_Udp;
5283                   }
5284 #line 5285 "src/y.tab.c"
5285     break;
5286 
5287   case 477:
5288 #line 1720 "src/p.y"
5289                                                 {
5290                         portset.protocol = Protocol_get(Protocol_PGSQL);
5291                   }
5292 #line 5293 "src/y.tab.c"
5293     break;
5294 
5295   case 478:
5296 #line 1723 "src/p.y"
5297                                {
5298                         portset.protocol = Protocol_get(Protocol_POP);
5299                   }
5300 #line 5301 "src/y.tab.c"
5301     break;
5302 
5303   case 479:
5304 #line 1726 "src/p.y"
5305                                 {
5306                         sslset.flags = SSL_Enabled;
5307                         portset.type = Socket_Tcp;
5308                         portset.protocol = Protocol_get(Protocol_POP);
5309                   }
5310 #line 5311 "src/y.tab.c"
5311     break;
5312 
5313   case 480:
5314 #line 1731 "src/p.y"
5315                                          {
5316                         portset.protocol = Protocol_get(Protocol_POSTFIXPOLICY);
5317                   }
5318 #line 5319 "src/y.tab.c"
5319     break;
5320 
5321   case 481:
5322 #line 1734 "src/p.y"
5323                                              {
5324                         portset.protocol = Protocol_get(Protocol_RADIUS);
5325                   }
5326 #line 5327 "src/y.tab.c"
5327     break;
5328 
5329   case 482:
5330 #line 1737 "src/p.y"
5331                                  {
5332                         portset.protocol = Protocol_get(Protocol_RDATE);
5333                   }
5334 #line 5335 "src/y.tab.c"
5335     break;
5336 
5337   case 483:
5338 #line 1740 "src/p.y"
5339                                   {
5340                         portset.protocol = Protocol_get(Protocol_REDIS);
5341                   }
5342 #line 5343 "src/y.tab.c"
5343     break;
5344 
5345   case 484:
5346 #line 1743 "src/p.y"
5347                                  {
5348                         portset.protocol = Protocol_get(Protocol_RSYNC);
5349                   }
5350 #line 5351 "src/y.tab.c"
5351     break;
5352 
5353   case 485:
5354 #line 1746 "src/p.y"
5355                                  {
5356                         portset.protocol = Protocol_get(Protocol_SIEVE);
5357                   }
5358 #line 5359 "src/y.tab.c"
5359     break;
5360 
5361   case 486:
5362 #line 1749 "src/p.y"
5363                                        {
5364                         portset.protocol = Protocol_get(Protocol_SIP);
5365                   }
5366 #line 5367 "src/y.tab.c"
5367     break;
5368 
5369   case 487:
5370 #line 1752 "src/p.y"
5371                                          {
5372                         portset.protocol = Protocol_get(Protocol_SMTP);
5373                   }
5374 #line 5375 "src/y.tab.c"
5375     break;
5376 
5377   case 488:
5378 #line 1755 "src/p.y"
5379                                           {
5380                         sslset.flags = SSL_Enabled;
5381                         portset.type = Socket_Tcp;
5382                         portset.protocol = Protocol_get(Protocol_SMTP);
5383                  }
5384 #line 5385 "src/y.tab.c"
5385     break;
5386 
5387   case 489:
5388 #line 1760 "src/p.y"
5389                                         {
5390                         portset.protocol = Protocol_get(Protocol_SPAMASSASSIN);
5391                   }
5392 #line 5393 "src/y.tab.c"
5393     break;
5394 
5395   case 490:
5396 #line 1763 "src/p.y"
5397                                 {
5398                         portset.protocol = Protocol_get(Protocol_SSH);
5399                   }
5400 #line 5401 "src/y.tab.c"
5401     break;
5402 
5403   case 491:
5404 #line 1766 "src/p.y"
5405                                {
5406                         portset.protocol = Protocol_get(Protocol_TNS);
5407                   }
5408 #line 5409 "src/y.tab.c"
5409     break;
5410 
5411   case 492:
5412 #line 1769 "src/p.y"
5413                                                    {
5414                         portset.protocol = Protocol_get(Protocol_WEBSOCKET);
5415                   }
5416 #line 5417 "src/y.tab.c"
5417     break;
5418 
5419   case 493:
5420 #line 1774 "src/p.y"
5421                               {
5422                         if (portset.protocol->check == check_default || portset.protocol->check == check_generic) {
5423                                 portset.protocol = Protocol_get(Protocol_GENERIC);
5424                                 addgeneric(&portset, (yyvsp[0].string), NULL);
5425                         } else {
5426                                 yyerror("The SEND statement is not allowed in the %s protocol context", portset.protocol->name);
5427                         }
5428                   }
5429 #line 5430 "src/y.tab.c"
5430     break;
5431 
5432   case 494:
5433 #line 1782 "src/p.y"
5434                                 {
5435                         if (portset.protocol->check == check_default || portset.protocol->check == check_generic) {
5436                                 portset.protocol = Protocol_get(Protocol_GENERIC);
5437                                 addgeneric(&portset, NULL, (yyvsp[0].string));
5438                         } else {
5439                                 yyerror("The EXPECT statement is not allowed in the %s protocol context", portset.protocol->name);
5440                         }
5441                   }
5442 #line 5443 "src/y.tab.c"
5443     break;
5444 
5445   case 497:
5446 #line 1796 "src/p.y"
5447                                 {
5448                         portset.parameters.websocket.origin = (yyvsp[0].string);
5449                   }
5450 #line 5451 "src/y.tab.c"
5451     break;
5452 
5453   case 498:
5454 #line 1799 "src/p.y"
5455                                {
5456                         portset.parameters.websocket.request = (yyvsp[0].string);
5457                   }
5458 #line 5459 "src/y.tab.c"
5459     break;
5460 
5461   case 499:
5462 #line 1802 "src/p.y"
5463                               {
5464                         portset.parameters.websocket.host = (yyvsp[0].string);
5465                   }
5466 #line 5467 "src/y.tab.c"
5467     break;
5468 
5469   case 500:
5470 #line 1805 "src/p.y"
5471                                     {
5472                         portset.parameters.websocket.version = (yyvsp[0].number);
5473                   }
5474 #line 5475 "src/y.tab.c"
5475     break;
5476 
5477   case 503:
5478 #line 1814 "src/p.y"
5479                            {
5480                         portset.parameters.smtp.username = (yyvsp[0].string);
5481                   }
5482 #line 5483 "src/y.tab.c"
5483     break;
5484 
5485   case 504:
5486 #line 1817 "src/p.y"
5487                            {
5488                         portset.parameters.smtp.password = (yyvsp[0].string);
5489                   }
5490 #line 5491 "src/y.tab.c"
5491     break;
5492 
5493   case 507:
5494 #line 1826 "src/p.y"
5495                            {
5496                         portset.parameters.mqtt.username = (yyvsp[0].string);
5497                   }
5498 #line 5499 "src/y.tab.c"
5499     break;
5500 
5501   case 508:
5502 #line 1829 "src/p.y"
5503                            {
5504                         portset.parameters.mqtt.password = (yyvsp[0].string);
5505                   }
5506 #line 5507 "src/y.tab.c"
5507     break;
5508 
5509   case 511:
5510 #line 1838 "src/p.y"
5511                            {
5512                         portset.parameters.mysql.username = (yyvsp[0].string);
5513                   }
5514 #line 5515 "src/y.tab.c"
5515     break;
5516 
5517   case 512:
5518 #line 1841 "src/p.y"
5519                            {
5520                         portset.parameters.mysql.password = (yyvsp[0].string);
5521                   }
5522 #line 5523 "src/y.tab.c"
5523     break;
5524 
5525   case 513:
5526 #line 1844 "src/p.y"
5527                                                           {
5528                         portset.parameters.mysql.rsaChecksum = (yyvsp[0].string);
5529                         switch (cleanup_hash_string(portset.parameters.mysql.rsaChecksum)) {
5530                                 case 32:
5531                                         portset.parameters.mysql.rsaChecksumType = Hash_Md5;
5532                                         break;
5533                                 case 40:
5534                                         portset.parameters.mysql.rsaChecksumType = Hash_Sha1;
5535                                         break;
5536                                 default:
5537                                         yyerror2("Unknown checksum type: [%s] is not MD5 nor SHA1", portset.parameters.mysql.rsaChecksum);
5538                         }
5539                   }
5540 #line 5541 "src/y.tab.c"
5541     break;
5542 
5543   case 514:
5544 #line 1857 "src/p.y"
5545                                                                   {
5546                         portset.parameters.mysql.rsaChecksum = (yyvsp[0].string);
5547                         if (cleanup_hash_string(portset.parameters.mysql.rsaChecksum) != 32)
5548                                 yyerror2("Unknown checksum type: [%s] is not MD5", portset.parameters.mysql.rsaChecksum);
5549                         portset.parameters.mysql.rsaChecksumType = Hash_Md5;
5550                   }
5551 #line 5552 "src/y.tab.c"
5552     break;
5553 
5554   case 515:
5555 #line 1863 "src/p.y"
5556                                                                    {
5557                         portset.parameters.mysql.rsaChecksum = (yyvsp[0].string);
5558                         if (cleanup_hash_string(portset.parameters.mysql.rsaChecksum) != 40)
5559                                 yyerror2("Unknown checksum type: [%s] is not SHA1", portset.parameters.mysql.rsaChecksum);
5560                         portset.parameters.mysql.rsaChecksumType = Hash_Sha1;
5561                   }
5562 #line 5563 "src/y.tab.c"
5563     break;
5564 
5565   case 518:
5566 #line 1875 "src/p.y"
5567                            {
5568                         portset.parameters.postgresql.username = (yyvsp[0].string);
5569                   }
5570 #line 5571 "src/y.tab.c"
5571     break;
5572 
5573   case 519:
5574 #line 1878 "src/p.y"
5575                            {
5576                         portset.parameters.postgresql.password = (yyvsp[0].string);
5577                   }
5578 #line 5579 "src/y.tab.c"
5579     break;
5580 
5581   case 520:
5582 #line 1881 "src/p.y"
5583                            {
5584                         portset.parameters.postgresql.database = (yyvsp[0].string);
5585                   }
5586 #line 5587 "src/y.tab.c"
5587     break;
5588 
5589   case 521:
5590 #line 1886 "src/p.y"
5591                                   {
5592                         (yyval.string) = (yyvsp[0].string);
5593                   }
5594 #line 5595 "src/y.tab.c"
5595     break;
5596 
5597   case 522:
5598 #line 1889 "src/p.y"
5599                                 {
5600                         (yyval.string) = (yyvsp[0].string);
5601                   }
5602 #line 5603 "src/y.tab.c"
5603     break;
5604 
5605   case 523:
5606 #line 1894 "src/p.y"
5607                                     {
5608                         (yyval.number) = verifyMaxForward((yyvsp[0].number));
5609                   }
5610 #line 5611 "src/y.tab.c"
5611     break;
5612 
5613   case 526:
5614 #line 1903 "src/p.y"
5615                          {
5616                         portset.parameters.sip.target = (yyvsp[0].string);
5617                   }
5618 #line 5619 "src/y.tab.c"
5619     break;
5620 
5621   case 527:
5622 #line 1906 "src/p.y"
5623                              {
5624                         portset.parameters.sip.maxforward = (yyvsp[0].number);
5625                   }
5626 #line 5627 "src/y.tab.c"
5627     break;
5628 
5629   case 530:
5630 #line 1915 "src/p.y"
5631                            {
5632                         portset.parameters.http.username = (yyvsp[0].string);
5633                   }
5634 #line 5635 "src/y.tab.c"
5635     break;
5636 
5637   case 531:
5638 #line 1918 "src/p.y"
5639                            {
5640                         portset.parameters.http.password = (yyvsp[0].string);
5641                   }
5642 #line 5643 "src/y.tab.c"
5643     break;
5644 
5645   case 538:
5646 #line 1929 "src/p.y"
5647                                          {
5648                         if ((yyvsp[0].number) < 0) {
5649                                 yyerror2("The status value must be greater or equal to 0");
5650                         }
5651                         portset.parameters.http.operator = (yyvsp[-1].number);
5652                         portset.parameters.http.status = (yyvsp[0].number);
5653                         portset.parameters.http.hasStatus = true;
5654                   }
5655 #line 5656 "src/y.tab.c"
5656     break;
5657 
5658   case 539:
5659 #line 1939 "src/p.y"
5660                              {
5661                         portset.parameters.http.method = Http_Get;
5662                   }
5663 #line 5664 "src/y.tab.c"
5664     break;
5665 
5666   case 540:
5667 #line 1942 "src/p.y"
5668                               {
5669                         portset.parameters.http.method = Http_Head;
5670                   }
5671 #line 5672 "src/y.tab.c"
5672     break;
5673 
5674   case 541:
5675 #line 1947 "src/p.y"
5676                                {
5677                         portset.parameters.http.request = Util_urlEncode((yyvsp[0].string), false);
5678                         FREE((yyvsp[0].string));
5679                   }
5680 #line 5681 "src/y.tab.c"
5681     break;
5682 
5683   case 542:
5684 #line 1951 "src/p.y"
5685                                  {
5686                         portset.parameters.http.request = Util_urlEncode((yyvsp[0].string), false);
5687                         FREE((yyvsp[0].string));
5688                   }
5689 #line 5690 "src/y.tab.c"
5690     break;
5691 
5692   case 543:
5693 #line 1957 "src/p.y"
5694                                   {
5695                         portset.parameters.http.checksum = (yyvsp[0].string);
5696                   }
5697 #line 5698 "src/y.tab.c"
5698     break;
5699 
5700   case 544:
5701 #line 1962 "src/p.y"
5702                                     {
5703                         addhttpheader(&portset, Str_cat("Host:%s", (yyvsp[0].string)));
5704                         FREE((yyvsp[0].string));
5705                   }
5706 #line 5707 "src/y.tab.c"
5707     break;
5708 
5709   case 546:
5710 #line 1969 "src/p.y"
5711                                             {
5712                         addhttpheader(&portset, (yyvsp[0].string));
5713                  }
5714 #line 5715 "src/y.tab.c"
5715     break;
5716 
5717   case 547:
5718 #line 1974 "src/p.y"
5719                                 {
5720                         (yyval.string) = (yyvsp[0].string);
5721                   }
5722 #line 5723 "src/y.tab.c"
5723     break;
5724 
5725   case 550:
5726 #line 1983 "src/p.y"
5727                          {
5728                         portset.parameters.radius.secret = (yyvsp[0].string);
5729                   }
5730 #line 5731 "src/y.tab.c"
5731     break;
5732 
5733   case 553:
5734 #line 1992 "src/p.y"
5735                            {
5736                         portset.parameters.apachestatus.username = (yyvsp[0].string);
5737                   }
5738 #line 5739 "src/y.tab.c"
5739     break;
5740 
5741   case 554:
5742 #line 1995 "src/p.y"
5743                            {
5744                         portset.parameters.apachestatus.password = (yyvsp[0].string);
5745                   }
5746 #line 5747 "src/y.tab.c"
5747     break;
5748 
5749   case 555:
5750 #line 1998 "src/p.y"
5751                                {
5752                         portset.parameters.apachestatus.path = (yyvsp[0].string);
5753                   }
5754 #line 5755 "src/y.tab.c"
5755     break;
5756 
5757   case 556:
5758 #line 2001 "src/p.y"
5759                                                    {
5760                         portset.parameters.apachestatus.loglimitOP = (yyvsp[-2].number);
5761                         portset.parameters.apachestatus.loglimit = (yyvsp[-1].number);
5762                   }
5763 #line 5764 "src/y.tab.c"
5764     break;
5765 
5766   case 557:
5767 #line 2005 "src/p.y"
5768                                                      {
5769                         portset.parameters.apachestatus.closelimitOP = (yyvsp[-2].number);
5770                         portset.parameters.apachestatus.closelimit = (yyvsp[-1].number);
5771                   }
5772 #line 5773 "src/y.tab.c"
5773     break;
5774 
5775   case 558:
5776 #line 2009 "src/p.y"
5777                                                    {
5778                         portset.parameters.apachestatus.dnslimitOP = (yyvsp[-2].number);
5779                         portset.parameters.apachestatus.dnslimit = (yyvsp[-1].number);
5780                   }
5781 #line 5782 "src/y.tab.c"
5782     break;
5783 
5784   case 559:
5785 #line 2013 "src/p.y"
5786                                                          {
5787                         portset.parameters.apachestatus.keepalivelimitOP = (yyvsp[-2].number);
5788                         portset.parameters.apachestatus.keepalivelimit = (yyvsp[-1].number);
5789                   }
5790 #line 5791 "src/y.tab.c"
5791     break;
5792 
5793   case 560:
5794 #line 2017 "src/p.y"
5795                                                      {
5796                         portset.parameters.apachestatus.replylimitOP = (yyvsp[-2].number);
5797                         portset.parameters.apachestatus.replylimit = (yyvsp[-1].number);
5798                   }
5799 #line 5800 "src/y.tab.c"
5800     break;
5801 
5802   case 561:
5803 #line 2021 "src/p.y"
5804                                                        {
5805                         portset.parameters.apachestatus.requestlimitOP = (yyvsp[-2].number);
5806                         portset.parameters.apachestatus.requestlimit = (yyvsp[-1].number);
5807                   }
5808 #line 5809 "src/y.tab.c"
5809     break;
5810 
5811   case 562:
5812 #line 2025 "src/p.y"
5813                                                      {
5814                         portset.parameters.apachestatus.startlimitOP = (yyvsp[-2].number);
5815                         portset.parameters.apachestatus.startlimit = (yyvsp[-1].number);
5816                   }
5817 #line 5818 "src/y.tab.c"
5818     break;
5819 
5820   case 563:
5821 #line 2029 "src/p.y"
5822                                                     {
5823                         portset.parameters.apachestatus.waitlimitOP = (yyvsp[-2].number);
5824                         portset.parameters.apachestatus.waitlimit = (yyvsp[-1].number);
5825                   }
5826 #line 5827 "src/y.tab.c"
5827     break;
5828 
5829   case 564:
5830 #line 2033 "src/p.y"
5831                                                         {
5832                         portset.parameters.apachestatus.gracefullimitOP = (yyvsp[-2].number);
5833                         portset.parameters.apachestatus.gracefullimit = (yyvsp[-1].number);
5834                   }
5835 #line 5836 "src/y.tab.c"
5836     break;
5837 
5838   case 565:
5839 #line 2037 "src/p.y"
5840                                                        {
5841                         portset.parameters.apachestatus.cleanuplimitOP = (yyvsp[-2].number);
5842                         portset.parameters.apachestatus.cleanuplimit = (yyvsp[-1].number);
5843                   }
5844 #line 5845 "src/y.tab.c"
5845     break;
5846 
5847   case 566:
5848 #line 2043 "src/p.y"
5849                                                                    {
5850                         addeventaction(&(nonexistset).action, (yyvsp[-1].number), (yyvsp[0].number));
5851                         addnonexist(&nonexistset);
5852                   }
5853 #line 5854 "src/y.tab.c"
5854     break;
5855 
5856   case 567:
5857 #line 2047 "src/p.y"
5858                                                                {
5859                         addeventaction(&(existset).action, (yyvsp[-1].number), (yyvsp[0].number));
5860                         addexist(&existset);
5861                   }
5862 #line 5863 "src/y.tab.c"
5863     break;
5864 
5865   case 568:
5866 #line 2054 "src/p.y"
5867                                                     {
5868                         addeventaction(&(pidset).action, (yyvsp[0].number), Action_Ignored);
5869                         addpid(&pidset);
5870                   }
5871 #line 5872 "src/y.tab.c"
5872     break;
5873 
5874   case 569:
5875 #line 2060 "src/p.y"
5876                                                      {
5877                         addeventaction(&(ppidset).action, (yyvsp[0].number), Action_Ignored);
5878                         addppid(&ppidset);
5879                   }
5880 #line 5881 "src/y.tab.c"
5881     break;
5882 
5883   case 570:
5884 #line 2066 "src/p.y"
5885                                                                                      {
5886                         uptimeset.operator = (yyvsp[-6].number);
5887                         uptimeset.uptime = ((unsigned long long)(yyvsp[-5].number) * (yyvsp[-4].number));
5888                         addeventaction(&(uptimeset).action, (yyvsp[-1].number), (yyvsp[0].number));
5889                         adduptime(&uptimeset);
5890                   }
5891 #line 5892 "src/y.tab.c"
5892     break;
5893 
5894   case 571:
5895 #line 2074 "src/p.y"
5896                                                            {
5897                         responsetimeset.operator = (yyvsp[-2].number);
5898                         responsetimeset.limit = (yyvsp[-1].number);
5899                   }
5900 #line 5901 "src/y.tab.c"
5901     break;
5902 
5903   case 572:
5904 #line 2078 "src/p.y"
5905                                                       {
5906                         responsetimeset.operator = (yyvsp[-2].number);
5907                         responsetimeset.limit = (yyvsp[-1].number) * 1000;
5908                   }
5909 #line 5910 "src/y.tab.c"
5910     break;
5911 
5912   case 573:
5913 #line 2084 "src/p.y"
5914                                {
5915                         icmpset.count = (yyvsp[0].number);
5916                  }
5917 #line 5918 "src/y.tab.c"
5918     break;
5919 
5920   case 574:
5921 #line 2089 "src/p.y"
5922                               {
5923                         icmpset.size = (yyvsp[0].number);
5924                         if (icmpset.size < 8) {
5925                                 yyerror2("The minimum ping size is 8 bytes");
5926                         } else if (icmpset.size > 1492) {
5927                                 yyerror2("The maximum ping size is 1492 bytes");
5928                         }
5929                  }
5930 #line 5931 "src/y.tab.c"
5931     break;
5932 
5933   case 575:
5934 #line 2099 "src/p.y"
5935                                         {
5936                         icmpset.timeout = (yyvsp[-1].number) * 1000; // timeout is in milliseconds internally
5937                     }
5938 #line 5939 "src/y.tab.c"
5939     break;
5940 
5941   case 576:
5942 #line 2104 "src/p.y"
5943                                  {
5944                         _parseOutgoingAddress((yyvsp[0].string), &(icmpset.outgoing));
5945                   }
5946 #line 5947 "src/y.tab.c"
5947     break;
5948 
5949   case 577:
5950 #line 2109 "src/p.y"
5951                               {
5952                         (yyval.number) = Run.limits.stopTimeout;
5953                   }
5954 #line 5955 "src/y.tab.c"
5955     break;
5956 
5957   case 578:
5958 #line 2112 "src/p.y"
5959                                         {
5960                         (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally
5961                   }
5962 #line 5963 "src/y.tab.c"
5963     break;
5964 
5965   case 579:
5966 #line 2117 "src/p.y"
5967                               {
5968                         (yyval.number) = Run.limits.startTimeout;
5969                   }
5970 #line 5971 "src/y.tab.c"
5971     break;
5972 
5973   case 580:
5974 #line 2120 "src/p.y"
5975                                         {
5976                         (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally
5977                   }
5978 #line 5979 "src/y.tab.c"
5979     break;
5980 
5981   case 581:
5982 #line 2125 "src/p.y"
5983                               {
5984                         (yyval.number) = Run.limits.restartTimeout;
5985                   }
5986 #line 5987 "src/y.tab.c"
5987     break;
5988 
5989   case 582:
5990 #line 2128 "src/p.y"
5991                                         {
5992                         (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally
5993                   }
5994 #line 5995 "src/y.tab.c"
5995     break;
5996 
5997   case 583:
5998 #line 2133 "src/p.y"
5999                               {
6000                         (yyval.number) = Run.limits.programTimeout;
6001                   }
6002 #line 6003 "src/y.tab.c"
6003     break;
6004 
6005   case 584:
6006 #line 2136 "src/p.y"
6007                                         {
6008                         (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally
6009                   }
6010 #line 6011 "src/y.tab.c"
6011     break;
6012 
6013   case 585:
6014 #line 2141 "src/p.y"
6015                               {
6016                         (yyval.number) = Run.limits.networkTimeout;
6017                   }
6018 #line 6019 "src/y.tab.c"
6019     break;
6020 
6021   case 586:
6022 #line 2144 "src/p.y"
6023                                         {
6024                         (yyval.number) = (yyvsp[-1].number) * 1000; // net timeout is in milliseconds internally
6025                   }
6026 #line 6027 "src/y.tab.c"
6027     break;
6028 
6029   case 587:
6030 #line 2149 "src/p.y"
6031                                           {
6032                         portset.timeout = (yyvsp[-1].number) * 1000; // timeout is in milliseconds internally
6033                     }
6034 #line 6035 "src/y.tab.c"
6035     break;
6036 
6037   case 588:
6038 #line 2154 "src/p.y"
6039                                {
6040                         portset.retry = (yyvsp[0].number);
6041                   }
6042 #line 6043 "src/y.tab.c"
6043     break;
6044 
6045   case 589:
6046 #line 2159 "src/p.y"
6047                                                               {
6048                         actionrateset.count = (yyvsp[-5].number);
6049                         actionrateset.cycle = (yyvsp[-3].number);
6050                         addeventaction(&(actionrateset).action, (yyvsp[0].number), Action_Alert);
6051                         addactionrate(&actionrateset);
6052                   }
6053 #line 6054 "src/y.tab.c"
6054     break;
6055 
6056   case 590:
6057 #line 2165 "src/p.y"
6058                                                               {
6059                         actionrateset.count = (yyvsp[-5].number);
6060                         actionrateset.cycle = (yyvsp[-3].number);
6061                         addeventaction(&(actionrateset).action, Action_Unmonitor, Action_Alert);
6062                         addactionrate(&actionrateset);
6063                   }
6064 #line 6065 "src/y.tab.c"
6065     break;
6066 
6067   case 591:
6068 #line 2173 "src/p.y"
6069                                              {
6070                         seturlrequest((yyvsp[-1].number), (yyvsp[0].string));
6071                         FREE((yyvsp[0].string));
6072                   }
6073 #line 6074 "src/y.tab.c"
6074     break;
6075 
6076   case 592:
6077 #line 2179 "src/p.y"
6078                            { (yyval.number) = Operator_Equal; }
6079 #line 6080 "src/y.tab.c"
6080     break;
6081 
6082   case 593:
6083 #line 2180 "src/p.y"
6084                            { (yyval.number) = Operator_NotEqual; }
6085 #line 6086 "src/y.tab.c"
6086     break;
6087 
6088   case 594:
6089 #line 2183 "src/p.y"
6090                                                 {
6091                         mailset.events = Event_All;
6092                         addmail((yyvsp[-2].string), &mailset, &current->maillist);
6093                   }
6094 #line 6095 "src/y.tab.c"
6095     break;
6096 
6097   case 595:
6098 #line 2187 "src/p.y"
6099                                                                         {
6100                         addmail((yyvsp[-5].string), &mailset, &current->maillist);
6101                   }
6102 #line 6103 "src/y.tab.c"
6103     break;
6104 
6105   case 596:
6106 #line 2190 "src/p.y"
6107                                                                             {
6108                         mailset.events = ~mailset.events;
6109                         addmail((yyvsp[-6].string), &mailset, &current->maillist);
6110                   }
6111 #line 6112 "src/y.tab.c"
6112     break;
6113 
6114   case 597:
6115 #line 2194 "src/p.y"
6116                               {
6117                         addmail((yyvsp[0].string), &mailset, &current->maillist);
6118                   }
6119 #line 6120 "src/y.tab.c"
6120     break;
6121 
6122   case 598:
6123 #line 2199 "src/p.y"
6124                                  { (yyval.string) = (yyvsp[0].string); }
6125 #line 6126 "src/y.tab.c"
6126     break;
6127 
6128   case 599:
6129 #line 2202 "src/p.y"
6130                                    { (yyval.string) = (yyvsp[0].string); }
6131 #line 6132 "src/y.tab.c"
6132     break;
6133 
6134   case 602:
6135 #line 2209 "src/p.y"
6136                                   { mailset.events |= Event_Action; }
6137 #line 6138 "src/y.tab.c"
6138     break;
6139 
6140   case 603:
6141 #line 2210 "src/p.y"
6142                                   { mailset.events |= Event_ByteIn; }
6143 #line 6144 "src/y.tab.c"
6144     break;
6145 
6146   case 604:
6147 #line 2211 "src/p.y"
6148                                   { mailset.events |= Event_ByteOut; }
6149 #line 6150 "src/y.tab.c"
6150     break;
6151 
6152   case 605:
6153 #line 2212 "src/p.y"
6154                                   { mailset.events |= Event_Checksum; }
6155 #line 6156 "src/y.tab.c"
6156     break;
6157 
6158   case 606:
6159 #line 2213 "src/p.y"
6160                                   { mailset.events |= Event_Connection; }
6161 #line 6162 "src/y.tab.c"
6162     break;
6163 
6164   case 607:
6165 #line 2214 "src/p.y"
6166                                   { mailset.events |= Event_Content; }
6167 #line 6168 "src/y.tab.c"
6168     break;
6169 
6170   case 608:
6171 #line 2215 "src/p.y"
6172                                   { mailset.events |= Event_Data; }
6173 #line 6174 "src/y.tab.c"
6174     break;
6175 
6176   case 609:
6177 #line 2216 "src/p.y"
6178                                   { mailset.events |= Event_Exec; }
6179 #line 6180 "src/y.tab.c"
6180     break;
6181 
6182   case 610:
6183 #line 2217 "src/p.y"
6184                                   { mailset.events |= Event_Exist; }
6185 #line 6186 "src/y.tab.c"
6186     break;
6187 
6188   case 611:
6189 #line 2218 "src/p.y"
6190                                   { mailset.events |= Event_FsFlag; }
6191 #line 6192 "src/y.tab.c"
6192     break;
6193 
6194   case 612:
6195 #line 2219 "src/p.y"
6196                                   { mailset.events |= Event_Gid; }
6197 #line 6198 "src/y.tab.c"
6198     break;
6199 
6200   case 613:
6201 #line 2220 "src/p.y"
6202                                   { mailset.events |= Event_Icmp; }
6203 #line 6204 "src/y.tab.c"
6204     break;
6205 
6206   case 614:
6207 #line 2221 "src/p.y"
6208                                   { mailset.events |= Event_Instance; }
6209 #line 6210 "src/y.tab.c"
6210     break;
6211 
6212   case 615:
6213 #line 2222 "src/p.y"
6214                                   { mailset.events |= Event_Invalid; }
6215 #line 6216 "src/y.tab.c"
6216     break;
6217 
6218   case 616:
6219 #line 2223 "src/p.y"
6220                                   { mailset.events |= Event_Link; }
6221 #line 6222 "src/y.tab.c"
6222     break;
6223 
6224   case 617:
6225 #line 2224 "src/p.y"
6226                                   { mailset.events |= Event_NonExist; }
6227 #line 6228 "src/y.tab.c"
6228     break;
6229 
6230   case 618:
6231 #line 2225 "src/p.y"
6232                                   { mailset.events |= Event_PacketIn; }
6233 #line 6234 "src/y.tab.c"
6234     break;
6235 
6236   case 619:
6237 #line 2226 "src/p.y"
6238                                   { mailset.events |= Event_PacketOut; }
6239 #line 6240 "src/y.tab.c"
6240     break;
6241 
6242   case 620:
6243 #line 2227 "src/p.y"
6244                                   { mailset.events |= Event_Permission; }
6245 #line 6246 "src/y.tab.c"
6246     break;
6247 
6248   case 621:
6249 #line 2228 "src/p.y"
6250                                   { mailset.events |= Event_Pid; }
6251 #line 6252 "src/y.tab.c"
6252     break;
6253 
6254   case 622:
6255 #line 2229 "src/p.y"
6256                                   { mailset.events |= Event_PPid; }
6257 #line 6258 "src/y.tab.c"
6258     break;
6259 
6260   case 623:
6261 #line 2230 "src/p.y"
6262                                   { mailset.events |= Event_Resource; }
6263 #line 6264 "src/y.tab.c"
6264     break;
6265 
6266   case 624:
6267 #line 2231 "src/p.y"
6268                                   { mailset.events |= Event_Saturation; }
6269 #line 6270 "src/y.tab.c"
6270     break;
6271 
6272   case 625:
6273 #line 2232 "src/p.y"
6274                                   { mailset.events |= Event_Size; }
6275 #line 6276 "src/y.tab.c"
6276     break;
6277 
6278   case 626:
6279 #line 2233 "src/p.y"
6280                                   { mailset.events |= Event_Speed; }
6281 #line 6282 "src/y.tab.c"
6282     break;
6283 
6284   case 627:
6285 #line 2234 "src/p.y"
6286                                   { mailset.events |= Event_Status; }
6287 #line 6288 "src/y.tab.c"
6288     break;
6289 
6290   case 628:
6291 #line 2235 "src/p.y"
6292                                   { mailset.events |= Event_Timeout; }
6293 #line 6294 "src/y.tab.c"
6294     break;
6295 
6296   case 629:
6297 #line 2236 "src/p.y"
6298                                   { mailset.events |= Event_Timestamp; }
6299 #line 6300 "src/y.tab.c"
6300     break;
6301 
6302   case 630:
6303 #line 2237 "src/p.y"
6304                                   { mailset.events |= Event_Uid; }
6305 #line 6306 "src/y.tab.c"
6306     break;
6307 
6308   case 631:
6309 #line 2238 "src/p.y"
6310                                   { mailset.events |= Event_Uptime; }
6311 #line 6312 "src/y.tab.c"
6312     break;
6313 
6314   case 636:
6315 #line 2249 "src/p.y"
6316                                          { mailset.from = (yyvsp[-1].address); }
6317 #line 6318 "src/y.tab.c"
6318     break;
6319 
6320   case 637:
6321 #line 2250 "src/p.y"
6322                                             { mailset.replyto = (yyvsp[-1].address); }
6323 #line 6324 "src/y.tab.c"
6324     break;
6325 
6326   case 638:
6327 #line 2251 "src/p.y"
6328                               { mailset.subject = (yyvsp[0].string); }
6329 #line 6330 "src/y.tab.c"
6330     break;
6331 
6332   case 639:
6333 #line 2252 "src/p.y"
6334                            { mailset.message = (yyvsp[0].string); }
6335 #line 6336 "src/y.tab.c"
6336     break;
6337 
6338   case 640:
6339 #line 2255 "src/p.y"
6340                                      {
6341                         _sanityCheckEveryStatement(current);
6342                         current->every.type = Every_SkipCycles;
6343                         current->every.spec.cycle.counter = current->every.spec.cycle.number = (yyvsp[-1].number);
6344                  }
6345 #line 6346 "src/y.tab.c"
6346     break;
6347 
6348   case 641:
6349 #line 2260 "src/p.y"
6350                                  {
6351                         _sanityCheckEveryStatement(current);
6352                         current->every.type = Every_Cron;
6353                         current->every.spec.cron = (yyvsp[0].string);
6354                  }
6355 #line 6356 "src/y.tab.c"
6356     break;
6357 
6358   case 642:
6359 #line 2265 "src/p.y"
6360                                     {
6361                         _sanityCheckEveryStatement(current);
6362                         current->every.type = Every_NotInCron;
6363                         current->every.spec.cron = (yyvsp[0].string);
6364                  }
6365 #line 6366 "src/y.tab.c"
6366     break;
6367 
6368   case 643:
6369 #line 2272 "src/p.y"
6370                               {
6371                         current->mode = Monitor_Active;
6372                   }
6373 #line 6374 "src/y.tab.c"
6374     break;
6375 
6376   case 644:
6377 #line 2275 "src/p.y"
6378                                {
6379                         current->mode = Monitor_Passive;
6380                   }
6381 #line 6382 "src/y.tab.c"
6382     break;
6383 
6384   case 645:
6385 #line 2278 "src/p.y"
6386                               {
6387                         // Deprecated since monit 5.18
6388                         current->onreboot = Onreboot_Laststate;
6389                   }
6390 #line 6391 "src/y.tab.c"
6391     break;
6392 
6393   case 646:
6394 #line 2284 "src/p.y"
6395                                  {
6396                         current->onreboot = Onreboot_Start;
6397                   }
6398 #line 6399 "src/y.tab.c"
6399     break;
6400 
6401   case 647:
6402 #line 2287 "src/p.y"
6403                                    {
6404                         current->onreboot = Onreboot_Nostart;
6405                         current->monitor = Monitor_Not;
6406                   }
6407 #line 6408 "src/y.tab.c"
6408     break;
6409 
6410   case 648:
6411 #line 2291 "src/p.y"
6412                                      {
6413                         current->onreboot = Onreboot_Laststate;
6414                   }
6415 #line 6416 "src/y.tab.c"
6416     break;
6417 
6418   case 649:
6419 #line 2296 "src/p.y"
6420                                    {
6421                         addservicegroup((yyvsp[0].string));
6422                         FREE((yyvsp[0].string));
6423                   }
6424 #line 6425 "src/y.tab.c"
6425     break;
6426 
6427   case 653:
6428 #line 2310 "src/p.y"
6429                               { adddependant((yyvsp[0].string)); }
6430 #line 6431 "src/y.tab.c"
6431     break;
6432 
6433   case 654:
6434 #line 2313 "src/p.y"
6435                                                                                 {
6436                         statusset.initialized = true;
6437                         statusset.operator = (yyvsp[-5].number);
6438                         statusset.return_value = (yyvsp[-4].number);
6439                         addeventaction(&(statusset).action, (yyvsp[-1].number), (yyvsp[0].number));
6440                         addstatus(&statusset);
6441                    }
6442 #line 6443 "src/y.tab.c"
6443     break;
6444 
6445   case 655:
6446 #line 2320 "src/p.y"
6447                                                        {
6448                         statusset.initialized = false;
6449                         statusset.operator = Operator_Changed;
6450                         statusset.return_value = 0;
6451                         addeventaction(&(statusset).action, (yyvsp[0].number), Action_Ignored);
6452                         addstatus(&statusset);
6453                    }
6454 #line 6455 "src/y.tab.c"
6455     break;
6456 
6457   case 656:
6458 #line 2329 "src/p.y"
6459                                                                              {
6460                         addeventaction(&(resourceset).action, (yyvsp[-1].number), (yyvsp[0].number));
6461                         addresource(&resourceset);
6462                    }
6463 #line 6464 "src/y.tab.c"
6464     break;
6465 
6466   case 666:
6467 #line 2348 "src/p.y"
6468                                                                             {
6469                         addeventaction(&(resourceset).action, (yyvsp[-1].number), (yyvsp[0].number));
6470                         addresource(&resourceset);
6471                    }
6472 #line 6473 "src/y.tab.c"
6473     break;
6474 
6475   case 673:
6476 #line 2364 "src/p.y"
6477                                              {
6478                         resourceset.resource_id = Resource_CpuPercent;
6479                         resourceset.operator = (yyvsp[-2].number);
6480                         resourceset.limit = (yyvsp[-1].real);
6481                   }
6482 #line 6483 "src/y.tab.c"
6483     break;
6484 
6485   case 674:
6486 #line 2369 "src/p.y"
6487                                                   {
6488                         resourceset.resource_id = Resource_CpuPercentTotal;
6489                         resourceset.operator = (yyvsp[-2].number);
6490                         resourceset.limit = (yyvsp[-1].real);
6491                   }
6492 #line 6493 "src/y.tab.c"
6493     break;
6494 
6495   case 675:
6496 #line 2376 "src/p.y"
6497                                                        {
6498                         resourceset.resource_id = (yyvsp[-3].number);
6499                         resourceset.operator = (yyvsp[-2].number);
6500                         resourceset.limit = (yyvsp[-1].real);
6501                   }
6502 #line 6503 "src/y.tab.c"
6503     break;
6504 
6505   case 676:
6506 #line 2383 "src/p.y"
6507                           {
6508                         if (systeminfo.statisticsAvailable & Statistics_CpuUser)
6509                                 (yyval.number) = Resource_CpuUser;
6510                         else
6511                                 yywarning2("The CPU user usage statistics is not available on this system\n");
6512                   }
6513 #line 6514 "src/y.tab.c"
6514     break;
6515 
6516   case 677:
6517 #line 2389 "src/p.y"
6518                             {
6519                         if (systeminfo.statisticsAvailable & Statistics_CpuSystem)
6520                                 (yyval.number) = Resource_CpuSystem;
6521                         else
6522                                 yywarning2("The CPU system usage statistics is not available on this system\n");
6523                   }
6524 #line 6525 "src/y.tab.c"
6525     break;
6526 
6527   case 678:
6528 #line 2395 "src/p.y"
6529                           {
6530                         if (systeminfo.statisticsAvailable & Statistics_CpuIOWait)
6531                                 (yyval.number) = Resource_CpuWait;
6532                         else
6533                                 yywarning2("The CPU I/O wait usage statistics is not available on this system\n");
6534                   }
6535 #line 6536 "src/y.tab.c"
6536     break;
6537 
6538   case 679:
6539 #line 2401 "src/p.y"
6540                           {
6541                         if (systeminfo.statisticsAvailable & Statistics_CpuNice)
6542                                 (yyval.number) = Resource_CpuNice;
6543                         else
6544                                 yywarning2("The CPU nice usage statistics is not available on this system\n");
6545                   }
6546 #line 6547 "src/y.tab.c"
6547     break;
6548 
6549   case 680:
6550 #line 2407 "src/p.y"
6551                              {
6552                         if (systeminfo.statisticsAvailable & Statistics_CpuHardIRQ)
6553                                 (yyval.number) = Resource_CpuHardIRQ;
6554                         else
6555                                 yywarning2("The CPU hardware IRQ usage statistics is not available on this system\n");
6556                   }
6557 #line 6558 "src/y.tab.c"
6558     break;
6559 
6560   case 681:
6561 #line 2413 "src/p.y"
6562                              {
6563                         if (systeminfo.statisticsAvailable & Statistics_CpuSoftIRQ)
6564                                 (yyval.number) = Resource_CpuSoftIRQ;
6565                         else
6566                                 yywarning2("The CPU software IRQ usage statistics is not available on this system\n");
6567                   }
6568 #line 6569 "src/y.tab.c"
6569     break;
6570 
6571   case 682:
6572 #line 2419 "src/p.y"
6573                            {
6574                         if (systeminfo.statisticsAvailable & Statistics_CpuSteal)
6575                                 (yyval.number) = Resource_CpuSteal;
6576                         else
6577                                 yywarning2("The CPU steal usage statistics is not available on this system\n");
6578                   }
6579 #line 6580 "src/y.tab.c"
6580     break;
6581 
6582   case 683:
6583 #line 2425 "src/p.y"
6584                            {
6585                         if (systeminfo.statisticsAvailable & Statistics_CpuGuest)
6586                                 (yyval.number) = Resource_CpuGuest;
6587                         else
6588                                 yywarning2("The CPU guest usage statistics is not available on this system\n");
6589                   }
6590 #line 6591 "src/y.tab.c"
6591     break;
6592 
6593   case 684:
6594 #line 2431 "src/p.y"
6595                                {
6596                         if (systeminfo.statisticsAvailable & Statistics_CpuGuestNice)
6597                                 (yyval.number) = Resource_CpuGuestNice;
6598                         else
6599                                 yywarning2("The CPU guest nice usage statistics is not available on this system\n");
6600                   }
6601 #line 6602 "src/y.tab.c"
6602     break;
6603 
6604   case 685:
6605 #line 2437 "src/p.y"
6606                       {
6607                         (yyval.number) = Resource_CpuPercent;
6608                   }
6609 #line 6610 "src/y.tab.c"
6610     break;
6611 
6612   case 686:
6613 #line 2442 "src/p.y"
6614                                              {
6615                         resourceset.resource_id = Resource_MemoryKbyte;
6616                         resourceset.operator = (yyvsp[-2].number);
6617                         resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number);
6618                   }
6619 #line 6620 "src/y.tab.c"
6620     break;
6621 
6622   case 687:
6623 #line 2447 "src/p.y"
6624                                                 {
6625                         resourceset.resource_id = Resource_MemoryPercent;
6626                         resourceset.operator = (yyvsp[-2].number);
6627                         resourceset.limit = (yyvsp[-1].real);
6628                   }
6629 #line 6630 "src/y.tab.c"
6630     break;
6631 
6632   case 688:
6633 #line 2454 "src/p.y"
6634                                              {
6635                         resourceset.resource_id = Resource_MemoryKbyte;
6636                         resourceset.operator = (yyvsp[-2].number);
6637                         resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number);
6638                   }
6639 #line 6640 "src/y.tab.c"
6640     break;
6641 
6642   case 689:
6643 #line 2459 "src/p.y"
6644                                                 {
6645                         resourceset.resource_id = Resource_MemoryPercent;
6646                         resourceset.operator = (yyvsp[-2].number);
6647                         resourceset.limit = (yyvsp[-1].real);
6648                   }
6649 #line 6650 "src/y.tab.c"
6650     break;
6651 
6652   case 690:
6653 #line 2464 "src/p.y"
6654                                                   {
6655                         resourceset.resource_id = Resource_MemoryKbyteTotal;
6656                         resourceset.operator = (yyvsp[-2].number);
6657                         resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number);
6658                   }
6659 #line 6660 "src/y.tab.c"
6660     break;
6661 
6662   case 691:
6663 #line 2469 "src/p.y"
6664                                                       {
6665                         resourceset.resource_id = Resource_MemoryPercentTotal;
6666                         resourceset.operator = (yyvsp[-2].number);
6667                         resourceset.limit = (yyvsp[-1].real);
6668                   }
6669 #line 6670 "src/y.tab.c"
6670     break;
6671 
6672   case 692:
6673 #line 2476 "src/p.y"
6674                                            {
6675                         resourceset.resource_id = Resource_SwapKbyte;
6676                         resourceset.operator = (yyvsp[-2].number);
6677                         resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number);
6678                   }
6679 #line 6680 "src/y.tab.c"
6680     break;
6681 
6682   case 693:
6683 #line 2481 "src/p.y"
6684                                               {
6685                         resourceset.resource_id = Resource_SwapPercent;
6686                         resourceset.operator = (yyvsp[-2].number);
6687                         resourceset.limit = (yyvsp[-1].real);
6688                   }
6689 #line 6690 "src/y.tab.c"
6690     break;
6691 
6692   case 694:
6693 #line 2488 "src/p.y"
6694                                           {
6695                         resourceset.resource_id = Resource_Threads;
6696                         resourceset.operator = (yyvsp[-1].number);
6697                         resourceset.limit = (yyvsp[0].number);
6698                   }
6699 #line 6700 "src/y.tab.c"
6700     break;
6701 
6702   case 695:
6703 #line 2495 "src/p.y"
6704                                            {
6705                         resourceset.resource_id = Resource_Children;
6706                         resourceset.operator = (yyvsp[-1].number);
6707                         resourceset.limit = (yyvsp[0].number);
6708                   }
6709 #line 6710 "src/y.tab.c"
6710     break;
6711 
6712   case 696:
6713 #line 2502 "src/p.y"
6714                                                                 {
6715                         switch ((yyvsp[-3].number)) {
6716                                 case Resource_LoadAverage1m:
6717                                         resourceset.resource_id = (yyvsp[-2].number) > 1 ? Resource_LoadAveragePerCore1m : (yyvsp[-3].number);
6718                                         break;
6719                                 case Resource_LoadAverage5m:
6720                                         resourceset.resource_id = (yyvsp[-2].number) > 1 ? Resource_LoadAveragePerCore5m : (yyvsp[-3].number);
6721                                         break;
6722                                 case Resource_LoadAverage15m:
6723                                         resourceset.resource_id = (yyvsp[-2].number) > 1 ? Resource_LoadAveragePerCore15m : (yyvsp[-3].number);
6724                                         break;
6725                                 default:
6726                                         resourceset.resource_id = (yyvsp[-3].number);
6727                                         break;
6728                         }
6729                         resourceset.operator = (yyvsp[-1].number);
6730                         resourceset.limit = (yyvsp[0].real);
6731                   }
6732 #line 6733 "src/y.tab.c"
6733     break;
6734 
6735   case 697:
6736 #line 2522 "src/p.y"
6737                             { (yyval.number) = Resource_LoadAverage1m; }
6738 #line 6739 "src/y.tab.c"
6739     break;
6740 
6741   case 698:
6742 #line 2523 "src/p.y"
6743                             { (yyval.number) = Resource_LoadAverage5m; }
6744 #line 6745 "src/y.tab.c"
6745     break;
6746 
6747   case 699:
6748 #line 2524 "src/p.y"
6749                             { (yyval.number) = Resource_LoadAverage15m; }
6750 #line 6751 "src/y.tab.c"
6751     break;
6752 
6753   case 700:
6754 #line 2527 "src/p.y"
6755                               { (yyval.number) = 1; }
6756 #line 6757 "src/y.tab.c"
6757     break;
6758 
6759   case 701:
6760 #line 2528 "src/p.y"
6761                               { (yyval.number) = systeminfo.cpu.count; }
6762 #line 6763 "src/y.tab.c"
6763     break;
6764 
6765   case 702:
6766 #line 2532 "src/p.y"
6767                                                        {
6768                         resourceset.resource_id = Resource_ReadBytes;
6769                         resourceset.operator = (yyvsp[-3].number);
6770                         resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number);
6771                   }
6772 #line 6773 "src/y.tab.c"
6773     break;
6774 
6775   case 703:
6776 #line 2537 "src/p.y"
6777                                                             {
6778                         resourceset.resource_id = Resource_ReadBytesPhysical;
6779                         resourceset.operator = (yyvsp[-3].number);
6780                         resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number);
6781                   }
6782 #line 6783 "src/y.tab.c"
6783     break;
6784 
6785   case 704:
6786 #line 2542 "src/p.y"
6787                                                       {
6788                         resourceset.resource_id = Resource_ReadOperations;
6789                         resourceset.operator = (yyvsp[-2].number);
6790                         resourceset.limit = (yyvsp[-1].number);
6791                   }
6792 #line 6793 "src/y.tab.c"
6793     break;
6794 
6795   case 705:
6796 #line 2549 "src/p.y"
6797                                                         {
6798                         resourceset.resource_id = Resource_WriteBytes;
6799                         resourceset.operator = (yyvsp[-3].number);
6800                         resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number);
6801                   }
6802 #line 6803 "src/y.tab.c"
6803     break;
6804 
6805   case 706:
6806 #line 2554 "src/p.y"
6807                                                              {
6808                         resourceset.resource_id = Resource_WriteBytesPhysical;
6809                         resourceset.operator = (yyvsp[-3].number);
6810                         resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number);
6811                   }
6812 #line 6813 "src/y.tab.c"
6813     break;
6814 
6815   case 707:
6816 #line 2559 "src/p.y"
6817                                                        {
6818                         resourceset.resource_id = Resource_WriteOperations;
6819                         resourceset.operator = (yyvsp[-2].number);
6820                         resourceset.limit = (yyvsp[-1].number);
6821                   }
6822 #line 6823 "src/y.tab.c"
6823     break;
6824 
6825   case 708:
6826 #line 2566 "src/p.y"
6827                        { (yyval.real) = (yyvsp[0].real); }
6828 #line 6829 "src/y.tab.c"
6829     break;
6830 
6831   case 709:
6832 #line 2567 "src/p.y"
6833                          { (yyval.real) = (float) (yyvsp[0].number); }
6834 #line 6835 "src/y.tab.c"
6835     break;
6836 
6837   case 710:
6838 #line 2570 "src/p.y"
6839                         { (yyval.number) = Timestamp_Default; }
6840 #line 6841 "src/y.tab.c"
6841     break;
6842 
6843   case 711:
6844 #line 2571 "src/p.y"
6845                         { (yyval.number) = Timestamp_Access; }
6846 #line 6847 "src/y.tab.c"
6847     break;
6848 
6849   case 712:
6850 #line 2572 "src/p.y"
6851                         { (yyval.number) = Timestamp_Change; }
6852 #line 6853 "src/y.tab.c"
6853     break;
6854 
6855   case 713:
6856 #line 2573 "src/p.y"
6857                         { (yyval.number) = Timestamp_Modification; }
6858 #line 6859 "src/y.tab.c"
6859     break;
6860 
6861   case 714:
6862 #line 2576 "src/p.y"
6863                                                                                             {
6864                         timestampset.type = (yyvsp[-7].number);
6865                         timestampset.operator = (yyvsp[-6].number);
6866                         timestampset.time = ((yyvsp[-5].number) * (yyvsp[-4].number));
6867                         addeventaction(&(timestampset).action, (yyvsp[-1].number), (yyvsp[0].number));
6868                         addtimestamp(&timestampset);
6869                   }
6870 #line 6871 "src/y.tab.c"
6871     break;
6872 
6873   case 715:
6874 #line 2583 "src/p.y"
6875                                                               {
6876                         timestampset.type = (yyvsp[-3].number);
6877                         timestampset.test_changes = true;
6878                         addeventaction(&(timestampset).action, (yyvsp[0].number), Action_Ignored);
6879                         addtimestamp(&timestampset);
6880                   }
6881 #line 6882 "src/y.tab.c"
6882     break;
6883 
6884   case 716:
6885 #line 2591 "src/p.y"
6886                                  { (yyval.number) = Operator_Equal; }
6887 #line 6888 "src/y.tab.c"
6888     break;
6889 
6890   case 717:
6891 #line 2592 "src/p.y"
6892                                  { (yyval.number) = Operator_Greater; }
6893 #line 6894 "src/y.tab.c"
6894     break;
6895 
6896   case 718:
6897 #line 2593 "src/p.y"
6898                                  { (yyval.number) = Operator_GreaterOrEqual; }
6899 #line 6900 "src/y.tab.c"
6900     break;
6901 
6902   case 719:
6903 #line 2594 "src/p.y"
6904                                  { (yyval.number) = Operator_Less; }
6905 #line 6906 "src/y.tab.c"
6906     break;
6907 
6908   case 720:
6909 #line 2595 "src/p.y"
6910                                  { (yyval.number) = Operator_LessOrEqual; }
6911 #line 6912 "src/y.tab.c"
6912     break;
6913 
6914   case 721:
6915 #line 2596 "src/p.y"
6916                                  { (yyval.number) = Operator_Equal; }
6917 #line 6918 "src/y.tab.c"
6918     break;
6919 
6920   case 722:
6921 #line 2597 "src/p.y"
6922                                  { (yyval.number) = Operator_NotEqual; }
6923 #line 6924 "src/y.tab.c"
6924     break;
6925 
6926   case 723:
6927 #line 2598 "src/p.y"
6928                                  { (yyval.number) = Operator_Changed; }
6929 #line 6930 "src/y.tab.c"
6930     break;
6931 
6932   case 724:
6933 #line 2601 "src/p.y"
6934                               { (yyval.number) = Time_Second; }
6935 #line 6936 "src/y.tab.c"
6936     break;
6937 
6938   case 725:
6939 #line 2602 "src/p.y"
6940                               { (yyval.number) = Time_Second; }
6941 #line 6942 "src/y.tab.c"
6942     break;
6943 
6944   case 726:
6945 #line 2603 "src/p.y"
6946                               { (yyval.number) = Time_Minute; }
6947 #line 6948 "src/y.tab.c"
6948     break;
6949 
6950   case 727:
6951 #line 2604 "src/p.y"
6952                               { (yyval.number) = Time_Hour; }
6953 #line 6954 "src/y.tab.c"
6954     break;
6955 
6956   case 728:
6957 #line 2605 "src/p.y"
6958                               { (yyval.number) = Time_Day; }
6959 #line 6960 "src/y.tab.c"
6960     break;
6961 
6962   case 729:
6963 #line 2606 "src/p.y"
6964                               { (yyval.number) = Time_Month; }
6965 #line 6966 "src/y.tab.c"
6966     break;
6967 
6968   case 730:
6969 #line 2609 "src/p.y"
6970                               { (yyval.number) = Time_Minute; }
6971 #line 6972 "src/y.tab.c"
6972     break;
6973 
6974   case 731:
6975 #line 2610 "src/p.y"
6976                               { (yyval.number) = Time_Hour; }
6977 #line 6978 "src/y.tab.c"
6978     break;
6979 
6980   case 732:
6981 #line 2611 "src/p.y"
6982                               { (yyval.number) = Time_Day; }
6983 #line 6984 "src/y.tab.c"
6984     break;
6985 
6986   case 733:
6987 #line 2613 "src/p.y"
6988                               { (yyval.number) = Time_Second; }
6989 #line 6990 "src/y.tab.c"
6990     break;
6991 
6992   case 734:
6993 #line 2614 "src/p.y"
6994                               { (yyval.number) = Time_Second; }
6995 #line 6996 "src/y.tab.c"
6996     break;
6997 
6998   case 735:
6999 #line 2616 "src/p.y"
7000                               {
7001                         repeat = 0;
7002                   }
7003 #line 7004 "src/y.tab.c"
7004     break;
7005 
7006   case 736:
7007 #line 2619 "src/p.y"
7008                                      {
7009                         repeat = 1;
7010                   }
7011 #line 7012 "src/y.tab.c"
7012     break;
7013 
7014   case 737:
7015 #line 2622 "src/p.y"
7016                                             {
7017                         if ((yyvsp[-1].number) < 0) {
7018                                 yyerror2("The number of repeat cycles must be greater or equal to 0");
7019                         }
7020                         repeat = (yyvsp[-1].number);
7021                   }
7022 #line 7023 "src/y.tab.c"
7023     break;
7024 
7025   case 738:
7026 #line 2630 "src/p.y"
7027                         {
7028                         (yyval.number) = Action_Alert;
7029                   }
7030 #line 7031 "src/y.tab.c"
7031     break;
7032 
7033   case 739:
7034 #line 2633 "src/p.y"
7035                                            {
7036                         (yyval.number) = Action_Exec;
7037                   }
7038 #line 7039 "src/y.tab.c"
7039     break;
7040 
7041   case 740:
7042 #line 2637 "src/p.y"
7043                   {
7044                         (yyval.number) = Action_Exec;
7045                   }
7046 #line 7047 "src/y.tab.c"
7047     break;
7048 
7049   case 741:
7050 #line 2640 "src/p.y"
7051                           {
7052                         (yyval.number) = Action_Restart;
7053                   }
7054 #line 7055 "src/y.tab.c"
7055     break;
7056 
7057   case 742:
7058 #line 2643 "src/p.y"
7059                         {
7060                         (yyval.number) = Action_Start;
7061                   }
7062 #line 7063 "src/y.tab.c"
7063     break;
7064 
7065   case 743:
7066 #line 2646 "src/p.y"
7067                        {
7068                         (yyval.number) = Action_Stop;
7069                   }
7070 #line 7071 "src/y.tab.c"
7071     break;
7072 
7073   case 744:
7074 #line 2649 "src/p.y"
7075                             {
7076                         (yyval.number) = Action_Unmonitor;
7077                   }
7078 #line 7079 "src/y.tab.c"
7079     break;
7080 
7081   case 745:
7082 #line 2654 "src/p.y"
7083                          {
7084                         (yyval.number) = (yyvsp[0].number);
7085                         if ((yyvsp[0].number) == Action_Exec && command) {
7086                                 repeat1 = repeat;
7087                                 repeat = 0;
7088                                 command1 = command;
7089                                 command = NULL;
7090                         }
7091                   }
7092 #line 7093 "src/y.tab.c"
7093     break;
7094 
7095   case 746:
7096 #line 2665 "src/p.y"
7097                          {
7098                         (yyval.number) = (yyvsp[0].number);
7099                         if ((yyvsp[0].number) == Action_Exec && command) {
7100                                 repeat2 = repeat;
7101                                 repeat = 0;
7102                                 command2 = command;
7103                                 command = NULL;
7104                         }
7105                   }
7106 #line 7107 "src/y.tab.c"
7107     break;
7108 
7109   case 747:
7110 #line 2676 "src/p.y"
7111                                {
7112                         if ((yyvsp[-1].number) < 1 || (unsigned long)(yyvsp[-1].number) > BITMAP_MAX) {
7113                                 yyerror2("The number of cycles must be between 1 and %zu", BITMAP_MAX);
7114                         } else {
7115                                 rate.count  = (yyvsp[-1].number);
7116                                 rate.cycles = (yyvsp[-1].number);
7117                         }
7118                   }
7119 #line 7120 "src/y.tab.c"
7120     break;
7121 
7122   case 748:
7123 #line 2686 "src/p.y"
7124                                       {
7125                         if ((yyvsp[-1].number) < 1 || (unsigned long)(yyvsp[-1].number) > BITMAP_MAX) {
7126                                 yyerror2("The number of cycles must be between 1 and %zu", BITMAP_MAX);
7127                         } else if ((yyvsp[-2].number) < 1 || (yyvsp[-2].number) > (yyvsp[-1].number)) {
7128                                 yyerror2("The number of events must be between 1 and less then poll cycles");
7129                         } else {
7130                                 rate.count  = (yyvsp[-2].number);
7131                                 rate.cycles = (yyvsp[-1].number);
7132                         }
7133                   }
7134 #line 7135 "src/y.tab.c"
7135     break;
7136 
7137   case 750:
7138 #line 2699 "src/p.y"
7139                               {
7140                         rate1.count = rate.count;
7141                         rate1.cycles = rate.cycles;
7142                         reset_rateset(&rate);
7143                   }
7144 #line 7145 "src/y.tab.c"
7145     break;
7146 
7147   case 751:
7148 #line 2704 "src/p.y"
7149                                {
7150                         rate1.count = rate.count;
7151                         rate1.cycles = rate.cycles;
7152                         reset_rateset(&rate);
7153                 }
7154 #line 7155 "src/y.tab.c"
7155     break;
7156 
7157   case 753:
7158 #line 2712 "src/p.y"
7159                               {
7160                         rate2.count = rate.count;
7161                         rate2.cycles = rate.cycles;
7162                         reset_rateset(&rate);
7163                   }
7164 #line 7165 "src/y.tab.c"
7165     break;
7166 
7167   case 754:
7168 #line 2717 "src/p.y"
7169                                {
7170                         rate2.count = rate.count;
7171                         rate2.cycles = rate.cycles;
7172                         reset_rateset(&rate);
7173                 }
7174 #line 7175 "src/y.tab.c"
7175     break;
7176 
7177   case 755:
7178 #line 2724 "src/p.y"
7179                                {
7180                         (yyval.number) = Action_Alert;
7181                   }
7182 #line 7183 "src/y.tab.c"
7183     break;
7184 
7185   case 756:
7186 #line 2727 "src/p.y"
7187                                {
7188                         (yyval.number) = (yyvsp[0].number);
7189                   }
7190 #line 7191 "src/y.tab.c"
7191     break;
7192 
7193   case 757:
7194 #line 2730 "src/p.y"
7195                                                        {
7196                         (yyval.number) = (yyvsp[0].number);
7197                   }
7198 #line 7199 "src/y.tab.c"
7199     break;
7200 
7201   case 758:
7202 #line 2733 "src/p.y"
7203                                                     {
7204                         (yyval.number) = (yyvsp[0].number);
7205                   }
7206 #line 7207 "src/y.tab.c"
7207     break;
7208 
7209   case 759:
7210 #line 2736 "src/p.y"
7211                                                        {
7212                         (yyval.number) = (yyvsp[0].number);
7213                   }
7214 #line 7215 "src/y.tab.c"
7215     break;
7216 
7217   case 760:
7218 #line 2741 "src/p.y"
7219                                {
7220                         (yyval.number) = Action_Alert;
7221                   }
7222 #line 7223 "src/y.tab.c"
7223     break;
7224 
7225   case 761:
7226 #line 2744 "src/p.y"
7227                                {
7228                         (yyval.number) = (yyvsp[0].number);
7229                   }
7230 #line 7231 "src/y.tab.c"
7231     break;
7232 
7233   case 762:
7234 #line 2747 "src/p.y"
7235                                                     {
7236                         (yyval.number) = (yyvsp[0].number);
7237                   }
7238 #line 7239 "src/y.tab.c"
7239     break;
7240 
7241   case 763:
7242 #line 2752 "src/p.y"
7243                                                                                   {
7244                         addeventaction(&(checksumset).action, (yyvsp[-1].number), (yyvsp[0].number));
7245                         addchecksum(&checksumset);
7246                   }
7247 #line 7248 "src/y.tab.c"
7248     break;
7249 
7250   case 764:
7251 #line 2757 "src/p.y"
7252                                    {
7253                         snprintf(checksumset.hash, sizeof(checksumset.hash), "%s", (yyvsp[-4].string));
7254                         FREE((yyvsp[-4].string));
7255                         addeventaction(&(checksumset).action, (yyvsp[-1].number), (yyvsp[0].number));
7256                         addchecksum(&checksumset);
7257                   }
7258 #line 7259 "src/y.tab.c"
7259     break;
7260 
7261   case 765:
7262 #line 2763 "src/p.y"
7263                                                                   {
7264                         checksumset.test_changes = true;
7265                         addeventaction(&(checksumset).action, (yyvsp[0].number), Action_Ignored);
7266                         addchecksum(&checksumset);
7267                   }
7268 #line 7269 "src/y.tab.c"
7269     break;
7270 
7271   case 766:
7272 #line 2769 "src/p.y"
7273                               { checksumset.type = Hash_Unknown; }
7274 #line 7275 "src/y.tab.c"
7275     break;
7276 
7277   case 767:
7278 #line 2770 "src/p.y"
7279                               { checksumset.type = Hash_Md5; }
7280 #line 7281 "src/y.tab.c"
7281     break;
7282 
7283   case 768:
7284 #line 2771 "src/p.y"
7285                               { checksumset.type = Hash_Sha1; }
7286 #line 7287 "src/y.tab.c"
7287     break;
7288 
7289   case 769:
7290 #line 2774 "src/p.y"
7291                                                                                {
7292                         filesystemset.resource = Resource_Inode;
7293                         filesystemset.operator = (yyvsp[-5].number);
7294                         filesystemset.limit_absolute = (yyvsp[-4].number);
7295                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7296                         addfilesystem(&filesystemset);
7297                   }
7298 #line 7299 "src/y.tab.c"
7299     break;
7300 
7301   case 770:
7302 #line 2781 "src/p.y"
7303                                                                                       {
7304                         filesystemset.resource = Resource_Inode;
7305                         filesystemset.operator = (yyvsp[-6].number);
7306                         filesystemset.limit_percent = (yyvsp[-5].real);
7307                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7308                         addfilesystem(&filesystemset);
7309                   }
7310 #line 7311 "src/y.tab.c"
7311     break;
7312 
7313   case 771:
7314 #line 2788 "src/p.y"
7315                                                                                      {
7316                         filesystemset.resource = Resource_InodeFree;
7317                         filesystemset.operator = (yyvsp[-5].number);
7318                         filesystemset.limit_absolute = (yyvsp[-4].number);
7319                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7320                         addfilesystem(&filesystemset);
7321                   }
7322 #line 7323 "src/y.tab.c"
7323     break;
7324 
7325   case 772:
7326 #line 2795 "src/p.y"
7327                                                                                             {
7328                         filesystemset.resource = Resource_InodeFree;
7329                         filesystemset.operator = (yyvsp[-6].number);
7330                         filesystemset.limit_percent = (yyvsp[-5].real);
7331                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7332                         addfilesystem(&filesystemset);
7333                   }
7334 #line 7335 "src/y.tab.c"
7335     break;
7336 
7337   case 773:
7338 #line 2804 "src/p.y"
7339                                                                                    {
7340                         filesystemset.resource = Resource_Space;
7341                         filesystemset.operator = (yyvsp[-6].number);
7342                         filesystemset.limit_absolute = (yyvsp[-5].real) * (yyvsp[-4].number);
7343                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7344                         addfilesystem(&filesystemset);
7345                   }
7346 #line 7347 "src/y.tab.c"
7347     break;
7348 
7349   case 774:
7350 #line 2811 "src/p.y"
7351                                                                                       {
7352                         filesystemset.resource = Resource_Space;
7353                         filesystemset.operator = (yyvsp[-6].number);
7354                         filesystemset.limit_percent = (yyvsp[-5].real);
7355                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7356                         addfilesystem(&filesystemset);
7357                   }
7358 #line 7359 "src/y.tab.c"
7359     break;
7360 
7361   case 775:
7362 #line 2818 "src/p.y"
7363                                                                                          {
7364                         filesystemset.resource = Resource_SpaceFree;
7365                         filesystemset.operator = (yyvsp[-6].number);
7366                         filesystemset.limit_absolute = (yyvsp[-5].real) * (yyvsp[-4].number);
7367                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7368                         addfilesystem(&filesystemset);
7369                   }
7370 #line 7371 "src/y.tab.c"
7371     break;
7372 
7373   case 776:
7374 #line 2825 "src/p.y"
7375                                                                                             {
7376                         filesystemset.resource = Resource_SpaceFree;
7377                         filesystemset.operator = (yyvsp[-6].number);
7378                         filesystemset.limit_percent = (yyvsp[-5].real);
7379                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7380                         addfilesystem(&filesystemset);
7381                   }
7382 #line 7383 "src/y.tab.c"
7383     break;
7384 
7385   case 777:
7386 #line 2834 "src/p.y"
7387                                                                                               {
7388                         filesystemset.resource = Resource_ReadBytes;
7389                         filesystemset.operator = (yyvsp[-7].number);
7390                         filesystemset.limit_absolute = (yyvsp[-6].real) * (yyvsp[-5].number);
7391                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7392                         addfilesystem(&filesystemset);
7393                   }
7394 #line 7395 "src/y.tab.c"
7395     break;
7396 
7397   case 778:
7398 #line 2841 "src/p.y"
7399                                                                                         {
7400                         filesystemset.resource = Resource_ReadOperations;
7401                         filesystemset.operator = (yyvsp[-6].number);
7402                         filesystemset.limit_absolute = (yyvsp[-5].number);
7403                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7404                         addfilesystem(&filesystemset);
7405                   }
7406 #line 7407 "src/y.tab.c"
7407     break;
7408 
7409   case 779:
7410 #line 2850 "src/p.y"
7411                                                                                                {
7412                         filesystemset.resource = Resource_WriteBytes;
7413                         filesystemset.operator = (yyvsp[-7].number);
7414                         filesystemset.limit_absolute = (yyvsp[-6].real) * (yyvsp[-5].number);
7415                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7416                         addfilesystem(&filesystemset);
7417                   }
7418 #line 7419 "src/y.tab.c"
7419     break;
7420 
7421   case 780:
7422 #line 2857 "src/p.y"
7423                                                                                          {
7424                         filesystemset.resource = Resource_WriteOperations;
7425                         filesystemset.operator = (yyvsp[-6].number);
7426                         filesystemset.limit_absolute = (yyvsp[-5].number);
7427                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7428                         addfilesystem(&filesystemset);
7429                   }
7430 #line 7431 "src/y.tab.c"
7431     break;
7432 
7433   case 781:
7434 #line 2866 "src/p.y"
7435                                                                                                  {
7436                         filesystemset.resource = Resource_ServiceTime;
7437                         filesystemset.operator = (yyvsp[-6].number);
7438                         filesystemset.limit_absolute = (yyvsp[-5].number);
7439                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7440                         addfilesystem(&filesystemset);
7441                   }
7442 #line 7443 "src/y.tab.c"
7443     break;
7444 
7445   case 782:
7446 #line 2873 "src/p.y"
7447                                                                                            {
7448                         filesystemset.resource = Resource_ServiceTime;
7449                         filesystemset.operator = (yyvsp[-6].number);
7450                         filesystemset.limit_absolute = (yyvsp[-5].real) * 1000;
7451                         addeventaction(&(filesystemset).action, (yyvsp[-1].number), (yyvsp[0].number));
7452                         addfilesystem(&filesystemset);
7453                   }
7454 #line 7455 "src/y.tab.c"
7455     break;
7456 
7457   case 783:
7458 #line 2882 "src/p.y"
7459                                                        {
7460                         addeventaction(&(fsflagset).action, (yyvsp[0].number), Action_Ignored);
7461                         addfsflag(&fsflagset);
7462                   }
7463 #line 7464 "src/y.tab.c"
7464     break;
7465 
7466   case 784:
7467 #line 2888 "src/p.y"
7468                                { (yyval.number) = Unit_Byte; }
7469 #line 7470 "src/y.tab.c"
7470     break;
7471 
7472   case 785:
7473 #line 2889 "src/p.y"
7474                                { (yyval.number) = Unit_Byte; }
7475 #line 7476 "src/y.tab.c"
7476     break;
7477 
7478   case 786:
7479 #line 2890 "src/p.y"
7480                                { (yyval.number) = Unit_Kilobyte; }
7481 #line 7482 "src/y.tab.c"
7482     break;
7483 
7484   case 787:
7485 #line 2891 "src/p.y"
7486                                { (yyval.number) = Unit_Megabyte; }
7487 #line 7488 "src/y.tab.c"
7488     break;
7489 
7490   case 788:
7491 #line 2892 "src/p.y"
7492                                { (yyval.number) = Unit_Gigabyte; }
7493 #line 7494 "src/y.tab.c"
7494     break;
7495 
7496   case 789:
7497 #line 2895 "src/p.y"
7498                                                                                   {
7499                         permset.perm = check_perm((yyvsp[-4].number));
7500                         addeventaction(&(permset).action, (yyvsp[-1].number), (yyvsp[0].number));
7501                         addperm(&permset);
7502                   }
7503 #line 7504 "src/y.tab.c"
7504     break;
7505 
7506   case 790:
7507 #line 2900 "src/p.y"
7508                                                                             {
7509                         permset.test_changes = true;
7510                         addeventaction(&(permset).action, (yyvsp[-1].number), Action_Ignored);
7511                         addperm(&permset);
7512                   }
7513 #line 7514 "src/y.tab.c"
7514     break;
7515 
7516   case 791:
7517 #line 2907 "src/p.y"
7518                                                                    {
7519                         matchset.not = (yyvsp[-4].number) == Operator_Equal ? false : true;
7520                         matchset.ignore = false;
7521                         matchset.match_path = NULL;
7522                         matchset.match_string = (yyvsp[-3].string);
7523                         addmatch(&matchset, (yyvsp[0].number), 0);
7524                   }
7525 #line 7526 "src/y.tab.c"
7526     break;
7527 
7528   case 792:
7529 #line 2916 "src/p.y"
7530                                                                  {
7531                         matchset.not = (yyvsp[-4].number) == Operator_Equal ? false : true;
7532                         matchset.ignore = false;
7533                         matchset.match_path = (yyvsp[-3].string);
7534                         matchset.match_string = NULL;
7535                         addmatchpath(&matchset, (yyvsp[0].number));
7536                         FREE((yyvsp[-3].string));
7537                   }
7538 #line 7539 "src/y.tab.c"
7539     break;
7540 
7541   case 793:
7542 #line 2924 "src/p.y"
7543                                                                    {
7544                         matchset.not = (yyvsp[-4].number) == Operator_Equal ? false : true;
7545                         matchset.ignore = false;
7546                         matchset.match_path = NULL;
7547                         matchset.match_string = (yyvsp[-3].string);
7548                         addmatch(&matchset, (yyvsp[0].number), 0);
7549                   }
7550 #line 7551 "src/y.tab.c"
7551     break;
7552 
7553   case 794:
7554 #line 2931 "src/p.y"
7555                                                   {
7556                         matchset.not = (yyvsp[-1].number) == Operator_Equal ? false : true;
7557                         matchset.ignore = true;
7558                         matchset.match_path = (yyvsp[0].string);
7559                         matchset.match_string = NULL;
7560                         addmatchpath(&matchset, Action_Ignored);
7561                         FREE((yyvsp[0].string));
7562                   }
7563 #line 7564 "src/y.tab.c"
7564     break;
7565 
7566   case 795:
7567 #line 2939 "src/p.y"
7568                                                     {
7569                         matchset.not = (yyvsp[-1].number) == Operator_Equal ? false : true;
7570                         matchset.ignore = true;
7571                         matchset.match_path = NULL;
7572                         matchset.match_string = (yyvsp[0].string);
7573                         addmatch(&matchset, Action_Ignored, 0);
7574                   }
7575 #line 7576 "src/y.tab.c"
7576     break;
7577 
7578   case 796:
7579 #line 2947 "src/p.y"
7580                                                                 {
7581                         matchset.ignore = false;
7582                         matchset.match_path = (yyvsp[-3].string);
7583                         matchset.match_string = NULL;
7584                         addmatchpath(&matchset, (yyvsp[0].number));
7585                         FREE((yyvsp[-3].string));
7586                   }
7587 #line 7588 "src/y.tab.c"
7588     break;
7589 
7590   case 797:
7591 #line 2954 "src/p.y"
7592                                                                   {
7593                         matchset.ignore = false;
7594                         matchset.match_path = NULL;
7595                         matchset.match_string = (yyvsp[-3].string);
7596                         addmatch(&matchset, (yyvsp[0].number), 0);
7597                   }
7598 #line 7599 "src/y.tab.c"
7599     break;
7600 
7601   case 798:
7602 #line 2960 "src/p.y"
7603                                                  {
7604                         matchset.ignore = true;
7605                         matchset.match_path = (yyvsp[0].string);
7606                         matchset.match_string = NULL;
7607                         addmatchpath(&matchset, Action_Ignored);
7608                         FREE((yyvsp[0].string));
7609                   }
7610 #line 7611 "src/y.tab.c"
7611     break;
7612 
7613   case 799:
7614 #line 2967 "src/p.y"
7615                                                    {
7616                         matchset.ignore = true;
7617                         matchset.match_path = NULL;
7618                         matchset.match_string = (yyvsp[0].string);
7619                         addmatch(&matchset, Action_Ignored, 0);
7620                   }
7621 #line 7622 "src/y.tab.c"
7622     break;
7623 
7624   case 800:
7625 #line 2975 "src/p.y"
7626                               {
7627                         matchset.not = false;
7628                   }
7629 #line 7630 "src/y.tab.c"
7630     break;
7631 
7632   case 801:
7633 #line 2978 "src/p.y"
7634                       {
7635                         matchset.not = true;
7636                   }
7637 #line 7638 "src/y.tab.c"
7638     break;
7639 
7640   case 802:
7641 #line 2984 "src/p.y"
7642                                                                                    {
7643                         sizeset.operator = (yyvsp[-6].number);
7644                         sizeset.size = ((unsigned long long)(yyvsp[-5].number) * (yyvsp[-4].number));
7645                         addeventaction(&(sizeset).action, (yyvsp[-1].number), (yyvsp[0].number));
7646                         addsize(&sizeset);
7647                   }
7648 #line 7649 "src/y.tab.c"
7649     break;
7650 
7651   case 803:
7652 #line 2990 "src/p.y"
7653                                                      {
7654                         sizeset.test_changes = true;
7655                         addeventaction(&(sizeset).action, (yyvsp[0].number), Action_Ignored);
7656                         addsize(&sizeset);
7657                   }
7658 #line 7659 "src/y.tab.c"
7659     break;
7660 
7661   case 804:
7662 #line 2997 "src/p.y"
7663                                                                            {
7664                         uidset.uid = get_uid((yyvsp[-4].string), 0);
7665                         addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number));
7666                         current->uid = adduid(&uidset);
7667                         FREE((yyvsp[-4].string));
7668                   }
7669 #line 7670 "src/y.tab.c"
7670     break;
7671 
7672   case 805:
7673 #line 3003 "src/p.y"
7674                                                                            {
7675                     uidset.uid = get_uid(NULL, (yyvsp[-4].number));
7676                     addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number));
7677                     current->uid = adduid(&uidset);
7678                   }
7679 #line 7680 "src/y.tab.c"
7680     break;
7681 
7682   case 806:
7683 #line 3010 "src/p.y"
7684                                                                             {
7685                         uidset.uid = get_uid((yyvsp[-4].string), 0);
7686                         addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number));
7687                         current->euid = adduid(&uidset);
7688                         FREE((yyvsp[-4].string));
7689                   }
7690 #line 7691 "src/y.tab.c"
7691     break;
7692 
7693   case 807:
7694 #line 3016 "src/p.y"
7695                                                                             {
7696                         uidset.uid = get_uid(NULL, (yyvsp[-4].number));
7697                         addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number));
7698                         current->euid = adduid(&uidset);
7699                   }
7700 #line 7701 "src/y.tab.c"
7701     break;
7702 
7703   case 808:
7704 #line 3023 "src/p.y"
7705                                                                                           {
7706                         addsecurityattribute((yyvsp[-4].string), (yyvsp[-1].number), (yyvsp[0].number));
7707                   }
7708 #line 7709 "src/y.tab.c"
7709     break;
7710 
7711   case 809:
7712 #line 3026 "src/p.y"
7713                                                                                         {
7714                         addsecurityattribute((yyvsp[-4].string), (yyvsp[-1].number), (yyvsp[0].number));
7715                   }
7716 #line 7717 "src/y.tab.c"
7717     break;
7718 
7719   case 810:
7720 #line 3031 "src/p.y"
7721                                                                                                {
7722                         if (systeminfo.statisticsAvailable & Statistics_FiledescriptorsPerSystem)
7723                                 addfiledescriptors((yyvsp[-5].number), false, (long long)(yyvsp[-4].number), -1., (yyvsp[-1].number), (yyvsp[0].number));
7724                         else
7725                                 yywarning("The per-system filedescriptors statistics is not available on this system\n");
7726                   }
7727 #line 7728 "src/y.tab.c"
7728     break;
7729 
7730   case 811:
7731 #line 3037 "src/p.y"
7732                                                                                                 {
7733                         if (systeminfo.statisticsAvailable & Statistics_FiledescriptorsPerSystem)
7734                                 addfiledescriptors((yyvsp[-6].number), false, -1LL, (yyvsp[-5].real), (yyvsp[-1].number), (yyvsp[0].number));
7735                         else
7736                                 yywarning("The per-system filedescriptors statistics is not available on this system\n");
7737                   }
7738 #line 7739 "src/y.tab.c"
7739     break;
7740 
7741   case 812:
7742 #line 3045 "src/p.y"
7743                                                                                                 {
7744                         if (systeminfo.statisticsAvailable & Statistics_FiledescriptorsPerProcess)
7745                                 addfiledescriptors((yyvsp[-5].number), false, (long long)(yyvsp[-4].number), -1., (yyvsp[-1].number), (yyvsp[0].number));
7746                         else
7747                                 yywarning("The per-process filedescriptors statistics is not available on this system\n");
7748                   }
7749 #line 7750 "src/y.tab.c"
7750     break;
7751 
7752   case 813:
7753 #line 3051 "src/p.y"
7754                                                                                                 {
7755                         if (systeminfo.statisticsAvailable & Statistics_FiledescriptorsPerProcessMax)
7756                                 addfiledescriptors((yyvsp[-6].number), false, -1LL, (yyvsp[-5].real), (yyvsp[-1].number), (yyvsp[0].number));
7757                         else
7758                                 yywarning("The per-process filedescriptors maximum is not exposed on this system, so we cannot compute usage %%, please use the test with absolute value\n");
7759                   }
7760 #line 7761 "src/y.tab.c"
7761     break;
7762 
7763   case 814:
7764 #line 3059 "src/p.y"
7765                                                                                                            {
7766                         if (systeminfo.statisticsAvailable & Statistics_FiledescriptorsPerProcess)
7767                                 addfiledescriptors((yyvsp[-5].number), true, (long long)(yyvsp[-4].number), -1., (yyvsp[-1].number), (yyvsp[0].number));
7768                         else
7769                                 yywarning("The per-process filedescriptors statistics is not available on this system\n");
7770                   }
7771 #line 7772 "src/y.tab.c"
7772     break;
7773 
7774   case 815:
7775 #line 3067 "src/p.y"
7776                                                                            {
7777                         gidset.gid = get_gid((yyvsp[-4].string), 0);
7778                         addeventaction(&(gidset).action, (yyvsp[-1].number), (yyvsp[0].number));
7779                         current->gid = addgid(&gidset);
7780                         FREE((yyvsp[-4].string));
7781                   }
7782 #line 7783 "src/y.tab.c"
7783     break;
7784 
7785   case 816:
7786 #line 3073 "src/p.y"
7787                                                                            {
7788                         gidset.gid = get_gid(NULL, (yyvsp[-4].number));
7789                         addeventaction(&(gidset).action, (yyvsp[-1].number), (yyvsp[0].number));
7790                         current->gid = addgid(&gidset);
7791                   }
7792 #line 7793 "src/y.tab.c"
7793     break;
7794 
7795   case 817:
7796 #line 3080 "src/p.y"
7797                                                                   { /* Deprecated */
7798                         addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number));
7799                         addlinkstatus(current, &linkstatusset);
7800                   }
7801 #line 7802 "src/y.tab.c"
7802     break;
7803 
7804   case 818:
7805 #line 3084 "src/p.y"
7806                                                                 {
7807                         linkstatusset.check_invers = false;
7808                         addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number));
7809                         addlinkstatus(current, &linkstatusset);
7810                   }
7811 #line 7812 "src/y.tab.c"
7812     break;
7813 
7814   case 819:
7815 #line 3089 "src/p.y"
7816                                                               {
7817                         linkstatusset.check_invers = true;
7818                         addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number));
7819                         addlinkstatus(current, &linkstatusset);
7820                   }
7821 #line 7822 "src/y.tab.c"
7822     break;
7823 
7824   case 820:
7825 #line 3096 "src/p.y"
7826                                                                    {
7827                         addeventaction(&(linkspeedset).action, (yyvsp[-1].number), (yyvsp[0].number));
7828                         addlinkspeed(current, &linkspeedset);
7829                   }
7830 #line 7831 "src/y.tab.c"
7831     break;
7832 
7833   case 821:
7834 #line 3101 "src/p.y"
7835                                                                                            {
7836                         linksaturationset.operator = (yyvsp[-6].number);
7837                         linksaturationset.limit = (unsigned long long)(yyvsp[-5].number);
7838                         addeventaction(&(linksaturationset).action, (yyvsp[-1].number), (yyvsp[0].number));
7839                         addlinksaturation(current, &linksaturationset);
7840                   }
7841 #line 7842 "src/y.tab.c"
7842     break;
7843 
7844   case 822:
7845 #line 3109 "src/p.y"
7846                                                                                                  {
7847                         bandwidthset.operator = (yyvsp[-7].number);
7848                         bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number));
7849                         bandwidthset.rangecount = 1;
7850                         bandwidthset.range = (yyvsp[-4].number);
7851                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7852                         addbandwidth(&(current->uploadbyteslist), &bandwidthset);
7853                   }
7854 #line 7855 "src/y.tab.c"
7855     break;
7856 
7857   case 823:
7858 #line 3117 "src/p.y"
7859                                                                                                      {
7860                         bandwidthset.operator = (yyvsp[-7].number);
7861                         bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number));
7862                         bandwidthset.rangecount = 1;
7863                         bandwidthset.range = (yyvsp[-4].number);
7864                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7865                         addbandwidth(&(current->uploadbyteslist), &bandwidthset);
7866                   }
7867 #line 7868 "src/y.tab.c"
7868     break;
7869 
7870   case 824:
7871 #line 3125 "src/p.y"
7872                                                                                                             {
7873                         bandwidthset.operator = (yyvsp[-8].number);
7874                         bandwidthset.limit = ((unsigned long long)(yyvsp[-7].number) * (yyvsp[-6].number));
7875                         bandwidthset.rangecount = (yyvsp[-5].number);
7876                         bandwidthset.range = (yyvsp[-4].number);
7877                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7878                         addbandwidth(&(current->uploadbyteslist), &bandwidthset);
7879                   }
7880 #line 7881 "src/y.tab.c"
7881     break;
7882 
7883   case 825:
7884 #line 3133 "src/p.y"
7885                                                                                                    {
7886                         bandwidthset.operator = (yyvsp[-7].number);
7887                         bandwidthset.limit = (unsigned long long)(yyvsp[-6].number);
7888                         bandwidthset.rangecount = 1;
7889                         bandwidthset.range = (yyvsp[-4].number);
7890                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7891                         addbandwidth(&(current->uploadpacketslist), &bandwidthset);
7892                   }
7893 #line 7894 "src/y.tab.c"
7894     break;
7895 
7896   case 826:
7897 #line 3141 "src/p.y"
7898                                                                                                        {
7899                         bandwidthset.operator = (yyvsp[-7].number);
7900                         bandwidthset.limit = (unsigned long long)(yyvsp[-6].number);
7901                         bandwidthset.rangecount = 1;
7902                         bandwidthset.range = (yyvsp[-4].number);
7903                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7904                         addbandwidth(&(current->uploadpacketslist), &bandwidthset);
7905                   }
7906 #line 7907 "src/y.tab.c"
7907     break;
7908 
7909   case 827:
7910 #line 3149 "src/p.y"
7911                                                                                                               {
7912                         bandwidthset.operator = (yyvsp[-8].number);
7913                         bandwidthset.limit = (unsigned long long)(yyvsp[-7].number);
7914                         bandwidthset.rangecount = (yyvsp[-5].number);
7915                         bandwidthset.range = (yyvsp[-4].number);
7916                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7917                         addbandwidth(&(current->uploadpacketslist), &bandwidthset);
7918                   }
7919 #line 7920 "src/y.tab.c"
7920     break;
7921 
7922   case 828:
7923 #line 3159 "src/p.y"
7924                                                                                                    {
7925                         bandwidthset.operator = (yyvsp[-7].number);
7926                         bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number));
7927                         bandwidthset.rangecount = 1;
7928                         bandwidthset.range = (yyvsp[-4].number);
7929                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7930                         addbandwidth(&(current->downloadbyteslist), &bandwidthset);
7931                   }
7932 #line 7933 "src/y.tab.c"
7933     break;
7934 
7935   case 829:
7936 #line 3167 "src/p.y"
7937                                                                                                        {
7938                         bandwidthset.operator = (yyvsp[-7].number);
7939                         bandwidthset.limit = ((unsigned long long)(yyvsp[-6].number) * (yyvsp[-5].number));
7940                         bandwidthset.rangecount = 1;
7941                         bandwidthset.range = (yyvsp[-4].number);
7942                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7943                         addbandwidth(&(current->downloadbyteslist), &bandwidthset);
7944                   }
7945 #line 7946 "src/y.tab.c"
7946     break;
7947 
7948   case 830:
7949 #line 3175 "src/p.y"
7950                                                                                                               {
7951                         bandwidthset.operator = (yyvsp[-8].number);
7952                         bandwidthset.limit = ((unsigned long long)(yyvsp[-7].number) * (yyvsp[-6].number));
7953                         bandwidthset.rangecount = (yyvsp[-5].number);
7954                         bandwidthset.range = (yyvsp[-4].number);
7955                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7956                         addbandwidth(&(current->downloadbyteslist), &bandwidthset);
7957                   }
7958 #line 7959 "src/y.tab.c"
7959     break;
7960 
7961   case 831:
7962 #line 3183 "src/p.y"
7963                                                                                                      {
7964                         bandwidthset.operator = (yyvsp[-7].number);
7965                         bandwidthset.limit = (unsigned long long)(yyvsp[-6].number);
7966                         bandwidthset.rangecount = 1;
7967                         bandwidthset.range = (yyvsp[-4].number);
7968                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7969                         addbandwidth(&(current->downloadpacketslist), &bandwidthset);
7970                   }
7971 #line 7972 "src/y.tab.c"
7972     break;
7973 
7974   case 832:
7975 #line 3191 "src/p.y"
7976                                                                                                          {
7977                         bandwidthset.operator = (yyvsp[-7].number);
7978                         bandwidthset.limit = (unsigned long long)(yyvsp[-6].number);
7979                         bandwidthset.rangecount = 1;
7980                         bandwidthset.range = (yyvsp[-4].number);
7981                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7982                         addbandwidth(&(current->downloadpacketslist), &bandwidthset);
7983                   }
7984 #line 7985 "src/y.tab.c"
7985     break;
7986 
7987   case 833:
7988 #line 3199 "src/p.y"
7989                                                                                                                 {
7990                         bandwidthset.operator = (yyvsp[-8].number);
7991                         bandwidthset.limit = (unsigned long long)(yyvsp[-7].number);
7992                         bandwidthset.rangecount = (yyvsp[-5].number);
7993                         bandwidthset.range = (yyvsp[-4].number);
7994                         addeventaction(&(bandwidthset).action, (yyvsp[-1].number), (yyvsp[0].number));
7995                         addbandwidth(&(current->downloadpacketslist), &bandwidthset);
7996                   }
7997 #line 7998 "src/y.tab.c"
7998     break;
7999 
8000   case 834:
8001 #line 3209 "src/p.y"
8002                                 { (yyval.number) = ICMP_ECHO; }
8003 #line 8004 "src/y.tab.c"
8004     break;
8005 
8006   case 835:
8007 #line 3212 "src/p.y"
8008                                         { mailset.reminder = 0; }
8009 #line 8010 "src/y.tab.c"
8010     break;
8011 
8012   case 836:
8013 #line 3213 "src/p.y"
8014                                         { mailset.reminder = (yyvsp[0].number); }
8015 #line 8016 "src/y.tab.c"
8016     break;
8017 
8018   case 837:
8019 #line 3214 "src/p.y"
8020                                         { mailset.reminder = (yyvsp[-1].number); }
8021 #line 8022 "src/y.tab.c"
8022     break;
8023 
8024 
8025 #line 8026 "src/y.tab.c"
8026 
8027       default: break;
8028     }
8029   /* User semantic actions sometimes alter yychar, and that requires
8030      that yytoken be updated with the new translation.  We take the
8031      approach of translating immediately before every use of yytoken.
8032      One alternative is translating here after every semantic action,
8033      but that translation would be missed if the semantic action invokes
8034      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
8035      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
8036      incorrect destructor might then be invoked immediately.  In the
8037      case of YYERROR or YYBACKUP, subsequent parser actions might lead
8038      to an incorrect destructor call or verbose syntax error message
8039      before the lookahead is translated.  */
8040   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
8041 
8042   YYPOPSTACK (yylen);
8043   yylen = 0;
8044   YY_STACK_PRINT (yyss, yyssp);
8045 
8046   *++yyvsp = yyval;
8047 
8048   /* Now 'shift' the result of the reduction.  Determine what state
8049      that goes to, based on the state we popped back to and the rule
8050      number reduced by.  */
8051   {
8052     const int yylhs = yyr1[yyn] - YYNTOKENS;
8053     const int yyi = yypgoto[yylhs] + *yyssp;
8054     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
8055                ? yytable[yyi]
8056                : yydefgoto[yylhs]);
8057   }
8058 
8059   goto yynewstate;
8060 
8061 
8062 /*--------------------------------------.
8063 | yyerrlab -- here on detecting error.  |
8064 `--------------------------------------*/
8065 yyerrlab:
8066   /* Make sure we have latest lookahead translation.  See comments at
8067      user semantic actions for why this is necessary.  */
8068   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
8069 
8070   /* If not already recovering from an error, report this error.  */
8071   if (!yyerrstatus)
8072     {
8073       ++yynerrs;
8074 #if ! YYERROR_VERBOSE
8075       yyerror (YY_("syntax error"));
8076 #else
8077 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
8078                                         yyssp, yytoken)
8079       {
8080         char const *yymsgp = YY_("syntax error");
8081         int yysyntax_error_status;
8082         yysyntax_error_status = YYSYNTAX_ERROR;
8083         if (yysyntax_error_status == 0)
8084           yymsgp = yymsg;
8085         else if (yysyntax_error_status == 1)
8086           {
8087             if (yymsg != yymsgbuf)
8088               YYSTACK_FREE (yymsg);
8089             yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
8090             if (!yymsg)
8091               {
8092                 yymsg = yymsgbuf;
8093                 yymsg_alloc = sizeof yymsgbuf;
8094                 yysyntax_error_status = 2;
8095               }
8096             else
8097               {
8098                 yysyntax_error_status = YYSYNTAX_ERROR;
8099                 yymsgp = yymsg;
8100               }
8101           }
8102         yyerror (yymsgp);
8103         if (yysyntax_error_status == 2)
8104           goto yyexhaustedlab;
8105       }
8106 # undef YYSYNTAX_ERROR
8107 #endif
8108     }
8109 
8110 
8111 
8112   if (yyerrstatus == 3)
8113     {
8114       /* If just tried and failed to reuse lookahead token after an
8115          error, discard it.  */
8116 
8117       if (yychar <= YYEOF)
8118         {
8119           /* Return failure if at end of input.  */
8120           if (yychar == YYEOF)
8121             YYABORT;
8122         }
8123       else
8124         {
8125           yydestruct ("Error: discarding",
8126                       yytoken, &yylval);
8127           yychar = YYEMPTY;
8128         }
8129     }
8130 
8131   /* Else will try to reuse lookahead token after shifting the error
8132      token.  */
8133   goto yyerrlab1;
8134 
8135 
8136 /*---------------------------------------------------.
8137 | yyerrorlab -- error raised explicitly by YYERROR.  |
8138 `---------------------------------------------------*/
8139 yyerrorlab:
8140   /* Pacify compilers when the user code never invokes YYERROR and the
8141      label yyerrorlab therefore never appears in user code.  */
8142   if (0)
8143     YYERROR;
8144 
8145   /* Do not reclaim the symbols of the rule whose action triggered
8146      this YYERROR.  */
8147   YYPOPSTACK (yylen);
8148   yylen = 0;
8149   YY_STACK_PRINT (yyss, yyssp);
8150   yystate = *yyssp;
8151   goto yyerrlab1;
8152 
8153 
8154 /*-------------------------------------------------------------.
8155 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
8156 `-------------------------------------------------------------*/
8157 yyerrlab1:
8158   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
8159 
8160   for (;;)
8161     {
8162       yyn = yypact[yystate];
8163       if (!yypact_value_is_default (yyn))
8164         {
8165           yyn += YYTERROR;
8166           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
8167             {
8168               yyn = yytable[yyn];
8169               if (0 < yyn)
8170                 break;
8171             }
8172         }
8173 
8174       /* Pop the current state because it cannot handle the error token.  */
8175       if (yyssp == yyss)
8176         YYABORT;
8177 
8178 
8179       yydestruct ("Error: popping",
8180                   yystos[yystate], yyvsp);
8181       YYPOPSTACK (1);
8182       yystate = *yyssp;
8183       YY_STACK_PRINT (yyss, yyssp);
8184     }
8185 
8186   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
8187   *++yyvsp = yylval;
8188   YY_IGNORE_MAYBE_UNINITIALIZED_END
8189 
8190 
8191   /* Shift the error token.  */
8192   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
8193 
8194   yystate = yyn;
8195   goto yynewstate;
8196 
8197 
8198 /*-------------------------------------.
8199 | yyacceptlab -- YYACCEPT comes here.  |
8200 `-------------------------------------*/
8201 yyacceptlab:
8202   yyresult = 0;
8203   goto yyreturn;
8204 
8205 
8206 /*-----------------------------------.
8207 | yyabortlab -- YYABORT comes here.  |
8208 `-----------------------------------*/
8209 yyabortlab:
8210   yyresult = 1;
8211   goto yyreturn;
8212 
8213 
8214 #if !defined yyoverflow || YYERROR_VERBOSE
8215 /*-------------------------------------------------.
8216 | yyexhaustedlab -- memory exhaustion comes here.  |
8217 `-------------------------------------------------*/
8218 yyexhaustedlab:
8219   yyerror (YY_("memory exhausted"));
8220   yyresult = 2;
8221   /* Fall through.  */
8222 #endif
8223 
8224 
8225 /*-----------------------------------------------------.
8226 | yyreturn -- parsing is finished, return the result.  |
8227 `-----------------------------------------------------*/
8228 yyreturn:
8229   if (yychar != YYEMPTY)
8230     {
8231       /* Make sure we have latest lookahead translation.  See comments at
8232          user semantic actions for why this is necessary.  */
8233       yytoken = YYTRANSLATE (yychar);
8234       yydestruct ("Cleanup: discarding lookahead",
8235                   yytoken, &yylval);
8236     }
8237   /* Do not reclaim the symbols of the rule whose action triggered
8238      this YYABORT or YYACCEPT.  */
8239   YYPOPSTACK (yylen);
8240   YY_STACK_PRINT (yyss, yyssp);
8241   while (yyssp != yyss)
8242     {
8243       yydestruct ("Cleanup: popping",
8244                   yystos[+*yyssp], yyvsp);
8245       YYPOPSTACK (1);
8246     }
8247 #ifndef yyoverflow
8248   if (yyss != yyssa)
8249     YYSTACK_FREE (yyss);
8250 #endif
8251 #if YYERROR_VERBOSE
8252   if (yymsg != yymsgbuf)
8253     YYSTACK_FREE (yymsg);
8254 #endif
8255   return yyresult;
8256 }
8257 #line 3217 "src/p.y"
8258 
8259 
8260 
8261 /* -------------------------------------------------------- Parser interface */
8262 
8263 
8264 /**
8265  * Syntactic error routine
8266  *
8267  * This routine is automatically called by the lexer!
8268  */
yyerror(const char * s,...)8269 void yyerror(const char *s, ...) {
8270         ASSERT(s);
8271         char *msg = NULL;
8272         va_list ap;
8273         va_start(ap, s);
8274         msg = Str_vcat(s, ap);
8275         va_end(ap);
8276         Log_error("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext);
8277         cfg_errflag++;
8278         FREE(msg);
8279 }
8280 
8281 
8282 /**
8283  * Syntactical warning routine
8284  */
yywarning(const char * s,...)8285 void yywarning(const char *s, ...) {
8286         ASSERT(s);
8287         char *msg = NULL;
8288         va_list ap;
8289         va_start(ap, s);
8290         msg = Str_vcat(s, ap);
8291         va_end(ap);
8292         Log_warning("%s:%i: %s '%s'\n", currentfile, lineno, msg, yytext);
8293         FREE(msg);
8294 }
8295 
8296 
8297 /**
8298  * Argument error routine
8299  */
yyerror2(const char * s,...)8300 void yyerror2(const char *s, ...) {
8301         ASSERT(s);
8302         char *msg = NULL;
8303         va_list ap;
8304         va_start(ap, s);
8305         msg = Str_vcat(s, ap);
8306         va_end(ap);
8307         Log_error("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
8308         cfg_errflag++;
8309         FREE(msg);
8310 }
8311 
8312 
8313 /**
8314  * Argument warning routine
8315  */
yywarning2(const char * s,...)8316 void yywarning2(const char *s, ...) {
8317         ASSERT(s);
8318         char *msg = NULL;
8319         va_list ap;
8320         va_start(ap, s);
8321         msg = Str_vcat(s, ap);
8322         va_end(ap);
8323         Log_warning("%s:%i: %s '%s'\n", argcurrentfile, arglineno, msg, argyytext);
8324         FREE(msg);
8325 }
8326 
8327 
8328 /*
8329  * The Parser hook - start parsing the control file
8330  * Returns true if parsing succeeded, otherwise false
8331  */
parse(char * controlfile)8332 bool parse(char *controlfile) {
8333         ASSERT(controlfile);
8334 
8335         if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) {
8336                 Log_error("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR);
8337                 return false;
8338         }
8339 
8340         currentfile = Str_dup(controlfile);
8341 
8342         available_statistics(&systeminfo);
8343 
8344         /*
8345          * Creation of the global service list is synchronized
8346          */
8347         LOCK(Run.mutex)
8348         {
8349                 preparse();
8350                 yyparse();
8351                 fclose(yyin);
8352                 postparse();
8353         }
8354         END_LOCK;
8355 
8356         FREE(currentfile);
8357 
8358         if (argyytext != NULL)
8359                 FREE(argyytext);
8360 
8361         /*
8362          * Secure check the monitrc file. The run control file must have the
8363          * same uid as the REAL uid of this process, it must have permissions
8364          * no greater than 700 and it must not be a symbolic link.
8365          */
8366         if (! file_checkStat(controlfile, "control file", S_IRUSR|S_IWUSR|S_IXUSR))
8367                 return false;
8368 
8369         return cfg_errflag == 0;
8370 }
8371 
8372 
8373 /* ----------------------------------------------------------------- Private */
8374 
8375 
8376 /**
8377  * Initialize objects used by the parser.
8378  */
preparse()8379 static void preparse() {
8380         servicelist = tail = current = NULL;
8381         /* Set instance incarnation ID */
8382         time(&Run.incarnation);
8383         /* Reset lexer */
8384         buffer_stack_ptr            = 0;
8385         lineno                      = 1;
8386         arglineno                   = 1;
8387         argcurrentfile              = NULL;
8388         argyytext                   = NULL;
8389         /* Reset parser */
8390         Run.limits.sendExpectBuffer  = LIMIT_SENDEXPECTBUFFER;
8391         Run.limits.fileContentBuffer = LIMIT_FILECONTENTBUFFER;
8392         Run.limits.httpContentBuffer = LIMIT_HTTPCONTENTBUFFER;
8393         Run.limits.programOutput     = LIMIT_PROGRAMOUTPUT;
8394         Run.limits.networkTimeout    = LIMIT_NETWORKTIMEOUT;
8395         Run.limits.programTimeout    = LIMIT_PROGRAMTIMEOUT;
8396         Run.limits.stopTimeout       = LIMIT_STOPTIMEOUT;
8397         Run.limits.startTimeout      = LIMIT_STARTTIMEOUT;
8398         Run.limits.restartTimeout    = LIMIT_RESTARTTIMEOUT;
8399         Run.onreboot                 = Onreboot_Start;
8400         Run.mmonitcredentials        = NULL;
8401         Run.httpd.flags              = Httpd_Disabled | Httpd_Signature;
8402         Run.httpd.credentials        = NULL;
8403         memset(&(Run.httpd.socket), 0, sizeof(Run.httpd.socket));
8404         Run.mailserver_timeout       = SMTP_TIMEOUT;
8405         Run.eventlist_dir            = NULL;
8406         Run.eventlist_slots          = -1;
8407         Run.system                   = NULL;
8408         Run.mmonits                  = NULL;
8409         Run.maillist                 = NULL;
8410         Run.mailservers              = NULL;
8411         Run.MailFormat.from          = NULL;
8412         Run.MailFormat.replyto       = NULL;
8413         Run.MailFormat.subject       = NULL;
8414         Run.MailFormat.message       = NULL;
8415         depend_list                  = NULL;
8416         Run.flags |= Run_HandlerInit | Run_MmonitCredentials;
8417         for (int i = 0; i <= Handler_Max; i++)
8418                 Run.handler_queue[i] = 0;
8419 
8420         /*
8421          * Initialize objects
8422          */
8423         reset_uidset();
8424         reset_gidset();
8425         reset_statusset();
8426         reset_sizeset();
8427         reset_mailset();
8428         reset_sslset();
8429         reset_mailserverset();
8430         reset_mmonitset();
8431         reset_responsetimeset();
8432         reset_portset();
8433         reset_permset();
8434         reset_icmpset();
8435         reset_linkstatusset();
8436         reset_linkspeedset();
8437         reset_linksaturationset();
8438         reset_bandwidthset();
8439         reset_rateset(&rate);
8440         reset_rateset(&rate1);
8441         reset_rateset(&rate2);
8442         reset_filesystemset();
8443         reset_resourceset();
8444         reset_checksumset();
8445         reset_timestampset();
8446         reset_actionrateset();
8447 }
8448 
8449 
8450 /*
8451  * Check that values are reasonable after parsing
8452  */
postparse()8453 static void postparse() {
8454         if (cfg_errflag)
8455                 return;
8456 
8457         /* If defined - add the last service to the service list */
8458         if (current) {
8459                 addservice(current);
8460                 current = NULL;
8461         }
8462 
8463         /* Check that we do not start monit in daemon mode without having a poll time */
8464         if (! Run.polltime && ((Run.flags & Run_Daemon) || (Run.flags & Run_Foreground))) {
8465                 Log_error("Poll time is invalid or not defined. Please define poll time in the control file\nas a number (> 0)  or use the -d option when starting monit\n");
8466                 cfg_errflag++;
8467         }
8468 
8469         if (Run.files.log)
8470                 Run.flags |= Run_Log;
8471 
8472         /* Add the default general system service if not specified explicitly: service name default to hostname */
8473         if (! Run.system) {
8474                 char hostname[STRLEN];
8475                 if (gethostname(hostname, sizeof(hostname))) {
8476                         Log_error("Cannot get system hostname -- please add 'check system <name>'\n");
8477                         cfg_errflag++;
8478                 }
8479                 if (Util_existService(hostname)) {
8480                         Log_error("'check system' not defined in control file, failed to add automatic configuration (service name %s is used already) -- please add 'check system <name>' manually\n", hostname);
8481                         cfg_errflag++;
8482                 }
8483                 Run.system = createservice(Service_System, Str_dup(hostname), NULL, check_system);
8484                 addservice(Run.system);
8485         }
8486         addeventaction(&(Run.system->action_MONIT_START), Action_Start, Action_Ignored);
8487         addeventaction(&(Run.system->action_MONIT_STOP), Action_Stop,  Action_Ignored);
8488 
8489         if (Run.mmonits) {
8490                 if (Run.httpd.flags & Httpd_Net) {
8491                         if (Run.flags & Run_MmonitCredentials) {
8492                                 Auth_T c;
8493                                 for (c = Run.httpd.credentials; c; c = c->next) {
8494                                         if (c->digesttype == Digest_Cleartext && ! c->is_readonly) {
8495                                                 Run.mmonitcredentials = c;
8496                                                 break;
8497                                         }
8498                                 }
8499                                 if (! Run.mmonitcredentials)
8500                                         Log_warning("M/Monit registration with credentials enabled, but no suitable credentials found in monit configuration file -- please add 'allow user:password' option to 'set httpd' statement\n");
8501                         }
8502                 } else if (Run.httpd.flags & Httpd_Unix) {
8503                         Log_warning("M/Monit enabled but Monit httpd is using unix socket -- please change 'set httpd' statement to use TCP port in order to be able to manage services on Monit\n");
8504                 } else {
8505                         Log_warning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n");
8506                 }
8507         }
8508 
8509         /* Check the sanity of any dependency graph */
8510         check_depend();
8511 
8512 #if defined HAVE_OPENSSL && defined OPENSSL_FIPS
8513         Ssl_setFipsMode(Run.flags & Run_FipsEnabled);
8514 #endif
8515 
8516         Processor_setHttpPostLimit();
8517 }
8518 
8519 
_parseOutgoingAddress(char * ip,Outgoing_T * outgoing)8520 static bool _parseOutgoingAddress(char *ip, Outgoing_T *outgoing) {
8521         struct addrinfo *result, hints = {.ai_flags = AI_NUMERICHOST};
8522         int status = getaddrinfo(ip, NULL, &hints, &result);
8523         if (status == 0) {
8524                 outgoing->ip = ip;
8525                 outgoing->addrlen = result->ai_addrlen;
8526                 memcpy(&(outgoing->addr), result->ai_addr, result->ai_addrlen);
8527                 freeaddrinfo(result);
8528                 return true;
8529         } else {
8530                 yyerror2("IP address parsing failed for %s -- %s", ip, status == EAI_SYSTEM ? STRERROR : gai_strerror(status));
8531         }
8532         return false;
8533 }
8534 
8535 
8536 /*
8537  * Create a new service object and add any current objects to the
8538  * service list.
8539  */
createservice(Service_Type type,char * name,char * value,State_Type (* check)(Service_T s))8540 static Service_T createservice(Service_Type type, char *name, char *value, State_Type (*check)(Service_T s)) {
8541         ASSERT(name);
8542 
8543         check_name(name);
8544 
8545         if (current)
8546                 addservice(current);
8547 
8548         NEW(current);
8549         current->type = type;
8550         switch (type) {
8551                 case Service_Directory:
8552                         NEW(current->inf.directory);
8553                         break;
8554                 case Service_Fifo:
8555                         NEW(current->inf.fifo);
8556                         break;
8557                 case Service_File:
8558                         NEW(current->inf.file);
8559                         break;
8560                 case Service_Filesystem:
8561                         NEW(current->inf.filesystem);
8562                         break;
8563                 case Service_Net:
8564                         NEW(current->inf.net);
8565                         break;
8566                 case Service_Process:
8567                         NEW(current->inf.process);
8568                         break;
8569                 default:
8570                         break;
8571         }
8572         Util_resetInfo(current);
8573 
8574         if (type == Service_Program) {
8575                 NEW(current->program);
8576                 current->program->args = command;
8577                 command = NULL;
8578                 current->program->timeout = Run.limits.programTimeout;
8579         }
8580 
8581         /* Set default values */
8582         current->onrebootRestored = false;
8583         current->mode     = Monitor_Active;
8584         current->monitor  = Monitor_Init;
8585         current->onreboot = Run.onreboot;
8586         current->name     = name;
8587         current->name_urlescaped = Util_urlEncode(name, false);
8588         current->name_htmlescaped = escapeHTML(StringBuffer_create(16), name);
8589         current->check    = check;
8590         current->path     = value;
8591 
8592         /* Initialize general event handlers */
8593         addeventaction(&(current)->action_DATA,     Action_Alert,     Action_Alert);
8594         addeventaction(&(current)->action_EXEC,     Action_Alert,     Action_Alert);
8595         addeventaction(&(current)->action_INVALID,  Action_Restart,   Action_Alert);
8596 
8597         /* Initialize internal event handlers */
8598         addeventaction(&(current)->action_ACTION,       Action_Alert, Action_Ignored);
8599 
8600         gettimeofday(&current->collected, NULL);
8601 
8602         return current;
8603 }
8604 
8605 
8606 /*
8607  * Add a service object to the servicelist
8608  */
addservice(Service_T s)8609 static void addservice(Service_T s) {
8610         ASSERT(s);
8611 
8612         // Test sanity check
8613         switch (s->type) {
8614                 case Service_Host:
8615                         // Verify that a remote service has a port or an icmp list
8616                         if (! s->portlist && ! s->icmplist) {
8617                                 Log_error("'check host' statement is incomplete: Please specify a port number to test\n or an icmp test at the remote host: '%s'\n", s->name);
8618                                 cfg_errflag++;
8619                         }
8620                         break;
8621                 case Service_Program:
8622                         // Verify that a program test has a status test
8623                         if (! s->statuslist && ! s->matchlist) {
8624                                 Log_error("'check program %s' is incomplete: Please add a 'status' or 'content' test\n", s->name);
8625                                 cfg_errflag++;
8626                         }
8627                         char program[PATH_MAX];
8628                         strncpy(program, s->program->args->arg[0], sizeof(program) - 1);
8629                         // Require that the program exist before creating the Command object
8630                         if (File_isExecutable(program)) {
8631                                 s->program->C = Command_new(program, NULL);
8632                                 for (int i = 1; i < s->program->args->length; i++) {
8633                                         Command_appendArgument(s->program->C, s->program->args->arg[i]);
8634                                         snprintf(program + strlen(program), sizeof(program) - strlen(program) - 1, " %s", s->program->args->arg[i]);
8635                                 }
8636                                 s->path = Str_dup(program);
8637                                 if (s->program->args->has_uid)
8638                                         Command_setUid(s->program->C, s->program->args->uid);
8639                                 if (s->program->args->has_gid)
8640                                         Command_setGid(s->program->C, s->program->args->gid);
8641                                 // Set environment
8642                                 Command_setEnv(s->program->C, "MONIT_SERVICE", s->name);
8643                         } else {
8644                                 Log_error("A 'check program' statement requires the program to exist '%s'\n", program);
8645                                 cfg_errflag++;
8646                         }
8647                         break;
8648                 case Service_Net:
8649                         if (! s->linkstatuslist) {
8650                                 // Add link status test if not defined
8651                                 addeventaction(&(linkstatusset).action, Action_Alert, Action_Alert);
8652                                 addlinkstatus(s, &linkstatusset);
8653                         }
8654                         break;
8655                 case Service_Filesystem:
8656                         if (! s->nonexistlist && ! s->existlist) {
8657                                 // Add non-existence test if not defined
8658                                 addeventaction(&(nonexistset).action, Action_Restart, Action_Alert);
8659                                 addnonexist(&nonexistset);
8660                         }
8661                         if (! s->fsflaglist) {
8662                                 // Add filesystem flags change test if not defined
8663                                 addeventaction(&(fsflagset).action, Action_Alert, Action_Ignored);
8664                                 addfsflag(&fsflagset);
8665                         }
8666                         break;
8667                 case Service_Directory:
8668                 case Service_Fifo:
8669                 case Service_File:
8670                 case Service_Process:
8671                         if (! s->nonexistlist && ! s->existlist) {
8672                                 // Add existence test if not defined
8673                                 addeventaction(&(nonexistset).action, Action_Restart, Action_Alert);
8674                                 addnonexist(&nonexistset);
8675                         }
8676                         break;
8677                 default:
8678                         break;
8679         }
8680 
8681         // No "every" statement was used, monitor each cycle
8682         if (s->every.type == Every_Initializing)
8683                 s->every.type = Every_Cycle;
8684 
8685         /* Add the service to the end of the service list */
8686         if (tail != NULL) {
8687                 tail->next = s;
8688                 tail->next_conf = s;
8689         } else {
8690                 servicelist = s;
8691                 servicelist_conf = s;
8692         }
8693         tail = s;
8694 }
8695 
8696 
8697 /*
8698  * Add entry to service group list
8699  */
addservicegroup(char * name)8700 static void addservicegroup(char *name) {
8701         ServiceGroup_T g;
8702 
8703         ASSERT(name);
8704 
8705         /* Check if service group with the same name is defined already */
8706         for (g = servicegrouplist; g; g = g->next)
8707                 if (IS(g->name, name))
8708                         break;
8709 
8710         if (! g) {
8711                 NEW(g);
8712                 g->name = Str_dup(name);
8713                 g->members = List_new();
8714                 g->next = servicegrouplist;
8715                 servicegrouplist = g;
8716         }
8717 
8718         List_append(g->members, current);
8719 }
8720 
8721 
8722 /*
8723  * Add a dependant entry to the current service dependant list
8724  */
adddependant(char * dependant)8725 static void adddependant(char *dependant) {
8726         Dependant_T d;
8727 
8728         ASSERT(dependant);
8729 
8730         NEW(d);
8731 
8732         if (current->dependantlist)
8733                 d->next = current->dependantlist;
8734 
8735         d->dependant = dependant;
8736         d->dependant_urlescaped = Util_urlEncode(dependant, false);
8737         d->dependant_htmlescaped = escapeHTML(StringBuffer_create(16), dependant);
8738         current->dependantlist = d;
8739 
8740 }
8741 
8742 
8743 /*
8744  * Add the given mailaddress with the appropriate alert notification
8745  * values and mail attributes to the given mailinglist.
8746  */
addmail(char * mailto,Mail_T f,Mail_T * l)8747 static void addmail(char *mailto, Mail_T f, Mail_T *l) {
8748         Mail_T m;
8749 
8750         ASSERT(mailto);
8751 
8752         NEW(m);
8753         m->to       = mailto;
8754         m->from     = f->from;
8755         m->replyto  = f->replyto;
8756         m->subject  = f->subject;
8757         m->message  = f->message;
8758         m->events   = f->events;
8759         m->reminder = f->reminder;
8760 
8761         m->next = *l;
8762         *l = m;
8763 
8764         reset_mailset();
8765 }
8766 
8767 
8768 /*
8769  * Add the given portset to the current service's portlist
8770  */
addport(Port_T * list,Port_T port)8771 static void addport(Port_T *list, Port_T port) {
8772         ASSERT(port);
8773 
8774         if (port->protocol->check == check_radius && port->type != Socket_Udp)
8775                 yyerror("Radius protocol test supports UDP only");
8776 
8777         Port_T p;
8778         NEW(p);
8779         p->is_available       = Connection_Init;
8780         p->check_invers       = port->check_invers;
8781         p->type               = port->type;
8782         p->socket             = port->socket;
8783         p->family             = port->family;
8784         p->action             = port->action;
8785         p->timeout            = port->timeout;
8786         p->retry              = port->retry;
8787         p->protocol           = port->protocol;
8788         p->hostname           = port->hostname;
8789         p->url_request        = port->url_request;
8790         p->outgoing           = port->outgoing;
8791 
8792         if (p->family == Socket_Unix) {
8793                 p->target.unix.pathname = port->target.unix.pathname;
8794         } else {
8795                 p->target.net.port = port->target.net.port;
8796                 if (sslset.flags) {
8797 #ifdef HAVE_OPENSSL
8798                         p->target.net.ssl.certificate.minimumDays = port->target.net.ssl.certificate.minimumDays;
8799                         if (sslset.flags && (p->target.net.port == 25 || p->target.net.port == 143 || p->target.net.port == 587))
8800                                 sslset.flags = SSL_StartTLS;
8801                         _setSSLOptions(&(p->target.net.ssl.options));
8802 #else
8803                         yyerror("SSL check cannot be activated -- Monit was not built with SSL support");
8804 #endif
8805                 }
8806         }
8807         memcpy(&p->parameters, &port->parameters, sizeof(port->parameters));
8808 
8809         if (p->protocol->check == check_http) {
8810                 if (p->parameters.http.checksum) {
8811                         cleanup_hash_string(p->parameters.http.checksum);
8812                         if (strlen(p->parameters.http.checksum) == 32)
8813                                 p->parameters.http.hashtype = Hash_Md5;
8814                         else if (strlen(p->parameters.http.checksum) == 40)
8815                                 p->parameters.http.hashtype = Hash_Sha1;
8816                         else
8817                                 yyerror2("invalid checksum [%s]", p->parameters.http.checksum);
8818                 } else {
8819                         p->parameters.http.hashtype = Hash_Unknown;
8820                 }
8821                 if (! p->parameters.http.method) {
8822                         p->parameters.http.method = Http_Get;
8823                 } else if (p->parameters.http.method == Http_Head) {
8824                         // Sanity check: if content or checksum test is used, the method Http_Head is not allowed, as we need the content
8825                         if ((p->url_request && p->url_request->regex) || p->parameters.http.checksum) {
8826                                 yyerror2("if response content or checksum test is enabled, the HEAD method is not allowed");
8827                         }
8828                 }
8829         } else if (p->protocol->check == check_mysql) {
8830                 if (p->parameters.mysql.rsaChecksum) {
8831                         if (! p->parameters.mysql.username)
8832                                 yyerror2("the rsakey checksum test requires credentials to be defined");
8833                         if (p->target.net.ssl.options.flags != SSL_Disabled)
8834                                 yyerror2("the rsakey checksum test can be used just with unsecured mysql protocol");
8835                 }
8836         }
8837 
8838         p->responsetime.limit    = responsetimeset.limit;
8839         p->responsetime.current  = responsetimeset.current;
8840         p->responsetime.operator = responsetimeset.operator;
8841 
8842         p->next = *list;
8843         *list = p;
8844 
8845         reset_sslset();
8846         reset_responsetimeset();
8847         reset_portset();
8848 
8849 }
8850 
8851 
addhttpheader(Port_T port,char * header)8852 static void addhttpheader(Port_T port, char *header) {
8853         if (! port->parameters.http.headers) {
8854                 port->parameters.http.headers = List_new();
8855         }
8856         if (Str_startsWith(header, "Connection:") && ! Str_sub(header, "close")) {
8857                 yywarning("We don't recommend setting the Connection header. Monit will always close the connection even if 'keep-alive' is set\n");
8858         }
8859         List_append(port->parameters.http.headers, header);
8860 }
8861 
8862 
8863 /*
8864  * Add a new resource object to the current service resource list
8865  */
addresource(Resource_T rr)8866 static void addresource(Resource_T rr) {
8867         ASSERT(rr);
8868         if (Run.flags & Run_ProcessEngineEnabled) {
8869                 Resource_T r;
8870                 NEW(r);
8871                 r->resource_id = rr->resource_id;
8872                 r->limit       = rr->limit;
8873                 r->action      = rr->action;
8874                 r->operator    = rr->operator;
8875                 r->next        = current->resourcelist;
8876                 current->resourcelist = r;
8877         } else {
8878                 yywarning("Cannot activate service check. The process status engine was disabled. On certain systems you must run monit as root to utilize this feature)\n");
8879         }
8880         reset_resourceset();
8881 }
8882 
8883 
8884 /*
8885  * Add a new file object to the current service timestamp list
8886  */
addtimestamp(Timestamp_T ts)8887 static void addtimestamp(Timestamp_T ts) {
8888         ASSERT(ts);
8889 
8890         Timestamp_T t;
8891         NEW(t);
8892         t->type         = ts->type;
8893         t->operator     = ts->operator;
8894         t->time         = ts->time;
8895         t->action       = ts->action;
8896         t->test_changes = ts->test_changes;
8897 
8898         t->next = current->timestamplist;
8899         current->timestamplist = t;
8900 
8901         reset_timestampset();
8902 }
8903 
8904 
8905 /*
8906  * Add a new object to the current service actionrate list
8907  */
addactionrate(ActionRate_T ar)8908 static void addactionrate(ActionRate_T ar) {
8909         ActionRate_T a;
8910 
8911         ASSERT(ar);
8912 
8913         if (ar->count > ar->cycle)
8914                 yyerror2("The number of restarts must be less than poll cycles");
8915         if (ar->count <= 0 || ar->cycle <= 0)
8916                 yyerror2("Zero or negative values not allowed in a action rate statement");
8917 
8918         NEW(a);
8919         a->count  = ar->count;
8920         a->cycle  = ar->cycle;
8921         a->action = ar->action;
8922 
8923         a->next = current->actionratelist;
8924         current->actionratelist = a;
8925 
8926         reset_actionrateset();
8927 }
8928 
8929 
8930 
8931 /*
8932  * Add a new Size object to the current service size list
8933  */
addsize(Size_T ss)8934 static void addsize(Size_T ss) {
8935         Size_T s;
8936         struct stat buf;
8937 
8938         ASSERT(ss);
8939 
8940         NEW(s);
8941         s->operator     = ss->operator;
8942         s->size         = ss->size;
8943         s->action       = ss->action;
8944         s->test_changes = ss->test_changes;
8945         /* Get the initial size for future comparison, if the file exists */
8946         if (s->test_changes) {
8947                 s->initialized = ! stat(current->path, &buf);
8948                 if (s->initialized)
8949                         s->size = (unsigned long long)buf.st_size;
8950         }
8951 
8952         s->next = current->sizelist;
8953         current->sizelist = s;
8954 
8955         reset_sizeset();
8956 }
8957 
8958 
8959 /*
8960  * Add a new Uptime object to the current service uptime list
8961  */
adduptime(Uptime_T uu)8962 static void adduptime(Uptime_T uu) {
8963         Uptime_T u;
8964 
8965         ASSERT(uu);
8966 
8967         NEW(u);
8968         u->operator = uu->operator;
8969         u->uptime = uu->uptime;
8970         u->action = uu->action;
8971 
8972         u->next = current->uptimelist;
8973         current->uptimelist = u;
8974 
8975         reset_uptimeset();
8976 }
8977 
8978 
8979 /*
8980  * Add a new Pid object to the current service pid list
8981  */
addpid(Pid_T pp)8982 static void addpid(Pid_T pp) {
8983         ASSERT(pp);
8984 
8985         Pid_T p;
8986         NEW(p);
8987         p->action = pp->action;
8988 
8989         p->next = current->pidlist;
8990         current->pidlist = p;
8991 
8992         reset_pidset();
8993 }
8994 
8995 
8996 /*
8997  * Add a new PPid object to the current service ppid list
8998  */
addppid(Pid_T pp)8999 static void addppid(Pid_T pp) {
9000         ASSERT(pp);
9001 
9002         Pid_T p;
9003         NEW(p);
9004         p->action = pp->action;
9005 
9006         p->next = current->ppidlist;
9007         current->ppidlist = p;
9008 
9009         reset_ppidset();
9010 }
9011 
9012 
9013 /*
9014  * Add a new Fsflag object to the current service fsflag list
9015  */
addfsflag(FsFlag_T ff)9016 static void addfsflag(FsFlag_T ff) {
9017         ASSERT(ff);
9018 
9019         FsFlag_T f;
9020         NEW(f);
9021         f->action = ff->action;
9022 
9023         f->next = current->fsflaglist;
9024         current->fsflaglist = f;
9025 
9026         reset_fsflagset();
9027 }
9028 
9029 
9030 /*
9031  * Add a new Nonexist object to the current service list
9032  */
addnonexist(NonExist_T ff)9033 static void addnonexist(NonExist_T ff) {
9034         ASSERT(ff);
9035 
9036         NonExist_T f;
9037         NEW(f);
9038         f->action = ff->action;
9039 
9040         f->next = current->nonexistlist;
9041         current->nonexistlist = f;
9042 
9043         reset_nonexistset();
9044 }
9045 
9046 
addexist(Exist_T rule)9047 static void addexist(Exist_T rule) {
9048         ASSERT(rule);
9049         Exist_T r;
9050         NEW(r);
9051         r->action = rule->action;
9052         r->next = current->existlist;
9053         current->existlist = r;
9054         reset_existset();
9055 }
9056 
9057 
9058 /*
9059  * Set Checksum object in the current service
9060  */
addchecksum(Checksum_T cs)9061 static void addchecksum(Checksum_T cs) {
9062         ASSERT(cs);
9063 
9064         cs->initialized = true;
9065 
9066         if (STR_UNDEF(cs->hash)) {
9067                 if (cs->type == Hash_Unknown)
9068                         cs->type = Hash_Default;
9069                 if (! (Checksum_getChecksum(current->path, cs->type, cs->hash, sizeof(cs->hash)))) {
9070                         /* If the file doesn't exist, set dummy value */
9071                         snprintf(cs->hash, sizeof(cs->hash), cs->type == Hash_Md5 ? "00000000000000000000000000000000" : "0000000000000000000000000000000000000000");
9072                         cs->initialized = false;
9073                         yywarning2("Cannot compute a checksum for file %s", current->path);
9074                 }
9075         }
9076 
9077         int len = cleanup_hash_string(cs->hash);
9078         if (cs->type == Hash_Unknown) {
9079                 if (len == 32) {
9080                         cs->type = Hash_Md5;
9081                 } else if (len == 40) {
9082                         cs->type = Hash_Sha1;
9083                 } else {
9084                         yyerror2("Unknown checksum type [%s] for file %s", cs->hash, current->path);
9085                         reset_checksumset();
9086                         return;
9087                 }
9088         } else if ((cs->type == Hash_Md5 && len != 32) || (cs->type == Hash_Sha1 && len != 40)) {
9089                 yyerror2("Invalid checksum [%s] for file %s", cs->hash, current->path);
9090                 reset_checksumset();
9091                 return;
9092         }
9093 
9094         Checksum_T c;
9095         NEW(c);
9096         c->type         = cs->type;
9097         c->test_changes = cs->test_changes;
9098         c->initialized  = cs->initialized;
9099         c->action       = cs->action;
9100         snprintf(c->hash, sizeof(c->hash), "%s", cs->hash);
9101 
9102         current->checksum = c;
9103 
9104         reset_checksumset();
9105 
9106 }
9107 
9108 
9109 /*
9110  * Set Perm object in the current service
9111  */
addperm(Perm_T ps)9112 static void addperm(Perm_T ps) {
9113         ASSERT(ps);
9114 
9115         Perm_T p;
9116         NEW(p);
9117         p->action = ps->action;
9118         p->test_changes = ps->test_changes;
9119         if (p->test_changes) {
9120                 if (! File_exist(current->path))
9121                         DEBUG("The path '%s' used in the PERMISSION statement refer to a non-existing object\n", current->path);
9122                 else if ((p->perm = File_mod(current->path)) < 0)
9123                         yyerror2("Cannot get the timestamp for '%s'", current->path);
9124                 else
9125                         p->perm &= 07777;
9126         } else {
9127                 p->perm = ps->perm;
9128         }
9129         current->perm = p;
9130         reset_permset();
9131 }
9132 
9133 
addlinkstatus(Service_T s,LinkStatus_T L)9134 static void addlinkstatus(Service_T s, LinkStatus_T L) {
9135         ASSERT(L);
9136 
9137         LinkStatus_T l;
9138 
9139         // Sanity check: we don't support link up/down tests mix
9140         for (l = s->linkstatuslist; l; l = l->next) {
9141                 if (l->check_invers != L->check_invers)
9142                         yyerror2("Mixing link up and down tests is not supported");
9143         }
9144 
9145         if (L->check_invers)
9146                 s->inverseStatus = true;
9147 
9148         NEW(l);
9149         l->check_invers = L->check_invers;
9150         l->action = L->action;
9151 
9152         l->next = s->linkstatuslist;
9153         s->linkstatuslist = l;
9154 
9155         reset_linkstatusset();
9156 }
9157 
9158 
addlinkspeed(Service_T s,LinkSpeed_T L)9159 static void addlinkspeed(Service_T s, LinkSpeed_T L) {
9160         ASSERT(L);
9161 
9162         LinkSpeed_T l;
9163         NEW(l);
9164         l->action = L->action;
9165 
9166         l->next = s->linkspeedlist;
9167         s->linkspeedlist = l;
9168 
9169         reset_linkspeedset();
9170 }
9171 
9172 
addlinksaturation(Service_T s,LinkSaturation_T L)9173 static void addlinksaturation(Service_T s, LinkSaturation_T L) {
9174         ASSERT(L);
9175 
9176         LinkSaturation_T l;
9177         NEW(l);
9178         l->operator = L->operator;
9179         l->limit = L->limit;
9180         l->action = L->action;
9181 
9182         l->next = s->linksaturationlist;
9183         s->linksaturationlist = l;
9184 
9185         reset_linksaturationset();
9186 }
9187 
9188 
9189 /*
9190  * Return Bandwidth object
9191  */
addbandwidth(Bandwidth_T * list,Bandwidth_T b)9192 static void addbandwidth(Bandwidth_T *list, Bandwidth_T b) {
9193         ASSERT(list);
9194         ASSERT(b);
9195 
9196         if (b->rangecount * b->range > 24 * Time_Hour) {
9197                 yyerror2("Maximum range for total test is 24 hours");
9198         } else if (b->range == Time_Minute && b->rangecount > 60) {
9199                 yyerror2("Maximum value for [minute(s)] unit is 60");
9200         } else if (b->range == Time_Hour && b->rangecount > 24) {
9201                 yyerror2("Maximum value for [hour(s)] unit is 24");
9202         } else if (b->range == Time_Day && b->rangecount > 1) {
9203                 yyerror2("Maximum value for [day(s)] unit is 1");
9204         } else {
9205                 if (b->range == Time_Day) {
9206                         // translate last day -> last 24 hours
9207                         b->rangecount = 24;
9208                         b->range = Time_Hour;
9209                 }
9210                 Bandwidth_T bandwidth;
9211                 NEW(bandwidth);
9212                 bandwidth->operator = b->operator;
9213                 bandwidth->limit = b->limit;
9214                 bandwidth->rangecount = b->rangecount;
9215                 bandwidth->range = b->range;
9216                 bandwidth->action = b->action;
9217                 bandwidth->next = *list;
9218                 *list = bandwidth;
9219         }
9220         reset_bandwidthset();
9221 }
9222 
9223 
appendmatch(Match_T * list,Match_T item)9224 static void appendmatch(Match_T *list, Match_T item) {
9225         if (*list) {
9226                 /* Find the end of the list (keep the same patterns order as in the config file) */
9227                 Match_T last;
9228                 for (last = *list; last->next; last = last->next)
9229                         ;
9230                 last->next = item;
9231         } else {
9232                 *list = item;
9233         }
9234 }
9235 
9236 
9237 /*
9238  * Set Match object in the current service
9239  */
addmatch(Match_T ms,int actionnumber,int linenumber)9240 static void addmatch(Match_T ms, int actionnumber, int linenumber) {
9241         Match_T m;
9242 
9243         ASSERT(ms);
9244 
9245         NEW(m);
9246         NEW(m->regex_comp);
9247 
9248         m->match_string = ms->match_string;
9249         m->match_path   = ms->match_path ? Str_dup(ms->match_path) : NULL;
9250         m->action       = ms->action;
9251         m->not          = ms->not;
9252         m->ignore       = ms->ignore;
9253         m->next         = NULL;
9254 
9255         addeventaction(&(m->action), actionnumber, Action_Ignored);
9256 
9257         int reg_return = regcomp(m->regex_comp, ms->match_string, REG_NOSUB|REG_EXTENDED);
9258 
9259         if (reg_return != 0) {
9260                 char errbuf[STRLEN];
9261                 regerror(reg_return, ms->regex_comp, errbuf, STRLEN);
9262                 if (m->match_path != NULL)
9263                         yyerror2("Regex parsing error: %s on line %i of", errbuf, linenumber);
9264                 else
9265                         yyerror2("Regex parsing error: %s", errbuf);
9266         }
9267         appendmatch(m->ignore ? &current->matchignorelist : &current->matchlist, m);
9268 }
9269 
9270 
addmatchpath(Match_T ms,Action_Type actionnumber)9271 static void addmatchpath(Match_T ms, Action_Type actionnumber) {
9272         ASSERT(ms->match_path);
9273 
9274         FILE *handle = fopen(ms->match_path, "r");
9275         if (handle == NULL) {
9276                 yyerror2("Cannot read regex match file (%s)", ms->match_path);
9277                 return;
9278         }
9279 
9280         // 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
9281         command_t savecommand = command1;
9282         for (int linenumber = 1; ! feof(handle); linenumber++) {
9283                 char buf[2048];
9284 
9285                 if (! fgets(buf, sizeof(buf), handle))
9286                         continue;
9287 
9288                 size_t len = strlen(buf);
9289 
9290                 if (len == 0 || buf[0] == '\n')
9291                         continue;
9292 
9293                 if (buf[len - 1] == '\n')
9294                         buf[len - 1] = 0;
9295 
9296                 ms->match_string = Str_dup(buf);
9297 
9298                 if (actionnumber == Action_Exec) {
9299                         if (command1 == NULL) {
9300                                 ASSERT(savecommand);
9301                                 command1 = copycommand(savecommand);
9302                         }
9303                 }
9304 
9305                 addmatch(ms, actionnumber, linenumber);
9306         }
9307         if (actionnumber == Action_Exec && savecommand)
9308                 gccmd(&savecommand);
9309 
9310         fclose(handle);
9311 }
9312 
9313 
9314 /*
9315  * Set exit status test object in the current service
9316  */
addstatus(Status_T status)9317 static void addstatus(Status_T status) {
9318         Status_T s;
9319         ASSERT(status);
9320         NEW(s);
9321         s->initialized = status->initialized;
9322         s->return_value = status->return_value;
9323         s->operator = status->operator;
9324         s->action = status->action;
9325         s->next = current->statuslist;
9326         current->statuslist = s;
9327 
9328         reset_statusset();
9329 }
9330 
9331 
9332 /*
9333  * Set Uid object in the current service
9334  */
adduid(Uid_T u)9335 static Uid_T adduid(Uid_T u) {
9336         ASSERT(u);
9337 
9338         Uid_T uid;
9339         NEW(uid);
9340         uid->uid = u->uid;
9341         uid->action = u->action;
9342         reset_uidset();
9343         return uid;
9344 }
9345 
9346 
9347 /*
9348  * Set Gid object in the current service
9349  */
addgid(Gid_T g)9350 static Gid_T addgid(Gid_T g) {
9351         ASSERT(g);
9352 
9353         Gid_T gid;
9354         NEW(gid);
9355         gid->gid = g->gid;
9356         gid->action = g->action;
9357         reset_gidset();
9358         return gid;
9359 }
9360 
9361 
9362 /*
9363  * Add a new filesystem to the current service's filesystem list
9364  */
addfilesystem(FileSystem_T ds)9365 static void addfilesystem(FileSystem_T ds) {
9366         FileSystem_T dev;
9367 
9368         ASSERT(ds);
9369 
9370         NEW(dev);
9371         dev->resource           = ds->resource;
9372         dev->operator           = ds->operator;
9373         dev->limit_absolute     = ds->limit_absolute;
9374         dev->limit_percent      = ds->limit_percent;
9375         dev->action             = ds->action;
9376 
9377         dev->next               = current->filesystemlist;
9378         current->filesystemlist = dev;
9379 
9380         reset_filesystemset();
9381 
9382 }
9383 
9384 
9385 /*
9386  * Add a new icmp object to the current service's icmp list
9387  */
addicmp(Icmp_T is)9388 static void addicmp(Icmp_T is) {
9389         Icmp_T icmp;
9390 
9391         ASSERT(is);
9392 
9393         NEW(icmp);
9394         icmp->family        = is->family;
9395         icmp->type          = is->type;
9396         icmp->size          = is->size;
9397         icmp->count         = is->count;
9398         icmp->timeout       = is->timeout;
9399         icmp->action        = is->action;
9400         icmp->outgoing      = is->outgoing;
9401         icmp->check_invers  = is->check_invers;
9402         icmp->is_available  = Connection_Init;
9403 
9404         icmp->responsetime.limit    = responsetimeset.limit;
9405         icmp->responsetime.current  = responsetimeset.current;
9406         icmp->responsetime.operator = responsetimeset.operator;
9407 
9408         icmp->next          = current->icmplist;
9409         current->icmplist   = icmp;
9410 
9411         reset_responsetimeset();
9412         reset_icmpset();
9413 }
9414 
9415 
9416 /*
9417  * Set EventAction object
9418  */
addeventaction(EventAction_T * _ea,Action_Type failed,Action_Type succeeded)9419 static void addeventaction(EventAction_T *_ea, Action_Type failed, Action_Type succeeded) {
9420         EventAction_T ea;
9421 
9422         ASSERT(_ea);
9423 
9424         NEW(ea);
9425         NEW(ea->failed);
9426         NEW(ea->succeeded);
9427 
9428         ea->failed->id = failed;
9429         ea->failed->repeat = repeat1;
9430         ea->failed->count = rate1.count;
9431         ea->failed->cycles = rate1.cycles;
9432         if (failed == Action_Exec) {
9433                 ASSERT(command1);
9434                 ea->failed->exec = command1;
9435                 command1 = NULL;
9436         }
9437 
9438         ea->succeeded->id = succeeded;
9439         ea->succeeded->repeat = repeat2;
9440         ea->succeeded->count = rate2.count;
9441         ea->succeeded->cycles = rate2.cycles;
9442         if (succeeded == Action_Exec) {
9443                 ASSERT(command2);
9444                 ea->succeeded->exec = command2;
9445                 command2 = NULL;
9446         }
9447         *_ea = ea;
9448         reset_rateset(&rate);
9449         reset_rateset(&rate1);
9450         reset_rateset(&rate2);
9451         repeat = repeat1 = repeat2 = 0;
9452 }
9453 
9454 
9455 /*
9456  * Add a generic protocol handler to
9457  */
addgeneric(Port_T port,char * send,char * expect)9458 static void addgeneric(Port_T port, char *send, char *expect) {
9459         Generic_T g = port->parameters.generic.sendexpect;
9460         if (! g) {
9461                 NEW(g);
9462                 port->parameters.generic.sendexpect = g;
9463         } else {
9464                 while (g->next)
9465                         g = g->next;
9466                 NEW(g->next);
9467                 g = g->next;
9468         }
9469         if (send) {
9470                 g->send = send;
9471                 g->expect = NULL;
9472         } else if (expect) {
9473                 int reg_return;
9474                 NEW(g->expect);
9475                 reg_return = regcomp(g->expect, expect, REG_NOSUB|REG_EXTENDED);
9476                 FREE(expect);
9477                 if (reg_return != 0) {
9478                         char errbuf[STRLEN];
9479                         regerror(reg_return, g->expect, errbuf, STRLEN);
9480                         yyerror2("Regex parsing error: %s", errbuf);
9481                 }
9482                 g->send = NULL;
9483         }
9484 }
9485 
9486 
9487 /*
9488  * Add the current command object to the current service object's
9489  * start or stop program.
9490  */
addcommand(int what,unsigned int timeout)9491 static void addcommand(int what, unsigned int timeout) {
9492 
9493         switch (what) {
9494                 case START:   current->start = command; break;
9495                 case STOP:    current->stop = command; break;
9496                 case RESTART: current->restart = command; break;
9497         }
9498 
9499         command->timeout = timeout;
9500 
9501         command = NULL;
9502 
9503 }
9504 
9505 
9506 /*
9507  * Add a new argument to the argument list
9508  */
addargument(char * argument)9509 static void addargument(char *argument) {
9510 
9511         ASSERT(argument);
9512 
9513         if (! command) {
9514                 check_exec(argument);
9515                 NEW(command);
9516         }
9517 
9518         command->arg[command->length++] = argument;
9519         command->arg[command->length] = NULL;
9520 
9521         if (command->length >= ARGMAX)
9522                 yyerror("Exceeded maximum number of program arguments");
9523 
9524 }
9525 
9526 
9527 /*
9528  * Setup a url request for the current port object
9529  */
prepare_urlrequest(URL_T U)9530 static void prepare_urlrequest(URL_T U) {
9531 
9532         ASSERT(U);
9533 
9534         /* Only the HTTP protocol is supported for URLs currently. See also the lexer if this is to be changed in the future */
9535         portset.protocol = Protocol_get(Protocol_HTTP);
9536 
9537         if (urlrequest == NULL)
9538                 NEW(urlrequest);
9539         urlrequest->url = U;
9540         portset.hostname = Str_dup(U->hostname);
9541         portset.target.net.port = U->port;
9542         portset.url_request = urlrequest;
9543         portset.type = Socket_Tcp;
9544         portset.parameters.http.request = Str_cat("%s%s%s", U->path, U->query ? "?" : "", U->query ? U->query : "");
9545         if (IS(U->protocol, "https"))
9546                 sslset.flags = SSL_Enabled;
9547 }
9548 
9549 
9550 /*
9551  * Set the url request for a port
9552  */
seturlrequest(int operator,char * regex)9553 static void  seturlrequest(int operator, char *regex) {
9554 
9555         ASSERT(regex);
9556 
9557         if (! urlrequest)
9558                 NEW(urlrequest);
9559         urlrequest->operator = operator;
9560         int reg_return;
9561         NEW(urlrequest->regex);
9562         reg_return = regcomp(urlrequest->regex, regex, REG_NOSUB|REG_EXTENDED);
9563         if (reg_return != 0) {
9564                 char errbuf[STRLEN];
9565                 regerror(reg_return, urlrequest->regex, errbuf, STRLEN);
9566                 yyerror2("Regex parsing error: %s", errbuf);
9567         }
9568 }
9569 
9570 
9571 /*
9572  * Add a new data recipient server to the mmonit server list
9573  */
addmmonit(Mmonit_T mmonit)9574 static void addmmonit(Mmonit_T mmonit) {
9575         ASSERT(mmonit->url);
9576 
9577         Mmonit_T c;
9578         NEW(c);
9579         c->url = mmonit->url;
9580         c->compress = MmonitCompress_Init;
9581         _setSSLOptions(&(c->ssl));
9582         if (IS(c->url->protocol, "https")) {
9583 #ifdef HAVE_OPENSSL
9584                 c->ssl.flags = SSL_Enabled;
9585 #else
9586                 yyerror("SSL check cannot be activated -- SSL disabled");
9587 #endif
9588         }
9589         c->timeout = mmonit->timeout;
9590         c->next = NULL;
9591 
9592         if (Run.mmonits) {
9593                 Mmonit_T C;
9594                 for (C = Run.mmonits; C->next; C = C->next)
9595                         /* Empty */ ;
9596                 C->next = c;
9597         } else {
9598                 Run.mmonits = c;
9599         }
9600         reset_sslset();
9601         reset_mmonitset();
9602 }
9603 
9604 
9605 /*
9606  * Add a new smtp server to the mail server list
9607  */
addmailserver(MailServer_T mailserver)9608 static void addmailserver(MailServer_T mailserver) {
9609 
9610         MailServer_T s;
9611 
9612         ASSERT(mailserver->host);
9613 
9614         NEW(s);
9615         s->host        = mailserver->host;
9616         s->port        = mailserver->port;
9617         s->username    = mailserver->username;
9618         s->password    = mailserver->password;
9619 
9620         if (sslset.flags && (mailserver->port == 25 || mailserver->port == 587))
9621                 sslset.flags = SSL_StartTLS;
9622         _setSSLOptions(&(s->ssl));
9623 
9624         s->next = NULL;
9625 
9626         if (Run.mailservers) {
9627                 MailServer_T l;
9628                 for (l = Run.mailservers; l->next; l = l->next)
9629                         /* empty */;
9630                 l->next = s;
9631         } else {
9632                 Run.mailservers = s;
9633         }
9634         reset_mailserverset();
9635 }
9636 
9637 
9638 /*
9639  * Return uid if found on the system. If the parameter user is NULL
9640  * the uid parameter is used for looking up the user id on the system,
9641  * otherwise the user parameter is used.
9642  */
get_uid(char * user,uid_t uid)9643 static uid_t get_uid(char *user, uid_t uid) {
9644         char buf[4096];
9645         struct passwd pwd, *result = NULL;
9646         if (user) {
9647                 if (getpwnam_r(user, &pwd, buf, sizeof(buf), &result) != 0 || ! result) {
9648                         yyerror2("Requested user not found on the system");
9649                         return(0);
9650                 }
9651         } else {
9652                 if (getpwuid_r(uid, &pwd, buf, sizeof(buf), &result) != 0 || ! result) {
9653                         yyerror2("Requested uid not found on the system");
9654                         return(0);
9655                 }
9656         }
9657         return(pwd.pw_uid);
9658 }
9659 
9660 
9661 /*
9662  * Return gid if found on the system. If the parameter group is NULL
9663  * the gid parameter is used for looking up the group id on the system,
9664  * otherwise the group parameter is used.
9665  */
get_gid(char * group,gid_t gid)9666 static gid_t get_gid(char *group, gid_t gid) {
9667         struct group *grd;
9668 
9669         if (group) {
9670                 grd = getgrnam(group);
9671 
9672                 if (! grd) {
9673                         yyerror2("Requested group not found on the system");
9674                         return(0);
9675                 }
9676 
9677         } else {
9678 
9679                 if (! (grd = getgrgid(gid))) {
9680                         yyerror2("Requested gid not found on the system");
9681                         return(0);
9682                 }
9683 
9684         }
9685 
9686         return(grd->gr_gid);
9687 
9688 }
9689 
9690 
9691 /*
9692  * Add a new user id to the current command object.
9693  */
addeuid(uid_t uid)9694 static void addeuid(uid_t uid) {
9695         if (! getuid()) {
9696                 command->has_uid = true;
9697                 command->uid = uid;
9698         } else {
9699                 yyerror("UID statement requires root privileges");
9700         }
9701 }
9702 
9703 
9704 /*
9705  * Add a new group id to the current command object.
9706  */
addegid(gid_t gid)9707 static void addegid(gid_t gid) {
9708         if (! getuid()) {
9709                 command->has_gid = true;
9710                 command->gid = gid;
9711         } else {
9712                 yyerror("GID statement requires root privileges");
9713         }
9714 }
9715 
9716 
9717 /*
9718  * Reset the logfile if changed
9719  */
setlogfile(char * logfile)9720 static void setlogfile(char *logfile) {
9721         if (Run.files.log) {
9722                 if (IS(Run.files.log, logfile)) {
9723                         FREE(logfile);
9724                         return;
9725                 } else {
9726                         FREE(Run.files.log);
9727                 }
9728         }
9729         Run.files.log = logfile;
9730 }
9731 
9732 
9733 /*
9734  * Reset the pidfile if changed
9735  */
setpidfile(char * pidfile)9736 static void setpidfile(char *pidfile) {
9737         if (Run.files.pid) {
9738                 if (IS(Run.files.pid, pidfile)) {
9739                         FREE(pidfile);
9740                         return;
9741                 } else {
9742                         FREE(Run.files.pid);
9743                 }
9744         }
9745         Run.files.pid = pidfile;
9746 }
9747 
9748 
9749 /*
9750  * Read a apache htpasswd file and add credentials found for username
9751  */
addhtpasswdentry(char * filename,char * username,Digest_Type dtype)9752 static void addhtpasswdentry(char *filename, char *username, Digest_Type dtype) {
9753         char *ht_username = NULL;
9754         char *ht_passwd = NULL;
9755         char buf[STRLEN];
9756         FILE *handle = NULL;
9757         int credentials_added = 0;
9758 
9759         ASSERT(filename);
9760 
9761         handle = fopen(filename, "r");
9762 
9763         if (handle == NULL) {
9764                 if (username != NULL)
9765                         yyerror2("Cannot read htpasswd (%s) for user %s", filename, username);
9766                 else
9767                         yyerror2("Cannot read htpasswd (%s)", filename);
9768                 return;
9769         }
9770 
9771         while (! feof(handle)) {
9772                 char *colonindex = NULL;
9773 
9774                 if (! fgets(buf, STRLEN, handle))
9775                         continue;
9776 
9777                 Str_rtrim(buf);
9778                 Str_curtail(buf, "#");
9779 
9780                 if (NULL == (colonindex = strchr(buf, ':')))
9781                 continue;
9782 
9783                 ht_passwd = Str_dup(colonindex+1);
9784                 *colonindex = '\0';
9785 
9786                 /* In case we have a file in /etc/passwd or /etc/shadow style we
9787                  *  want to remove ":.*$" and Crypt and MD5 hashed dont have a colon
9788                  */
9789 
9790                 if ((NULL != (colonindex = strchr(ht_passwd, ':'))) && (dtype != Digest_Cleartext))
9791                         *colonindex = '\0';
9792 
9793                 ht_username = Str_dup(buf);
9794 
9795                 if (username == NULL) {
9796                         if (addcredentials(ht_username, ht_passwd, dtype, false))
9797                                 credentials_added++;
9798                 } else if (Str_cmp(username, ht_username) == 0)  {
9799                         if (addcredentials(ht_username, ht_passwd, dtype, false))
9800                                 credentials_added++;
9801                 } else {
9802                         FREE(ht_passwd);
9803                         FREE(ht_username);
9804                 }
9805         }
9806 
9807         if (credentials_added == 0) {
9808                 if (username == NULL)
9809                         yywarning2("htpasswd file (%s) has no usable credentials", filename);
9810                 else
9811                         yywarning2("htpasswd file (%s) has no usable credentials for user %s", filename, username);
9812         }
9813         fclose(handle);
9814 }
9815 
9816 
9817 #ifdef HAVE_LIBPAM
addpamauth(char * groupname,int readonly)9818 static void addpamauth(char* groupname, int readonly) {
9819         Auth_T prev = NULL;
9820 
9821         ASSERT(groupname);
9822 
9823         if (! Run.httpd.credentials)
9824                 NEW(Run.httpd.credentials);
9825 
9826         Auth_T c = Run.httpd.credentials;
9827         do {
9828                 if (c->groupname != NULL && IS(c->groupname, groupname)) {
9829                         yywarning2("PAM group %s was added already, entry ignored", groupname);
9830                         FREE(groupname);
9831                         return;
9832                 }
9833                 prev = c;
9834                 c = c->next;
9835         } while (c != NULL);
9836 
9837         NEW(prev->next);
9838         c = prev->next;
9839 
9840         c->next        = NULL;
9841         c->uname       = NULL;
9842         c->passwd      = NULL;
9843         c->groupname   = groupname;
9844         c->digesttype  = Digest_Pam;
9845         c->is_readonly = readonly;
9846 
9847         DEBUG("Adding PAM group '%s'\n", groupname);
9848 
9849         return;
9850 }
9851 #endif
9852 
9853 
9854 /*
9855  * Add Basic Authentication credentials
9856  */
addcredentials(char * uname,char * passwd,Digest_Type dtype,bool readonly)9857 static bool addcredentials(char *uname, char *passwd, Digest_Type dtype, bool readonly) {
9858         Auth_T c;
9859 
9860         ASSERT(uname);
9861         ASSERT(passwd);
9862 
9863         if (strlen(passwd) > Str_compareConstantTimeStringLength) {
9864                 yyerror2("Password for user %s is too long, maximum %d allowed", uname, Str_compareConstantTimeStringLength);
9865                 FREE(uname);
9866                 FREE(passwd);
9867                 return false;
9868         }
9869 
9870         if (! Run.httpd.credentials) {
9871                 NEW(Run.httpd.credentials);
9872                 c = Run.httpd.credentials;
9873         } else {
9874                 if (Util_getUserCredentials(uname) != NULL) {
9875                         yywarning2("Credentials for user %s were already added, entry ignored", uname);
9876                         FREE(uname);
9877                         FREE(passwd);
9878                         return false;
9879                 }
9880                 c = Run.httpd.credentials;
9881                 while (c->next != NULL)
9882                         c = c->next;
9883                 NEW(c->next);
9884                 c = c->next;
9885         }
9886 
9887         c->next        = NULL;
9888         c->uname       = uname;
9889         c->passwd      = passwd;
9890         c->groupname   = NULL;
9891         c->digesttype  = dtype;
9892         c->is_readonly = readonly;
9893 
9894         DEBUG("Adding credentials for user '%s'\n", uname);
9895 
9896         return true;
9897 
9898 }
9899 
9900 
9901 /*
9902  * Set the syslog and the facilities to be used
9903  */
setsyslog(char * facility)9904 static void setsyslog(char *facility) {
9905 
9906         if (! Run.files.log || ihp.logfile) {
9907                 ihp.logfile = true;
9908                 setlogfile(Str_dup("syslog"));
9909                 Run.flags |= Run_UseSyslog;
9910                 Run.flags |= Run_Log;
9911         }
9912 
9913         if (facility) {
9914                 if (IS(facility,"log_local0"))
9915                         Run.facility = LOG_LOCAL0;
9916                 else if (IS(facility, "log_local1"))
9917                         Run.facility = LOG_LOCAL1;
9918                 else if (IS(facility, "log_local2"))
9919                         Run.facility = LOG_LOCAL2;
9920                 else if (IS(facility, "log_local3"))
9921                         Run.facility = LOG_LOCAL3;
9922                 else if (IS(facility, "log_local4"))
9923                         Run.facility = LOG_LOCAL4;
9924                 else if (IS(facility, "log_local5"))
9925                         Run.facility = LOG_LOCAL5;
9926                 else if (IS(facility, "log_local6"))
9927                         Run.facility = LOG_LOCAL6;
9928                 else if (IS(facility, "log_local7"))
9929                         Run.facility = LOG_LOCAL7;
9930                 else if (IS(facility, "log_daemon"))
9931                         Run.facility = LOG_DAEMON;
9932                 else
9933                         yyerror2("Invalid syslog facility");
9934         } else {
9935                 Run.facility = LOG_USER;
9936         }
9937 
9938 }
9939 
9940 
9941 /*
9942  * Reset the current sslset for reuse
9943  */
reset_sslset()9944 static void reset_sslset() {
9945         memset(&sslset, 0, sizeof(struct SslOptions_T));
9946         sslset.version = sslset.verify = sslset.allowSelfSigned = -1;
9947 }
9948 
9949 
9950 /*
9951  * Reset the current mailset for reuse
9952  */
reset_mailset()9953 static void reset_mailset() {
9954         memset(&mailset, 0, sizeof(struct Mail_T));
9955 }
9956 
9957 
9958 /*
9959  * Reset the mailserver set to default values
9960  */
reset_mailserverset()9961 static void reset_mailserverset() {
9962         memset(&mailserverset, 0, sizeof(struct MailServer_T));
9963         mailserverset.port = PORT_SMTP;
9964 }
9965 
9966 
9967 /*
9968  * Reset the mmonit set to default values
9969  */
reset_mmonitset()9970 static void reset_mmonitset() {
9971         memset(&mmonitset, 0, sizeof(struct Mmonit_T));
9972         mmonitset.timeout = Run.limits.networkTimeout;
9973 }
9974 
9975 
9976 /*
9977  * Reset the Port set to default values
9978  */
reset_portset()9979 static void reset_portset() {
9980         memset(&portset, 0, sizeof(struct Port_T));
9981         portset.check_invers = false;
9982         portset.socket = -1;
9983         portset.type = Socket_Tcp;
9984         portset.family = Socket_Ip;
9985         portset.timeout = Run.limits.networkTimeout;
9986         portset.retry = 1;
9987         portset.protocol = Protocol_get(Protocol_DEFAULT);
9988         urlrequest = NULL;
9989 }
9990 
9991 
9992 /*
9993  * Reset the Proc set to default values
9994  */
reset_resourceset()9995 static void reset_resourceset() {
9996         resourceset.resource_id = 0;
9997         resourceset.limit = 0;
9998         resourceset.action = NULL;
9999         resourceset.operator = Operator_Equal;
10000 }
10001 
10002 
10003 /*
10004  * Reset the Timestamp set to default values
10005  */
reset_timestampset()10006 static void reset_timestampset() {
10007         timestampset.type = Timestamp_Default;
10008         timestampset.operator = Operator_Equal;
10009         timestampset.time = 0;
10010         timestampset.test_changes = false;
10011         timestampset.initialized = false;
10012         timestampset.action = NULL;
10013 }
10014 
10015 
10016 /*
10017  * Reset the ActionRate set to default values
10018  */
reset_actionrateset()10019 static void reset_actionrateset() {
10020         actionrateset.count = 0;
10021         actionrateset.cycle = 0;
10022         actionrateset.action = NULL;
10023 }
10024 
10025 
10026 /*
10027  * Reset the Size set to default values
10028  */
reset_sizeset()10029 static void reset_sizeset() {
10030         sizeset.operator = Operator_Equal;
10031         sizeset.size = 0;
10032         sizeset.test_changes = false;
10033         sizeset.action = NULL;
10034 }
10035 
10036 
10037 /*
10038  * Reset the Uptime set to default values
10039  */
reset_uptimeset()10040 static void reset_uptimeset() {
10041         uptimeset.operator = Operator_Equal;
10042         uptimeset.uptime = 0;
10043         uptimeset.action = NULL;
10044 }
10045 
10046 
reset_responsetimeset()10047 static void reset_responsetimeset() {
10048         responsetimeset.operator = Operator_Less;
10049         responsetimeset.current = 0.;
10050         responsetimeset.limit = -1.;
10051 }
10052 
10053 
reset_linkstatusset()10054 static void reset_linkstatusset() {
10055         linkstatusset.check_invers = false;
10056         linkstatusset.action = NULL;
10057 }
10058 
10059 
reset_linkspeedset()10060 static void reset_linkspeedset() {
10061         linkspeedset.action = NULL;
10062 }
10063 
10064 
reset_linksaturationset()10065 static void reset_linksaturationset() {
10066         linksaturationset.limit = 0.;
10067         linksaturationset.operator = Operator_Equal;
10068         linksaturationset.action = NULL;
10069 }
10070 
10071 
10072 /*
10073  * Reset the Bandwidth set to default values
10074  */
reset_bandwidthset()10075 static void reset_bandwidthset() {
10076         bandwidthset.operator = Operator_Equal;
10077         bandwidthset.limit = 0ULL;
10078         bandwidthset.action = NULL;
10079 }
10080 
10081 
10082 /*
10083  * Reset the Pid set to default values
10084  */
reset_pidset()10085 static void reset_pidset() {
10086         pidset.action = NULL;
10087 }
10088 
10089 
10090 /*
10091  * Reset the PPid set to default values
10092  */
reset_ppidset()10093 static void reset_ppidset() {
10094         ppidset.action = NULL;
10095 }
10096 
10097 
10098 /*
10099  * Reset the Fsflag set to default values
10100  */
reset_fsflagset()10101 static void reset_fsflagset() {
10102         fsflagset.action = NULL;
10103 }
10104 
10105 
10106 /*
10107  * Reset the Nonexist set to default values
10108  */
reset_nonexistset()10109 static void reset_nonexistset() {
10110         nonexistset.action = NULL;
10111 }
10112 
10113 
reset_existset()10114 static void reset_existset() {
10115         existset.action = NULL;
10116 }
10117 
10118 
10119 /*
10120  * Reset the Checksum set to default values
10121  */
reset_checksumset()10122 static void reset_checksumset() {
10123         checksumset.type         = Hash_Unknown;
10124         checksumset.test_changes = false;
10125         checksumset.action       = NULL;
10126         *checksumset.hash        = 0;
10127 }
10128 
10129 
10130 /*
10131  * Reset the Perm set to default values
10132  */
reset_permset()10133 static void reset_permset() {
10134         permset.test_changes = false;
10135         permset.perm = 0;
10136         permset.action = NULL;
10137 }
10138 
10139 
10140 /*
10141  * Reset the Status set to default values
10142  */
reset_statusset()10143 static void reset_statusset() {
10144         statusset.initialized = false;
10145         statusset.return_value = 0;
10146         statusset.operator = Operator_Equal;
10147         statusset.action = NULL;
10148 }
10149 
10150 
10151 /*
10152  * Reset the Uid set to default values
10153  */
reset_uidset()10154 static void reset_uidset() {
10155         uidset.uid = 0;
10156         uidset.action = NULL;
10157 }
10158 
10159 
10160 /*
10161  * Reset the Gid set to default values
10162  */
reset_gidset()10163 static void reset_gidset() {
10164         gidset.gid = 0;
10165         gidset.action = NULL;
10166 }
10167 
10168 
10169 /*
10170  * Reset the Filesystem set to default values
10171  */
reset_filesystemset()10172 static void reset_filesystemset() {
10173         filesystemset.resource = 0;
10174         filesystemset.operator = Operator_Equal;
10175         filesystemset.limit_absolute = -1;
10176         filesystemset.limit_percent = -1.;
10177         filesystemset.action = NULL;
10178 }
10179 
10180 
10181 /*
10182  * Reset the ICMP set to default values
10183  */
reset_icmpset()10184 static void reset_icmpset() {
10185         icmpset.type = ICMP_ECHO;
10186         icmpset.size = ICMP_SIZE;
10187         icmpset.count = ICMP_ATTEMPT_COUNT;
10188         icmpset.timeout = Run.limits.networkTimeout;
10189         icmpset.check_invers = false;
10190         icmpset.action = NULL;
10191 }
10192 
10193 
10194 /*
10195  * Reset the Rate set to default values
10196  */
reset_rateset(struct rate_t * r)10197 static void reset_rateset(struct rate_t *r) {
10198         r->count = 1;
10199         r->cycles = 1;
10200 }
10201 
10202 
10203 /* ---------------------------------------------------------------- Checkers */
10204 
10205 
10206 /*
10207  * Check for unique service name
10208  */
check_name(char * name)10209 static void check_name(char *name) {
10210         ASSERT(name);
10211 
10212         if (Util_existService(name) || (current && IS(name, current->name)))
10213                 yyerror2("Service name conflict, %s already defined", name);
10214         if (name && *name == '/')
10215                 yyerror2("Service name '%s' must not start with '/' -- ", name);
10216 }
10217 
10218 
10219 /*
10220  * Permission statement semantic check
10221  */
check_perm(int perm)10222 static int check_perm(int perm) {
10223         int result;
10224         char *status;
10225         char buf[STRLEN];
10226 
10227         snprintf(buf, STRLEN, "%d", perm);
10228 
10229         result = (int)strtol(buf, &status, 8);
10230 
10231         if (*status != '\0' || result < 0 || result > 07777)
10232                 yyerror2("Permission statements must have an octal value between 0 and 7777");
10233 
10234         return result;
10235 }
10236 
10237 
10238 /*
10239  * Check the dependency graph for errors
10240  * by doing a topological sort, thereby finding any cycles.
10241  * Assures that graph is a Directed Acyclic Graph (DAG).
10242  */
check_depend()10243 static void check_depend() {
10244         Service_T depends_on = NULL;
10245         Service_T* dlt = &depend_list; /* the current tail of it                                 */
10246         bool done;                /* no unvisited nodes left?                               */
10247         bool found_some;          /* last iteration found anything new ?                    */
10248         depend_list = NULL;            /* depend_list will be the topological sorted servicelist */
10249 
10250         do {
10251                 done = true;
10252                 found_some = false;
10253                 for (Service_T s = servicelist; s; s = s->next) {
10254                         Dependant_T d;
10255                         if (s->visited)
10256                                 continue;
10257                         done = false; // still unvisited nodes
10258                         depends_on = NULL;
10259                         for (d = s->dependantlist; d; d = d->next) {
10260                                 Service_T dp = Util_getService(d->dependant);
10261                                 if (! dp) {
10262                                         Log_error("Depending service '%s' is not defined in the control file\n", d->dependant);
10263                                         exit(1);
10264                                 }
10265                                 if (! dp->visited) {
10266                                         depends_on = dp;
10267                                 }
10268                         }
10269 
10270                         if (! depends_on) {
10271                                 s->visited = true;
10272                                 found_some = true;
10273                                 *dlt = s;
10274                                 dlt = &s->next_depend;
10275                         }
10276                 }
10277         } while (found_some && ! done);
10278 
10279         if (! done) {
10280                 ASSERT(depends_on);
10281                 Log_error("Found a depend loop in the control file involving the service '%s'\n", depends_on->name);
10282                 exit(1);
10283         }
10284 
10285         ASSERT(depend_list);
10286         servicelist = depend_list;
10287 
10288         for (Service_T s = depend_list; s; s = s->next_depend)
10289                 s->next = s->next_depend;
10290 }
10291 
10292 
10293 // Check and warn if the executable does not exist
check_exec(char * exec)10294 static void check_exec(char *exec) {
10295         if (! File_exist(exec))
10296                 yywarning2("Program does not exist:");
10297         else if (! File_isExecutable(exec))
10298                 yywarning2("Program is not executable:");
10299 }
10300 
10301 
10302 /* Return a valid max forward value for SIP header */
verifyMaxForward(int mf)10303 static int verifyMaxForward(int mf) {
10304         if (mf == 0) {
10305                 return INT_MAX; // Differentiate uninitialized (0) and explicit zero
10306         } else if (mf > 0 && mf <= 255) {
10307                 return mf;
10308         }
10309         yywarning2("SIP max forward is outside the range [0..255]. Setting max forward to 70");
10310         return 70;
10311 }
10312 
10313 
10314 /* -------------------------------------------------------------------- Misc */
10315 
10316 
10317 /*
10318  * Cleans up a hash string, tolower and remove byte separators
10319  */
cleanup_hash_string(char * hashstring)10320 static int cleanup_hash_string(char *hashstring) {
10321         int i = 0, j = 0;
10322 
10323         ASSERT(hashstring);
10324 
10325         while (hashstring[i]) {
10326                 if (isxdigit((int)hashstring[i])) {
10327                         hashstring[j] = tolower((int)hashstring[i]);
10328                         j++;
10329                 }
10330                 i++;
10331         }
10332         hashstring[j] = 0;
10333         return j;
10334 }
10335 
10336 
10337 /* Return deep copy of the command */
copycommand(command_t source)10338 static command_t copycommand(command_t source) {
10339         int i;
10340         command_t copy = NULL;
10341 
10342         NEW(copy);
10343         copy->length = source->length;
10344         copy->has_uid = source->has_uid;
10345         copy->uid = source->uid;
10346         copy->has_gid = source->has_gid;
10347         copy->gid = source->gid;
10348         copy->timeout = source->timeout;
10349         for (i = 0; i < copy->length; i++)
10350                 copy->arg[i] = Str_dup(source->arg[i]);
10351         copy->arg[copy->length] = NULL;
10352 
10353         return copy;
10354 }
10355 
10356 
_setPEM(char ** store,char * path,const char * description,bool isFile)10357 static void _setPEM(char **store, char *path, const char *description, bool isFile) {
10358         if (*store) {
10359                 yyerror2("Duplicate %s", description);
10360                 FREE(path);
10361         } else if (! File_exist(path)) {
10362                 yyerror2("%s doesn't exist", description);
10363                 FREE(path);
10364         } else if (! (isFile ? File_isFile(path) : File_isDirectory(path))) {
10365                 yyerror2("%s is not a %s", description, isFile ? "file" : "directory");
10366                 FREE(path);
10367         } else if (! File_isReadable(path)) {
10368                 yyerror2("Cannot read %s", description);
10369                 FREE(path);
10370         } else {
10371                 sslset.flags = SSL_Enabled;
10372                 *store = path;
10373         }
10374 }
10375 
10376 
_setSSLOptions(SslOptions_T options)10377 static void _setSSLOptions(SslOptions_T options) {
10378         options->allowSelfSigned = sslset.allowSelfSigned;
10379         options->CACertificateFile = sslset.CACertificateFile;
10380         options->CACertificatePath = sslset.CACertificatePath;
10381         options->checksum = sslset.checksum;
10382         options->checksumType = sslset.checksumType;
10383         options->ciphers = sslset.ciphers;
10384         options->clientpemfile = sslset.clientpemfile;
10385         options->flags = sslset.flags;
10386         options->pemfile = sslset.pemfile;
10387         options->pemchain = sslset.pemchain;
10388         options->pemkey = sslset.pemkey;
10389         options->verify = sslset.verify;
10390         options->version = sslset.version;
10391         reset_sslset();
10392 }
10393 
10394 
10395 #ifdef HAVE_OPENSSL
_setSSLVersion(short version)10396 static void _setSSLVersion(short version) {
10397         sslset.flags = SSL_Enabled;
10398         if (sslset.version == -1)
10399                 sslset.version = version;
10400         else
10401                 sslset.version |= version;
10402 }
10403 #endif
10404 
10405 
_unsetSSLVersion(short version)10406 static void _unsetSSLVersion(short version) {
10407         if (sslset.version != -1)
10408                 sslset.version &= ~version;
10409 }
10410 
10411 
addsecurityattribute(char * value,Action_Type failed,Action_Type succeeded)10412 static void addsecurityattribute(char *value, Action_Type failed, Action_Type succeeded) {
10413         SecurityAttribute_T attr;
10414         NEW(attr);
10415         addeventaction(&(attr->action), failed, succeeded);
10416         attr->attribute = value;
10417         attr->next = current->secattrlist;
10418         current->secattrlist = attr;
10419 }
10420 
10421 
addfiledescriptors(Operator_Type operator,bool total,long long value_absolute,float value_percent,Action_Type failed,Action_Type succeeded)10422 static void addfiledescriptors(Operator_Type operator, bool total, long long value_absolute, float value_percent, Action_Type failed, Action_Type succeeded) {
10423         Filedescriptors_T fds;
10424         NEW(fds);
10425         addeventaction(&(fds->action), failed, succeeded);
10426         fds->total = total;
10427         fds->limit_absolute = value_absolute;
10428         fds->limit_percent = value_percent;
10429         fds->operator = operator;
10430         fds->next = current->filedescriptorslist;
10431         current->filedescriptorslist = fds;
10432 }
10433 
_sanityCheckEveryStatement(Service_T s)10434 static void _sanityCheckEveryStatement(Service_T s) {
10435         if (s->every.type != Every_Initializing) {
10436                 yywarning2("The 'every' statement can be specified only once, the last value will be used\n");
10437                 switch (s->every.type) {
10438                         case Every_Cron:
10439                         case Every_NotInCron:
10440                                 FREE(s->every.spec.cron);
10441                                 break;
10442                         default:
10443                                 break;
10444                 }
10445         }
10446 }
10447 
10448