You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by am...@apache.org on 2014/11/26 23:46:13 UTC
git commit: updated refs/heads/master to 86895ec
Repository: cloudstack
Updated Branches:
refs/heads/master 3d6635a53 -> 86895ec13
Add validation for domain names passed via global pamaremets
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/86895ec1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/86895ec1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/86895ec1
Branch: refs/heads/master
Commit: 86895ec13c11bdf4dc1feab0a3dfa003e02fde12
Parents: 3d6635a
Author: amoghvk <am...@citrix.com>
Authored: Wed Nov 26 14:45:50 2014 -0800
Committer: amoghvk <am...@citrix.com>
Committed: Wed Nov 26 14:45:50 2014 -0800
----------------------------------------------------------------------
server/src/com/cloud/configuration/Config.java | 21 ++++++++++----------
.../configuration/ConfigurationManagerImpl.java | 9 +++++++++
2 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86895ec1/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 0ef0e25..a1dd882 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -16,6 +16,15 @@
// under the License.
package com.cloud.configuration;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.framework.config.ConfigKey;
+
import com.cloud.agent.AgentManager;
import com.cloud.consoleproxy.ConsoleProxyManager;
import com.cloud.ha.HighAvailabilityManager;
@@ -29,14 +38,6 @@ import com.cloud.storage.snapshot.SnapshotManager;
import com.cloud.template.TemplateManager;
import com.cloud.vm.UserVmManager;
import com.cloud.vm.snapshot.VMSnapshotManager;
-import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
-import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
-import org.apache.cloudstack.framework.config.ConfigKey;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.StringTokenizer;
public enum Config {
@@ -438,7 +439,7 @@ public enum Config {
"Console proxy command port that is used to communicate with management server",
null),
ConsoleProxyRestart("Console Proxy", AgentManager.class, Boolean.class, "consoleproxy.restart", "true", "Console proxy restart flag, defaulted to true", null),
- ConsoleProxyUrlDomain("Console Proxy", AgentManager.class, String.class, "consoleproxy.url.domain", "", "Console proxy url domain", null),
+ ConsoleProxyUrlDomain("Console Proxy", AgentManager.class, String.class, "consoleproxy.url.domain", "", "Console proxy url domain", "domainName"),
ConsoleProxyLoadscanInterval(
"Console Proxy",
AgentManager.class,
@@ -774,7 +775,7 @@ public enum Config {
"secstorage.ssl.cert.domain",
"",
"SSL certificate used to encrypt copy traffic between zones",
- null),
+ "domainName"),
SecStorageCapacityStandby(
"Advanced",
AgentManager.class,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86895ec1/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 57b50e6..9d25b30 100644
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -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]{2,6}$";
protected Set<String> configValuesForValidation;
private Set<String> weightBasedParametersForValidation;
private Set<String> overprovisioningFactorsForValidation;
@@ -838,6 +839,14 @@ 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 "*."
+ }
+ if (!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) {