In the "operation does permission checking" model used by fuse, chdir
permission is not checked, since there's no chdir method.
For this case set a lookup flag, which will be passed to
->permission(), so fuse can distinguish it from permission checks for
other operations.
Signed-off-by: Miklos Szeredi <[email protected]>
---
Index: linux/fs/fuse/dir.c
===================================================================
--- linux.orig/fs/fuse/dir.c 2006-07-27 14:38:04.000000000 +0200
+++ linux/fs/fuse/dir.c 2006-07-27 14:38:15.000000000 +0200
@@ -776,7 +776,7 @@ static int fuse_permission(struct inode
if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO))
return -EACCES;
- if (nd && (nd->flags & LOOKUP_ACCESS))
+ if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR)))
return fuse_access(inode, mask);
return 0;
}
Index: linux/fs/open.c
===================================================================
--- linux.orig/fs/open.c 2006-07-27 14:35:14.000000000 +0200
+++ linux/fs/open.c 2006-07-27 14:38:15.000000000 +0200
@@ -546,7 +546,8 @@ asmlinkage long sys_chdir(const char __u
struct nameidata nd;
int error;
- error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
+ error = __user_walk(filename,
+ LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
if (error)
goto out;
Index: linux/include/linux/namei.h
===================================================================
--- linux.orig/include/linux/namei.h 2006-07-27 14:35:14.000000000 +0200
+++ linux/include/linux/namei.h 2006-07-27 14:38:15.000000000 +0200
@@ -54,6 +54,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LA
#define LOOKUP_OPEN (0x0100)
#define LOOKUP_CREATE (0x0200)
#define LOOKUP_ACCESS (0x0400)
+#define LOOKUP_CHDIR (0x0800)
extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]