Exemplo n.º 1
0
        private static string ClientRunProcessCommand(string server, Guid processGuid, string componentName, string componentArgument, bool componentRestrictedData, bool componentUnlimited, string userIdentity)
        {
            MdbefPropertyCollection mdbefPropertyCollection = new MdbefPropertyCollection();

            if (!string.IsNullOrEmpty(componentName))
            {
                mdbefPropertyCollection.Add(2466250783U, componentName);
            }
            if (!string.IsNullOrEmpty(componentArgument))
            {
                mdbefPropertyCollection.Add(2466316319U, componentArgument);
            }
            mdbefPropertyCollection.Add(2466381835U, componentRestrictedData);
            mdbefPropertyCollection.Add(2466512907U, componentUnlimited);
            if (!string.IsNullOrEmpty(userIdentity))
            {
                mdbefPropertyCollection.Add(2466447391U, userIdentity);
            }
            byte[] bytes = mdbefPropertyCollection.GetBytes();
            byte[] array;
            using (ProcessAccessRpcClient processAccessRpcClient = new ProcessAccessRpcClient(server, processGuid))
            {
                array = processAccessRpcClient.RunProcessCommand(bytes);
            }
            MdbefPropertyCollection mdbefPropertyCollection2 = MdbefPropertyCollection.Create(array, 0, array.Length);
            object obj = null;

            mdbefPropertyCollection2.TryGetValue(2471559199U, out obj);
            return(obj as string);
        }
 // Token: 0x06000022 RID: 34 RVA: 0x000025C4 File Offset: 0x000007C4
 public override byte[] ObtainTokens(byte[] request)
 {
     byte[] result;
     try
     {
         RequestedAction         requestedAction         = RequestedAction.Invalid;
         Guid                    mailboxGuid             = Guid.Empty;
         int                     requestedTokenCount     = 0;
         int                     totalTokenCount         = 0;
         string                  clientHostName          = null;
         string                  clientProcessName       = null;
         string                  clientType              = null;
         MdbefPropertyCollection mdbefPropertyCollection = MdbefPropertyCollection.Create(request, 0, request.Length);
         object                  obj;
         if (mdbefPropertyCollection.TryGetValue(2415984712U, out obj) && obj is Guid)
         {
             mailboxGuid = (Guid)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416050179U, out obj) && obj is int)
         {
             requestedAction = (RequestedAction)((int)obj);
         }
         if (mdbefPropertyCollection.TryGetValue(2416115715U, out obj) && obj is int)
         {
             requestedTokenCount = (int)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416181251U, out obj) && obj is int)
         {
             totalTokenCount = (int)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416312351U, out obj) && obj != null && obj is string)
         {
             clientHostName = (string)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416377887U, out obj) && obj != null && obj is string)
         {
             clientProcessName = (string)obj;
         }
         if (mdbefPropertyCollection.TryGetValue(2416246815U, out obj) && obj != null && obj is string)
         {
             clientType = (string)obj;
         }
         bool   flag  = this.ObtainTokens(mailboxGuid, requestedAction, requestedTokenCount, totalTokenCount, clientHostName, clientProcessName, clientType);
         byte[] bytes = new MdbefPropertyCollection
         {
             {
                 2566914059U,
                 flag
             }
         }.GetBytes();
         result = bytes;
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
         result = null;
     }
     return(result);
 }
        private static byte[] GetTestUserCacheInputBytes(string primarySmtpAddress, SubscriptionCacheAction cacheAction)
        {
            MdbefPropertyCollection mdbefPropertyCollection = new MdbefPropertyCollection();

            mdbefPropertyCollection[2684485663U] = primarySmtpAddress;
            mdbefPropertyCollection[2684420099U] = (int)cacheAction;
            return(mdbefPropertyCollection.GetBytes());
        }
        private static void UnpackResponse(byte[] responseByteArray, out bool allowed)
        {
            MdbefPropertyCollection mdbefPropertyCollection = MdbefPropertyCollection.Create(responseByteArray, 0, responseByteArray.Length);

            allowed = true;
            object obj;

            if (mdbefPropertyCollection.TryGetValue(2566914059U, out obj) && obj is bool)
            {
                allowed = (bool)obj;
            }
        }
        private static byte[] PackRequest(Guid mailboxGuid, RequestedAction requestedAction, int requestedTokenCount, int totalTokenCount, string clientInfo)
        {
            MdbefPropertyCollection mdbefPropertyCollection = new MdbefPropertyCollection();

            mdbefPropertyCollection.Add(2415984712U, mailboxGuid);
            mdbefPropertyCollection.Add(2416050179U, (int)requestedAction);
            mdbefPropertyCollection.Add(2416115715U, requestedTokenCount);
            mdbefPropertyCollection.Add(2416181251U, totalTokenCount);
            mdbefPropertyCollection.Add(2416312351U, Environment.MachineName);
            mdbefPropertyCollection.Add(2416377887U, ThrottlingRpcClientImpl.currentProcess.ProcessName);
            if (!string.IsNullOrEmpty(clientInfo))
            {
                mdbefPropertyCollection.Add(2416246815U, clientInfo);
            }
            return(mdbefPropertyCollection.GetBytes());
        }
        internal static bool TryTestUserCache(string databaseServer, string primarySmtpAddress, SubscriptionCacheAction cacheAction, out string failureReason, out uint cacheActionResult, out List <SubscriptionCacheObject> cacheObjects, out ObjectState objectState)
        {
            SyncUtilities.ThrowIfArgumentNullOrEmpty("databaseServer", databaseServer);
            SyncUtilities.ThrowIfArgumentNullOrEmpty("primarySmtpAddress", primarySmtpAddress);
            failureReason     = null;
            cacheActionResult = 268435456U;
            cacheObjects      = null;
            objectState       = ObjectState.Unchanged;
            byte[] testUserCacheInputBytes = SubscriptionCacheClient.GetTestUserCacheInputBytes(primarySmtpAddress, cacheAction);
            byte[] array = null;
            using (SubscriptionCacheRpcClient subscriptionCacheRpcClient = new SubscriptionCacheRpcClient(databaseServer))
            {
                try
                {
                    array = subscriptionCacheRpcClient.TestUserCache(0, testUserCacheInputBytes);
                }
                catch (RpcException exception)
                {
                    failureReason = Strings.CacheRpcExceptionEncountered(exception);
                    return(false);
                }
            }
            MdbefPropertyCollection args = MdbefPropertyCollection.Create(array, 0, array.Length);
            int num;

            if (!RpcHelper.TryGetProperty <int>(args, 2835349507U, out num))
            {
                failureReason = Strings.CacheRpcInvalidServerVersionIssue(databaseServer);
                return(false);
            }
            cacheActionResult = (uint)num;
            RpcHelper.TryGetProperty <string>(args, 2835415071U, out failureReason);
            byte[] buffer;
            if (RpcHelper.TryGetProperty <byte[]>(args, 2835480834U, out buffer))
            {
                using (MemoryStream memoryStream = new MemoryStream(buffer))
                {
                    cacheObjects = (List <SubscriptionCacheObject>)SubscriptionCacheClient.binaryFormatter.Deserialize(memoryStream);
                }
            }
            if (RpcHelper.TryGetProperty <int>(args, 2835546115U, out num))
            {
                objectState = (ObjectState)num;
            }
            return(true);
        }
Exemplo n.º 7
0
 protected override void InternalProcessRecord()
 {
     try
     {
         MessageResubmissionRpcClientImpl messageResubmissionRpcClientImpl = new MessageResubmissionRpcClientImpl(this.Server.Fqdn);
         string[] unresponsivePrimaryServers = (this.UnresponsivePrimaryServers != null) ? this.UnresponsivePrimaryServers.ToArray() : null;
         byte[]   reservedBytes = null;
         if (this.TestOnly)
         {
             MdbefPropertyCollection mdbefPropertyCollection = new MdbefPropertyCollection();
             mdbefPropertyCollection[65547U] = true;
             reservedBytes = mdbefPropertyCollection.GetBytes();
         }
         AddResubmitRequestStatus addResubmitRequestStatus;
         if (string.IsNullOrEmpty(this.conditionalString))
         {
             addResubmitRequestStatus = messageResubmissionRpcClientImpl.AddMdbResubmitRequest((this.CorrelationId == Guid.Empty) ? Guid.NewGuid() : this.CorrelationId, new Guid(this.DataObject.Destination), this.StartTime.ToUniversalTime().Ticks, this.EndTime.ToUniversalTime().Ticks, unresponsivePrimaryServers, reservedBytes);
         }
         else
         {
             addResubmitRequestStatus = messageResubmissionRpcClientImpl.AddConditionalResubmitRequest((this.CorrelationId == Guid.Empty) ? Guid.NewGuid() : this.CorrelationId, this.StartTime.ToUniversalTime().Ticks, this.EndTime.ToUniversalTime().Ticks, this.conditionalString, unresponsivePrimaryServers, reservedBytes);
         }
         if (addResubmitRequestStatus != AddResubmitRequestStatus.Success)
         {
             base.WriteError(new LocalizedException(Strings.AddResubmitRequestFailed(addResubmitRequestStatus)), ErrorCategory.NotSpecified, null);
         }
     }
     catch (RpcException rpcException)
     {
         GetResubmitRequest.ProcessRpcError(rpcException, this.Server.Fqdn, this);
     }
     catch (ResubmitRequestException exception)
     {
         base.WriteError(exception, ErrorCategory.InvalidArgument, null);
     }
     catch (LocalizedException exception2)
     {
         base.WriteError(exception2, ExchangeErrorCategory.Client, null);
     }
 }
Exemplo n.º 8
0
        public override byte[] RunProcessCommand(byte[] inBlob)
        {
            string componentName       = null;
            string argument            = null;
            bool   allowRestrictedData = false;
            bool   unlimited           = false;
            string userIdentity        = null;
            string text = null;
            MdbefPropertyCollection mdbefPropertyCollection = MdbefPropertyCollection.Create(inBlob, 0, inBlob.Length);
            object obj;

            if (mdbefPropertyCollection.TryGetValue(2466316319U, out obj) && obj is string)
            {
                argument = (string)obj;
            }
            if (mdbefPropertyCollection.TryGetValue(2466250783U, out obj) && obj is string)
            {
                componentName = (string)obj;
            }
            if (mdbefPropertyCollection.TryGetValue(2466381835U, out obj) && obj is bool)
            {
                allowRestrictedData = (bool)obj;
            }
            if (mdbefPropertyCollection.TryGetValue(2466512907U, out obj) && obj is bool)
            {
                unlimited = (bool)obj;
            }
            if (mdbefPropertyCollection.TryGetValue(2466447391U, out obj) && obj is string)
            {
                userIdentity = (string)obj;
            }
            try
            {
                DiagnosableParameters componentParameters = DiagnosableParameters.Create(argument, allowRestrictedData, unlimited, userIdentity);
                text = ProcessAccessManager.RunComponentCommand(componentName, componentParameters);
            }
            catch (XmlException ex)
            {
                StringBuilder stringBuilder = new StringBuilder(100 * ex.Data.Count);
                foreach (object obj2 in ex.Data)
                {
                    KeyValuePair <object, object> keyValuePair = (KeyValuePair <object, object>)obj2;
                    stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}:{1}{2}", new object[]
                    {
                        keyValuePair.Key,
                        keyValuePair.Value,
                        Environment.NewLine
                    });
                }
                text = string.Format(CultureInfo.InvariantCulture, "Message={0}{1}Data={2}{1}Stack={3}", new object[]
                {
                    ex.Message,
                    Environment.NewLine,
                    stringBuilder,
                    ex.StackTrace
                });
            }
            catch (Exception ex2)
            {
                text = ex2.ToString();
            }
            MdbefPropertyCollection mdbefPropertyCollection2 = new MdbefPropertyCollection();

            if (text != null)
            {
                mdbefPropertyCollection2.Add(2471559199U, text);
            }
            return(mdbefPropertyCollection2.GetBytes());
        }