Ejemplo n.º 1
0
        // Token: 0x0600056A RID: 1386 RVA: 0x0001E388 File Offset: 0x0001C588
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            string text;

            if (RequestQueryStringParser.TryGetMailboxId(base.ClientRequest.QueryString, ref text))
            {
                base.Logger.Set(3, "MailboxGuidWithDomain");
                return(this.GetAnchorMailboxFromMailboxId(text));
            }
            if (RequestQueryStringParser.TryGetSmtpAddress(base.ClientRequest.QueryString, ref text))
            {
                base.Logger.Set(3, "SMTP");
                return(this.GetAnchorMailboxFromSmtpAddress(text));
            }
            bool flag = false;

            if (RequestQueryStringParser.TryGetUseMailboxOfAuthenticatedUser(base.ClientRequest.QueryString, ref text) && bool.TryParse(text, out flag) && flag)
            {
                return(base.ResolveAnchorMailbox());
            }
            if (string.Compare(base.ClientRequest.RequestType, "GET", true) == 0)
            {
                return(base.ResolveAnchorMailbox());
            }
            throw new HttpProxyException(HttpStatusCode.BadRequest, 3003, "No target mailbox specified.");
        }
        // Token: 0x06000547 RID: 1351 RVA: 0x0001D220 File Offset: 0x0001B420
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            string smtp;

            if (base.UseRoutingHintForAnchorMailbox && RequestQueryStringParser.TryGetExplicitLogonSmtp(base.ClientRequest.QueryString, ref smtp))
            {
                if (HttpProxySettings.NoMailboxFallbackRoutingEnabled.Value)
                {
                    base.IsAnchorMailboxFromRoutingHint = true;
                }
                base.Logger.Set(3, "ExplicitLogon-SMTP");
                return(new SmtpAnchorMailbox(smtp, this));
            }
            return(base.ResolveAnchorMailbox());
        }
        // Token: 0x0600070D RID: 1805 RVA: 0x000296EC File Offset: 0x000278EC
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            UriBuilder uriBuilder = new UriBuilder(base.ClientRequest.Url);

            if (string.IsNullOrEmpty(base.ClientRequest.Url.Query))
            {
                throw new HttpProxyException(HttpStatusCode.NotFound, 3001, "No proxy destination is specified!");
            }
            RpcHttpQueryString rpcHttpQueryString = new RpcHttpQueryString(uriBuilder.Query);

            this.rpcServerTarget = rpcHttpQueryString.RcaServer;
            if (SmtpAddress.IsValidSmtpAddress(this.rpcServerTarget))
            {
                string text;
                HttpContextItemParser.TryGetLiveIdMemberName(base.HttpContext.Items, ref text);
                Guid   guid;
                string domain;
                string text2;
                if (RequestQueryStringParser.TryGetMailboxGuid(this.rpcServerTarget, text, ref guid, ref domain, ref text2))
                {
                    MailboxGuidAnchorMailbox result;
                    if (!string.IsNullOrEmpty(text2))
                    {
                        this.rpcServerTarget = ExchangeRpcClientAccess.CreatePersonalizedServer(guid, text2);
                        base.Logger.AppendString(3, "MailboxGuidWithDomain-ChangedToUserDomain");
                        result = new MailboxGuidAnchorMailbox(guid, text2, this);
                    }
                    else
                    {
                        base.Logger.AppendString(3, "MailboxGuidWithDomain");
                        result = new MailboxGuidAnchorMailbox(guid, domain, this);
                    }
                    this.updateRpcServer = true;
                    return(result);
                }
                return(this.ResolveToDefaultAnchorMailbox(this.rpcServerTarget, "InvalidFormat"));
            }
            else
            {
                ProxyDestination proxyDestination;
                if (RpcHttpProxyRules.Instance.TryGetProxyDestination(this.rpcServerTarget, out proxyDestination))
                {
                    string text3 = proxyDestination.GetHostName(this.GetKeyForCasAffinity());
                    if (proxyDestination.IsDynamicTarget)
                    {
                        try
                        {
                            text3 = DownLevelServerManager.Instance.GetDownLevelClientAccessServerWithPreferredServer <RpcHttpService>(new ServerInfoAnchorMailbox(text3, this), text3, 1, base.Logger, proxyDestination.Version).Fqdn;
                        }
                        catch (NoAvailableDownLevelBackEndException)
                        {
                            throw new HttpProxyException(HttpStatusCode.NotFound, 3001, string.Format("Cannot find a healthy E12 or E14 CAS to proxy to: {0}", this.rpcServerTarget));
                        }
                    }
                    uriBuilder.Host   = text3;
                    uriBuilder.Port   = proxyDestination.Port;
                    uriBuilder.Scheme = Uri.UriSchemeHttps;
                    base.Logger.Set(3, "RpcHttpProxyRules");
                    this.updateRpcServer = false;
                    return(new UrlAnchorMailbox(uriBuilder.Uri, this));
                }
                return(this.ResolveToDefaultAnchorMailbox(this.rpcServerTarget, "UnknownServerName"));
            }
        }