Пример #1
0
		public static void ToDirectoryGroupScope(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			ADGroupScope aDGroupScope = ADGroupScope.DomainLocal;
			if (extendedData != null)
			{
				if (extendedData.Value != null)
				{
					ADGroupScope value = (ADGroupScope)extendedData.Value;
					int directoryGroupTypeValue = GroupTypeUtils.GetDirectoryGroupTypeValue(value);
					if (!directoryObj.Contains(directoryAttributes[0]))
					{
						directoryObj.Add(directoryAttributes[0], directoryGroupTypeValue);
					}
					else
					{
						int num = (int)directoryObj[directoryAttributes[0]].Value;
						if (GroupTypeUtils.TryGetExtendedGroupScopeValue(num, out aDGroupScope))
						{
							int directoryGroupTypeValue1 = GroupTypeUtils.GetDirectoryGroupTypeValue(aDGroupScope);
							num = num & ~directoryGroupTypeValue1;
						}
						directoryObj[directoryAttributes[0]].Value = num + directoryGroupTypeValue;
						return;
					}
				}
				else
				{
					return;
				}
			}
		}
Пример #2
0
		internal static void ToExtendedAttributeMetadataValue(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj["sourceXmlAttribute"].Value as string;
			if (!string.Equals("msDS-ReplAttributeMetaData", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-ReplValueMetaData", value, StringComparison.OrdinalIgnoreCase))
				{
					AttributeConverters.ToExtendedObject(extendedAttribute, directoryAttributes, userObj, directoryObj, cmdletSessionInfo);
				}
				return;
			}
			else
			{
				string str = directoryObj["pszAttributeName"].Value as string;
				if (string.IsNullOrEmpty(str))
				{
					userObj.SetValue(extendedAttribute, null);
					return;
				}
				else
				{
					userObj.SetValue(extendedAttribute, directoryObj[str]);
					return;
				}
			}
		}
Пример #3
0
        internal ADEntity GetForest()
        {
            this.Init();
            GetADForestRequest  getADForestRequest = new GetADForestRequest();
            GetADForestResponse aDForest           = this._topoMgmt.GetADForest(this._sessionHandle, getADForestRequest);

            if (aDForest.Forest == null)
            {
                return(null);
            }
            else
            {
                ActiveDirectoryForest forest = aDForest.Forest;
                ADEntity aDEntity            = new ADEntity();
                aDEntity.Add("msDS-SPNSuffixes", forest.SPNSuffixes);
                aDEntity.Add("uPNSuffixes", forest.UPNSuffixes);
                aDEntity.Add("msDS-Behavior-Version", (ADForestMode)forest.ForestMode);
                aDEntity.Add("name", forest.Name);
                aDEntity.Add("RootDomain", forest.RootDomain);
                aDEntity.Add("ApplicationPartitions", forest.ApplicationPartitions);
                aDEntity.Add("CrossForestReferences", forest.CrossForestReferences);
                aDEntity.Add("Domains", forest.Domains);
                aDEntity.Add("GlobalCatalogs", forest.GlobalCatalogs);
                aDEntity.Add("Sites", forest.Sites);
                aDEntity.Add("DomainNamingMaster", forest.DomainNamingMaster);
                aDEntity.Add("SchemaMaster", forest.SchemaMaster);
                return(aDEntity);
            }
        }
Пример #4
0
        internal static object GetPropertyValue(ADEntity targetEntity, string propertyName)
        {
            PropertyInfo dotNetProperty = targetEntity.GetDotNetProperty(propertyName);

            if (dotNetProperty == null)
            {
                if (targetEntity.PropertyIsReadable(propertyName))
                {
                    ADPropertyValueCollection item = targetEntity[propertyName];
                    if (targetEntity.PropertyIsSingleValue(propertyName))
                    {
                        if (item == null || item.Count == 0)
                        {
                            return(null);
                        }
                        else
                        {
                            return(item[0]);
                        }
                    }
                    else
                    {
                        return(item);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(dotNetProperty.GetValue(targetEntity, null));
            }
        }
Пример #5
0
 public override bool IsSettable(PSAdaptedProperty property)
 {
     if (property != null)
     {
         ADEntity baseObject = property.BaseObject as ADEntity;
         if (baseObject != null)
         {
             PropertyInfo dotNetProperty = baseObject.GetDotNetProperty(property.Name);
             if (dotNetProperty == null)
             {
                 return(baseObject.PropertyIsWritable(property.Name));
             }
             else
             {
                 return(dotNetProperty.CanWrite);
             }
         }
         else
         {
             object[] typeAdapterTypeName = new object[2];
             typeAdapterTypeName[0] = ADEntityAdapter.TypeAdapterTypeName;
             typeAdapterTypeName[1] = ADEntityAdapter.ADEntityTypeName;
             throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.TypeAdapterForADEntityOnly, typeAdapterTypeName));
         }
     }
     else
     {
         throw new ArgumentNullException("property");
     }
 }
Пример #6
0
 private object GetPropertyValue(object targetObject, string propertyName)
 {
     if (targetObject != null)
     {
         ADEntity aDEntity = targetObject as ADEntity;
         if (aDEntity == null)
         {
             PropertyInfo property = targetObject.GetType().GetProperty(propertyName);
             if (property != null)
             {
                 return(property.GetValue(targetObject, null));
             }
             else
             {
                 object[] str = new object[2];
                 str[0] = propertyName;
                 str[1] = targetObject.GetType().ToString();
                 throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ADFilterPropertyNotFoundInObject, str));
             }
         }
         else
         {
             return(ADEntityAdapter.GetPropertyValue(aDEntity, propertyName));
         }
     }
     else
     {
         throw new ArgumentNullException("targetObject");
     }
 }
Пример #7
0
		public static void ToDirectoryAccountExpirationDate(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (extendedData.Count != 0 && extendedData[0] != null)
			{
				DateTime item = (DateTime)extendedData[0];
				if (item.Ticks != 0x89f7ff5f7b58000L)
				{
					AttributeConverters.ToDirectoryDateTime(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
					return;
				}
			}
			directoryObj.SetValue(directoryAttributes[0], 0x7fffffffffffffffL);
		}
 public ADDefaultDomainPasswordPolicy(ADEntity adentity)
 {
     if (adentity != null)
     {
         base.Identity = adentity;
         if (adentity.IsSearchResult)
         {
             base.SessionInfo = adentity.SessionInfo;
         }
         return;
     }
     else
     {
         throw new ArgumentException("adentity");
     }
 }
Пример #9
0
 static ADObject()
 {
     string[] strArrays = new string[4];
     strArrays[0] = "distinguishedName";
     strArrays[1] = "name";
     strArrays[2] = "objectClass";
     strArrays[3] = "objectGUID";
     ADObject.DefaultProperties = strArrays;
     string[] strArrays1 = new string[4];
     strArrays1[0] = "distinguishedName";
     strArrays1[1] = "name";
     strArrays1[2] = "objectClass";
     strArrays1[3] = "objectGUID";
     ADObject.IdentityPropertyNames = strArrays1;
     ADEntity.RegisterMappingTable(typeof(ADObject), ADObjectFactory <ADObject> .AttributeTable);
 }
Пример #10
0
        internal ADEntity[] GetDomainController(string[] dcNtdsSettingsDN)
        {
            this.Init();
            GetADDomainControllerRequest getADDomainControllerRequest = new GetADDomainControllerRequest();

            getADDomainControllerRequest.NtdsSettingsDN = dcNtdsSettingsDN;
            GetADDomainControllerResponse aDDomainController = this._topoMgmt.GetADDomainController(this._sessionHandle, getADDomainControllerRequest);
            List <ADEntity> aDEntities = new List <ADEntity>();

            if (aDDomainController.DomainControllers == null)
            {
                return(new ADEntity[0]);
            }
            else
            {
                ActiveDirectoryDomainController[] domainControllers = aDDomainController.DomainControllers;
                for (int i = 0; i < (int)domainControllers.Length; i++)
                {
                    ActiveDirectoryDomainController activeDirectoryDomainController = domainControllers[i];
                    ADEntity aDEntity = new ADEntity();
                    aDEntity.Add("ComputerDN", activeDirectoryDomainController.ComputerDN);
                    aDEntity.Add("Domain", activeDirectoryDomainController.Domain);
                    aDEntity.Add("Forest", activeDirectoryDomainController.Forest);
                    aDEntity.Add("Enabled", activeDirectoryDomainController.Enabled);
                    aDEntity.Add("IsGlobalCatalog", activeDirectoryDomainController.IsGlobalCatalog);
                    aDEntity.Add("IsReadOnly", activeDirectoryDomainController.IsReadOnly);
                    aDEntity.Add("OSHotFix", activeDirectoryDomainController.OSHotFix);
                    aDEntity.Add("OSName", activeDirectoryDomainController.OSName);
                    aDEntity.Add("OSServicepack", activeDirectoryDomainController.OSServicepack);
                    aDEntity.Add("OSVersion", activeDirectoryDomainController.OSVersion);
                    aDEntity.Add("DefaultPartition", activeDirectoryDomainController.DefaultPartition);
                    aDEntity.Add("HostName", activeDirectoryDomainController.HostName);
                    aDEntity.Add("InvocationId", activeDirectoryDomainController.InvocationId);
                    aDEntity.Add("LdapPort", activeDirectoryDomainController.LdapPort);
                    aDEntity.Add("NTDSSettingsObjectDN", activeDirectoryDomainController.NTDSSettingsObjectDN);
                    aDEntity.Add("Name", activeDirectoryDomainController.Name);
                    aDEntity.Add("OperationMasterRole", activeDirectoryDomainController.OperationMasterRole);
                    aDEntity.Add("Partitions", activeDirectoryDomainController.Partitions);
                    aDEntity.Add("ServerObjectDN", activeDirectoryDomainController.ServerObjectDN);
                    aDEntity.Add("ServerObjectGuid", activeDirectoryDomainController.ServerObjectGuid);
                    aDEntity.Add("Site", activeDirectoryDomainController.Site);
                    aDEntity.Add("SslPort", activeDirectoryDomainController.SslPort);
                    aDEntities.Add(aDEntity);
                }
                return(aDEntities.ToArray());
            }
        }
Пример #11
0
		internal static void ToExtendedReplicationFailureType(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj[directoryAttributes[0]].Value as string;
			if (!string.Equals("msDS-ReplConnectionFailures", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-ReplLinkFailures", value, StringComparison.OrdinalIgnoreCase))
				{
					userObj.Add(extendedAttribute, ADReplicationFailureType.Link);
				}
				return;
			}
			else
			{
				userObj.Add(extendedAttribute, ADReplicationFailureType.Connection);
				return;
			}
		}
Пример #12
0
		internal static void ToExtendedReplicationPartnerType(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj[directoryAttributes[0]].Value as string;
			if (!string.Equals("msDS-NCReplInboundNeighbors", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-NCReplOutboundNeighbors", value, StringComparison.OrdinalIgnoreCase))
				{
					userObj.Add(extendedAttribute, ADPartnerType.Outbound);
				}
				return;
			}
			else
			{
				userObj.Add(extendedAttribute, ADPartnerType.Inbound);
				return;
			}
		}
Пример #13
0
		internal static void ToExtendedIsLinkValue(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			string value = directoryObj[directoryAttributes[0]].Value as string;
			if (!string.Equals("msDS-ReplAttributeMetaData", value, StringComparison.OrdinalIgnoreCase))
			{
				if (string.Equals("msDS-ReplValueMetaData", value, StringComparison.OrdinalIgnoreCase))
				{
					userObj.Add(extendedAttribute, true);
				}
				return;
			}
			else
			{
				userObj.Add(extendedAttribute, false);
				return;
			}
		}
Пример #14
0
		internal static void ToDirectoryComputerSamAccountName(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (extendedData == null || extendedData.Value == null)
			{
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
				return;
			}
			else
			{
				string value = extendedData.Value as string;
				if (!string.IsNullOrEmpty(value) && !value.EndsWith("$", StringComparison.OrdinalIgnoreCase))
				{
					value = string.Concat(value, "$");
				}
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, new ADPropertyValueCollection(value), directoryObj, cmdletSessionInfo);
				return;
			}
		}
Пример #15
0
		internal static ADObject GetObjectFromIdentitySearcher(ADObjectSearcher searcher, ADEntity identityObj, string searchRoot, AttributeSetRequest attrs, CmdletSessionInfo cmdletSessionInfo, out string[] warningMessages)
		{
			ADObject aDObject;
			bool flag = false;
			warningMessages = new string[0];
			using (searcher)
			{
				searcher.Properties.AddRange(attrs.DirectoryAttributes);
				DebugLogger.LogInfo("ADFactoryUtil", string.Format("GetObjectFromIdentity: Searching for identity using filter: {0} searchbase: {1}", searcher.Filter.GetLdapFilterString(), searcher.SearchRoot));
				aDObject = searcher.FindOne(out flag);
				if (aDObject != null)
				{
					if (flag)
					{
						throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
					}
				}
				else
				{
					DebugLogger.LogInfo("ADFactoryUtil", string.Format("GetObjectFromIdentity: Identity not found.", new object[0]));
					object[] str = new object[2];
					str[0] = identityObj.ToString();
					str[1] = searchRoot;
					throw new ADIdentityNotFoundException(string.Format(CultureInfo.CurrentCulture, StringResources.IdentityNotFound, str));
				}
			}
			string str1 = ADForestPartitionInfo.ExtractPartitionInfo(cmdletSessionInfo.ADRootDSE, aDObject.DistinguishedName, false);
			if (cmdletSessionInfo.CmdletParameters.Contains("Partition"))
			{
				string item = cmdletSessionInfo.CmdletParameters["Partition"] as string;
				if (!ADPathModule.ComparePath(item, str1, ADPathFormat.X500))
				{
					string[] strArrays = new string[1];
					object[] objArray = new object[3];
					objArray[0] = identityObj.ToString();
					objArray[1] = str1;
					objArray[2] = item;
					strArrays[0] = string.Format(CultureInfo.CurrentCulture, StringResources.IdentityInWrongPartition, objArray);
					warningMessages = strArrays;
				}
			}
			cmdletSessionInfo.DefaultPartitionPath = str1;
			return aDObject;
		}
Пример #16
0
		internal static void ToDirectoryServiceAccountSamAccountName(string extendedAttribute, string[] directoryAttributes, ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			int num;
			if (extendedData == null || extendedData.Value == null)
			{
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
				return;
			}
			else
			{
				string value = extendedData.Value as string;
				if (!string.IsNullOrEmpty(value))
				{
					bool flag = value.EndsWith("$", StringComparison.OrdinalIgnoreCase);
					int length = value.Length;
					if (flag)
					{
						num = 16;
					}
					else
					{
						num = 15;
					}
					if (length <= num)
					{
						if (!flag)
						{
							value = string.Concat(value, "$");
						}
					}
					else
					{
						object[] objArray = new object[1];
						objArray[0] = value;
						throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, StringResources.ServiceAccountNameLengthInvalid, objArray));
					}
				}
				AttributeConverters.ToDirectoryObject(extendedAttribute, directoryAttributes, new ADPropertyValueCollection(value), directoryObj, cmdletSessionInfo);
				return;
			}
		}
Пример #17
0
        public override Collection <PSAdaptedProperty> GetProperties(object baseObject)
        {
            ADEntity aDEntity = baseObject as ADEntity;

            if (aDEntity != null)
            {
                Collection <PSAdaptedProperty> pSAdaptedProperties = new Collection <PSAdaptedProperty>();
                foreach (string propertyName in aDEntity.PropertyNames)
                {
                    pSAdaptedProperties.Add(new PSAdaptedProperty(propertyName, null));
                }
                return(pSAdaptedProperties);
            }
            else
            {
                object[] typeAdapterTypeName = new object[2];
                typeAdapterTypeName[0] = ADEntityAdapter.TypeAdapterTypeName;
                typeAdapterTypeName[1] = ADEntityAdapter.ADEntityTypeName;
                throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.TypeAdapterForADEntityOnly, typeAdapterTypeName));
            }
        }
Пример #18
0
		public static void ToExtendedAccountExpirationDate(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (directoryObj[directoryAttributes[0]].Value != null)
			{
				long value = (long)directoryObj[directoryAttributes[0]].Value;
				if (value == (long)0 || value == 0x7fffffffffffffffL)
				{
					userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
					return;
				}
				else
				{
					AttributeConverters.ToExtendedDateTimeFromLong(extendedAttribute, directoryAttributes, userObj, directoryObj, cmdletSessionInfo);
					return;
				}
			}
			else
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
				return;
			}
		}
Пример #19
0
 static ADRootDSE()
 {
     ADRootDSE._supportedCapabilitiesTable = new Hashtable(StringComparer.OrdinalIgnoreCase);
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.800", "LDAP_CAP_ACTIVE_DIRECTORY_OID");
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.1670", "LDAP_CAP_ACTIVE_DIRECTORY_V51_OID");
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.1791", "LDAP_CAP_ACTIVE_DIRECTORY_LDAP_INTEG_OID");
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.1935", "LDAP_CAP_ACTIVE_DIRECTORY_V61_OID");
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.1920", "LDAP_CAP_ACTIVE_DIRECTORY_PARTIAL_SECRETS_OID");
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.1851", "LDAP_CAP_ACTIVE_DIRECTORY_ADAM_OID");
     ADRootDSE._supportedCapabilitiesTable.Add("1.2.840.113556.1.4.1880", "LDAP_CAP_ACTIVE_DIRECTORY_ADAM_DIGEST");
     ADRootDSE._supportedControlTable = new Hashtable(StringComparer.OrdinalIgnoreCase);
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.319", "LDAP_PAGED_RESULT_OID_STRING");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.801", "LDAP_SERVER_SD_FLAGS_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.473", "LDAP_SERVER_SORT_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.528", "LDAP_SERVER_NOTIFICATION_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.417", "LDAP_SERVER_SHOW_DELETED_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.619", "LDAP_SERVER_LAZY_COMMIT_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.841", "LDAP_SERVER_DIRSYNC_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.529", "LDAP_SERVER_EXTENDED_DN_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.805", "LDAP_SERVER_TREE_DELETE_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.521", "LDAP_SERVER_CROSSDOM_MOVE_TARGET_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.970", "LDAP_SERVER_GET_STATS_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1338", "LDAP_SERVER_VERIFY_NAME_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.474", "LDAP_SERVER_RESP_SORT_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1339", "LDAP_SERVER_DOMAIN_SCOPE_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1340", "LDAP_SERVER_SEARCH_OPTIONS_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1413", "LDAP_SERVER_PERMISSIVE_MODIFY_OID");
     ADRootDSE._supportedControlTable.Add("2.16.840.1.113730.3.4.9", "LDAP_CONTROL_VLVREQUEST");
     ADRootDSE._supportedControlTable.Add("2.16.840.1.113730.3.4.10", "LDAP_CONTROL_VLVRESPONSE");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1504", "LDAP_SERVER_ASQ_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1852", "LDAP_SERVER_QUOTA_CONTROL_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.802", "LDAP_SERVER_RANGE_OPTION_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1907", "LDAP_SERVER_SHUTDOWN_NOTIFY_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1948", "LDAP_SERVER_RANGE_RETRIEVAL_NOERR_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1974", "LDAP_SERVER_FORCE_UPDATE_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.1341", "LDAP_SERVER_RODC_DCPROMO_OID");
     ADRootDSE._supportedControlTable.Add("1.2.840.113556.1.4.2026", "LDAP_SERVER_DN_INPUT_OID");
     ADEntity.RegisterMappingTable(typeof(ADRootDSE), null);
 }
Пример #20
0
		private static bool EveryoneDeniedDeleteAndDeleteTree(ADEntity directoryObj)
		{
			bool flag;
			ActiveDirectorySecurity value = (ActiveDirectorySecurity)directoryObj["nTSecurityDescriptor"].Value;
			ActiveDirectoryAccessRule deleteAndDeleteTreeAccessRule = ProtectedFromDeletionUtil.ACEConstants.DeleteAndDeleteTreeAccessRule;
			IEnumerator enumerator = value.GetAccessRules(true, true, typeof(SecurityIdentifier)).GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ActiveDirectoryAccessRule current = (ActiveDirectoryAccessRule)enumerator.Current;
					if (current.AccessControlType != AccessControlType.Allow || !Utils.HasFlagsSet((int)current.ActiveDirectoryRights, 0x10000) && !Utils.HasFlagsSet((int)current.ActiveDirectoryRights, 64))
					{
						if (current.InheritanceFlags != deleteAndDeleteTreeAccessRule.InheritanceFlags || !(current.IdentityReference == deleteAndDeleteTreeAccessRule.IdentityReference) || current.AccessControlType != deleteAndDeleteTreeAccessRule.AccessControlType || !Utils.HasFlagsSet((int)current.ActiveDirectoryRights, (int)deleteAndDeleteTreeAccessRule.ActiveDirectoryRights))
						{
							continue;
						}
						flag = true;
						return flag;
					}
					else
					{
						flag = false;
						return flag;
					}
				}
				return false;
			}
			finally
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
			return flag;
		}
Пример #21
0
        public override PSAdaptedProperty GetProperty(object baseObject, string propertyName)
        {
            ADEntity aDEntity = baseObject as ADEntity;

            if (aDEntity != null)
            {
                if (!aDEntity.HasMethod(propertyName))
                {
                    return(new PSAdaptedProperty(propertyName, null));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                object[] typeAdapterTypeName = new object[2];
                typeAdapterTypeName[0] = ADEntityAdapter.TypeAdapterTypeName;
                typeAdapterTypeName[1] = ADEntityAdapter.ADEntityTypeName;
                throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.TypeAdapterForADEntityOnly, typeAdapterTypeName));
            }
        }
Пример #22
0
 public override object GetPropertyValue(PSAdaptedProperty property)
 {
     if (property != null)
     {
         if (property.BaseObject != null)
         {
             if (property.Name != null)
             {
                 ADEntity baseObject = property.BaseObject as ADEntity;
                 if (baseObject != null)
                 {
                     return(ADEntityAdapter.GetPropertyValue(baseObject, property.Name));
                 }
                 else
                 {
                     object[] typeAdapterTypeName = new object[2];
                     typeAdapterTypeName[0] = ADEntityAdapter.TypeAdapterTypeName;
                     typeAdapterTypeName[1] = ADEntityAdapter.ADEntityTypeName;
                     throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.TypeAdapterForADEntityOnly, typeAdapterTypeName));
                 }
             }
             else
             {
                 throw new ArgumentNullException("property.Name");
             }
         }
         else
         {
             throw new ArgumentNullException("property.BaseObject");
         }
     }
     else
     {
         throw new ArgumentNullException("property");
     }
 }
Пример #23
0
 static ADReplicationConnection()
 {
     ADEntity.RegisterMappingTable(typeof(ADReplicationConnection), ADReplicationConnectionFactory <ADReplicationConnection> .AttributeTable);
     ADEntity.RegisterMappingTable(typeof(ADReplicationConnection), ADNtdsSettingFactory <ADNtdsSetting> .AttributeTable);
 }
Пример #24
0
 static ADReplicationUpToDatenessVectorTable()
 {
     ADEntity.RegisterMappingTable(typeof(ADReplicationUpToDatenessVectorTable), ADReplicationUpToDatenessVectorTableFactory <ADReplicationUpToDatenessVectorTable> .AttributeTable);
 }
Пример #25
0
		internal static ADObjectSearcher GetADObjectSearcherFromIdentity(ADEntity identityObj, string searchRoot, bool showDeleted, IADOPathNode structuralObjectFilter, IADOPathNode identityFilter, IdentityResolverDelegate[] identityResolvers, CmdletSessionInfo cmdletSessionInfo)
		{
			ADObjectSearcher identity = null;
			IADOPathNode aDOPathNode = null;
			bool flag = true;
			IdentityResolverDelegate[] identityResolverDelegateArray = identityResolvers;
			int num = 0;
			while (num < (int)identityResolverDelegateArray.Length)
			{
				IdentityResolverDelegate identityResolverDelegate = identityResolverDelegateArray[num];
				if (identityObj.Identity == null)
				{
					identity = identityResolverDelegate(identityObj, searchRoot, cmdletSessionInfo, out flag);
				}
				else
				{
					identity = identityResolverDelegate(identityObj.Identity, searchRoot, cmdletSessionInfo, out flag);
				}
				if (identity == null)
				{
					num++;
				}
				else
				{
					if (!flag)
					{
						aDOPathNode = structuralObjectFilter;
						break;
					}
					else
					{
						IADOPathNode[] filter = new IADOPathNode[2];
						filter[0] = identity.Filter;
						filter[1] = structuralObjectFilter;
						aDOPathNode = ADOPathUtil.CreateAndClause(filter);
						break;
					}
				}
			}
			if (identity == null)
			{
				if (searchRoot != null)
				{
					if (identityFilter != null)
					{
						IADOPathNode[] aDOPathNodeArray = new IADOPathNode[2];
						aDOPathNodeArray[0] = identityFilter;
						aDOPathNodeArray[1] = structuralObjectFilter;
						aDOPathNode = ADOPathUtil.CreateAndClause(aDOPathNodeArray);
						identity = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, searchRoot, ADSearchScope.Subtree);
					}
					else
					{
						object[] str = new object[2];
						str[0] = identityObj.ToString();
						str[1] = searchRoot;
						throw new ADIdentityNotFoundException(string.Format(CultureInfo.CurrentCulture, StringResources.IdentityNotFound, str));
					}
				}
				else
				{
					throw new ADIdentityResolutionException(StringResources.IdentityResolutionPartitionRequired);
				}
			}
			identity.Filter = aDOPathNode;
			identity.ShowDeleted = showDeleted;
			return identity;
		}
Пример #26
0
		internal virtual void InvokeToExtendedConverter(ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			this._toExtendedDelegate(base.ExtendedAttribute, this.DirectoryAttributes, userObj, directoryObj, cmdletSessionInfo);
		}
Пример #27
0
 static ADReplicationSiteLink()
 {
     ADEntity.RegisterMappingTable(typeof(ADReplicationSiteLink), ADReplicationSiteLinkFactory <ADReplicationSiteLink> .AttributeTable);
 }
Пример #28
0
		internal static void ToExtendedTransportTypeFromDrsOptions(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			bool hasValue;
			bool flag;
			AttributeConverters.ToExtendedFlagFromInt(128, false, extendedAttribute, directoryAttributes, userObj, directoryObj, cmdletSessionInfo);
			bool? value = (bool?)(userObj[extendedAttribute].Value as bool?);
			bool? nullable = value;
			if (!nullable.GetValueOrDefault())
			{
				hasValue = false;
			}
			else
			{
				hasValue = nullable.HasValue;
			}
			if (!hasValue)
			{
				bool? nullable1 = value;
				if (nullable1.GetValueOrDefault())
				{
					flag = false;
				}
				else
				{
					flag = nullable1.HasValue;
				}
				if (flag)
				{
					userObj.SetValue(extendedAttribute, ADInterSiteTransportProtocolType.IP);
				}
				return;
			}
			else
			{
				userObj.SetValue(extendedAttribute, ADInterSiteTransportProtocolType.SMTP);
				return;
			}
		}
Пример #29
0
		internal static ADEntity DiscoverDomainController(string siteName, string domainName, ADDiscoverableService[] servicesToFind, ADDiscoverDomainControllerOptions discoverOptions, ADMinimumDirectoryServiceVersion? minDSVersion)
		{
			DOMAIN_CONTROLLER_INFO structure;
			string domainControllerName;
			IntPtr zero = IntPtr.Zero;
			uint num = 0;
			if (servicesToFind.Length != 0)
			{
				ADDiscoverableService[] aDDiscoverableServiceArray = servicesToFind;
				for (int i = 0; i < (int)aDDiscoverableServiceArray.Length; i++)
				{
					ADDiscoverableService aDDiscoverableService = aDDiscoverableServiceArray[i];
					ADDiscoverableService aDDiscoverableService1 = aDDiscoverableService;
					if (aDDiscoverableService1 == ADDiscoverableService.PrimaryDC)
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.PdcRequired);
					}
					else if (aDDiscoverableService1 == ADDiscoverableService.GlobalCatalog)
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.GCRequired);
					}
					else if (aDDiscoverableService1 == ADDiscoverableService.KDC)
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.KdcRequired);
					}
					else if (aDDiscoverableService1 == ADDiscoverableService.TimeService)
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.TimeServerRequired);
					}
					else if (aDDiscoverableService1 == ADDiscoverableService.ReliableTimeService)
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.GoodTimeServerPreferred);
						num = num | Convert.ToUInt32(ADLocatorFlags.TimeServerRequired);
					}
					else if (aDDiscoverableService1 == ADDiscoverableService.ADWS)
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.WebServiceRequired);
					}
					else
					{
						object[] str = new object[1];
						str[0] = (object)aDDiscoverableService.ToString();
						throw new ADException(string.Format(CultureInfo.CurrentCulture, StringResources.UnsupportedOptionSpecified, str));
					}
				}
			}
			ADMinimumDirectoryServiceVersion valueOrDefault = minDSVersion.GetValueOrDefault();
			if (minDSVersion.HasValue)
			{
				switch (valueOrDefault)
				{
					case ADMinimumDirectoryServiceVersion.Windows2000:
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.DirectoryServicesRequired);
						break;
					}
					case ADMinimumDirectoryServiceVersion.Windows2008:
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.DirectoryServices6Required);
						break;
					}
					case ADMinimumDirectoryServiceVersion.Windows2012:
					{
						num = num | Convert.ToUInt32(ADLocatorFlags.DirectoryServices8Required);
						break;
					}
				}
			}
			if ((discoverOptions & ADDiscoverDomainControllerOptions.Writable) == ADDiscoverDomainControllerOptions.Writable)
			{
				num = num | Convert.ToUInt32(ADLocatorFlags.WriteableRequired);
			}
			if ((discoverOptions & ADDiscoverDomainControllerOptions.AvoidSelf) == ADDiscoverDomainControllerOptions.AvoidSelf)
			{
				num = num | Convert.ToUInt32(ADLocatorFlags.AvoidSelf);
			}
			if ((discoverOptions & ADDiscoverDomainControllerOptions.ForceDiscover) == ADDiscoverDomainControllerOptions.ForceDiscover)
			{
				num = num | Convert.ToUInt32(ADLocatorFlags.ForceRediscovery);
			}
			if ((discoverOptions & ADDiscoverDomainControllerOptions.TryNextClosestSite) == ADDiscoverDomainControllerOptions.TryNextClosestSite)
			{
				num = num | Convert.ToUInt32(ADLocatorFlags.TryNextClosestSite);
			}
			if ((discoverOptions & ADDiscoverDomainControllerOptions.ReturnDnsName) == ADDiscoverDomainControllerOptions.ReturnDnsName)
			{
				num = num | Convert.ToUInt32(ADLocatorFlags.ReturnDnsName);
			}
			if ((discoverOptions & ADDiscoverDomainControllerOptions.ReturnFlatName) == ADDiscoverDomainControllerOptions.ReturnFlatName)
			{
				num = num | Convert.ToUInt32(-2147483648);
			}
			try
			{
				int num1 = UnsafeNativeMethods.DsGetDcName(null, domainName, 0, siteName, num, out zero);
				if (num1 != 0)
				{
					Win32Exception win32Exception = new Win32Exception(num1);
					throw new ADException(win32Exception.Message, num1);
				}
				else
				{
					structure = (DOMAIN_CONTROLLER_INFO)Marshal.PtrToStructure(zero, typeof(DOMAIN_CONTROLLER_INFO));
				}
			}
			finally
			{
				UnsafeNativeMethods.NetApiBufferFree(zero);
			}
			ADEntity aDEntity = new ADEntity();
			if (!structure.DomainControllerName.StartsWith("\\\\"))
			{
				domainControllerName = structure.DomainControllerName;
			}
			else
			{
				domainControllerName = structure.DomainControllerName.Substring(2);
			}
			if ((structure.Flags & 0x20000000) != 0x20000000)
			{
				aDEntity.Add("Name", domainControllerName);
			}
			else
			{
				aDEntity.Add("HostName", domainControllerName);
			}
			aDEntity.Add("Domain", structure.DomainName);
			aDEntity.Add("Forest", structure.DnsForestName);
			aDEntity.Add("Site", structure.DcSiteName);
			aDEntity.InternalProperties.Add("DiscoveryInternalPropertyDCAddress", structure.DomainControllerAddress);
			return aDEntity;
		}
Пример #30
0
		internal ADEntity GetForest()
		{
			this.Init();
			GetADForestRequest getADForestRequest = new GetADForestRequest();
			GetADForestResponse aDForest = this._topoMgmt.GetADForest(this._sessionHandle, getADForestRequest);
			if (aDForest.Forest == null)
			{
				return null;
			}
			else
			{
				ActiveDirectoryForest forest = aDForest.Forest;
				ADEntity aDEntity = new ADEntity();
				aDEntity.Add("msDS-SPNSuffixes", forest.SPNSuffixes);
				aDEntity.Add("uPNSuffixes", forest.UPNSuffixes);
				aDEntity.Add("msDS-Behavior-Version", (ADForestMode)forest.ForestMode);
				aDEntity.Add("name", forest.Name);
				aDEntity.Add("RootDomain", forest.RootDomain);
				aDEntity.Add("ApplicationPartitions", forest.ApplicationPartitions);
				aDEntity.Add("CrossForestReferences", forest.CrossForestReferences);
				aDEntity.Add("Domains", forest.Domains);
				aDEntity.Add("GlobalCatalogs", forest.GlobalCatalogs);
				aDEntity.Add("Sites", forest.Sites);
				aDEntity.Add("DomainNamingMaster", forest.DomainNamingMaster);
				aDEntity.Add("SchemaMaster", forest.SchemaMaster);
				return aDEntity;
			}
		}
Пример #31
0
 static ADReplicationQueueOperation()
 {
     ADEntity.RegisterMappingTable(typeof(ADReplicationQueueOperation), ADReplicationQueueOperationFactory <ADReplicationQueueOperation> .AttributeTable);
 }
		internal override void InvokeToExtendedConverter(ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			this._toExtendedDelegate(base.ExtendedAttribute, this.CustomObjectProperties, userObj, directoryObj, cmdletSessionInfo);
		}
Пример #33
0
		public static void ToExtendedGroupCategory(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (!directoryObj.Contains(directoryAttributes[0]))
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
				return;
			}
			else
			{
				int value = (int)directoryObj[directoryAttributes[0]].Value;
				if ((value & -2147483648) != -2147483648)
				{
					userObj.Add(extendedAttribute, ADGroupCategory.Distribution);
					return;
				}
				else
				{
					userObj.Add(extendedAttribute, ADGroupCategory.Security);
					return;
				}
			}
		}
Пример #34
0
 static ADPrincipal()
 {
     ADEntity.RegisterMappingTable(typeof(ADPrincipal), ADPrincipalFactory <ADPrincipal> .AttributeTable);
 }
Пример #35
0
 static ADServiceAccount()
 {
     ADEntity.RegisterMappingTable(typeof(ADServiceAccount), ADServiceAccountFactory <ADServiceAccount> .AttributeTable);
 }
Пример #36
0
		internal static void ToExtendedServerFromSessionInfo(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			userObj.Add(extendedAttribute, cmdletSessionInfo.ADRootDSE.DNSHostName);
		}
Пример #37
0
 static ADTrust()
 {
     ADEntity.RegisterMappingTable(typeof(ADTrust), ADTrustFactory <ADTrust> .AttributeTable);
 }
Пример #38
0
		internal static void ToExtendedGPLink(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (!directoryObj.Contains(directoryAttributes[0]))
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection());
				return;
			}
			else
			{
				string value = directoryObj[directoryAttributes[0]].Value as string;
				userObj.Add(extendedAttribute, GPLinkUtil.ConvertLinkedGroupPolicyObjects(value));
				return;
			}
		}
Пример #39
0
		public ADDefaultDomainPasswordPolicy(ADEntity adentity)
		{
			if (adentity != null)
			{
				base.Identity = adentity;
				if (adentity.IsSearchResult)
				{
					base.SessionInfo = adentity.SessionInfo;
				}
				return;
			}
			else
			{
				throw new ArgumentException("adentity");
			}
		}
Пример #40
0
		internal virtual void InvokeToDirectoryConverter(ADPropertyValueCollection extendedData, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			this._toDirectoryDelegate(base.ExtendedAttribute, this.DirectoryAttributes, extendedData, directoryObj, cmdletSessionInfo);
		}
Пример #41
0
 static ADDomain()
 {
     ADEntity.RegisterMappingTable(typeof(ADDomain), ADDomainFactory <ADDomain> .AttributeTable);
 }
Пример #42
0
		static ADClaimTransformPolicy()
		{
			ADEntity.RegisterMappingTable(typeof(ADClaimTransformPolicy), ADClaimTransformPolicyFactory<ADClaimTransformPolicy>.AttributeTable);
		}
Пример #43
0
 static ADSchemaObject()
 {
     ADEntity.RegisterMappingTable(typeof(ADSchemaObject), ADSchemaObjectFactory <ADSchemaObject> .AttributeTable);
 }
Пример #44
0
        public override void SetPropertyValue(PSAdaptedProperty property, object valueObject)
        {
            Type      realType;
            Type      type;
            object    obj       = null;
            Exception exception = null;

            if (property != null)
            {
                ADEntity baseObject = property.BaseObject as ADEntity;
                if (baseObject != null)
                {
                    PSObject pSObject = valueObject as PSObject;
                    if (pSObject != null)
                    {
                        valueObject = pSObject.BaseObject;
                    }
                    PropertyInfo dotNetProperty = baseObject.GetDotNetProperty(property.Name);
                    if (dotNetProperty == null)
                    {
                        if (this.IsSettable(property))
                        {
                            if (valueObject != null)
                            {
                                realType = this.GetRealType(baseObject.GetPropertyType(property.Name));
                                type     = this.GetRealType(valueObject.GetType());
                                if (realType == typeof(object) || realType == type)
                                {
                                    baseObject[property.Name].Value = valueObject;
                                    return;
                                }
                                else
                                {
                                    if (baseObject.PropertyIsSingleValue(property.Name) || valueObject as ICollection == null)
                                    {
                                        baseObject[property.Name].Value = this.ConvertValue(property, valueObject, realType, type);
                                        return;
                                    }
                                    else
                                    {
                                        if (!this.TryConvertValue(property, valueObject, realType, type, out obj, out exception))
                                        {
                                            ICollection collections = valueObject as ICollection;
                                            ADPropertyValueCollection aDPropertyValueCollection = new ADPropertyValueCollection();
                                            foreach (object obj1 in collections)
                                            {
                                                if (obj1 == null)
                                                {
                                                    continue;
                                                }
                                                Type type1 = obj1.GetType();
                                                if (type1 != realType)
                                                {
                                                    aDPropertyValueCollection.Add(this.ConvertValue(property, obj1, realType, type1));
                                                }
                                                else
                                                {
                                                    aDPropertyValueCollection.Add(obj1);
                                                }
                                            }
                                            baseObject[property.Name].Value = aDPropertyValueCollection;
                                            return;
                                        }
                                        else
                                        {
                                            baseObject[property.Name].Value = obj;
                                            return;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                baseObject[property.Name].Value = null;
                                return;
                            }
                        }
                        else
                        {
                            object[] name = new object[1];
                            name[0] = property.Name;
                            throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.PropertyIsReadonly, name));
                        }
                    }
                    else
                    {
                        if (dotNetProperty.CanWrite)
                        {
                            if (valueObject != null)
                            {
                                realType = this.GetRealType(dotNetProperty.PropertyType);
                                type     = this.GetRealType(valueObject.GetType());
                                if (realType == typeof(object) || realType == type)
                                {
                                    dotNetProperty.SetValue(baseObject, valueObject, null);
                                    return;
                                }
                                else
                                {
                                    dotNetProperty.SetValue(baseObject, this.ConvertValue(property, valueObject, realType, type), null);
                                    return;
                                }
                            }
                            else
                            {
                                dotNetProperty.SetValue(baseObject, null, null);
                                return;
                            }
                        }
                        else
                        {
                            object[] objArray = new object[1];
                            objArray[0] = property.Name;
                            throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.PropertyIsReadonly, objArray));
                        }
                    }
                }
                else
                {
                    object[] typeAdapterTypeName = new object[2];
                    typeAdapterTypeName[0] = ADEntityAdapter.TypeAdapterTypeName;
                    typeAdapterTypeName[1] = ADEntityAdapter.ADEntityTypeName;
                    throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, StringResources.TypeAdapterForADEntityOnly, typeAdapterTypeName));
                }
            }
            else
            {
                throw new ArgumentNullException("property");
            }
        }
Пример #45
0
		internal static object GetPropertyValue(ADEntity targetEntity, string propertyName)
		{
			PropertyInfo dotNetProperty = targetEntity.GetDotNetProperty(propertyName);
			if (dotNetProperty == null)
			{
				if (targetEntity.PropertyIsReadable(propertyName))
				{
					ADPropertyValueCollection item = targetEntity[propertyName];
					if (targetEntity.PropertyIsSingleValue(propertyName))
					{
						if (item == null || item.Count == 0)
						{
							return null;
						}
						else
						{
							return item[0];
						}
					}
					else
					{
						return item;
					}
				}
				else
				{
					return null;
				}
			}
			else
			{
				return dotNetProperty.GetValue(targetEntity, null);
			}
		}
Пример #46
0
 static ADDirectoryServer()
 {
     ADEntity.RegisterMappingTable(typeof(ADDirectoryServer), ADDirectoryServerFactory <ADDirectoryServer> .AttributeTable);
 }
Пример #47
0
 static ADReplicationAttributeMetadata()
 {
     ADEntity.RegisterMappingTable(typeof(ADReplicationAttributeMetadata), ADReplicationAttributeMetadataFactory <ADReplicationAttributeMetadata> .AttributeTable);
 }
Пример #48
0
		public static void ToExtendedGroupScope(string extendedAttribute, string[] directoryAttributes, ADEntity userObj, ADEntity directoryObj, CmdletSessionInfo cmdletSessionInfo)
		{
			if (!directoryObj.Contains(directoryAttributes[0]))
			{
				userObj.Add(extendedAttribute, new ADPropertyValueCollection(null));
			}
			else
			{
				int value = (int)directoryObj[directoryAttributes[0]].Value;
				if ((value & 4) != 4)
				{
					if ((value & 2) != 2)
					{
						if ((value & 8) == 8)
						{
							userObj.Add(extendedAttribute, ADGroupScope.Universal);
							return;
						}
					}
					else
					{
						userObj.Add(extendedAttribute, ADGroupScope.Global);
						return;
					}
				}
				else
				{
					userObj.Add(extendedAttribute, ADGroupScope.DomainLocal);
					return;
				}
			}
		}
 static ADResourcePropertyValueType()
 {
     ADEntity.RegisterMappingTable(typeof(ADResourcePropertyValueType), ADResourcePropertyValueTypeFactory <ADResourcePropertyValueType> .AttributeTable);
 }
Пример #50
0
 static ADResourcePropertyList()
 {
     ADEntity.RegisterMappingTable(typeof(ADResourcePropertyList), ADResourcePropertyListFactory <ADResourcePropertyList> .AttributeTable);
 }
Пример #51
0
 static ADOrganizationalUnit()
 {
     ADEntity.RegisterMappingTable(typeof(ADOrganizationalUnit), ADOrganizationalUnitFactory <ADOrganizationalUnit> .AttributeTable);
 }
Пример #52
0
		internal ADEntity[] GetDomainController(string[] dcNtdsSettingsDN)
		{
			this.Init();
			GetADDomainControllerRequest getADDomainControllerRequest = new GetADDomainControllerRequest();
			getADDomainControllerRequest.NtdsSettingsDN = dcNtdsSettingsDN;
			GetADDomainControllerResponse aDDomainController = this._topoMgmt.GetADDomainController(this._sessionHandle, getADDomainControllerRequest);
			List<ADEntity> aDEntities = new List<ADEntity>();
			if (aDDomainController.DomainControllers == null)
			{
				return new ADEntity[0];
			}
			else
			{
				ActiveDirectoryDomainController[] domainControllers = aDDomainController.DomainControllers;
				for (int i = 0; i < (int)domainControllers.Length; i++)
				{
					ActiveDirectoryDomainController activeDirectoryDomainController = domainControllers[i];
					ADEntity aDEntity = new ADEntity();
					aDEntity.Add("ComputerDN", activeDirectoryDomainController.ComputerDN);
					aDEntity.Add("Domain", activeDirectoryDomainController.Domain);
					aDEntity.Add("Forest", activeDirectoryDomainController.Forest);
					aDEntity.Add("Enabled", activeDirectoryDomainController.Enabled);
					aDEntity.Add("IsGlobalCatalog", activeDirectoryDomainController.IsGlobalCatalog);
					aDEntity.Add("IsReadOnly", activeDirectoryDomainController.IsReadOnly);
					aDEntity.Add("OSHotFix", activeDirectoryDomainController.OSHotFix);
					aDEntity.Add("OSName", activeDirectoryDomainController.OSName);
					aDEntity.Add("OSServicepack", activeDirectoryDomainController.OSServicepack);
					aDEntity.Add("OSVersion", activeDirectoryDomainController.OSVersion);
					aDEntity.Add("DefaultPartition", activeDirectoryDomainController.DefaultPartition);
					aDEntity.Add("HostName", activeDirectoryDomainController.HostName);
					aDEntity.Add("InvocationId", activeDirectoryDomainController.InvocationId);
					aDEntity.Add("LdapPort", activeDirectoryDomainController.LdapPort);
					aDEntity.Add("NTDSSettingsObjectDN", activeDirectoryDomainController.NTDSSettingsObjectDN);
					aDEntity.Add("Name", activeDirectoryDomainController.Name);
					aDEntity.Add("OperationMasterRole", activeDirectoryDomainController.OperationMasterRole);
					aDEntity.Add("Partitions", activeDirectoryDomainController.Partitions);
					aDEntity.Add("ServerObjectDN", activeDirectoryDomainController.ServerObjectDN);
					aDEntity.Add("ServerObjectGuid", activeDirectoryDomainController.ServerObjectGuid);
					aDEntity.Add("Site", activeDirectoryDomainController.Site);
					aDEntity.Add("SslPort", activeDirectoryDomainController.SslPort);
					aDEntities.Add(aDEntity);
				}
				return aDEntities.ToArray();
			}
		}
Пример #53
0
 static ADCentralAccessPolicy()
 {
     ADEntity.RegisterMappingTable(typeof(ADCentralAccessPolicy), ADCentralAccessPolicyFactory <ADCentralAccessPolicy> .AttributeTable);
 }
Пример #54
0
 static ADClaimType()
 {
     ADEntity.RegisterMappingTable(typeof(ADClaimType), ADClaimTypeFactory <ADClaimType> .AttributeTable);
 }
Пример #55
0
 static ADOptionalFeature()
 {
     ADOptionalFeature.FeatureDisableableBit = 4;
     ADEntity.RegisterMappingTable(typeof(ADOptionalFeature), ADObjectFactory <ADOptionalFeature> .AttributeTable);
 }