Beispiel #1
0
        // Token: 0x06000395 RID: 917 RVA: 0x00016394 File Offset: 0x00014594
        internal override AutodiscoverResponseMessage Execute()
        {
            GetDomainSettingsResponseMessage getDomainSettingsResponseMessage = new GetDomainSettingsResponseMessage();
            GetDomainSettingsResponse        response = getDomainSettingsResponseMessage.Response;
            ExchangeVersion?requestedVersion          = this.Request.RequestedVersion;
            IPrincipal      user = HttpContext.Current.User;
            string          errorMessage;
            ExchangeVersion exchangeVersion;

            if (!AutodiscoverRequestMessage.ValidateRequest <string>(this.Request, this.Request.Domains, this.Request.RequestedSettings, null, GetDomainSettingsRequestMessage.maxDomainsPerGetDomainSettingsRequest, Strings.MaxDomainsPerGetDomainSettingsRequestExceeded, out errorMessage, out exchangeVersion))
            {
                response.ErrorCode    = ErrorCode.InvalidRequest;
                response.ErrorMessage = errorMessage;
            }
            else
            {
                HashSet <DomainConfigurationSettingName> hashSet;
                DomainSettingErrorCollection             settingErrors;
                this.TryParseRequestDomainSettings(out hashSet, out settingErrors);
                if (hashSet.Count == 0)
                {
                    response.ErrorCode    = ErrorCode.InvalidRequest;
                    response.ErrorMessage = Strings.NoSettingsToReturn;
                }
                else
                {
                    string userAgent = Common.SafeGetUserAgent(HttpContext.Current.Request);
                    GetDomainSettingsCallContext callContext = new GetDomainSettingsCallContext(userAgent, this.Request.RequestedVersion, this.Request.Domains, hashSet, settingErrors, response);
                    try
                    {
                        this.ExecuteGetDomainSettingsCommand(user, callContext);
                    }
                    catch (OverBudgetException arg)
                    {
                        ExTraceGlobals.FrameworkTracer.TraceError <OverBudgetException>(0L, "GetDomainSettingsRequestMessage.Execute()returning ServerBusy for exception: {0}.", arg);
                        response.ErrorCode    = ErrorCode.ServerBusy;
                        response.ErrorMessage = Strings.ServerBusy;
                        response.DomainResponses.Clear();
                    }
                    catch (LocalizedException ex)
                    {
                        ExTraceGlobals.FrameworkTracer.TraceError <LocalizedException>(0L, "GetDomainSettingsRequestMessage.Execute()returning InternalServerError for exception: {0}.", ex);
                        Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_ErrWebException, Common.PeriodicKey, new object[]
                        {
                            ex.Message,
                            ex
                        });
                        response.ErrorCode    = ErrorCode.InternalServerError;
                        response.ErrorMessage = Strings.InternalServerError;
                        response.DomainResponses.Clear();
                    }
                }
            }
            return(getDomainSettingsResponseMessage);
        }
Beispiel #2
0
 // Token: 0x06000397 RID: 919 RVA: 0x00016598 File Offset: 0x00014798
 private void ExecuteGetDomainSettingsCommand(IPrincipal callingPrincipal, GetDomainSettingsCallContext callContext)
 {
     this.CheckIdentity(callingPrincipal);
     if (callContext.RequestedSettings.Contains(DomainConfigurationSettingName.ExternalEwsUrl) && callContext.Domains != null && callContext.Domains.Count > 0)
     {
         Uri uri;
         int currentExchangeMajorVersion;
         if (Common.SkipServiceTopologyInDatacenter())
         {
             uri = FrontEndLocator.GetDatacenterFrontEndWebServicesUrl();
             currentExchangeMajorVersion = Server.CurrentExchangeMajorVersion;
         }
         else
         {
             uri = GetDomainSettingsRequestMessage.GetRandomCasExternalServiceUri <WebServicesService>(callContext.RequestedVersion, out currentExchangeMajorVersion);
         }
         DomainStringSetting setting  = null;
         DomainStringSetting setting2 = null;
         if (null != uri)
         {
             setting = new DomainStringSetting
             {
                 Name  = GetDomainSettingsRequestMessage.externalEwsUrlSettingName,
                 Value = uri.AbsoluteUri
             };
         }
         bool flag = callContext.RequestedSettings.Contains(DomainConfigurationSettingName.ExternalEwsVersion);
         if (flag)
         {
             ServerVersion serverVersion = new ServerVersion(currentExchangeMajorVersion);
             setting2 = new DomainStringSetting
             {
                 Name  = GetDomainSettingsRequestMessage.externalEwsVersionSettingName,
                 Value = string.Format(CultureInfo.InvariantCulture, "{0:d}.{1:d2}.{2:d4}.{3:d3}", new object[]
                 {
                     serverVersion.Major,
                     serverVersion.Minor,
                     serverVersion.Build,
                     serverVersion.Revision
                 })
             };
         }
         using (IEnumerator <string> enumerator = callContext.Domains.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 string         text           = enumerator.Current;
                 DomainResponse domainResponse = new DomainResponse();
                 domainResponse.ErrorCode           = ErrorCode.NoError;
                 domainResponse.ErrorMessage        = Strings.NoError;
                 domainResponse.DomainSettingErrors = new DomainSettingErrorCollection();
                 domainResponse.DomainSettings      = new DomainSettingCollection();
                 GetDomainSettingsRequestMessage.AddSettingToResponse(domainResponse, setting, GetDomainSettingsRequestMessage.externalEwsUrlSettingName);
                 if (flag)
                 {
                     GetDomainSettingsRequestMessage.AddSettingToResponse(domainResponse, setting2, GetDomainSettingsRequestMessage.externalEwsVersionSettingName);
                 }
                 callContext.Response.DomainResponses.Add(domainResponse);
             }
             return;
         }
     }
     callContext.Response.ErrorCode    = ErrorCode.InvalidRequest;
     callContext.Response.ErrorMessage = Strings.InvalidRequest;
 }