summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-09-09 23:50:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:06 -0500
commitb0f6a94d9aab979b277c7dbd82b03aa0ce3d1a2f (patch)
tree6d72b304e5bc2f09be23b21434a01f385361a613 /source4/ntvfs
parente91cee468eceb6ff8843bafc7fbb22a21b52a00c (diff)
downloadsamba-b0f6a94d9aab979b277c7dbd82b03aa0ce3d1a2f.tar.gz
samba-b0f6a94d9aab979b277c7dbd82b03aa0ce3d1a2f.tar.bz2
samba-b0f6a94d9aab979b277c7dbd82b03aa0ce3d1a2f.zip
r18314: Handle the case where a dir has the sticky bit set and the OS gives back
EPERM when trying to access user xattrs. Just pretend no attributes are set. Simo. (This used to be commit 53463ca7969e76f9fb2bc7c5a023d23732e422f5)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/posix/xattr_system.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/xattr_system.c b/source4/ntvfs/posix/xattr_system.c
index 9dca13e5c2..ab2337c200 100644
--- a/source4/ntvfs/posix/xattr_system.c
+++ b/source4/ntvfs/posix/xattr_system.c
@@ -58,6 +58,30 @@ again:
blob->length = estimated_size;
goto again;
}
+ if (ret == -1 && errno == EPERM) {
+ struct stat statbuf;
+
+ if (fd != -1) {
+ ret = fstat(fd, &statbuf);
+ } else {
+ ret = stat(fname, &statbuf);
+ }
+ if (ret == 0) {
+ /* check if this is a directory and the sticky bit is set */
+ if (S_ISDIR(statbuf.st_mode) && (statbuf.st_mode & S_ISVTX)) {
+ /* pretend we could not find the xattr */
+
+ data_blob_free(blob);
+ return NT_STATUS_NOT_FOUND;
+
+ } else {
+ /* if not this was probably a legittimate error
+ * reset ret and errno to the correct values */
+ errno = EPERM;
+ ret = -1;
+ }
+ }
+ }
if (ret == -1) {
data_blob_free(blob);