mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[RPCRT4] Sync with Wine Staging 1.9.16. CORE-11866
svn path=/trunk/; revision=72350
This commit is contained in:
parent
891c9a1bc1
commit
5f766a75dc
4 changed files with 84 additions and 91 deletions
|
@ -1829,3 +1829,8 @@ RPCRTAPI LONG RPC_ENTRY NdrAsyncStubCall(struct IRpcStubBuffer* pThis,
|
||||||
FIXME("unimplemented, expect crash!\n");
|
FIXME("unimplemented, expect crash!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RPC_ENTRY NdrAsyncServerCall(PRPC_MESSAGE pRpcMsg)
|
||||||
|
{
|
||||||
|
FIXME("unimplemented, %p\n", pRpcMsg);
|
||||||
|
}
|
||||||
|
|
|
@ -1288,11 +1288,44 @@ struct rpc_server_registered_auth_info
|
||||||
{
|
{
|
||||||
struct list entry;
|
struct list entry;
|
||||||
TimeStamp exp;
|
TimeStamp exp;
|
||||||
|
BOOL cred_acquired;
|
||||||
CredHandle cred;
|
CredHandle cred;
|
||||||
ULONG max_token;
|
ULONG max_token;
|
||||||
USHORT auth_type;
|
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(
|
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(
|
||||||
USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
|
USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
|
||||||
{
|
{
|
||||||
|
@ -1304,6 +1337,28 @@ RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(
|
||||||
{
|
{
|
||||||
if (auth_info->auth_type == auth_type)
|
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;
|
*cred = auth_info->cred;
|
||||||
*exp = auth_info->exp;
|
*exp = auth_info->exp;
|
||||||
*max_token = auth_info->max_token;
|
*max_token = auth_info->max_token;
|
||||||
|
@ -1323,7 +1378,9 @@ void RPCRT4_ServerFreeAllRegisteredAuthInfo(void)
|
||||||
EnterCriticalSection(&server_auth_info_cs);
|
EnterCriticalSection(&server_auth_info_cs);
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(auth_info, cursor2, &server_registered_auth_info, struct rpc_server_registered_auth_info, entry)
|
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);
|
HeapFree(GetProcessHeap(), 0, auth_info);
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&server_auth_info_cs);
|
LeaveCriticalSection(&server_auth_info_cs);
|
||||||
|
@ -1336,63 +1393,18 @@ void RPCRT4_ServerFreeAllRegisteredAuthInfo(void)
|
||||||
RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn,
|
RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn,
|
||||||
LPVOID Arg )
|
LPVOID Arg )
|
||||||
{
|
{
|
||||||
SECURITY_STATUS sec_status;
|
WCHAR *principal_name = NULL;
|
||||||
CredHandle cred;
|
RPC_STATUS status;
|
||||||
TimeStamp exp;
|
|
||||||
ULONG package_count;
|
|
||||||
ULONG i;
|
|
||||||
PSecPkgInfoA packages;
|
|
||||||
ULONG max_token;
|
|
||||||
struct rpc_server_registered_auth_info *auth_info;
|
|
||||||
|
|
||||||
TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
|
TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
|
||||||
|
|
||||||
sec_status = EnumerateSecurityPackagesA(&package_count, &packages);
|
if(ServerPrincName && !(principal_name = RPCRT4_strdupAtoW((const char*)ServerPrincName)))
|
||||||
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;
|
|
||||||
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;
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
}
|
|
||||||
|
|
||||||
auth_info->exp = exp;
|
status = RpcServerRegisterAuthInfoW(principal_name, AuthnSvc, GetKeyFn, Arg);
|
||||||
auth_info->cred = cred;
|
|
||||||
auth_info->max_token = max_token;
|
|
||||||
auth_info->auth_type = AuthnSvc;
|
|
||||||
|
|
||||||
EnterCriticalSection(&server_auth_info_cs);
|
HeapFree(GetProcessHeap(), 0, principal_name);
|
||||||
list_add_tail(&server_registered_auth_info, &auth_info->entry);
|
return status;
|
||||||
LeaveCriticalSection(&server_auth_info_cs);
|
|
||||||
|
|
||||||
return RPC_S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1401,55 +1413,31 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG Au
|
||||||
RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn,
|
RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn,
|
||||||
LPVOID Arg )
|
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;
|
struct rpc_server_registered_auth_info *auth_info;
|
||||||
|
SecPkgInfoW *packages, *package;
|
||||||
|
ULONG max_token;
|
||||||
|
RPC_STATUS status;
|
||||||
|
|
||||||
TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
|
TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
|
||||||
|
|
||||||
sec_status = EnumerateSecurityPackagesW(&package_count, &packages);
|
status = find_security_package(AuthnSvc, &packages, &package);
|
||||||
if (sec_status != SEC_E_OK)
|
if (status != RPC_S_OK)
|
||||||
{
|
return status;
|
||||||
ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n",
|
|
||||||
sec_status);
|
|
||||||
return RPC_S_SEC_PKG_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < package_count; i++)
|
max_token = package->cbMaxToken;
|
||||||
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);
|
FreeContextBuffer(packages);
|
||||||
if (sec_status != SEC_E_OK)
|
|
||||||
return RPC_S_SEC_PKG_ERROR;
|
|
||||||
|
|
||||||
auth_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*auth_info));
|
auth_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*auth_info));
|
||||||
if (!auth_info)
|
if (!auth_info)
|
||||||
{
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
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;
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
auth_info->exp = exp;
|
|
||||||
auth_info->cred = cred;
|
|
||||||
auth_info->max_token = max_token;
|
auth_info->max_token = max_token;
|
||||||
auth_info->auth_type = AuthnSvc;
|
auth_info->auth_type = AuthnSvc;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
124 stub NDRcopy
|
124 stub NDRcopy
|
||||||
125 stdcall NdrAllocate(ptr long)
|
125 stdcall NdrAllocate(ptr long)
|
||||||
126 varargs NdrAsyncClientCall(ptr ptr)
|
126 varargs NdrAsyncClientCall(ptr ptr)
|
||||||
127 stub NdrAsyncServerCall
|
127 stdcall NdrAsyncServerCall(ptr)
|
||||||
128 stdcall NdrByteCountPointerBufferSize(ptr ptr ptr)
|
128 stdcall NdrByteCountPointerBufferSize(ptr ptr ptr)
|
||||||
129 stdcall NdrByteCountPointerFree(ptr ptr ptr)
|
129 stdcall NdrByteCountPointerFree(ptr ptr ptr)
|
||||||
130 stdcall NdrByteCountPointerMarshall(ptr ptr ptr)
|
130 stdcall NdrByteCountPointerMarshall(ptr ptr ptr)
|
||||||
|
|
|
@ -163,7 +163,7 @@ reactos/dll/win32/rasapi32 # Synced to WineStaging-1.9.11
|
||||||
reactos/dll/win32/resutils # Synced to WineStaging-1.9.11
|
reactos/dll/win32/resutils # Synced to WineStaging-1.9.11
|
||||||
reactos/dll/win32/riched20 # Synced to WineStaging-1.9.16
|
reactos/dll/win32/riched20 # Synced to WineStaging-1.9.16
|
||||||
reactos/dll/win32/riched32 # Synced to WineStaging-1.9.11
|
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/rsabase # Synced to WineStaging-1.9.11
|
||||||
reactos/dll/win32/rsaenh # 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
|
reactos/dll/win32/sccbase # Synced to WineStaging-1.9.11
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue