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

smbd: Make complex if-expression in file_set_dosmode() easier to read

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2022-03-04 08:39:01 +01:00 committed by Ralph Boehme
parent ab692aa6e7
commit b3514a57e9

View File

@ -1022,9 +1022,11 @@ int file_set_dosmode(connection_struct *conn,
* Simply refuse to do the chmod in this case. * Simply refuse to do the chmod in this case.
*/ */
if (S_ISDIR(smb_fname->st.st_ex_mode) && (unixmode & S_ISGID) && if (S_ISDIR(smb_fname->st.st_ex_mode) &&
geteuid() != sec_initial_uid() && (unixmode & S_ISGID) &&
!current_user_in_group(conn, smb_fname->st.st_ex_gid)) { geteuid() != sec_initial_uid() &&
!current_user_in_group(conn, smb_fname->st.st_ex_gid))
{
DEBUG(3,("file_set_dosmode: setgid bit cannot be " DEBUG(3,("file_set_dosmode: setgid bit cannot be "
"set for directory %s\n", "set for directory %s\n",
smb_fname_str_dbg(smb_fname))); smb_fname_str_dbg(smb_fname)));