Example #1
0
        private void Init()
        {
            if (this._schemaProperties == null)
            {
                ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);

                {
                    ADRootDSE rootDSE = aDObjectSearcher.GetRootDSE();
                    this._subSchemaDN = rootDSE.SubSchemaSubEntry;
                    ADSchema aDSchema = null;
                    lock (ADSchema._schemaTableLock)
                    {
                        ADSchema._schemaTable.TryGetValue(this._subSchemaDN, out aDSchema);
                    }
                    if (aDSchema != null)
                    {
                        this._schemaProperties    = aDSchema._schemaProperties;
                        this._userSubClasses      = aDSchema._userSubClasses;
                        this._schemaClasses       = aDSchema._schemaClasses;
                        this._schemaClassesDnHash = aDSchema._schemaClassesDnHash;
                    }
                    if (this._schemaProperties == null)
                    {
                        if (rootDSE.ServerType == ADServerType.ADDS && this._sessionInfo.ConnectedToGC)
                        {
                            this._sessionInfo.SetEffectivePort(LdapConstants.LDAP_PORT);
                            aDObjectSearcher.Dispose();
                            aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);
                        }
                        this._schemaProperties = new Dictionary <string, ADSchemaAttribute>(1, StringComparer.OrdinalIgnoreCase);
                        this.ReadConstructedSchema(aDObjectSearcher, this);
                        this.ReadObjectSchema(aDObjectSearcher, this);
                        this._userSubClasses = this.GetUserSubClasses(aDObjectSearcher, rootDSE);
                    }
                    else
                    {
                        return;
                    }
                }
                aDObjectSearcher.Dispose();
                lock (ADSchema._schemaTableLock)
                {
                    if (ADSchema._schemaTable.ContainsKey(this._subSchemaDN))
                    {
                        ADSchema._schemaTable.Remove(this._subSchemaDN);
                    }
                    ADSchema._schemaTable.Add(this._subSchemaDN, this);
                }
                return;
            }
            else
            {
                return;
            }
        }
Example #2
0
 private void PopulateSchemaClasses()
 {
     if (this._schemaClasses == null)
     {
         ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);
         {
             ADRootDSE rootDSE = aDObjectSearcher.GetRootDSE();
             this._subSchemaDN = rootDSE.SubSchemaSubEntry;
             if (rootDSE.ServerType == ADServerType.ADDS && this._sessionInfo.ConnectedToGC)
             {
                 this._sessionInfo.SetEffectivePort(LdapConstants.LDAP_PORT);
                 aDObjectSearcher.Dispose();
                 aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);
             }
             this._schemaClasses       = new Dictionary <string, ADObject>(1, StringComparer.OrdinalIgnoreCase);
             this._schemaClassesDnHash = new Dictionary <string, string>(1, StringComparer.OrdinalIgnoreCase);
             this.AddSchemaClassObjects(aDObjectSearcher, this);
         }
         aDObjectSearcher.Dispose();
         lock (ADSchema._schemaTableLock)
         {
             ADSchema aDSchema = null;
             lock (ADSchema._schemaTableLock)
             {
                 ADSchema._schemaTable.TryGetValue(this._subSchemaDN, out aDSchema);
                 if (aDSchema != null)
                 {
                     aDSchema._schemaClasses       = this._schemaClasses;
                     aDSchema._schemaClassesDnHash = this._schemaClassesDnHash;
                 }
             }
         }
         return;
     }
     else
     {
         return;
     }
 }
Example #3
0
		private void PopulateSchemaClasses()
		{
			if (this._schemaClasses == null)
			{
				ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);
				{
					ADRootDSE rootDSE = aDObjectSearcher.GetRootDSE();
					this._subSchemaDN = rootDSE.SubSchemaSubEntry;
					if (rootDSE.ServerType == ADServerType.ADDS && this._sessionInfo.ConnectedToGC)
					{
						this._sessionInfo.SetEffectivePort(LdapConstants.LDAP_PORT);
						aDObjectSearcher.Dispose();
						aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);
					}
					this._schemaClasses = new Dictionary<string, ADObject>(1, StringComparer.OrdinalIgnoreCase);
					this._schemaClassesDnHash = new Dictionary<string, string>(1, StringComparer.OrdinalIgnoreCase);
					this.AddSchemaClassObjects(aDObjectSearcher, this);
				}
				aDObjectSearcher.Dispose ();
				lock (ADSchema._schemaTableLock)
				{
					ADSchema aDSchema = null;
					lock (ADSchema._schemaTableLock)
					{
						ADSchema._schemaTable.TryGetValue(this._subSchemaDN, out aDSchema);
						if (aDSchema != null)
						{
							aDSchema._schemaClasses = this._schemaClasses;
							aDSchema._schemaClassesDnHash = this._schemaClassesDnHash;
						}
					}
				}
				return;
			}
			else
			{
				return;
			}
		}
Example #4
0
		private void Init()
		{
			if (this._schemaProperties == null)
			{
				ADObjectSearcher aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);

				{
					ADRootDSE rootDSE = aDObjectSearcher.GetRootDSE();
					this._subSchemaDN = rootDSE.SubSchemaSubEntry;
					ADSchema aDSchema = null;
					lock (ADSchema._schemaTableLock)
					{
						ADSchema._schemaTable.TryGetValue(this._subSchemaDN, out aDSchema);
					}
					if (aDSchema != null)
					{
						this._schemaProperties = aDSchema._schemaProperties;
						this._userSubClasses = aDSchema._userSubClasses;
						this._schemaClasses = aDSchema._schemaClasses;
						this._schemaClassesDnHash = aDSchema._schemaClassesDnHash;
					}
					if (this._schemaProperties == null)
					{
						if (rootDSE.ServerType == ADServerType.ADDS && this._sessionInfo.ConnectedToGC)
						{
							this._sessionInfo.SetEffectivePort(LdapConstants.LDAP_PORT);
							aDObjectSearcher.Dispose();
							aDObjectSearcher = new ADObjectSearcher(this._sessionInfo);
						}
						this._schemaProperties = new Dictionary<string, ADSchemaAttribute>(1, StringComparer.OrdinalIgnoreCase);
						this.ReadConstructedSchema(aDObjectSearcher, this);
						this.ReadObjectSchema(aDObjectSearcher, this);
						this._userSubClasses = this.GetUserSubClasses(aDObjectSearcher, rootDSE);
					}
					else
					{
						return;
					}
				}
				aDObjectSearcher.Dispose ();
				lock (ADSchema._schemaTableLock)
				{
					if (ADSchema._schemaTable.ContainsKey(this._subSchemaDN))
					{
						ADSchema._schemaTable.Remove(this._subSchemaDN);
					}
					ADSchema._schemaTable.Add(this._subSchemaDN, this);
				}
				return;
			}
			else
			{
				return;
			}
		}