Rob Shearman : rpcrt4: Fix the error handling in RpcBindingSetAuthInfoA/ W when RpcAuthInfo_Create fails.
Alexandre Julliard
julliard at winehq.org
Wed Jan 23 14:36:47 CST 2008
Module: wine
Branch: master
Commit: fef5ce52ce380c17de68ef1cd7df063e364f2846
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fef5ce52ce380c17de68ef1cd7df063e364f2846
Author: Rob Shearman <rob at codeweavers.com>
Date: Wed Jan 23 16:32:45 2008 +0000
rpcrt4: Fix the error handling in RpcBindingSetAuthInfoA/W when RpcAuthInfo_Create fails.
Don't release the old auth info until we successfully have a new auth
info and return failure to the caller if RpcAuthInfo_Create fails.
---
dlls/rpcrt4/rpc_binding.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index 24769e2..bcf89da 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -1421,13 +1421,17 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
FreeContextBuffer(packages);
if (r == ERROR_SUCCESS)
{
- if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
- bind->AuthInfo = NULL;
+ RpcAuthInfo *new_auth_info;
r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
- AuthIdentity, &bind->AuthInfo);
- if (r != RPC_S_OK)
+ AuthIdentity, &new_auth_info);
+ if (r == RPC_S_OK)
+ {
+ if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
+ bind->AuthInfo = new_auth_info;
+ }
+ else
FreeCredentialsHandle(&cred);
- return RPC_S_OK;
+ return r;
}
else
{
@@ -1537,13 +1541,17 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
FreeContextBuffer(packages);
if (r == ERROR_SUCCESS)
{
- if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
- bind->AuthInfo = NULL;
+ RpcAuthInfo *new_auth_info;
r = RpcAuthInfo_Create(AuthnLevel, AuthnSvc, cred, exp, cbMaxToken,
- AuthIdentity, &bind->AuthInfo);
- if (r != RPC_S_OK)
+ AuthIdentity, &new_auth_info);
+ if (r == RPC_S_OK)
+ {
+ if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
+ bind->AuthInfo = new_auth_info;
+ }
+ else
FreeCredentialsHandle(&cred);
- return RPC_S_OK;
+ return r;
}
else
{
More information about the wine-cvs
mailing list