mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7976 : Param validation for global params involving domain name
(cherry picked from commit 95ea203907)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Conflicts:
server/src/com/cloud/configuration/ConfigurationManagerImpl.java
This commit is contained in:
parent
3cb4358270
commit
57f5d51a11
|
|
@ -327,6 +327,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
private int _maxVolumeSizeInGb = Integer.parseInt(Config.MaxVolumeSize.getDefaultValue());
|
||||
private long _defaultPageSize = Long.parseLong(Config.DefaultPageSize.getDefaultValue());
|
||||
private static final String DOMAIN_NAME_PATTERN = "^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$";
|
||||
protected Set<String> configValuesForValidation;
|
||||
private Set<String> weightBasedParametersForValidation;
|
||||
private Set<String> overprovisioningFactorsForValidation;
|
||||
|
|
@ -843,6 +844,15 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (!NetUtils.verifyInstanceName(value)) {
|
||||
return "Instance name can not contain hyphen, space or plus sign";
|
||||
}
|
||||
} else if (range.equalsIgnoreCase("domainName")) {
|
||||
String domainName = value;
|
||||
if (value.startsWith("*")) {
|
||||
domainName = value.substring(2); //skip the "*."
|
||||
}
|
||||
//max length for FQDN is 253 + 2, code adds xxx-xxx-xxx-xxx to domain name when creating URL
|
||||
if (domainName.length() >= 238 || !domainName.matches(DOMAIN_NAME_PATTERN)) {
|
||||
return "Please enter a valid string for domain name, prefixed with '*.' if applicable";
|
||||
}
|
||||
} else if (range.equals("routes")) {
|
||||
String[] routes = value.split(",");
|
||||
for (String route : routes) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue