1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

smbd: avoid become_user_without_service() in close_remove_share_mode()

Here we called become_user_without_service() just in order to be able to fetch
the nt_token and unix_token subsequently via
get_current_[nt|u]tok(conn). The same can be achieved by fetching the
session_info with smbXsrv_session_info_lookup().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-04-07 09:54:24 +02:00 committed by Jeremy Allison
parent cbe80ceef8
commit 367c0d1910

View File

@ -341,22 +341,21 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
if (fsp->fsp_flags.initial_delete_on_close && if (fsp->fsp_flags.initial_delete_on_close &&
!is_delete_on_close_set(lck, fsp->name_hash)) { !is_delete_on_close_set(lck, fsp->name_hash)) {
bool became_user = False; struct auth_session_info *session_info = NULL;
/* Initial delete on close was set and no one else /* Initial delete on close was set and no one else
* wrote a real delete on close. */ * wrote a real delete on close. */
if (get_current_vuid(conn) != fsp->vuid) { status = smbXsrv_session_info_lookup(conn->sconn->client,
become_user_without_service(conn, fsp->vuid); fsp->vuid,
became_user = True; &session_info);
if (!NT_STATUS_IS_OK(status)) {
return NT_STATUS_INTERNAL_ERROR;
} }
fsp->fsp_flags.delete_on_close = true; fsp->fsp_flags.delete_on_close = true;
set_delete_on_close_lck(fsp, lck, set_delete_on_close_lck(fsp, lck,
get_current_nttok(conn), session_info->security_token,
get_current_utok(conn)); session_info->unix_token);
if (became_user) {
unbecome_user_without_service();
}
} }
delete_file = is_delete_on_close_set(lck, fsp->name_hash) && delete_file = is_delete_on_close_set(lck, fsp->name_hash) &&