Skip to content

Commit 3f6d779

Browse files
committed
Merge pull request apache#929 from karuturi/CLOUDSTACK-8951
[4.7] CLOUDSTACK-8951: validation for config param "remote.access.vpn.psk.length"throwing error for value < 8 and value > 256 right now, 8, 256 are hardcoded in the code. They should be moved to a constant and has to be reused everywhere. will update with test cases/testing later. * pr/929: CLOUDSTACK-8951: validation for "remote.access.vpn.psk.length" Signed-off-by: Remi Bergsma <github@remi.nl>
2 parents a323434 + 170a025 commit 3f6d779

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

server/src/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ private void populateConfigValuesForValidationSet() {
386386
configValuesForValidation.add("ovm3.heartbeat.timeout");
387387
configValuesForValidation.add("incorrect.login.attempts.allowed");
388388
configValuesForValidation.add("vm.password.length");
389+
configValuesForValidation.add("remote.access.vpn.psk.length");
389390
}
390391

391392
private void weightBasedParametersForValidation() {
@@ -773,6 +774,14 @@ private String validateConfigurationValue(final String name, String value, final
773774
if ("vm.password.length".equalsIgnoreCase(name) && val < 6) {
774775
throw new InvalidParameterValueException("Please enter a value greater than 6 for the configuration parameter:" + name);
775776
}
777+
if ("remote.access.vpn.psk.length".equalsIgnoreCase(name)) {
778+
if (val < 8) {
779+
throw new InvalidParameterValueException("Please enter a value greater than 8 for the configuration parameter:" + name);
780+
}
781+
if (val > 256) {
782+
throw new InvalidParameterValueException("Please enter a value less than 256 for the configuration parameter:" + name);
783+
}
784+
}
776785
} catch (final NumberFormatException e) {
777786
s_logger.error("There was an error trying to parse the integer value for:" + name);
778787
throw new InvalidParameterValueException("There was an error trying to parse the integer value for:" + name);

0 commit comments

Comments
 (0)