Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
opentrafficshaper
opentrafficshaper
Commits
353c3397
Commit
353c3397
authored
Mar 06, 2018
by
Nigel Kukard
Browse files
Fixed validation of pool override add/edit
parent
dd55e871
Changes
1
Hide whitespace changes
Inline
Side-by-side
opentrafficshaper/plugins/webserver/pages/limits.pm
View file @
353c3397
...
...
@@ -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
,"
A
t least a valid pool name, username or IP address
must be specified
to match
");
}
# If the traffic class is ticked, process it
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment