Commit da05dfd1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rpcrt4: Store security package name in rpc_server_registered_auth_info.

parent b3d12a16
......@@ -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);
if (!package_name)
return RPC_S_OUT_OF_RESOURCES;
auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
if (!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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment