208 |
char *string; |
char *string; |
209 |
} |
} |
210 |
|
|
211 |
|
%token IF THEN ELSE FAILED CYCLE |
212 |
%token SET LOGFILE FACILITY DAEMON SYSLOG MAILSERVER HTTPD ALLOW ADDRESS INIT |
%token SET LOGFILE FACILITY DAEMON SYSLOG MAILSERVER HTTPD ALLOW ADDRESS INIT |
213 |
%token PEMFILE ENABLE DISABLE HTTPDSSL CLIENTPEMFILE ALLOWSELFCERTIFICATION |
%token PEMFILE ENABLE DISABLE HTTPDSSL CLIENTPEMFILE ALLOWSELFCERTIFICATION |
214 |
%token STATEFILE |
%token STATEFILE |
224 |
%token CHECKPROC CHECKDEV CHECKFILE CHECKDIR |
%token CHECKPROC CHECKDEV CHECKFILE CHECKDIR |
225 |
%token CPUUSAGE MEMUSAGE MEMKBYTE TOTALMEMKBYTE TOTALMEMUSAGE CHILDREN |
%token CPUUSAGE MEMUSAGE MEMKBYTE TOTALMEMKBYTE TOTALMEMUSAGE CHILDREN |
226 |
%token RESOURCE MEMORY TOTALMEMORY CPU LOADAVG1 LOADAVG5 LOADAVG15 |
%token RESOURCE MEMORY TOTALMEMORY CPU LOADAVG1 LOADAVG5 LOADAVG15 |
227 |
%token AUTOSTART MODE ACTIVE PASSIVE MANUAL |
%token MODE ACTIVE PASSIVE MANUAL |
228 |
%token GROUP REQUEST DEPENDS |
%token GROUP REQUEST DEPENDS |
229 |
%token UID GID ENVIRONMENT |
%token UID GID ENVIRONMENT |
230 |
%token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY |
%token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY |
265 |
|
|
266 |
optproc : start |
optproc : start |
267 |
| stop |
| stop |
268 |
| host port type protocol connecttimeout action { |
| connection |
|
portset.timeout= $<number>5; |
|
|
portset.action= $<number>6; |
|
|
addport(&portset); |
|
|
} |
|
|
| unixsocket type protocol connecttimeout action { |
|
|
portset.timeout= $<number>4; |
|
|
portset.action= $<number>5; |
|
|
addport(&portset); |
|
|
} |
|
269 |
| timeout |
| timeout |
|
| every |
|
270 |
| alert |
| alert |
271 |
| autostart |
| every |
272 |
| mode |
| mode |
273 |
| group |
| group |
274 |
| depend |
| depend |
275 |
| resource resourcecycle action { |
| resourcesystem |
|
resourceset.action= $<number>3; |
|
|
addresource(&resourceset); |
|
|
} |
|
276 |
; |
; |
277 |
|
|
278 |
optfilelist : /* EMPTY */ |
optfilelist : /* EMPTY */ |
281 |
|
|
282 |
optfile : start |
optfile : start |
283 |
| stop |
| stop |
284 |
| timestamp { |
| timestamp |
|
addtimestamp(×tampset); |
|
|
} |
|
285 |
| timeout |
| timeout |
286 |
| every |
| every |
287 |
| alert |
| alert |
288 |
| permission |
| permission |
289 |
| size { |
| size |
|
addsize(&sizeset); |
|
|
} |
|
290 |
| checksum |
| checksum |
291 |
| mode |
| mode |
292 |
| group |
| group |
306 |
| mode |
| mode |
307 |
| group |
| group |
308 |
| depend |
| depend |
309 |
| inode { |
| inode |
310 |
adddevice(&deviceset); |
| space |
|
} |
|
|
| space { |
|
|
adddevice(&deviceset); |
|
|
} |
|
311 |
; |
; |
312 |
|
|
313 |
optdirlist : /* EMPTY */ |
optdirlist : /* EMPTY */ |
316 |
|
|
317 |
optdir : start |
optdir : start |
318 |
| stop |
| stop |
319 |
| timestamp { |
| timestamp |
|
addtimestamp(×tampset); |
|
|
} |
|
320 |
| timeout |
| timeout |
321 |
| every |
| every |
322 |
| alert |
| alert |
527 |
| GID NUMBER { addgid(NULL, $2); } |
| GID NUMBER { addgid(NULL, $2); } |
528 |
; |
; |
529 |
|
|
530 |
|
connection : IF FAILED host port type protocol nettimeout THEN action { |
531 |
|
portset.timeout= $<number>7; |
532 |
|
portset.action= $<number>9; |
533 |
|
addport(&portset); |
534 |
|
} |
535 |
|
| IF FAILED unixsocket type protocol nettimeout THEN action { |
536 |
|
portset.timeout= $<number>6; |
537 |
|
portset.action= $<number>8; |
538 |
|
addport(&portset); |
539 |
|
} |
540 |
|
; |
541 |
|
|
542 |
host : /* EMPTY */ { portset.hostname= xstrdup(LOCALHOST); } |
host : /* EMPTY */ { portset.hostname= xstrdup(LOCALHOST); } |
543 |
| HOST STRING { check_hostname($2); portset.hostname= $2; } |
| HOST STRING { check_hostname($2); portset.hostname= $2; } |
544 |
; |
; |
590 |
| REQUEST PATH { portset.request= url_encode($2); free($2); } |
| REQUEST PATH { portset.request= url_encode($2); free($2); } |
591 |
; |
; |
592 |
|
|
593 |
|
nettimeout : /* EMPTY */ { |
594 |
|
$<number>$= NET_TIMEOUT; |
595 |
|
} |
596 |
|
| TIMEOUT NUMBER SECOND { |
597 |
|
$<number>$= $2; |
598 |
|
} |
599 |
|
; |
600 |
|
|
601 |
timeout : TIMEOUT NUMBER NUMBER { |
timeout : TIMEOUT NUMBER NUMBER { |
602 |
|
log("%s: The timeout statement at line %d is deprecated." |
603 |
|
"\n\tPlease use the new version:\n" |
604 |
|
"\tif x restarts within y cycles then timeout\n", |
605 |
|
prog, lineno); |
606 |
check_timeout($2, $3); |
check_timeout($2, $3); |
607 |
current->def_timeout= TRUE; |
current->def_timeout= TRUE; |
608 |
current->to_start= $2; |
current->to_start= $2; |
609 |
current->to_cycle= $3; |
current->to_cycle= $3; |
610 |
} |
} |
611 |
|
| IF NUMBER RESTART NUMBER CYCLE THEN TIMEOUT { |
612 |
|
check_timeout($2, $4); |
613 |
|
current->def_timeout= TRUE; |
614 |
|
current->to_start= $2; |
615 |
|
current->to_cycle= $4; |
616 |
|
} |
617 |
; |
; |
618 |
|
|
|
connecttimeout : /* EMPTY */ { |
|
|
$<number>$= NET_TIMEOUT; |
|
|
} |
|
|
| TIMEOUT NUMBER SECOND { |
|
|
$<number>$= $2; |
|
|
} |
|
|
; |
|
619 |
|
|
620 |
alert : alertmail '{' eventoptionlist '}' formatlist { |
alert : alertmail '{' eventoptionlist '}' formatlist { |
621 |
addmail($<string>1, &mailset, eventset); |
addmail($<string>1, &mailset, eventset); |
665 |
} |
} |
666 |
; |
; |
667 |
|
|
|
checksum : CHECKSUM { addchecksum(NULL); } |
|
|
| CHECKSUM EXPECT STRING { addchecksum($3); } |
|
|
; |
|
|
|
|
|
autostart : AUTOSTART { |
|
|
YERROR("Error: 'autostart' is obsolete - " |
|
|
"use the 'mode' statement instead"); |
|
|
} |
|
|
; |
|
|
|
|
668 |
mode : MODE ACTIVE { current->mode= MODE_ACTIVE; } |
mode : MODE ACTIVE { current->mode= MODE_ACTIVE; } |
669 |
| MODE PASSIVE { current->mode= MODE_PASSIVE; } |
| MODE PASSIVE { current->mode= MODE_PASSIVE; } |
670 |
| MODE MANUAL { current->mode= MODE_MANUAL; |
| MODE MANUAL { current->mode= MODE_MANUAL; |
685 |
dependant : SERVICENAME { adddependant($<string>1); } |
dependant : SERVICENAME { adddependant($<string>1); } |
686 |
; |
; |
687 |
|
|
688 |
|
resourcesystem : IF resource resourcecycle THEN action { |
689 |
|
resourceset.action= $<number>5; |
690 |
|
addresource(&resourceset); |
691 |
|
} |
692 |
|
; |
693 |
|
|
694 |
resource : /* Old syntax */ |
resource : /* Old syntax */ |
695 |
CPUUSAGE operator value { |
CPUUSAGE operator value { |
696 |
YERROR("Error: 'CPUUSAGE' is obsolete -" |
YERROR("parse error: 'CPUUSAGE' is obsolete -" |
697 |
" use the 'CPU' statement instead"); |
" use the 'CPU' statement instead"); |
698 |
} |
} |
699 |
| MEMUSAGE operator value { |
| MEMUSAGE operator value { |
700 |
YERROR("Error: 'MEMUSAGE' is obsolete -" |
YERROR("parse error: 'MEMUSAGE' is obsolete -" |
701 |
" use the 'MEMORY' statement instead"); |
" use the 'MEMORY' statement instead"); |
702 |
} |
} |
703 |
| MEMKBYTE operator value { |
| MEMKBYTE operator value { |
704 |
YERROR("Error: 'MEMKBYTE' is obsolete -" |
YERROR("parse error: 'MEMKBYTE' is obsolete -" |
705 |
" use the 'MEMORY' statement instead"); |
" use the 'MEMORY' statement instead"); |
706 |
} |
} |
707 |
/* New syntax */ |
/* New syntax */ |
755 |
; |
; |
756 |
|
|
757 |
resourcecycle : /* EMPTY */ |
resourcecycle : /* EMPTY */ |
758 |
| NUMBER { resourceset.max_cycle= $1; } |
| NUMBER CYCLE { resourceset.max_cycle= $1; } |
759 |
; |
; |
760 |
|
|
761 |
timestamp : TIMESTAMP operator NUMBER time action { |
timestamp : IF TIMESTAMP operator NUMBER time THEN action { |
762 |
timestampset.operator= $<number>2; |
timestampset.operator= $<number>3; |
763 |
timestampset.time= ($3 * $<number>4); |
timestampset.time= ($4 * $<number>5); |
764 |
timestampset.action= $<number>5; |
timestampset.action= $<number>7; |
765 |
timestampset.test_changes= FALSE; |
timestampset.test_changes= FALSE; |
766 |
|
addtimestamp(×tampset); |
767 |
} |
} |
768 |
| TIMESTAMP CHANGED action { |
| IF TIMESTAMP CHANGED THEN action { |
769 |
timestampset.test_changes= TRUE; |
timestampset.test_changes= TRUE; |
770 |
timestampset.action= $<number>3; |
timestampset.action= $<number>5; |
771 |
|
addtimestamp(×tampset); |
772 |
} |
} |
773 |
; |
; |
774 |
|
|
794 |
| EXEC argumentlist useroptionlist { $<number>$= ACTION_EXEC; } |
| EXEC argumentlist useroptionlist { $<number>$= ACTION_EXEC; } |
795 |
; |
; |
796 |
|
|
797 |
inode : INODE operator NUMBER action { |
checksum : CHECKSUM { addchecksum(NULL); } |
798 |
|
| CHECKSUM EXPECT STRING { addchecksum($3); } |
799 |
|
; |
800 |
|
|
801 |
|
inode : IF INODE operator NUMBER THEN action { |
802 |
deviceset.resource= RESOURCE_ID_INODE; |
deviceset.resource= RESOURCE_ID_INODE; |
803 |
deviceset.operator= $<number>2; |
deviceset.operator= $<number>3; |
804 |
deviceset.limit_absolute= $3; |
deviceset.limit_absolute= $4; |
805 |
deviceset.action= $<number>4; |
deviceset.action= $<number>6; |
806 |
|
adddevice(&deviceset); |
807 |
} |
} |
808 |
| INODE operator PERCENT action { |
| IF INODE operator PERCENT THEN action { |
809 |
deviceset.resource= RESOURCE_ID_INODE; |
deviceset.resource= RESOURCE_ID_INODE; |
810 |
deviceset.operator= $<number>2; |
deviceset.operator= $<number>3; |
811 |
deviceset.limit_percent= (int) $<real>3; |
deviceset.limit_percent= (int) $<real>4; |
812 |
deviceset.action= $<number>4; |
deviceset.action= $<number>6; |
813 |
|
adddevice(&deviceset); |
814 |
} |
} |
815 |
; |
; |
816 |
|
|
817 |
space : SPACE operator value unit action { |
space : IF SPACE operator value unit THEN action { |
818 |
DeviceInfo_T di; |
DeviceInfo_T di; |
819 |
NEW(di); |
NEW(di); |
820 |
DeviceInfo_Usage(di, current->path); |
DeviceInfo_Usage(di, current->path); |
821 |
deviceset.resource= RESOURCE_ID_SPACE; |
deviceset.resource= RESOURCE_ID_SPACE; |
822 |
deviceset.operator= $<number>2; |
deviceset.operator= $<number>3; |
823 |
deviceset.limit_absolute= (int)((float)$<real>3 / |
deviceset.limit_absolute= (int)((float)$<real>4 / |
824 |
(float)di->f_bsize * |
(float)di->f_bsize * |
825 |
(float)$<number>4 ); |
(float)$<number>5 ); |
826 |
deviceset.action= $<number>5; |
deviceset.action= $<number>6; |
827 |
free(di); |
free(di); |
828 |
|
adddevice(&deviceset); |
829 |
} |
} |
830 |
| SPACE operator PERCENT action { |
| IF SPACE operator PERCENT THEN action { |
831 |
deviceset.resource= RESOURCE_ID_SPACE; |
deviceset.resource= RESOURCE_ID_SPACE; |
832 |
deviceset.operator= $<number>2; |
deviceset.operator= $<number>3; |
833 |
deviceset.limit_percent= (int) $<real>3; |
deviceset.limit_percent= (int) $<real>4; |
834 |
deviceset.action= $<number>4; |
deviceset.action= $<number>6; |
835 |
|
adddevice(&deviceset); |
836 |
} |
} |
837 |
; |
; |
838 |
|
|
845 |
permission : PERMISSION NUMBER { current->perm=check_perm($2); } |
permission : PERMISSION NUMBER { current->perm=check_perm($2); } |
846 |
; |
; |
847 |
|
|
848 |
size : SIZE operator NUMBER unit action { |
size : IF SIZE operator NUMBER unit THEN action { |
849 |
sizeset.operator= $<number>2; |
sizeset.operator= $<number>3; |
850 |
sizeset.size= ((unsigned long)$3 * $<number>4); |
sizeset.size= ((unsigned long)$4 * $<number>5); |
851 |
sizeset.action= $<number>5; |
sizeset.action= $<number>7; |
852 |
sizeset.test_changes= FALSE; |
sizeset.test_changes= FALSE; |
853 |
|
addsize(&sizeset); |
854 |
} |
} |
855 |
| SIZE CHANGED action { |
| IF SIZE CHANGED THEN action { |
856 |
sizeset.test_changes= TRUE; |
sizeset.test_changes= TRUE; |
857 |
sizeset.action= $<number>3; |
sizeset.action= $<number>5; |
858 |
|
addsize(&sizeset); |
859 |
} |
} |
860 |
; |
; |
861 |
|
|
896 |
|
|
897 |
if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) { |
if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) { |
898 |
|
|
899 |
log("%s: Error opening the control file '%s' -- %s\n", |
log("%s: error opening the control file '%s' -- %s\n", |
900 |
prog, controlfile, STRERROR); |
prog, controlfile, STRERROR); |
901 |
return(FALSE); |
return(FALSE); |
902 |
|
|
1407 |
if ( r == NULL ) { |
if ( r == NULL ) { |
1408 |
#endif |
#endif |
1409 |
|
|
1410 |
log("%s: Requested user '%s' not found on the system. Error at line %d\n", |
log("%s: Requested user '%s' not found on the system. " |
1411 |
prog, user, lineno); |
"Error at line %d\n", prog, user, lineno); |
1412 |
cfg_errflag++; |
cfg_errflag++; |
1413 |
|
|
1414 |
} |
} |
1422 |
if ( r == NULL ) { |
if ( r == NULL ) { |
1423 |
#endif |
#endif |
1424 |
|
|
1425 |
log("%s: Requested uid '%d' not found on the system. Error at line %d\n", |
log("%s: Requested uid '%d' not found on the system. " |
1426 |
prog, uid, lineno); |
"Error at line %d\n", prog, uid, lineno); |
1427 |
cfg_errflag++; |
cfg_errflag++; |
1428 |
|
|
1429 |
} |
} |
1469 |
if ( r == NULL ) { |
if ( r == NULL ) { |
1470 |
#endif |
#endif |
1471 |
|
|
1472 |
log("%s: Requested group '%s' not found on the system. Error at line %d\n", |
log("%s: Requested group '%s' not found on the system. " |
1473 |
prog, group, lineno); |
"Error at line %d\n", prog, group, lineno); |
1474 |
cfg_errflag++; |
cfg_errflag++; |
1475 |
|
|
1476 |
} |
} |
1477 |
|
|
1484 |
if ( r == NULL ) { |
if ( r == NULL ) { |
1485 |
#endif |
#endif |
1486 |
|
|
1487 |
log("%s: Requested gid '%d' not found on the system. Error at line %d\n", |
log("%s: Requested gid '%d' not found on the system. " |
1488 |
prog, gid, lineno); |
"Error at line %d\n", prog, gid, lineno); |
1489 |
cfg_errflag++; |
cfg_errflag++; |
1490 |
|
|
1491 |
} |
} |
1492 |
|
|
2004 |
Service_T dp= get_service(d->dependant); |
Service_T dp= get_service(d->dependant); |
2005 |
|
|
2006 |
if(!dp) { |
if(!dp) { |
2007 |
log("%s: Error, depend service '%s' is not defined in the " |
log("%s: parse error, depend service '%s' is not defined in the " |
2008 |
"control file\n", prog, d->dependant); |
"control file\n", prog, d->dependant); |
2009 |
exit(1); |
exit(1); |
2010 |
} |
} |
2011 |
|
|
2012 |
if(dp->depend_visited) { |
if(dp->depend_visited) { |
2013 |
log("%s: Error, found a depend loop in the control file involving " |
log("%s: parse error, found a depend loop in the control file " |
2014 |
"the service '%s'\n", prog, s->name); |
"involving the service '%s'\n", prog, s->name); |
2015 |
exit(1); |
exit(1); |
2016 |
} |
} |
2017 |
|
|