secur32: Fix wrapper.c to honour functions that run twice, try 2
Kai Blin
blin at gmx.net
Sun Aug 21 14:06:24 CDT 2005
Fixed the wrapper calls to InitializeSecurityContext(A/W) and
AcceptSecurityContext to correctly handle SEC_I_CONTINUE_NEEDED returns.
Corrected writing the wrapped context to the correct variable.
Corrected InitializeSecurityContext(A/W)'s and AcceptSecurityContext's
calls to unwrap the context before passing it to the package's
functions.
Made wrapper calls return the packages return value, not
SECUR32_makeSecHandle()'s return value.
Changelog:
Kai Blin <blin at gmx.net>
Fixed a couple of bugs in InitializeSecurityContext(A/W) and
AcceptSecurityContext.
--
Kai Blin, (blin at gmx dot net)
How sharper than a hound's tooth it is to have a thankless serpent.
-------------- next part --------------
Index: dlls/secur32/wrapper.c
===================================================================
RCS file: /home/wine/wine/dlls/secur32/wrapper.c,v
retrieving revision 1.2
diff -u -3 -r1.2 wrapper.c
--- dlls/secur32/wrapper.c 17 May 2004 21:08:31 -0000 1.2
+++ dlls/secur32/wrapper.c 21 Aug 2005 18:59:22 -0000
@@ -35,6 +35,7 @@
static SECURITY_STATUS SECUR32_makeSecHandle(PSecHandle phSec,
SecurePackage *package, PSecHandle realHandle)
{
+ TRACE("%p %p %p\n", phSec, package, realHandle);
SECURITY_STATUS ret;
if (phSec && package && realHandle)
@@ -260,14 +261,22 @@
{
CtxtHandle myCtxt;
+ if(phContext)
+ {
+ PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
+ myCtxt.dwUpper = realCtxt->dwUpper;
+ myCtxt.dwLower = realCtxt->dwLower;
+ }
+
ret = package->provider->fnTableA.InitializeSecurityContextA(
cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq,
Reserved1, TargetDataRep, pInput, Reserved2, &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);
- if (ret != SEC_E_OK)
+ SECURITY_STATUS ret2;
+ ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
+ if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext(
&myCtxt);
}
@@ -309,14 +318,22 @@
{
CtxtHandle myCtxt;
+ if(phContext)
+ {
+ PCtxtHandle realCtxt = (PCtxtHandle)phContext->dwLower;
+ myCtxt.dwUpper = realCtxt->dwUpper;
+ myCtxt.dwLower = realCtxt->dwLower;
+ }
+
ret = package->provider->fnTableW.InitializeSecurityContextW(
cred, phContext ? &myCtxt : NULL, pszTargetName, fContextReq,
Reserved1, TargetDataRep, pInput, Reserved2, &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);
- if (ret != SEC_E_OK)
+ SECURITY_STATUS ret2;
+ ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
+ if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext(
&myCtxt);
}
@@ -357,13 +374,22 @@
{
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(
cred, phContext ? &myCtxt : NULL, pInput, fContextReq,
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);
- if (ret != SEC_E_OK)
+ SECURITY_STATUS ret2;
+ ret2 = SECUR32_makeSecHandle(phNewContext, package, &myCtxt);
+ if (ret2 != SEC_E_OK)
package->provider->fnTableW.DeleteSecurityContext(
&myCtxt);
}
More information about the wine-patches
mailing list