コード例 #1
0
 // Token: 0x06000301 RID: 769 RVA: 0x0000FE9C File Offset: 0x0000E09C
 private void InitializeExchangePrincipal()
 {
     try
     {
         this.exchangePrincipalInitialized = true;
         if (((IAirSyncUser)this).ADUser == null)
         {
             throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.UserHasNoMailbox, null, false)
                   {
                       ErrorStringForProtocolLogger = "UserHasNoMailbox"
                   };
         }
         AirSyncDiagnostics.FaultInjectionPoint(3414568253U, delegate
         {
             this.exchangePrincipal = ExchangePrincipal.FromMiniRecipient(((IAirSyncUser)this).ADUser);
         }, delegate
         {
             throw new ObjectNotFoundException(new LocalizedString("FaultInjection ObjectNotFoundException"));
         });
     }
     catch (ObjectNotFoundException innerException)
     {
         string redirectAddressForUserHasNoMailbox = this.GetRedirectAddressForUserHasNoMailbox(((IAirSyncUser)this).ADUser);
         if (!string.IsNullOrEmpty(redirectAddressForUserHasNoMailbox))
         {
             throw new IncorrectUrlRequestException((HttpStatusCode)451, "X-MS-Location", redirectAddressForUserHasNoMailbox);
         }
         throw new AirSyncPermanentException(HttpStatusCode.Forbidden, StatusCode.UserHasNoMailbox, innerException, false)
               {
                   ErrorStringForProtocolLogger = "UserHasNoMailbox"
               };
     }
 }
コード例 #2
0
        // Token: 0x06000302 RID: 770 RVA: 0x000100E8 File Offset: 0x0000E2E8
        private string GetRedirectAddressForUserHasNoMailbox(ActiveSyncMiniRecipient activesyncMiniRecipient)
        {
            string easEndpoint = null;

            if (!VariantConfiguration.InvariantNoFlightingSnapshot.ActiveSync.RedirectForOnBoarding.Enabled)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "The hybrid on boarding redirect feature is only for OnPrem servers.");
                return(null);
            }
            if (this.context.CommandType != CommandType.Options && this.context.AirSyncVersion < GlobalSettings.MinRedirectProtocolVersion)
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "The protocol version is less than 14.0 that doesn't support 451 redirect protocol call.");
                return(null);
            }
            AirSyncDiagnostics.FaultInjectionPoint(3414568253U, delegate
            {
                if (activesyncMiniRecipient != null && activesyncMiniRecipient.ExternalEmailAddress != null)
                {
                    AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Try to figure out eas endpoint for user: {0}.", activesyncMiniRecipient.ExternalEmailAddress.AddressString);
                    this.context.ProtocolLogger.SetValue(ProtocolLoggerData.RedirectTo, "TryToFigureOutEasEndpoint");
                    SmtpProxyAddress smtpProxyAddress = activesyncMiniRecipient.ExternalEmailAddress as SmtpProxyAddress;
                    if (smtpProxyAddress != null && !string.IsNullOrEmpty(smtpProxyAddress.AddressString))
                    {
                        OrganizationIdCacheValue organizationIdCacheValue = OrganizationIdCache.Singleton.Get(activesyncMiniRecipient.OrganizationId);
                        string domain = ((SmtpAddress)smtpProxyAddress).Domain;
                        OrganizationRelationship organizationRelationship = organizationIdCacheValue.GetOrganizationRelationship(domain);
                        if (organizationRelationship != null)
                        {
                            Uri targetOwaURL = organizationRelationship.TargetOwaURL;
                            easEndpoint      = this.TransferTargetOwaUrlToEasEndpoint(targetOwaURL);
                            AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "Redirect to EASEndpoint : {0}.", easEndpoint);
                            this.context.ProtocolLogger.AppendValue(ProtocolLoggerData.RedirectTo, easEndpoint);
                            return;
                        }
                        AirSyncDiagnostics.TraceDebug <string>(ExTraceGlobals.RequestsTracer, this, "OrganizationRelationShip is null for the domain {0}", domain);
                        return;
                    }
                    else
                    {
                        AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "External email address is null");
                    }
                }
            }, delegate
            {
                Uri targetOwaUri = new Uri("http://outlook.com/owa");
                easEndpoint      = this.TransferTargetOwaUrlToEasEndpoint(targetOwaUri);
            });
            return(easEndpoint);
        }