Exemplo n.º 1
0
 public static void LogAcquirePrelicenseResult(RmsClientManagerContext context, LicenseResponse[] responses)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (responses == null || responses.Length == 0)
     {
         RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, RmsClientManagerLog.RmsClientManagerEvent.Success, context.TransactionId, RmsClientManagerLog.PrelicenseNoResult, context.ContextStringForm);
         return;
     }
     foreach (LicenseResponse licenseResponse in responses)
     {
         if (licenseResponse.Exception != null)
         {
             RmsClientManagerLog.LogException(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, context, licenseResponse.Exception);
         }
         else
         {
             RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, RmsClientManagerLog.RmsClientManagerEvent.Success, context.TransactionId, licenseResponse.UsageRights.ToString(), context.ContextStringForm);
         }
     }
 }
Exemplo n.º 2
0
        public static void LogException(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerContext context, Exception ex)
        {
            if (!RmsClientManagerLog.rmsLogEnabled)
            {
                return;
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            StringBuilder stringBuilder = null;

            if (ex != null)
            {
                stringBuilder = new StringBuilder(ex.Message.Length + ex.GetType().Name.Length + 3);
                stringBuilder.AppendFormat("{0} [{1}]", ex.Message, ex.GetType().Name);
                if (ex.InnerException != null)
                {
                    stringBuilder.AppendFormat("; Inner Exception: {0} [{1}]", ex.InnerException.Message, ex.InnerException.GetType().Name);
                }
            }
            LogRowFormatter logRowFormatter = new LogRowFormatter(RmsClientManagerLog.rmsLogSchema);

            logRowFormatter[1] = clientManagerFeature;
            logRowFormatter[2] = RmsClientManagerLog.RmsClientManagerEvent.Exception;
            Guid transactionId = context.TransactionId;

            logRowFormatter[7] = context.TransactionId.ToString();
            logRowFormatter[6] = context.ContextStringForm;
            if (stringBuilder != null)
            {
                logRowFormatter[5] = stringBuilder.ToString();
            }
            RmsClientManagerLog.Append(logRowFormatter);
        }
Exemplo n.º 3
0
 private static void HandleConfigurationChange(ADNotificationEventArgs args)
 {
     try
     {
         if (Interlocked.Increment(ref RmsClientManagerLog.notificationHandlerCount) == 1)
         {
             Server            localServer       = null;
             ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
             {
                 ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 1191, "HandleConfigurationChange", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\rightsmanagement\\RmsClientManagerLog.cs");
                 localServer = topologyConfigurationSession.FindLocalServer();
             });
             if (!adoperationResult.Succeeded)
             {
                 RmsClientManagerLog.Tracer.TraceError <Exception>(0L, "Failed to get the local server.  Unable to reload the log configuration. Error {0}", adoperationResult.Exception);
             }
             else
             {
                 RmsClientManagerLog.Configure(localServer);
             }
         }
     }
     finally
     {
         Interlocked.Decrement(ref RmsClientManagerLog.notificationHandlerCount);
     }
 }
Exemplo n.º 4
0
 public static void LogAcquireServerInfoResult(RmsClientManagerContext context, ExternalRMSServerInfo serverInfo)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (serverInfo == null)
     {
         RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, RmsClientManagerLog.ServerInfoNotFound, context.ContextStringForm);
         return;
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, string.Format(CultureInfo.InvariantCulture, "KeyUri: {0}; CertificationWSPipeline: {1}; CertificationWSTargetUri: {2}; ServerLicensingWSPipeline: {3}; ServerLicensingWSTargetUri: {4}; ExpiryTime: {5}", new object[]
     {
         (serverInfo.KeyUri == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.KeyUri.ToString(),
         (serverInfo.CertificationWSPipeline == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.CertificationWSPipeline.ToString(),
         (serverInfo.CertificationWSTargetUri == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.CertificationWSTargetUri.ToString(),
         (serverInfo.ServerLicensingWSPipeline == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.ServerLicensingWSPipeline.ToString(),
         (serverInfo.ServerLicensingWSTargetUri == null) ? RmsClientManagerLog.ServerInfoUriNull : serverInfo.ServerLicensingWSTargetUri.ToString(),
         serverInfo.ExpiryTime.Ticks.ToString()
     }), context.ContextStringForm);
 }
Exemplo n.º 5
0
        public static void LogAcquireRmsTemplateResult(RmsClientManagerContext context, Uri serverUrl, LinkedList <RmsTemplate> templates)
        {
            if (!RmsClientManagerLog.rmsLogEnabled)
            {
                return;
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = true;

            foreach (RmsTemplate rmsTemplate in templates)
            {
                if (!flag)
                {
                    stringBuilder.AppendFormat("; {0}", rmsTemplate.Id.ToString());
                }
                else
                {
                    stringBuilder.Append(rmsTemplate.Id.ToString());
                    flag = false;
                }
            }
            RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Template, RmsClientManagerLog.RmsClientManagerEvent.Success, serverUrl, context.OrgId, context.TransactionId, stringBuilder.ToString(), context.ContextStringForm);
        }
Exemplo n.º 6
0
        private static void LogEvent(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerLog.RmsClientManagerEvent clientManagerEvent, Guid transaction, string data, string context)
        {
            LogRowFormatter logRowFormatter = new LogRowFormatter(RmsClientManagerLog.rmsLogSchema);

            logRowFormatter[1] = clientManagerFeature;
            logRowFormatter[2] = clientManagerEvent;
            logRowFormatter[7] = transaction.ToString();
            logRowFormatter[6] = context;
            logRowFormatter[5] = data;
            RmsClientManagerLog.Append(logRowFormatter);
        }
Exemplo n.º 7
0
 public static void LogAcquireRmsTemplateResult(RmsClientManagerContext context, RmsTemplate template)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Template, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, template.Id.ToString(), context.ContextStringForm);
 }
Exemplo n.º 8
0
 public static void LogVerifySignatureResult(RmsClientManagerContext context, string userIdentity)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.SignatureVerification, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, userIdentity, context.ContextStringForm);
 }
Exemplo n.º 9
0
 public static void LogAcquireRacClc(RmsClientManagerContext context)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.RacClc, RmsClientManagerLog.RmsClientManagerEvent.Acquire, context.OrgId, context.TransactionId, RmsClientManagerLog.AcquireServerRacClc, context.ContextStringForm);
 }
Exemplo n.º 10
0
 public static void LogAcquireUseLicenseResult(RmsClientManagerContext context, string useLicense)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.UseLicense, RmsClientManagerLog.RmsClientManagerEvent.Success, context.TransactionId, string.IsNullOrEmpty(useLicense) ? RmsClientManagerLog.UseLicenseEmpty : RmsClientManagerLog.UseLicenseExists, context.ContextStringForm);
 }
Exemplo n.º 11
0
 public static void LogAcquireUseLicense(RmsClientManagerContext context, Uri serverUrl, string user)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.UseLicense, RmsClientManagerLog.RmsClientManagerEvent.Acquire, serverUrl, context.OrgId, context.TransactionId, user, context.ContextStringForm);
 }
Exemplo n.º 12
0
 public static void LogUriEvent(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerLog.RmsClientManagerEvent clientManagerEvent, RmsClientManagerContext context, Uri serverUrl)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(clientManagerFeature, clientManagerEvent, serverUrl, context.OrgId, context.TransactionId, context.ContextStringForm);
 }
Exemplo n.º 13
0
        public static void LogDrmInitialization(int machineCertIndex)
        {
            if (!RmsClientManagerLog.rmsLogEnabled)
            {
                return;
            }
            RmsClientManagerContext rmsClientManagerContext = new RmsClientManagerContext(OrganizationId.ForestWideOrgId, null);

            RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.DrmInitialization, RmsClientManagerLog.RmsClientManagerEvent.Success, default(Guid), string.Format(CultureInfo.InvariantCulture, "Selected machine certificate index: {0}", new object[]
            {
                machineCertIndex.ToString(NumberFormatInfo.InvariantInfo)
            }), rmsClientManagerContext.ContextStringForm);
        }
Exemplo n.º 14
0
 public static void LogAcquirePrelicense(RmsClientManagerContext context, Uri serverUrl, string[] identities)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     foreach (string data in identities)
     {
         RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.Prelicense, RmsClientManagerLog.RmsClientManagerEvent.Acquire, serverUrl, context.OrgId, context.TransactionId, data, context.ContextStringForm);
     }
 }
Exemplo n.º 15
0
        public static void LogDrmInitialization(Uri rmsServerUri)
        {
            if (!RmsClientManagerLog.rmsLogEnabled)
            {
                return;
            }
            if (rmsServerUri == null)
            {
                throw new ArgumentNullException("rmsServerUri");
            }
            RmsClientManagerContext rmsClientManagerContext = new RmsClientManagerContext(OrganizationId.ForestWideOrgId, null);

            RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.DrmInitialization, RmsClientManagerLog.RmsClientManagerEvent.Success, default(Guid), string.Format(CultureInfo.InvariantCulture, "RMS Server queried for active crypto mode: {0}", new object[]
            {
                rmsServerUri.ToString()
            }), rmsClientManagerContext.ContextStringForm);
        }
Exemplo n.º 16
0
 public static void LogAcquireRacClcResult(RmsClientManagerContext context, TenantLicensePair tenantLicensePair)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.RacClc, RmsClientManagerLog.RmsClientManagerEvent.Success, context.OrgId, context.TransactionId, string.Format(CultureInfo.InvariantCulture, "CLC: {0}; RAC: {1}; Version: {2}", new object[]
     {
         (tenantLicensePair.BoundLicenseClc == null) ? RmsClientManagerLog.LicenseEmpty : RmsClientManagerLog.LicenseExists,
         (tenantLicensePair.Rac == null) ? RmsClientManagerLog.LicenseEmpty : RmsClientManagerLog.LicenseExists,
         tenantLicensePair.Version
     }).ToString(NumberFormatInfo.InvariantInfo), context.ContextStringForm);
 }
Exemplo n.º 17
0
        public static void LogUrlMalFormatException(UriFormatException ex, string key, string originalUri)
        {
            StringBuilder stringBuilder = null;

            if (ex != null)
            {
                stringBuilder = new StringBuilder(ex.Message.Length + ex.GetType().Name.Length + 3);
                stringBuilder.AppendFormat("{0} [{1}]", ex.Message, ex.GetType().Name);
                if (ex.InnerException != null)
                {
                    stringBuilder.AppendFormat("; Inner Exception: {0} [{1}]", ex.InnerException.Message, ex.InnerException.GetType().Name);
                }
            }
            string data = string.Format("RMSO connector Url is a malformat url, regkey value: {0}, originalUri: {1}", key, originalUri);

            RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Exception, default(Guid), data, stringBuilder.ToString());
        }
Exemplo n.º 18
0
 public static void LogAcquireRacClcCacheResult(RmsClientManagerContext context, Uri serviceLocation, Uri publishingLocation, byte version)
 {
     if (!RmsClientManagerLog.rmsLogEnabled)
     {
         return;
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.RacClc, RmsClientManagerLog.RmsClientManagerEvent.Success, RmsClientManagerLog.DummyUriForRacClcCache, context.OrgId, context.TransactionId, string.Format(CultureInfo.InvariantCulture, "Service Location: {0}; Publishing Location: {1}; Version: {2}", new object[]
     {
         serviceLocation.ToString(),
         publishingLocation.ToString(),
         version.ToString(NumberFormatInfo.InvariantInfo)
     }), context.ContextStringForm);
 }
Exemplo n.º 19
0
        private static void LogEvent(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerLog.RmsClientManagerEvent clientManagerEvent, Uri serverUrl, OrganizationId orgId, Guid transaction, string context)
        {
            LogRowFormatter logRowFormatter = new LogRowFormatter(RmsClientManagerLog.rmsLogSchema);

            logRowFormatter[1] = clientManagerFeature;
            logRowFormatter[2] = clientManagerEvent;
            if (serverUrl != null)
            {
                logRowFormatter[4] = serverUrl.ToString();
            }
            if (orgId != null)
            {
                logRowFormatter[3] = orgId.ToString();
            }
            logRowFormatter[7] = transaction.ToString();
            logRowFormatter[6] = context;
            RmsClientManagerLog.Append(logRowFormatter);
        }
Exemplo n.º 20
0
        public static ExternalRMSServerInfo EndAcquireServerInfo(IAsyncResult asyncResult)
        {
            RmsServerInfoManager.ThrowIfNotInitialized();
            ArgumentValidator.ThrowIfNull("asyncResult", asyncResult);
            AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = asyncResult as AcquireServerInfoAsyncResult;

            if (acquireServerInfoAsyncResult == null)
            {
                throw new InvalidOperationException("asyncResult cannot be null and has to be type of AcquireServerInfoAsyncResult");
            }
            acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.EndAcquireServerInfo);
            if (!acquireServerInfoAsyncResult.IsCompleted)
            {
                acquireServerInfoAsyncResult.InternalWaitForCompletion();
            }
            Exception ex = acquireServerInfoAsyncResult.Result as Exception;

            if (ex != null)
            {
                RmsServerInfoManager.Tracer.TraceError <Uri, Exception>(0L, "EndAcquireServerInfo hit an exception; and as a result of it, '{0}' will be marked as negative entry in cache. Exception - {1}", acquireServerInfoAsyncResult.LicenseUri, ex);
                RightsManagementException ex2 = ex as RightsManagementException;
                if (ex2 == null || ex2.IsPermanent)
                {
                    RmsServerInfoManager.AddNegativeServerInfo(acquireServerInfoAsyncResult.LicenseUri);
                }
                RmsClientManagerLog.LogException(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, acquireServerInfoAsyncResult.Context, ex);
                throw ex;
            }
            ExternalRMSServerInfo externalRMSServerInfo;

            if (!RmsServerInfoManager.serverInfoMap.TryGet(acquireServerInfoAsyncResult.LicenseUri, out externalRMSServerInfo))
            {
                RmsClientManagerLog.LogAcquireServerInfoResult(acquireServerInfoAsyncResult.Context, null);
                RmsServerInfoManager.Tracer.TraceError(0L, "Could not find the server info in the cache");
                return(null);
            }
            RmsClientManagerLog.LogAcquireServerInfoResult(acquireServerInfoAsyncResult.Context, externalRMSServerInfo);
            if (externalRMSServerInfo.IsNegativeEntry)
            {
                RmsServerInfoManager.Tracer.TraceError(0L, "RmsServerInfoManager found requested server info in cache; but it is a negative entry!");
                return(null);
            }
            return(externalRMSServerInfo);
        }
Exemplo n.º 21
0
        public static void Start()
        {
            Server localServer = null;

            RmsClientManagerLog.rmsLogSchema = new LogSchema("Microsoft Exchange Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Rms Client Manager Log", RmsClientManagerLog.Fields);
            RmsClientManagerLog.rmsLog       = new Log(RmsClientManagerUtils.GetUniqueFileNameForProcess(RmsClientManagerLog.LogSuffix, true), new LogHeaderFormatter(RmsClientManagerLog.rmsLogSchema), "RmsClientManagerLog");
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 254, "Start", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\rightsmanagement\\RmsClientManagerLog.cs");
                localServer = topologyConfigurationSession.FindLocalServer();
                RmsClientManagerLog.notificationCookie = ADNotificationAdapter.RegisterChangeNotification <Server>(localServer.Id, new ADNotificationCallback(RmsClientManagerLog.HandleConfigurationChange));
            });

            if (!adoperationResult.Succeeded)
            {
                RmsClientManagerLog.Tracer.TraceError <Exception>(0L, "Failed to get the local server.  Unable to load the log configuration. Error {0}", adoperationResult.Exception);
                throw new ExchangeConfigurationException(ServerStrings.FailedToReadConfiguration, adoperationResult.Exception);
            }
            RmsClientManagerLog.Configure(localServer);
        }
Exemplo n.º 22
0
        public static void LogDrmInitialization(DRMClientVersionInfo msdrmVersionInfo)
        {
            if (!RmsClientManagerLog.rmsLogEnabled)
            {
                return;
            }
            if (msdrmVersionInfo == null)
            {
                throw new ArgumentNullException("msdrmVersionInfo");
            }
            RmsClientManagerContext rmsClientManagerContext = new RmsClientManagerContext(OrganizationId.ForestWideOrgId, null);

            RmsClientManagerLog.LogEvent(RmsClientManagerLog.RmsClientManagerFeature.DrmInitialization, RmsClientManagerLog.RmsClientManagerEvent.Success, default(Guid), string.Format(CultureInfo.InvariantCulture, "MSDRM.DLL version: {0}.{1}.{2}.{3}", new object[]
            {
                msdrmVersionInfo.V1.ToString(),
                msdrmVersionInfo.V2.ToString(),
                msdrmVersionInfo.V3.ToString(),
                msdrmVersionInfo.V4.ToString()
            }), rmsClientManagerContext.ContextStringForm);
        }
Exemplo n.º 23
0
        private static Uri CheckRedirectUrl(Uri originalUrl, bool isCertificationServerUrl)
        {
            Uri    uri  = originalUrl;
            string text = uri.AbsoluteUri;
            string name = isCertificationServerUrl ? "SOFTWARE\\Microsoft\\ExchangeServer\\V15\\IRM\\CertificationServerRedirection\\" : "SOFTWARE\\Microsoft\\ExchangeServer\\V15\\IRM\\LicenseServerRedirection\\";

            using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(name))
            {
                if (registryKey != null)
                {
                    string[] valueNames = registryKey.GetValueNames();
                    if (valueNames == null || valueNames.Length == 0)
                    {
                        return(originalUrl);
                    }
                    foreach (string text2 in valueNames)
                    {
                        if (!string.IsNullOrWhiteSpace(text2) && registryKey.GetValueKind(text2) == RegistryValueKind.String && text.ToLower().Contains(text2.ToLower()))
                        {
                            text = text.ToLower().Replace(text2.ToLower(), ((string)registryKey.GetValue(text2)).ToLower());
                            try
                            {
                                uri = new Uri(text);
                                break;
                            }
                            catch (UriFormatException ex)
                            {
                                RmsClientManagerLog.LogUrlMalFormatException(ex, text2, originalUrl.AbsoluteUri);
                                RmsoProxyUtil.Tracer.TraceError(0L, ex.Message);
                                throw ex;
                            }
                        }
                    }
                }
            }
            return(uri);
        }
Exemplo n.º 24
0
        public static IAsyncResult BeginAcquireServerInfo(RmsClientManagerContext context, Uri licenseUri, object state, AsyncCallback callback)
        {
            RmsServerInfoManager.ThrowIfNotInitialized();
            ArgumentValidator.ThrowIfNull("licenseUri", licenseUri);
            AcquireServerInfoAsyncResult acquireServerInfoAsyncResult = new AcquireServerInfoAsyncResult(context, licenseUri, state, callback);

            acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginAcquireServerInfo);
            ExternalRMSServerInfo externalRMSServerInfo;

            if (RmsServerInfoManager.serverInfoMap.TryGet(licenseUri, out externalRMSServerInfo))
            {
                acquireServerInfoAsyncResult.InvokeCallback();
                return(acquireServerInfoAsyncResult);
            }
            RmsClientManagerLog.LogUriEvent(RmsClientManagerLog.RmsClientManagerFeature.ServerInfo, RmsClientManagerLog.RmsClientManagerEvent.Acquire, context, licenseUri);
            WebProxy localServerProxy;

            try
            {
                localServerProxy = RmsClientManagerUtils.GetLocalServerProxy(true);
            }
            catch (ExchangeConfigurationException value)
            {
                acquireServerInfoAsyncResult.InvokeCallback(value);
                return(acquireServerInfoAsyncResult);
            }
            bool flag = RmsServerInfoManager.outstandingFindServiceLocationCalls.EnqueueResult(licenseUri, acquireServerInfoAsyncResult);

            if (flag)
            {
                acquireServerInfoAsyncResult.ServerWSManager = new ServerWSManager(licenseUri, RmsServerInfoManager.perfCounters, acquireServerInfoAsyncResult.LatencyTracker, localServerProxy, RmsClientManager.AppSettings.RmsSoapQueriesTimeout);
                ServiceType[] serviceTypes = new ServiceType[]
                {
                    ServiceType.CertificationWSService,
                    ServiceType.ServerLicensingWSService,
                    ServiceType.CertificationMexService,
                    ServiceType.ServerLicensingMexService
                };
                RmsClientManager.TracePass(null, context.SystemProbeId, "Querying the RMS server {0} for server info", new object[]
                {
                    licenseUri
                });
                acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginFindServiceLocationsFirstRequest);
                try
                {
                    acquireServerInfoAsyncResult.ServerWSManager.BeginFindServiceLocations(serviceTypes, RmsClientManagerUtils.WrapCallbackWithUnhandledExceptionHandlerAndUpdatePoisonContext(new AsyncCallback(RmsServerInfoManager.AcquireServiceLocationCallback)), acquireServerInfoAsyncResult);
                    return(acquireServerInfoAsyncResult);
                }
                catch (InvalidOperationException ex)
                {
                    RmsClientManager.TraceFail(null, context.SystemProbeId, "Hit an exception during BeginFindServiceLocations {0}", new object[]
                    {
                        ex
                    });
                    acquireServerInfoAsyncResult.InvokeCallback(new RightsManagementException(RightsManagementFailureCode.FindServiceLocationFailed, ServerStrings.FailedToFindServerInfo(licenseUri), ex));
                    return(acquireServerInfoAsyncResult);
                }
            }
            RmsClientManager.TracePass(null, context.SystemProbeId, "A request for server info for the license uri {0} is already pending. Enqueuing the result", new object[]
            {
                licenseUri
            });
            acquireServerInfoAsyncResult.AddBreadCrumb(Constants.State.BeginFindServiceLocationsPendingRequest);
            return(acquireServerInfoAsyncResult);
        }