| 18 | /* DEFINITIONS *************************************************************/ |
| 19 | |
| 20 | int Ext2CheckInodeAccess(PEXT2_VCB Vcb, struct inode *in, int attempt) |
| 21 | { |
| 22 | int granted = 0; |
| 23 | |
| 24 | uid_t uid = Vcb->uid; |
| 25 | gid_t gid = Vcb->gid; |
| 26 | |
| 27 | if (IsFlagOn(Vcb->Flags, VCB_USER_EIDS)) { |
| 28 | uid = Vcb->euid; |
| 29 | gid = Vcb->egid; |
| 30 | } |
| 31 | |
| 32 | if (!uid || uid == in->i_uid) { |
| 33 | /* grant all access for inode owner or root */ |
| 34 | granted = Ext2FileCanRead | Ext2FileCanWrite | Ext2FileCanExecute; |
| 35 | } else if (gid == in->i_gid) { |
| 36 | if (Ext2IsGroupReadOnly(in->i_mode)) |
| 37 | granted = Ext2FileCanRead | Ext2FileCanExecute; |
| 38 | else if (Ext2IsGroupWritable(in->i_mode)) |
| 39 | granted = Ext2FileCanRead | Ext2FileCanWrite | Ext2FileCanExecute; |
| 40 | } else { |
| 41 | if (Ext2IsOtherReadOnly(in->i_mode)) |
| 42 | granted = Ext2FileCanRead | Ext2FileCanExecute; |
| 43 | else if (Ext2IsOtherWritable(in->i_mode)) |
| 44 | granted = Ext2FileCanRead | Ext2FileCanWrite | Ext2FileCanExecute; |
| 45 | |
| 46 | } |
| 47 | |
| 48 | return IsFlagOn(granted, attempt); |
| 49 | } |
| 50 | |
| 51 | int Ext2CheckFileAccess(PEXT2_VCB Vcb, PEXT2_MCB Mcb, int attempt) |
| 52 | { |
no outgoing calls
no test coverage detected