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

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