Hello,
I try to authenticate a client against an ISA-Server using the single-sign-on
functionality provided by secur32.dll.
The procedure itself isn't very complicated:
1. Call AcquireCredentialsHandle to get a CredHandle
2. Call InitializeSecurityContext with this handle to receive a security token
3. Send this token to the server.
4. Server does something with the token and sends a new token back.
5. Call InitializeSecurityContext again with the token provided by the server.
6. Done.
So far so easy.
Currently, I struggle with point 2.
When calling InitializeSecurityContext for the first time, the parameter
phContext needs to be NULL. If I do this (see line 149 in the attached source
code), Function#invoke returns the error ERROR_INSUFFICIENT_BUFFER (122,
winerror.h), which according to MSDN means that the data area passed to a system
call is too small.
If I change line 149 to new Pointer(hContext) InitializeSecurityContext is
executed and returns with an SEC_E_INVALID_HANDLE error. This is to be expected
as the pointer has to be NULL at this point. So it looks as I did something
right
Still, I need to pass phContext = NULL in the first call.
I've been working on this for some time, double-checked everything but still
fail to see what's wrong with it.
Could you please give me a hint?
Thanks,
Janek.
InitializeSecurityContext (NTLM):
http://windowssdk.msdn.microsoft.com/en-us/library/ms718653.aspx