OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsd/fs_acl.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 #ifndef AFS_FS_ACL_H
00011 #define AFS_FS_ACL_H
00012 
00013 #define ACL_MAXNAME 100
00014 
00015 
00016 /*
00017  * Character to use between name and rights in printed representation for
00018  * DFS ACL's.
00019  */
00020 #define DFS_SEPARATOR   ' '
00021 
00022 typedef char sec_rgy_name_t[1025];      /* A DCE definition */
00023 
00024 struct Acl {
00025     int dfs;            /* Originally true if a dfs acl; now also the type
00026                          * of the acl (1, 2, or 3, corresponding to object,
00027                          * initial dir, or initial object). */
00028     sec_rgy_name_t cell; /* DFS cell name */
00029     int nplus;
00030     int nminus;
00031     struct AclEntry *pluslist;
00032     struct AclEntry *minuslist;
00033 };
00034 
00035 struct AclEntry {
00036     struct AclEntry *next;
00037     char name[ACL_MAXNAME];
00038     afs_int32 rights;
00039 };
00040 
00041 /*
00042  * Mods for the AFS/DFS protocol translator.
00043  *
00044  * DFS rights. It's ugly to put these definitions here, but they
00045  * *cannot* change, because they're part of the wire protocol.
00046  * In any event, the protocol translator will guarantee these
00047  * assignments for AFS cache managers.
00048  */
00049 #define DFS_READ          0x01
00050 #define DFS_WRITE         0x02
00051 #define DFS_EXECUTE       0x04
00052 #define DFS_CONTROL       0x08
00053 #define DFS_INSERT        0x10
00054 #define DFS_DELETE        0x20
00055 
00056 /* the application definable ones (backwards from AFS) */
00057 #define DFS_USR0 0x80000000      /* "A" bit */
00058 #define DFS_USR1 0x40000000      /* "B" bit */
00059 #define DFS_USR2 0x20000000      /* "C" bit */
00060 #define DFS_USR3 0x10000000      /* "D" bit */
00061 #define DFS_USR4 0x08000000      /* "E" bit */
00062 #define DFS_USR5 0x04000000      /* "F" bit */
00063 #define DFS_USR6 0x02000000      /* "G" bit */
00064 #define DFS_USR7 0x01000000      /* "H" bit */
00065 #define DFS_USRALL      (DFS_USR0 | DFS_USR1 | DFS_USR2 | DFS_USR3 |\
00066                          DFS_USR4 | DFS_USR5 | DFS_USR6 | DFS_USR7)
00067 
00068 /* added relative add resp. delete    */
00069 /* (so old add really means to set)   */
00070 enum rtype { add, destroy, deny, reladd, reldel };
00071 
00072 extern void ZapList(struct AclEntry *alist);
00073 
00074 extern void ZapAcl(struct Acl *acl);
00075 
00076 extern int PruneList(struct AclEntry **ae, int dfs);
00077 
00078 extern int CleanAcl(struct Acl *aa, char *cellname);
00079 
00080 extern struct Acl *EmptyAcl(char *astr);
00081 
00082 extern struct Acl *ParseAcl (char *astr, int astr_size);
00083 
00084 extern char *AclToString(struct Acl *acl);
00085 
00086 extern void ChangeList (struct Acl *al, afs_int32 plus, char *aname,
00087                         afs_int32 arights, enum rtype *artypep);
00088 
00089 extern struct AclEntry *FindList (struct AclEntry *alist, char *aname);
00090 
00091 
00092 #endif
 All Data Structures Files Functions Variables