root/fs/ext2/acl.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ext2_permission

   1 /*
   2  * linux/fs/ext2/acl.c
   3  *
   4  * Copyright (C) 1993  Remy Card (card@masi.ibp.fr)
   5  */
   6 
   7 /*
   8  * This file will contain the Access Control Lists management for the
   9  * second extended file system.
  10  */
  11 
  12 #include <linux/errno.h>
  13 #include <linux/fs.h>
  14 #include <linux/ext2_fs.h>
  15 #include <linux/kernel.h>
  16 #include <linux/sched.h>
  17 #include <linux/stat.h>
  18 
  19 /*
  20  * ext2_permission ()
  21  *
  22  * Check for access rights
  23  */
  24 int ext2_permission (struct inode * inode, int mask)
     /* [previous][next][first][last][top][bottom][index][help] */
  25 {
  26         unsigned short mode = inode->i_mode;
  27 
  28         /* Special case, access is always granted for root */
  29         if (suser ())
  30                 return 1;
  31         /* If no ACL, checks using the file mode */
  32         else if (current->euid == inode->i_uid)
  33                 mode >>= 6;
  34         else if (in_group_p (inode->i_gid))
  35                 mode >>= 3;
  36         if (((mode & mask & S_IRWXO) == mask))
  37                 return 1;
  38         else
  39                 return 0;
  40 }

/* [previous][next][first][last][top][bottom][index][help] */