mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +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:
parent
cbe80ceef8
commit
367c0d1910
@ -341,22 +341,21 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
|
||||
|
||||
if (fsp->fsp_flags.initial_delete_on_close &&
|
||||
!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
|
||||
* wrote a real delete on close. */
|
||||
|
||||
if (get_current_vuid(conn) != fsp->vuid) {
|
||||
become_user_without_service(conn, fsp->vuid);
|
||||
became_user = True;
|
||||
status = smbXsrv_session_info_lookup(conn->sconn->client,
|
||||
fsp->vuid,
|
||||
&session_info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
fsp->fsp_flags.delete_on_close = true;
|
||||
set_delete_on_close_lck(fsp, lck,
|
||||
get_current_nttok(conn),
|
||||
get_current_utok(conn));
|
||||
if (became_user) {
|
||||
unbecome_user_without_service();
|
||||
}
|
||||
session_info->security_token,
|
||||
session_info->unix_token);
|
||||
}
|
||||
|
||||
delete_file = is_delete_on_close_set(lck, fsp->name_hash) &&
|
||||
|
Loading…
Reference in New Issue
Block a user