become_root() Necessary for Group Quota in quotas.c?
Orion
orion at et.byu.edu
Thu Aug 1 23:06:52 UTC 2024
We have a situation in which the root user does not have access to the
files contained in a directory with SGID set. When a user navigates to
this directory and Samba attempts to request the quota for the
directory, it fails when the code later attempts to do a stat on the
file because of lack of permissions.
In the file samba/source3/smbd/quotas.c if the SGID bit is set, the code
changes the effective GID to the GID of the folder, uses become_root()
to change to root, and then requests the quota. However, if the SGID bit
is not set, quotas.c requests the quota without using the become_root()
function. The question I have is, why when the SGID bit is set does it
change to root before requesting the quota?
Can we remove the become_root() function call for this instance and
request the quota as the GID of the folder?
I tested removing the become_root() and unbecome_root() function calls,
and for our particular setup, it works perfectly. However, I am curious
if there is some other setup that may have issues if this bit is removed.
More information about the samba-technical
mailing list