Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- EncoderBestFitFallback.cs
- RangeContentEnumerator.cs
- MessageSecurityException.cs
- SimpleFieldTemplateFactory.cs
- FileSecurity.cs
- BinaryConverter.cs
- AdditionalEntityFunctions.cs
- ExceptionUtil.cs
- _TimerThread.cs
- XhtmlBasicFormAdapter.cs
- ConditionalBranch.cs
- BitmapMetadata.cs
- TableLayoutCellPaintEventArgs.cs
- ResourceManager.cs
- CoreSwitches.cs
- FlowchartDesigner.Helpers.cs
- storepermissionattribute.cs
- ContextStaticAttribute.cs
- HttpResponseBase.cs
- ResourcesChangeInfo.cs
- Vector.cs
- WebPartConnectionsCloseVerb.cs
- ObjectDataSource.cs
- CellQuery.cs
- jithelpers.cs
- CompilerScope.Storage.cs
- ModifyActivitiesPropertyDescriptor.cs
- CodeExpressionStatement.cs
- DataTable.cs
- TreeViewImageIndexConverter.cs
- DSASignatureDeformatter.cs
- FixedSOMTableRow.cs
- RegisteredScript.cs
- CodeTypeReference.cs
- MsmqAppDomainProtocolHandler.cs
- ThousandthOfEmRealDoubles.cs
- StreamAsIStream.cs
- TransactionFlowAttribute.cs
- OdbcDataAdapter.cs
- Label.cs
- PasswordRecoveryDesigner.cs
- CompositionTarget.cs
- HiddenFieldPageStatePersister.cs
- ResourceExpressionEditor.cs
- CopyNodeSetAction.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- BasicHttpSecurityMode.cs
- TablePatternIdentifiers.cs
- HttpConfigurationSystem.cs
- CommandID.cs
- DataServiceRequestException.cs
- ExchangeUtilities.cs
- FormatterServicesNoSerializableCheck.cs
- ScriptResourceInfo.cs
- NavigationFailedEventArgs.cs
- ResourceManager.cs
- StyleTypedPropertyAttribute.cs
- SHA512.cs
- clipboard.cs
- XmlArrayItemAttributes.cs
- ValidationErrorEventArgs.cs
- ReferentialConstraint.cs
- TextWriterTraceListener.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- OpenTypeCommon.cs
- XmlTextReader.cs
- HandleCollector.cs
- control.ime.cs
- MenuEventArgs.cs
- TableSectionStyle.cs
- WorkflowViewStateService.cs
- FillErrorEventArgs.cs
- DataGridViewRowPrePaintEventArgs.cs
- SmiEventSink.cs
- RulePatternOps.cs
- ControlAdapter.cs
- SafeJobHandle.cs
- DefaultDiscoveryServiceExtension.cs
- ResourcesGenerator.cs
- WebPartsPersonalizationAuthorization.cs
- Utils.cs
- DocobjHost.cs
- ListViewSortEventArgs.cs
- StyleTypedPropertyAttribute.cs
- FlowDecisionDesigner.xaml.cs
- ValueQuery.cs
- AuthenticationService.cs
- PageAction.cs
- Point.cs
- serverconfig.cs
- ConditionCollection.cs
- UrlPath.cs
- XmlBinaryReader.cs
- SqlDataSourceStatusEventArgs.cs
- Point4DConverter.cs
- BitmapVisualManager.cs
- EntityStoreSchemaFilterEntry.cs
- Metafile.cs
- TabControlCancelEvent.cs
- ColumnMap.cs