svn commit: samba r18314 - in branches/SAMBA_4_0/source/ntvfs/posix: .

idra at samba.org idra at samba.org
Sat Sep 9 23:50:45 GMT 2006


Author: idra
Date: 2006-09-09 23:50:44 +0000 (Sat, 09 Sep 2006)
New Revision: 18314

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18314

Log:

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.


Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c	2006-09-09 22:27:06 UTC (rev 18313)
+++ branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c	2006-09-09 23:50:44 UTC (rev 18314)
@@ -58,7 +58,31 @@
 		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);
 		return pvfs_map_errno(pvfs, errno);



More information about the samba-cvs mailing list