Add a new validation function
The service parameter are accepting negative values for the unique last password counter. The fix changes the validation for positive integer or zero. Test Plan: PASS: Verify parameter in command 'system service-parameter-add identity security_compliance unique_last_password_count' are not accepting negative values. Closes-Bug: 1950937 Change-Id: I54866078622308057c350d32adb05c573cd12cdc Signed-off-by: Alexandre Horst <alexandre.horst@windriver.com>
This commit is contained in:
parent
75326577c7
commit
e21a2cc327
|
@ -57,6 +57,14 @@ def _validate_integer(name, value):
|
|||
"Parameter '%s' must be an integer value." % name))
|
||||
|
||||
|
||||
def _validate_zero_or_positive_integer(name, value):
|
||||
_validate_integer(name, value)
|
||||
|
||||
if int(value) < 0:
|
||||
raise wsme.exc.ClientSideError(_(
|
||||
"Parameter '%s' must be positive integer or zero.") % name)
|
||||
|
||||
|
||||
def _validate_float(name, value):
|
||||
try:
|
||||
float(value)
|
||||
|
@ -564,7 +572,7 @@ PLATFORM_KERNEL_PARAMETER_VALIDATOR = {
|
|||
|
||||
PLATFORM_KEYSTONE_PARAMETER_VALIDATOR = {
|
||||
constants.SERVICE_PARAM_NAME_SECURITY_COMPLIANCE_UNIQUE_LAST_PASSWORD_COUNT:
|
||||
_validate_integer,
|
||||
_validate_zero_or_positive_integer,
|
||||
constants.SERVICE_PARAM_NAME_SECURITY_COMPLIANCE_PASSWORD_REGEX:
|
||||
_validate_regex,
|
||||
constants.SERVICE_PARAM_NAME_SECURITY_COMPLIANCE_PASSWORD_REGEX_DESCRIPTION:
|
||||
|
|
Loading…
Reference in New Issue