9 tVFS_ACL gVFS_ACL_EveryoneRWX = { {0,-1}, {0,VFS_PERM_ALL} };
10 tVFS_ACL gVFS_ACL_EveryoneRW = { {0,-1}, {0,VFS_PERM_ALL^VFS_PERM_EXECUTE} };
11 tVFS_ACL gVFS_ACL_EveryoneRX = { {0,-1}, {0,VFS_PERM_READ|VFS_PERM_EXECUTE} };
12 tVFS_ACL gVFS_ACL_EveryoneRO = { {0,-1}, {0,VFS_PERM_READ} };
16 * \fn int VFS_CheckACL(tVFS_Node *Node, Uint Permissions)
17 * \brief Checks the permissions on a file
19 int VFS_CheckACL(tVFS_Node *Node, Uint Permissions)
22 int uid = Threads_GetUID();
23 int gid = Threads_GetGID();
25 // Root can do anything
26 if(uid == 0) return 1;
28 // Root only file?, fast return
29 if( Node->NumACLs == 0 ) return 0;
31 // Check Deny Permissions
32 for(i=0;i<Node->NumACLs;i++)
34 if(!Node->ACLs[i].Inv) continue; // Ignore ALLOWs
35 if(Node->ACLs[i].ID != -1)
37 if(!Node->ACLs[i].Group && Node->ACLs[i].ID != uid) continue;
38 if(Node->ACLs[i].Group && Node->ACLs[i].ID != gid) continue;
41 if(Node->ACLs[i].Perms & Permissions) return 0;
44 // Check for allow permissions
45 for(i=0;i<Node->NumACLs;i++)
47 if(Node->ACLs[i].Inv) continue; // Ignore DENYs
48 if(Node->ACLs[i].ID != -1)
50 if(!Node->ACLs[i].Group && Node->ACLs[i].ID != uid) continue;
51 if(Node->ACLs[i].Group && Node->ACLs[i].ID != gid) continue;
54 if((Node->ACLs[i].Perms & Permissions) == Permissions) return 1;