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:
@@ -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,
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace NSspi.Contexts
|
||||
SetLastError = true
|
||||
)]
|
||||
public static extern SecurityStatus AcceptSecurityContext_1(
|
||||
ref long credHandle,
|
||||
ref RawSspiHandle credHandle,
|
||||
IntPtr oldContextHandle,
|
||||
IntPtr inputBuffer,
|
||||
ContextAttrib requestedAttribs,
|
||||
@@ -51,7 +51,7 @@ namespace NSspi.Contexts
|
||||
SetLastError = true
|
||||
)]
|
||||
public static extern SecurityStatus AcceptSecurityContext_2(
|
||||
ref long credHandle,
|
||||
ref RawSspiHandle credHandle,
|
||||
ref long oldContextHandle,
|
||||
IntPtr inputBuffer,
|
||||
ContextAttrib requestedAttribs,
|
||||
@@ -104,7 +104,7 @@ namespace NSspi.Contexts
|
||||
SetLastError = true
|
||||
)]
|
||||
public static extern SecurityStatus InitializeSecurityContext_1(
|
||||
ref long credentialHandle,
|
||||
ref RawSspiHandle credentialHandle,
|
||||
IntPtr zero,
|
||||
string serverPrincipleName,
|
||||
ContextAttrib requiredAttribs,
|
||||
@@ -126,7 +126,7 @@ namespace NSspi.Contexts
|
||||
SetLastError = true
|
||||
)]
|
||||
public static extern SecurityStatus InitializeSecurityContext_2(
|
||||
ref long credentialHandle,
|
||||
ref RawSspiHandle credentialHandle,
|
||||
ref long previousHandle,
|
||||
string serverPrincipleName,
|
||||
ContextAttrib requiredAttribs,
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace NSspi.Contexts
|
||||
SecureBuffer clientBuffer = new SecureBuffer( clientToken, BufferType.Token );
|
||||
SecureBuffer outBuffer = new SecureBuffer( new byte[12288], BufferType.Token );
|
||||
|
||||
long credHandle = this.Credential.CredentialHandle;
|
||||
long oldContextHandle = base.ContextHandle;
|
||||
long newContextHandle = 0;
|
||||
|
||||
@@ -42,7 +41,7 @@ namespace NSspi.Contexts
|
||||
if ( oldContextHandle == 0 )
|
||||
{
|
||||
status = ContextNativeMethods.AcceptSecurityContext_1(
|
||||
ref credHandle,
|
||||
ref this.Credential.Handle.rawHandle,
|
||||
IntPtr.Zero,
|
||||
clientAdapter.Handle,
|
||||
requestedAttribs,
|
||||
@@ -56,7 +55,7 @@ namespace NSspi.Contexts
|
||||
else
|
||||
{
|
||||
status = ContextNativeMethods.AcceptSecurityContext_2(
|
||||
ref credHandle,
|
||||
ref this.Credential.Handle.rawHandle,
|
||||
ref oldContextHandle,
|
||||
clientAdapter.Handle,
|
||||
requestedAttribs,
|
||||
|
||||
Reference in New Issue
Block a user