patch to fs/ext2/acl.c

Wes Cowley (wcowley@cftnet.com)
Thu, 12 Oct 1995 18:33:56 -0400 (EDT)


Last night I posted about a glitch with ext2_permission() in
fs/ext2/acl.c I haven't seen my post come thru yet, so I'll summarize:

access(some_file,X_OK) returns 0 for root in all cases, even when the file
is not executable at all. It seems to me that in the case of a file that
isn't executable by anyone the function return non-zero since the actual
execution of the file will fail.

I posted an untested fix last night that wasn't quite complete. Here's a
patch that's running now on my system and seems correct. The patch is
against 1.2.13, but it looks like the same code in 1.3.31.

--- fs/ext2/acl.c.dist Thu Oct 12 16:05:26 1995
+++ fs/ext2/acl.c Thu Oct 12 16:29:21 1995
@@ -34,10 +34,13 @@
return -EACCES;
/*
* Special case, access is always granted for root
*/
- if (fsuser())
- return 0;
+ if (fsuser())
+ if (mask == S_IXOTH && !(mode & S_IXUGO) && S_ISREG(mode))
+ return -EACCES;
+ else
+ return 0;
/*
* If no ACL, checks using the file mode
*/
else if (current->fsuid == inode->i_uid)

Wes