Skip to content
Snippets Groups Projects
Commit d5552969 authored by Tomáš Plesník's avatar Tomáš Plesník
Browse files

pridani kontroly validniho typu noveho prijimajiciho klienta

parent ac5aef0b
No related branches found
No related tags found
No related merge requests found
...@@ -120,9 +120,15 @@ switch () { ...@@ -120,9 +120,15 @@ switch () {
case {!defined $ip_net_client} {WardenCommon::errMsg("Parameter '-c <cidr>' is not defined!")} case {!defined $ip_net_client} {WardenCommon::errMsg("Parameter '-c <cidr>' is not defined!")}
} }
# check if type of event is allowed in validation hash
my @valid_types = $WardenCommon::VALID_STRINGS{"type"};
if (!($type ~~ @valid_types)) {
WardenCommon::errMsg("Unsupported type of events: '$type'!");
}
# check validity of IP address (CIDR format) # check validity of IP address (CIDR format)
if ($ip_net_client !~ /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$/) { if ($ip_net_client !~ /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$/) {
WardenCommon::errMsg("Enter correct IP address in CIDR format!"); WardenCommon::errMsg("Incorrect CIDR format of IP address: '$ip_net_client'!");
} }
# check client ID # check client ID
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment