From b0f6a94d9aab979b277c7dbd82b03aa0ce3d1a2f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 9 Sep 2006 23:50:44 +0000 Subject: 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) --- source4/ntvfs/posix/xattr_system.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'source4/ntvfs') 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); -- cgit