Beispiel #1
0
        // Token: 0x0600014A RID: 330 RVA: 0x0000726C File Offset: 0x0000546C
        protected override ADRawEntry LoadADRawEntry()
        {
            ADRawEntry adrawEntry = null;
            ITenantRecipientSession tenantRecipientSession;

            if (this.TenantGuid != Guid.Empty)
            {
                tenantRecipientSession = DirectoryHelper.GetTenantRecipientSessionFromPuidAndTenantGuid(this.Puid, this.TenantGuid, base.RequestContext.Logger, base.RequestContext.LatencyTracker, false);
            }
            else
            {
                tenantRecipientSession = DirectoryHelper.GetTenantRecipientSessionFromPuidAndDomain(this.Puid, this.Domain, base.RequestContext.Logger, base.RequestContext.LatencyTracker, !string.IsNullOrEmpty(this.FallbackSmtp));
            }
            if (tenantRecipientSession != null)
            {
                adrawEntry = DirectoryHelper.InvokeAccountForest <ADRawEntry>(base.RequestContext.LatencyTracker, () => tenantRecipientSession.FindUniqueEntryByNetID(this.Puid, (this.TenantGuid == Guid.Empty) ? this.Domain : this.TenantGuid.ToString(), this.PropertySet, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\AnchorMailbox\\PuidAnchorMailbox.cs", 231, "LoadADRawEntry"), base.RequestContext.Logger, tenantRecipientSession);
            }
            if (adrawEntry == null && !string.IsNullOrEmpty(this.FallbackSmtp) && SmtpAddress.IsValidSmtpAddress(this.FallbackSmtp))
            {
                adrawEntry = new SmtpAnchorMailbox(this.FallbackSmtp, base.RequestContext)
                {
                    NotFoundExceptionCreator = null
                }.GetADRawEntry();
            }
            return(base.CheckForNullAndThrowIfApplicable <ADRawEntry>(adrawEntry));
        }
        // Token: 0x06000127 RID: 295 RVA: 0x00006B5C File Offset: 0x00004D5C
        protected override ADRawEntry LoadADRawEntry()
        {
            IRecipientSession session = null;

            if (!string.IsNullOrEmpty(this.Domain) && SmtpAddress.IsValidDomain(this.Domain))
            {
                try
                {
                    session = DirectoryHelper.GetRecipientSessionFromMailboxGuidAndDomain(this.MailboxGuid, this.Domain, base.RequestContext.Logger, base.RequestContext.LatencyTracker);
                    goto IL_98;
                }
                catch (CannotResolveTenantNameException)
                {
                    base.UpdateNegativeCache(new NegativeAnchorMailboxCacheEntry
                    {
                        ErrorCode    = HttpStatusCode.NotFound,
                        SubErrorCode = 3009,
                        SourceObject = this.ToCacheKey()
                    });
                    throw;
                }
            }
            session = DirectoryHelper.GetRootOrgRecipientSession();
IL_98:
            ADRawEntry adrawEntry;

            if (base.IsArchive != null)
            {
                adrawEntry = DirectoryHelper.InvokeAccountForest <ADRawEntry>(base.RequestContext.LatencyTracker, () => session.FindByExchangeGuidIncludingAlternate(this.MailboxGuid, this.PropertySet, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\AnchorMailbox\\MailboxGuidAnchorMailbox.cs", 170, "LoadADRawEntry"), base.RequestContext.Logger, session);
            }
            else
            {
                adrawEntry = DirectoryHelper.InvokeAccountForest <ADRawEntry>(base.RequestContext.LatencyTracker, () => session.FindByExchangeGuidIncludingAlternate(this.MailboxGuid, MailboxGuidAnchorMailbox.ADRawEntryWithArchivePropertySet, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\AnchorMailbox\\MailboxGuidAnchorMailbox.cs", 184, "LoadADRawEntry"), base.RequestContext.Logger, session);
                if (adrawEntry != null)
                {
                    Guid guid  = (Guid)adrawEntry[ADMailboxRecipientSchema.ArchiveGuid];
                    Guid guid2 = (Guid)adrawEntry[ADMailboxRecipientSchema.ExchangeGuid];
                    if (guid.Equals(this.MailboxGuid))
                    {
                        base.IsArchive = new bool?(true);
                    }
                    else if (!guid2.Equals(this.MailboxGuid))
                    {
                        adrawEntry = DirectoryHelper.InvokeAccountForest <ADRawEntry>(base.RequestContext.LatencyTracker, () => session.FindByExchangeGuidIncludingAlternate(this.MailboxGuid, MailboxGuidAnchorMailbox.ADRawEntryWithMailboxLocationsPropertySet, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\AnchorMailbox\\MailboxGuidAnchorMailbox.cs", 208, "LoadADRawEntry"), base.RequestContext.Logger, session);
                        this.isLocationsMailbox = true;
                    }
                }
            }
            if (adrawEntry == null && !string.IsNullOrEmpty(this.FallbackSmtp) && SmtpAddress.IsValidSmtpAddress(this.FallbackSmtp))
            {
                adrawEntry = new SmtpAnchorMailbox(this.FallbackSmtp, base.RequestContext)
                {
                    IsArchive = base.IsArchive,
                    NotFoundExceptionCreator = null
                }.GetADRawEntry();
            }
            return(base.CheckForNullAndThrowIfApplicable <ADRawEntry>(adrawEntry));
        }
        // Token: 0x0600049D RID: 1181 RVA: 0x000197C4 File Offset: 0x000179C4
        private bool TryMatchBySmtpAddress(AnonymousPublishingUrl publishingUrl, out AnchorMailbox anchorMailbox)
        {
            anchorMailbox = null;
            string text = publishingUrl.ParameterSegments[0];

            if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text))
            {
                base.Logger.Set(3, "AnonymousPublishingUrl-SMTP");
                anchorMailbox = new SmtpAnchorMailbox(text, this);
            }
            return(anchorMailbox != null);
        }
Beispiel #4
0
        protected override ADRawEntry LoadADRawEntry()
        {
            IRecipientSession session = null;

            if (!string.IsNullOrEmpty(this.Domain) && SmtpAddress.IsValidDomain(this.Domain))
            {
                try
                {
                    session = DirectoryHelper.GetRecipientSessionFromDomain(base.RequestContext.LatencyTracker, this.Domain, false);
                    goto IL_95;
                }
                catch (CannotResolveTenantNameException)
                {
                    base.UpdateNegativeCache(new NegativeAnchorMailboxCacheEntry
                    {
                        ErrorCode    = HttpStatusCode.NotFound,
                        SubErrorCode = HttpProxySubErrorCode.DomainNotFound,
                        SourceObject = this.ToCacheKey()
                    });
                    throw;
                }
            }
            session = DirectoryHelper.GetRootOrgRecipientSession();
IL_95:
            ADRawEntry adrawEntry;

            if (base.IsArchive != null)
            {
                adrawEntry = DirectoryHelper.InvokeAccountForest(base.RequestContext.LatencyTracker, () => session.FindByExchangeGuidIncludingAlternate(this.MailboxGuid, this.PropertySet));
            }
            else
            {
                adrawEntry = DirectoryHelper.InvokeAccountForest(base.RequestContext.LatencyTracker, () => session.FindByExchangeGuidIncludingAlternate(this.MailboxGuid, MailboxGuidAnchorMailbox.ADRawEntryWithArchivePropertySet));
                if (adrawEntry != null && ((Guid)adrawEntry[ADUserSchema.ArchiveGuid]).Equals(this.MailboxGuid))
                {
                    base.IsArchive = new bool?(true);
                }
            }
            if (adrawEntry == null && !string.IsNullOrEmpty(this.FallbackSmtp) && SmtpAddress.IsValidSmtpAddress(this.FallbackSmtp))
            {
                adrawEntry = new SmtpAnchorMailbox(this.FallbackSmtp, base.RequestContext)
                {
                    IsArchive = base.IsArchive,
                    NotFoundExceptionCreator = null
                }.GetADRawEntry();
            }
            return(base.CheckForNullAndThrowIfApplicable <ADRawEntry>(adrawEntry));
        }
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (this.skipTargetBackEndCalculation)
            {
                base.Logger.Set(HttpProxyMetadata.RoutingHint, "OrgRelationship-Anonymous");
                return(new AnonymousAnchorMailbox(this));
            }
            string text;

            if (ProtocolHelper.IsAutodiscoverV2PreviewRequest(base.ClientRequest.Url.AbsolutePath))
            {
                text = base.ClientRequest.Params["Email"];
            }
            else if (ProtocolHelper.IsAutodiscoverV2Version1Request(base.ClientRequest.Url.AbsolutePath))
            {
                int num = base.ClientRequest.Url.AbsolutePath.LastIndexOf('/');
                text = base.ClientRequest.Url.AbsolutePath.Substring(num + 1);
            }
            else
            {
                text = this.TryGetExplicitLogonNode(ExplicitLogonNode.Second);
            }
            string text2;

            if (ProtocolHelper.TryGetValidNormalizedExplicitLogonAddress(text, out text2))
            {
                this.isExplicitLogonRequest = true;
                this.explicitLogonAddress   = text;
                base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP");
                SmtpAnchorMailbox smtpAnchorMailbox = new SmtpAnchorMailbox(text2, this);
                if (this.preferAnchorMailboxHeader)
                {
                    string text3 = base.ClientRequest.Headers[Constants.AnchorMailboxHeaderName];
                    if (!string.IsNullOrEmpty(text3) && !StringComparer.OrdinalIgnoreCase.Equals(text3, text2) && SmtpAddress.IsValidSmtpAddress(text3))
                    {
                        base.Logger.Set(HttpProxyMetadata.RoutingHint, "AnchorMailboxHeader-SMTP");
                        smtpAnchorMailbox = new SmtpAnchorMailbox(text3, this);
                    }
                }
                if (ProtocolHelper.IsAutodiscoverV2Request(base.ClientRequest.Url.AbsolutePath))
                {
                    smtpAnchorMailbox.FailOnDomainNotFound = false;
                }
                return(smtpAnchorMailbox);
            }
            return(base.ResolveAnchorMailbox());
        }
        private string ResolveUserAddress(AnchorMailbox anchorMailbox)
        {
            SidAnchorMailbox sidAnchorMailbox = anchorMailbox as SidAnchorMailbox;

            if (sidAnchorMailbox != null && !string.IsNullOrEmpty(sidAnchorMailbox.SmtpOrLiveId))
            {
                return(sidAnchorMailbox.SmtpOrLiveId);
            }
            SmtpAnchorMailbox smtpAnchorMailbox = anchorMailbox as SmtpAnchorMailbox;

            if (smtpAnchorMailbox != null)
            {
                return(smtpAnchorMailbox.Smtp);
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = (UserBasedAnchorMailbox)anchorMailbox;

            return(string.Format("anyone@{0}", userBasedAnchorMailbox.GetDomainName()));
        }
Beispiel #7
0
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            string text = base.ClientRequest.QueryString[Constants.AnchorMailboxHeaderName];

            if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text))
            {
                SmtpAnchorMailbox smtpAnchorMailbox = new SmtpAnchorMailbox(text, this);
                string            value             = "AnchorMailboxQuery-SMTP";
                if (!base.ClientRequest.GetHttpRequestBase().IsProxyTestProbeRequest())
                {
                    smtpAnchorMailbox.IsArchive = new bool?(true);
                    value = "AnchorMailboxQuery-Archive-SMTP";
                }
                base.Logger.Set(HttpProxyMetadata.RoutingHint, value);
                return(smtpAnchorMailbox);
            }
            return(new OrganizationAnchorMailbox(OrganizationId.ForestWideOrgId, this));
        }
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            string text = base.HttpContext.Items["destination"] as string;
            Uri    uri;

            if (!Uri.TryCreate(text, UriKind.Absolute, out uri))
            {
                throw new HttpException(400, "destination value is not valid");
            }
            string text2 = null;
            bool   flag2;
            string text3;
            bool   flag = FbaFormPostProxyRequestHandler.IsExplicitLogon(HttpRuntime.AppDomainAppVirtualPath, uri.PathAndQuery, uri.OriginalString, out flag2, out text2, out text3);

            if (flag)
            {
                this.explicitLogonUser = text2;
            }
            AnchorMailbox anchorMailbox;

            if (!string.IsNullOrEmpty(this.explicitLogonUser))
            {
                anchorMailbox = new SmtpAnchorMailbox(this.explicitLogonUser, this);
            }
            else
            {
                anchorMailbox = AnchorMailboxFactory.CreateFromCaller(this);
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;

            if (userBasedAnchorMailbox != null)
            {
                if (UrlUtilities.IsEacUrl(text))
                {
                    userBasedAnchorMailbox.CacheKeyPostfix = "_EAC";
                }
                else
                {
                    userBasedAnchorMailbox.MissingDatabaseHandler = new Func <ADRawEntry, ADObjectId>(base.ResolveMailboxDatabase);
                }
            }
            return(anchorMailbox);
        }
 protected override AnchorMailbox ResolveAnchorMailbox()
 {
     if (AutodiscoverProxyRequestHandler.LoadBalancedPartnerRouting.Value && base.ClientRequest.Url.AbsolutePath.ToLower().Contains("/wssecurity/x509cert"))
     {
         string text  = base.ClientRequest.Headers[Constants.AnchorMailboxHeaderName];
         string text2 = null;
         if (string.IsNullOrEmpty(text))
         {
             AnchorMailbox anchorMailbox = base.TryGetAnchorMailboxFromWsSecurityRequest();
             if (anchorMailbox != null)
             {
                 SmtpAnchorMailbox smtpAnchorMailbox = anchorMailbox as SmtpAnchorMailbox;
                 if (smtpAnchorMailbox != null)
                 {
                     text2 = smtpAnchorMailbox.Smtp;
                 }
                 else
                 {
                     DomainAnchorMailbox domainAnchorMailbox = anchorMailbox as DomainAnchorMailbox;
                     if (domainAnchorMailbox != null)
                     {
                         text2 = domainAnchorMailbox.Domain;
                     }
                 }
             }
         }
         else
         {
             text2 = text;
         }
         if (!string.IsNullOrEmpty(text2))
         {
             bool flag = text2.EndsWith(AutodiscoverProxyRequestHandler.BlackBerryTenantName.Value, StringComparison.OrdinalIgnoreCase);
             if (flag)
             {
                 base.Logger.SafeSet(HttpProxyMetadata.RoutingHint, "PartnerX509Request");
                 return(new TargetForestAnchorMailbox(this, AutodiscoverProxyRequestHandler.BlackBerryTenantName.Value, false));
             }
         }
     }
     return(base.ResolveAnchorMailbox());
 }
 // Token: 0x060005AA RID: 1450 RVA: 0x0001F7D8 File Offset: 0x0001D9D8
 private void OnProxyLogonResponseReady(object extraData)
 {
     base.CallThreadEntranceMethod(delegate
     {
         IAsyncResult asyncResult = extraData as IAsyncResult;
         object lockObject        = this.LockObject;
         lock (lockObject)
         {
             try
             {
                 GuardedProxyExecution.Default.Decrement(this.AnchoredRoutingTarget.BackEndServer);
                 this.proxyLogonResponse = (HttpWebResponse)this.proxyLogonRequest.EndGetResponse(asyncResult);
                 this.PfdTracer.TraceResponse("ProxyLogonResponse", this.proxyLogonResponse);
                 this.proxyLogonResponseCookies = this.proxyLogonResponse.Cookies;
                 this.proxyLogonResponse.Close();
                 this.proxyLogonResponse             = null;
                 UserContextCookie userContextCookie = this.TryGetUserContextFromProxyLogonResponse();
                 if (userContextCookie != null && userContextCookie.MailboxUniqueKey != null)
                 {
                     string mailboxUniqueKey = userContextCookie.MailboxUniqueKey;
                     if (SmtpAddress.IsValidSmtpAddress(mailboxUniqueKey))
                     {
                         AnchorMailbox anchorMailbox = new SmtpAnchorMailbox(ProxyAddress.Parse("SMTP", mailboxUniqueKey).AddressString, this);
                         this.AnchoredRoutingTarget  = new AnchoredRoutingTarget(anchorMailbox, this.AnchoredRoutingTarget.BackEndServer);
                     }
                     else
                     {
                         try
                         {
                             AnchorMailbox anchorMailbox2 = new SidAnchorMailbox(new SecurityIdentifier(mailboxUniqueKey), this);
                             this.AnchoredRoutingTarget   = new AnchoredRoutingTarget(anchorMailbox2, this.AnchoredRoutingTarget.BackEndServer);
                         }
                         catch (ArgumentException)
                         {
                         }
                     }
                 }
                 ThreadPool.QueueUserWorkItem(new WaitCallback(this.BeginProxyRequest));
                 this.State = ProxyRequestHandler.ProxyState.PrepareServerRequest;
             }
             catch (WebException ex)
             {
                 if (ex.Status == WebExceptionStatus.ProtocolError && ((HttpWebResponse)ex.Response).StatusCode == (HttpStatusCode)442)
                 {
                     this.RedirectOn442Response();
                 }
                 else
                 {
                     this.CompleteWithError(ex, "[OwaEcpProxyRequestHandler::OnProxyLogonResponseReady]");
                 }
             }
             catch (HttpException ex2)
             {
                 this.CompleteWithError(ex2, "[OwaEcpProxyRequestHandler::OnProxyLogonResponseReady]");
             }
             catch (IOException ex3)
             {
                 this.CompleteWithError(ex3, "[OwaEcpProxyRequestHandler::OnProxyLogonResponseReady]");
             }
             catch (HttpProxyException ex4)
             {
                 this.CompleteWithError(ex4, "[OwaEcpProxyRequestHandler::OnProxyLogonResponseReady]");
             }
         }
     });
 }
Beispiel #11
0
        private AnchorMailbox LegacyResolveAnchorMailbox()
        {
            AnchorMailbox anchorMailbox = null;

            if (base.UseRoutingHintForAnchorMailbox)
            {
                string text = base.ClientRequest.Headers["X-OWA-ExplicitLogonUser"];
                if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text))
                {
                    base.IsExplicitSignOn      = true;
                    base.ExplicitSignOnAddress = text;
                    base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP-Header");
                    anchorMailbox = new SmtpAnchorMailbox(text, this);
                }
                else
                {
                    text = this.TryGetExplicitLogonNode(ExplicitLogonNode.Second);
                    if (!string.IsNullOrEmpty(text))
                    {
                        if (SmtpAddress.IsValidSmtpAddress(text))
                        {
                            base.IsExplicitSignOn      = true;
                            base.ExplicitSignOnAddress = text;
                            base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP");
                            anchorMailbox = new SmtpAnchorMailbox(text, this);
                        }
                        else if ((Utilities.IsPartnerHostedOnly || VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.ExplicitDomain.Enabled) && SmtpAddress.IsValidDomain(text))
                        {
                            string domain = text;
                            text = this.TryGetExplicitLogonNode(ExplicitLogonNode.Third);
                            if (text == null)
                            {
                                base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-Domain");
                                anchorMailbox = new DomainAnchorMailbox(domain, this);
                            }
                            else
                            {
                                base.IsExplicitSignOn      = true;
                                base.ExplicitSignOnAddress = text;
                                base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP");
                                anchorMailbox = new SmtpAnchorMailbox(text, this);
                            }
                        }
                    }
                }
            }
            if (anchorMailbox == null)
            {
                anchorMailbox = base.ResolveAnchorMailbox();
            }
            else
            {
                base.IsAnchorMailboxFromRoutingHint         = true;
                this.originalAnchorMailboxFromExplicitLogon = anchorMailbox;
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;

            if (userBasedAnchorMailbox != null)
            {
                userBasedAnchorMailbox.MissingDatabaseHandler = new Func <ADRawEntry, ADObjectId>(this.ResolveMailboxDatabase);
            }
            return(anchorMailbox);
        }
Beispiel #12
0
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (base.AuthBehavior.IsFullyAuthenticated())
            {
                return(this.LegacyResolveAnchorMailbox());
            }
            base.HasPreemptivelyCheckedForRoutingHint = true;
            string        text = base.HttpContext.Request.Headers["X-UpnAnchorMailbox"];
            AnchorMailbox anchorMailbox;

            if (string.IsNullOrWhiteSpace(text))
            {
                anchorMailbox = base.CreateAnchorMailboxFromRoutingHint();
            }
            else
            {
                base.Logger.SafeSet(HttpProxyMetadata.RoutingHint, "OwaEcpUpn");
                anchorMailbox = new LiveIdMemberNameAnchorMailbox(text, null, this);
            }
            string text2 = base.ClientRequest.Headers["X-OWA-ExplicitLogonUser"];

            if (anchorMailbox == null)
            {
                if (base.UseRoutingHintForAnchorMailbox)
                {
                    if (!string.IsNullOrEmpty(text2) && SmtpAddress.IsValidSmtpAddress(text2))
                    {
                        base.IsExplicitSignOn      = true;
                        base.ExplicitSignOnAddress = text2;
                        base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP-Header");
                        anchorMailbox = new SmtpAnchorMailbox(text2, this);
                    }
                    else
                    {
                        text2 = this.TryGetExplicitLogonNode(ExplicitLogonNode.Second);
                        if (!string.IsNullOrEmpty(text2))
                        {
                            if (SmtpAddress.IsValidSmtpAddress(text2))
                            {
                                base.IsExplicitSignOn      = true;
                                base.ExplicitSignOnAddress = text2;
                                base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP");
                                anchorMailbox = new SmtpAnchorMailbox(text2, this);
                            }
                            else if ((Utilities.IsPartnerHostedOnly || VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.ExplicitDomain.Enabled) && SmtpAddress.IsValidDomain(text2))
                            {
                                text2 = this.TryGetExplicitLogonNode(ExplicitLogonNode.Third);
                                if (text2 != null)
                                {
                                    base.IsExplicitSignOn      = true;
                                    base.ExplicitSignOnAddress = text2;
                                    base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP");
                                    anchorMailbox = new SmtpAnchorMailbox(text2, this);
                                }
                            }
                        }
                    }
                }
                if (anchorMailbox == null)
                {
                    anchorMailbox = base.ResolveAnchorMailbox();
                }
                else
                {
                    base.IsAnchorMailboxFromRoutingHint         = true;
                    this.originalAnchorMailboxFromExplicitLogon = anchorMailbox;
                }
            }
            else if (!string.IsNullOrWhiteSpace(text2))
            {
                if (!string.Equals(anchorMailbox.SourceObject.ToString(), text2, StringComparison.InvariantCultureIgnoreCase))
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(base.Logger, "ExplicitLogonMismatch", string.Format("{0}~{1}", anchorMailbox.SourceObject, text2));
                }
                this.originalAnchorMailboxFromExplicitLogon = anchorMailbox;
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;

            if (userBasedAnchorMailbox != null)
            {
                userBasedAnchorMailbox.MissingDatabaseHandler = new Func <ADRawEntry, ADObjectId>(this.ResolveMailboxDatabase);
            }
            return(anchorMailbox);
        }
        // Token: 0x060005D4 RID: 1492 RVA: 0x0002073C File Offset: 0x0001E93C
        private AnchorMailbox LegacyResolveAnchorMailbox()
        {
            AnchorMailbox anchorMailbox = null;

            if (base.UseRoutingHintForAnchorMailbox)
            {
                string text;
                if (RequestHeaderParser.TryGetExplicitLogonSmtp(base.ClientRequest.Headers, ref text))
                {
                    base.IsExplicitSignOn      = true;
                    base.ExplicitSignOnAddress = text;
                    base.Logger.Set(3, "ExplicitLogon-SMTP-Header");
                    anchorMailbox = new SmtpAnchorMailbox(text, this);
                }
                else
                {
                    text = this.TryGetExplicitLogonNode(0);
                    if (!string.IsNullOrEmpty(text))
                    {
                        if (SmtpAddress.IsValidSmtpAddress(text))
                        {
                            base.IsExplicitSignOn      = true;
                            base.ExplicitSignOnAddress = text;
                            base.Logger.Set(3, "ExplicitLogon-SMTP");
                            anchorMailbox = new SmtpAnchorMailbox(text, this);
                        }
                        else if ((Utilities.IsPartnerHostedOnly || CafeConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).ExplicitDomain.Enabled) && SmtpAddress.IsValidDomain(text))
                        {
                            string domain = text;
                            text = this.TryGetExplicitLogonNode(1);
                            if (text == null)
                            {
                                base.Logger.Set(3, "ExplicitLogon-Domain");
                                anchorMailbox = new DomainAnchorMailbox(domain, this);
                            }
                            else if (SmtpAddress.IsValidSmtpAddress(text))
                            {
                                base.IsExplicitSignOn      = true;
                                base.ExplicitSignOnAddress = text;
                                base.Logger.Set(3, "ExplicitLogon-SMTP");
                                anchorMailbox = new SmtpAnchorMailbox(text, this);
                            }
                        }
                    }
                }
            }
            if (anchorMailbox == null)
            {
                anchorMailbox = base.ResolveAnchorMailbox();
            }
            else
            {
                base.IsAnchorMailboxFromRoutingHint         = true;
                this.originalAnchorMailboxFromExplicitLogon = anchorMailbox;
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;

            if (userBasedAnchorMailbox != null)
            {
                userBasedAnchorMailbox.MissingDatabaseHandler = new Func <ADRawEntry, ADObjectId>(this.ResolveMailboxDatabase);
            }
            return(anchorMailbox);
        }
        // Token: 0x060005CA RID: 1482 RVA: 0x000200D0 File Offset: 0x0001E2D0
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (base.AuthBehavior.IsFullyAuthenticated())
            {
                return(this.LegacyResolveAnchorMailbox());
            }
            base.HasPreemptivelyCheckedForRoutingHint = true;
            string        liveIdMemberName;
            AnchorMailbox anchorMailbox;

            if (!RequestHeaderParser.TryGetAnchorMailboxUpn(base.ClientRequest.Headers, ref liveIdMemberName))
            {
                anchorMailbox = base.CreateAnchorMailboxFromRoutingHint();
            }
            else
            {
                base.Logger.SafeSet(3, "OwaEcpUpn");
                anchorMailbox = new LiveIdMemberNameAnchorMailbox(liveIdMemberName, null, this);
            }
            string text;

            RequestHeaderParser.TryGetExplicitLogonSmtp(base.ClientRequest.Headers, ref text);
            if (anchorMailbox == null)
            {
                if (base.UseRoutingHintForAnchorMailbox)
                {
                    if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text))
                    {
                        base.IsExplicitSignOn      = true;
                        base.ExplicitSignOnAddress = text;
                        base.Logger.Set(3, "ExplicitLogon-SMTP-Header");
                        anchorMailbox = new SmtpAnchorMailbox(text, this);
                    }
                    else
                    {
                        text = this.TryGetExplicitLogonNode(0);
                        if (!string.IsNullOrEmpty(text))
                        {
                            if (SmtpAddress.IsValidSmtpAddress(text))
                            {
                                base.IsExplicitSignOn      = true;
                                base.ExplicitSignOnAddress = text;
                                base.Logger.Set(3, "ExplicitLogon-SMTP");
                                anchorMailbox = new SmtpAnchorMailbox(text, this);
                            }
                            else if ((Utilities.IsPartnerHostedOnly || CafeConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).ExplicitDomain.Enabled) && SmtpAddress.IsValidDomain(text))
                            {
                                text = this.TryGetExplicitLogonNode(1);
                                if (text != null)
                                {
                                    base.IsExplicitSignOn      = true;
                                    base.ExplicitSignOnAddress = text;
                                    base.Logger.Set(3, "ExplicitLogon-SMTP");
                                    anchorMailbox = new SmtpAnchorMailbox(text, this);
                                }
                            }
                        }
                    }
                }
                if (anchorMailbox == null)
                {
                    anchorMailbox = base.ResolveAnchorMailbox();
                }
                else
                {
                    base.IsAnchorMailboxFromRoutingHint         = true;
                    this.originalAnchorMailboxFromExplicitLogon = anchorMailbox;
                }
            }
            else if (!string.IsNullOrWhiteSpace(text))
            {
                if (!string.Equals(anchorMailbox.SourceObject.ToString(), text, StringComparison.InvariantCultureIgnoreCase))
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(base.Logger, "ExplicitLogonMismatch", string.Format("{0}~{1}", anchorMailbox.SourceObject, text));
                }
                this.originalAnchorMailboxFromExplicitLogon = anchorMailbox;
            }
            UserBasedAnchorMailbox userBasedAnchorMailbox = anchorMailbox as UserBasedAnchorMailbox;

            if (userBasedAnchorMailbox != null)
            {
                userBasedAnchorMailbox.MissingDatabaseHandler = new Func <ADRawEntry, ADObjectId>(this.ResolveMailboxDatabase);
            }
            return(anchorMailbox);
        }