Hariharasudhan
Joined: 04 Mar 2010 Posts: 1
|
Posted: Thu Mar 04, 2010 7:29 pm Post subject: Invalid handle from InitializeSecurityContext |
|
|
Hi All,
I went thorugh the code in
http://www.pinvoke.net/default.aspx/secur32.InitializeSecurityContext
Instead of kerberos authentication, i wish to implement Windows authentication . I modifed the AcquireCredentials method as follows:
| Code: |
returnValue = AcquireCredentialsHandle(_sAccountName, "NTLM", SECPKG_CRED_OUTBOUND,
HANDLE.Zero, HANDLE.Zero, HANDLE.Zero, HANDLE.Zero,
ref _hOutboundCred, ref ClientLifeTime);
|
I got returnvalue zero for above method call.
But the initializeSecurityContext returns SEC_E_INVALID_HANDLE. Please see below code :
| Code: |
ss = InitializeSecurityContext(ref _hOutboundCred,
IntPtr.Zero,
_sAccountName, // null string pszTargetName,
STANDARD_CONTEXT_ATTRIBUTES,
0,//int Reserved1,
SECURITY_NETWORK_DREP, //int TargetDataRep
IntPtr.Zero, //Always zero first time around...
0, //int Reserved2,
out _hClientContext, //pHandle CtxtHandle = SecHandle
out ClientToken,//ref SecBufferDesc pOutput, //PSecBufferDesc
out ContextAttributes,//ref int pfContextAttr,
out ClientLifeTime); //ref IntPtr ptsExpiry ); //PTimeStamp
|
Please help me in this regard. _________________ Thanks
Hariharasudhan |
|