Пример #1
0
        private void InitializeForMarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocolInformation = whereabouts.ProtocolInformation;

            if ((protocolInformation != null) && protocolInformation.NetworkOutboundAccess)
            {
                if (protocolInformation.IsV10Enabled)
                {
                    UriBuilder builder = new UriBuilder(Uri.UriSchemeHttps, protocolInformation.HostName, protocolInformation.HttpsPort, protocolInformation.BasePath + "/" + BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version10));
                    this.registrationServiceAddress10 = builder.Uri;
                }
                if (protocolInformation.IsV11Enabled)
                {
                    UriBuilder builder2 = new UriBuilder(Uri.UriSchemeHttps, protocolInformation.HostName, protocolInformation.HttpsPort, protocolInformation.BasePath + "/" + BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version11));
                    this.registrationServiceAddress11 = builder2.Uri;
                }
                this.issuedTokensEnabled = protocolInformation.IssuedTokensEnabled;
                this.maxTimeout          = protocolInformation.MaxTimeout;
            }
            else
            {
                UriBuilder builder3 = new UriBuilder(Uri.UriSchemeHttps, whereabouts.HostName, 0x1bb, DisabledRegistrationPath);
                this.registrationServiceAddress10 = builder3.Uri;
                this.registrationServiceAddress11 = builder3.Uri;
                this.issuedTokensEnabled          = false;
                this.maxTimeout = TimeSpan.FromMinutes(5.0);
            }
        }
Пример #2
0
        private EndpointAddress CreateActivationEndpointAddress(ProtocolInformationReader protocol, string suffix, string spnIdentity, bool isRemote)
        {
            string uriSchemeHttps;
            string hostName;
            int    httpsPort;
            string str3;

            if (isRemote)
            {
                uriSchemeHttps = Uri.UriSchemeHttps;
                hostName       = protocol.HostName;
                httpsPort      = protocol.HttpsPort;
                str3           = protocol.BasePath + "/" + suffix + "Remote/";
            }
            else
            {
                uriSchemeHttps = Uri.UriSchemeNetPipe;
                hostName       = "localhost";
                httpsPort      = -1;
                str3           = protocol.HostName + "/" + protocol.BasePath + "/" + suffix;
            }
            UriBuilder builder = new UriBuilder(uriSchemeHttps, hostName, httpsPort, str3);

            if (spnIdentity != null)
            {
                return(new EndpointAddress(builder.Uri, EndpointIdentity.CreateSpnIdentity(spnIdentity), new AddressHeader[0]));
            }
            return(new EndpointAddress(builder.Uri, new AddressHeader[0]));
        }
Пример #3
0
        private void ReadExtendedProtocol(MemoryStream mem, uint cbTmProtocolData)
        {
            Guid guid = SerializationUtils.ReadGuid(mem);

            if ((guid == PluggableProtocol10.ProtocolGuid) || (guid == PluggableProtocol11.ProtocolGuid))
            {
                this.protocolInfo = new ProtocolInformationReader(mem);
            }
            else
            {
                SerializationUtils.IncrementPosition(mem, (long)(cbTmProtocolData - 0x10));
            }
        }
Пример #4
0
        public WsatConfiguration()
        {
            WhereaboutsReader         whereabouts         = this.GetWhereabouts();
            ProtocolInformationReader protocolInformation = whereabouts.ProtocolInformation;

            if (protocolInformation != null)
            {
                this.protocolService10Enabled = protocolInformation.IsV10Enabled;
                this.protocolService11Enabled = protocolInformation.IsV11Enabled;
            }
            this.Initialize(whereabouts);
            this.oleTxUpgradeEnabled = ReadFlag(@"Software\Microsoft\WSAT\3.0", "OleTxUpgradeEnabled", true);
        }
Пример #5
0
        void InitializeForMarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;

            if (protocol != null && protocol.NetworkOutboundAccess)
            {
                // We can marshal outgoing transactions using a valid address
                if (protocol.IsV10Enabled)
                {
                    UriBuilder builder10 = new UriBuilder(Uri.UriSchemeHttps,
                                                          protocol.HostName,
                                                          protocol.HttpsPort,
                                                          protocol.BasePath + "/" +
                                                          BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version10));
                    this.registrationServiceAddress10 = builder10.Uri;
                }

                // when we have a WSAT1.1 coordinator
                if (protocol.IsV11Enabled)
                {
                    UriBuilder builder11 = new UriBuilder(Uri.UriSchemeHttps,
                                                          protocol.HostName,
                                                          protocol.HttpsPort,
                                                          protocol.BasePath + "/" +
                                                          BindingStrings.RegistrationCoordinatorSuffix(ProtocolVersion.Version11));

                    this.registrationServiceAddress11 = builder11.Uri;
                }

                this.issuedTokensEnabled = protocol.IssuedTokensEnabled;
                this.maxTimeout          = protocol.MaxTimeout;
            }
            else
            {
                // Generate an address that will not work
                // We do this in order to generate coordination contexts that can be propagated
                // between processes on the same node even if WS-AT is disabled
                UriBuilder builder = new UriBuilder(Uri.UriSchemeHttps,
                                                    whereabouts.HostName,
                                                    443,
                                                    DisabledRegistrationPath);

                this.registrationServiceAddress10 = builder.Uri;
                this.registrationServiceAddress11 = builder.Uri;
                this.issuedTokensEnabled          = false;
                this.maxTimeout = TimeSpan.FromMinutes(5);
            }
        }
Пример #6
0
        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.

        /*
         * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] // because we use ProtocolInformationReader, which is defined in a non-APTCA assembly; WSATs are not supported in partial trust, so customers should not be broken by this demand
         */
        void ReadExtendedProtocol(MemoryStream mem, uint cbTmProtocolData)
        {
            // Read the WSAT1.0 protoocol identifier
            Guid guid = SerializationUtils.ReadGuid(mem);

            if (guid == PluggableProtocol10.ProtocolGuid || guid == PluggableProtocol11.ProtocolGuid)
            {
                // This is the WS-AT extended whereabouts blob
                this.protocolInfo = new ProtocolInformationReader(mem);
            }
            else
            {
                // Some other gateway protocol... Skip the rest of the data
                SerializationUtils.IncrementPosition(mem, cbTmProtocolData - 16);
            }
        }
Пример #7
0
        public WsatConfiguration()
        {
            // Get whereabouts
            WhereaboutsReader whereabouts = GetWhereabouts();

            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;

            if (protocol != null)
            {
                this.protocolService10Enabled = protocol.IsV10Enabled;
                this.protocolService11Enabled = protocol.IsV11Enabled;
            }

            Initialize(whereabouts);

            // Read local registry flag
            this.oleTxUpgradeEnabled = ReadFlag(WsatKey, OleTxUpgradeEnabledValue, OleTxUpgradeEnabledDefault);
        }
Пример #8
0
        private void InitializeForUnmarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocolInformation = whereabouts.ProtocolInformation;

            if ((protocolInformation != null) && protocolInformation.NetworkInboundAccess)
            {
                string str;
                this.inboundEnabled = true;
                bool   flag   = string.Compare(Environment.MachineName, protocolInformation.NodeName, StringComparison.OrdinalIgnoreCase) == 0;
                string suffix = BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version10);
                string str3   = BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version11);
                if (protocolInformation.IsClustered || (protocolInformation.NetworkClientAccess && !flag))
                {
                    if (protocolInformation.IsClustered)
                    {
                        str = null;
                    }
                    else
                    {
                        str = "host/" + protocolInformation.HostName;
                    }
                    if (protocolInformation.IsV10Enabled)
                    {
                        this.remoteActivationService10 = this.CreateActivationEndpointAddress(protocolInformation, suffix, str, true);
                    }
                    if (protocolInformation.IsV11Enabled)
                    {
                        this.remoteActivationService11 = this.CreateActivationEndpointAddress(protocolInformation, str3, str, true);
                    }
                }
                if (flag)
                {
                    str = "host/" + protocolInformation.NodeName;
                    if (protocolInformation.IsV10Enabled)
                    {
                        this.localActivationService10 = this.CreateActivationEndpointAddress(protocolInformation, suffix, str, false);
                    }
                    if (protocolInformation.IsV11Enabled)
                    {
                        this.localActivationService11 = this.CreateActivationEndpointAddress(protocolInformation, str3, str, false);
                    }
                }
            }
        }
Пример #9
0
        EndpointAddress CreateActivationEndpointAddress(ProtocolInformationReader protocol,
                                                        string suffix,
                                                        string spnIdentity,
                                                        bool isRemote)
        {
            string uriScheme;
            string host;
            int    port;
            string path;

            if (isRemote)
            {
                uriScheme = Uri.UriSchemeHttps;
                host      = protocol.HostName;
                port      = protocol.HttpsPort;
                path      = protocol.BasePath + "/" + suffix + BindingStrings.RemoteProxySuffix;
            }
            else
            {
                uriScheme = Uri.UriSchemeNetPipe;
                host      = "localhost";
                port      = -1;
                path      = protocol.HostName + "/" + protocol.BasePath + "/" + suffix;
            }

            UriBuilder builder = new UriBuilder(uriScheme, host, port, path);

            if (spnIdentity != null)
            {
                EndpointIdentity identity = EndpointIdentity.CreateSpnIdentity(spnIdentity);
                return(new EndpointAddress(builder.Uri, identity));
            }
            else
            {
                return(new EndpointAddress(builder.Uri));
            }
        }
Пример #10
0
        void InitializeForUnmarshal(WhereaboutsReader whereabouts)
        {
            ProtocolInformationReader protocol = whereabouts.ProtocolInformation;

            if (protocol != null && protocol.NetworkInboundAccess)
            {
                this.inboundEnabled = true;

                bool isTmLocal = string.Compare(Environment.MachineName,
                                                protocol.NodeName,
                                                StringComparison.OrdinalIgnoreCase) == 0;

                string spnIdentity;

                string activationCoordinatorSuffix10 =
                    BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version10);

                string activationCoordinatorSuffix11 =
                    BindingStrings.ActivationCoordinatorSuffix(ProtocolVersion.Version11);

                if (protocol.IsClustered ||
                    (protocol.NetworkClientAccess && !isTmLocal))
                {
                    if (protocol.IsClustered)
                    {
                        // We cannot reliably perform mutual authentication against a clustered resource
                        // See MB 43523 for more details on this

                        spnIdentity = null;
                    }
                    else
                    {
                        spnIdentity = "host/" + protocol.HostName;
                    }

                    if (protocol.IsV10Enabled)
                    {
                        this.remoteActivationService10 = CreateActivationEndpointAddress(protocol,
                                                                                         activationCoordinatorSuffix10,
                                                                                         spnIdentity,
                                                                                         true);
                    }

                    if (protocol.IsV11Enabled)
                    {
                        this.remoteActivationService11 = CreateActivationEndpointAddress(protocol,
                                                                                         activationCoordinatorSuffix11,
                                                                                         spnIdentity,
                                                                                         true);
                    }
                }

                if (isTmLocal)
                {
                    spnIdentity = "host/" + protocol.NodeName;

                    // The net.pipe Activation endpoint uses the host name as a discriminant
                    // for cluster scenarios with more than one service on a node.
                    if (protocol.IsV10Enabled)
                    {
                        this.localActivationService10 = CreateActivationEndpointAddress(protocol,
                                                                                        activationCoordinatorSuffix10,
                                                                                        spnIdentity,
                                                                                        false);
                    }

                    if (protocol.IsV11Enabled)
                    {
                        this.localActivationService11 = CreateActivationEndpointAddress(protocol,
                                                                                        activationCoordinatorSuffix11,
                                                                                        spnIdentity,
                                                                                        false);
                    }
                }
            }
        }