628 |
|
|
629 |
ASSERT(msg); |
ASSERT(msg); |
630 |
|
|
631 |
log("%s: %s '%s' at line %d\n", prog, msg, yytext, lineno ); |
log("%s: %s '%s' at line %d\n", prog, msg, yytext, lineno); |
632 |
cfg_errflag++; |
cfg_errflag++; |
633 |
|
|
634 |
} |
} |
677 |
check_depend(); |
check_depend(); |
678 |
END_LOCK; |
END_LOCK; |
679 |
|
|
680 |
return ( cfg_errflag == 0 ); |
return(cfg_errflag == 0); |
681 |
|
|
682 |
} |
} |
683 |
|
|
698 |
Run.Auth.defined= FALSE; |
Run.Auth.defined= FALSE; |
699 |
Run.servicessl= FALSE; |
Run.servicessl= FALSE; |
700 |
Run.clientssl= FALSE; |
Run.clientssl= FALSE; |
701 |
|
depend_list= NULL; |
702 |
reset_runmail(); |
reset_runmail(); |
703 |
if(Run.bind_addr) { |
if(Run.bind_addr) { |
704 |
free(Run.bind_addr); |
free(Run.bind_addr); |
718 |
ASSERT(name); |
ASSERT(name); |
719 |
ASSERT(pidfile); |
ASSERT(pidfile); |
720 |
|
|
721 |
if ( current ) { |
if(current) { |
722 |
|
|
723 |
createprocinfo(); |
createprocinfo(); |
724 |
addprocess(current); |
addprocess(current); |
750 |
*/ |
*/ |
751 |
static void addprocess(Process_T p) { |
static void addprocess(Process_T p) { |
752 |
|
|
753 |
Process_T n= NEW(n); |
Process_T n; |
754 |
|
|
755 |
|
ASSERT(p); |
756 |
|
|
757 |
|
n= NEW(n); |
758 |
memcpy(n, p, sizeof(*p)); |
memcpy(n, p, sizeof(*p)); |
759 |
|
|
760 |
/* Add the process to the end of the process list */ |
/* Add the process to the end of the process list */ |
761 |
if ( tail != NULL ) { |
if(tail != NULL) { |
762 |
|
|
763 |
tail->next= n; |
tail->next= n; |
764 |
|
|
805 |
|
|
806 |
c->file= filename; |
c->file= filename; |
807 |
|
|
808 |
if ( sum ) { |
if(sum) { |
809 |
|
|
810 |
c->md5= sum; |
c->md5= sum; |
811 |
|
|
812 |
|
|
813 |
} else if ( ! set_md5sum(&c->md5, filename) ) { |
} else if(! set_md5sum(&c->md5, filename)) { |
814 |
|
|
815 |
log("%s: Cannot compute a checksum for %s at line %d\n", |
log("%s: Cannot compute a checksum for %s at line %d\n", |
816 |
prog, filename, lineno-1); |
prog, filename, lineno-1); |
842 |
|
|
843 |
ASSERT(mailto); |
ASSERT(mailto); |
844 |
|
|
845 |
if ( f->timeout || |
if(f->timeout || |
846 |
f->restart || |
f->restart || |
847 |
f->checksum || |
f->checksum || |
848 |
f->resource || |
f->resource || |
849 |
f->stop || |
f->stop || |
850 |
f->timestamp ) { |
f->timestamp) { |
851 |
|
|
852 |
m->alert_on_timeout= f->timeout; |
m->alert_on_timeout= f->timeout; |
853 |
m->alert_on_restart= f->restart; |
m->alert_on_restart= f->restart; |
907 |
|
|
908 |
} |
} |
909 |
|
|
910 |
if ( pp->family == AF_INET ) { |
if(pp->family == AF_INET) { |
911 |
snprintf(address, STRLEN, "INET[%s:%d]", pp->hostname, pp->port); |
snprintf(address, STRLEN, "INET[%s:%d]", pp->hostname, pp->port); |
912 |
} else if ( pp->family == AF_UNIX ) { |
} else if(pp->family == AF_UNIX) { |
913 |
snprintf(address, STRLEN, "UNIX[%s]", pp->pathname); |
snprintf(address, STRLEN, "UNIX[%s]", pp->pathname); |
914 |
} |
} |
915 |
|
|
916 |
if ( pp->ssl == TRUE ) { |
if(pp->ssl == TRUE) { |
917 |
|
|
918 |
if ( !have_ssl() ) { |
if(!have_ssl()) { |
919 |
|
|
920 |
log("%s: The ssl check cannot be activated at line %d, " |
log("%s: The ssl check cannot be activated at line %d, " |
921 |
"SSL is not support.\n", |
"SSL is not support.\n", |
953 |
|
|
954 |
ASSERT(rr); |
ASSERT(rr); |
955 |
|
|
956 |
if ( ! Run.doprocess ) { |
if(! Run.doprocess) { |
957 |
|
|
958 |
log("%s: Cannot activate process check at line %d\n" |
log("%s: Cannot activate process check at line %d\n" |
959 |
"\t(The process status engine was disabled. On certain" |
"\t(The process status engine was disabled. On certain" |
971 |
r->operator= rr->operator; |
r->operator= rr->operator; |
972 |
r->next= current->resourcelist; |
r->next= current->resourcelist; |
973 |
|
|
974 |
if ( r->max_cycle < 1 ) { |
if(r->max_cycle < 1) { |
975 |
|
|
976 |
log("%s: The number of cycles must be greater then 0 in line %d\n", |
log("%s: The number of cycles must be greater then 0 in line %d\n", |
977 |
prog, lineno-1); |
prog, lineno-1); |
1090 |
*/ |
*/ |
1091 |
static void setlogfile(char *logfile) { |
static void setlogfile(char *logfile) { |
1092 |
|
|
1093 |
if ( Run.logfile ) { |
if(Run.logfile) { |
1094 |
|
|
1095 |
if ( is(Run.logfile, logfile) ) { |
if(is(Run.logfile, logfile)) { |
1096 |
|
|
1097 |
return; |
return; |
1098 |
|
|
1138 |
|
|
1139 |
ASSERT(mailserver); |
ASSERT(mailserver); |
1140 |
|
|
1141 |
if ( Run.mailserver ) { |
if(Run.mailserver) { |
1142 |
|
|
1143 |
if ( is(Run.mailserver, mailserver) ) { |
if(is(Run.mailserver, mailserver)) { |
1144 |
|
|
1145 |
return; |
return; |
1146 |
|
|
1163 |
|
|
1164 |
ASSERT(uname); |
ASSERT(uname); |
1165 |
|
|
1166 |
if ( Run.Auth.uname ) { |
if(Run.Auth.uname) { |
1167 |
|
|
1168 |
if ( is(Run.Auth.uname, uname) ) { |
if(is(Run.Auth.uname, uname)) { |
1169 |
|
|
1170 |
return; |
return; |
1171 |
|
|
1188 |
|
|
1189 |
ASSERT(passwd); |
ASSERT(passwd); |
1190 |
|
|
1191 |
if ( Run.Auth.passwd ) { |
if(Run.Auth.passwd) { |
1192 |
|
|
1193 |
if ( is(Run.Auth.passwd, passwd) ) { |
if(is(Run.Auth.passwd, passwd)) { |
1194 |
|
|
1195 |
return; |
return; |
1196 |
|
|
1295 |
|
|
1296 |
ASSERT(name); |
ASSERT(name); |
1297 |
|
|
1298 |
if ( exist_process(name) ) { |
if(exist_process(name)) { |
1299 |
|
|
1300 |
log("%s: Name conflict at line %d - check name '%s' already defined\n", |
log("%s: Name conflict at line %d - check name '%s' already defined\n", |
1301 |
prog, lineno, name); |
prog, lineno, name); |
1312 |
*/ |
*/ |
1313 |
static void check_timeout(int s, int c) { |
static void check_timeout(int s, int c) { |
1314 |
|
|
1315 |
if ( s > c ) { |
if(s > c) { |
1316 |
|
|
1317 |
yyerror("The number of restarts must be less than poll cycles"); |
yyerror("The number of restarts must be less than poll cycles"); |
1318 |
|
|
1319 |
} |
} |
1320 |
|
|
1321 |
if ( s <= 0 || c <= 0 ) { |
if(s <= 0 || c <= 0) { |
1322 |
|
|
1323 |
yyerror("Zero or negative values not allowed in a timeout statement"); |
yyerror("Zero or negative values not allowed in a timeout statement"); |
1324 |
|
|
1332 |
*/ |
*/ |
1333 |
static void check_every(int every) { |
static void check_every(int every) { |
1334 |
|
|
1335 |
if ( every <= 1 ) { |
if(every <= 1) { |
1336 |
|
|
1337 |
yyerror("An every statement must have a value greater than 1."); |
yyerror("An every statement must have a value greater than 1."); |
1338 |
|
|
1348 |
|
|
1349 |
ASSERT(hostname); |
ASSERT(hostname); |
1350 |
|
|
1351 |
if ( !check_host(hostname) ) { |
if(!check_host(hostname)) { |
1352 |
|
|
1353 |
yyerror("Hostname did not resolve"); |
yyerror("Hostname did not resolve"); |
1354 |
|
|
1456 |
*/ |
*/ |
1457 |
static void validate_depend(Process_T p, int *has_depend) { |
static void validate_depend(Process_T p, int *has_depend) { |
1458 |
|
|
1459 |
|
ASSERT(p); |
1460 |
|
|
1461 |
if(p->visited) |
if(p->visited) |
1462 |
return; |
return; |
1463 |
|
|
1465 |
|
|
1466 |
Dependant_T d; |
Dependant_T d; |
1467 |
|
|
1468 |
for(d= p->dependantlist; d; d= d->next ) { |
for(d= p->dependantlist; d; d= d->next) { |
1469 |
|
|
1470 |
Process_T dp= get_process(d->dependant); |
Process_T dp= get_process(d->dependant); |
1471 |
|
|
1499 |
*/ |
*/ |
1500 |
static void order_depend(Process_T p) { |
static void order_depend(Process_T p) { |
1501 |
|
|
1502 |
|
ASSERT(p); |
1503 |
|
|
1504 |
if(p->visited) |
if(p->visited) |
1505 |
return; |
return; |
1506 |
|
|
1510 |
|
|
1511 |
Dependant_T d; |
Dependant_T d; |
1512 |
|
|
1513 |
for(d= p->dependantlist; d; d= d->next ) { |
for(d= p->dependantlist; d; d= d->next) { |
1514 |
|
|
1515 |
Process_T dp= get_process(d->dependant); |
Process_T dp= get_process(d->dependant); |
1516 |
|
|