Example #1
0
        internal WsatConfiguration(string machineName, string virtualServer, WsatConfiguration previousConfig, bool minimalWrite)
        {
            this.MachineName     = machineName;
            this.minimalWrite    = minimalWrite;
            this.firewallWrapper = new FirewallWrapper();
            this.previousConfig  = previousConfig;
            this.virtualServer   = virtualServer;
            if (previousConfig == null)
            {
                this.allowedCertificates = DefaultX509GlobalAcl;
                this.kerberosGlobalAcl   = DefaultKerberosGlobalAcl;
            }
            else
            {
                CopyConfigurationData(previousConfig, this);
            }

            if (MsdtcClusterUtils.IsClusterServer(MachineName))
            {
                this.hClusterDtcResource = MsdtcClusterUtils.GetTransactionManagerClusterResource(VirtualServer, out clusterNodes);
                if (hClusterDtcResource == null || hClusterDtcResource.IsInvalid)
                {
                    if (!string.IsNullOrEmpty(VirtualServer))
                    {
                        throw new WsatAdminException(WsatAdminErrorCode.CANNOT_FIND_CLUSTER_VIRTUAL_SERVER, SR.GetString(SR.ErrorCanNotFindVirtualServer));
                    }
                }
            }
            InitializeConfigurationProvider();
        }
 static bool IsLongHornClusterLocalDtc(string machineName, string virtualServerName)
 {
     if (Utilities.GetOSMajor(machineName) > 5 && MsdtcClusterUtils.IsClusterServer(machineName))
     {
         if (string.IsNullOrEmpty(virtualServerName))
         {
             return(true);
         }
     }
     return(false);
 }
        static string GetTransactionManagerHostName(string machineName, string virtualServerName)
        {
            if (MsdtcClusterUtils.IsClusterServer(machineName))
            {
                if (!string.IsNullOrEmpty(virtualServerName))
                {
                    return(virtualServerName);
                }
                return(Utilities.IsLocalMachineName(machineName) ? Utilities.LocalHostName : machineName);
            }

            return(Utilities.IsLocalMachineName(machineName) ? string.Empty : machineName);
        }
Example #4
0
        public int CreatePropertyPages(IPropertySheetCallback provider, IntPtr handle, System.Runtime.InteropServices.ComTypes.IDataObject dataObject)
        {
            const int E_UNEXPECTED = unchecked ((int)0x8000ffff);

            if (dataObject != null)
            {
                if (Utilities.OSMajor <= 5)
                {
                    // REMARK: there is a BUG here:
                    // CCF_COM_WORKSTATION should return the machine name,
                    // not CCF_COM_OBJECTKEY
                    if (!TryGetResourceValue(dataObject, "CCF_COM_OBJECTKEY", out machineName))
                    {
                        return(E_UNEXPECTED);
                    }

                    if (!Utilities.IsLocalMachineName(machineName) && MsdtcClusterUtils.IsClusterServer(machineName))
                    {
                        //Remote cluster configuration is not supported
                        return(HRESULT.S_FALSE);
                    }
                }
                else
                {
                    string dtcHostName;
                    if (!TryGetResourceValue(dataObject, "CCF_DTC_HOSTNAME", out dtcHostName))
                    {
                        return(E_UNEXPECTED);
                    }

                    bool   isDtcNode = false;
                    string dtcResource;
                    if (TryGetResourceValue(dataObject, "CCF_DTC_RESOURCE", out dtcResource) && !string.IsNullOrEmpty(dtcResource))
                    {
                        isDtcNode = true;
                    }

                    if (isDtcNode)
                    {
                        if (!MsdtcClusterUtils.ResolveVirtualServerName(dtcHostName, dtcResource, out virtualServer))
                        {
                            return(E_UNEXPECTED);
                        }

                        if (!Utilities.SafeCompare(dtcHostName, virtualServer))
                        {
                            //Remote cluster configuration is not supported
                            return(HRESULT.S_FALSE);
                        }
                    }
                    else
                    {
                        this.machineName = dtcHostName;
                    }
                }
            }

            int hr = 0;

            if (provider != null)
            {
                hr = provider.AddPage(handlePropSheetPage);
            }
            return(hr);
        }