Fixed Credential using a fixed-size 64-bit handle; it's always 2 pointers.

Reworked the Credential handle into a SafeCredentialHandle. We still use references to the raw handle, which is unsafe, but I will hopefully rework that soon.
This commit is contained in:
antiduh
2014-06-24 03:01:53 +00:00
parent 19f2e71e9c
commit fe14836949
7 changed files with 124 additions and 38 deletions

View File

@@ -25,8 +25,6 @@ namespace NSspi.Contexts
public SecurityStatus Init( byte[] serverToken, out byte[] outToken )
{
long credHandle = base.Credential.CredentialHandle;
long prevContextHandle = base.ContextHandle;
long newContextHandle = 0;
@@ -62,7 +60,7 @@ namespace NSspi.Contexts
if ( prevContextHandle == 0 )
{
status = ContextNativeMethods.InitializeSecurityContext_1(
ref credHandle,
ref this.Credential.Handle.rawHandle,
IntPtr.Zero,
this.serverPrinc,
this.requestedAttribs,
@@ -81,7 +79,7 @@ namespace NSspi.Contexts
using ( serverAdapter = new SecureBufferAdapter( serverBuffer ) )
{
status = ContextNativeMethods.InitializeSecurityContext_2(
ref credHandle,
ref this.Credential.Handle.rawHandle,
ref prevContextHandle,
this.serverPrinc,
this.requestedAttribs,