private void Uninit() { if (this._adSession != null) { this._adSession.Delete(); this._adSession = null; } }
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"); } }
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); }
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); }
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; } }
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"); } }
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; } }
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); } } }
internal ADTopologyManagement(ADSessionInfo sessionInfo) { this._adSession = ADSession.ConstructSession(sessionInfo); }
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; }
internal ADAccountManagement(ADSessionInfo sessionInfo) { this._adSession = ADSession.ConstructSession(sessionInfo); }
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); } } }
public SafeSessionCache(ADSession session) { this._session = session; }
public SafeSessionCache(ADSessionInfo info) { this._session = ADSession.ConstructSession(info); }
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; }