summaryrefslogtreecommitdiffstats
path: root/lib/util/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-08-05 11:21:06 +1000
committerAndrew Tridgell <tridge@samba.org>2009-08-05 11:21:06 +1000
commit58e5e1ea8d4c5a9eb8d36aa8132fd1ba3985ca53 (patch)
treec66cc43d180750e40a4a7ffb42ca1bfe6bbd7f11 /lib/util/util.c
parentfd43e0ee09e3f82093e9a15dd6cbd2fbaa113426 (diff)
downloadsamba-58e5e1ea8d4c5a9eb8d36aa8132fd1ba3985ca53.tar.gz
samba-58e5e1ea8d4c5a9eb8d36aa8132fd1ba3985ca53.tar.xz
samba-58e5e1ea8d4c5a9eb8d36aa8132fd1ba3985ca53.zip
make the UID_WRAPPER skip checks at runtime
This fixes two issues pointed out by Andrew. It adds a runtime uwrap_enabled() call that wraps the skips needed for uid emulation. It also makes the skip in the directory_create_or_exist() function only change the uid checking code, not the permissions code
Diffstat (limited to 'lib/util/util.c')
-rw-r--r--lib/util/util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index dea140148fa..2a809d3ccb0 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -133,14 +133,17 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
umask(old_umask);
return false;
}
- if ((st.st_uid != uid) ||
- ((st.st_mode & 0777) != dir_perms)) {
-#ifndef UID_WRAPPER_REPLACE
+ if (st.st_uid != uid && !uwrap_enabled()) {
+ DEBUG(0, ("invalid ownership on directory "
+ "%s\n", dname));
+ umask(old_umask);
+ return false;
+ }
+ if ((st.st_mode & 0777) != dir_perms) {
DEBUG(0, ("invalid permissions on directory "
"%s\n", dname));
umask(old_umask);
return false;
-#endif
}
}
return true;