"LogFacility" => "syslog",
"BlockCount" => "3",
"BlockTime" => "86400",
+ "FirewallEngine" => "none",
);
#
# If an error message is returned, exit and print the error message.
} else {
- die "Invalid configuration: $error\n";
+ die "Invalid configuration: $error";
}
}
# Check if the configfile exists and is read-able.
unless (-r "$file") {
- die "The given configfile ($file) does not exist, or is not read-able: $!\n";
+ die "The given configfile ($file) does not exist, or is not read-able: $!";
}
# Open the config file and read-in all configuration options and values.
- open(CONF, "$file") or die "Could not open $file: $!\n";
+ open(CONF, "$file") or die "Could not open $file: $!";
# Process line by line.
while (my $line = <CONF>) {
# Remove any newlines.
chomp($line);
- # Remove any spaces at the start and end of the line.
- $line =~ s/^\s*//;
- $line =~ s/\s*$//;
-
# Check line lenght, skip it, if it is longer than, the
# allowed maximum.
my $length = length("$line");
next if ($length gt $maxlength);
+ # Remove any whitespaces.
+ $line=~ s/ //g;
+
# Splitt line into two parts.
my ($option, $value) = split (/=/, $line);
}
}
- # XXX - add check for validating the configured loglevel.
+ # Gather details about supported log levels.
+ my %supported_loglevels = &Guardian::Logger::GetLogLevels();
+
+ # Check if the configured log level is valid.
+ unless (exists ($supported_loglevels{$config{LogLevel}})) {
+ return "Invalid LogLevel: $config{LogLevel}";
+ }
# The config looks good, so return nothing (no error message).
return undef