184 |
static void check_depend(); |
static void check_depend(); |
185 |
static void order_depend(Process_T); |
static void order_depend(Process_T); |
186 |
static void validate_depend(Process_T, int *); |
static void validate_depend(Process_T, int *); |
187 |
static void init_syslog(); |
static void init_syslog(char *); |
188 |
%} |
%} |
189 |
|
|
190 |
%union { |
%union { |
262 |
; |
; |
263 |
|
|
264 |
setdaemon : SET DAEMON NUMBER { |
setdaemon : SET DAEMON NUMBER { |
265 |
if (!Run.isdaemon || ihp.daemon) { |
if(!Run.isdaemon || ihp.daemon) { |
266 |
ihp.daemon= TRUE; |
ihp.daemon= TRUE; |
267 |
Run.isdaemon= TRUE; |
Run.isdaemon= TRUE; |
268 |
Run.polltime= $3; |
Run.polltime= $3; |
276 |
; |
; |
277 |
|
|
278 |
setlog : SET LOGFILE PATH { |
setlog : SET LOGFILE PATH { |
279 |
if (!Run.logfile || ihp.logfile) { |
if(!Run.logfile || ihp.logfile) { |
280 |
ihp.logfile= TRUE; |
ihp.logfile= TRUE; |
281 |
setlogfile($3); |
setlogfile($3); |
282 |
Run.use_syslog= FALSE; |
Run.use_syslog= FALSE; |
283 |
Run.dolog=TRUE; |
Run.dolog=TRUE; |
284 |
} |
} |
285 |
} |
} |
286 |
| SET LOGFILE SYSLOG { |
| SET LOGFILE SYSLOG { init_syslog(NULL); } |
|
init_syslog(); |
|
|
Run.facility = LOG_USER; |
|
|
} |
|
287 |
| SET LOGFILE SYSLOG FACILITY STRING { |
| SET LOGFILE SYSLOG FACILITY STRING { |
288 |
init_syslog(); |
init_syslog($5); free($5); |
|
if ( !strcmp($5,"log_local0")) { |
|
|
Run.facility = LOG_LOCAL0; |
|
|
} else if ( !strcmp($5, "log_local1")) { |
|
|
Run.facility = LOG_LOCAL1; |
|
|
} else if ( !strcmp($5, "log_local2")) { |
|
|
Run.facility = LOG_LOCAL2; |
|
|
} else if ( !strcmp($5, "log_local3")) { |
|
|
Run.facility = LOG_LOCAL3; |
|
|
} else if ( !strcmp($5, "log_local4")) { |
|
|
Run.facility = LOG_LOCAL4; |
|
|
} else if ( !strcmp($5, "log_local5")) { |
|
|
Run.facility = LOG_LOCAL5; |
|
|
} else if ( !strcmp($5, "log_local6")) { |
|
|
Run.facility = LOG_LOCAL6; |
|
|
} else if ( !strcmp($5, "log_local7")) { |
|
|
Run.facility = LOG_LOCAL7; |
|
|
} else if ( !strcmp($5, "log_daemon")) { |
|
|
Run.facility = LOG_DAEMON; |
|
|
} else { |
|
|
printf("Invalid facility given %s\n", $5); |
|
|
exit(1); |
|
289 |
} |
} |
|
|
|
|
} |
|
290 |
; |
; |
291 |
|
|
292 |
setpid : SET PIDFILE PATH { |
setpid : SET PIDFILE PATH { |
293 |
if (!Run.pidfile || ihp.pidfile) { |
if(!Run.pidfile || ihp.pidfile) { |
294 |
ihp.pidfile= TRUE; |
ihp.pidfile= TRUE; |
295 |
setpidfile($3); |
setpidfile($3); |
296 |
} |
} |
413 |
; |
; |
414 |
|
|
415 |
start : START argumentlist { addcommand(START); } |
start : START argumentlist { addcommand(START); } |
416 |
| START argumentlist cmdoptionlist { addcommand(START); } |
| START argumentlist useroptionlist { addcommand(START); } |
417 |
; |
; |
418 |
|
|
419 |
stop : STOP argumentlist { addcommand(STOP); } |
stop : STOP argumentlist { addcommand(STOP); } |
420 |
| STOP argumentlist cmdoptionlist { addcommand(STOP); } |
| STOP argumentlist useroptionlist { addcommand(STOP); } |
421 |
; |
; |
422 |
|
|
423 |
argumentlist : argument |
argumentlist : argument |
424 |
| argumentlist argument |
| argumentlist argument |
425 |
; |
; |
426 |
|
|
427 |
cmdoptionlist : cmdoption |
useroptionlist : useroption |
428 |
| cmdoptionlist cmdoption |
| useroptionlist useroption |
429 |
; |
; |
430 |
|
|
431 |
argument : STRING { addargument($1); } | PATH { addargument($1); } |
argument : STRING { addargument($1); } | PATH { addargument($1); } |
432 |
; |
; |
433 |
|
|
434 |
cmdoption : UID STRING { adduid($2, 0); } |
useroption : UID STRING { adduid($2, 0); free($2); } |
435 |
| GID STRING { addgid($2, 0); } |
| GID STRING { addgid($2, 0); free($2); } |
436 |
| UID NUMBER { adduid(NULL, $2); } |
| UID NUMBER { adduid(NULL, $2); } |
437 |
| GID NUMBER { addgid(NULL, $2); } |
| GID NUMBER { addgid(NULL, $2); } |
438 |
; |
; |
1178 |
|
|
1179 |
} else { |
} else { |
1180 |
|
|
1181 |
log("%s: Ignoring uid switch at line %d, not running as the super-user.\n", |
log("%s: Ignoring uid statement at line %d, not running as root.\n", |
1182 |
prog, lineno); |
prog, lineno); |
1183 |
|
|
1184 |
} |
} |
|
|
|
|
free(user); |
|
1185 |
|
|
1186 |
} |
} |
1187 |
|
|
1242 |
|
|
1243 |
} else { |
} else { |
1244 |
|
|
1245 |
log("%s: Ignoring gid switch at line %d, not running as the super-user.\n", |
log("%s: Ignoring gid statement at line %d, not running as root.\n", |
1246 |
prog, lineno); |
prog, lineno); |
1247 |
|
|
1248 |
} |
} |
1249 |
|
|
|
free(group); |
|
|
|
|
1250 |
} |
} |
1251 |
|
|
1252 |
|
|
1691 |
|
|
1692 |
} |
} |
1693 |
|
|
1694 |
static void init_syslog() { |
|
1695 |
|
|
1696 |
|
static void init_syslog(char *facility) { |
1697 |
|
|
1698 |
if (!Run.logfile || ihp.logfile) { |
if (!Run.logfile || ihp.logfile) { |
1699 |
|
|
1703 |
Run.dolog=TRUE; |
Run.dolog=TRUE; |
1704 |
|
|
1705 |
} |
} |
1706 |
|
|
1707 |
|
if(facility) { |
1708 |
|
if(is(facility,"log_local0")) { |
1709 |
|
Run.facility = LOG_LOCAL0; |
1710 |
|
} else if(is(facility, "log_local1")) { |
1711 |
|
Run.facility = LOG_LOCAL1; |
1712 |
|
} else if(is(facility, "log_local2")) { |
1713 |
|
Run.facility = LOG_LOCAL2; |
1714 |
|
} else if(is(facility, "log_local3")) { |
1715 |
|
Run.facility = LOG_LOCAL3; |
1716 |
|
} else if(is(facility, "log_local4")) { |
1717 |
|
Run.facility = LOG_LOCAL4; |
1718 |
|
} else if(is(facility, "log_local5")) { |
1719 |
|
Run.facility = LOG_LOCAL5; |
1720 |
|
} else if(is(facility, "log_local6")) { |
1721 |
|
Run.facility = LOG_LOCAL6; |
1722 |
|
} else if(is(facility, "log_local7")) { |
1723 |
|
Run.facility = LOG_LOCAL7; |
1724 |
|
} else if(is(facility, "log_daemon")) { |
1725 |
|
Run.facility = LOG_DAEMON; |
1726 |
|
} else { |
1727 |
|
log("Invalid syslog facility '%s' used at line %d\n", facility, lineno); |
1728 |
|
cfg_errflag++; |
1729 |
|
} |
1730 |
|
} else { |
1731 |
|
Run.facility= LOG_USER; |
1732 |
|
} |
1733 |
|
|
1734 |
} |
} |