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

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