Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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());
}
}
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RuntimeComponentFilter.cs
- SQLConvert.cs
- TextServicesCompartment.cs
- FormsAuthenticationModule.cs
- TypeViewSchema.cs
- ButtonFieldBase.cs
- AtomicFile.cs
- ThreadAbortException.cs
- safelink.cs
- WebPartsPersonalizationAuthorization.cs
- BufferedGraphicsManager.cs
- ICspAsymmetricAlgorithm.cs
- mediaclock.cs
- DefaultCommandConverter.cs
- SystemGatewayIPAddressInformation.cs
- FixedPageAutomationPeer.cs
- PageCache.cs
- TemplateControlParser.cs
- StringSource.cs
- DataControlFieldCell.cs
- DataMisalignedException.cs
- SpanIndex.cs
- WebPartPersonalization.cs
- EllipseGeometry.cs
- TextRangeEditTables.cs
- DataTableCollection.cs
- PageSetupDialog.cs
- ImageButton.cs
- ISessionStateStore.cs
- CookielessData.cs
- SByte.cs
- ClientBuildManager.cs
- TemplatingOptionsDialog.cs
- Vector3DKeyFrameCollection.cs
- SqlProviderServices.cs
- HWStack.cs
- AsyncPostBackErrorEventArgs.cs
- _Win32.cs
- RightsManagementEncryptedStream.cs
- RegexWriter.cs
- SharedConnectionInfo.cs
- ControlBuilder.cs
- WorkflowElementDialog.cs
- XmlDownloadManager.cs
- TypeConverters.cs
- Image.cs
- ArgumentException.cs
- SqlGatherConsumedAliases.cs
- KeyGestureValueSerializer.cs
- RegisteredExpandoAttribute.cs
- TextBlock.cs
- TreeViewHitTestInfo.cs
- SqlConnectionStringBuilder.cs
- ServicesUtilities.cs
- ListViewItemEventArgs.cs
- OutputCacheProviderCollection.cs
- Merger.cs
- ListControl.cs
- ViewBox.cs
- ValidatingPropertiesEventArgs.cs
- DataSourceHelper.cs
- ConnectionManager.cs
- TraceUtils.cs
- SoapCodeExporter.cs
- DrawItemEvent.cs
- ChtmlSelectionListAdapter.cs
- PassportIdentity.cs
- TransformCryptoHandle.cs
- JsonUriDataContract.cs
- CompilerScopeManager.cs
- Substitution.cs
- Win32Interop.cs
- SizeAnimationBase.cs
- IItemProperties.cs
- ChangePasswordAutoFormat.cs
- FileLoadException.cs
- TreeNodeStyleCollectionEditor.cs
- RemotingConfiguration.cs
- DrawToolTipEventArgs.cs
- SrgsGrammar.cs
- SqlWriter.cs
- ObjectReaderCompiler.cs
- EntityContainer.cs
- MatrixKeyFrameCollection.cs
- ReflectionUtil.cs
- UrlMappingsModule.cs
- compensatingcollection.cs
- HandledMouseEvent.cs
- ProjectionAnalyzer.cs
- MetabaseServerConfig.cs
- arabicshape.cs
- GlobalizationSection.cs
- GlyphsSerializer.cs
- SamlAssertionKeyIdentifierClause.cs
- HostingEnvironmentException.cs
- UriTemplateMatchException.cs
- HttpProfileGroupBase.cs
- SQLDouble.cs
- DataMember.cs
- DockAndAnchorLayout.cs