[test suite] add SYSLOG_FACILITY tests

This commit is contained in:
Michael Rash 2014-07-07 21:35:27 -05:00
parent 5c54ef00ad
commit 1b47173906
2 changed files with 172 additions and 10 deletions

View File

@ -63,8 +63,8 @@ free_logging(void)
*/ */
void void
init_logging(fko_srv_options_t *opts) { init_logging(fko_srv_options_t *opts) {
char *my_name = NULL; char *my_name = NULL;
int is_syslog = 0; int is_syslog = 0;
/* In case this is a re-init. /* In case this is a re-init.
*/ */
@ -140,19 +140,17 @@ init_logging(fko_srv_options_t *opts) {
syslog_fac = LOG_LOCAL6; syslog_fac = LOG_LOCAL6;
else if(!strcasecmp(opts->config[CONF_SYSLOG_FACILITY], "LOG_LOCAL7")) else if(!strcasecmp(opts->config[CONF_SYSLOG_FACILITY], "LOG_LOCAL7"))
syslog_fac = LOG_LOCAL7; syslog_fac = LOG_LOCAL7;
else
{
fprintf(stderr, "Invalid SYSLOG_FACILITY setting '%s'\n",
opts->config[CONF_SYSLOG_FACILITY]);
clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
}
} }
verbosity = LOG_DEFAULT_VERBOSITY + opts->verbose; verbosity = LOG_DEFAULT_VERBOSITY + opts->verbose;
} }
/* Set the log facility value.
*/
void
set_log_facility(int fac)
{
syslog_fac = fac;
}
/* Syslog message function. It uses default set at intialization, and also /* Syslog message function. It uses default set at intialization, and also
* takes variable args to accomodate printf-like formatting and expansion. * takes variable args to accomodate printf-like formatting and expansion.
*/ */

View File

@ -2132,6 +2132,170 @@
], ],
}, },
### test syslog config
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_DAEMON',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_DAEMON',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL0',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL0',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL1',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL1',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL2',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL2',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL3',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL3',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL4',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL4',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL5',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL5',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL6',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL6',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL7',
'function' => \&server_conf_files,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL7',
],
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'syslog LOG_LOCAL8',
'function' => \&server_conf_files,
'exec_err' => $YES,
'fwknopd_cmdline' => "$lib_view_str $valgrind_str $fwknopdCmd " .
"-c $rewrite_fwknopd_conf -a $rewrite_access_conf " .
"-d $default_digest_file -p $default_pid_file -D --syslog-enable",
'server_access_file' => [
'SOURCE any',
'KEY testtest'
],
'server_conf_file' => [
'SYSLOG_FACILITY LOG_LOCAL8',
],
'positive_output_matches' => [qr/Invalid SYSLOG_FACILITY/],
},
{ {
'category' => 'basic operations', 'category' => 'basic operations',
'subcategory' => 'server', 'subcategory' => 'server',