rpcrt4: Store security package name in rpc_server_registered_auth_info.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-11-30 12:08:51 +01:00 committed by Alexandre Julliard
parent b3d12a16ce
commit da05dfd151
1 changed files with 15 additions and 12 deletions

View File

@ -1312,9 +1312,10 @@ struct rpc_server_registered_auth_info
TimeStamp exp;
BOOL cred_acquired;
CredHandle cred;
ULONG max_token;
USHORT auth_type;
WCHAR *package_name;
WCHAR *principal;
ULONG max_token;
};
static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
@ -1361,17 +1362,11 @@ RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(
{
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,
sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)auth_info->principal, auth_info->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;
@ -1437,6 +1432,7 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG Au
{
struct rpc_server_registered_auth_info *auth_info;
SecPkgInfoW *packages, *package;
WCHAR *package_name;
ULONG max_token;
RPC_STATUS status;
@ -1446,20 +1442,27 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG Au
if (status != RPC_S_OK)
return status;
package_name = RPCRT4_strdupW(package->Name);
max_token = package->cbMaxToken;
FreeContextBuffer(packages);
auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
if (!auth_info)
if (!package_name)
return RPC_S_OUT_OF_RESOURCES;
auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
if (!auth_info) {
HeapFree(GetProcessHeap(), 0, package_name);
return RPC_S_OUT_OF_RESOURCES;
}
if (ServerPrincName && !(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) {
HeapFree(GetProcessHeap(), 0, package_name);
HeapFree(GetProcessHeap(), 0, auth_info);
return RPC_S_OUT_OF_RESOURCES;
}
auth_info->max_token = max_token;
auth_info->auth_type = AuthnSvc;
auth_info->package_name = package_name;
auth_info->max_token = max_token;
EnterCriticalSection(&server_auth_info_cs);
list_add_tail(&server_registered_auth_info, &auth_info->entry);