rpcrt4: Allow applications to specify authentication levels other than connect in RpcBindingSetAuthInfoA/W.

Robert Shearman rob at codeweavers.com
Tue Nov 21 07:09:44 CST 2006


Map the default authentication level and service to sane values.

Don't create an RpcAuthInfo object if RPC_C_AUTHN_LEVEL_NONE is specified.
---
  dlls/rpcrt4/rpc_binding.c |   36 ++++++++++++++++++++++++++++++++----
  1 files changed, 32 insertions(+), 4 deletions(-)
-------------- next part --------------
diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index c8368ff..7b55f21 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -1049,9 +1049,23 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HA
   TRACE("%p %s %lu %lu %p %lu %p\n", Binding, debugstr_a((const char*)ServerPrincName),
         AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
 
-  if (AuthnLevel != RPC_C_AUTHN_LEVEL_CONNECT)
+  if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
+    AuthnSvc = RPC_C_AUTHN_WINNT;
+
+  /* FIXME: the mapping should probably be retrieved using SSPI somehow */
+  if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
+    AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
+
+  if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
+  {
+    if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
+    bind->AuthInfo = NULL;
+    return RPC_S_OK;
+  }
+
+  if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
   {
-    FIXME("unsupported AuthnLevel %lu\n", AuthnLevel);
+    FIXME("unknown AuthnLevel %lu\n", AuthnLevel);
     return RPC_S_UNKNOWN_AUTHN_LEVEL;
   }
 
@@ -1121,9 +1135,23 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HA
   TRACE("%p %s %lu %lu %p %lu %p\n", Binding, debugstr_w((const WCHAR*)ServerPrincName),
         AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
 
-  if (AuthnLevel != RPC_C_AUTHN_LEVEL_CONNECT)
+  if (AuthnSvc == RPC_C_AUTHN_DEFAULT)
+    AuthnSvc = RPC_C_AUTHN_WINNT;
+
+  /* FIXME: the mapping should probably be retrieved using SSPI somehow */
+  if (AuthnLevel == RPC_C_AUTHN_LEVEL_DEFAULT)
+    AuthnLevel = RPC_C_AUTHN_LEVEL_NONE;
+
+  if ((AuthnLevel == RPC_C_AUTHN_LEVEL_NONE) || (AuthnSvc == RPC_C_AUTHN_NONE))
+  {
+    if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo);
+    bind->AuthInfo = NULL;
+    return RPC_S_OK;
+  }
+
+  if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
   {
-    FIXME("unsupported AuthnLevel %lu\n", AuthnLevel);
+    FIXME("unknown AuthnLevel %lu\n", AuthnLevel);
     return RPC_S_UNKNOWN_AUTHN_LEVEL;
   }
 


More information about the wine-patches mailing list