Author: akhaldi Date: Fri Aug 19 09:40:25 2016 New Revision: 72350
URL: http://svn.reactos.org/svn/reactos?rev=72350&view=rev Log: [RPCRT4] Sync with Wine Staging 1.9.16. CORE-11866
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c trunk/reactos/dll/win32/rpcrt4/rpc_server.c trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_stuble... ============================================================================== --- trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c [iso-8859-1] Fri Aug 19 09:40:25 2016 @@ -1829,3 +1829,8 @@ FIXME("unimplemented, expect crash!\n"); return 0; } + +void RPC_ENTRY NdrAsyncServerCall(PRPC_MESSAGE pRpcMsg) +{ + FIXME("unimplemented, %p\n", pRpcMsg); +}
Modified: trunk/reactos/dll/win32/rpcrt4/rpc_server.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_server... ============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_server.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_server.c [iso-8859-1] Fri Aug 19 09:40:25 2016 @@ -1288,10 +1288,43 @@ { struct list entry; TimeStamp exp; + BOOL cred_acquired; CredHandle cred; ULONG max_token; USHORT auth_type; + WCHAR *principal; }; + +static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret) +{ + SECURITY_STATUS sec_status; + SecPkgInfoW *packages; + ULONG package_count; + ULONG i; + + sec_status = EnumerateSecurityPackagesW(&package_count, &packages); + if (sec_status != SEC_E_OK) + { + ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", sec_status); + return RPC_S_SEC_PKG_ERROR; + } + + for (i = 0; i < package_count; i++) + if (packages[i].wRPCID == auth_type) + break; + + if (i == package_count) + { + WARN("unsupported AuthnSvc %u\n", auth_type); + FreeContextBuffer(packages); + return RPC_S_UNKNOWN_AUTHN_SERVICE; + } + + TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), auth_type); + *packages_buf = packages; + *ret = packages + i; + return RPC_S_OK; +}
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo( USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token) @@ -1304,6 +1337,28 @@ { if (auth_info->auth_type == auth_type) { + if (!auth_info->cred_acquired) + { + SecPkgInfoW *packages, *package; + SECURITY_STATUS sec_status; + + status = find_security_package(auth_info->auth_type, &packages, &package); + if (status != RPC_S_OK) + break; + + sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)auth_info->principal, package->Name, + SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL, + &auth_info->cred, &auth_info->exp); + FreeContextBuffer(packages); + if (sec_status != SEC_E_OK) + { + status = RPC_S_SEC_PKG_ERROR; + break; + } + + auth_info->cred_acquired = TRUE; + } + *cred = auth_info->cred; *exp = auth_info->exp; *max_token = auth_info->max_token; @@ -1323,7 +1378,9 @@ EnterCriticalSection(&server_auth_info_cs); LIST_FOR_EACH_ENTRY_SAFE(auth_info, cursor2, &server_registered_auth_info, struct rpc_server_registered_auth_info, entry) { - FreeCredentialsHandle(&auth_info->cred); + if (auth_info->cred_acquired) + FreeCredentialsHandle(&auth_info->cred); + HeapFree(GetProcessHeap(), 0, auth_info->principal); HeapFree(GetProcessHeap(), 0, auth_info); } LeaveCriticalSection(&server_auth_info_cs); @@ -1336,120 +1393,51 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg ) { - SECURITY_STATUS sec_status; - CredHandle cred; - TimeStamp exp; - ULONG package_count; - ULONG i; - PSecPkgInfoA packages; + WCHAR *principal_name = NULL; + RPC_STATUS status; + + TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg); + + if(ServerPrincName && !(principal_name = RPCRT4_strdupAtoW((const char*)ServerPrincName))) + return RPC_S_OUT_OF_RESOURCES; + + status = RpcServerRegisterAuthInfoW(principal_name, AuthnSvc, GetKeyFn, Arg); + + HeapFree(GetProcessHeap(), 0, principal_name); + return status; +} + +/*********************************************************************** + * RpcServerRegisterAuthInfoW (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, + LPVOID Arg ) +{ + struct rpc_server_registered_auth_info *auth_info; + SecPkgInfoW *packages, *package; ULONG max_token; - struct rpc_server_registered_auth_info *auth_info; - - TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg); - - sec_status = EnumerateSecurityPackagesA(&package_count, &packages); - if (sec_status != SEC_E_OK) - { - ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", - sec_status); - return RPC_S_SEC_PKG_ERROR; - } - - for (i = 0; i < package_count; i++) - if (packages[i].wRPCID == AuthnSvc) - break; - - if (i == package_count) - { - WARN("unsupported AuthnSvc %u\n", AuthnSvc); - FreeContextBuffer(packages); - return RPC_S_UNKNOWN_AUTHN_SERVICE; - } - TRACE("found package %s for service %u\n", packages[i].Name, - AuthnSvc); - sec_status = AcquireCredentialsHandleA((SEC_CHAR *)ServerPrincName, - packages[i].Name, - SECPKG_CRED_INBOUND, NULL, NULL, - NULL, NULL, &cred, &exp); - max_token = packages[i].cbMaxToken; + RPC_STATUS status; + + TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg); + + status = find_security_package(AuthnSvc, &packages, &package); + if (status != RPC_S_OK) + return status; + + max_token = package->cbMaxToken; FreeContextBuffer(packages); - if (sec_status != SEC_E_OK) - return RPC_S_SEC_PKG_ERROR;
auth_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*auth_info)); if (!auth_info) - { - FreeCredentialsHandle(&cred); return RPC_S_OUT_OF_RESOURCES; - } - - auth_info->exp = exp; - auth_info->cred = cred; - auth_info->max_token = max_token; - auth_info->auth_type = AuthnSvc; - - EnterCriticalSection(&server_auth_info_cs); - list_add_tail(&server_registered_auth_info, &auth_info->entry); - LeaveCriticalSection(&server_auth_info_cs); - - return RPC_S_OK; -} - -/*********************************************************************** - * RpcServerRegisterAuthInfoW (RPCRT4.@) - */ -RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, - LPVOID Arg ) -{ - SECURITY_STATUS sec_status; - CredHandle cred; - TimeStamp exp; - ULONG package_count; - ULONG i; - PSecPkgInfoW packages; - ULONG max_token; - struct rpc_server_registered_auth_info *auth_info; - - TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg); - - sec_status = EnumerateSecurityPackagesW(&package_count, &packages); - if (sec_status != SEC_E_OK) - { - ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", - sec_status); - return RPC_S_SEC_PKG_ERROR; - } - - for (i = 0; i < package_count; i++) - if (packages[i].wRPCID == AuthnSvc) - break; - - if (i == package_count) - { - WARN("unsupported AuthnSvc %u\n", AuthnSvc); - FreeContextBuffer(packages); - return RPC_S_UNKNOWN_AUTHN_SERVICE; - } - TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), - AuthnSvc); - sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)ServerPrincName, - packages[i].Name, - SECPKG_CRED_INBOUND, NULL, NULL, - NULL, NULL, &cred, &exp); - max_token = packages[i].cbMaxToken; - FreeContextBuffer(packages); - if (sec_status != SEC_E_OK) - return RPC_S_SEC_PKG_ERROR; - - auth_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*auth_info)); - if (!auth_info) - { - FreeCredentialsHandle(&cred); + + if (!ServerPrincName) { + auth_info->principal = NULL; + }else if (!(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) { + HeapFree(GetProcessHeap(), 0, auth_info); return RPC_S_OUT_OF_RESOURCES; }
- auth_info->exp = exp; - auth_info->cred = cred; auth_info->max_token = max_token; auth_info->auth_type = AuthnSvc;
Modified: trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpcrt4.spe... ============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpcrt4.spec [iso-8859-1] Fri Aug 19 09:40:25 2016 @@ -124,7 +124,7 @@ 124 stub NDRcopy 125 stdcall NdrAllocate(ptr long) 126 varargs NdrAsyncClientCall(ptr ptr) -127 stub NdrAsyncServerCall +127 stdcall NdrAsyncServerCall(ptr) 128 stdcall NdrByteCountPointerBufferSize(ptr ptr ptr) 129 stdcall NdrByteCountPointerFree(ptr ptr ptr) 130 stdcall NdrByteCountPointerMarshall(ptr ptr ptr)
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=7... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Aug 19 09:40:25 2016 @@ -163,7 +163,7 @@ reactos/dll/win32/resutils # Synced to WineStaging-1.9.11 reactos/dll/win32/riched20 # Synced to WineStaging-1.9.16 reactos/dll/win32/riched32 # Synced to WineStaging-1.9.11 -reactos/dll/win32/rpcrt4 # Synced to WineStaging-1.9.11 +reactos/dll/win32/rpcrt4 # Synced to WineStaging-1.9.16 reactos/dll/win32/rsabase # Synced to WineStaging-1.9.11 reactos/dll/win32/rsaenh # Synced to WineStaging-1.9.11 reactos/dll/win32/sccbase # Synced to WineStaging-1.9.11