protected override void InternalProcessRecord() { TaskLogger.LogEnter(); ADForest localForest = ADForest.GetLocalForest(); if (this.DomainName != null) { this.WriteResult <ADDomainTrustInfo>(localForest.FindAllTrustedForests()); this.WriteResult <ADDomainTrustInfo>(localForest.FindTrustedDomains(this.DomainName)); } else { HashSet <string> hashSet = new HashSet <string>(); foreach (ADDomainTrustInfo addomainTrustInfo in localForest.FindAllTrustedForests()) { hashSet.Add(addomainTrustInfo.Name); this.WriteResult(addomainTrustInfo); } foreach (ADDomain addomain in localForest.FindDomains()) { foreach (ADDomainTrustInfo addomainTrustInfo2 in localForest.FindTrustedDomains(addomain.Fqdn)) { if (!hashSet.Contains(addomainTrustInfo2.Name)) { hashSet.Add(addomainTrustInfo2.Name); this.WriteResult(addomainTrustInfo2); } } } } TaskLogger.LogExit(); }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); if (this.Credential != null) { base.NetCredential = this.Credential.GetNetworkCredential(); } base.InternalBeginProcessing(); base.WriteVerbose(Strings.VerboseIgnoreDefaultScope); this.domainRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.NetCredential, base.OrgWideSessionSettings, 106, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\recipient\\UpdateRecipient.cs"); this.domainRecipientSession.EnforceDefaultScope = false; ADSessionSettings sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); if (!OrganizationId.ForestWideOrgId.Equals(base.OrgWideSessionSettings.CurrentOrganizationId)) { sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(base.OrgWideSessionSettings.CurrentOrganizationId.PartitionId); } this.configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential, sessionSettings, 120, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\recipient\\UpdateRecipient.cs"); this.localForestLinkResolutionServer = ADSession.GetCurrentConfigDC(base.OrgWideSessionSettings.GetAccountOrResourceForestFqdn()); string fqdn = NativeHelpers.CanonicalNameFromDistinguishedName(this.configurationSession.GetRootDomainNamingContextFromCurrentReadConnection()); if (ADForest.IsLocalForestFqdn(fqdn) || !OrganizationId.ForestWideOrgId.Equals(base.OrgWideSessionSettings.CurrentOrganizationId)) { this.domainRecipientSession.LinkResolutionServer = this.localForestLinkResolutionServer; } TaskLogger.LogExit(); }
internal static ADDomainTrustInfo ResolveAndValidateForestTrustForADDomain(Fqdn domainFqdn, Task.ErrorLoggerDelegate errorDelegate, IConfigurationSession configSession) { if (domainFqdn == null) { throw new ArgumentNullException("domainFqdn"); } if (errorDelegate == null) { throw new ArgumentNullException("errorDelegate"); } if (configSession == null) { throw new ArgumentNullException("configSession"); } ADForest localForest = ADForest.GetLocalForest(); ADDomainTrustInfo[] array = localForest.FindTrustRelationshipsForDomain(domainFqdn); if (array == null || array.Length == 0) { errorDelegate(new ManagementObjectNotFoundException(Strings.ErrorManagementObjectNotFound(domainFqdn.ToString())), ExchangeErrorCategory.Client, null); } else if (array.Length != 1) { errorDelegate(new ManagementObjectAmbiguousException(Strings.ErrorManagementObjectAmbiguous(domainFqdn.ToString())), ExchangeErrorCategory.Client, null); } ADDomainTrustInfo addomainTrustInfo = array[0]; AccountPartition[] array2 = configSession.Find <AccountPartition>(configSession.GetOrgContainerId().GetChildId(AccountPartition.AccountForestContainerName), QueryScope.OneLevel, new ComparisonFilter(ComparisonOperator.Equal, AccountPartitionSchema.TrustedDomainLink, addomainTrustInfo.DistinguishedName), null, 1); if (array2 != null && array2.Length != 0) { errorDelegate(new LocalizedException(Strings.ErrorTrustAlreadyInUse(addomainTrustInfo.Name, array2[0].Name)), ExchangeErrorCategory.Client, null); } return(addomainTrustInfo); }
protected override void InternalValidate() { TaskLogger.LogEnter(); ADForest localForest = ADForest.GetLocalForest(); if (base.Fields.IsModified("Domain")) { this.adDomain = localForest.FindDomainByFqdn(this.Domain); if (this.adDomain == null) { base.WriteError(new DomainNotFoundException(this.Domain), ErrorCategory.InvalidArgument, null); } } else { this.adDomain = localForest.FindLocalDomain(); } string defaultOUForRecipient = RecipientTaskHelper.GetDefaultOUForRecipient(this.adDomain.Id); if (string.IsNullOrEmpty(defaultOUForRecipient)) { base.WriteError(new ArgumentException(Strings.UsersContainerNotFound(this.adDomain.Fqdn, WellKnownGuid.UsersWkGuid)), ErrorCategory.InvalidArgument, null); } this.containerId = new ADObjectId(NativeHelpers.DistinguishedNameFromCanonicalName(defaultOUForRecipient)); base.InternalValidate(); TaskLogger.LogExit(); }
private IRecipientSession CreateWriteableRecipientSessionForRootDomain() { ADDomain addomain = ADForest.GetLocalForest().FindRootDomain(true); if (addomain == null) { base.ThrowTerminatingError(new RootDomainNotFoundException(), ErrorCategory.InvalidData, null); } return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(addomain.OriginatingServer, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 382, "CreateWriteableRecipientSessionForRootDomain", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\UpdateRmsSharedIdentity.cs")); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); IConfigurationSession configurationSession = base.DataSession as IConfigurationSession; if (this.Identity != null) { this.Identity.IncludeContainers = this.IncludeContainers; if (this.SingleNodeOnly) { IConfigurable dataObject = base.GetDataObject(this.Identity); base.WriteResult(dataObject); IEnumerable <ExtendedOrganizationalUnit> dataObjects = ExtendedOrganizationalUnit.FindFirstLevelChildOrganizationalUnit(this.IncludeContainers, configurationSession, dataObject.Identity as ADObjectId, this.InternalFilter, this.InternalSortBy, this.PageSize); base.WriteResult <ExtendedOrganizationalUnit>(dataObjects); } else { base.InternalProcessRecord(); } } else { if (this.SingleNodeOnly) { if (this.IsTenant) { ExtendedOrganizationalUnit dataObject2 = configurationSession.Read <ExtendedOrganizationalUnit>((ADObjectId)this.RootId); this.WriteResult(dataObject2); goto IL_195; } ReadOnlyCollection <ADDomain> readOnlyCollection = ADForest.GetLocalForest(configurationSession.DomainController).FindTopLevelDomains(); using (ReadOnlyCollection <ADDomain> .Enumerator enumerator = readOnlyCollection.GetEnumerator()) { while (enumerator.MoveNext()) { ADDomain addomain = enumerator.Current; ExtendedOrganizationalUnit dataObject3 = configurationSession.Read <ExtendedOrganizationalUnit>(addomain.Id); this.WriteResult(dataObject3); } goto IL_195; } } IEnumerable <ExtendedOrganizationalUnit> enumerable = ExtendedOrganizationalUnit.FindSubTreeChildOrganizationalUnit(this.IncludeContainers, configurationSession, this.IsTenant ? ((ADObjectId)this.RootId) : null, this.InternalFilter); if (!string.IsNullOrEmpty(this.SearchText)) { string nameToSearch = this.SearchText.ToUpper(); enumerable = from ou in enumerable where ou.CanonicalName.ToUpper().Contains(nameToSearch) select ou; } this.WriteResult <ExtendedOrganizationalUnit>(enumerable); } IL_195: TaskLogger.LogExit(); }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); if (!string.IsNullOrEmpty(this.Domain)) { ADForest localForest = ADForest.GetLocalForest(); if (localForest.FindDomainByFqdn(this.Domain) == null) { base.ThrowTerminatingError(new DomainNotFoundException(this.Domain.ToString()), ErrorCategory.InvalidArgument, this.Domain); } } TaskLogger.LogExit(); }
private void PopulateADServersList() { List <ADServer> list = new List <ADServer>(); foreach (ADDomain addomain in ADForest.GetForest(new PartitionId(this.forestFqdn)).FindDomains()) { foreach (ADServer adserver in addomain.FindAllDomainControllers(true)) { if (adserver.DnsHostName != null) { list.Add(adserver); } } } this.lastTopologyUpdateTime = ExDateTime.UtcNow; this.serversList = list; }
private string SourceForestFqdn() { string result = string.Empty; if (this.PreferredSourceFqdn != null) { result = this.PreferredSourceFqdn.ToString(); } else if (this.inSource) { result = ADForest.GetLocalForest(this.sourceConfigSession.DomainController).Fqdn; } else { result = NativeHelpers.CanonicalNameFromDistinguishedName(this.sourceServiceContainer.Id.Parent.Parent.DistinguishedName); } return(result); }
// Token: 0x0600145B RID: 5211 RVA: 0x00075C04 File Offset: 0x00073E04 private string GetForestFQDN() { this.diagnosticLogger.LogDebug("Computing forest FQDN.", new object[0]); string forestFqdn = string.Empty; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { ADForest localForest = ADForest.GetLocalForest(); forestFqdn = localForest.Fqdn; }, 1); if (!adoperationResult.Succeeded) { this.diagnosticLogger.LogError("Unable to get the local ADForest {0}", new object[] { adoperationResult.Exception.Message }); } return(forestFqdn); }
public static ADGroup GetWellKnownGroup(Guid groupGuid, IConfigurationSession configSession, ManageSendConnectors.ThrowTerminatingErrorDelegate throwDelegate, out IRecipientSession recipSession, out ITopologyConfigurationSession gcSession) { TaskLogger.LogEnter(); ADGroup adgroup = null; recipSession = null; recipSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 530, "GetWellKnownGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Transport\\ManageSendConnectors.cs"); try { recipSession.UseGlobalCatalog = true; adgroup = recipSession.ResolveWellKnownGuid<ADGroup>(groupGuid, configSession.ConfigurationNamingContext); recipSession.UseGlobalCatalog = false; adgroup = (ADGroup)recipSession.Read(adgroup.Id); } finally { recipSession.UseGlobalCatalog = false; } if (adgroup == null) { try { ADDomain addomain = ADForest.GetLocalForest().FindRootDomain(true); if (addomain != null) { recipSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(addomain.OriginatingServer, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 564, "GetWellKnownGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Transport\\ManageSendConnectors.cs"); adgroup = recipSession.ResolveWellKnownGuid<ADGroup>(groupGuid, configSession.ConfigurationNamingContext); } } catch (ADReferralException) { } } if (adgroup == null) { throwDelegate(new ErrorExchangeGroupNotFoundException(groupGuid), ErrorCategory.ObjectNotFound, null); } gcSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 589, "GetWellKnownGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\Transport\\ManageSendConnectors.cs"); gcSession.UseConfigNC = false; gcSession.UseGlobalCatalog = true; TaskLogger.LogExit(); return adgroup; }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); base.CreateParentContainerIfNeeded(this.DataObject); if (CommonConstants.UseDataCenterCallRouting) { this.DataObject.PhoneContext = base.Name + "." + Guid.NewGuid().ToString("D"); } else { this.DataObject.PhoneContext = base.Name + "." + ADForest.GetLocalForest().Fqdn; } if (this.DataObject.SubscriberType == UMSubscriberType.Consumer) { this.DataObject.CallSomeoneEnabled = false; this.DataObject.SendVoiceMsgEnabled = false; } this.DataObject.AudioCodec = AudioCodecEnum.Mp3; UMMailboxPolicy ummailboxPolicy = null; if (base.Fields["GenerateUMMailboxPolicy"] == null || (bool)base.Fields["GenerateUMMailboxPolicy"]) { base.DataSession.Save(this.DataObject); ummailboxPolicy = this.AutoGeneratePolicy(); } base.InternalProcessRecord(); if (!base.HasErrors) { UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_NewDialPlanCreated, null, new object[] { base.Name }); } else if (ummailboxPolicy != null) { base.DataSession.Delete(ummailboxPolicy); base.DataSession.Delete(this.DataObject); } TaskLogger.LogExit(); }