mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3:param: Allow to add usershare if uid_wrapper is loaded
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
4f5cfe2713
commit
0df6ecf2fa
@ -3513,6 +3513,19 @@ static bool usershare_exists(int iService, struct timespec *last_mod)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool usershare_directory_is_root(uid_t uid)
|
||||
{
|
||||
if (uid == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (uid_wrapper_enabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Load a usershare service by name. Returns a valid servicenumber or -1.
|
||||
***************************************************************************/
|
||||
@ -3546,9 +3559,11 @@ int load_usershare_service(const char *servicename)
|
||||
*/
|
||||
|
||||
#ifdef S_ISVTX
|
||||
if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
|
||||
if (!usershare_directory_is_root(sbuf.st_ex_uid) ||
|
||||
!(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
|
||||
#else
|
||||
if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
|
||||
if (!usershare_directory_is_root(sbuf.st_ex_uid) ||
|
||||
(sbuf.st_ex_mode & S_IWOTH)) {
|
||||
#endif
|
||||
DEBUG(0,("load_usershare_service: directory %s is not owned by root "
|
||||
"or does not have the sticky bit 't' set or is writable by anyone.\n",
|
||||
|
Loading…
Reference in New Issue
Block a user