Ejemplo n.º 1
0
        public static MultiValuedProperty <PublicFolderAccessRight> CreatePublicFolderAccessRightCollection(PublicFolderPermission permission)
        {
            permission &= (PublicFolderPermission.ReadItems | PublicFolderPermission.CreateItems | PublicFolderPermission.EditOwnedItems | PublicFolderPermission.DeleteOwnedItems | PublicFolderPermission.EditAllItems | PublicFolderPermission.DeleteAllItems | PublicFolderPermission.CreateSubfolders | PublicFolderPermission.FolderOwner | PublicFolderPermission.FolderContact | PublicFolderPermission.FolderVisible);
            MultiValuedProperty <PublicFolderAccessRight> multiValuedProperty = new MultiValuedProperty <PublicFolderAccessRight>();

            if (Enum.IsDefined(typeof(PublicFolderPermission), permission) || Enum.IsDefined(typeof(PublicFolderPermissionRole), (int)permission))
            {
                multiValuedProperty.Add(new PublicFolderAccessRight(permission));
            }
            else
            {
                int num  = (int)permission;
                int num2 = 1;
                int num3 = 0;
                while (24 > num3)
                {
                    if ((num2 & num) != 0 && Enum.IsDefined(typeof(PublicFolderPermission), num2))
                    {
                        multiValuedProperty.Add(new PublicFolderAccessRight((PublicFolderPermission)num2));
                    }
                    num2 <<= 1;
                    num3++;
                }
            }
            return(multiValuedProperty);
        }
        // Token: 0x06000E89 RID: 3721 RVA: 0x00045E24 File Offset: 0x00044024
        private static MultiValuedProperty <KeywordHit> ConvertStringArrayToMvpKeywordHit(object keywordHits)
        {
            MultiValuedProperty <KeywordHit> result = new MultiValuedProperty <KeywordHit>();

            if (keywordHits is string)
            {
                keywordHits = new string[]
                {
                    (string)keywordHits
                };
            }
            if (keywordHits is string[])
            {
                try
                {
                    result = new MultiValuedProperty <KeywordHit>(Array.ConvertAll <string, KeywordHit>((string[])keywordHits, (string keywordHit) => KeywordHit.Parse(keywordHit)));
                }
                catch (ArgumentNullException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "KeywordHit.Parse() throws ArgumentNullException");
                }
                catch (FormatException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "KeywordHit.Parse() throws FormatException");
                }
                catch (OverflowException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "KeywordHit.Parse() throws OverflowException");
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
 private bool CheckForInvalidIPAddress(MultiValuedProperty <IPAddress> ipList, out SetPerimeterConfig.IPAddressType ipType, out IPAddress ipAddress)
 {
     ipType    = SetPerimeterConfig.IPAddressType.IPv4;
     ipAddress = null;
     foreach (IPAddress ipaddress in ipList)
     {
         if (ipaddress.AddressFamily == AddressFamily.InterNetworkV6)
         {
             ipAddress = ipaddress;
             ipType    = SetPerimeterConfig.IPAddressType.IPv6;
             return(true);
         }
         if (!IPAddressValidation.IsValidIPv4Address(ipaddress.ToString()))
         {
             ipAddress = ipaddress;
             ipType    = SetPerimeterConfig.IPAddressType.InvalidIPv4;
             return(true);
         }
         if (IPAddressValidation.IsReservedIPv4Address(ipaddress.ToString()))
         {
             ipAddress = ipaddress;
             ipType    = SetPerimeterConfig.IPAddressType.ReservedIPv4;
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
        // Token: 0x06000023 RID: 35 RVA: 0x00002F78 File Offset: 0x00001178
        private bool ProcessPartnerApplication(PartnerApplication partnerApplication)
        {
            bool         result       = false;
            AuthMetadata authMetadata = this.FetchMetadata(partnerApplication.Name, partnerApplication.AuthMetadataUrl, false);

            if (authMetadata == null)
            {
                return(false);
            }
            if (!OAuthCommon.IsIdMatch(partnerApplication.ApplicationIdentifier, authMetadata.ServiceName) || !OAuthCommon.IsRealmMatchIncludingEmpty(partnerApplication.Realm, authMetadata.Realm) || !string.Equals(partnerApplication.IssuerIdentifier, authMetadata.Issuer))
            {
                this.Context.Logger.LogTerseEvent(MigrationEventType.Error, MSExchangeAuthAdminEventLogConstants.Tuple_InvalidTrustedIssuerChanges, new string[]
                {
                    partnerApplication.Name,
                    partnerApplication.AuthMetadataUrl
                });
                return(false);
            }
            MultiValuedProperty <byte[]> multiValuedProperty = null;

            if (this.ProcessCertificates(partnerApplication.Name, partnerApplication.CertificateBytes, authMetadata.CertificateStrings, out multiValuedProperty) && multiValuedProperty != null)
            {
                result = true;
                partnerApplication.CertificateBytes = multiValuedProperty;
            }
            return(result);
        }
        // Token: 0x06000E86 RID: 3718 RVA: 0x00045CC0 File Offset: 0x00043EC0
        private static MultiValuedProperty <string> ConvertStringArrayToMvpString(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            if (obj is string)
            {
                multiValuedProperty.Add((string)obj);
            }
            else if (obj is string[])
            {
                string[] array = (string[])obj;
                foreach (string text in array)
                {
                    if (text != null)
                    {
                        multiValuedProperty.Add(text);
                    }
                }
            }
            return(multiValuedProperty);
        }
        private void UpdateInternalAndExternalAuthenticationMethods()
        {
            List <AuthenticationMethod> list = new List <AuthenticationMethod>();

            if (base.InternalAuthenticationMethods != null)
            {
                list.AddRange(base.InternalAuthenticationMethods);
            }
            List <AuthenticationMethod> authenticationMethods = list;
            bool basicAuthentication = this.BasicAuthentication;

            AuthenticationMethod[] applicableAuthenticationMethods = new AuthenticationMethod[1];
            this.AddOrRemoveAuthenticationMethod(authenticationMethods, basicAuthentication, applicableAuthenticationMethods);
            this.AddOrRemoveAuthenticationMethod(list, this.WindowsAuthentication, new AuthenticationMethod[]
            {
                AuthenticationMethod.WindowsIntegrated
            });
            this.AddOrRemoveAuthenticationMethod(list, this.OAuthAuthentication, new AuthenticationMethod[]
            {
                AuthenticationMethod.OAuth
            });
            MultiValuedProperty <AuthenticationMethod> multiValuedProperty = new MultiValuedProperty <AuthenticationMethod>(list);

            base.InternalAuthenticationMethods = multiValuedProperty;
            base.ExternalAuthenticationMethods = multiValuedProperty;
        }
        // Token: 0x06001D45 RID: 7493 RVA: 0x00079D44 File Offset: 0x00077F44
        internal static object IncludeRecipientGetter(IPropertyBag propertyBag, ADPropertyDefinition filterMeatadata, ADPropertyDefinition filter)
        {
            WellKnownRecipientType?wellKnownRecipientType = null;

            if (WellKnownRecipientFilterType.Precanned == (WellKnownRecipientFilterType)RecipientFilterHelper.RecipientFilterTypeGetter(propertyBag, filterMeatadata, filter))
            {
                MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[filterMeatadata];
                wellKnownRecipientType = new WellKnownRecipientType?(WellKnownRecipientType.None);
                foreach (string text in multiValuedProperty)
                {
                    if (text.StartsWith("Microsoft.Exchange12.8f91d340bc0c47e4b4058a479602f94c:IncludedRecipients=", StringComparison.OrdinalIgnoreCase))
                    {
                        int value;
                        if (int.TryParse(text.Substring("Microsoft.Exchange12.8f91d340bc0c47e4b4058a479602f94c:IncludedRecipients=".Length), out value))
                        {
                            wellKnownRecipientType = new WellKnownRecipientType?((WellKnownRecipientType)value);
                            break;
                        }
                        wellKnownRecipientType = null;
                        break;
                    }
                }
            }
            return(wellKnownRecipientType);
        }
Ejemplo n.º 8
0
        private List <AcceptedDomain> GetAllFederatedDomains(FederatedOrganizationId fedOrgId)
        {
            QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, fedOrgId.Guid);

            ADRawEntry[] array = this.ConfigurationSession.Find(base.CurrentOrgContainerId, QueryScope.SubTree, filter, null, 1, new ADPropertyDefinition[]
            {
                FederatedOrganizationIdSchema.AcceptedDomainsBackLink
            });
            if (array == null || array.Length == 0)
            {
                base.WriteError(new InvalidOperationException(Strings.CannotLocateFedOrgId), ErrorCategory.InvalidOperation, null);
            }
            MultiValuedProperty <ADObjectId> multiValuedProperty = array[0][FederatedOrganizationIdSchema.AcceptedDomainsBackLink] as MultiValuedProperty <ADObjectId>;
            List <AcceptedDomain>            list = new List <AcceptedDomain>(multiValuedProperty.Count);

            foreach (ADObjectId entryId in multiValuedProperty)
            {
                AcceptedDomain acceptedDomain = this.ConfigurationSession.Read <AcceptedDomain>(entryId);
                if (acceptedDomain != null)
                {
                    list.Add(acceptedDomain);
                }
            }
            return(list);
        }
        public override void WriteCookie(byte[] cookie, DateTime timestamp)
        {
            if (cookie == null || cookie.Length == 0)
            {
                throw new ArgumentException("cookie is empty");
            }
            MsoTenantCookieContainer msoTenantCookieContainer = this.configSession.GetMsoTenantCookieContainer(base.ContextId);

            if (msoTenantCookieContainer != null)
            {
                int cookieVersion = (base.LastCookie != null) ? base.LastCookie.Version : 1;
                MsoFullSyncCookie msoFullSyncCookie = new MsoFullSyncCookie(cookie, cookieVersion);
                msoFullSyncCookie.Timestamp = timestamp;
                if (base.LastCookie != null)
                {
                    msoFullSyncCookie.SyncType          = base.LastCookie.SyncType;
                    msoFullSyncCookie.SyncRequestor     = base.LastCookie.SyncRequestor;
                    msoFullSyncCookie.WhenSyncRequested = base.LastCookie.WhenSyncRequested;
                    msoFullSyncCookie.WhenSyncStarted   = ((base.LastCookie.WhenSyncStarted != DateTime.MinValue) ? base.LastCookie.WhenSyncStarted : timestamp);
                }
                byte[] item = msoFullSyncCookie.ToStorageCookie();
                MultiValuedProperty <byte[]> multiValuedProperty = this.RetrievePersistedPageTokens(msoTenantCookieContainer);
                multiValuedProperty.Clear();
                multiValuedProperty.Add(item);
                this.configSession.Save(msoTenantCookieContainer);
                this.LogPersistPageTokenEvent();
            }
        }
Ejemplo n.º 10
0
        internal static void MultiValuedBytesKeySetter(object value, IPropertyBag propertyBag, ADPropertyDefinition rawProperty, int offset)
        {
            MultiValuedProperty <byte[]> multiValuedProperty = propertyBag[rawProperty] as MultiValuedProperty <byte[]>;
            string text = value as string;

            if (string.IsNullOrEmpty(text))
            {
                if (offset > multiValuedProperty.Count - 1)
                {
                    return;
                }
                if (offset == multiValuedProperty.Count - 1)
                {
                    multiValuedProperty.RemoveAt(offset);
                    return;
                }
            }
            while (multiValuedProperty.Count < offset + 1)
            {
                MultiValuedProperty <byte[]> multiValuedProperty2 = multiValuedProperty;
                byte[] item = new byte[1];
                multiValuedProperty2.Add(item);
            }
            if (!string.IsNullOrEmpty(text))
            {
                multiValuedProperty[offset] = Convert.FromBase64String(text);
                return;
            }
            MultiValuedProperty <byte[]> multiValuedProperty3 = multiValuedProperty;

            byte[] value2 = new byte[1];
            multiValuedProperty3[offset] = value2;
        }
Ejemplo n.º 11
0
        internal static object MultiValuedStringKeyGetter(IPropertyBag propertyBag, ADPropertyDefinition rawProperty, int offset)
        {
            if (offset < 0 || offset > 2)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            MultiValuedProperty <string> multiValuedProperty = propertyBag[rawProperty] as MultiValuedProperty <string>;

            if (multiValuedProperty == null || multiValuedProperty.Count == 0)
            {
                return(string.Empty);
            }
            string tag   = offset.ToString("d1") + AuthConfigSchema.NameValueSeparator;
            string text  = string.Empty;
            string text2 = multiValuedProperty.SingleOrDefault((string s) => s.StartsWith(tag));

            if (text2 != null && text2.Length > tag.Length)
            {
                text = text2.Substring(tag.Length);
            }
            if (!string.IsNullOrEmpty(text))
            {
                return(text);
            }
            if (multiValuedProperty.Count == 1 && offset == 0)
            {
                text = multiValuedProperty[0];
            }
            return(text);
        }
Ejemplo n.º 12
0
        internal static object LanguagesGetter(IPropertyBag propertyBag)
        {
            string text = (string)propertyBag[ADOrgPersonSchema.LanguagesRaw];
            MultiValuedProperty <CultureInfo> multiValuedProperty = new MultiValuedProperty <CultureInfo>();

            if (!string.IsNullOrEmpty(text))
            {
                string[] array = text.Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < array.Length; i++)
                {
                    CultureInfo cultureInfo = null;
                    try
                    {
                        cultureInfo = new CultureInfo(array[i].Trim());
                    }
                    catch (ArgumentException ex)
                    {
                        ExTraceGlobals.ADReadDetailsTracer.TraceDebug <string, string>(0L, "ADOrgPerson::LanguagesGetter - Invalid culture {0} ignored. Exception: {1}", array[i], ex.Message);
                    }
                    if (cultureInfo != null)
                    {
                        multiValuedProperty.Add(cultureInfo);
                    }
                }
            }
            return(multiValuedProperty);
        }
Ejemplo n.º 13
0
        public static MultiValuedProperty <Page> BlobToPageCollection(byte[] blob, MAPIPropertiesDictionary propertiesDictionary)
        {
            MultiValuedProperty <Page> multiValuedProperty = new MultiValuedProperty <Page>();

            try
            {
                uint intFrom4bytes = DetailsTemplateAdapter.GetIntFrom4bytes(blob, 4);
                int  num           = 8;
                int  num2          = 0;
                while ((long)num2 < (long)((ulong)intFrom4bytes))
                {
                    uint[] array = new uint[9];
                    for (int i = 0; i < 9; i++)
                    {
                        array[i] = DetailsTemplateAdapter.GetIntFrom4bytes(blob, num);
                        num     += 4;
                    }
                    DetailsTemplateAdapter.AddControl(array, blob, multiValuedProperty, propertiesDictionary);
                    num2++;
                }
            }
            catch (ArgumentException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("Pages", ex.Message), DetailsTemplateSchema.Pages, blob), ex);
            }
            catch (InvalidOperationException ex2)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("Pages", ex2.Message), DetailsTemplateSchema.Pages, blob), ex2);
            }
            catch (ParsingException ex3)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("Pages", ex3.Message), DetailsTemplateSchema.Pages, blob), ex3);
            }
            return(multiValuedProperty);
        }
        private void SetTaskCondition(AuditOperationsPredicate condition)
        {
            MultiValuedProperty <AuditableOperations> multiValuedProperty = new MultiValuedProperty <AuditableOperations>();

            if (condition != null && condition.Value != null && condition.Value.ParsedValue != null)
            {
                if (condition.Value.ParsedValue is string)
                {
                    AuditableOperations item;
                    if (Enum.TryParse <AuditableOperations>((string)condition.Value.ParsedValue, true, out item))
                    {
                        multiValuedProperty.Add(item);
                    }
                }
                else if (condition.Value.ParsedValue is List <string> )
                {
                    foreach (string text in ((List <string>)condition.Value.ParsedValue))
                    {
                        AuditableOperations item;
                        if (text != null && Enum.TryParse <AuditableOperations>(text, true, out item))
                        {
                            multiValuedProperty.Add(item);
                        }
                    }
                }
            }
            this.AuditOperation = multiValuedProperty;
        }
Ejemplo n.º 15
0
        internal static MultiValuedProperty <ADObjectId> ValidateAddressBook(IConfigDataProvider session, AddressListIdParameter[] addressBooks, AddressBookPolicyTaskUtility.GetUniqueObject getAddressBook, AddressBookMailboxPolicy target, Task.TaskErrorLoggingDelegate writeError)
        {
            MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, AddressBookMailboxPolicySchema.AddressLists, new object[0]);

            if (addressBooks != null)
            {
                foreach (AddressListIdParameter addressListIdParameter in addressBooks)
                {
                    if (addressListIdParameter != null)
                    {
                        IConfigurable configurable = getAddressBook(addressListIdParameter, session, null, new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotFound(addressListIdParameter.ToString())), new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotUnique(addressListIdParameter.ToString())));
                        if (configurable != null)
                        {
                            if (multiValuedProperty.Contains((ADObjectId)configurable.Identity))
                            {
                                writeError(new InvalidOperationException(Strings.ErrorOabALAlreadyAssigned((target.Identity != null) ? target.Identity.ToString() : target.Name, configurable.Identity.ToString())), ErrorCategory.InvalidOperation, target.Identity);
                            }
                            else
                            {
                                multiValuedProperty.Add((ADObjectId)configurable.Identity);
                            }
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }
Ejemplo n.º 16
0
        private void SaveTemplate(CancelEventArgs e)
        {
            TabControl templateTab = this.templatePage.TemplateSurface.TemplateTab;
            MultiValuedProperty <Page> multiValuedProperty = new MultiValuedProperty <Page>();

            foreach (object obj in templateTab.TabPages)
            {
                CustomTabPage customTabPage      = (CustomTabPage)obj;
                Page          detailsTemplateTab = customTabPage.DetailsTemplateTab;
                detailsTemplateTab.Controls.Clear();
                DetailsTemplatesSurface.SortControls(customTabPage, true);
                foreach (object obj2 in customTabPage.Controls)
                {
                    Control control = (Control)obj2;
                    DetailsTemplateControl detailsTemplateControl = (control as IDetailsTemplateControlBound).DetailsTemplateControl;
                    detailsTemplateTab.Controls.Add(detailsTemplateControl);
                }
                DetailsTemplatesSurface.SortControls(customTabPage, false);
                multiValuedProperty.Add(detailsTemplateTab);
            }
            DetailsTemplate detailsTemplate = this.templatePage.BindingSource.DataSource as DetailsTemplate;

            detailsTemplate.Pages = multiValuedProperty;
            if (this.templatePage.DataHandler != null)
            {
                this.templatePage.DataHandler.SpecifyParameterNames("Pages");
            }
            this.templatePage.Apply(e);
            this.RefreshOnFinish.Refresh(base.CreateProgress(Strings.Refreshing));
        }
Ejemplo n.º 17
0
        protected MultiValuedProperty <TResult> ResolveIdParameterCollection <TIdParameter, TObject, TResult>(IEnumerable <TIdParameter> idParameters, IConfigDataProvider session, ObjectId rootId, OptionalIdentityData optionalData, ExchangeErrorCategory errorCategory, Func <IIdentityParameter, LocalizedString> parameterToNotFoundError, Func <IIdentityParameter, LocalizedString> parameterToMultipleFoundError, Func <IConfigurable, TResult> convertToResult, Func <IConfigurable, IConfigurable> validateObject) where TIdParameter : IIdentityParameter where TObject : IConfigurable, new()
        {
            MultiValuedProperty <TIdParameter> multiValuedProperty = idParameters as MultiValuedProperty <TIdParameter>;
            MultiValuedProperty <TResult>      result;

            if (multiValuedProperty != null && multiValuedProperty.IsChangesOnlyCopy)
            {
                Hashtable hashtable = new Hashtable();
                if (multiValuedProperty.Added.Length > 0)
                {
                    IEnumerable <TResult> value = this.ResolveIdList <TObject, TResult>(multiValuedProperty.Added, session, rootId, optionalData, errorCategory, parameterToNotFoundError, parameterToMultipleFoundError, convertToResult, validateObject);
                    hashtable.Add("Add", value);
                }
                if (multiValuedProperty.Removed.Length > 0)
                {
                    IEnumerable <TResult> value2 = this.ResolveIdList <TObject, TResult>(multiValuedProperty.Removed, session, rootId, optionalData, errorCategory, parameterToNotFoundError, parameterToMultipleFoundError, convertToResult, null);
                    hashtable.Add("Remove", value2);
                }
                result = new MultiValuedProperty <TResult>(hashtable);
            }
            else
            {
                IEnumerable <TResult> value3 = this.ResolveIdList <TObject, TResult>(idParameters, session, rootId, optionalData, errorCategory, parameterToNotFoundError, parameterToMultipleFoundError, convertToResult, validateObject);
                result = new MultiValuedProperty <TResult>(value3);
            }
            return(result);
        }
Ejemplo n.º 18
0
        internal static object RoleGroupDescriptionGetter(IPropertyBag propertyBag)
        {
            int num  = (int)propertyBag[ADGroupSchema.LocalizationFlags];
            int num2 = (int)propertyBag[ADGroupSchema.RoleGroupTypeId];

            if ((num & 1) == 0 && num2 != 0 && RoleGroup.RoleGroupStringIds.ContainsKey(num2))
            {
                string text = null;
                try
                {
                    text = SchemaHelpers.resourceManager.GetString(RoleGroup.RoleGroupStringIds[num2]);
                }
                catch (MissingManifestResourceException)
                {
                }
                if (!string.IsNullOrEmpty(text))
                {
                    return(text);
                }
            }
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[ADRecipientSchema.Description];

            if (multiValuedProperty.Count <= 0)
            {
                return(string.Empty);
            }
            return(multiValuedProperty[0]);
        }
Ejemplo n.º 19
0
        // Token: 0x060019C4 RID: 6596 RVA: 0x0006CB4C File Offset: 0x0006AD4C
        internal static object ManagedByGetter(IPropertyBag propertyBag)
        {
            object result;

            try
            {
                ADObjectId adobjectId = propertyBag[ADGroupSchema.RawManagedBy] as ADObjectId;
                MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();
                if (adobjectId != null)
                {
                    multiValuedProperty.Add(adobjectId);
                }
                MultiValuedProperty <ADObjectId> multiValuedProperty2 = propertyBag[ADGroupSchema.CoManagedBy] as MultiValuedProperty <ADObjectId>;
                foreach (ADObjectId item in multiValuedProperty2)
                {
                    if (!multiValuedProperty.Contains(item))
                    {
                        multiValuedProperty.Add(item);
                    }
                }
                multiValuedProperty.ResetChangeTracking();
                result = multiValuedProperty;
            }
            catch (InvalidOperationException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("ManagedBy", ex.Message), ADGroupSchema.ManagedBy, propertyBag[ADGroupSchema.RawManagedBy]), ex);
            }
            return(result);
        }
Ejemplo n.º 20
0
        internal static void RoleGroupDescriptionSetter(object value, IPropertyBag propertyBag)
        {
            MultiValuedProperty <string> value2 = (value == null) ? null : new MultiValuedProperty <string>(value);

            propertyBag[ADRecipientSchema.Description]   = value2;
            propertyBag[ADGroupSchema.LocalizationFlags] = ((int)propertyBag[ADGroupSchema.LocalizationFlags] | 1);
        }
        // Token: 0x06001D48 RID: 7496 RVA: 0x00079EF8 File Offset: 0x000780F8
        private static void InternalStringValuesSetter(object value, IPropertyBag propertyBag, ADPropertyDefinition filterMeatadata, string filterPrefix)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[filterMeatadata];

            RecipientFilterHelper.ClearNonExchange12RecipientFilterMetadata(multiValuedProperty);
            int num = multiValuedProperty.Count - 1;

            while (0 <= num)
            {
                if (multiValuedProperty[num].StartsWith(filterPrefix, StringComparison.OrdinalIgnoreCase))
                {
                    multiValuedProperty.RemoveAt(num);
                }
                num--;
            }
            MultiValuedProperty <string> multiValuedProperty2 = (MultiValuedProperty <string>)value;

            if (multiValuedProperty2 != null && multiValuedProperty2.Count != 0)
            {
                foreach (string text in multiValuedProperty2)
                {
                    if (!string.IsNullOrEmpty(text))
                    {
                        multiValuedProperty.Add(filterPrefix + text);
                    }
                }
            }
        }
Ejemplo n.º 22
0
        public IOutboundConnector BuildExpectedOutboundConnector(ADObjectId identity, string name, string tlsCertificateSubjectDomainName, MultiValuedProperty <SmtpDomain> hybridDomains, string smartHost, bool centralizedTransportFeatureEnabled)
        {
            MultiValuedProperty <SmtpDomainWithSubdomains> multiValuedProperty = new MultiValuedProperty <SmtpDomainWithSubdomains>();

            if (centralizedTransportFeatureEnabled)
            {
                multiValuedProperty.Add(new SmtpDomainWithSubdomains("*"));
            }
            else
            {
                foreach (SmtpDomainWithSubdomains item in from s in hybridDomains
                         select new SmtpDomainWithSubdomains(s.Domain))
                {
                    multiValuedProperty.Add(item);
                }
            }
            MultiValuedProperty <SmartHost> smartHosts = new MultiValuedProperty <SmartHost>
            {
                new SmartHost(smartHost)
            };

            return(new OutboundConnector(name, tlsCertificateSubjectDomainName, multiValuedProperty, smartHosts, centralizedTransportFeatureEnabled)
            {
                Identity = identity
            });
        }
Ejemplo n.º 23
0
        public IMailboxBuilder <GroupMailbox> BuildFromDirectory(ADRawEntry rawEntry)
        {
            this.Mailbox.Alias                              = (rawEntry[GroupMailboxSchema.Alias] as string);
            this.Mailbox.DisplayName                        = (rawEntry[GroupMailboxSchema.DisplayName] as string);
            this.Mailbox.Owners                             = (rawEntry[GroupMailboxSchema.Owners] as MultiValuedProperty <ADObjectId>);
            this.Mailbox.SmtpAddress                        = (SmtpAddress)rawEntry[GroupMailboxSchema.PrimarySmtpAddress];
            this.Mailbox.Type                               = (ModernGroupObjectType)rawEntry[GroupMailboxSchema.ModernGroupType];
            this.Mailbox.SharePointUrl                      = (rawEntry[GroupMailboxSchema.SharePointUrl] as Uri);
            this.Mailbox.SharePointSiteUrl                  = (rawEntry[GroupMailboxSchema.SharePointSiteUrl] as string);
            this.Mailbox.SharePointDocumentsUrl             = (rawEntry[GroupMailboxSchema.SharePointDocumentsUrl] as string);
            this.Mailbox.RequireSenderAuthenticationEnabled = (bool)rawEntry[GroupMailboxSchema.RequireSenderAuthenticationEnabled];
            this.Mailbox.AutoSubscribeNewGroupMembers       = (bool)rawEntry[GroupMailboxSchema.AutoSubscribeNewGroupMembers];
            MultiValuedProperty <CultureInfo> multiValuedProperty = rawEntry[GroupMailboxSchema.Languages] as MultiValuedProperty <CultureInfo>;

            if (multiValuedProperty != null)
            {
                this.Mailbox.Language = multiValuedProperty.FirstOrDefault <CultureInfo>();
            }
            MultiValuedProperty <string> multiValuedProperty2 = rawEntry[GroupMailboxSchema.Description] as MultiValuedProperty <string>;

            if (multiValuedProperty2 != null)
            {
                this.Mailbox.Description = multiValuedProperty2.FirstOrDefault <string>();
            }
            return(this);
        }
Ejemplo n.º 24
0
        internal static void FixIPAddress(AmServerName nodeName, DatabaseAvailabilityGroup dag, IEnumerable <AmServerName> startedMailboxServers, ITaskOutputHelper output)
        {
            output.WriteProgressSimple(Strings.DagTaskFixingUpIpResources);
            MultiValuedProperty <IPAddress> databaseAvailabilityGroupIpv4Addresses = dag.DatabaseAvailabilityGroupIpv4Addresses;

            IPAddress[] array = new IPAddress[0];
            if (databaseAvailabilityGroupIpv4Addresses.Count > 0)
            {
                array = databaseAvailabilityGroupIpv4Addresses.ToArray();
            }
            string[] value = (from addr in array
                              select addr.ToString()).ToArray <string>();
            output.AppendLogMessage("Got the following IP addresses for the DAG (blank means DHCP):{0}", new object[]
            {
                string.Join(",", value)
            });
            using (AmCluster amCluster = AmCluster.OpenByNames(startedMailboxServers))
            {
                if (amCluster.CnoName != string.Empty)
                {
                    using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                    {
                        using (IAmClusterResource amClusterResource = amClusterGroup.FindResourceByTypeName("Network Name"))
                        {
                            LocalizedString value2 = AmClusterResourceHelper.FixUpIpAddressesForNetName(output, amCluster, (AmClusterGroup)amClusterGroup, (AmClusterResource)amClusterResource, array);
                            output.WriteProgressSimple(Strings.DagTaskFixedUpIpResources(value2));
                            DagTaskHelper.LogCnoState(output, dag.Name, amClusterResource);
                        }
                    }
                }
            }
        }
        // Token: 0x06000E87 RID: 3719 RVA: 0x00045D30 File Offset: 0x00043F30
        private static MultiValuedProperty <ADObjectId> ConvertStringArrayToMvpADObjectId(object guids)
        {
            MultiValuedProperty <ADObjectId> result = new MultiValuedProperty <ADObjectId>();

            if (guids is string)
            {
                guids = new string[]
                {
                    (string)guids
                };
            }
            if (guids is string[])
            {
                try
                {
                    result = new MultiValuedProperty <ADObjectId>(Array.ConvertAll <string, ADObjectId>((string[])guids, (string guidString) => new ADObjectId(new Guid(guidString))));
                }
                catch (FormatException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "The guid strings of user configuration is corrupted");
                }
                catch (OverflowException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "The guid strings of user configuration is corrupted");
                }
            }
            return(result);
        }
Ejemplo n.º 26
0
        private static object GetAccessScope(IPropertyBag properties, string prefix, ADPropertyDefinition cacheDefinition)
        {
            MultiValuedProperty <string> actions = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions];
            string action        = OrganizationRelationshipHelper.GetAction(actions, prefix);
            string targetElement = OrganizationRelationshipHelper.GetTargetElement(action);

            if (targetElement == null)
            {
                return(null);
            }
            Guid guid;

            try
            {
                guid = new Guid(targetElement);
            }
            catch (FormatException)
            {
                return(null);
            }
            catch (OverflowException)
            {
                return(null);
            }
            ADObjectId adobjectId = (ADObjectId)properties[cacheDefinition];

            if (adobjectId != null && adobjectId.ObjectGuid == guid)
            {
                return(adobjectId);
            }
            return(new ADObjectId(guid));
        }
        // Token: 0x06000E8A RID: 3722 RVA: 0x00045EF8 File Offset: 0x000440F8
        private static MultiValuedProperty <DiscoverySearchStats> ConvertStringArrayToMvpDiscoverySearchStats(object searchStats)
        {
            MultiValuedProperty <DiscoverySearchStats> result = new MultiValuedProperty <DiscoverySearchStats>();

            if (searchStats is string)
            {
                searchStats = new string[]
                {
                    (string)searchStats
                };
            }
            if (searchStats is string[])
            {
                try
                {
                    result = new MultiValuedProperty <DiscoverySearchStats>(Array.ConvertAll <string, DiscoverySearchStats>((string[])searchStats, (string searchStat) => DiscoverySearchStats.Parse(searchStat)));
                }
                catch (ArgumentNullException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "DiscoverySearchStats.Parse() throws ArgumentNullException");
                }
                catch (FormatException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "DiscoverySearchStats.Parse() throws FormatException");
                }
                catch (OverflowException)
                {
                    ExTraceGlobals.StorageTracer.TraceDebug(0L, "DiscoverySearchStats.Parse() throws OverflowException");
                }
            }
            return(result);
        }
Ejemplo n.º 28
0
        private static object GetAccessLevel <T>(IPropertyBag properties, string actionPrefix, T defaultLevel)
        {
            MultiValuedProperty <string> actions = (MultiValuedProperty <string>)properties[OrganizationRelationshipSchema.FederationEnabledActions];
            string action       = OrganizationRelationshipHelper.GetAction(actions, actionPrefix);
            string levelElement = OrganizationRelationshipHelper.GetLevelElement(action);

            if (levelElement == null)
            {
                return(defaultLevel);
            }
            object result;

            try
            {
                result = (T)((object)Enum.Parse(typeof(T), levelElement, true));
            }
            catch (ArgumentNullException)
            {
                result = defaultLevel;
            }
            catch (ArgumentException)
            {
                result = defaultLevel;
            }
            return(result);
        }
Ejemplo n.º 29
0
        public void Delete(IConfigurable instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            if (this.configurationSession.ReadOnly)
            {
                throw new InvalidOperationException("read only");
            }
            if (this.serviceInstanceName == null)
            {
                throw new InvalidOperationException("Delete can be performed only for specific service instance.");
            }
            FullSyncObjectRequest fullSyncObjectRequest = instance as FullSyncObjectRequest;

            if (fullSyncObjectRequest == null)
            {
                throw new NotSupportedException(instance.GetType().FullName);
            }
            this.RefreshRidMasterInformation();
            MsoMainStreamCookieContainer msoMainStreamCookieContainer = this.configurationSession.GetMsoMainStreamCookieContainer(this.serviceInstanceName);
            MultiValuedProperty <FullSyncObjectRequest> msoForwardSyncObjectFullSyncRequests = msoMainStreamCookieContainer.MsoForwardSyncObjectFullSyncRequests;

            if (msoForwardSyncObjectFullSyncRequests.Contains(fullSyncObjectRequest))
            {
                msoForwardSyncObjectFullSyncRequests.Remove(fullSyncObjectRequest);
                this.configurationSession.Save(msoMainStreamCookieContainer);
                return;
            }
            throw new ADNoSuchObjectException(DirectoryStrings.ExceptionADOperationFailedNoSuchObject(this.configurationSession.DomainController, fullSyncObjectRequest.ToString()));
        }
Ejemplo n.º 30
0
        public static MultiValuedProperty <string> UpdateRemoteState(MultiValuedProperty <string> componentStates, string requester, string component, ServiceState state)
        {
            if (!ServerComponentStates.IsValidName(component))
            {
                throw new ArgumentException(DirectoryStrings.ComponentNameInvalid);
            }
            if (!ServerComponentStates.IsValidName(requester))
            {
                throw new ArgumentException(DirectoryStrings.RequesterNameInvalid);
            }
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            if (componentStates != null)
            {
                foreach (string text in componentStates)
                {
                    ServerComponentStates.ItemEntry itemEntry;
                    if (ServerComponentStates.TryParseRemoteStateString(text, out itemEntry) && (!string.Equals(itemEntry.Component, component, StringComparison.OrdinalIgnoreCase) || !string.Equals(itemEntry.Requester, requester, StringComparison.OrdinalIgnoreCase)))
                    {
                        multiValuedProperty.Add(text);
                    }
                }
            }
            multiValuedProperty.Add(string.Format("1:{0}:{1}:{2}:{3}", new object[]
            {
                component,
                requester,
                (int)state,
                DateTime.UtcNow.Ticks
            }));
            return(multiValuedProperty);
        }