Esempio n. 1
0
 private void Uninit()
 {
     if (this._adSession != null)
     {
         this._adSession.Delete();
         this._adSession = null;
     }
 }
Esempio n. 2
0
 public ADActiveObject(ADSessionInfo sessionInfo, ADObject obj)
 {
     this._sdFlags = SecurityMasks.Dacl;
     if (obj != null)
     {
         this._adSession = ADSession.ConstructSession(sessionInfo);
         this._adObject  = obj;
         return;
     }
     else
     {
         DebugLogger.LogWarning("ADActiveObject", "Constructor(ADSessionInfo,ADObject) called with null obj");
         throw new ArgumentNullException("obj");
     }
 }
Esempio n. 3
0
		public ADActiveObject(ADSessionInfo sessionInfo, ADObject obj)
		{
			this._sdFlags = SecurityMasks.Dacl;
			if (obj != null)
			{
				this._adSession = ADSession.ConstructSession(sessionInfo);
				this._adObject = obj;
				return;
			}
			else
			{
				DebugLogger.LogWarning("ADActiveObject", "Constructor(ADSessionInfo,ADObject) called with null obj");
				throw new ArgumentNullException("obj");
			}
		}
Esempio n. 4
0
        public bool GetEntry(ADSessionInfo info, out ADSession session)
        {
            DebugLogger.LogInfo(ADSessionCache._debugCategory, "GetEntry: Entering");
            string str = this.GenerateKey(info);
            int    num = 0;

            if (ADSessionCache._sessionMap.ContainsKey(str))
            {
                ADSessionCache.CacheEntry cacheEntry = this.FindEntryInServerList(str, info, out num);
                if (cacheEntry != null)
                {
                    session = cacheEntry.Session;
                    return(true);
                }
            }
            session = null;
            return(false);
        }
Esempio n. 5
0
        public static ADSession ConstructSession(ADSessionInfo info)
        {
            ADSession aDSession = null;

            if (info == null)
            {
                info = new ADSessionInfo();
            }
            lock (ADSession._sessionCache)
            {
                if (!ADSession._sessionCache.GetEntry(info, out aDSession))
                {
                    aDSession = new ADSession(info);
                    ADSession._sessionCache.AddEntry(aDSession._info, aDSession);
                }
                aDSession.AddRef();
            }
            aDSession.Create();
            return(aDSession);
        }
Esempio n. 6
0
        public void AddEntry(ADSessionInfo info, ADSession session)
        {
            PSCredential credential;
            string       str = this.GenerateKey(info);

            DebugLogger.LogInfo(ADSessionCache._debugCategory, string.Concat("AddEntry: Adding Entry , Key: ", str));
            ADSessionCache.CacheEntry cacheEntry = new ADSessionCache.CacheEntry();
            cacheEntry.Session = session;
            ADSessionCache.CacheEntry cacheEntry1 = cacheEntry;
            if (info == null)
            {
                credential = null;
            }
            else
            {
                credential = info.Credential;
            }
            cacheEntry1.Credential = credential;
            if (!this.AreCredentialsExplicit(info))
            {
                WindowsIdentity current = WindowsIdentity.GetCurrent(true);
                if (current != null)
                {
                    cacheEntry.ImpersonatedOwnerSid = current.Owner;
                }
            }
            if (!ADSessionCache._sessionMap.ContainsKey(str))
            {
                ADSessionCache._sessionMap.Add(str, new List <ADSessionCache.CacheEntry>(1));
                ADSessionCache._sessionMap[str].Add(cacheEntry);
                return;
            }
            else
            {
                ADSessionCache._sessionMap[str].Add(cacheEntry);
                return;
            }
        }
Esempio n. 7
0
 private ADActiveObject(ADSession session, ADObject obj)
 {
     this._sdFlags = SecurityMasks.Dacl;
     if (obj != null)
     {
         if (session != null)
         {
             this._adObject  = obj;
             this._adSession = session;
             return;
         }
         else
         {
             DebugLogger.LogWarning("ADActiveObject", "Constructor(ADSession,ADObject) called with null session");
             throw new ArgumentNullException("session");
         }
     }
     else
     {
         DebugLogger.LogWarning("ADActiveObject", "Constructor(ADSession,ADObject) called with null obj");
         throw new ArgumentNullException("obj");
     }
 }
Esempio n. 8
0
		private ADActiveObject(ADSession session, ADObject obj)
		{
			this._sdFlags = SecurityMasks.Dacl;
			if (obj != null)
			{
				if (session != null)
				{
					this._adObject = obj;
					this._adSession = session;
					return;
				}
				else
				{
					DebugLogger.LogWarning("ADActiveObject", "Constructor(ADSession,ADObject) called with null session");
					throw new ArgumentNullException("session");
				}
			}
			else
			{
				DebugLogger.LogWarning("ADActiveObject", "Constructor(ADSession,ADObject) called with null obj");
				throw new ArgumentNullException("obj");
			}
		}
Esempio n. 9
0
		public void AddEntry(ADSessionInfo info, ADSession session)
		{
			PSCredential credential;
			string str = this.GenerateKey(info);
			DebugLogger.LogInfo(ADSessionCache._debugCategory, string.Concat("AddEntry: Adding Entry , Key: ", str));
			ADSessionCache.CacheEntry cacheEntry = new ADSessionCache.CacheEntry();
			cacheEntry.Session = session;
			ADSessionCache.CacheEntry cacheEntry1 = cacheEntry;
			if (info == null)
			{
				credential = null;
			}
			else
			{
				credential = info.Credential;
			}
			cacheEntry1.Credential = credential;
			if (!this.AreCredentialsExplicit(info))
			{
				WindowsIdentity current = WindowsIdentity.GetCurrent(true);
				if (current != null)
				{
					cacheEntry.ImpersonatedOwnerSid = current.Owner;
				}
			}
			if (!ADSessionCache._sessionMap.ContainsKey(str))
			{
				ADSessionCache._sessionMap.Add(str, new List<ADSessionCache.CacheEntry>(1));
				ADSessionCache._sessionMap[str].Add(cacheEntry);
				return;
			}
			else
			{
				ADSessionCache._sessionMap[str].Add(cacheEntry);
				return;
			}
		}
Esempio n. 10
0
 public ADObjectSearcher(ADSessionInfo sessionInfo, ADObject obj)
 {
     this._searchScope              = ADSearchScope.Subtree;
     this._filter                   = ADOPathUtil.CreateFilterClause(ADOperator.Like, "objectClass", "*");
     this._propertyList             = new List <string>(ADObject.DefaultProperties);
     this._timeLimit                = TimeSpan.Zero;
     this._schemaTranslationEnabled = true;
     this._pageSize                 = 0x100;
     this._searchOption             = null;
     this._autoRangeRetrieve        = true;
     this._sdFlags                  = SecurityMasks.Owner | SecurityMasks.Group | SecurityMasks.Dacl;
     if (sessionInfo == null)
     {
         if (obj == null)
         {
             this._adSession = ADSession.ConstructSession(null);
         }
         else
         {
             this._adSession = ADSession.ConstructSession(obj.SessionInfo);
         }
     }
     else
     {
         this._adSession = ADSession.ConstructSession(sessionInfo);
     }
     if (obj != null)
     {
         this._adObject   = obj;
         this._searchRoot = this._adObject.DistinguishedName;
         foreach (string propertyName in this._adObject.PropertyNames)
         {
             this._propertyList.Add(propertyName);
         }
     }
 }
Esempio n. 11
0
 internal ADTopologyManagement(ADSessionInfo sessionInfo)
 {
     this._adSession = ADSession.ConstructSession(sessionInfo);
 }
Esempio n. 12
0
		public static ADSession ConstructSession(ADSessionInfo info)
		{
			ADSession aDSession = null;
			if (info == null)
			{
				info = new ADSessionInfo();
			}
			lock (ADSession._sessionCache)
			{
				if (!ADSession._sessionCache.GetEntry(info, out aDSession))
				{
					aDSession = new ADSession(info);
					ADSession._sessionCache.AddEntry(aDSession._info, aDSession);
				}
				aDSession.AddRef();
			}
			aDSession.Create();
			return aDSession;
		}
Esempio n. 13
0
 internal ADAccountManagement(ADSessionInfo sessionInfo)
 {
     this._adSession = ADSession.ConstructSession(sessionInfo);
 }
Esempio n. 14
0
		public ADObjectSearcher(ADSessionInfo sessionInfo, ADObject obj)
		{
			this._searchScope = ADSearchScope.Subtree;
			this._filter = ADOPathUtil.CreateFilterClause(ADOperator.Like, "objectClass", "*");
			this._propertyList = new List<string>(ADObject.DefaultProperties);
			this._timeLimit = TimeSpan.Zero;
			this._schemaTranslationEnabled = true;
			this._pageSize = 0x100;
			this._searchOption = null;
			this._autoRangeRetrieve = true;
			this._sdFlags = SecurityMasks.Owner | SecurityMasks.Group | SecurityMasks.Dacl;
			if (sessionInfo == null)
			{
				if (obj == null)
				{
					this._adSession = ADSession.ConstructSession(null);
				}
				else
				{
					this._adSession = ADSession.ConstructSession(obj.SessionInfo);
				}
			}
			else
			{
				this._adSession = ADSession.ConstructSession(sessionInfo);
			}
			if (obj != null)
			{
				this._adObject = obj;
				this._searchRoot = this._adObject.DistinguishedName;
				foreach (string propertyName in this._adObject.PropertyNames)
				{
					this._propertyList.Add(propertyName);
				}
			}
		}
Esempio n. 15
0
		internal ADTopologyManagement(ADSessionInfo sessionInfo)
		{
			this._adSession = ADSession.ConstructSession(sessionInfo);
		}
Esempio n. 16
0
		public SafeSessionCache(ADSession session)
		{
			this._session = session;
		}
Esempio n. 17
0
		public SafeSessionCache(ADSessionInfo info)
		{
			this._session = ADSession.ConstructSession(info);
		}
Esempio n. 18
0
		public bool GetEntry(ADSessionInfo info, out ADSession session)
		{
			DebugLogger.LogInfo(ADSessionCache._debugCategory, "GetEntry: Entering");
			string str = this.GenerateKey(info);
			int num = 0;
			if (ADSessionCache._sessionMap.ContainsKey(str))
			{
				ADSessionCache.CacheEntry cacheEntry = this.FindEntryInServerList(str, info, out num);
				if (cacheEntry != null)
				{
					session = cacheEntry.Session;
					return true;
				}
			}
			session = null;
			return false;
		}
Esempio n. 19
0
		private void Uninit()
		{
			if (this._adSession != null)
			{
				this._adSession.Delete();
				this._adSession = null;
			}
		}
Esempio n. 20
0
		internal ADAccountManagement(ADSessionInfo sessionInfo)
		{
			this._adSession = ADSession.ConstructSession(sessionInfo);
		}