Changed back to lottery scheduler, disabled debug
[tpg/acess2.git] / Kernel / vfs / acls.c
index 51cf65b..ab88b98 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Acess Micro VFS
  */
-#include <common.h>
+#include <acess.h>
 #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, uid=%i", Node, uid);
+               return 0;
+       }
        
        // Check Deny Permissions
        for(i=0;i<Node->NumACLs;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;i<Node->NumACLs;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;
 }
 /**
@@ -126,7 +138,7 @@ tVFS_ACL *VFS_UnixToAcessACL(Uint Mode, Uint Owner, Uint Group)
        if(Mode & 0010) ret[1].Perms |= VFS_PERM_EXECUTE;
        
        // Global
-       ret[2].Group = 1;       ret[2].ID = Group;
+       ret[2].Group = 1;       ret[2].ID = -1;
        ret[2].Inv = 0;         ret[2].Perms = 0;
        if(Mode & 0004) ret[2].Perms |= VFS_PERM_READ;
        if(Mode & 0002) ret[2].Perms |= VFS_PERM_WRITE;

UCC git Repository :: git.ucc.asn.au