secur32: Fix the wrapper InitializeSecurityContextA/W functions to handle phContext and phNewContext parameters being optional for some SSPs.
This commit is contained in:
parent
e24667cc6e
commit
ee47c5a23a
|
@ -247,46 +247,52 @@ SECURITY_STATUS WINAPI InitializeSecurityContextA(
|
||||||
ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
||||||
{
|
{
|
||||||
SECURITY_STATUS ret;
|
SECURITY_STATUS ret;
|
||||||
|
SecurePackage *package = NULL;
|
||||||
|
PCredHandle cred = NULL;
|
||||||
|
PCredHandle ctxt = NULL;
|
||||||
|
|
||||||
TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
|
TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
|
||||||
debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
||||||
Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
||||||
|
|
||||||
|
if (phContext)
|
||||||
|
{
|
||||||
|
package = (SecurePackage *)phContext->dwUpper;
|
||||||
|
ctxt = (PCtxtHandle)phContext->dwLower;
|
||||||
|
}
|
||||||
if (phCredential)
|
if (phCredential)
|
||||||
{
|
{
|
||||||
SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
|
package = (SecurePackage *)phCredential->dwUpper;
|
||||||
PCredHandle cred = (PCredHandle)phCredential->dwLower;
|
cred = (PCredHandle)phCredential->dwLower;
|
||||||
|
}
|
||||||
|
|
||||||
if (package && package->provider)
|
if (package && package->provider)
|
||||||
|
{
|
||||||
|
if (package->provider->fnTableA.InitializeSecurityContextA)
|
||||||
{
|
{
|
||||||
if (package->provider->fnTableA.InitializeSecurityContextA)
|
CtxtHandle myCtxt;
|
||||||
|
|
||||||
|
if (phContext)
|
||||||
{
|
{
|
||||||
CtxtHandle myCtxt;
|
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
|
||||||
|
myCtxt.dwUpper = realCtxt->dwUpper;
|
||||||
if(phContext)
|
myCtxt.dwLower = realCtxt->dwLower;
|
||||||
{
|
}
|
||||||
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
|
|
||||||
myCtxt.dwUpper = realCtxt->dwUpper;
|
ret = package->provider->fnTableA.InitializeSecurityContextA(
|
||||||
myCtxt.dwLower = realCtxt->dwLower;
|
cred, ctxt, pszTargetName, fContextReq,
|
||||||
}
|
Reserved1, TargetDataRep, pInput, Reserved2, phNewContext ? &myCtxt : NULL,
|
||||||
|
pOutput, pfContextAttr, ptsExpiry);
|
||||||
ret = package->provider->fnTableA.InitializeSecurityContextA(
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
||||||
cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq,
|
{
|
||||||
Reserved1, TargetDataRep, pInput, Reserved2, &myCtxt,
|
SECURITY_STATUS ret2;
|
||||||
pOutput, pfContextAttr, ptsExpiry);
|
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
|
||||||
if (ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED)
|
if (ret2 != SEC_E_OK)
|
||||||
{
|
package->provider->fnTableA.DeleteSecurityContext(&myCtxt);
|
||||||
SECURITY_STATUS ret2;
|
|
||||||
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
|
|
||||||
if (ret2 != SEC_E_OK)
|
|
||||||
package->provider->fnTableW.DeleteSecurityContext(
|
|
||||||
&myCtxt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = SEC_E_INVALID_HANDLE;
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = SEC_E_INVALID_HANDLE;
|
ret = SEC_E_INVALID_HANDLE;
|
||||||
|
@ -304,46 +310,52 @@ SECURITY_STATUS WINAPI InitializeSecurityContextW(
|
||||||
ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
ULONG *pfContextAttr, PTimeStamp ptsExpiry)
|
||||||
{
|
{
|
||||||
SECURITY_STATUS ret;
|
SECURITY_STATUS ret;
|
||||||
|
SecurePackage *package = NULL;
|
||||||
|
PCredHandle cred = NULL;
|
||||||
|
PCredHandle ctxt = NULL;
|
||||||
|
|
||||||
TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
|
TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
|
||||||
debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
|
||||||
Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
|
||||||
|
|
||||||
|
if (phContext)
|
||||||
|
{
|
||||||
|
package = (SecurePackage *)phContext->dwUpper;
|
||||||
|
ctxt = (PCtxtHandle)phContext->dwLower;
|
||||||
|
}
|
||||||
if (phCredential)
|
if (phCredential)
|
||||||
{
|
{
|
||||||
SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
|
package = (SecurePackage *)phCredential->dwUpper;
|
||||||
PCredHandle cred = (PCredHandle)phCredential->dwLower;
|
cred = (PCredHandle)phCredential->dwLower;
|
||||||
|
}
|
||||||
|
|
||||||
if (package && package->provider)
|
if (package && package->provider)
|
||||||
|
{
|
||||||
|
if (package->provider->fnTableW.InitializeSecurityContextW)
|
||||||
{
|
{
|
||||||
if (package->provider->fnTableW.QueryCredentialsAttributesW)
|
CtxtHandle myCtxt;
|
||||||
|
|
||||||
|
if (phContext)
|
||||||
{
|
{
|
||||||
CtxtHandle myCtxt;
|
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
|
||||||
|
myCtxt.dwUpper = realCtxt->dwUpper;
|
||||||
if(phContext)
|
myCtxt.dwLower = realCtxt->dwLower;
|
||||||
{
|
}
|
||||||
PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
|
|
||||||
myCtxt.dwUpper = realCtxt->dwUpper;
|
ret = package->provider->fnTableW.InitializeSecurityContextW(
|
||||||
myCtxt.dwLower = realCtxt->dwLower;
|
cred, ctxt, pszTargetName, fContextReq,
|
||||||
}
|
Reserved1, TargetDataRep, pInput, Reserved2, phNewContext ? &myCtxt : NULL,
|
||||||
|
pOutput, pfContextAttr, ptsExpiry);
|
||||||
ret = package->provider->fnTableW.InitializeSecurityContextW(
|
if ((ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED) && phNewContext)
|
||||||
cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq,
|
{
|
||||||
Reserved1, TargetDataRep, pInput, Reserved2, &myCtxt,
|
SECURITY_STATUS ret2;
|
||||||
pOutput, pfContextAttr, ptsExpiry);
|
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
|
||||||
if (ret == SEC_E_OK || ret == SEC_I_CONTINUE_NEEDED)
|
if (ret2 != SEC_E_OK)
|
||||||
{
|
package->provider->fnTableW.DeleteSecurityContext(&myCtxt);
|
||||||
SECURITY_STATUS ret2;
|
|
||||||
ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
|
|
||||||
if (ret2 != SEC_E_OK)
|
|
||||||
package->provider->fnTableW.DeleteSecurityContext(
|
|
||||||
&myCtxt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = SEC_E_INVALID_HANDLE;
|
ret = SEC_E_UNSUPPORTED_FUNCTION;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = SEC_E_INVALID_HANDLE;
|
ret = SEC_E_INVALID_HANDLE;
|
||||||
|
|
Loading…
Reference in New Issue