Exemplo n.º 1
0
        // Token: 0x06000088 RID: 136 RVA: 0x000045C4 File Offset: 0x000027C4
        public static bool DoesEmailAddressReferenceArchive(ADRecipient recipient, string emailAddress)
        {
            bool result = false;
            Guid g;

            if (AutodiscoverCommonUserSettings.TryGetExchangeGuidFromEmailAddress(emailAddress, out g) && (recipient.RecipientType == RecipientType.MailUser || recipient.RecipientType == RecipientType.UserMailbox))
            {
                ADUser aduser = (ADUser)recipient;
                if (aduser.ArchiveGuid.Equals(g))
                {
                    result = true;
                }
            }
            return(result);
        }
        internal static Dictionary <string, string> CreateTestOutlookConnectivityPropertyBag(ADUser mailboxAdUser, bool isPasswordAuthenticated, bool isCtpTest, PSCredential mailboxCredential, ADUser adUserCorrespondingToMailboxCredential, string endpoint)
        {
            Dictionary <string, string>    dictionary  = new Dictionary <string, string>();
            Dictionary <string, string>    dictionary2 = new Dictionary <string, string>(0);
            AutodiscoverCommonUserSettings autodiscoverCommonUserSettings = null;

            if (mailboxAdUser != null)
            {
                TestOutlookConnectivity.AddToPropertyBag(dictionary2, "MailboxLegacyDN", mailboxAdUser.LegacyExchangeDN);
                autodiscoverCommonUserSettings = AutodiscoverCommonUserSettings.GetSettingsFromRecipient(mailboxAdUser, mailboxAdUser.PrimarySmtpAddress.ToString());
                TestOutlookConnectivity.AddToPropertyBag(dictionary2, "PersonalizedServerName", string.Format("{0}@{1}", autodiscoverCommonUserSettings.MailboxGuid, autodiscoverCommonUserSettings.PrimarySmtpAddress.Domain));
                if (!TestOutlookConnectivity.IsMailboxCredentialEmpty(mailboxCredential))
                {
                    if (adUserCorrespondingToMailboxCredential == null)
                    {
                        throw new ArgumentException("This should never happen.  If mailboxCredential is passed in, then adUserCorrespondingToMailboxCredential should match.");
                    }
                    TestOutlookConnectivity.AddToPropertyBag(dictionary, "Account", TestOutlookConnectivity.GetAccountLoginName(adUserCorrespondingToMailboxCredential));
                    TestOutlookConnectivity.AddToPropertyBag(dictionary2, "AccountLegacyDN", adUserCorrespondingToMailboxCredential.LegacyExchangeDN);
                    if (isPasswordAuthenticated)
                    {
                        string value = TestOutlookConnectivity.ConvertSecureStringToPlainString(mailboxCredential.Password);
                        TestOutlookConnectivity.AddToPropertyBag(dictionary, "Password", value);
                    }
                }
            }
            TestOutlookConnectivity.AddToPropertyBag(dictionary, "Endpoint", endpoint);
            if (!isCtpTest)
            {
                TestOutlookConnectivity.AddToPropertyBag(dictionary, "SecondaryEndpoint", endpoint);
            }
            if (autodiscoverCommonUserSettings != null && !string.IsNullOrEmpty(autodiscoverCommonUserSettings.RpcServer) && isCtpTest)
            {
                TestOutlookConnectivity.AddToPropertyBag(dictionary, "SecondaryEndpoint", autodiscoverCommonUserSettings.RpcServer);
            }
            TestOutlookConnectivity.AddToPropertyBag(dictionary, "ItemTargetExtension", WorkDefinition.SerializeExtensionAttributes(dictionary2));
            return(dictionary);
        }
Exemplo n.º 3
0
        protected void ResolveRequestedADRecipient()
        {
            string resolveMethod = "Unknown";

            try
            {
                if (this.Caller != null)
                {
                    if (!string.IsNullOrEmpty(this.RequestData.LegacyDN) && string.Equals(this.Caller.LegacyExchangeDN, this.RequestData.LegacyDN, StringComparison.OrdinalIgnoreCase))
                    {
                        this.RequestedRecipient = this.Caller;
                        resolveMethod           = "CallerByLegacyDN";
                        return;
                    }
                    if (!string.IsNullOrEmpty(this.RequestData.LegacyDN) && this.Caller.EmailAddresses != null)
                    {
                        string       x500 = "x500:" + this.RequestData.LegacyDN;
                        ProxyAddress a    = this.Caller.EmailAddresses.Find((ProxyAddress x) => string.Equals(x.ToString(), x500, StringComparison.OrdinalIgnoreCase));
                        if (a != null)
                        {
                            this.RequestedRecipient = this.Caller;
                            resolveMethod           = "CallerByX500";
                            return;
                        }
                    }
                    if (!string.IsNullOrEmpty(this.RequestData.EMailAddress) && SmtpAddress.IsValidSmtpAddress(this.RequestData.EMailAddress))
                    {
                        SmtpProxyAddress smtpProxy = new SmtpProxyAddress(this.RequestData.EMailAddress, true);
                        ProxyAddress     a2        = this.Caller.EmailAddresses.Find((ProxyAddress x) => x.Equals(smtpProxy));
                        if (a2 != null)
                        {
                            this.RequestedRecipient = this.Caller;
                            resolveMethod           = "CallerByProxy";
                            return;
                        }
                    }
                    if (AutodiscoverCommonUserSettings.HasLocalArchive(this.Caller) && AutodiscoverCommonUserSettings.IsEmailAddressTargetingArchive(this.Caller as ADUser, this.RequestData.EMailAddress))
                    {
                        this.RequestedRecipient = this.Caller;
                        resolveMethod           = "CallerByArchive";
                        return;
                    }
                }
                if (this.Caller == null)
                {
                    if (VariantConfiguration.InvariantNoFlightingSnapshot.Autodiscover.NoADLookupForUser.Enabled)
                    {
                        goto IL_285;
                    }
                }
                try
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .Current.TrackLatency(ServiceLatencyMetadata.RequestedUserADLatency, delegate()
                    {
                        IRecipientSession callerScopedRecipientSession = this.GetCallerScopedRecipientSession();
                        if (!string.IsNullOrEmpty(this.RequestData.LegacyDN))
                        {
                            this.RequestedRecipient = callerScopedRecipientSession.FindByLegacyExchangeDN(this.RequestData.LegacyDN);
                            if (this.RequestedRecipient != null)
                            {
                                resolveMethod = "FoundByLegacyDN";
                            }
                        }
                        if (this.RequestedRecipient == null && this.RequestData.EMailAddress != null && SmtpAddress.IsValidSmtpAddress(this.RequestData.EMailAddress))
                        {
                            Guid guid;
                            if (AutodiscoverCommonUserSettings.TryGetExchangeGuidFromEmailAddress(this.RequestData.EMailAddress, out guid))
                            {
                                this.RequestedRecipient = callerScopedRecipientSession.FindByExchangeGuidIncludingArchive(guid);
                                ADUser aduser           = this.RequestedRecipient as ADUser;
                                if (aduser != null && aduser.ArchiveGuid.Equals(guid) && RemoteMailbox.IsRemoteMailbox(aduser.RecipientTypeDetails) && aduser.ArchiveDatabase == null)
                                {
                                    this.RequestedRecipient = null;
                                }
                                if (this.RequestedRecipient != null)
                                {
                                    resolveMethod = "FoundByGUID";
                                }
                            }
                            if (this.RequestedRecipient == null)
                            {
                                SmtpProxyAddress proxyAddress = new SmtpProxyAddress(this.RequestData.EMailAddress, true);
                                this.RequestedRecipient       = callerScopedRecipientSession.FindByProxyAddress(proxyAddress);
                                if (this.RequestedRecipient != null)
                                {
                                    resolveMethod = "FoundBySMTP";
                                }
                            }
                        }
                    });
                }
                catch (LocalizedException ex)
                {
                    ExTraceGlobals.FrameworkTracer.TraceError <string, string>(0L, "[UpdateCacheCallback()] 'LocalizedException' Message=\"{0}\";StackTrace=\"{1}\"", ex.Message, ex.StackTrace);
                    Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_ErrWebException, Common.PeriodicKey, new object[]
                    {
                        ex.Message,
                        ex.StackTrace
                    });
                    resolveMethod = "Exception";
                }
                IL_285 :;
            }
            finally
            {
                RequestDetailsLoggerBase <RequestDetailsLogger> .Current.AppendGenericInfo("ResolveMethod", resolveMethod);
            }
        }