rpcrt4: Handle NULL binding in RpcBindingInqAuthClient{,Ex}.

Hans Leidekker hans at codeweavers.com
Tue Nov 22 09:27:06 CST 2016


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/rpcrt4/rpc_binding.c  | 6 +++++-
 dlls/rpcrt4/tests/server.c | 9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index 07eddbe..f2b1d59 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -1621,11 +1621,15 @@ RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
                             RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc,
                             ULONG *AuthzSvc, ULONG Flags )
 {
-    RpcBinding *bind = ClientBinding;
+    RpcBinding *bind;
 
     TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
           AuthnSvc, AuthzSvc, Flags);
 
+    if (!ClientBinding) ClientBinding = I_RpcGetCurrentCallHandle();
+    if (!ClientBinding) return RPC_S_INVALID_BINDING;
+
+    bind = ClientBinding;
     if (!bind->FromConn) return RPC_S_INVALID_BINDING;
 
     return rpcrt4_conn_inquire_auth_client(bind->FromConn, Privs,
diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index ee28703..89dc27a 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -1525,6 +1525,15 @@ void __cdecl s_authinfo_test(unsigned int protseq, int secure)
         }
         ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "level unchanged\n");
         ok(authnsvc == RPC_C_AUTHN_WINNT, "authnsvc unchanged\n");
+        RpcStringFreeA(&principal);
+
+        status = RpcBindingInqAuthClientA(NULL, &privs, &principal, &level, &authnsvc, NULL);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        RpcStringFreeA(&principal);
+
+        status = RpcBindingInqAuthClientExA(NULL, &privs, &principal, &level, &authnsvc, NULL, 0);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        RpcStringFreeA(&principal);
 
         status = RpcImpersonateClient(NULL);
         ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
-- 
2.1.4




More information about the wine-patches mailing list