1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: don't call change_to_root_user() before change_to_guest()

This is just an optimization and it makes it clearer
that calling change_to_root_user() just before change_to_guest()
is useless and confusing.

We call change_to_guest() before set_current_service() now,
but that has no impact as we pass 'do_chdir=false'
as AS_GUEST is never mixed with AS_USER or DO_CHDIR.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jun 14 23:38:55 CEST 2018 on sn-devel-144
This commit is contained in:
Stefan Metzmacher 2018-05-23 14:26:37 +02:00
parent 9393d95f22
commit 5ef6775919

View File

@ -1624,6 +1624,15 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req)
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return conn;
}
} else if (flags & AS_GUEST) {
/*
* Does this protocol need to be run as guest? (Only archane
* messenger service requests have this...)
*/
if (!change_to_guest()) {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return conn;
}
} else {
/* This call needs to be run as root */
change_to_root_user();
@ -1656,17 +1665,6 @@ static connection_struct *switch_message(uint8_t type, struct smb_request *req)
conn->num_smb_operations++;
}
/*
* Does this protocol need to be run as guest? (Only archane
* messenger service requests have this...)
*/
if (flags & AS_GUEST) {
if (!change_to_guest()) {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return conn;
}
}
/*
* Update encryption and signing state tracking flags that are
* used by smbstatus to display signing and encryption status.