summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-06-22 16:13:12 +0200
committerStefan Metzmacher <metze@samba.org>2017-06-27 16:57:42 +0200
commit0df6ecf2fabf7bc4b29688d200274acb81cad0db (patch)
tree5d424549a48615bf80b1f1ddcc93793497e33221 /source3/param
parent4f5cfe2713294462b9dc68afbec2ea2c72230885 (diff)
downloadsamba-0df6ecf2fabf7bc4b29688d200274acb81cad0db.tar.gz
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>
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 297a7e9175a..91fa85ea7b0 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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",