Commit 353c3397 authored by Nigel Kukard's avatar Nigel Kukard

Fixed validation of pool override add/edit

parent dd55e871
......@@ -2011,12 +2011,31 @@ sub pool_override_addedit
push(@errors,"Friendly name must be specified");
}
# Make sure we have at least a pool name, username or IP address
my $poolName = isUsername($formData->{'PoolName'},ISUSERNAME_ALLOW_ATSIGN);
my $username = isUsername($formData->{'Username'},ISUSERNAME_ALLOW_ATSIGN);
my $ipAddress = isIPv4($formData->{'IPAddress'});
# Check the pool name is valid if it was specified
my $poolName;
if (defined($formData->{'PoolName'}) && $formData->{'PoolName'} ne "") {
if (!defined($poolName = isUsername($formData->{'PoolName'},ISUSERNAME_ALLOW_ATSIGN))) {
push(@errors,"Pool name is not valid");
}
}
# Next check the username
my $username;
if (defined($formData->{'Username'}) && $formData->{'Username'} ne "") {
if (!defined($username = isUsername($formData->{'Username'},ISUSERNAME_ALLOW_ATSIGN))) {
push(@errors,"Username is not valid");
}
}
# Then the IP
my $ipAddress;
if (defined($formData->{'IPAddress'}) && $formData->{'IPAddress'} ne "") {
if (!defined($ipAddress = isIPv4($formData->{'IPAddress'}))) {
push(@errors,"IP address is not valid");
}
}
# Then confirm we have at least one of the above
if (!defined($poolName) && !defined($username) && !defined($ipAddress)) {
push(@errors,"A pool name and/or IP address and/or Username must be specified");
push(@errors,"At least a valid pool name, username or IP address must be specified to match");
}
# If the traffic class is ticked, process it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment