From d1bee20b4ab60e3560cfbb3fd3ffc2a0d4e7e3e5 Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 17 Jun 2011 16:58:21 -0700 Subject: [PATCH] Validate network domain in upateNetwork command --- server/src/com/cloud/network/NetworkManagerImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 88274d20387..f1ab36900bd 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -2893,6 +2893,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag //don't allow to modify network domain if the service is not supported if (domainSuffix != null) { + // validate network domain + if (!NetUtils.verifyDomainName(domainSuffix)) { + throw new InvalidParameterValueException( + "Invalid network domain. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', " + + "and the hyphen ('-'); can't start or end with \"-\""); + } + + Map dnsCapabilities = getServiceCapabilities(network.getDataCenterId(), network.getNetworkOfferingId(), Service.Dns); String isUpdateDnsSupported = dnsCapabilities.get(Capability.AllowDnsSuffixModification); if (isUpdateDnsSupported == null || !Boolean.valueOf(isUpdateDnsSupported)) {