mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-10111: Fix validation for parameter "vm.password.length" (#2291)
The description of the parameter was saying that the parameter has to be bigger than 6, however, in the code we were only accepting values bigger than 10. This PR changes the validation method to accept any number >= 6. We also change other inconsistencies in error messages presented to users. in near by validations.
This commit is contained in:
parent
1315c947c0
commit
c6b808fd33
|
|
@ -240,8 +240,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
VolumeDao _volumeDao;
|
||||
@Inject
|
||||
VMInstanceDao _vmInstanceDao;
|
||||
//@Inject
|
||||
//VmwareDatacenterZoneMapDao _vmwareDatacenterZoneMapDao;
|
||||
@Inject
|
||||
AccountVlanMapDao _accountVlanMapDao;
|
||||
@Inject
|
||||
|
|
@ -282,7 +280,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
ClusterDao _clusterDao;
|
||||
@Inject
|
||||
AlertManager _alertMgr;
|
||||
// @com.cloud.utils.component.Inject(adapter = SecurityChecker.class)
|
||||
List<SecurityChecker> _secChecker;
|
||||
|
||||
@Inject
|
||||
|
|
@ -816,16 +813,15 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (val <= 0) {
|
||||
throw new InvalidParameterValueException("Please enter a positive value for the configuration parameter:" + name);
|
||||
}
|
||||
//TODO - better validation for all password pamameters
|
||||
if ("vm.password.length".equalsIgnoreCase(name) && val < 10) {
|
||||
throw new InvalidParameterValueException("Please enter a value greater than 6 for the configuration parameter:" + name);
|
||||
if ("vm.password.length".equalsIgnoreCase(name) && val < 6) {
|
||||
throw new InvalidParameterValueException("Please enter a value greater than 5 for the configuration parameter:" + name);
|
||||
}
|
||||
if ("remote.access.vpn.psk.length".equalsIgnoreCase(name)) {
|
||||
if (val < 8) {
|
||||
throw new InvalidParameterValueException("Please enter a value greater than 8 for the configuration parameter:" + name);
|
||||
throw new InvalidParameterValueException("Please enter a value greater than 7 for the configuration parameter:" + name);
|
||||
}
|
||||
if (val > 256) {
|
||||
throw new InvalidParameterValueException("Please enter a value less than 256 for the configuration parameter:" + name);
|
||||
throw new InvalidParameterValueException("Please enter a value less than 257 for the configuration parameter:" + name);
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
|
|
@ -1019,12 +1015,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
final String checkPodCIDRs = _configDao.getValue("check.pod.cidrs");
|
||||
if (checkPodCIDRs == null || checkPodCIDRs.trim().isEmpty() || Boolean.parseBoolean(checkPodCIDRs)) {
|
||||
checkPodCidrSubnets(zoneId, podId, cidr);
|
||||
/*
|
||||
* Commenting out due to Bug 11593 - CIDR conflicts with zone when
|
||||
* extending pod but not when creating it
|
||||
*
|
||||
* checkCidrVlanOverlap(zoneId, cidr);
|
||||
*/
|
||||
}
|
||||
|
||||
if (allocationStateStr != null && !allocationStateStr.isEmpty()) {
|
||||
|
|
@ -1587,12 +1577,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
throw new InvalidParameterValueException(
|
||||
"Invalid Zone Detail specified, fields 'key' and 'value' cannot be null, please specify details in the form: details[0].key=XXX&details[0].value=YYY");
|
||||
}
|
||||
// validate the zone detail keys are known keys
|
||||
/*
|
||||
* if(!ZoneConfig.doesKeyExist(key)){ throw new
|
||||
* InvalidParameterValueException
|
||||
* ("Invalid Zone Detail parameter: "+ key); }
|
||||
*/
|
||||
newDetails.put(key, value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue