protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     try
     {
         if (this.Identity == null)
         {
             ADObjectId orgContainerId = this.ConfigurationSession.GetOrgContainerId();
             this.Identity = new ApprovalApplicationIdParameter(orgContainerId.GetDescendantId(new ADObjectId(string.Concat(new object[]
             {
                 "CN=",
                 base.ParameterSetName,
                 ",",
                 ApprovalApplication.ParentPathInternal
             }), Guid.Empty)));
         }
         else
         {
             base.WriteError(new ArgumentException(Strings.ErrorApprovalApplicationIdentityUnsupported), ErrorCategory.InvalidArgument, this.Identity);
         }
         base.InternalValidate();
         ExistsFilter          filter = new ExistsFilter(ApprovalApplicationSchema.ArbitrationMailboxesBacklink);
         ApprovalApplication[] array  = this.ConfigurationSession.Find <ApprovalApplication>((ADObjectId)base.DataObject.Identity, QueryScope.Base, filter, null, 0);
         if (array.Length > 0)
         {
             base.WriteError(new CannotRemoveApprovalApplicationWithMailboxes(), ErrorCategory.PermissionDenied, this.Identity);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
Example #2
0
        public static ADObjectId GetUpdatedADObjectIdWithDN(ADObjectId adObject, string tenantDistinguishedName, Guid tenantGuid, ADObjectId relativeConfigDN = null)
        {
            if (adObject == null || string.IsNullOrEmpty(tenantDistinguishedName))
            {
                return(null);
            }
            if (tenantGuid == Guid.Empty || adObject.ObjectGuid == Guid.Empty)
            {
                throw new InvalidOperationException(string.Format("Unable to fix distinguished name for ADObject = {0}, TenantGuid = {1}, ObjectGuid = {2}, objectName = {3}.", new object[]
                {
                    adObject.GetType().Name,
                    tenantGuid,
                    adObject.ObjectGuid,
                    adObject.Name
                }));
            }
            string     unescapedCommonName = string.IsNullOrEmpty(adObject.Name) ? adObject.ObjectGuid.ToString() : adObject.Name;
            ADObjectId adobjectId          = new ADObjectId(tenantDistinguishedName, tenantGuid);
            ADObjectId adobjectId2         = new ADObjectId(adobjectId.GetChildId("Configuration").DistinguishedName, tenantGuid);

            if (relativeConfigDN != null)
            {
                adobjectId2 = new ADObjectId(adobjectId2.GetDescendantId(relativeConfigDN).DistinguishedName, tenantGuid);
            }
            return(new ADObjectId(adobjectId2.GetChildId(unescapedCommonName).DistinguishedName, adObject.ObjectGuid));
        }
Example #3
0
        private UMMailboxPolicy AutoGeneratePolicy()
        {
            UMMailboxPolicy ummailboxPolicy = new UMMailboxPolicy();

            ummailboxPolicy.UMDialPlan = this.DataObject.Id;
            if (this.DataObject.SubscriberType == UMSubscriberType.Consumer)
            {
                ummailboxPolicy.AllowDialPlanSubscribers = false;
                ummailboxPolicy.AllowExtensions          = false;
            }
            ADObjectId descendantId  = base.CurrentOrgContainerId.GetDescendantId(new ADObjectId("CN=UM Mailbox Policies", Guid.Empty));
            AdName     adName        = new AdName("CN", this.defaultPolicyName);
            ADObjectId descendantId2 = descendantId.GetDescendantId(new ADObjectId(adName.ToString(), Guid.Empty));

            ummailboxPolicy.SetId(descendantId2);
            if (base.CurrentOrganizationId != null)
            {
                ummailboxPolicy.OrganizationId = base.CurrentOrganizationId;
            }
            else
            {
                ummailboxPolicy.OrganizationId = base.ExecutingUserOrganizationId;
            }
            ummailboxPolicy.SourceForestPolicyNames.Add(adName.EscapedName);
            base.CreateParentContainerIfNeeded(ummailboxPolicy);
            base.DataSession.Save(ummailboxPolicy);
            return(ummailboxPolicy);
        }
        private bool ExistDistinctRoleAssignmentForGroup(ExchangeRoleAssignment roleAssignment, ExchangeRole role, bool verifyGroupEmptiness)
        {
            ADObjectId adobjectId = roleAssignment.OrganizationId.Equals(OrganizationId.ForestWideOrgId) ? this.configurationSession.GetOrgContainerId() : roleAssignment.OrganizationId.ConfigurationUnit;

            adobjectId = adobjectId.GetDescendantId(ExchangeRoleAssignment.RdnContainer);
            List <QueryFilter> list = new List <QueryFilter>
            {
                new ComparisonFilter(ComparisonOperator.NotEqual, ADObjectSchema.Id, roleAssignment.Id),
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.Role, roleAssignment.Role),
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.RecipientWriteScope, (RecipientWriteScopeType)role.ImplicitRecipientWriteScope),
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.ConfigWriteScope, (ConfigWriteScopeType)role.ImplicitConfigWriteScope),
                new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.RoleAssignmentDelegationType, roleAssignment.RoleAssignmentDelegationType),
                new OrFilter(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.RoleAssigneeType, RoleAssigneeType.RoleGroup),
                    new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.RoleAssigneeType, RoleAssigneeType.SecurityGroup)
                })
            };

            if (this.excludedFromAssignmentSearch != null)
            {
                foreach (ADObjectId propertyValue in this.excludedFromAssignmentSearch)
                {
                    list.Add(new ComparisonFilter(ComparisonOperator.NotEqual, ExchangeRoleAssignmentSchema.User, propertyValue));
                }
            }
            foreach (ExchangeRoleAssignment exchangeRoleAssignment in this.configurationSession.FindPaged <ExchangeRoleAssignment>(adobjectId, QueryScope.OneLevel, new AndFilter(list.ToArray()), null, 0))
            {
                if (exchangeRoleAssignment.IsValid && exchangeRoleAssignment.Enabled && exchangeRoleAssignment.RecipientReadScope.Equals(role.ImplicitRecipientReadScope) && exchangeRoleAssignment.ConfigReadScope.Equals(role.ImplicitConfigReadScope) && (!verifyGroupEmptiness || !this.IsGroupEmpty(exchangeRoleAssignment.User)))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #5
0
        // Token: 0x06000AD5 RID: 2773 RVA: 0x000232AC File Offset: 0x000214AC
        internal static ADObjectId DefaultRoot(IConfigDataProvider session)
        {
            IConfigurationSession configurationSession = (IConfigurationSession)session;
            ADObjectId            orgContainerId       = configurationSession.GetOrgContainerId();

            return(orgContainerId.GetDescendantId(MessageClassificationIdParameter.DefaultsRoot));
        }
        private void ProcessAllFederationTrusts()
        {
            FederationTrust[] federationTrusts = null;
            this.Context.Logger.Log(MigrationEventType.Information, "Retrieving Federation Trust Configuration", new object[0]);
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ADObjectId orgContainerId = this.session.GetOrgContainerId();
                ADObjectId descendantId   = orgContainerId.GetDescendantId(FederationTrust.FederationTrustsContainer);
                federationTrusts          = this.session.Find <FederationTrust>(descendantId, QueryScope.SubTree, null, null, ADGenericPagedReader <FederationTrust> .DefaultPageSize);
            });

            if (adoperationResult != ADOperationResult.Success)
            {
                this.Context.Logger.Log(MigrationEventType.Warning, "Unable to read Federation Trusts, result = {0}", new object[]
                {
                    adoperationResult.ErrorCode.ToString()
                });
                if (adoperationResult.Exception != null && adoperationResult.Exception is TransientException)
                {
                    throw adoperationResult.Exception;
                }
                return;
            }
            else
            {
                if (federationTrusts == null)
                {
                    this.Context.Logger.Log(MigrationEventType.Information, "No Federation Trusts found", new object[0]);
                    return;
                }
                foreach (FederationTrust federationTrust in federationTrusts)
                {
                    if (this.StopEvent.WaitOne(0, false))
                    {
                        return;
                    }
                    this.Context.Logger.Log(MigrationEventType.Information, "Processing Federation Trust {0}", new object[]
                    {
                        federationTrust.Name
                    });
                    if (federationTrust.TokenIssuerMetadataEpr == null)
                    {
                        this.Context.Logger.LogTerseEvent(MigrationEventType.Error, MSExchangeAuthAdminEventLogConstants.Tuple_InvalidTrustedIssuerConfiguration, new string[]
                        {
                            federationTrust.Name
                        });
                    }
                    else if (this.ProcessFederationTrust(federationTrust))
                    {
                        this.session.Save(federationTrust);
                        this.Context.Logger.LogTerseEvent(MigrationEventType.Information, MSExchangeAuthAdminEventLogConstants.Tuple_TrustedIssuerUpdated, new string[]
                        {
                            federationTrust.Name
                        });
                    }
                }
                return;
            }
        }
Example #7
0
 internal static ADObjectId GetMicrosoftExchangeRoot(ADObjectId configNC)
 {
     if (configNC == null)
     {
         throw new ArgumentNullException("configNC");
     }
     return(configNC.GetDescendantId(new ADObjectId("CN=Microsoft Exchange,CN=Services")));
 }
        internal static ADObjectId GetParentContainer(ITopologyConfigurationSession adSession)
        {
            ADObjectId clientAccessContainerId = adSession.GetClientAccessContainerId();
            ADObjectId relativePath            = new ADObjectId("CN=AutoDiscover");
            ADObjectId relativePath2           = new ADObjectId("CN=Outlook");

            return(clientAccessContainerId.GetDescendantId(relativePath).GetDescendantId(relativePath2));
        }
        private static ADObjectId GetClassificationDefinitionsContainerId(IConfigurationSession session)
        {
            ADObjectId orgContainerId = session.GetOrgContainerId();

            return(orgContainerId.GetDescendantId("Transport Settings", "Rules", new string[]
            {
                "ClassificationDefinitions"
            }));
        }
        internal void SetId(IConfigurationSession session, ADObjectId parent, string cn)
        {
            if (string.IsNullOrEmpty(cn))
            {
                throw new ArgumentException(DirectoryStrings.ErrorEmptyString("cn"), "cn");
            }
            ADObjectId adobjectId = session.GetOrgContainerId();

            if (this.ParentPath != null && !string.IsNullOrEmpty(this.ParentPath.DistinguishedName))
            {
                adobjectId = adobjectId.GetDescendantId(this.ParentPath);
            }
            if (parent != null && !string.IsNullOrEmpty(parent.DistinguishedName))
            {
                adobjectId = adobjectId.GetDescendantId(parent);
            }
            base.SetId(adobjectId.GetChildId(cn));
        }
Example #11
0
        private static ADObjectId GetPolicyNudgeRuleContainerId(IConfigurationSession session)
        {
            ADObjectId orgContainerId = session.GetOrgContainerId();

            return(orgContainerId.GetDescendantId("Transport Settings", "Rules", new string[]
            {
                "TransportVersioned"
            }));
        }
        private static ADObjectId GetProtectionRuleContainerId(IConfigurationSession session)
        {
            ADObjectId orgContainerId = session.GetOrgContainerId();

            return(orgContainerId.GetDescendantId("Transport Settings", "Rules", new string[]
            {
                "OutlookProtectionRules"
            }));
        }
Example #13
0
        internal static ADObjectId GetRootId(IConfigurationSession configSession, MRSRequestType type)
        {
            if (!configSession.SessionSettings.IsTenantScoped && CommonUtils.IsMultiTenantEnabled())
            {
                return(null);
            }
            ADObjectId descendantId = configSession.GetOrgContainerId().GetDescendantId(ADHandler.RelativeMRSContainer);

            return(descendantId.GetDescendantId(ADHandler.GetRelativeContainerId(type)));
        }
Example #14
0
        public CountryListKey(string countryListName)
        {
            if (string.IsNullOrEmpty(countryListName))
            {
                throw new ArgumentNullException("countryListName");
            }
            ADObjectId rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();

            this.Key            = rootOrgContainerIdForLocalForest.GetDescendantId(CountryList.RdnContainer.GetChildId(countryListName.ToLower()));
            this.cachedHashCode = this.Key.DistinguishedName.ToLower().GetHashCode();
        }
Example #15
0
        internal static string GenerateUniqueRoleAssignmentName(IConfigurationSession configurationSession, ADObjectId orgContainerId, string roleName, string roleAssigneeName, RoleAssignmentDelegationType roleAssignmentDelegationType, Task.TaskVerboseLoggingDelegate writeVerbose)
        {
            if (configurationSession == null)
            {
                throw new ArgumentNullException("configurationSession");
            }
            if (orgContainerId == null)
            {
                throw new ArgumentNullException("orgContainerId");
            }
            string text = roleName + "-" + roleAssigneeName;

            if (roleAssignmentDelegationType != RoleAssignmentDelegationType.Regular)
            {
                text += "-Delegating";
            }
            text = text.Trim();
            if (text.Length > 64)
            {
                text = text.Substring(0, 64).Trim();
            }
            if (writeVerbose == null)
            {
                throw new ArgumentNullException("writeVerbose");
            }
            ADObjectId descendantId = orgContainerId.GetDescendantId(ExchangeRoleAssignment.RdnContainer);
            string     text2        = text;

            if (text2.Length > 61)
            {
                text2 = text2.Substring(0, 61).Trim();
            }
            int num = 1;

            for (;;)
            {
                QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, text);
                writeVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(configurationSession, typeof(ExchangeRoleAssignment), filter, descendantId, false));
                ExchangeRoleAssignment[] array = configurationSession.Find <ExchangeRoleAssignment>(descendantId, QueryScope.OneLevel, filter, null, 1);
                if (array.Length == 0)
                {
                    break;
                }
                text = text2 + "-" + num.ToString();
                num++;
                if (num >= 100)
                {
                    return(text);
                }
            }
            return(text);
        }
 protected override IConfigurable PrepareDataObject()
 {
     TaskLogger.LogEnter();
     this.DataObject             = (RoleAssignmentPolicy)base.PrepareDataObject();
     this.DataObject.Description = this.Description;
     if (!base.HasErrors)
     {
         ADObjectId orgContainerId = ((IConfigurationSession)base.DataSession).GetOrgContainerId();
         ADObjectId descendantId   = orgContainerId.GetDescendantId(RoleAssignmentPolicy.RdnContainer);
         this.DataObject.SetId(descendantId.GetChildId(base.Name));
         this.PrepareRolesAndRoleAssignments();
     }
     TaskLogger.LogExit();
     return(this.DataObject);
 }
Example #17
0
        internal static BindingStorage CreateNewBindingStorage(ADObjectId tenantId, Workload workload, Guid policyId)
        {
            string         text           = workload.ToString() + policyId.ToString();
            BindingStorage bindingStorage = new BindingStorage
            {
                MasterIdentity = Guid.NewGuid(),
                Name           = text,
                PolicyId       = policyId,
                Workload       = workload
            };

            bindingStorage[ADObjectSchema.OrganizationalUnitRoot] = tenantId;
            bindingStorage.SetId(tenantId.GetDescendantId(PolicyStorage.PoliciesContainer).GetChildId(policyId.ToString()).GetChildId(text));
            return(bindingStorage);
        }
Example #18
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            this.DataObject = (CmdletExtensionAgent)base.PrepareDataObject();
            if (base.HasErrors)
            {
                return(null);
            }
            if (this.Assembly.IndexOf("\\") != -1)
            {
                base.WriteError(new ArgumentException(Strings.ErrorAssemblyIsPath(this.Assembly)), ErrorCategory.InvalidArgument, null);
            }
            if (string.IsNullOrEmpty(this.DataObject.Name))
            {
                string[] array = this.ClassFactory.Split(new char[]
                {
                    '.'
                });
                string text = array[array.Length - 1];
                if (text.Length > 64)
                {
                    this.DataObject.Name = text.Substring(0, 64);
                }
                else
                {
                    this.DataObject.Name = text;
                }
            }
            if (!this.agentsGlobalConfig.IsPriorityAvailable(this.Priority, null) && !this.agentsGlobalConfig.FreeUpPriorityValue(this.Priority))
            {
                base.WriteError(new ArgumentException(Strings.NotEnoughFreePrioritiesAvailable(this.Priority.ToString())), ErrorCategory.InvalidArgument, null);
            }
            this.DataObject.Priority = this.Priority;
            this.DataObject.Enabled  = this.Enabled;
            this.DataObject.IsSystem = this.IsSystem;
            if (this.IsSystem && !this.Enabled)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorAgentCannotBeDisabled), ErrorCategory.InvalidOperation, null);
            }
            ADObjectId descendantId  = base.RootOrgContainerId.GetDescendantId(new ADObjectId("CN=Global Settings"));
            ADObjectId descendantId2 = descendantId.GetDescendantId(new ADObjectId("CN=CmdletExtensionAgent Settings"));

            this.DataObject.SetId(descendantId2.GetChildId(this.DataObject.Name));
            TaskLogger.LogExit();
            return(this.DataObject);
        }
Example #19
0
        public static void FixDistinguishedName(ADObject adObject, string tenantDistinguishedName, Guid tenantGuid, Guid objectGuid, ADObjectId relativeConfigDN = null)
        {
            if (adObject == null || string.IsNullOrEmpty(tenantDistinguishedName))
            {
                return;
            }
            if (tenantGuid == Guid.Empty || objectGuid == Guid.Empty)
            {
                throw new InvalidOperationException(string.Format("Unable to fix distinguished name for ADObject = {0}, TenantGuid = {1}, ObjectGuid = {2}, objectName = {3}.", new object[]
                {
                    adObject.GetType().Name,
                    tenantGuid,
                    objectGuid,
                    adObject.Name
                }));
            }
            string     unescapedCommonName = string.IsNullOrEmpty(adObject.Name) ? objectGuid.ToString() : adObject.Name;
            ADObjectId adobjectId          = new ADObjectId(tenantDistinguishedName, tenantGuid);
            ADObjectId adobjectId2         = new ADObjectId(adobjectId.GetChildId("Configuration").DistinguishedName, tenantGuid);

            if (relativeConfigDN != null)
            {
                adobjectId2 = new ADObjectId(adobjectId2.GetDescendantId(relativeConfigDN).DistinguishedName, tenantGuid);
            }
            ADObjectId id          = new ADObjectId(adobjectId2.GetChildId(unescapedCommonName).DistinguishedName, objectGuid);
            ADObjectId adobjectId3 = (ADObjectId)adObject[ADObjectSchema.ConfigurationUnit];

            if (adobjectId3 != null && adobjectId3.Name != null && string.Equals(adobjectId3.Name, adobjectId2.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }
            adObject[ADObjectSchema.OrganizationalUnitRoot] = adobjectId;
            adObject[ADObjectSchema.ConfigurationUnit]      = adobjectId2;
            adObject.SetId(id);
            FfoDirectorySession.FixLegacyExchangeDN(adObject, tenantGuid);
            FfoDirectorySession.FixDistinguishedNameForADObjectIDs(adObject, tenantDistinguishedName);
        }
Example #20
0
        public void RegisterForEdgeTransportEvents()
        {
            if (!this.NeedExplicitDeletedObjectSubscription)
            {
                return;
            }
            ADObjectId rootOrgContainerIdForLocalForest = TransportADNotificationAdapter.GetRootOrgContainerIdForLocalForest();
            ADObjectId childId            = rootOrgContainerIdForLocalForest.GetChildId("Administrative Groups").GetChildId(AdministrativeGroup.DefaultName);
            ADObjectId childId2           = rootOrgContainerIdForLocalForest.GetChildId(AcceptedDomain.AcceptedDomainContainer.Parent.Name);
            ADObjectId childId3           = childId.GetChildId(ServersContainer.DefaultName);
            ADObjectId childId4           = childId2.GetChildId(AcceptedDomain.AcceptedDomainContainer.Name);
            ADObjectId childId5           = childId3.GetChildId(Environment.MachineName).GetChildId(ProtocolsContainer.DefaultName).GetChildId(ReceiveConnector.DefaultName);
            ADObjectId childId6           = rootOrgContainerIdForLocalForest.GetChildId("Global Settings").GetChildId("Internet Message Formats");
            ADObjectId childId7           = childId.GetChildId(DatabasesContainer.DefaultName);
            ADObjectId childId8           = childId2.GetChildId("Rules").GetChildId("TransportVersioned");
            ADObjectId childId9           = childId2.GetChildId("Rules").GetChildId("JournalingVersioned");
            ADObjectId descendantId       = rootOrgContainerIdForLocalForest.GetDescendantId(InterceptorRule.InterceptorRulesContainer);
            ADObjectId childId10          = ADSession.GetConfigurationNamingContextForLocalForest().GetChildId(SitesContainer.DefaultName);
            ADObjectId childId11          = childId10.GetChildId("Inter-Site Transports").GetChildId("IP");
            ADObjectId childId12          = childId.GetChildId(RoutingGroupsContainer.DefaultName).GetChildId(RoutingGroup.DefaultName).GetChildId("Connections");
            ADObjectId parentContainerId  = childId12;
            ADObjectId parentContainerId2 = childId12;

            this.RegisterChangeNotificationForDeletedObject <AcceptedDomain>(childId4, new ADNotificationCallback(this.HandleAcceptedDomainDeleted));
            this.RegisterChangeNotificationForDeletedObject <ADSiteLink>(childId11, new ADNotificationCallback(this.HandleADSiteLinkDeleted));
            this.RegisterChangeNotificationForDeletedObject <DeliveryAgentConnector>(parentContainerId, new ADNotificationCallback(this.HandleDeliveryAgentConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <DomainContentConfig>(childId6, new ADNotificationCallback(this.HandleRemoteDomainDeleted));
            this.RegisterChangeNotificationForDeletedObject <ForeignConnector>(parentContainerId2, new ADNotificationCallback(this.HandleForeignConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <MailboxDatabase>(childId7, new ADNotificationCallback(this.HandleDatabaseDeleted));
            this.RegisterChangeNotificationForDeletedObject <ReceiveConnector>(childId5, new ADNotificationCallback(this.HandleReceiveConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <Server>(childId3, new ADNotificationCallback(this.HandleExchangeServerDeleted));
            this.RegisterChangeNotificationForDeletedObject <SmtpSendConnectorConfig>(childId12, new ADNotificationCallback(this.HandleSmtpSendConnectorDeleted));
            this.RegisterChangeNotificationForDeletedObject <TransportRule>(childId8, new ADNotificationCallback(this.HandleTransportRuleDeleted));
            this.RegisterChangeNotificationForDeletedObject <TransportRule>(childId9, new ADNotificationCallback(this.HandleJournalRuleDeleted));
            this.RegisterChangeNotificationForDeletedObject <InterceptorRule>(descendantId, new ADNotificationCallback(this.HandleInterceptorRuleDeleted));
        }
Example #21
0
        internal static IEnumerable <CertificateRecord> FederationCertificates(IConfigurationSession session)
        {
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            ADPagedReader <FederationTrust> dataObjects = null;
            ADOperationResult adoperationResult         = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                ADObjectId orgContainerId = session.GetOrgContainerId();
                ADObjectId descendantId   = orgContainerId.GetDescendantId(FederationTrust.FederationTrustsContainer);
                dataObjects = session.FindPaged <FederationTrust>(descendantId, QueryScope.SubTree, null, null, 0);
            });

            if (!adoperationResult.Succeeded)
            {
                throw adoperationResult.Exception;
            }
            List <CertificateRecord> list = new List <CertificateRecord>();

            foreach (FederationTrust federationTrust in dataObjects)
            {
                if (!string.IsNullOrEmpty(federationTrust.OrgPrevPrivCertificate))
                {
                    CertificateRecord certificateRecord = new CertificateRecord
                    {
                        Type       = FederationCertificateType.PreviousCertificate,
                        Thumbprint = federationTrust.OrgPrevPrivCertificate
                    };
                    CertificateRecord certificateRecord2 = list.Find(new Predicate <CertificateRecord>(certificateRecord.Equals));
                    if (certificateRecord2 != null)
                    {
                        certificateRecord2.Type |= FederationCertificateType.PreviousCertificate;
                    }
                    else
                    {
                        list.Add(certificateRecord);
                    }
                }
                if (!string.IsNullOrEmpty(federationTrust.OrgPrivCertificate))
                {
                    CertificateRecord certificateRecord3 = new CertificateRecord
                    {
                        Type       = FederationCertificateType.CurrentCertificate,
                        Thumbprint = federationTrust.OrgPrivCertificate
                    };
                    CertificateRecord certificateRecord4 = list.Find(new Predicate <CertificateRecord>(certificateRecord3.Equals));
                    if (certificateRecord4 != null)
                    {
                        certificateRecord4.Type |= FederationCertificateType.CurrentCertificate;
                    }
                    else
                    {
                        list.Add(certificateRecord3);
                    }
                }
                if (!string.IsNullOrEmpty(federationTrust.OrgNextPrivCertificate))
                {
                    CertificateRecord certificateRecord5 = new CertificateRecord
                    {
                        Type       = FederationCertificateType.NextCertificate,
                        Thumbprint = federationTrust.OrgNextPrivCertificate
                    };
                    CertificateRecord certificateRecord6 = list.Find(new Predicate <CertificateRecord>(certificateRecord5.Equals));
                    if (certificateRecord6 != null)
                    {
                        certificateRecord6.Type |= FederationCertificateType.NextCertificate;
                    }
                    else
                    {
                        list.Add(certificateRecord5);
                    }
                }
            }
            return(list);
        }
Example #22
0
        private static ADObjectId GetPolicyTipMessageConfigsContainerId(IConfigurationSession session)
        {
            ADObjectId orgContainerId = session.GetOrgContainerId();

            return(orgContainerId.GetDescendantId(PolicyTipMessageConfig.PolicyTipMessageConfigContainer));
        }
Example #23
0
        internal static ADObjectId GetWellKnownParentLocation(ADObjectId orgContainerId)
        {
            ADObjectId defaultsRoot = SmimeConfigurationContainer.DefaultsRoot;

            return(orgContainerId.GetDescendantId(defaultsRoot));
        }
 internal static ADObjectId GetWellKnownParentLocation(ADObjectId orgContainerId)
 {
     return(orgContainerId.GetDescendantId(HybridConfiguration.parentPath));
 }
Example #25
0
        public static ADObjectId GetContainerId(bool isFlight)
        {
            ADObjectId rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();

            return(rootOrgContainerIdForLocalForest.GetDescendantId(isFlight ? SettingOverride.FlightsRelativePath : SettingOverride.SettingsRelativePath));
        }
        private static IOrganizationSettingsData LoadOrganizationSettings(IConfigurationSession scopedSession, IAirSyncContext context)
        {
            ADObjectId organizationId = scopedSession.GetOrgContainerId();
            ActiveSyncOrganizationSettings organizationSettings = null;
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                organizationSettings = scopedSession.Read <ActiveSyncOrganizationSettings>(organizationId.GetDescendantId(new ADObjectId("CN=Mobile Mailbox Settings")));
            });

            if (!adoperationResult.Succeeded)
            {
                AirSyncDiagnostics.TraceDebug <ADObjectId, string>(ExTraceGlobals.RequestsTracer, null, "Exception occurred during AD Operation during LoadOrganizationSettings {0}. Exception Message- {1}", organizationId, adoperationResult.Exception.Message);
            }
            ValidationError[] array = organizationSettings.Validate();
            bool flag = false;

            if (array != null)
            {
                foreach (ValidationError validationError in array)
                {
                    if (string.Equals(validationError.PropertyName, "ConfigurationXMLRaw", StringComparison.OrdinalIgnoreCase))
                    {
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                organizationSettings.DeviceFiltering = null;
            }
            ADRawEntry adrawEntry = scopedSession.ReadADRawEntry(organizationId, new PropertyDefinition[]
            {
                OrganizationSchema.IntuneManagedStatus
            });

            organizationSettings.IsIntuneManaged = (adrawEntry != null && (bool)adrawEntry[OrganizationSchema.IntuneManagedStatus]);
            AirSyncDiagnostics.TraceInfo <bool>(ExTraceGlobals.RequestsTracer, null, "LoadOrganizationSettings from AD.IntuneManagedStatus {0}.", organizationSettings.IsIntuneManaged);
            if (context != null)
            {
                context.ProtocolLogger.SetValue(ProtocolLoggerData.DomainController, scopedSession.LastUsedDc);
            }
            if (organizationSettings != null)
            {
                AirSyncDiagnostics.TraceInfo <int>(ExTraceGlobals.RequestsTracer, null, "LoadOrganizationSettings from AD. Found {0} OrganizationSettings.", 1);
                return(ADNotificationManager.AddOrganizationSettingsToCache(organizationSettings, scopedSession));
            }
            AirSyncDiagnostics.TraceError <ADObjectId>(ExTraceGlobals.RequestsTracer, null, "Cannot find ActiveSyncOrganizationSettings object in AD for organization {0}", organizationId);
            return(null);
        }
Example #27
0
        public RbacContainer GetRbacContainer()
        {
            ADObjectId adobjectId = this.GetOrgContainerId();

            return(this.Read <RbacContainer>(adobjectId.GetDescendantId(new ADObjectId("CN=RBAC"))));
        }
        internal static ADObjectId GetWellKnownParentLocation(ADObjectId orgContainerId)
        {
            ADObjectId relativePath = AdminAuditLogConfig.parentPath;

            return(orgContainerId.GetDescendantId(relativePath));
        }
Example #29
0
        internal static ADObjectId GetWellKnownParentLocation(ADObjectId orgContainerId)
        {
            ADObjectId relativePath = new ADObjectId("CN=Global Settings");

            return(orgContainerId.GetDescendantId(relativePath));
        }
        // Token: 0x06000EC2 RID: 3778 RVA: 0x0002B308 File Offset: 0x00029508
        internal static ADObjectId GetRootContainerId(IConfigurationSession scSession)
        {
            ADObjectId orgContainerId = scSession.GetOrgContainerId();

            return(orgContainerId.GetDescendantId(ManagementScope.RdnScopesContainerToOrganization));
        }