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/sched.h>
  13 #include <linux/ext2_fs.h>
  14 #include <linux/errno.h>
  15 
  16 /*
  17  * ext2_permission ()
  18  *
  19  * Check for access rights
  20  */
  21 int ext2_permission (struct inode * inode, int mask)
     /* [previous][next][first][last][top][bottom][index][help] */
  22 {
  23         int mode = inode->i_mode;
  24 
  25         /* Special case, access is always granted for root */
  26         if (suser ())
  27                 return 1;
  28         /* If no ACL, checks using the file mode */
  29         else if (current->euid == inode->i_uid)
  30                 mode >>= 6;
  31         else if (in_group_p (inode->i_gid))
  32                 mode >>= 3;
  33         if (((mode & mask & 0007) == mask))
  34                 return 1;
  35         else
  36                 return 0;
  37 }

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