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:
parent
b3d12a16ce
commit
da05dfd151
|
@ -1312,9 +1312,10 @@ struct rpc_server_registered_auth_info
|
||||||
TimeStamp exp;
|
TimeStamp exp;
|
||||||
BOOL cred_acquired;
|
BOOL cred_acquired;
|
||||||
CredHandle cred;
|
CredHandle cred;
|
||||||
ULONG max_token;
|
|
||||||
USHORT auth_type;
|
USHORT auth_type;
|
||||||
|
WCHAR *package_name;
|
||||||
WCHAR *principal;
|
WCHAR *principal;
|
||||||
|
ULONG max_token;
|
||||||
};
|
};
|
||||||
|
|
||||||
static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
|
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)
|
if (!auth_info->cred_acquired)
|
||||||
{
|
{
|
||||||
SecPkgInfoW *packages, *package;
|
|
||||||
SECURITY_STATUS sec_status;
|
SECURITY_STATUS sec_status;
|
||||||
|
|
||||||
status = find_security_package(auth_info->auth_type, &packages, &package);
|
sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)auth_info->principal, auth_info->package_name,
|
||||||
if (status != RPC_S_OK)
|
|
||||||
break;
|
|
||||||
|
|
||||||
sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)auth_info->principal, package->Name,
|
|
||||||
SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL,
|
SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL,
|
||||||
&auth_info->cred, &auth_info->exp);
|
&auth_info->cred, &auth_info->exp);
|
||||||
FreeContextBuffer(packages);
|
|
||||||
if (sec_status != SEC_E_OK)
|
if (sec_status != SEC_E_OK)
|
||||||
{
|
{
|
||||||
status = RPC_S_SEC_PKG_ERROR;
|
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;
|
struct rpc_server_registered_auth_info *auth_info;
|
||||||
SecPkgInfoW *packages, *package;
|
SecPkgInfoW *packages, *package;
|
||||||
|
WCHAR *package_name;
|
||||||
ULONG max_token;
|
ULONG max_token;
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
|
|
||||||
|
@ -1446,20 +1442,27 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG Au
|
||||||
if (status != RPC_S_OK)
|
if (status != RPC_S_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
package_name = RPCRT4_strdupW(package->Name);
|
||||||
max_token = package->cbMaxToken;
|
max_token = package->cbMaxToken;
|
||||||
FreeContextBuffer(packages);
|
FreeContextBuffer(packages);
|
||||||
|
if (!package_name)
|
||||||
auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
|
|
||||||
if (!auth_info)
|
|
||||||
return RPC_S_OUT_OF_RESOURCES;
|
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))) {
|
if (ServerPrincName && !(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, package_name);
|
||||||
HeapFree(GetProcessHeap(), 0, auth_info);
|
HeapFree(GetProcessHeap(), 0, auth_info);
|
||||||
return RPC_S_OUT_OF_RESOURCES;
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
auth_info->max_token = max_token;
|
|
||||||
auth_info->auth_type = AuthnSvc;
|
auth_info->auth_type = AuthnSvc;
|
||||||
|
auth_info->package_name = package_name;
|
||||||
|
auth_info->max_token = max_token;
|
||||||
|
|
||||||
EnterCriticalSection(&server_auth_info_cs);
|
EnterCriticalSection(&server_auth_info_cs);
|
||||||
list_add_tail(&server_registered_auth_info, &auth_info->entry);
|
list_add_tail(&server_registered_auth_info, &auth_info->entry);
|
||||||
|
|
Loading…
Reference in New Issue