示例#1
0
 internal static void MergeBindings(MultiValuedProperty <BindingMetadata> bindings, MultiValuedProperty <BindingMetadata> addedBindings, MultiValuedProperty <BindingMetadata> removedBindings, bool forceClear)
 {
     ArgumentValidator.ThrowIfNull("bindings", bindings);
     ArgumentValidator.ThrowIfNull("addedBindings", addedBindings);
     ArgumentValidator.ThrowIfNull("removedBindings", removedBindings);
     if (forceClear && bindings.Any <BindingMetadata>())
     {
         bindings.Clear();
         return;
     }
     using (MultiValuedProperty <BindingMetadata> .Enumerator enumerator = removedBindings.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             BindingMetadata item            = enumerator.Current;
             BindingMetadata bindingMetadata = bindings.FirstOrDefault((BindingMetadata p) => p.ImmutableIdentity == item.ImmutableIdentity);
             if (bindingMetadata != null)
             {
                 bindings.Remove(bindingMetadata);
             }
         }
     }
     using (MultiValuedProperty <BindingMetadata> .Enumerator enumerator2 = addedBindings.GetEnumerator())
     {
         while (enumerator2.MoveNext())
         {
             BindingMetadata item             = enumerator2.Current;
             BindingMetadata bindingMetadata2 = bindings.FirstOrDefault((BindingMetadata p) => p.ImmutableIdentity == item.ImmutableIdentity);
             if (bindingMetadata2 == null)
             {
                 bindings.Add(item);
             }
             else if (!string.Equals(bindingMetadata2.DisplayName, item.DisplayName, StringComparison.InvariantCulture) || !string.Equals(bindingMetadata2.Name, item.Name, StringComparison.InvariantCultureIgnoreCase))
             {
                 int index = bindings.IndexOf(bindingMetadata2);
                 bindings[index] = item;
             }
         }
     }
 }
        private void LogSaveEvent(SearchObjectBase obj)
        {
            SearchEventLogger.PropertyLogData propertyLogData = new SearchEventLogger.PropertyLogData();
            if (base.ADUser.OrganizationId != null && base.ADUser.OrganizationId.ConfigurationUnit != null)
            {
                propertyLogData.AddOrganization(base.ADUser.OrganizationId.ConfigurationUnit.ToString());
            }
            switch (obj.ObjectType)
            {
            case ObjectType.SearchObject:
                break;

            case ObjectType.SearchStatus:
            {
                SearchStatus searchStatus = (SearchStatus)obj;
                propertyLogData.AddSearchStatus(searchStatus);
                SearchEventLogger.Instance.LogSearchStatusSavedEvent(propertyLogData);
                if (searchStatus.Errors == null)
                {
                    return;
                }
                using (MultiValuedProperty <string> .Enumerator enumerator = searchStatus.Errors.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string errorMsg = enumerator.Current;
                        SearchEventLogger.Instance.LogSearchErrorEvent(obj.Id.ToString(), errorMsg);
                    }
                    return;
                }
                break;
            }

            default:
                return;
            }
            propertyLogData.AddSearchObject((SearchObject)obj);
            SearchEventLogger.Instance.LogSearchObjectSavedEvent(propertyLogData);
        }
示例#3
0
        private bool DoOnPremisesReceiveConnectorNeedConfiguration()
        {
            this.receiveConnectorOperation = MailFlowTask.Operation.NOP;
            if (this.ReceivingTransportServers.Count > 0)
            {
                using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = this.ReceivingTransportServers.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ADObjectId        adobjectId       = enumerator.Current;
                        IReceiveConnector obj              = this.BuildExpectedReceiveConnector(adobjectId);
                        IReceiveConnector receiveConnector = base.OnPremisesSession.GetReceiveConnector(adobjectId);
                        if (receiveConnector == null)
                        {
                            throw new LocalizedException(HybridStrings.ErrorDefaultReceieveConnectorNotFound(adobjectId.Name));
                        }
                        Tuple <MailFlowTask.Operation, IReceiveConnector> value;
                        if (receiveConnector.Equals(obj))
                        {
                            value = new Tuple <MailFlowTask.Operation, IReceiveConnector>(MailFlowTask.Operation.NOP, receiveConnector);
                        }
                        else
                        {
                            this.receiveConnectorOperation = MailFlowTask.Operation.Update;
                            value = new Tuple <MailFlowTask.Operation, IReceiveConnector>(MailFlowTask.Operation.Update, receiveConnector);
                        }
                        this.receiveConnectorsByTransportServer[adobjectId.Name] = value;
                    }
                    goto IL_C2;
                }
            }
            if (this.EdgeTransportServers.Count > 0 && !this.edgeReceiveConnectorsWarningDisplayed)
            {
                this.receiveConnectorOperation = MailFlowTask.Operation.Update;
            }
IL_C2:
            return(this.receiveConnectorOperation != MailFlowTask.Operation.NOP);
        }
示例#4
0
        private MultiValuedProperty <ADObjectId> MergeArraysIntoList(params MultiValuedProperty <ADObjectId>[] propertyArrayArray)
        {
            MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();

            foreach (MultiValuedProperty <ADObjectId> multiValuedProperty2 in propertyArrayArray)
            {
                if (multiValuedProperty2 != null)
                {
                    using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty2.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ADObjectId value = enumerator.Current;
                            if (multiValuedProperty.Find((ADObjectId b) => ADObjectId.Equals(value, b)) == null)
                            {
                                multiValuedProperty.Add(value);
                            }
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }
示例#5
0
 protected override void InternalProcessRecord()
 {
     DiagnosticContext.Reset();
     if (base.ParameterSetName == "MultipleMailboxesSearch")
     {
         if (this.Mailboxes != null && this.Mailboxes.Count == 0)
         {
             this.ProcessRecordInternal();
             return;
         }
         using (MultiValuedProperty <MailboxIdParameter> .Enumerator enumerator = this.Mailboxes.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 MailboxIdParameter identity = enumerator.Current;
                 this.Identity = identity;
                 this.ProcessRecordInternal();
             }
             return;
         }
     }
     this.ProcessRecordInternal();
 }
示例#6
0
        // Token: 0x060000AF RID: 175 RVA: 0x00004C1C File Offset: 0x00002E1C
        private static AuthenticationMethod ConvertAuthenticationMethods(MultiValuedProperty <AuthenticationMethod> configMethods)
        {
            AuthenticationMethod authenticationMethod = 0;

            using (MultiValuedProperty <AuthenticationMethod> .Enumerator enumerator = configMethods.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    switch (enumerator.Current)
                    {
                    case 0:
                        authenticationMethod |= 1;
                        break;

                    case 1:
                        authenticationMethod |= 8;
                        break;

                    case 2:
                        authenticationMethod |= 2;
                        break;

                    case 3:
                        authenticationMethod |= 4;
                        break;

                    case 4:
                        authenticationMethod |= 16;
                        break;

                    case 5:
                        authenticationMethod |= 32;
                        break;

                    case 6:
                        authenticationMethod |= 64;
                        break;

                    case 7:
                        authenticationMethod |= 128;
                        break;

                    case 8:
                        authenticationMethod |= 256;
                        break;

                    case 9:
                        authenticationMethod |= 512;
                        break;

                    case 10:
                        authenticationMethod |= 1024;
                        break;

                    case 11:
                        authenticationMethod |= 2048;
                        break;

                    case 12:
                        authenticationMethod |= 4096;
                        break;

                    case 13:
                        authenticationMethod |= 8192;
                        break;

                    case 14:
                        authenticationMethod |= 16384;
                        break;
                    }
                }
            }
            return(authenticationMethod);
        }
示例#7
0
        protected override void InternalValidate()
        {
            Dictionary <Guid, bool> dictionary = new Dictionary <Guid, bool>();

            TaskLogger.LogEnter();
            base.InternalValidate();
            if (!base.HasErrors)
            {
                this.rootOrgConfigSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 123, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs");
                if (this.DialPlan != null)
                {
                    IEnumerable <UMDialPlan> objects = this.DialPlan.GetObjects <UMDialPlan>(null, this.rootOrgConfigSession);
                    using (IEnumerator <UMDialPlan> enumerator = objects.GetEnumerator())
                    {
                        if (!enumerator.MoveNext())
                        {
                            base.WriteError(new LocalizedException(Strings.NonExistantDialPlan(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan);
                        }
                        this.adResults = enumerator.Current;
                        if (enumerator.MoveNext())
                        {
                            base.WriteError(new LocalizedException(Strings.MultipleDialplansWithSameId(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan);
                        }
                    }
                    UMDialPlan dialPlan = (UMDialPlan)this.adResults;
                    if (Utility.DialPlanHasIncompatibleServers(dialPlan, this.rootOrgConfigSession, dictionary))
                    {
                        this.WriteWarning(Strings.InvalidServerVersionInDialPlan(((UMDialPlan)this.adResults).Name));
                    }
                }
                else
                {
                    if (this.IPGateway != null)
                    {
                        IEnumerable <UMIPGateway> objects2 = this.IPGateway.GetObjects <UMIPGateway>(null, this.rootOrgConfigSession);
                        using (IEnumerator <UMIPGateway> enumerator2 = objects2.GetEnumerator())
                        {
                            if (!enumerator2.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.NonExistantIPGateway(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway);
                            }
                            this.adResults = enumerator2.Current;
                            if (enumerator2.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.MultipleIPGatewaysWithSameId(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway);
                            }
                        }
                        if (CommonConstants.UseDataCenterCallRouting)
                        {
                            goto IL_36F;
                        }
                        UMIPGateway umipgateway = (UMIPGateway)this.adResults;
                        using (MultiValuedProperty <UMHuntGroup> .Enumerator enumerator3 = umipgateway.HuntGroups.GetEnumerator())
                        {
                            while (enumerator3.MoveNext())
                            {
                                UMHuntGroup umhuntGroup = enumerator3.Current;
                                if (umhuntGroup.UMDialPlan != null && !dictionary.ContainsKey(umhuntGroup.UMDialPlan.ObjectGuid))
                                {
                                    dictionary[umhuntGroup.UMDialPlan.ObjectGuid] = true;
                                    IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(umhuntGroup.UMDialPlan), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs");
                                    UMDialPlan            dialPlan2 = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(umhuntGroup.UMDialPlan);
                                    if (Utility.DialPlanHasIncompatibleServers(dialPlan2, this.rootOrgConfigSession, dictionary))
                                    {
                                        this.WriteWarning(Strings.InvalidServerVersionInGateway(umipgateway.Name));
                                    }
                                }
                            }
                            goto IL_36F;
                        }
                    }
                    if (this.Server != null)
                    {
                        IEnumerable <Server> objects3 = this.Server.GetObjects <Server>(null, this.rootOrgConfigSession);
                        using (IEnumerator <Server> enumerator4 = objects3.GetEnumerator())
                        {
                            if (!enumerator4.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.NonExistantServer(this.Server.ToString())), ErrorCategory.InvalidData, this.Server);
                            }
                            this.adResults = enumerator4.Current;
                            if (enumerator4.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.MultipleServersWithSameId(this.Server.ToString())), ErrorCategory.InvalidData, this.Server);
                            }
                        }
                        Server target = (Server)this.adResults;
                        this.ValidateServerIsCompatible(target);
                    }
                    else if (this.InstanceServer != null)
                    {
                        Server target2 = (Server)this.InstanceServer.DataObject;
                        this.ValidateServerIsCompatible(target2);
                    }
                }
            }
IL_36F:
            TaskLogger.LogExit();
        }
示例#8
0
        public static void CopyDavVdirsToMetabase(string domainController, string exchangeServerName, string metabaseServerName)
        {
            ADSessionSettings             sessionSettings = ADSessionSettings.FromRootOrgScopeSet();
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(domainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 154, "CopyDavVdirsToMetabase", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\VirtualDirectoryTasks\\OWAVirtualDirectoryHelper.cs");
            Server server = topologyConfigurationSession.FindServerByName(exchangeServerName);
            IConfigDataProvider configDataProvider         = topologyConfigurationSession;
            IEnumerable <ADOwaVirtualDirectory> enumerable = configDataProvider.FindPaged <ADOwaVirtualDirectory>(null, server.Id, true, null, 0);

            OwaVirtualDirectoryHelper.SetWebSvcExtRestrictionList(metabaseServerName);
            foreach (ADOwaVirtualDirectory adowaVirtualDirectory in enumerable)
            {
                if (!adowaVirtualDirectory.IsExchange2007OrLater)
                {
                    string[] array = adowaVirtualDirectory.MetabasePath.Split(new char[]
                    {
                        '/'
                    });
                    if (array.Length == 7)
                    {
                        array[2] = metabaseServerName;
                        MultiValuedProperty <AuthenticationMethod> internalAuthenticationMethods = adowaVirtualDirectory.InternalAuthenticationMethods;
                        adowaVirtualDirectory.WindowsAuthentication = true;
                        string appPoolRootPath = IisUtility.GetAppPoolRootPath(metabaseServerName);
                        string text            = "MSExchangeOWAAppPool";
                        if (!IisUtility.Exists(appPoolRootPath, text, "IIsApplicationPool"))
                        {
                            using (DirectoryEntry directoryEntry = IisUtility.CreateApplicationPool(metabaseServerName, text))
                            {
                                IisUtility.SetProperty(directoryEntry, "AppPoolIdentityType", 0, true);
                                directoryEntry.CommitChanges();
                            }
                        }
                        if (!IisUtility.Exists(string.Join("/", array)))
                        {
                            DirectoryEntry directoryEntry2 = IisUtility.CreateWebDirObject(string.Join("/", array, 0, 6), adowaVirtualDirectory.FolderPathname, array[6]);
                            ArrayList      arrayList       = new ArrayList();
                            arrayList.Add(new MetabaseProperty("LogonMethod", MetabasePropertyTypes.LogonMethod.ClearTextLogon));
                            arrayList.Add(new MetabaseProperty("AccessFlags", MetabasePropertyTypes.AccessFlags.Read | MetabasePropertyTypes.AccessFlags.Write | MetabasePropertyTypes.AccessFlags.Source | MetabasePropertyTypes.AccessFlags.Script));
                            arrayList.Add(new MetabaseProperty("DirBrowseFlags", (MetabasePropertyTypes.DirBrowseFlags) 3221225534U));
                            arrayList.Add(new MetabaseProperty("ScriptMaps", OwaVirtualDirectoryHelper.GetDavScriptMaps(), true));
                            if (adowaVirtualDirectory.VirtualDirectoryType == VirtualDirectoryTypes.Exchweb)
                            {
                                arrayList.Add(new MetabaseProperty("HttpExpires", "D, 0x278d00"));
                            }
                            if (adowaVirtualDirectory.DefaultDomain.Length > 0)
                            {
                                arrayList.Add(new MetabaseProperty("DefaultLogonDomain", adowaVirtualDirectory.DefaultDomain, true));
                            }
                            OwaIsapiFilter.DisableFba(directoryEntry2);
                            uint num = 0U;
                            using (MultiValuedProperty <AuthenticationMethod> .Enumerator enumerator2 = adowaVirtualDirectory.InternalAuthenticationMethods.GetEnumerator())
                            {
                                while (enumerator2.MoveNext())
                                {
                                    switch (enumerator2.Current)
                                    {
                                    case AuthenticationMethod.Basic:
                                        num |= 2U;
                                        break;

                                    case AuthenticationMethod.Digest:
                                        num |= 16U;
                                        break;

                                    case AuthenticationMethod.Ntlm:
                                        num |= 4U;
                                        break;

                                    case AuthenticationMethod.Fba:
                                        OwaIsapiFilter.EnableFba(directoryEntry2);
                                        break;
                                    }
                                }
                            }
                            arrayList.Add(new MetabaseProperty("AuthFlags", num, true));
                            IisUtility.SetProperties(directoryEntry2, arrayList);
                            IisUtility.AssignApplicationPool(directoryEntry2, text);
                        }
                    }
                }
            }
        }
示例#9
0
        public static string ConvertToString(object item, Type type)
        {
            if (item != null)
            {
                type = (type ?? item.GetType());
                if (type == typeof(ExchangeObjectVersion))
                {
                    return(((ExchangeObjectVersion)item).ToInt64().ToString());
                }
                if (typeof(Enum).IsAssignableFrom(type))
                {
                    return(item.ToString());
                }
                if (type == typeof(ProxyAddressCollection))
                {
                    ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)item;
                    if (proxyAddressCollection.Count <= 0)
                    {
                        goto IL_21C;
                    }
                    StringBuilder stringBuilder = new StringBuilder();
                    using (MultiValuedProperty <ProxyAddress> .Enumerator enumerator = proxyAddressCollection.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ProxyAddress item2 = enumerator.Current;
                            stringBuilder.Append(SearchHelper.ConvertToString(item2, typeof(ProxyAddress)));
                            stringBuilder.Append(',');
                        }
                        goto IL_21C;
                    }
                }
                if (type == typeof(ADObjectId))
                {
                    return(SearchHelper.ConvertToString(((ADObjectId)item).GetBytes(), typeof(byte[])));
                }
                if (type == typeof(OrganizationId))
                {
                    return(SearchHelper.ConvertToString(((OrganizationId)item).GetBytes(Encoding.Unicode), typeof(byte[])));
                }
                if (type == typeof(string))
                {
                    return((string)item);
                }
                if (type == typeof(ProxyAddress))
                {
                    return(((ProxyAddress)item).ProxyAddressString);
                }
                if (type == typeof(SmtpAddress))
                {
                    return(SearchHelper.ConvertToString(((SmtpAddress)item).GetBytes(), typeof(byte[])));
                }
                if (type == typeof(Guid))
                {
                    return(((Guid)item).ToString());
                }
                if (type == typeof(SmtpDomain))
                {
                    return(((SmtpDomain)item).ToString());
                }
                if (type == typeof(SecurityIdentifier))
                {
                    return(((SecurityIdentifier)item).ToString());
                }
                if (type == typeof(byte[]))
                {
                    return(Convert.ToBase64String((byte[])item));
                }
                return(ValueConvertor.ConvertValueToString(item, null));
            }
IL_21C:
            return(string.Empty);
        }
示例#10
0
        private static AuthenticationMethod ConvertAuthenticationMethods(MultiValuedProperty <AuthenticationMethod> configMethods)
        {
            AuthenticationMethod authenticationMethod = AuthenticationMethod.None;

            using (MultiValuedProperty <AuthenticationMethod> .Enumerator enumerator = configMethods.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    switch (enumerator.Current)
                    {
                    case AuthenticationMethod.Basic:
                        authenticationMethod |= AuthenticationMethod.Basic;
                        break;

                    case AuthenticationMethod.Digest:
                        authenticationMethod |= AuthenticationMethod.Digest;
                        break;

                    case AuthenticationMethod.Ntlm:
                        authenticationMethod |= AuthenticationMethod.Ntlm;
                        break;

                    case AuthenticationMethod.Fba:
                        authenticationMethod |= AuthenticationMethod.Fba;
                        break;

                    case AuthenticationMethod.WindowsIntegrated:
                        authenticationMethod |= AuthenticationMethod.WindowsIntegrated;
                        break;

                    case AuthenticationMethod.LiveIdFba:
                        authenticationMethod |= AuthenticationMethod.LiveIdFba;
                        break;

                    case AuthenticationMethod.LiveIdBasic:
                        authenticationMethod |= AuthenticationMethod.LiveIdBasic;
                        break;

                    case AuthenticationMethod.WSSecurity:
                        authenticationMethod |= AuthenticationMethod.WSSecurity;
                        break;

                    case AuthenticationMethod.Certificate:
                        authenticationMethod |= AuthenticationMethod.Certificate;
                        break;

                    case AuthenticationMethod.NegoEx:
                        authenticationMethod |= AuthenticationMethod.NegoEx;
                        break;

                    case AuthenticationMethod.OAuth:
                        authenticationMethod |= AuthenticationMethod.OAuth;
                        break;

                    case AuthenticationMethod.Adfs:
                        authenticationMethod |= AuthenticationMethod.Adfs;
                        break;

                    case AuthenticationMethod.Kerberos:
                        authenticationMethod |= AuthenticationMethod.Kerberos;
                        break;

                    case AuthenticationMethod.Negotiate:
                        authenticationMethod |= AuthenticationMethod.Negotiate;
                        break;

                    case AuthenticationMethod.LiveIdNegotiate:
                        authenticationMethod |= AuthenticationMethod.LiveIdNegotiate;
                        break;
                    }
                }
            }
            return(authenticationMethod);
        }
示例#11
0
        private static List <ADObjectId> GetMasterServerIdsForDatabase(IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup, IADDatabase database, out Exception exception)
        {
            IADToplogyConfigurationSession adSession = dagLookup.AdSession;
            List <ADObjectId> list = new List <ADObjectId>(16);

            exception = null;
            try
            {
                ADObjectId masterServerOrAvailabilityGroup = database.MasterServerOrAvailabilityGroup;
                if (masterServerOrAvailabilityGroup == null)
                {
                    return(null);
                }
                if (masterServerOrAvailabilityGroup.IsDeleted)
                {
                    ActiveManagerUtil.Tracer.TraceError <string, string>(0L, "GetMasterServerIdsForDatabase() for database '{0}' found the MasterServerOrAvailabilityGroup to be a link to a deleted object. Returning an empty collection. MasterServerOrAvailabilityGroup = [{1}]", database.Name, masterServerOrAvailabilityGroup.Name);
                    return(null);
                }
                IADDatabaseAvailabilityGroup iaddatabaseAvailabilityGroup = dagLookup.ReadAdObjectByObjectId(masterServerOrAvailabilityGroup);
                if (iaddatabaseAvailabilityGroup != null)
                {
                    list.AddRange(iaddatabaseAvailabilityGroup.Servers);
                }
                else
                {
                    IADDatabase iaddatabase = adSession.ReadADObject <IADDatabase>(database.Id);
                    ADObjectId  adobjectId  = null;
                    if (iaddatabase != null)
                    {
                        adobjectId = iaddatabase.MasterServerOrAvailabilityGroup;
                        if (!masterServerOrAvailabilityGroup.Equals(adobjectId))
                        {
                            ActiveManagerUtil.Tracer.TraceDebug <ADObjectId, ADObjectId>(0L, "GetMasterServerIdsForDatabase() re-read the Database object and it made a difference. MasterServerOrDag was {0} and is now {1}", masterServerOrAvailabilityGroup, adobjectId);
                            iaddatabaseAvailabilityGroup = adSession.ReadADObject <IADDatabaseAvailabilityGroup>(adobjectId);
                            if (iaddatabaseAvailabilityGroup == null)
                            {
                                goto IL_165;
                            }
                            HashSet <string> hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                            foreach (string fqdn in iaddatabaseAvailabilityGroup.StoppedMailboxServers)
                            {
                                hashSet.Add(MachineName.GetNodeNameFromFqdn(fqdn));
                            }
                            using (MultiValuedProperty <ADObjectId> .Enumerator enumerator2 = iaddatabaseAvailabilityGroup.Servers.GetEnumerator())
                            {
                                while (enumerator2.MoveNext())
                                {
                                    ADObjectId adobjectId2 = enumerator2.Current;
                                    if (!hashSet.Contains(adobjectId2.Name))
                                    {
                                        list.Add(adobjectId2);
                                    }
                                }
                                goto IL_165;
                            }
                        }
                        ActiveManagerUtil.Tracer.TraceDebug <ADObjectId>(0L, "GetMasterServerIdsForDatabase: re-reading the Database object made no difference. MasterServerOrDag is still {0}.", masterServerOrAvailabilityGroup);
                    }
IL_165:
                    if (iaddatabaseAvailabilityGroup == null && adobjectId != null)
                    {
                        IADServer iadserver = adSession.ReadMiniServer(adobjectId);
                        if (iadserver != null)
                        {
                            list.Add(adobjectId);
                        }
                    }
                }
            }
            catch (DataValidationException ex)
            {
                exception = ex;
            }
            catch (ADTransientException ex2)
            {
                exception = ex2;
            }
            catch (ADOperationException ex3)
            {
                exception = ex3;
            }
            catch (ADTopologyUnexpectedException ex4)
            {
                exception = ex4;
            }
            catch (ADTopologyPermanentException ex5)
            {
                exception = ex5;
            }
            if (exception != null)
            {
                ActiveManagerUtil.Tracer.TraceDebug <Exception>(0L, "GetMasterServerIdsForDatabase() got exception: {0}", exception);
                list = null;
            }
            return(list);
        }
示例#12
0
        internal static HashSet <string> GetAllSmtpProxiesForRecipientFilters(ICollection <string> filters, IRecipientSession session)
        {
            HashSet <string> hashSet = null;

            if (filters == null || filters.Count == 0)
            {
                return(null);
            }
            int num = Math.Min(filters.Count, 256);
            List <ProxyAddress> list = new List <ProxyAddress>(num);

            foreach (string text in filters)
            {
                if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text) && SmtpAddress.NullReversePath != (SmtpAddress)text)
                {
                    ExTraceGlobals.TaskTracer.TraceDebug <string>(0L, "Adding filter '{0}' for proxy lookup.", text);
                    list.Add(ProxyAddress.Parse(text));
                    if (list.Count > num)
                    {
                        ExTraceGlobals.TaskTracer.TraceDebug <int>(0L, "Not going to get proxy for all filters.  Total number of filters is {0}.", filters.Count);
                        break;
                    }
                }
            }
            if (list.Count == 0)
            {
                ExTraceGlobals.TaskTracer.TraceDebug(0L, "No filters need to be looked up, none are addresses.");
                return(null);
            }
            ProxyAddress[]        array  = list.ToArray();
            Result <ADRawEntry>[] array2 = session.FindByProxyAddresses(array, Utils.emailAddressesProperty);
            if (array2 == null)
            {
                return(null);
            }
            int i = 0;

            while (i < array2.Length)
            {
                Result <ADRawEntry> result = array2[i];
                if (result.Data == null)
                {
                    goto IL_1A5;
                }
                ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)result.Data[ADRecipientSchema.EmailAddresses];
                if (proxyAddressCollection != null)
                {
                    using (MultiValuedProperty <ProxyAddress> .Enumerator enumerator2 = proxyAddressCollection.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            ProxyAddress proxyAddress = enumerator2.Current;
                            if (ProxyAddressPrefix.Smtp.Equals(proxyAddress.Prefix) && !string.Equals(proxyAddress.AddressString, list[i].AddressString, StringComparison.OrdinalIgnoreCase))
                            {
                                if (hashSet == null)
                                {
                                    hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                                }
                                hashSet.Add(proxyAddress.AddressString);
                            }
                        }
                        goto IL_1C2;
                    }
                    goto IL_1A5;
                }
IL_1C2:
                i++;
                continue;
IL_1A5:
                ExTraceGlobals.TaskTracer.TraceDebug <ProxyAddress, ProviderError>(0L, "{0} cannot be found up due to {1}.", array[i], result.Error);
                goto IL_1C2;
            }
            return(hashSet);
        }
        private CultureInfo SelectApproverCommonCulture(ADRawEntry[] approvers)
        {
            int num = 0;
            Dictionary <int, int>    dictionary  = new Dictionary <int, int>();
            Dictionary <string, int> dictionary2 = new Dictionary <string, int>();
            int         culture     = 0;
            int         num2        = 0;
            int         culture2    = 0;
            int         num3        = 0;
            string      value       = string.Empty;
            CultureInfo cultureInfo = null;
            int         i           = 0;

            while (i < approvers.Length)
            {
                MultiValuedProperty <CultureInfo> multiValuedProperty = (MultiValuedProperty <CultureInfo>)approvers[i][ADUserSchema.Languages];
                if (multiValuedProperty.Count > 0)
                {
                    if (cultureInfo == null)
                    {
                        cultureInfo = multiValuedProperty[0];
                    }
                    List <string> list = new List <string>();
                    using (MultiValuedProperty <CultureInfo> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            CultureInfo cultureInfo2 = enumerator.Current;
                            if (dictionary.ContainsKey(cultureInfo2.LCID))
                            {
                                Dictionary <int, int> dictionary3;
                                int lcid;
                                (dictionary3 = dictionary)[lcid = cultureInfo2.LCID] = dictionary3[lcid] + 1;
                            }
                            else
                            {
                                dictionary.Add(cultureInfo2.LCID, 1);
                            }
                            if (num2 < dictionary[cultureInfo2.LCID])
                            {
                                culture = cultureInfo2.LCID;
                                num2    = dictionary[cultureInfo2.LCID];
                            }
                            if (!list.Contains(cultureInfo2.TwoLetterISOLanguageName))
                            {
                                list.Add(cultureInfo2.TwoLetterISOLanguageName);
                                if (dictionary2.ContainsKey(cultureInfo2.TwoLetterISOLanguageName))
                                {
                                    Dictionary <string, int> dictionary4;
                                    string twoLetterISOLanguageName;
                                    (dictionary4 = dictionary2)[twoLetterISOLanguageName = cultureInfo2.TwoLetterISOLanguageName] = dictionary4[twoLetterISOLanguageName] + 1;
                                }
                                else
                                {
                                    dictionary2.Add(cultureInfo2.TwoLetterISOLanguageName, 1);
                                }
                                if (num3 < dictionary2[cultureInfo2.TwoLetterISOLanguageName])
                                {
                                    num3 = dictionary2[cultureInfo2.TwoLetterISOLanguageName];
                                    if (!cultureInfo2.TwoLetterISOLanguageName.Equals(value, StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        value    = cultureInfo2.TwoLetterISOLanguageName;
                                        culture2 = cultureInfo2.LCID;
                                    }
                                }
                            }
                        }
                        goto IL_19F;
                    }
                    goto IL_19B;
                }
                goto IL_19B;
                IL_19F:
                i++;
                continue;
                IL_19B:
                num++;
                goto IL_19F;
            }
            if (num == approvers.Length)
            {
                return(null);
            }
            if ((double)num2 - (double)(approvers.Length - num) / 2.0 >= 0.0)
            {
                return(new CultureInfo(culture));
            }
            if ((double)num3 - (double)(approvers.Length - num) / 2.0 >= 0.0)
            {
                return(new CultureInfo(culture2));
            }
            MultiValuedProperty <CultureInfo> multiValuedProperty2 = (MultiValuedProperty <CultureInfo>) this.requester[ADUserSchema.Languages];

            foreach (CultureInfo cultureInfo3 in multiValuedProperty2)
            {
                foreach (int num4 in dictionary.Keys)
                {
                    if (num4 == cultureInfo3.LCID)
                    {
                        return(cultureInfo3);
                    }
                }
            }
            foreach (CultureInfo cultureInfo4 in multiValuedProperty2)
            {
                foreach (string value2 in dictionary2.Keys)
                {
                    if (cultureInfo4.TwoLetterISOLanguageName.Equals(value2, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(cultureInfo4);
                    }
                }
            }
            return(cultureInfo);
        }
        // Token: 0x06001869 RID: 6249 RVA: 0x0008F2EC File Offset: 0x0008D4EC
        private void ProcessGet()
        {
            using (this.user.Context.Tracker.Start(TimeId.UserInformationSettingsProcessGet))
            {
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Processing UserInformationSetting - Get");
                XmlNode xmlNode  = base.Response.OwnerDocument.CreateElement("Get", "Settings:");
                bool    flag     = this.version > 140;
                XmlNode xmlNode2 = null;
                XmlNode xmlNode3 = null;
                if (flag)
                {
                    xmlNode2 = base.Response.OwnerDocument.CreateElement("Accounts", "Settings:");
                    xmlNode3 = base.Response.OwnerDocument.CreateElement("Account", "Settings:");
                }
                XmlNode           xmlNode4 = base.Response.OwnerDocument.CreateElement("EmailAddresses", "Settings:");
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(this.user.OrganizationId), 203, "ProcessGet", "f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\UserInformationSetting.cs");
                ADRecipient       adrecipient = tenantOrRootOrgRecipientSession.FindByExchangeGuid(this.user.ADUser.ExchangeGuid);
                base.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, tenantOrRootOrgRecipientSession.LastUsedDc);
                if (adrecipient != null && adrecipient.EmailAddresses != null)
                {
                    using (MultiValuedProperty <ProxyAddress> .Enumerator enumerator = adrecipient.EmailAddresses.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ProxyAddress proxyAddress = enumerator.Current;
                            AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.RequestsTracer, this, "Found proxy address {0}!", proxyAddress.AddressString);
                            if (SmtpAddress.IsValidSmtpAddress(proxyAddress.AddressString))
                            {
                                if (this.version > 140 && proxyAddress.IsPrimaryAddress && proxyAddress.Prefix.DisplayName == "SMTP")
                                {
                                    AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.RequestsTracer, this, "Found valid Primary Smtp proxy address {0}!", proxyAddress.AddressString);
                                    XmlNode xmlNode5 = base.Response.OwnerDocument.CreateElement("PrimarySmtpAddress", "Settings:");
                                    xmlNode5.InnerText = proxyAddress.AddressString;
                                    xmlNode4.AppendChild(xmlNode5);
                                }
                                else
                                {
                                    AirSyncDiagnostics.TraceInfo <string>(ExTraceGlobals.RequestsTracer, this, "Found valid Smtp proxy address {0}!", proxyAddress.AddressString);
                                    XmlNode xmlNode6 = base.Response.OwnerDocument.CreateElement("SmtpAddress", "Settings:");
                                    xmlNode6.InnerText = proxyAddress.AddressString;
                                    xmlNode4.AppendChild(xmlNode6);
                                }
                            }
                        }
                        goto IL_263;
                    }
                }
                AirSyncDiagnostics.TraceDebug <bool, bool>(ExTraceGlobals.RequestsTracer, this, "fullRecipient fullRecipient.EmailAddresses is null! fullRecipient == null: {0}, fullRecipient.EmailAddresses == null : {1}", adrecipient == null, adrecipient != null && adrecipient.EmailAddresses == null);
IL_263:
                if (flag)
                {
                    xmlNode3.AppendChild(xmlNode4);
                    xmlNode2.AppendChild(xmlNode3);
                }
                if (flag)
                {
                    List <AggregationSubscription> allSubscriptions = SubscriptionManager.GetAllSubscriptions(this.mailboxSession, AggregationSubscriptionType.AllEMail);
                    foreach (AggregationSubscription aggregationSubscription in allSubscriptions)
                    {
                        PimAggregationSubscription pimAggregationSubscription = aggregationSubscription as PimAggregationSubscription;
                        if (pimAggregationSubscription == null)
                        {
                            AirSyncDiagnostics.TraceInfo <Guid>(ExTraceGlobals.RequestsTracer, this, "Found AggregationSubscription that was not a PimAggregationSubscription {0}!", pimAggregationSubscription.SubscriptionGuid);
                        }
                        else
                        {
                            AirSyncDiagnostics.TraceInfo <Guid>(ExTraceGlobals.RequestsTracer, this, "Found valid subscription {0}!", pimAggregationSubscription.SubscriptionGuid);
                            XmlNode xmlNode7 = base.Response.OwnerDocument.CreateElement("Account", "Settings:");
                            XmlNode xmlNode8 = base.Response.OwnerDocument.CreateElement("AccountId", "Settings:");
                            xmlNode8.InnerText = pimAggregationSubscription.SubscriptionGuid.ToString();
                            xmlNode7.AppendChild(xmlNode8);
                            XmlNode xmlNode9 = base.Response.OwnerDocument.CreateElement("AccountName", "Settings:");
                            xmlNode9.InnerText = pimAggregationSubscription.Name;
                            xmlNode7.AppendChild(xmlNode9);
                            XmlNode xmlNode10 = base.Response.OwnerDocument.CreateElement("UserDisplayName", "Settings:");
                            xmlNode10.InnerText = pimAggregationSubscription.UserDisplayName;
                            xmlNode7.AppendChild(xmlNode10);
                            if (!pimAggregationSubscription.SendAsCapable || !SubscriptionManager.IsValidForSendAs(pimAggregationSubscription.SendAsState, pimAggregationSubscription.Status))
                            {
                                XmlNode newChild = base.Response.OwnerDocument.CreateElement("SendDisabled", "Settings:");
                                xmlNode7.AppendChild(newChild);
                            }
                            XmlNode xmlNode11 = base.Response.OwnerDocument.CreateElement("PrimarySmtpAddress", "Settings:");
                            xmlNode11.InnerText = pimAggregationSubscription.UserEmailAddress.ToString();
                            xmlNode4            = base.Response.OwnerDocument.CreateElement("EmailAddresses", "Settings:");
                            xmlNode4.AppendChild(xmlNode11);
                            xmlNode7.AppendChild(xmlNode4);
                            xmlNode2.AppendChild(xmlNode7);
                        }
                    }
                }
                XmlNode xmlNode12 = base.Response.OwnerDocument.CreateElement("Status", "Settings:");
                XmlNode xmlNode13 = xmlNode12;
                int     num       = (int)this.status;
                xmlNode13.InnerText = num.ToString(CultureInfo.InvariantCulture);
                base.Response.AppendChild(xmlNode12);
                if (flag)
                {
                    xmlNode.AppendChild(xmlNode2);
                }
                else
                {
                    xmlNode.AppendChild(xmlNode4);
                }
                base.Response.AppendChild(xmlNode);
                AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "Done processing UserInformationSetting - Get.");
            }
        }
示例#15
0
        internal AutoAttendantSettings GetCurrentSettings(out HolidaySchedule holidaySettings, ref bool isBusinessHour)
        {
            ExTimeZone exTimeZone = null;
            string     timeZone   = this.TimeZone;

            if (string.IsNullOrEmpty(timeZone))
            {
                ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string>((long)this.GetHashCode(), "AA [Name = \"{0}\"] TZ Id = empty string, defaulting to using Current machine timezone", base.Name);
                exTimeZone = ExTimeZone.CurrentTimeZone;
            }
            else if (!ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(this.TimeZone, out exTimeZone))
            {
                throw new InvalidOperationException(DirectoryStrings.InvalidTimeZoneId(this.TimeZone));
            }
            ExDateTime utcNow     = ExDateTime.UtcNow;
            ExDateTime exDateTime = exTimeZone.ConvertDateTime(utcNow);

            ExTraceGlobals.UMAutoAttendantTracer.TraceDebug((long)this.GetHashCode(), "AA [Name = \"{0}\"] UTC = {1} LOCAL = {2} TZ Id = {3}", new object[]
            {
                base.Name,
                utcNow.ToString("R"),
                exDateTime.ToString("R"),
                this.TimeZone
            });
            AutoAttendantSettings autoAttendantSettings            = null;
            HolidaySchedule       holidaySchedule                  = null;
            MultiValuedProperty <HolidaySchedule> holidaySchedule2 = this.HolidaySchedule;

            if (holidaySchedule2 != null && holidaySchedule2.Count > 0)
            {
                using (MultiValuedProperty <HolidaySchedule> .Enumerator enumerator = holidaySchedule2.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        HolidaySchedule holidaySchedule3 = enumerator.Current;
                        if ((ExDateTime)holidaySchedule3.StartDate.Date <= exDateTime.Date && (ExDateTime)holidaySchedule3.EndDate.Date >= exDateTime.Date)
                        {
                            ExTraceGlobals.UMAutoAttendantTracer.TraceDebug((long)this.GetHashCode(), "AA: {0} Call Time: {1} Matched with holiday: {2} {3}-{4}", new object[]
                            {
                                base.Name,
                                exDateTime.ToString("R"),
                                holidaySchedule3.Name,
                                holidaySchedule3.StartDate.ToString("R"),
                                holidaySchedule3.EndDate.ToString("R")
                            });
                            autoAttendantSettings = this.AfterHourSettings;
                            isBusinessHour        = false;
                            if (holidaySchedule == null)
                            {
                                holidaySchedule = holidaySchedule3;
                            }
                            else if (holidaySchedule3.StartDate.Date > holidaySchedule.StartDate.Date)
                            {
                                holidaySchedule = holidaySchedule3;
                            }
                            else if (holidaySchedule3.StartDate.Date == holidaySchedule.StartDate.Date)
                            {
                                int num = string.Compare(holidaySchedule.Name, holidaySchedule3.Name, StringComparison.OrdinalIgnoreCase);
                                holidaySchedule = ((num > 0) ? holidaySchedule3 : holidaySchedule);
                            }
                        }
                    }
                    goto IL_290;
                }
            }
            ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} No holiday schedule found", base.Name, exDateTime.ToString("R"));
IL_290:
            holidaySettings = holidaySchedule;
            if (autoAttendantSettings != null)
            {
                return(autoAttendantSettings);
            }
            autoAttendantSettings = this.AfterHourSettings;
            isBusinessHour        = false;
            foreach (ScheduleInterval scheduleInterval in this.BusinessHoursSchedule)
            {
                ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} BusinessHour: {2}", base.Name, exDateTime.ToString("R"), scheduleInterval.ToString());
                if (scheduleInterval.Contains(new WeekDayAndTime((DateTime)exDateTime)))
                {
                    ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} Matched with BusinessHour: {2}", base.Name, exDateTime.ToString("R"), scheduleInterval.ToString());
                    isBusinessHour        = true;
                    autoAttendantSettings = this.BusinessHourSettings;
                    break;
                }
            }
            if (!isBusinessHour)
            {
                ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} Returning AfterHour settings", base.Name, exDateTime.ToString("R"));
            }
            return(autoAttendantSettings);
        }
示例#16
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            Exception exception = null;

            if (!ReplicationTopology.TryLoadLocalSiteTopology(this.DomainController, out this.replicationTopology, out exception))
            {
                this.WriteErrorAndMonitoringEvent(exception, ExchangeErrorCategory.ServerOperation, null, 1002, "MSExchange Monitoring EdgeSynchronization");
                return;
            }
            if (this.replicationTopology.EdgeSyncServiceConfig == null)
            {
                this.ReportStatus(new EdgeSubscriptionStatus(string.Empty)
                {
                    SyncStatus    = ValidationStatus.NoSyncConfigured,
                    FailureDetail = Strings.EdgeSyncServiceConfigMissing((this.replicationTopology.LocalSite != null) ? this.replicationTopology.LocalSite.Name : string.Empty)
                });
                return;
            }
            if (this.replicationTopology.SiteEdgeServers.Count == 0)
            {
                this.ReportStatus(new EdgeSubscriptionStatus(string.Empty)
                {
                    SyncStatus    = ValidationStatus.NoSyncConfigured,
                    FailureDetail = Strings.NoSubscription((this.replicationTopology.LocalSite != null) ? this.replicationTopology.LocalSite.Name : string.Empty)
                });
                return;
            }
            List <EdgeSubscriptionStatus> list = new List <EdgeSubscriptionStatus>(this.replicationTopology.SiteEdgeServers.Count);

            foreach (Server server in this.replicationTopology.SiteEdgeServers)
            {
                if (string.IsNullOrEmpty(this.TargetServer) || this.TargetServer.Equals(server.Name, StringComparison.OrdinalIgnoreCase) || this.TargetServer.Equals(server.Fqdn))
                {
                    EdgeSubscriptionStatus edgeSubscriptionStatus = new EdgeSubscriptionStatus(server.Name);
                    EdgeConnectionInfo     edgeConnectionInfo     = new EdgeConnectionInfo(this.replicationTopology, server);
                    if (edgeConnectionInfo.EdgeConnection == null)
                    {
                        goto IL_3D5;
                    }
                    edgeSubscriptionStatus.LeaseHolder               = edgeConnectionInfo.LeaseHolder;
                    edgeSubscriptionStatus.LeaseType                 = edgeConnectionInfo.LeaseType;
                    edgeSubscriptionStatus.LeaseExpiryUtc            = edgeConnectionInfo.LeaseExpiry;
                    edgeSubscriptionStatus.LastSynchronizedUtc       = edgeConnectionInfo.LastSynchronizedDate;
                    edgeSubscriptionStatus.CredentialRecords.Records = CredentialRecordsLoader.Load(server);
                    edgeSubscriptionStatus.CookieRecords.Load(edgeConnectionInfo.Cookies);
                    if (this.VerifyRecipient != null)
                    {
                        RecipientValidator recipientValidator = new RecipientValidator(this.replicationTopology);
                        edgeSubscriptionStatus.RecipientStatus = recipientValidator.ValidateOneRecipient(edgeConnectionInfo, this.VerifyRecipient.ProxyAddressString);
                    }
                    else if (this.InitializeSubscriptionStatus(edgeConnectionInfo, ref edgeSubscriptionStatus))
                    {
                        if (!(DateTime.UtcNow > edgeSubscriptionStatus.LeaseExpiryUtc + this.GetAlertPaddingTimeSpan()))
                        {
                            bool flag = false;
                            if (edgeSubscriptionStatus.CookieRecords.Records.Count > 0)
                            {
                                using (MultiValuedProperty <CookieRecord> .Enumerator enumerator2 = edgeSubscriptionStatus.CookieRecords.Records.GetEnumerator())
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        CookieRecord cookieRecord = enumerator2.Current;
                                        if (DateTime.UtcNow > cookieRecord.LastUpdated + this.GetAlertPaddingTimeSpan())
                                        {
                                            flag = true;
                                        }
                                    }
                                    goto IL_2EC;
                                }
                                goto IL_2E9;
                            }
                            goto IL_2E9;
IL_2EC:
                            if (!flag)
                            {
                                edgeSubscriptionStatus.SyncStatus = ValidationStatus.Normal;
                                goto IL_313;
                            }
                            edgeSubscriptionStatus.SyncStatus    = ValidationStatus.Failed;
                            edgeSubscriptionStatus.FailureDetail = Strings.CookieNotUpdated;
                            goto IL_313;
IL_2E9:
                            flag = true;
                            goto IL_2EC;
                        }
                        edgeSubscriptionStatus.SyncStatus    = ValidationStatus.Failed;
                        edgeSubscriptionStatus.FailureDetail = Strings.LeaseExpired;
IL_313:
                        if (this.fullCompareMode)
                        {
                            try
                            {
                                this.LoadValidators();
                                edgeSubscriptionStatus.TransportConfigStatus       = this.transportConfigValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.TransportServerStatus       = this.transportServerValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.AcceptedDomainStatus        = this.acceptedDomainValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.RemoteDomainStatus          = this.remoteDomainValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.MessageClassificationStatus = this.messageClassificationValidator.Validate(edgeConnectionInfo);
                                edgeSubscriptionStatus.SendConnectorStatus         = this.sendConnectorValidator.Validate(edgeConnectionInfo);
                                if (!this.ExcludeRecipientTest.IsPresent)
                                {
                                    edgeSubscriptionStatus.RecipientStatus = this.recipientValidator.Validate(edgeConnectionInfo);
                                }
                                goto IL_3F5;
                            }
                            catch (ExDirectoryException ex)
                            {
                                edgeSubscriptionStatus.FailureDetail = ex.Message;
                                goto IL_3F5;
                            }
                            goto IL_3D5;
                        }
                    }
IL_3F5:
                    base.WriteObject(edgeSubscriptionStatus);
                    list.Add(edgeSubscriptionStatus);
                    continue;
IL_3D5:
                    edgeSubscriptionStatus.SyncStatus    = ValidationStatus.Failed;
                    edgeSubscriptionStatus.FailureDetail = Strings.SubscriptionConnectionError(edgeConnectionInfo.FailureDetail);
                    goto IL_3F5;
                }
            }
            if (this.MonitoringContext)
            {
                this.ReportMomStatus(list);
            }
            TaskLogger.LogExit();
        }
        public void ApplyConfiguration(ISearchPolicy policy, ref SearchMailboxesInputs inputs)
        {
            Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Inputs:", inputs);
            if (inputs.Sources != null && inputs.Sources.Count > 0 && inputs.Sources[0].SourceType == SourceType.SavedSearchId)
            {
                inputs.SearchConfigurationId = inputs.Sources[0].ReferenceId;
                inputs.Sources.RemoveAt(0);
                Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Found In Sources SearchId:", inputs.SearchConfigurationId);
            }
            if (!string.IsNullOrWhiteSpace(inputs.SearchConfigurationId))
            {
                Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Found SearchId:", inputs.SearchConfigurationId);
                IDiscoverySearchDataProvider discoverySearchDataProvider = new DiscoverySearchDataProvider(policy.RecipientSession.SessionSettings.CurrentOrganizationId);
                MailboxDiscoverySearch       mailboxDiscoverySearch      = discoverySearchDataProvider.Find <MailboxDiscoverySearch>(inputs.SearchConfigurationId);
                if (mailboxDiscoverySearch == null)
                {
                    Recorder.Trace(5L, TraceType.ErrorTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Invalid SearchId:", inputs.SearchConfigurationId);
                    throw new SearchException(KnownError.ErrorInvalidSearchId);
                }
                inputs.SearchQuery = mailboxDiscoverySearch.CalculatedQuery;
                inputs.Language    = mailboxDiscoverySearch.Language;
                Recorder.Trace(5L, TraceType.InfoTrace, new object[]
                {
                    "ArbitrationSearchConfigurationProvider.ApplyConfiguration Query:",
                    inputs.SearchQuery,
                    "Language:",
                    inputs.Language
                });
                if (inputs.Sources == null || inputs.Sources.Count == 0)
                {
                    Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration No Sources");
                    inputs.Sources = new List <SearchSource>();
                    if (mailboxDiscoverySearch.Sources != null && mailboxDiscoverySearch.Sources.Count > 0)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration Mailboxes:", mailboxDiscoverySearch.Sources.Count);
                        using (MultiValuedProperty <string> .Enumerator enumerator = mailboxDiscoverySearch.Sources.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                string referenceId = enumerator.Current;
                                inputs.Sources.Add(new SearchSource
                                {
                                    ReferenceId    = referenceId,
                                    SourceLocation = SourceLocation.All,
                                    SourceType     = SourceType.AutoDetect
                                });
                            }
                            goto IL_234;
                        }
                    }
                    if (mailboxDiscoverySearch.Version == SearchObjectVersion.Original || mailboxDiscoverySearch.AllSourceMailboxes)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration AllMailboxes");
                        inputs.Sources.Add(new SearchSource
                        {
                            SourceLocation = SourceLocation.All,
                            SourceType     = SourceType.AllMailboxes
                        });
                    }
IL_234:
                    if (mailboxDiscoverySearch.PublicFolderSources != null && mailboxDiscoverySearch.PublicFolderSources.Count > 0)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration PublicFoiders:", mailboxDiscoverySearch.PublicFolderSources.Count);
                        using (MultiValuedProperty <string> .Enumerator enumerator2 = mailboxDiscoverySearch.PublicFolderSources.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                string referenceId2 = enumerator2.Current;
                                inputs.Sources.Add(new SearchSource
                                {
                                    ReferenceId    = referenceId2,
                                    SourceLocation = SourceLocation.All,
                                    SourceType     = SourceType.PublicFolder
                                });
                            }
                            return;
                        }
                    }
                    if (mailboxDiscoverySearch.AllPublicFolderSources)
                    {
                        Recorder.Trace(5L, TraceType.InfoTrace, "ArbitrationSearchConfigurationProvider.ApplyConfiguration AllPublicFoiders");
                        inputs.Sources.Add(new SearchSource
                        {
                            SourceLocation = SourceLocation.PrimaryOnly,
                            SourceType     = SourceType.AllPublicFolders
                        });
                    }
                }
            }
        }
示例#18
0
        internal bool?IsDelegateOfPrincipal(Participant principal, Participant delegateParticipant)
        {
            if (this.outboundOptions == null || this.outboundOptions.RecipientCache == null)
            {
                return(null);
            }
            ProxyAddress proxyAddressForParticipant = OutboundAddressCache.GetProxyAddressForParticipant(principal);

            if (proxyAddressForParticipant == null)
            {
                return(null);
            }
            Result <ADRawEntry> result;

            if (this.outboundOptions.RecipientCache.TryGetValue(proxyAddressForParticipant, out result))
            {
                ADRawEntry data = result.Data;
                if (data == null)
                {
                    return(null);
                }
                MultiValuedProperty <ADObjectId> multiValuedProperty = data[ADRecipientSchema.GrantSendOnBehalfTo] as MultiValuedProperty <ADObjectId>;
                if (multiValuedProperty == null || multiValuedProperty.Count == 0)
                {
                    return(new bool?(false));
                }
                ProxyAddress proxyAddressForParticipant2 = OutboundAddressCache.GetProxyAddressForParticipant(delegateParticipant);
                if (proxyAddressForParticipant2 == null)
                {
                    return(null);
                }
                Result <ADRawEntry> result2;
                if (this.outboundOptions.RecipientCache.TryGetValue(proxyAddressForParticipant2, out result2))
                {
                    ADRawEntry data2 = result2.Data;
                    if (data2 == null)
                    {
                        return(null);
                    }
                    ADObjectId adobjectId = data2[ADObjectSchema.Id] as ADObjectId;
                    if (adobjectId == null)
                    {
                        goto IL_13A;
                    }
                    using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ADObjectId x = enumerator.Current;
                            if (ADObjectId.Equals(x, adobjectId))
                            {
                                return(new bool?(true));
                            }
                        }
                        goto IL_13A;
                    }
                }
                return(null);
            }
IL_13A:
            return(new bool?(false));
        }
示例#19
0
        private static void InternalUpdateRecipients(IEnumerator <ADRecipient> pagedReaderGC, AddressBookBase abb, QueryFilter removeFilter, List <Guid> abbObjectGuidList, string domainControllerFqdn, IRecipientSession globalCatalogSession, Task.TaskWarningLoggingDelegate writeWarning, WriteProgress writeProgress, Cmdlet cmdlet, ref int currentPercent)
        {
            if (cmdlet != null && cmdlet.Stopping)
            {
                return;
            }
            string domainControllerDomainName = null;

            if (!string.IsNullOrEmpty(domainControllerFqdn))
            {
                int num = domainControllerFqdn.IndexOf(".");
                if (0 <= num)
                {
                    domainControllerDomainName = domainControllerFqdn.Substring(num + 1);
                }
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.PartiallyConsistent, globalCatalogSession.SessionSettings, 300, "InternalUpdateRecipients", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\AddressBook\\UpdateAddressBook.cs");

            tenantOrRootOrgRecipientSession.EnforceDefaultScope         = false;
            tenantOrRootOrgRecipientSession.EnforceContainerizedScoping = false;
            string text = null;

            while (pagedReaderGC.MoveNext())
            {
                ADRecipient adrecipient = pagedReaderGC.Current;
                if (cmdlet != null && cmdlet.Stopping)
                {
                    return;
                }
                ADRecipient adrecipient2 = adrecipient;
                try
                {
                    SystemConfigurationTasksHelper.PrepareDomainControllerRecipientSessionForUpdate(tenantOrRootOrgRecipientSession, adrecipient.Id, domainControllerFqdn, domainControllerDomainName);
                    tenantOrRootOrgRecipientSession.LinkResolutionServer = null;
                    IConfigurable configurable = null;
                    if (abb != null)
                    {
                        IEnumerator <ADRecipient> enumerator = abb.FindUpdatingRecipientsPaged(tenantOrRootOrgRecipientSession, adrecipient.Id).GetEnumerator();
                        if (enumerator.MoveNext())
                        {
                            configurable = enumerator.Current;
                        }
                    }
                    else
                    {
                        IConfigurable[] array = tenantOrRootOrgRecipientSession.Find(adrecipient.Id, QueryScope.Base, removeFilter, null, 1);
                        if (array.Length > 0)
                        {
                            configurable = array[0];
                        }
                    }
                    if (configurable != null)
                    {
                        adrecipient2 = (ADRecipient)configurable;
                        if (!adrecipient2.IsValid || adrecipient2.IsReadOnly)
                        {
                            writeWarning(Strings.ErrorCannotUpdateInvalidRecipient(adrecipient2.Id.ToString()));
                        }
                        else
                        {
                            if (cmdlet != null && cmdlet.Stopping)
                            {
                                break;
                            }
                            bool flag = false;
                            if (abb != null)
                            {
                                using (MultiValuedProperty <ADObjectId> .Enumerator enumerator2 = adrecipient2.AddressListMembership.GetEnumerator())
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        ADObjectId adobjectId = enumerator2.Current;
                                        if (ADObjectId.Equals(adobjectId, abb.Id))
                                        {
                                            flag = true;
                                            adrecipient2.AddressListMembership.Remove(adobjectId);
                                            break;
                                        }
                                    }
                                    goto IL_1E5;
                                }
                            }
                            int num2 = adrecipient2.AddressListMembership.Count - 1;
                            while (0 <= num2)
                            {
                                if (abbObjectGuidList.BinarySearch(adrecipient2.AddressListMembership[num2].ObjectGuid) >= 0)
                                {
                                    flag = true;
                                    adrecipient2.AddressListMembership.RemoveAt(num2);
                                }
                                num2--;
                            }
IL_1E5:
                            if (!flag && !adrecipient2.HiddenFromAddressListsEnabled)
                            {
                                if (string.IsNullOrEmpty(text))
                                {
                                    try
                                    {
                                        if (!string.IsNullOrEmpty(abb.OriginatingServer))
                                        {
                                            text = SystemConfigurationTasksHelper.GetConfigurationDomainControllerFqdn(abb.OriginatingServer);
                                        }
                                    }
                                    catch (SocketException ex)
                                    {
                                        writeWarning(Strings.ErrorResolveFqdnForDomainController(abb.OriginatingServer, ex.Message));
                                        continue;
                                    }
                                }
                                tenantOrRootOrgRecipientSession.LinkResolutionServer = text;
                                adrecipient2.AddressListMembership.Add(abb.Id);
                            }
                            currentPercent = currentPercent++ % 99 + 1;
                            writeProgress(Strings.ProgressActivityUpdateRecipient, Strings.ProgressStatusUpdateRecipient(adrecipient2.Id.ToString()), currentPercent);
                            tenantOrRootOrgRecipientSession.Save(adrecipient2);
                        }
                    }
                }
                catch (DataSourceTransientException ex2)
                {
                    writeWarning(Strings.ErrorUpdateRecipient(adrecipient2.Id.ToString(), ex2.Message));
                    TaskLogger.Trace("Exception is raised while updating recipient '{0}': {1}", new object[]
                    {
                        adrecipient2.Id.ToString(),
                        ex2.Message
                    });
                }
                catch (DataSourceOperationException ex3)
                {
                    writeWarning(Strings.ErrorUpdateRecipient(adrecipient2.Id.ToString(), ex3.Message));
                    TaskLogger.Trace("Exception is raised while updating recipient '{0}': {1}", new object[]
                    {
                        adrecipient2.Id.ToString(),
                        ex3.Message
                    });
                }
                catch (DataValidationException ex4)
                {
                    writeWarning(Strings.ErrorUpdateRecipient(adrecipient2.Id.ToString(), ex4.Message));
                    TaskLogger.Trace("Exception is raised while updating recipient '{0}': {1}", new object[]
                    {
                        adrecipient2.Id.ToString(),
                        ex4.Message
                    });
                }
            }
        }