Commit 2cc40bac authored by Kai Blin's avatar Kai Blin Committed by Alexandre Julliard

Fixed a couple of bugs in InitializeSecurityContext(A/W) and

AcceptSecurityContext.
parent 297aeb5b
...@@ -37,6 +37,8 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec, ...@@ -37,6 +37,8 @@ static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec,
{ {
SECURITY_STATUS ret; SECURITY_STATUS ret;
TRACE("%p %p %p\n", phSec, package, realHandle);
if (phSec && package && realHandle) if (phSec && package && realHandle)
{ {
PSecHandle newSec = (PSecHandle)SECUR32_ALLOC(sizeof(SecHandle)); PSecHandle newSec = (PSecHandle)SECUR32_ALLOC(sizeof(SecHandle));
...@@ -260,14 +262,22 @@ SECURITY_STATUS WINAPI InitializeSecurityContextA( ...@@ -260,14 +262,22 @@ SECURITY_STATUS WINAPI InitializeSecurityContextA(
{ {
CtxtHandle myCtxt; CtxtHandle myCtxt;
if(phContext)
{
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
myCtxt.dwUpper = realCtxt->dwUpper;
myCtxt.dwLower = realCtxt->dwLower;
}
ret = package->provider->fnTableA.InitializeSecurityContextA( ret = package->provider->fnTableA.InitializeSecurityContextA(
cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq, cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq,
Reserved1, TargetDataRep, pInput, Reserved2, &myCtxt, Reserved1, TargetDataRep, pInput, Reserved2, &myCtxt,
pOutput, pfContextAttr, ptsExpiry); pOutput, pfContextAttr, ptsExpiry);
if (ret == SEC_E_OK) if (ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED)
{ {
ret = SECUR32_makeSecHandle(phContext, package, &myCtxt); SECURITY_STATUS ret2;
if (ret != SEC_E_OK) ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext( package->provider->fnTableW.DeleteSecurityContext(
&myCtxt); &myCtxt);
} }
...@@ -309,14 +319,22 @@ SECURITY_STATUS WINAPI InitializeSecurityContextW( ...@@ -309,14 +319,22 @@ SECURITY_STATUS WINAPI InitializeSecurityContextW(
{ {
CtxtHandle myCtxt; CtxtHandle myCtxt;
if(phContext)
{
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
myCtxt.dwUpper = realCtxt->dwUpper;
myCtxt.dwLower = realCtxt->dwLower;
}
ret = package->provider->fnTableW.InitializeSecurityContextW( ret = package->provider->fnTableW.InitializeSecurityContextW(
cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq, cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq,
Reserved1, TargetDataRep, pInput, Reserved2, &myCtxt, Reserved1, TargetDataRep, pInput, Reserved2, &myCtxt,
pOutput, pfContextAttr, ptsExpiry); pOutput, pfContextAttr, ptsExpiry);
if (ret == SEC_E_OK) if (ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED)
{ {
ret = SECUR32_makeSecHandle(phContext, package, &myCtxt); SECURITY_STATUS ret2;
if (ret != SEC_E_OK) ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext( package->provider->fnTableW.DeleteSecurityContext(
&myCtxt); &myCtxt);
} }
...@@ -357,13 +375,22 @@ SECURITY_STATUS WINAPI AcceptSecurityContext( ...@@ -357,13 +375,22 @@ SECURITY_STATUS WINAPI AcceptSecurityContext(
{ {
CtxtHandle myCtxt; CtxtHandle myCtxt;
if(phContext)
{
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
TRACE("realCtx: %p\n", realCtxt);
myCtxt.dwUpper = realCtxt->dwUpper;
myCtxt.dwLower = realCtxt->dwLower;
}
ret = package->provider->fnTableW.AcceptSecurityContext( ret = package->provider->fnTableW.AcceptSecurityContext(
cred, phContext ? &myCtxt : NULL, pInput, fContextReq, cred, phContext ? &myCtxt : NULL, pInput, fContextReq,
TargetDataRep, &myCtxt, pOutput, pfContextAttr, ptsExpiry); TargetDataRep, &myCtxt, pOutput, pfContextAttr, ptsExpiry);
if (ret == SEC_E_OK) if (ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED)
{ {
ret = SECUR32_makeSecHandle(phContext, package, &myCtxt); SECURITY_STATUS ret2;
if (ret != SEC_E_OK) ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext( package->provider->fnTableW.DeleteSecurityContext(
&myCtxt); &myCtxt);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment