// Token: 0x060003DA RID: 986 RVA: 0x0000E5A8 File Offset: 0x0000C7A8 protected override IConfigDataProvider CreateSession() { IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, base.NetCredential, base.SessionSettings, 285, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\GetAdObjectTask.cs"); if (this.InternalIgnoreDefaultScope) { tenantOrRootOrgRecipientSession.EnforceDefaultScope = false; tenantOrRootOrgRecipientSession.UseGlobalCatalog = (this.Identity == null); } else { bool flag; if (this.ReadFromDomainController && this.Identity != null) { TIdentity identity = this.Identity; flag = ADObjectId.IsValidDistinguishedName(identity.RawIdentity); } else { flag = false; } bool flag2 = flag; bool viewEntireForest = base.ServerSettings.ViewEntireForest; tenantOrRootOrgRecipientSession.UseGlobalCatalog = (base.DomainController == null && viewEntireForest && !flag2); } return(tenantOrRootOrgRecipientSession); }
public static string DistinguishedNameFromCanonicalName(string canonicalName, ADServerSettings serverSettings) { if (canonicalName.IndexOf('/') != canonicalName.LastIndexOf('/') && !canonicalName.EndsWith("\\/")) { canonicalName = canonicalName.TrimEnd(new char[] { '/' }); } if (!canonicalName.Contains("/")) { canonicalName += "/"; } string text = null; uint err = 0U; bool flag = NativeHelpers.TryDsCrackNames(canonicalName, ExtendedNameFormat.NameCanonical, ExtendedNameFormat.NameFullyQualifiedDN, serverSettings, out text, out err); bool flag2 = ADObjectId.IsValidDistinguishedName(text); if (!flag || !flag2) { throw new NameConversionException(DirectoryStrings.ErrorConversionFailedWithError(canonicalName, err)); } return(text); }
// Token: 0x06000461 RID: 1121 RVA: 0x0000FAD0 File Offset: 0x0000DCD0 public static object ConvertValueFromString(object valueToConvert, Type resultType) { string text = valueToConvert as string; if (resultType.IsGenericType && resultType.GetGenericTypeDefinition() == typeof(Nullable <>)) { bool flag = text == null || "null".Equals(text, StringComparison.OrdinalIgnoreCase) || "$null".Equals(text, StringComparison.OrdinalIgnoreCase); if (flag) { return(null); } } if (resultType.Equals(typeof(ADObjectId)) && !string.IsNullOrEmpty(text) && !ADObjectId.IsValidDistinguishedName(text)) { try { text = NativeHelpers.DistinguishedNameFromCanonicalName(text); } catch (NameConversionException) { throw new FormatException(DirectoryStrings.InvalidDNFormat(text)); } } if (!resultType.Equals(typeof(bool)) && !resultType.Equals(typeof(bool?))) { return(LanguagePrimitives.ConvertTo(text, resultType)); } if (text == null) { return(false); } return(bool.Parse(text)); }
protected static object GetSingleProperty(object prop, Type type) { if (prop == null) { return(null); } object obj = null; if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>)) { obj = MockObjectCreator.GetSingleProperty(prop, type.GetGenericArguments()[0]); } else if (type == typeof(ADObjectId) && prop is PSObject) { obj = new ADObjectId(((PSObject)prop).Members["DistinguishedName"].Value.ToString(), new Guid(((PSObject)prop).Members["ObjectGuid"].Value.ToString())); } else if (type == typeof(EnhancedTimeSpan)) { obj = EnhancedTimeSpan.Parse(prop.ToString()); } else if (type == typeof(Unlimited <EnhancedTimeSpan>)) { obj = Unlimited <EnhancedTimeSpan> .Parse(prop.ToString()); } else if (type == typeof(ByteQuantifiedSize)) { obj = ByteQuantifiedSize.Parse(prop.ToString()); } else if (type == typeof(Unlimited <ByteQuantifiedSize>)) { obj = Unlimited <ByteQuantifiedSize> .Parse(prop.ToString()); } else if (type == typeof(Unlimited <int>)) { obj = Unlimited <int> .Parse(prop.ToString()); } else if (type == typeof(ProxyAddress)) { obj = ProxyAddress.Parse(prop.ToString()); } else if (type == typeof(SmtpAddress)) { obj = new SmtpAddress(prop.ToString()); } else if (type == typeof(SmtpDomain)) { obj = SmtpDomain.Parse(prop.ToString()); } else if (type == typeof(CountryInfo)) { obj = CountryInfo.Parse(prop.ToString()); } else if (type == typeof(SharingPolicyDomain)) { obj = SharingPolicyDomain.Parse(prop.ToString()); } else if (type == typeof(ApprovedApplication)) { obj = ApprovedApplication.Parse(prop.ToString()); } else if (type == typeof(SmtpDomainWithSubdomains)) { obj = SmtpDomainWithSubdomains.Parse(prop.ToString()); } else if (type == typeof(UMLanguage)) { obj = UMLanguage.Parse(prop.ToString()); } else if (type == typeof(UMSmartHost)) { obj = UMSmartHost.Parse(prop.ToString()); } else if (type == typeof(ScheduleInterval)) { obj = ScheduleInterval.Parse(prop.ToString()); } else if (type == typeof(NumberFormat)) { obj = NumberFormat.Parse(prop.ToString()); } else if (type == typeof(DialGroupEntry)) { obj = DialGroupEntry.Parse(prop.ToString()); } else if (type == typeof(CustomMenuKeyMapping)) { obj = CustomMenuKeyMapping.Parse(prop.ToString()); } else if (type == typeof(HolidaySchedule)) { obj = HolidaySchedule.Parse(prop.ToString()); } else if (type == typeof(UMTimeZone)) { obj = UMTimeZone.Parse(prop.ToString()); } else if (type == typeof(ServerVersion)) { obj = ServerVersion.ParseFromSerialNumber(prop.ToString()); } else if (type == typeof(X509Certificate2)) { obj = new X509Certificate2(((PSObject)prop).Members["RawData"].Value as byte[]); } else if (type == typeof(LocalizedString)) { obj = new LocalizedString(prop.ToString()); } else if (type == typeof(ExchangeObjectVersion)) { obj = ExchangeObjectVersion.Parse(prop.ToString()); } else if (type == typeof(bool)) { obj = bool.Parse(prop.ToString()); } else if (type == typeof(SecurityPrincipalIdParameter)) { obj = new SecurityPrincipalIdParameter(prop.ToString()); } else if (type == typeof(ActiveDirectoryAccessRule)) { obj = (prop as ActiveDirectoryAccessRule); } else if (type == typeof(ObjectId)) { string text = prop.ToString(); if (!ADObjectId.IsValidDistinguishedName(text) && text.Contains("/")) { text = MockObjectCreator.ConvertDNFromTreeStructure(text); } obj = new ADObjectId(text); } else if (type.IsEnum) { try { obj = Enum.Parse(type, prop.ToString()); } catch (ArgumentException) { obj = Enum.GetValues(type).GetValue(0); } } return(obj ?? prop); }
// Token: 0x06001254 RID: 4692 RVA: 0x00069B14 File Offset: 0x00067D14 private bool OABAddressListsAreValid(OfflineAddressBook oab) { bool flag = true; ADObjectId adobjectId = null; foreach (ADObjectId adobjectId2 in oab.AddressLists) { if (string.IsNullOrEmpty(adobjectId2.DistinguishedName)) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it does not have a DN", new object[] { adobjectId2 }); break; } if (!ADObjectId.IsValidDistinguishedName(adobjectId2.DistinguishedName)) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because the DN is not validly formed", new object[] { adobjectId2.DistinguishedName }); break; } if (adobjectId2.IsDeleted) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it is a deleted object", new object[] { adobjectId2.DistinguishedName }); break; } bool flag2 = adobjectId2.DistinguishedName.IndexOf(",CN=LostAndFound,DC=", StringComparison.OrdinalIgnoreCase) != -1; bool flag3 = adobjectId2.DistinguishedName.IndexOf(",CN=LostAndFoundConfig,CN=Configuration,DC=", StringComparison.OrdinalIgnoreCase) != -1; if (flag2 || flag3) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it is a deleted object", new object[] { adobjectId2.DistinguishedName }); break; } bool flag4 = adobjectId2.DistinguishedName.IndexOf(GlobalAddressList.RdnGalContainerToOrganization.DistinguishedName, StringComparison.OrdinalIgnoreCase) > 0; bool flag5 = adobjectId2.DistinguishedName.IndexOf(AddressList.RdnAlContainerToOrganization.DistinguishedName, StringComparison.OrdinalIgnoreCase) > 0; if (!flag4 && !flag5) { flag = false; adobjectId = adobjectId2; OABLogger.LogRecord(TraceType.ErrorTrace, "Address list id {0} is not valid because it is not a child or descendant of either the All Global Address Lists or All Address Lists container", new object[] { adobjectId2.DistinguishedName }); break; } } if (!flag && adobjectId != null) { OABLogger.LogEvent(InfoWorkerEventLogConstants.Tuple_OABNotProcessedBecauseAddressListIsInvalid, new object[] { oab.Identity, string.IsNullOrEmpty(adobjectId.DistinguishedName) ? adobjectId.ToString() : adobjectId.DistinguishedName }); OABLogger.LogRecord(TraceType.ErrorTrace, "Address list errors found in OAB {0}, address list {1}", new object[] { oab.Id, string.IsNullOrEmpty(adobjectId.DistinguishedName) ? adobjectId.ToString() : adobjectId.DistinguishedName }); } return(flag); }