diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebServersProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebServersProxy.cs index ca9b7876..dfd90b61 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebServersProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/WebServersProxy.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -25,6 +53,7 @@ namespace WebsitePanel.EnterpriseServer { using WebsitePanel.Providers.Web; using WebsitePanel.Providers.ResultObjects; + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] @@ -808,22 +837,24 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddWebSite", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) { + public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone) { object[] results = this.Invoke("AddWebSite", new object[] { packageId, hostName, domainId, - ipAddressId}); + ipAddressId, + ignoreGlobalDNSZone}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginAddWebSite(int packageId, string hostName, int domainId, int ipAddressId, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginAddWebSite(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("AddWebSite", new object[] { packageId, hostName, domainId, - ipAddressId}, callback, asyncState); + ipAddressId, + ignoreGlobalDNSZone}, callback, asyncState); } /// @@ -833,12 +864,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId) { - this.AddWebSiteAsync(packageId, hostName, domainId, ipAddressId, null); + public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone) { + this.AddWebSiteAsync(packageId, hostName, domainId, ipAddressId, ignoreGlobalDNSZone, null); } /// - public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId, object userState) { + public void AddWebSiteAsync(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone, object userState) { if ((this.AddWebSiteOperationCompleted == null)) { this.AddWebSiteOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddWebSiteOperationCompleted); } @@ -846,7 +877,8 @@ namespace WebsitePanel.EnterpriseServer { packageId, hostName, domainId, - ipAddressId}, this.AddWebSiteOperationCompleted, userState); + ipAddressId, + ignoreGlobalDNSZone}, this.AddWebSiteOperationCompleted, userState); } private void OnAddWebSiteOperationCompleted(object arg) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs index 910a49fa..164ad64f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Packages/PackageController.cs @@ -481,7 +481,7 @@ namespace WebsitePanel.EnterpriseServer // create web site try { - int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true); + int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true, false); if (webSiteId < 0) { result.Result = webSiteId; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Servers/ServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Servers/ServerController.cs index 9c1ff2a4..fa1b5caf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Servers/ServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Servers/ServerController.cs @@ -1729,7 +1729,7 @@ namespace WebsitePanel.EnterpriseServer int webSiteId = 0; if (webEnabled && createWebSite) { - webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias); + webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias, false); if (webSiteId < 0) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs index 9e3561f0..49916149 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/WebServers/WebServerController.cs @@ -157,11 +157,11 @@ namespace WebsitePanel.EnterpriseServer public static int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) { - return AddWebSite(packageId, hostName, domainId, ipAddressId, false); + return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true); } public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId, - bool addInstantAlias) + bool addInstantAlias, bool ignoreGlobalDNSRecords) { // check account int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); @@ -182,10 +182,14 @@ namespace WebsitePanel.EnterpriseServer string siteName = string.IsNullOrEmpty(hostName) ? domainName : hostName + "." + domainName; - // check if the web site already exists + // check if the web site already exists (legacy) if (PackageController.GetPackageItemByName(packageId, siteName, typeof(WebSite)) != null) return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS; + if (DataProvider.CheckDomain(domain.PackageId, siteName, true) != 0) + return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS; + + // place log record TaskManager.StartTask("WEB_SITE", "ADD", siteName); @@ -239,13 +243,7 @@ namespace WebsitePanel.EnterpriseServer if (ip != null) ipAddr = !String.IsNullOrEmpty(ip.InternalIP) ? ip.InternalIP : ip.ExternalIP; - // load domain instant alias -/* - string instantAlias = ServerController.GetDomainAlias(packageId, domainName); - DomainInfo instantDomain = ServerController.GetDomain(instantAlias); - if (instantDomain == null || instantDomain.WebSiteId > 0) - instantAlias = ""; -*/ + // load web DNS records List dnsRecords = ServerController.GetDnsRecordsByService(serviceId); @@ -256,18 +254,15 @@ namespace WebsitePanel.EnterpriseServer { // SHARED IP // fill main domain bindings - FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, false); + FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords); - // fill alias bindings if required - /* - if (addInstantAlias && !String.IsNullOrEmpty(instantAlias)) + //double check all bindings + foreach (ServerBinding b in bindings) { - // fill bindings from DNS "A" records - FillWebServerBindings(bindings, dnsRecords, ipAddr, "", instantAlias); + if (DataProvider.CheckDomain(domain.PackageId, b.Host, true) != 0) + return BusinessErrorCodes.ERROR_WEB_SITE_ALREADY_EXISTS; } - */ - //bindings.Add(new ServerBinding(ipAddr, "80", siteName)); } else { @@ -391,14 +386,9 @@ namespace WebsitePanel.EnterpriseServer // update domain // add main pointer - AddWebSitePointer(siteItemId, hostName, domain.DomainId, false); + AddWebSitePointer(siteItemId, hostName, domain.DomainId, false, ignoreGlobalDNSRecords); - // add instant pointer - /* - if (addInstantAlias && !String.IsNullOrEmpty(instantAlias)) - AddWebSitePointer(siteItemId, "", instantDomain.DomainId, false); - */ - + // add parking page // load package if (webPolicy["AddParkingPage"] != null) @@ -722,39 +712,25 @@ namespace WebsitePanel.EnterpriseServer if ((dnsRecord.RecordType == "A" || dnsRecord.RecordType == "AAAA" || dnsRecord.RecordType == "CNAME") && dnsRecord.RecordName != "*") { - /* - string recordData = dnsRecord.RecordName + - ((dnsRecord.RecordName != "") ? "." : "") + domainName; + string recordData = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName, true); - bindings.Add(new ServerBinding(ipAddr, "80", recordData)); - */ - - string tmpName = string.Empty; - - tmpName = Utils.ReplaceStringVariable(dnsRecord.RecordName, "host_name", hostName); - - if (!(tmpName== "[host_name]")) + if (!string.IsNullOrEmpty(domainName)) + recordData = recordData + ((string.IsNullOrEmpty(recordData)) ? "" : ".") + domainName; + //otherwise full recordData is supplied by hostName + + if (ignoreGlobalDNSRecords) { - string recordData = string.Empty; - if (tmpName.Contains(".")) - recordData = hostName; - else - recordData = tmpName + ((tmpName != "") ? "." : "") + domainName; - - - if (ignoreGlobalDNSRecords) - { - if (dnsRecord.RecordName == "[host_name]") - { - AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData)); - break; - } - } - else + //only look for the host_nanme record, ignore all others + if (dnsRecord.RecordName == "[host_name]") { AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData)); + break; } } + else + { + AddBinding(bindings, new ServerBinding(ipAddr, "80", recordData)); + } } } @@ -915,8 +891,10 @@ namespace WebsitePanel.EnterpriseServer string serviceIp = (ip != null) ? ip.ExternalIP : null; + //filter initiat GlobaDNSRecords list if (ignoreGlobalDNSRecords) { + //ignore all other except the host_name record foreach (GlobalDnsRecord r in dnsRecords) { if (r.RecordName == "[host_name]") @@ -977,6 +955,7 @@ namespace WebsitePanel.EnterpriseServer // fill bindings FillWebServerBindings(bindings, dnsRecords, ipAddr, hostName, domain.DomainName, ignoreGlobalDNSRecords); + //for logging purposes foreach (ServerBinding b in bindings) { string header = string.Format("{0} {1} {2}", b.Host, b.IP, b.Port); @@ -991,14 +970,12 @@ namespace WebsitePanel.EnterpriseServer // update domain domain.WebSiteId = siteItemId; - //ServerController.UpdateDomain(domain); - + domain.IsDomainPointer = true; foreach (ServerBinding b in bindings) { + //add new domain record domain.DomainName = b.Host; - domain.IsDomainPointer = true; int domainID = ServerController.AddDomain(domain); - DomainInfo domainTmp = ServerController.GetDomain(domainID); if (domainTmp != null) { @@ -1008,7 +985,6 @@ namespace WebsitePanel.EnterpriseServer } } - return 0; } catch (Exception ex) @@ -1070,7 +1046,7 @@ namespace WebsitePanel.EnterpriseServer { foreach (GlobalDnsRecord r in dnsRecords) { - if (r.RecordName == "[host_name]") + if ((r.RecordName == "[host_name]") | ((r.RecordName + (string.IsNullOrEmpty(r.RecordName) ? domain.ZoneName : "." + domain.ZoneName)) == domain.DomainName)) tmpDnsRecords.Add(r); } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs index 9f5d7ed8..c1d24976 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Wizards/UserCreationWizard.cs @@ -199,7 +199,7 @@ namespace WebsitePanel.EnterpriseServer try { int webSiteId = WebServerController.AddWebSite( - createdPackageId, hostName, domainId, 0, true); + createdPackageId, hostName, domainId, 0, true, false); if (webSiteId < 0) { // rollback wizard diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config index ba1ad41e..b78330c8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config @@ -5,11 +5,11 @@ - + - + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esWebServers.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esWebServers.asmx.cs index 997303e9..00dc32d0 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esWebServers.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esWebServers.asmx.cs @@ -104,9 +104,9 @@ namespace WebsitePanel.EnterpriseServer } [WebMethod] - public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId) + public int AddWebSite(int packageId, string hostName, int domainId, int ipAddressId, bool ignoreGlobalDNSZone) { - return WebServerController.AddWebSite(packageId, hostName, domainId, ipAddressId, true); + return WebServerController.AddWebSite(packageId, hostName, domainId, ipAddressId, true, ignoreGlobalDNSZone); } [WebMethod] diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddPointer.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddPointer.ascx.resx index f6e5d7d6..f4978101 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddPointer.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddPointer.ascx.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Add Pointer @@ -124,6 +124,6 @@ Cancel - Domain Alias: + Web Site Pointer: \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddSite.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddSite.ascx.resx index a425d075..000c366a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddSite.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/WebSitesAddSite.ascx.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ShowProgressDialog('Creating web site...'); @@ -126,11 +126,14 @@ Cancel + + Ignore Zone Template + ASP.NET Version: - Domain Name: + Site: IP address: @@ -138,6 +141,9 @@ If you need your web site to be accessible via dedicated IP address or you are planning to enable SSL for your site you should choose "Dedicated IP" option; otherwise leave this settings by default. In order to create IP-based site you need to purchase IP address from your host. + + Note: A Zone Template is often defined by your host and contains additional Web Site Pointers to create when creating a new Web Site. Static record definitions such as 'www' conflicts when creating an additional Web Site in the same Domain. </p>Check this option to ignore the Zone Template and create the new Web Site with this Web Site Pointer only. + Dedicated diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx index c5eead2c..3b6e2608 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx @@ -11,7 +11,7 @@ - . + . + + + + + + + + +
+ +
+ + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx.cs index 689fa1a3..93d85f19 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesAddSite.ascx.cs @@ -53,6 +53,8 @@ namespace WebsitePanel.Portal // bind IP Addresses BindIPAddresses(); + BindIgnoreZoneTemplate(); + // toggle ToggleControls(); } @@ -63,6 +65,19 @@ namespace WebsitePanel.Portal rowDedicatedIP.Visible = rbDedicatedIP.Checked; } + private void BindIgnoreZoneTemplate() + { + /* + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas[Quotas.WEB_SITES].QuotaUsedValue > 0) + chkIgnoreGlobalDNSRecords.Visible = chkIgnoreGlobalDNSRecords.Checked = lblIgnoreGlobalDNSRecords.Visible = true; + else + chkIgnoreGlobalDNSRecords.Visible = chkIgnoreGlobalDNSRecords.Checked = lblIgnoreGlobalDNSRecords.Visible= false; + */ + + chkIgnoreGlobalDNSRecords.Checked = false; + } + private void BindIPAddresses() { ddlIpAddresses.Items.Add(new ListItem("