X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fvfs%2Facls.c;h=4a65be690440cad615a1b1c05c47acc494911a5b;hb=156885e938b60fee9d061d989ae7711c9aeea493;hp=51cf65b4b9a8132cbea4d0f9051a826f7fc87a61;hpb=77ed20ce9d7e25654215980d0f89e63b8dd366f0;p=tpg%2Facess2.git diff --git a/Kernel/vfs/acls.c b/Kernel/vfs/acls.c index 51cf65b4..4a65be69 100644 --- a/Kernel/vfs/acls.c +++ b/Kernel/vfs/acls.c @@ -1,7 +1,7 @@ /* * Acess Micro VFS */ -#include +#include #include "vfs.h" #include "vfs_int.h" @@ -26,34 +26,46 @@ int VFS_CheckACL(tVFS_Node *Node, Uint Permissions) if(uid == 0) return 1; // Root only file?, fast return - if( Node->NumACLs == 0 ) return 0; + if( Node->NumACLs == 0 ) { + Log("VFS_CheckACL - %p inaccesable, NumACLs = 0", Node); + return 0; + } // Check Deny Permissions for(i=0;iNumACLs;i++) { if(!Node->ACLs[i].Inv) continue; // Ignore ALLOWs - if(Node->ACLs[i].ID != -1) + if(Node->ACLs[i].ID != 0x7FFFFFFF) { if(!Node->ACLs[i].Group && Node->ACLs[i].ID != uid) continue; if(Node->ACLs[i].Group && Node->ACLs[i].ID != gid) continue; } - if(Node->ACLs[i].Perms & Permissions) return 0; + //Log("Deny %x", Node->ACLs[i].Perms); + + if(Node->ACLs[i].Perms & Permissions) { + Log("VFS_CheckACL - %p inaccesable, %x denied", + Node, Node->ACLs[i].Perms & Permissions); + return 0; + } } // Check for allow permissions for(i=0;iNumACLs;i++) { if(Node->ACLs[i].Inv) continue; // Ignore DENYs - if(Node->ACLs[i].ID != -1) + if(Node->ACLs[i].ID != 0x7FFFFFFF) { if(!Node->ACLs[i].Group && Node->ACLs[i].ID != uid) continue; if(Node->ACLs[i].Group && Node->ACLs[i].ID != gid) continue; } + //Log("Allow %x", Node->ACLs[i].Perms); + if((Node->ACLs[i].Perms & Permissions) == Permissions) return 1; } + Log("VFS_CheckACL - %p inaccesable, %x not allowed", Node, Permissions); return 0; } /**