lkml.org 
[lkml]   [2006]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 5/5] vfs: define new lookup flag for chdir
From
Date
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 <miklos@szeredi.hu>
---
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-07-27 15:05    [from the cache]
©2003-2011 Jasper Spaans