Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Net / System / Net / _SSPISessionCache.cs / 1 / _SSPISessionCache.cs
/*++
Copyright (c) Microsoft Corporation
Module Name:
_SspiSessionCache.cs
Abstract:
The file implements trivial SSPI credential caching mechanism based on lru list
Author:
Alexei Vopilov 20-Oct-2004
Revision History:
--*/
namespace System.Net.Security {
using System.Net;
using System.Threading;
using System.Collections;
//
// Implements delayed SSPI handle release, like a finalizable object though the handles are kept alive until being pushed out
// by the newly incoming ones.
//
internal static class SSPIHandleCache
{
private const int c_MaxCacheSize = 0x1F; // must a (power of 2) - 1
private static SafeCredentialReference[] _CacheSlots = new SafeCredentialReference[c_MaxCacheSize+1];
private static int _Current = -1;
internal static void CacheCredential(SafeFreeCredentials newHandle)
{
try {
SafeCredentialReference newRef = SafeCredentialReference.CreateReference(newHandle);
if (newRef == null)
return;
unchecked
{
int index = Interlocked.Increment(ref _Current) & c_MaxCacheSize;
newRef = Interlocked.Exchange(ref _CacheSlots[index], newRef);
}
if (newRef != null)
newRef.Close();
}
catch(Exception e) {
if (!NclUtilities.IsFatal(e)){
GlobalLog.Assert("SSPIHandlCache", "Attempted to throw: " + e.ToString());
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/*++
Copyright (c) Microsoft Corporation
Module Name:
_SspiSessionCache.cs
Abstract:
The file implements trivial SSPI credential caching mechanism based on lru list
Author:
Alexei Vopilov 20-Oct-2004
Revision History:
--*/
namespace System.Net.Security {
using System.Net;
using System.Threading;
using System.Collections;
//
// Implements delayed SSPI handle release, like a finalizable object though the handles are kept alive until being pushed out
// by the newly incoming ones.
//
internal static class SSPIHandleCache
{
private const int c_MaxCacheSize = 0x1F; // must a (power of 2) - 1
private static SafeCredentialReference[] _CacheSlots = new SafeCredentialReference[c_MaxCacheSize+1];
private static int _Current = -1;
internal static void CacheCredential(SafeFreeCredentials newHandle)
{
try {
SafeCredentialReference newRef = SafeCredentialReference.CreateReference(newHandle);
if (newRef == null)
return;
unchecked
{
int index = Interlocked.Increment(ref _Current) & c_MaxCacheSize;
newRef = Interlocked.Exchange(ref _CacheSlots[index], newRef);
}
if (newRef != null)
newRef.Close();
}
catch(Exception e) {
if (!NclUtilities.IsFatal(e)){
GlobalLog.Assert("SSPIHandlCache", "Attempted to throw: " + e.ToString());
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ChannelManagerService.cs
- ModulesEntry.cs
- ConfigurationValidatorBase.cs
- DisplayMemberTemplateSelector.cs
- DeflateStreamAsyncResult.cs
- ValueOfAction.cs
- StringAnimationUsingKeyFrames.cs
- WebPageTraceListener.cs
- FixedSOMTable.cs
- Cursors.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- Literal.cs
- Serializer.cs
- BindingOperations.cs
- ISFClipboardData.cs
- KnownTypeDataContractResolver.cs
- ISAPIWorkerRequest.cs
- precedingsibling.cs
- DisableDpiAwarenessAttribute.cs
- DurationConverter.cs
- TextCompositionManager.cs
- SourceSwitch.cs
- SupportingTokenBindingElement.cs
- Terminate.cs
- EdmValidator.cs
- Vector3D.cs
- GPPOINT.cs
- OpCellTreeNode.cs
- X509CertificateInitiatorServiceCredential.cs
- XmlDataSource.cs
- LinkedResource.cs
- UserControlParser.cs
- MLangCodePageEncoding.cs
- AuthenticationConfig.cs
- HMACRIPEMD160.cs
- DocumentXmlWriter.cs
- ValidationError.cs
- SemanticResolver.cs
- DataListItemCollection.cs
- SortDescriptionCollection.cs
- MouseEvent.cs
- WpfSharedXamlSchemaContext.cs
- CreateUserErrorEventArgs.cs
- LinqDataSourceUpdateEventArgs.cs
- ListBox.cs
- TreeNodeConverter.cs
- ReferenceService.cs
- NativeMethods.cs
- FieldAccessException.cs
- Catch.cs
- _Rfc2616CacheValidators.cs
- ControlUtil.cs
- Table.cs
- WebPartZone.cs
- PtsCache.cs
- ImageListStreamer.cs
- SqlXmlStorage.cs
- ConfigurationManagerInternalFactory.cs
- WebBrowserNavigatedEventHandler.cs
- ExpressionLexer.cs
- Visual3DCollection.cs
- FastEncoderWindow.cs
- StreamReader.cs
- ModelEditingScope.cs
- DoubleUtil.cs
- WhitespaceRule.cs
- IResourceProvider.cs
- altserialization.cs
- versioninfo.cs
- IndexedGlyphRun.cs
- ThreadPool.cs
- LinqDataSource.cs
- DependencyPropertyKey.cs
- StackOverflowException.cs
- ProgressPage.cs
- WindowsRebar.cs
- DrawingContextWalker.cs
- EncodingTable.cs
- XmlFormatReaderGenerator.cs
- DrawingCollection.cs
- GPRECT.cs
- ImageIndexConverter.cs
- QilDataSource.cs
- GridViewEditEventArgs.cs
- XamlSerializer.cs
- FormsAuthenticationModule.cs
- PropertyCollection.cs
- ApplicationDirectory.cs
- TextTreeDeleteContentUndoUnit.cs
- Configuration.cs
- HttpWebResponse.cs
- UIElementHelper.cs
- SecurityHeaderTokenResolver.cs
- TimeZone.cs
- Mappings.cs
- DelegateCompletionCallbackWrapper.cs
- KeyboardEventArgs.cs
- SqlConnectionFactory.cs
- GreenMethods.cs
- bidPrivateBase.cs