Coda File System

acl length - revisited

From: Jan Kopriva <vasquez_at_jikos.cz>
Date: Fri, 15 Apr 2005 18:12:33 +0200
Hi again,

I looked again to the cfs.cc and performed some tests. I realized that 
2KB buffer is
actually enough to hold 20 ACL entries. Also if you create an ACL longer 
than
20 entries it is rejected by Vice and not by the kernel as I previously 
thought.
The thing is that Vice has  AL_MAXEXTENTRIES constant set to 20. This 
enforces the
limit.

The user after creating more than 20 entries in the ACL obtains 
following message:
.: Invalid argument

which does not say anything about the problem. So, I have made a patch 
to cfs.cc that
forces the cfs process to tell the user that he/she execeeds the limit 
of an ACL and that also after each
ACL listing, provides its length.

It counts with AL_MAXEXTENTRIES constant, thus if anyone changes it at 
Vice source,
he should keep in mind the Venus limit (1000 entries) and kernel 2KB 
limit. Patch does
not check if AL_MAXEXTENTRIES follows the limitations above.

The patch is attached to this message.

Regards

Jan

--- cfs.cc	2005-04-15 17:50:06.000000000 +0200
+++ cfs.cc.orig	2005-04-15 17:43:55.000000000 +0200
@@ -4,7 +4,7 @@
                               Release 6
 
           Copyright (c) 1987-2003 Carnegie Mellon University
-                  Additionalcopyrights listed below
+                  Additional copyrights listed below
 
 This  code  is  distributed "AS IS" without warranty of any kind under
 the terms of the GNU General Public Licence Version 2, as shown in the
@@ -38,8 +38,6 @@
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <sys/types.h>
-#include <prs.h>
-#include <al.h>
 #ifdef  __linux__
 #if defined(__GLIBC__) && __GLIBC__ >= 2
 #include <dirent.h>
@@ -1436,7 +1434,6 @@
             printf(" -%-8s\n", rightsbuf); /* rights */ 
             }
         }
-    printf("ACL length: %d entries\n", a.pluscount + a.minuscount);
     }
 
 static int parseacl(char *s, struct acl *a)
@@ -1939,7 +1936,7 @@
             else
 		PERROR("realpath");
 	    continue;
-        }
+	}
 
         /* there must be a slash in what myrealpath() returns */
         s = rindex(path, '/');
@@ -2238,13 +2235,6 @@
 EntryDone:
         i += 2;  /* point to next (id,rights) pair */
         }
-
-    /* First check if we do not exceed the ACL length */
-    if (a.pluscount + a.minuscount > AL_MAXEXTENTRIES) {
-        printf("Cannot create longer ACL. Max length is: %d entries\n",
-               AL_MAXEXTENTRIES);
-        exit(-1);
-    }
     
     /* Construct string encoding of ACL */
 
@@ -2252,7 +2242,8 @@
     nzcount = 0;
     for (i = 0; i < a.pluscount; i++)
         {if (a.plusentries[i].rights != 0) nzcount++;}
-    sprintf(piobuf, "%d\n", nzcount);    
+    sprintf(piobuf, "%d\n", nzcount);
+
     nzcount = 0;
     for (i = 0; i < a.minuscount; i++)
         {if (a.minusentries[i].rights != 0) nzcount++;}
@@ -2270,7 +2261,7 @@
         if (a.minusentries[i].rights != 0)
             sprintf(&piobuf[strlen(piobuf)], "%s %d\n", a.minusentries[i].id, a.minusentries[i].rights);
         }
-    
+
     /* Set new acl */
     vio.in = piobuf;
     vio.in_size = (int) strlen(piobuf) + 1;
Received on 2005-04-15 12:13:55