diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1994-11-28 11:59:19 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1994-11-28 11:59:19 +0000 |
commit | 1513ff9b7899ab588401c89db0e99903dbf5f886 (patch) | |
tree | f69cc81a940a502ea23d664c3ffb2d215a479667 /fs/ext2/acl.c |
Import of Linus's Linux 1.1.68
Diffstat (limited to 'fs/ext2/acl.c')
-rw-r--r-- | fs/ext2/acl.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c new file mode 100644 index 000000000..91ef7c8cc --- /dev/null +++ b/fs/ext2/acl.c @@ -0,0 +1,50 @@ +/* + * linux/fs/ext2/acl.c + * + * Copyright (C) 1993, 1994 Remy Card (card@masi.ibp.fr) + * Laboratoire MASI - Institut Blaise Pascal + * Universite Pierre et Marie Curie (Paris VI) + */ + +/* + * This file will contain the Access Control Lists management for the + * second extended file system. + */ + +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/ext2_fs.h> +#include <linux/sched.h> +#include <linux/stat.h> + +/* + * ext2_permission () + * + * Check for access rights + */ +int ext2_permission (struct inode * inode, int mask) +{ + unsigned short mode = inode->i_mode; + + /* + * Nobody gets write access to an immutable file + */ + if ((mask & S_IWOTH) && IS_IMMUTABLE(inode)) + return 0; + /* + * Special case, access is always granted for root + */ + if (fsuser()) + return 1; + /* + * If no ACL, checks using the file mode + */ + else if (current->fsuid == inode->i_uid) + mode >>= 6; + else if (in_group_p (inode->i_gid)) + mode >>= 3; + if (((mode & mask & S_IRWXO) == mask)) + return 1; + else + return 0; +} |