119 |
int pidfile; |
int pidfile; |
120 |
}; |
}; |
121 |
|
|
122 |
|
struct myrate { |
123 |
|
unsigned count; |
124 |
|
unsigned cycles; |
125 |
|
}; |
126 |
|
|
127 |
/* yacc interface */ |
/* yacc interface */ |
128 |
void yyerror(const char *,...); |
void yyerror(const char *,...); |
129 |
void yyerror2(const char *,...); |
void yyerror2(const char *,...); |
164 |
static struct mychecksum checksumset; |
static struct mychecksum checksumset; |
165 |
static struct mytimestamp timestampset; |
static struct mytimestamp timestampset; |
166 |
static struct IHavePrecedence ihp= {FALSE, FALSE, FALSE}; |
static struct IHavePrecedence ihp= {FALSE, FALSE, FALSE}; |
167 |
|
static struct myrate rate1 = {1, 1}; |
168 |
|
static struct myrate rate2 = {1, 1}; |
169 |
static char * htpasswd_file= NULL; |
static char * htpasswd_file= NULL; |
170 |
static int digesttype= DIGEST_CLEARTEXT; |
static int digesttype= DIGEST_CLEARTEXT; |
171 |
|
|
172 |
|
#define BITMAP_MAX (sizeof(long long) * 8) |
173 |
|
|
174 |
|
|
175 |
/* -------------------------------------------------------------- Prototypes */ |
/* -------------------------------------------------------------- Prototypes */ |
176 |
|
|
221 |
static void reset_gidset(); |
static void reset_gidset(); |
222 |
static void reset_deviceset(); |
static void reset_deviceset(); |
223 |
static void reset_icmpset(); |
static void reset_icmpset(); |
224 |
|
static void reset_rateset(); |
225 |
static void check_name(char *); |
static void check_name(char *); |
226 |
static void check_timeout(int, int); |
static void check_timeout(int, int); |
227 |
static void check_every(int); |
static void check_every(int); |
271 |
%token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5 |
%token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5 |
272 |
%token BYTE KILOBYTE MEGABYTE GIGABYTE |
%token BYTE KILOBYTE MEGABYTE GIGABYTE |
273 |
%token INODE SPACE PERMISSION SIZE MATCH NOT IGNORE |
%token INODE SPACE PERMISSION SIZE MATCH NOT IGNORE |
274 |
%token EXEC UNMONITOR ICMP ICMPECHO NONEXIST INVALID DATA RECOVERED |
%token EXEC UNMONITOR ICMP ICMPECHO NONEXIST INVALID DATA RECOVERED PASSED |
275 |
%token URL CONTENT PID PPID |
%token URL CONTENT PID PPID |
276 |
%token <url> URLOBJECT |
%token <url> URLOBJECT |
277 |
|
|
329 |
|
|
330 |
optfile : start |
optfile : start |
331 |
| stop |
| stop |
332 |
| timestamp |
| timestamp |
333 |
| timeout |
| timeout |
334 |
| every |
| every |
335 |
| alert |
| alert |
336 |
| permission |
| permission |
337 |
| uid |
| uid |
338 |
| gid |
| gid |
339 |
| checksum |
| checksum |
340 |
| size |
| size |
341 |
| match |
| match |
342 |
| mode |
| mode |
343 |
| group |
| group |
344 |
| depend |
| depend |
345 |
; |
; |
346 |
|
|
398 |
; |
; |
399 |
|
|
400 |
setalert : SET alertmail '{' eventoptionlist '}' formatlist reminder { |
setalert : SET alertmail '{' eventoptionlist '}' formatlist reminder { |
401 |
addmail($<string>2, &mailset, &Run.maillist, eventset, $<number>5); |
addmail($<string>2, &mailset, &Run.maillist, eventset, $<number>5); |
402 |
} |
} |
403 |
| SET alertmail formatlist reminder { |
| SET alertmail formatlist reminder { |
404 |
addmail($<string>2, &mailset, &Run.maillist, eventset, $<number>4); |
addmail($<string>2, &mailset, &Run.maillist, eventset, $<number>4); |
405 |
} |
} |
406 |
; |
; |
407 |
|
|
408 |
setdaemon : SET DAEMON NUMBER { |
setdaemon : SET DAEMON NUMBER { |
409 |
if(!Run.isdaemon || ihp.daemon) { |
if(!Run.isdaemon || ihp.daemon) { |
410 |
ihp.daemon= TRUE; |
ihp.daemon= TRUE; |
411 |
Run.isdaemon= TRUE; |
Run.isdaemon= TRUE; |
412 |
Run.polltime= $3; |
Run.polltime= $3; |
413 |
} |
} |
414 |
} |
} |
415 |
; |
; |
416 |
|
|
417 |
setinit : SET INIT { |
setinit : SET INIT { |
418 |
Run.init= TRUE; |
Run.init= TRUE; |
419 |
} |
} |
420 |
; |
; |
421 |
|
|
422 |
setlog : SET LOGFILE PATH { |
setlog : SET LOGFILE PATH { |
423 |
if(!Run.logfile || ihp.logfile) { |
if(!Run.logfile || ihp.logfile) { |
424 |
ihp.logfile= TRUE; |
ihp.logfile= TRUE; |
425 |
setlogfile($3); |
setlogfile($3); |
426 |
Run.use_syslog= FALSE; |
Run.use_syslog= FALSE; |
427 |
Run.dolog=TRUE; |
Run.dolog=TRUE; |
428 |
} |
} |
429 |
} |
} |
430 |
| SET LOGFILE SYSLOG { setsyslog(NULL); } |
| SET LOGFILE SYSLOG { |
431 |
|
setsyslog(NULL); |
432 |
|
} |
433 |
| SET LOGFILE SYSLOG FACILITY STRING { |
| SET LOGFILE SYSLOG FACILITY STRING { |
434 |
setsyslog($5); FREE($5); |
setsyslog($5); FREE($5); |
435 |
} |
} |
436 |
; |
; |
437 |
|
|
438 |
setstate : SET STATEFILE PATH { |
setstate : SET STATEFILE PATH { |
439 |
Run.statefile= $3; |
Run.statefile= $3; |
442 |
|
|
443 |
setpid : SET PIDFILE PATH { |
setpid : SET PIDFILE PATH { |
444 |
if(!Run.pidfile || ihp.pidfile) { |
if(!Run.pidfile || ihp.pidfile) { |
445 |
ihp.pidfile= TRUE; |
ihp.pidfile= TRUE; |
446 |
setpidfile($3); |
setpidfile($3); |
447 |
} |
} |
448 |
} |
} |
449 |
; |
; |
450 |
|
|
468 |
|
|
469 |
setmailformat : SET MAILFORMAT '{' formatoptionlist '}' { |
setmailformat : SET MAILFORMAT '{' formatoptionlist '}' { |
470 |
Run.MailFormat.from= |
Run.MailFormat.from= |
471 |
mailset.from? |
mailset.from? |
472 |
mailset.from: |
mailset.from: |
473 |
xstrdup(ALERT_FROM); |
xstrdup(ALERT_FROM); |
474 |
Run.MailFormat.subject= |
Run.MailFormat.subject= |
475 |
mailset.subject? |
mailset.subject? |
476 |
mailset.subject: |
mailset.subject: |
477 |
xstrdup(ALERT_SUBJECT); |
xstrdup(ALERT_SUBJECT); |
478 |
Run.MailFormat.message= |
Run.MailFormat.message= |
479 |
mailset.message? |
mailset.message? |
480 |
mailset.message: |
mailset.message: |
481 |
xstrdup(ALERT_MESSAGE); |
xstrdup(ALERT_MESSAGE); |
482 |
reset_mailset(); |
reset_mailset(); |
483 |
} |
} |
484 |
; |
; |
485 |
|
|
486 |
sethttpd : SET HTTPD PORT NUMBER httpdlist { |
sethttpd : SET HTTPD PORT NUMBER httpdlist { |
487 |
Run.dohttpd= TRUE; |
Run.dohttpd= TRUE; |
488 |
Run.httpdport= $4; |
Run.httpdport= $4; |
489 |
} |
} |
490 |
; |
; |
491 |
|
|
503 |
} |
} |
504 |
; |
; |
505 |
|
|
506 |
httpdlist : /* EMPTY */ |
httpdlist : /* EMPTY */ |
507 |
| httpdlist httpdoption |
| httpdlist httpdoption |
508 |
; |
; |
509 |
|
|
510 |
httpdoption : ssl |
httpdoption : ssl |
511 |
| signature |
| signature |
512 |
| bindaddress |
| bindaddress |
513 |
| allow |
| allow |
514 |
; |
; |
515 |
|
|
516 |
ssl : ssldisable { Run.httpdssl= FALSE; } |
ssl : ssldisable { Run.httpdssl= FALSE; } |
517 |
| sslenable pemfile clientpemfile allowselfcert { |
| sslenable pemfile clientpemfile allowselfcert { |
518 |
Run.httpdssl= TRUE; |
Run.httpdssl= TRUE; |
519 |
if(!have_ssl()) { |
if(!have_ssl()) { |
520 |
yyerror("SSL is not supported"); |
yyerror("SSL is not supported"); |
521 |
} |
} |
522 |
} |
} |
523 |
; |
; |
524 |
|
|
525 |
sslenable : HTTPDSSL |
sslenable : HTTPDSSL |
550 |
; |
; |
551 |
|
|
552 |
pemfile : PEMFILE PATH { |
pemfile : PEMFILE PATH { |
553 |
Run.httpsslpem= $2; |
Run.httpsslpem= $2; |
554 |
if(!File_checkStat(Run.httpsslpem, |
if(!File_checkStat(Run.httpsslpem, |
555 |
"SSL server PEM file", S_IRWXU)) |
"SSL server PEM file", S_IRWXU)) { |
556 |
yyerror2("SSL server PEM file has too" |
yyerror2("SSL server PEM file has too loose permissions"); |
557 |
" loose permissions"); |
} |
558 |
} |
} |
559 |
; |
; |
560 |
|
|
561 |
clientpemfile : /* EMPTY */ |
clientpemfile : /* EMPTY */ |
562 |
| CLIENTPEMFILE PATH { |
| CLIENTPEMFILE PATH { |
563 |
Run.httpsslclientpem= $2; |
Run.httpsslclientpem= $2; |
564 |
Run.clientssl= TRUE; |
Run.clientssl= TRUE; |
565 |
if(!File_checkStat(Run.httpsslclientpem, |
if(!File_checkStat(Run.httpsslclientpem, |
566 |
"SSL client PEM file", |
"SSL client PEM file", S_IRWXU | S_IRGRP | S_IROTH)) { |
567 |
S_IRWXU | S_IRGRP | S_IROTH)) |
yyerror2("SSL client PEM file has too loose permissions"); |
568 |
yyerror2("SSL client PEM file has too" |
} |
|
" loose permissions"); |
|
569 |
} |
} |
570 |
; |
; |
571 |
|
|
647 |
; |
; |
648 |
|
|
649 |
checkproc : CHECKPROC SERVICENAME PIDFILE PATH { |
checkproc : CHECKPROC SERVICENAME PIDFILE PATH { |
650 |
check_name($<string>2); |
check_name($<string>2); |
651 |
createservice(TYPE_PROCESS, $<string>2, $4, check_process); |
createservice(TYPE_PROCESS, $<string>2, $4, check_process); |
652 |
} |
} |
653 |
| CHECKPROC SERVICENAME PATHTOK PATH { |
| CHECKPROC SERVICENAME PATHTOK PATH { |
654 |
check_name($<string>2); |
check_name($<string>2); |
655 |
createservice(TYPE_PROCESS, $<string>2, $4, check_process); |
createservice(TYPE_PROCESS, $<string>2, $4, check_process); |
656 |
} |
} |
657 |
; |
; |
658 |
|
|
659 |
checkfile : CHECKFILE SERVICENAME PATHTOK PATH { |
checkfile : CHECKFILE SERVICENAME PATHTOK PATH { |
660 |
check_name($<string>2); |
check_name($<string>2); |
661 |
createservice(TYPE_FILE, $<string>2, $4, check_file); |
createservice(TYPE_FILE, $<string>2, $4, check_file); |
662 |
} |
} |
663 |
; |
; |
664 |
|
|
665 |
checkdev : CHECKDEV SERVICENAME PATHTOK PATH { |
checkdev : CHECKDEV SERVICENAME PATHTOK PATH { |
666 |
check_name($<string>2); |
check_name($<string>2); |
667 |
createservice(TYPE_DEVICE, $<string>2, $4, check_device); |
createservice(TYPE_DEVICE, $<string>2, $4, check_device); |
668 |
} |
} |
669 |
; |
; |
670 |
|
|
671 |
checkdir : CHECKDIR SERVICENAME PATHTOK PATH { |
checkdir : CHECKDIR SERVICENAME PATHTOK PATH { |
672 |
check_name($<string>2); |
check_name($<string>2); |
673 |
createservice(TYPE_DIRECTORY, $<string>2, $4, |
createservice(TYPE_DIRECTORY, $<string>2, $4, |
674 |
check_directory); |
check_directory); |
675 |
} |
} |
677 |
|
|
678 |
checkhost : CHECKHOST SERVICENAME ADDRESS STRING { |
checkhost : CHECKHOST SERVICENAME ADDRESS STRING { |
679 |
check_hostname($4); |
check_hostname($4); |
680 |
check_name($<string>2); |
check_name($<string>2); |
681 |
createservice(TYPE_HOST, $<string>2, $4, check_remote_host); |
createservice(TYPE_HOST, $<string>2, $4, check_remote_host); |
682 |
} |
} |
683 |
; |
; |
708 |
| GID NUMBER { addegid( get_gid(NULL, $2) ); } |
| GID NUMBER { addegid( get_gid(NULL, $2) ); } |
709 |
; |
; |
710 |
|
|
711 |
connection : IF FAILED host port type protocol nettimeout THEN action1 |
connection : IF FAILED host port type protocol nettimeout rate1 |
712 |
recovery { |
THEN action1 recovery { |
713 |
portset.timeout= $<number>7; |
portset.timeout= $<number>7; |
714 |
addeventaction(&(portset).action, $<number>9, $<number>10); |
addeventaction(&(portset).action, $<number>10, $<number>11); |
715 |
addport(&portset); |
addport(&portset); |
716 |
|
} |
717 |
|
| IF FAILED URL URLOBJECT urloption nettimeout rate1 |
718 |
|
THEN action1 recovery { |
719 |
|
prepare_urlrequest($<url>4); |
720 |
|
portset.timeout= $<number>6; |
721 |
|
addeventaction(&(portset).action, $<number>9, $<number>10); |
722 |
|
addport(&portset); |
723 |
} |
} |
|
| IF FAILED URL URLOBJECT urloption nettimeout THEN action1 |
|
|
recovery { |
|
|
prepare_urlrequest($<url>4); |
|
|
portset.timeout= $<number>6; |
|
|
addeventaction(&(portset).action, $<number>8, $<number>9); |
|
|
addport(&portset); |
|
|
} |
|
724 |
; |
; |
725 |
|
|
726 |
connectionunix : IF FAILED unixsocket type protocol nettimeout THEN action1 |
connectionunix : IF FAILED unixsocket type protocol nettimeout rate1 |
727 |
recovery { |
THEN action1 recovery { |
728 |
portset.timeout= $<number>6; |
portset.timeout= $<number>6; |
729 |
addeventaction(&(portset).action, $<number>8, $<number>9); |
addeventaction(&(portset).action, $<number>9, $<number>10); |
730 |
addport(&portset); |
addport(&portset); |
731 |
} |
} |
732 |
; |
; |
733 |
|
|
734 |
icmp : IF FAILED ICMP icmptype count nettimeout THEN action1 recovery { |
icmp : IF FAILED ICMP icmptype count nettimeout rate1 |
735 |
|
THEN action1 recovery { |
736 |
icmpset.type= $<number>4; |
icmpset.type= $<number>4; |
737 |
icmpset.count= $<number>5; |
icmpset.count= $<number>5; |
738 |
icmpset.timeout= $<number>6; |
icmpset.timeout= $<number>6; |
739 |
addeventaction(&(icmpset).action, $<number>8, $<number>9); |
addeventaction(&(icmpset).action, $<number>9, $<number>10); |
740 |
addicmp(&icmpset); |
addicmp(&icmpset); |
741 |
} |
} |
742 |
; |
; |
766 |
} |
} |
767 |
| TYPE TCPSSL sslversion certmd5 { |
| TYPE TCPSSL sslversion certmd5 { |
768 |
portset.type= SOCK_STREAM; |
portset.type= SOCK_STREAM; |
769 |
portset.SSL.use_ssl= TRUE; |
portset.SSL.use_ssl= TRUE; |
770 |
portset.SSL.version= $<number>3; |
portset.SSL.version= $<number>3; |
771 |
portset.SSL.certmd5= $<string>4; |
portset.SSL.certmd5= $<string>4; |
772 |
} |
} |
773 |
| TYPE UDP { |
| TYPE UDP { |
774 |
portset.type= SOCK_DGRAM; |
portset.type= SOCK_DGRAM; |
791 |
} |
} |
792 |
| PROTOCOL APACHESTATUS apache_stat_list { |
| PROTOCOL APACHESTATUS apache_stat_list { |
793 |
portset.protocol= addprotocol(P_APACHESTATUS); |
portset.protocol= addprotocol(P_APACHESTATUS); |
794 |
} |
} |
795 |
| PROTOCOL DEFAULT { |
| PROTOCOL DEFAULT { |
796 |
portset.protocol= addprotocol(P_DEFAULT); |
portset.protocol= addprotocol(P_DEFAULT); |
797 |
} |
} |
859 |
|
|
860 |
request : /* EMPTY */ |
request : /* EMPTY */ |
861 |
| REQUEST PATH { |
| REQUEST PATH { |
862 |
portset.request= Util_urlEncode($2); |
portset.request= Util_urlEncode($2); |
863 |
FREE($2); |
FREE($2); |
864 |
} |
} |
865 |
| REQUEST PATH CHECKSUM STRING { |
| REQUEST PATH CHECKSUM STRING { |
866 |
portset.request= Util_urlEncode($2); FREE($2); |
portset.request= Util_urlEncode($2); FREE($2); |
867 |
portset.request_checksum= $4; |
portset.request_checksum= $4; |
868 |
} |
} |
869 |
; |
; |
870 |
|
|
871 |
apache_stat_list: apache_stat |
apache_stat_list: apache_stat |
873 |
; |
; |
874 |
|
|
875 |
apache_stat : LOGLIMIT operator NUMBER PERCENT { |
apache_stat : LOGLIMIT operator NUMBER PERCENT { |
876 |
portset.ApacheStatus.loglimitOP= $<number>2; |
portset.ApacheStatus.loglimitOP= $<number>2; |
877 |
portset.ApacheStatus.loglimit= (int)$3; |
portset.ApacheStatus.loglimit= (int)$3; |
878 |
} |
} |
879 |
| CLOSELIMIT operator NUMBER PERCENT { |
| CLOSELIMIT operator NUMBER PERCENT { |
880 |
portset.ApacheStatus.closelimitOP= $<number>2; |
portset.ApacheStatus.closelimitOP= $<number>2; |
881 |
portset.ApacheStatus.closelimit= (int)($3); |
portset.ApacheStatus.closelimit= (int)($3); |
882 |
} |
} |
883 |
| DNSLIMIT operator NUMBER PERCENT { |
| DNSLIMIT operator NUMBER PERCENT { |
884 |
portset.ApacheStatus.dnslimitOP= $<number>2; |
portset.ApacheStatus.dnslimitOP= $<number>2; |
885 |
portset.ApacheStatus.dnslimit= (int)($3); |
portset.ApacheStatus.dnslimit= (int)($3); |
886 |
} |
} |
887 |
| KEEPALIVELIMIT operator NUMBER PERCENT { |
| KEEPALIVELIMIT operator NUMBER PERCENT { |
888 |
portset.ApacheStatus.keepalivelimitOP= $<number>2; |
portset.ApacheStatus.keepalivelimitOP= $<number>2; |
889 |
portset.ApacheStatus.keepalivelimit= (int)($3); |
portset.ApacheStatus.keepalivelimit= (int)($3); |
890 |
} |
} |
891 |
| REPLYLIMIT operator NUMBER PERCENT { |
| REPLYLIMIT operator NUMBER PERCENT { |
892 |
portset.ApacheStatus.replylimitOP= $<number>2; |
portset.ApacheStatus.replylimitOP= $<number>2; |
893 |
portset.ApacheStatus.replylimit= (int)($3); |
portset.ApacheStatus.replylimit= (int)($3); |
894 |
} |
} |
895 |
| REQUESTLIMIT operator NUMBER PERCENT { |
| REQUESTLIMIT operator NUMBER PERCENT { |
896 |
portset.ApacheStatus.requestlimitOP= $<number>2; |
portset.ApacheStatus.requestlimitOP= $<number>2; |
897 |
portset.ApacheStatus.requestlimit= (int)($3); |
portset.ApacheStatus.requestlimit= (int)($3); |
898 |
} |
} |
899 |
| STARTLIMIT operator NUMBER PERCENT { |
| STARTLIMIT operator NUMBER PERCENT { |
900 |
portset.ApacheStatus.startlimitOP= $<number>2; |
portset.ApacheStatus.startlimitOP= $<number>2; |
901 |
portset.ApacheStatus.startlimit= (int)($3); |
portset.ApacheStatus.startlimit= (int)($3); |
902 |
} |
} |
903 |
| WAITLIMIT operator NUMBER PERCENT { |
| WAITLIMIT operator NUMBER PERCENT { |
904 |
portset.ApacheStatus.waitlimitOP= $<number>2; |
portset.ApacheStatus.waitlimitOP= $<number>2; |
905 |
portset.ApacheStatus.waitlimit= (int)($3); |
portset.ApacheStatus.waitlimit= (int)($3); |
906 |
} |
} |
907 |
| GRACEFULLIMIT operator NUMBER PERCENT { |
| GRACEFULLIMIT operator NUMBER PERCENT { |
908 |
portset.ApacheStatus.gracefullimitOP= $<number>2; |
portset.ApacheStatus.gracefullimitOP= $<number>2; |
909 |
portset.ApacheStatus.gracefullimit= (int)($3); |
portset.ApacheStatus.gracefullimit= (int)($3); |
910 |
} |
} |
911 |
| CLEANUPLIMIT operator NUMBER PERCENT { |
| CLEANUPLIMIT operator NUMBER PERCENT { |
912 |
portset.ApacheStatus.cleanuplimitOP= $<number>2; |
portset.ApacheStatus.cleanuplimitOP= $<number>2; |
913 |
portset.ApacheStatus.cleanuplimit= (int)($3); |
portset.ApacheStatus.cleanuplimit= (int)($3); |
914 |
} |
} |
915 |
; |
; |
916 |
|
|
917 |
pid : IF CHANGED PID THEN action1 { |
pid : IF CHANGED PID rate1 THEN action1 { |
918 |
seteventaction(&(current)->action_PID, $<number>5, |
seteventaction(&(current)->action_PID, $<number>6, |
919 |
ACTION_IGNORE); |
ACTION_IGNORE); |
920 |
} |
} |
921 |
; |
; |
922 |
|
|
923 |
ppid : IF CHANGED PPID THEN action1 { |
ppid : IF CHANGED PPID rate1 THEN action1 { |
924 |
seteventaction(&(current)->action_PPID, $<number>5, |
seteventaction(&(current)->action_PPID, $<number>6, |
925 |
ACTION_IGNORE); |
ACTION_IGNORE); |
926 |
} |
} |
927 |
; |
; |
948 |
"\n\tIF x RESTARTS WITHIN y CYCLES THEN TIMEOUT" |
"\n\tIF x RESTARTS WITHIN y CYCLES THEN TIMEOUT" |
949 |
"\n\t"); |
"\n\t"); |
950 |
check_timeout($2, $3); |
check_timeout($2, $3); |
951 |
current->def_timeout= TRUE; |
current->def_timeout= TRUE; |
952 |
current->to_start= $2; |
current->to_start= $2; |
953 |
current->to_cycle= $3; |
current->to_cycle= $3; |
954 |
} |
} |
955 |
| IF NUMBER RESTART NUMBER CYCLE THEN TIMEOUT { |
| IF NUMBER RESTART NUMBER CYCLE THEN TIMEOUT { |
956 |
check_timeout($2, $4); |
check_timeout($2, $4); |
957 |
current->def_timeout= TRUE; |
current->def_timeout= TRUE; |
958 |
current->to_start= $2; |
current->to_start= $2; |
959 |
current->to_cycle= $4; |
current->to_cycle= $4; |
960 |
} |
} |
961 |
; |
; |
962 |
|
|
963 |
urloption : /* EMPTY */ |
urloption : /* EMPTY */ |
964 |
| CONTENT urloperator STRING { |
| CONTENT urloperator STRING { |
965 |
seturlrequest($<number>2, $<string>3); |
seturlrequest($<number>2, $<string>3); |
966 |
FREE($3); |
FREE($3); |
967 |
} |
} |
968 |
; |
; |
969 |
|
|
970 |
urloperator : EQUAL { $<number>$= OPERATOR_EQUAL; } |
urloperator : EQUAL { $<number>$= OPERATOR_EQUAL; } |
971 |
| NOTEQUAL { $<number>$= OPERATOR_NOTEQUAL; } |
| NOTEQUAL { $<number>$= OPERATOR_NOTEQUAL; } |
972 |
; |
; |
973 |
|
|
974 |
alert : alertmail '{' eventoptionlist '}' formatlist reminder { |
alert : alertmail '{' eventoptionlist '}' formatlist reminder { |
975 |
addmail($<string>1, &mailset, ¤t->maillist, eventset, $<number>4); |
addmail($<string>1, &mailset, ¤t->maillist, eventset, $<number>4); |
976 |
} |
} |
977 |
| alertmail formatlist reminder { |
| alertmail formatlist reminder { |
978 |
addmail($<string>1, &mailset, ¤t->maillist, eventset, $<number>3); |
addmail($<string>1, &mailset, ¤t->maillist, eventset, $<number>3); |
979 |
} |
} |
980 |
; |
; |
981 |
|
|
982 |
alertmail : ALERT MAILADDR { $<string>$= $2; } |
alertmail : ALERT MAILADDR { $<string>$= $2; } |
983 |
; |
; |
984 |
|
|
985 |
eventoptionlist : eventoption |
eventoptionlist : eventoption |
986 |
| eventoptionlist eventoption |
| eventoptionlist eventoption |
1011 |
; |
; |
1012 |
|
|
1013 |
formatlist : /* EMPTY */ |
formatlist : /* EMPTY */ |
1014 |
| MAILFORMAT '{' formatoptionlist '}' |
| MAILFORMAT '{' formatoptionlist '}' |
1015 |
; |
; |
1016 |
|
|
1017 |
formatoptionlist: formatoption |
formatoptionlist: formatoption |
1025 |
|
|
1026 |
every : EVERY NUMBER CYCLE { |
every : EVERY NUMBER CYCLE { |
1027 |
check_every($2); |
check_every($2); |
1028 |
current->def_every= TRUE; |
current->def_every= TRUE; |
1029 |
current->every= $2; |
current->every= $2; |
1030 |
} |
} |
1031 |
; |
; |
1032 |
|
|
1033 |
mode : MODE ACTIVE { current->mode= MODE_ACTIVE; } |
mode : MODE ACTIVE { |
1034 |
| MODE PASSIVE { current->mode= MODE_PASSIVE; } |
current->mode= MODE_ACTIVE; |
1035 |
| MODE MANUAL { current->mode= MODE_MANUAL; |
} |
1036 |
current->monitor= MONITOR_NOT; |
| MODE PASSIVE { |
1037 |
} |
current->mode= MODE_PASSIVE; |
1038 |
; |
} |
1039 |
|
| MODE MANUAL { |
1040 |
|
current->mode= MODE_MANUAL; |
1041 |
|
current->monitor= MONITOR_NOT; |
1042 |
|
} |
1043 |
|
; |
1044 |
|
|
1045 |
group : GROUP STRING { current->group= $2; } |
group : GROUP STRING { current->group= $2; } |
1046 |
; |
; |
1047 |
|
|
1048 |
depend : DEPENDS dependlist |
depend : DEPENDS dependlist |
1049 |
; |
; |
1055 |
dependant : SERVICENAME { adddependant($<string>1); } |
dependant : SERVICENAME { adddependant($<string>1); } |
1056 |
; |
; |
1057 |
|
|
1058 |
resourcesystem : IF resource resourcecycle THEN action1 recovery { |
resourcesystem : IF resource rate1 THEN action1 recovery { |
1059 |
addeventaction(&(resourceset).action, $<number>5, |
addeventaction(&(resourceset).action, |
1060 |
$<number>6); |
$<number>5, $<number>6); |
1061 |
addresource(&resourceset); |
addresource(&resourceset); |
1062 |
} |
} |
1063 |
; |
; |
1064 |
|
|
1065 |
resource : /* Old syntax */ |
resource : /* Old syntax */ |
1066 |
CPUUSAGE operator value { |
CPUUSAGE operator value { |
1067 |
yyerror("CPUUSAGE is obsolete -" |
yyerror("CPUUSAGE is obsolete -" |
1068 |
" use the CPU statement instead"); |
" use the CPU statement instead"); |
1069 |
} |
} |
1070 |
| MEMUSAGE operator value { |
| MEMUSAGE operator value { |
1071 |
yyerror("MEMUSAGE is obsolete -" |
yyerror("MEMUSAGE is obsolete -" |
1072 |
" use the MEMORY statement instead"); |
" use the MEMORY statement instead"); |
1073 |
} |
} |
1074 |
| MEMKBYTE operator value { |
| MEMKBYTE operator value { |
1075 |
yyerror("MEMKBYTE is obsolete -" |
yyerror("MEMKBYTE is obsolete -" |
1076 |
" use the MEMORY statement instead"); |
" use the MEMORY statement instead"); |
1077 |
} |
} |
1078 |
/* New syntax */ |
/* New syntax */ |
1079 |
| MEMORY operator value unit { |
| MEMORY operator value unit { |
1080 |
resourceset.resource_id= RESOURCE_ID_MEM_KBYTE; |
resourceset.resource_id= RESOURCE_ID_MEM_KBYTE; |
1081 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1082 |
resourceset.limit= (int) ($<real>3 * |
resourceset.limit= (int) ($<real>3 * |
1083 |
($<number>4 / 1024.0)); |
($<number>4 / 1024.0)); |
1084 |
} |
} |
1085 |
| MEMORY operator NUMBER PERCENT { |
| MEMORY operator NUMBER PERCENT { |
1086 |
resourceset.resource_id= RESOURCE_ID_MEM_PERCENT; |
resourceset.resource_id= RESOURCE_ID_MEM_PERCENT; |
1087 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1088 |
resourceset.limit= ($3 * 10); |
resourceset.limit= ($3 * 10); |
1089 |
} |
} |
1090 |
| TOTALMEMORY operator value unit { |
| TOTALMEMORY operator value unit { |
1091 |
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_KBYTE; |
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_KBYTE; |
1092 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1093 |
resourceset.limit= (int) ($<real>3 * |
resourceset.limit= (int) ($<real>3 * |
1094 |
($<number>4 / 1024.0)); |
($<number>4 / 1024.0)); |
1095 |
#ifdef LINUX |
#ifdef LINUX |
1096 |
yywarning("TOTALMEMORY statement " |
yywarning("TOTALMEMORY statement " |
1097 |
"does not work properly on Linux\n", |
"does not work properly on Linux\n", |
1101 |
| TOTALMEMORY operator NUMBER PERCENT { |
| TOTALMEMORY operator NUMBER PERCENT { |
1102 |
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_PERCENT; |
resourceset.resource_id= RESOURCE_ID_TOTAL_MEM_PERCENT; |
1103 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1104 |
resourceset.limit= ($3 * 10); |
resourceset.limit= ($3 * 10); |
1105 |
#ifdef LINUX |
#ifdef LINUX |
1106 |
yywarning("TOTALMEMORY statement" |
yywarning("TOTALMEMORY statement" |
1107 |
"does not work properly on Linux.\n", |
"does not work properly on Linux.\n", |
1111 |
| CPU operator NUMBER PERCENT { |
| CPU operator NUMBER PERCENT { |
1112 |
resourceset.resource_id= RESOURCE_ID_CPU_PERCENT; |
resourceset.resource_id= RESOURCE_ID_CPU_PERCENT; |
1113 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1114 |
resourceset.limit= ($3 * 10); |
resourceset.limit= ($3 * 10); |
1115 |
} |
} |
1116 |
/* Remaining syntax */ |
/* Remaining syntax */ |
1117 |
| CHILDREN operator NUMBER { |
| CHILDREN operator NUMBER { |
1118 |
resourceset.resource_id= RESOURCE_ID_CHILDREN; |
resourceset.resource_id= RESOURCE_ID_CHILDREN; |
1119 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1120 |
resourceset.limit= (int) $3; |
resourceset.limit= (int) $3; |
1121 |
} |
} |
1122 |
| resourceload operator value { |
| resourceload operator value { |
1123 |
resourceset.resource_id= $<number>1; |
resourceset.resource_id= $<number>1; |
1124 |
resourceset.operator= $<number>2; |
resourceset.operator= $<number>2; |
1125 |
resourceset.limit= (int) ($<real>3 * 10.0); |
resourceset.limit= (int) ($<real>3 * 10.0); |
1126 |
} |
} |
1127 |
; |
; |
1128 |
|
|
1129 |
value : REAL { $<real>$ = $1; } |
value : REAL { $<real>$ = $1; } |
1135 |
| LOADAVG15 { $<number>$= RESOURCE_ID_LOAD15; } |
| LOADAVG15 { $<number>$= RESOURCE_ID_LOAD15; } |
1136 |
; |
; |
1137 |
|
|
1138 |
resourcecycle : /* EMPTY */ |
timestamp : IF TIMESTAMP operator NUMBER time rate1 THEN action1 |
|
| NUMBER CYCLE { resourceset.max_cycle= $1; } |
|
|
; |
|
|
|
|
|
timestamp : IF TIMESTAMP operator NUMBER time THEN action1 |
|
1139 |
recovery { |
recovery { |
1140 |
timestampset.operator= $<number>3; |
timestampset.operator= $<number>3; |
1141 |
timestampset.time= ($4 * $<number>5); |
timestampset.time= ($4 * $<number>5); |
1142 |
addeventaction(&(timestampset).action, $<number>7, |
addeventaction(&(timestampset).action, $<number>8, |
1143 |
$<number>8); |
$<number>9); |
1144 |
addtimestamp(×tampset, FALSE); |
addtimestamp(×tampset, FALSE); |
1145 |
} |
} |
1146 |
| IF TIMESTAMP THEN action1 recovery { |
| IF CHANGED TIMESTAMP rate1 THEN action1 { |
1147 |
addeventaction(&(timestampset).action, $<number>4, |
timestampset.test_changes= TRUE; |
1148 |
$<number>5); |
addeventaction(&(timestampset).action, $<number>6, |
|
addtimestamp(×tampset, TRUE); |
|
|
} |
|
|
| IF CHANGED TIMESTAMP THEN action1 { |
|
|
timestampset.test_changes= TRUE; |
|
|
addeventaction(&(timestampset).action, $<number>5, |
|
1149 |
ACTION_IGNORE); |
ACTION_IGNORE); |
1150 |
addtimestamp(×tampset, TRUE); |
addtimestamp(×tampset, TRUE); |
1151 |
} |
} |
1152 |
; |
; |
1153 |
|
|
1172 |
| RESTART { $<number>$= ACTION_RESTART; } |
| RESTART { $<number>$= ACTION_RESTART; } |
1173 |
| START { $<number>$= ACTION_START; } |
| START { $<number>$= ACTION_START; } |
1174 |
| STOP { $<number>$= ACTION_STOP; } |
| STOP { $<number>$= ACTION_STOP; } |
1175 |
| UNMONITOR { $<number>$= ACTION_UNMONITOR; } |
| UNMONITOR { $<number>$= ACTION_UNMONITOR; } |
1176 |
; |
; |
1177 |
|
|
1178 |
action1 : action { |
action1 : action { |
1179 |
$<number>$= $<number>1; |
$<number>$= $<number>1; |
1180 |
if($<number>1 == ACTION_EXEC && command) { |
if($<number>1 == ACTION_EXEC && command) { |
1181 |
command1= command; |
command1= command; |
1182 |
command= NULL; |
command= NULL; |
1183 |
} |
} |
1184 |
} |
} |
1185 |
; |
; |
1186 |
|
|
1187 |
action2 : action { |
action2 : action { |
1188 |
$<number>$= $<number>1; |
$<number>$= $<number>1; |
1189 |
if($<number>1 == ACTION_EXEC && command) { |
if($<number>1 == ACTION_EXEC && command) { |
1190 |
command2= command; |
command2= command; |
1191 |
command= NULL; |
command= NULL; |
1192 |
} |
} |
1193 |
} |
} |
1194 |
; |
; |
1195 |
|
|
1196 |
recovery : /* EMPTY */ { $<number>$= ACTION_ALERT; } |
rate1 : /* EMPTY */ |
1197 |
| ELSE IF RECOVERED THEN action2 { $<number>$= $<number>5; } |
| NUMBER CYCLE { |
1198 |
|
rate1.count = $<number>1; |
1199 |
|
rate1.cycles = $<number>1; |
1200 |
|
if(rate1.cycles < 1 || rate1.cycles > BITMAP_MAX) { |
1201 |
|
yyerror2("the number of cycles must be between 1 and %d", |
1202 |
|
BITMAP_MAX); |
1203 |
|
} |
1204 |
|
} |
1205 |
|
| NUMBER NUMBER CYCLE { |
1206 |
|
rate1.count = $<number>1; |
1207 |
|
rate1.cycles = $<number>2; |
1208 |
|
if(rate1.cycles < 1 || rate1.cycles > BITMAP_MAX) { |
1209 |
|
yyerror2("the number of cycles must be between 1 and %d", |
1210 |
|
BITMAP_MAX); |
1211 |
|
} |
1212 |
|
if(rate1.count < 1 || rate1.count > rate1.cycles) { |
1213 |
|
yyerror2("the number of events must be bigger then 0 and " |
1214 |
|
"less than poll cycles"); |
1215 |
|
} |
1216 |
|
} |
1217 |
; |
; |
1218 |
|
|
1219 |
checksum : IF FAILED hashtype CHECKSUM THEN action1 recovery { |
rate2 : /* EMPTY */ |
1220 |
addeventaction(&(checksumset).action, $<number>6, |
| NUMBER CYCLE { |
1221 |
$<number>7); |
rate2.count = $<number>1; |
1222 |
|
rate2.cycles = $<number>1; |
1223 |
|
if(rate2.cycles < 1 || rate2.cycles > BITMAP_MAX) { |
1224 |
|
yyerror2("the number of cycles must be between 1 and %d", |
1225 |
|
BITMAP_MAX); |
1226 |
|
} |
1227 |
|
} |
1228 |
|
| NUMBER NUMBER CYCLE { |
1229 |
|
rate2.count = $<number>1; |
1230 |
|
rate2.cycles = $<number>2; |
1231 |
|
if(rate2.cycles < 1 || rate2.cycles > BITMAP_MAX) { |
1232 |
|
yyerror2("the number of cycles must be between 1 and %d", |
1233 |
|
BITMAP_MAX); |
1234 |
|
} |
1235 |
|
if(rate2.count < 1 || rate2.count > rate2.cycles) { |
1236 |
|
yyerror2("the number of events must be bigger then 0 and " |
1237 |
|
"less than poll cycles"); |
1238 |
|
} |
1239 |
|
} |
1240 |
|
; |
1241 |
|
|
1242 |
|
recovery : /* EMPTY */ { |
1243 |
|
$<number>$= ACTION_ALERT; |
1244 |
|
} |
1245 |
|
| ELSE IF RECOVERED rate2 THEN action2 { |
1246 |
|
$<number>$= $<number>6; |
1247 |
|
} |
1248 |
|
| ELSE IF PASSED rate2 THEN action2 { |
1249 |
|
$<number>$= $<number>6; |
1250 |
|
} |
1251 |
|
; |
1252 |
|
|
1253 |
|
checksum : IF FAILED hashtype CHECKSUM rate1 THEN action1 recovery { |
1254 |
|
addeventaction(&(checksumset).action, $<number>7, |
1255 |
|
$<number>8); |
1256 |
addchecksum(&checksumset); |
addchecksum(&checksumset); |
1257 |
} |
} |
1258 |
| IF FAILED hashtype CHECKSUM EXPECT STRING THEN action1 |
| IF FAILED hashtype CHECKSUM EXPECT STRING rate1 THEN action1 |
1259 |
recovery { |
recovery { |
1260 |
checksumset.hash= $6; |
checksumset.hash= $6; |
1261 |
addeventaction(&(checksumset).action, $<number>8, |
addeventaction(&(checksumset).action, $<number>9, |
1262 |
$<number>9); |
$<number>10); |
1263 |
addchecksum(&checksumset); |
addchecksum(&checksumset); |
1264 |
} |
} |
1265 |
| IF CHANGED hashtype CHECKSUM THEN action1 { |
| IF CHANGED hashtype CHECKSUM rate1 THEN action1 { |
1266 |
checksumset.test_changes= TRUE; |
checksumset.test_changes= TRUE; |
1267 |
addeventaction(&(checksumset).action, $<number>6, |
addeventaction(&(checksumset).action, $<number>7, |
1268 |
ACTION_IGNORE); |
ACTION_IGNORE); |
1269 |
addchecksum(&checksumset); |
addchecksum(&checksumset); |
1270 |
} |
} |
1274 |
| SHA1HASH { checksumset.type= HASH_SHA1; } |
| SHA1HASH { checksumset.type= HASH_SHA1; } |
1275 |
; |
; |
1276 |
|
|
1277 |
inode : IF INODE operator NUMBER THEN action1 recovery { |
inode : IF INODE operator NUMBER rate1 THEN action1 recovery { |
1278 |
deviceset.resource= RESOURCE_ID_INODE; |
deviceset.resource= RESOURCE_ID_INODE; |
1279 |
deviceset.operator= $<number>3; |
deviceset.operator= $<number>3; |
1280 |
deviceset.limit_absolute= $4; |
deviceset.limit_absolute= $4; |
1281 |
addeventaction(&(deviceset).action, $<number>6, $<number>7); |
addeventaction(&(deviceset).action, $<number>7, $<number>8); |
1282 |
adddevice(&deviceset); |
adddevice(&deviceset); |
1283 |
} |
} |
1284 |
| IF INODE operator NUMBER PERCENT THEN action1 recovery { |
| IF INODE operator NUMBER PERCENT rate1 THEN action1 recovery { |
1285 |
deviceset.resource= RESOURCE_ID_INODE; |
deviceset.resource= RESOURCE_ID_INODE; |
1286 |
deviceset.operator= $<number>3; |
deviceset.operator= $<number>3; |
1287 |
deviceset.limit_percent= (int)($4 * 10); |
deviceset.limit_percent= (int)($4 * 10); |
1288 |
addeventaction(&(deviceset).action, $<number>7, $<number>8); |
addeventaction(&(deviceset).action, $<number>8, $<number>9); |
1289 |
adddevice(&deviceset); |
adddevice(&deviceset); |
1290 |
} |
} |
1291 |
; |
; |
1292 |
|
|
1293 |
space : IF SPACE operator value unit THEN action1 recovery { |
space : IF SPACE operator value unit rate1 THEN action1 recovery { |
1294 |
if(!device_usage(current->inf, current->path)) { |
if(!device_usage(current->inf, current->path)) { |
1295 |
yyerror2("cannot read usage of device %s", |
yyerror2("cannot read usage of device %s", |
1296 |
current->path); |
current->path); |
1297 |
} |
} |
1298 |
deviceset.resource= RESOURCE_ID_SPACE; |
deviceset.resource= RESOURCE_ID_SPACE; |
1299 |
deviceset.operator= $<number>3; |
deviceset.operator= $<number>3; |
1300 |
deviceset.limit_absolute= |
deviceset.limit_absolute= |
1301 |
(int)((float)$<real>4 / |
(int)( |
1302 |
(float)current->inf->f_bsize * |
(float)$<real>4 / |
1303 |
(float)$<number>5 ); |
(float)current->inf->f_bsize * (float)$<number>5 |
1304 |
addeventaction(&(deviceset).action, $<number>7, $<number>8); |
); |
1305 |
|
addeventaction(&(deviceset).action, $<number>8, $<number>9); |
1306 |
adddevice(&deviceset); |
adddevice(&deviceset); |
1307 |
} |
} |
1308 |
| IF SPACE operator NUMBER PERCENT THEN action1 recovery { |
| IF SPACE operator NUMBER PERCENT rate1 THEN action1 recovery { |
1309 |
deviceset.resource= RESOURCE_ID_SPACE; |
deviceset.resource= RESOURCE_ID_SPACE; |
1310 |
deviceset.operator= $<number>3; |
deviceset.operator= $<number>3; |
1311 |
deviceset.limit_percent= (int)($4 * 10); |
deviceset.limit_percent= (int)($4 * 10); |
1312 |
addeventaction(&(deviceset).action, $<number>7, |
addeventaction(&(deviceset).action, $<number>8, $<number>9); |
|
$<number>8); |
|
1313 |
adddevice(&deviceset); |
adddevice(&deviceset); |
1314 |
} |
} |
1315 |
; |
; |
1320 |
| GIGABYTE { $<number>$= UNIT_GIGABYTE; } |
| GIGABYTE { $<number>$= UNIT_GIGABYTE; } |
1321 |
; |
; |
1322 |
|
|
1323 |
permission : IF FAILED PERMISSION NUMBER THEN action1 recovery { |
permission : IF FAILED PERMISSION NUMBER rate1 THEN action1 recovery { |
1324 |
permset.perm= check_perm($4); |
permset.perm= check_perm($4); |
1325 |
addeventaction(&(permset).action, $<number>6, $<number>7); |
addeventaction(&(permset).action, $<number>7, $<number>8); |
1326 |
addperm(&permset); |
addperm(&permset); |
1327 |
} |
} |
1328 |
; |
; |
1329 |
|
|
1330 |
match : IF matchflagnot MATCH PATH THEN action1 { |
match : IF matchflagnot MATCH PATH rate1 THEN action1 { |
1331 |
matchset.ignore= FALSE; |
matchset.ignore= FALSE; |
1332 |
matchset.match_path= xstrdup($4); |
matchset.match_path= xstrdup($4); |
1333 |
matchset.match_string= NULL; |
matchset.match_string= NULL; |
1334 |
addmatchpath(&matchset, $<number>6); |
addmatchpath(&matchset, $<number>7); |
1335 |
} |
} |
1336 |
| IF matchflagnot MATCH STRING THEN action1 { |
| IF matchflagnot MATCH STRING rate1 THEN action1 { |
1337 |
matchset.ignore= FALSE; |
matchset.ignore= FALSE; |
1338 |
matchset.match_path= NULL; |
matchset.match_path= NULL; |
1339 |
matchset.match_string= xstrdup($4); |
matchset.match_string= xstrdup($4); |
1340 |
addmatch(&matchset, $<number>6, 0); |
addmatch(&matchset, $<number>7, 0); |
1341 |
} |
} |
1342 |
| IGNORE matchflagnot MATCH PATH { |
| IGNORE matchflagnot MATCH PATH { |
1343 |
matchset.ignore= TRUE; |
matchset.ignore= TRUE; |
1344 |
matchset.match_path= xstrdup($4); |
matchset.match_path= xstrdup($4); |
1345 |
matchset.match_string= NULL; |
matchset.match_string= NULL; |
1346 |
addmatchpath(&matchset, ACTION_IGNORE); |
addmatchpath(&matchset, ACTION_IGNORE); |
1347 |
} |
} |
1348 |
| IGNORE matchflagnot MATCH STRING { |
| IGNORE matchflagnot MATCH STRING { |
1349 |
matchset.ignore= TRUE; |
matchset.ignore= TRUE; |
1350 |
matchset.match_path= NULL; |
matchset.match_path= NULL; |
1351 |
matchset.match_string= xstrdup($4); |
matchset.match_string= xstrdup($4); |
1352 |
addmatch(&matchset, ACTION_IGNORE, 0); |
addmatch(&matchset, ACTION_IGNORE, 0); |
1353 |
} |
} |
1354 |
; |
; |
1355 |
|
|
1356 |
matchflagnot : /* empty */ { |
matchflagnot : /* EMPTY */ { |
1357 |
matchset.not= FALSE; |
matchset.not= FALSE; |
1358 |
} |
} |
1359 |
| NOT { |
| NOT { |
1360 |
matchset.not= TRUE; |
matchset.not= TRUE; |
1361 |
} |
} |
1362 |
; |
; |
1363 |
|
|
1364 |
|
|
1365 |
size : IF SIZE operator NUMBER unit THEN action1 recovery { |
size : IF SIZE operator NUMBER unit rate1 THEN action1 recovery { |
1366 |
sizeset.operator= $<number>4; |
sizeset.operator= $<number>4; |
1367 |
sizeset.size= ((unsigned long)$4 * $<number>5); |
sizeset.size= ((unsigned long)$4 * $<number>5); |
1368 |
addeventaction(&(sizeset).action, $<number>7, $<number>8); |
addeventaction(&(sizeset).action, $<number>8, $<number>9); |
1369 |
addsize(&sizeset, FALSE); |
addsize(&sizeset, FALSE); |
1370 |
} |
} |
1371 |
| IF SIZE THEN action1 recovery { |
| IF CHANGED SIZE rate1 THEN action1 { |
1372 |
addeventaction(&(sizeset).action, $<number>4, $<number>5); |
sizeset.test_changes= TRUE; |
1373 |
addsize(&sizeset, TRUE); |
addeventaction(&(sizeset).action, $<number>6, |
1374 |
} |
ACTION_IGNORE); |
1375 |
| IF CHANGED SIZE THEN action1 { |
addsize(&sizeset, TRUE); |
|
sizeset.test_changes= TRUE; |
|
|
addeventaction(&(sizeset).action, $<number>5, |
|
|
ACTION_IGNORE); |
|
|
addsize(&sizeset, TRUE); |
|
1376 |
} |
} |
1377 |
; |
; |
1378 |
|
|
1379 |
uid : IF FAILED UID STRING THEN action1 recovery { |
uid : IF FAILED UID STRING rate1 THEN action1 recovery { |
1380 |
uidset.uid= get_uid($4, 0); |
uidset.uid= get_uid($4, 0); |
1381 |
addeventaction(&(uidset).action, $<number>6, $<number>7); |
addeventaction(&(uidset).action, $<number>7, $<number>8); |
1382 |
adduid(&uidset); |
adduid(&uidset); |
1383 |
FREE($4); |
FREE($4); |
1384 |
} |
} |
1385 |
| IF FAILED UID NUMBER THEN action1 recovery { |
| IF FAILED UID NUMBER rate1 THEN action1 recovery { |
1386 |
uidset.uid= get_uid(NULL, $4); |
uidset.uid= get_uid(NULL, $4); |
1387 |
addeventaction(&(uidset).action, $<number>6, $<number>7); |
addeventaction(&(uidset).action, $<number>7, $<number>8); |
1388 |
adduid(&uidset); |
adduid(&uidset); |
1389 |
} |
} |
1390 |
; |
; |
1391 |
|
|
1392 |
gid : IF FAILED GID STRING THEN action1 recovery { |
gid : IF FAILED GID STRING rate1 THEN action1 recovery { |
1393 |
gidset.gid= get_gid($4, 0); |
gidset.gid= get_gid($4, 0); |
1394 |
addeventaction(&(gidset).action, $<number>6, $<number>7); |
addeventaction(&(gidset).action, $<number>7, $<number>8); |
1395 |
addgid(&gidset); |
addgid(&gidset); |
1396 |
FREE($4); |
FREE($4); |
1397 |
} |
} |
1398 |
| IF FAILED GID NUMBER THEN action1 recovery { |
| IF FAILED GID NUMBER rate1 THEN action1 recovery { |
1399 |
gidset.gid= get_gid(NULL, $4); |
gidset.gid= get_gid(NULL, $4); |
1400 |
addeventaction(&(gidset).action, $<number>6, $<number>7); |
addeventaction(&(gidset).action, $<number>7, $<number>8); |
1401 |
addgid(&gidset); |
addgid(&gidset); |
1402 |
} |
} |
1403 |
; |
; |
1404 |
|
|
1405 |
icmptype : TYPE ICMPECHO { $<number>$= ICMP_ECHO; } |
icmptype : TYPE ICMPECHO { $<number>$= ICMP_ECHO; } |
1595 |
reset_portset(); |
reset_portset(); |
1596 |
reset_permset(); |
reset_permset(); |
1597 |
reset_icmpset(); |
reset_icmpset(); |
1598 |
|
reset_rateset(); |
1599 |
reset_deviceset(); |
reset_deviceset(); |
1600 |
reset_resourceset(); |
reset_resourceset(); |
1601 |
reset_checksumset(); |
reset_checksumset(); |
1857 |
} |
} |
1858 |
r->resource_id= rr->resource_id; |
r->resource_id= rr->resource_id; |
1859 |
r->limit= rr->limit; |
r->limit= rr->limit; |
|
r->cycle= 0; |
|
|
r->max_cycle= rr->max_cycle; |
|
1860 |
r->action= rr->action; |
r->action= rr->action; |
1861 |
r->operator= rr->operator; |
r->operator= rr->operator; |
1862 |
r->next= current->resourcelist; |
r->next= current->resourcelist; |
1863 |
|
|
|
if(r->max_cycle < 1) { |
|
|
yyerror2("the number of cycles must be greater then 0"); |
|
|
} |
|
|
|
|
1864 |
current->resourcelist= r; |
current->resourcelist= r; |
1865 |
reset_resourceset(); |
reset_resourceset(); |
1866 |
} |
} |
2204 |
NEW(ea); |
NEW(ea); |
2205 |
NEW(ea->failed); |
NEW(ea->failed); |
2206 |
NEW(ea->passed); |
NEW(ea->passed); |
|
ea->failed->id= failed; |
|
|
ea->passed->id= passed; |
|
2207 |
|
|
2208 |
|
ea->failed->id= failed; |
2209 |
|
ea->failed->count= rate1.count; |
2210 |
|
ea->failed->cycles= rate1.cycles; |
2211 |
if(failed == ACTION_EXEC) { |
if(failed == ACTION_EXEC) { |
2212 |
ASSERT(command1); |
ASSERT(command1); |
2213 |
ea->failed->exec = command1; |
ea->failed->exec = command1; |
2214 |
command1 = NULL; |
command1 = NULL; |
2215 |
} |
} |
2216 |
|
|
2217 |
|
ea->passed->id= passed; |
2218 |
|
ea->passed->count= rate2.count; |
2219 |
|
ea->passed->cycles= rate2.cycles; |
2220 |
if(passed == ACTION_EXEC) { |
if(passed == ACTION_EXEC) { |
2221 |
ASSERT(command2); |
ASSERT(command2); |
2222 |
ea->passed->exec = command2; |
ea->passed->exec = command2; |
2225 |
|
|
2226 |
*_ea= ea; |
*_ea= ea; |
2227 |
|
|
2228 |
|
reset_rateset(); |
2229 |
|
|
2230 |
} |
} |
2231 |
|
|
2232 |
|
|
2898 |
static void reset_resourceset() { |
static void reset_resourceset() { |
2899 |
resourceset.resource_id= 0; |
resourceset.resource_id= 0; |
2900 |
resourceset.limit= 0; |
resourceset.limit= 0; |
|
resourceset.max_cycle= 1; |
|
2901 |
resourceset.action= NULL; |
resourceset.action= NULL; |
2902 |
resourceset.operator= OPERATOR_EQUAL; |
resourceset.operator= OPERATOR_EQUAL; |
2903 |
} |
} |
2986 |
} |
} |
2987 |
|
|
2988 |
|
|
2989 |
|
/* |
2990 |
|
* Reset the Rate set to default values |
2991 |
|
*/ |
2992 |
|
static void reset_rateset() { |
2993 |
|
rate1.count = 1; |
2994 |
|
rate1.cycles = 1; |
2995 |
|
|
2996 |
|
rate2.count = 1; |
2997 |
|
rate2.cycles = 1; |
2998 |
|
} |
2999 |
|
|
3000 |
|
|
3001 |
/* ---------------------------------------------------------------- Checkers */ |
/* ---------------------------------------------------------------- Checkers */ |
3002 |
|
|
3003 |
|
|