2 $Id: acls.h,v 1.3 2009-11-20 17:45:47 franklahm Exp $
3 Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
20 #include <atalk/uuid.h> /* for uuid_t */
23 * This is what Apple says about ACL flags in sys/kauth.h:
25 * <Apple> The low 16 bits of the flags field are reserved for filesystem
26 * internal use and must be preserved by all APIs. This includes
27 * round-tripping flags through user-space interfaces.
28 * The high 16 bits of the flags are used to store attributes and
29 * to request specific handling of the ACL. </Apple>
31 * The constants are included for reference. We DONT expect them on
32 * the wire! We will ignore and spoil em.
35 /* Some stuff for the handling of NFSv4 ACLs */
36 #define ACE_TRIVIAL (ACE_OWNER | ACE_GROUP | ACE_EVERYONE)
38 /* FPGet|Set Bitmap */
40 kFileSec_UUID = (1<<0),
41 kFileSec_GRPUUID = (1<<1),
42 kFileSec_ACL = (1<<2),
43 kFileSec_REMOVEACL = (1<<3),
44 kFileSec_Inherit = (1<<4)
48 #define DARWIN_ACL_FLAGS_PRIVATE (0xffff)
49 /* inheritance will be deferred until the first rename operation */
50 #define KAUTH_ACL_DEFER_INHERIT (1<<16)
51 /* this ACL must not be overwritten as part of an inheritance operation */
52 #define KAUTH_ACL_NO_INHERIT (1<<17)
55 #define DARWIN_ACE_FLAGS_KINDMASK 0xf
56 #define DARWIN_ACE_FLAGS_PERMIT (1<<0)
57 #define DARWIN_ACE_FLAGS_DENY (1<<1)
58 #define DARWIN_ACE_FLAGS_INHERITED (1<<4)
59 #define DARWIN_ACE_FLAGS_FILE_INHERIT (1<<5)
60 #define DARWIN_ACE_FLAGS_DIRECTORY_INHERIT (1<<6)
61 #define DARWIN_ACE_FLAGS_LIMIT_INHERIT (1<<7)
62 #define DARWIN_ACE_FLAGS_ONLY_INHERIT (1<<8)
64 /* All flag bits controlling ACE inheritance */
65 #define DARWIN_ACE_INHERIT_CONTROL_FLAGS \
66 (DARWIN_ACE_FLAGS_FILE_INHERIT |\
67 DARWIN_ACE_FLAGS_DIRECTORY_INHERIT |\
68 DARWIN_ACE_FLAGS_LIMIT_INHERIT |\
69 DARWIN_ACE_FLAGS_ONLY_INHERIT)
72 #define DARWIN_ACE_READ_DATA 0x00000002
73 #define DARWIN_ACE_LIST_DIRECTORY 0x00000002
74 #define DARWIN_ACE_WRITE_DATA 0x00000004
75 #define DARWIN_ACE_ADD_FILE 0x00000004
76 #define DARWIN_ACE_EXECUTE 0x00000008
77 #define DARWIN_ACE_SEARCH 0x00000008
78 #define DARWIN_ACE_DELETE 0x00000010
79 #define DARWIN_ACE_APPEND_DATA 0x00000020
80 #define DARWIN_ACE_ADD_SUBDIRECTORY 0x00000020
81 #define DARWIN_ACE_DELETE_CHILD 0x00000040
82 #define DARWIN_ACE_READ_ATTRIBUTES 0x00000080
83 #define DARWIN_ACE_WRITE_ATTRIBUTES 0x00000100
84 #define DARWIN_ACE_READ_EXTATTRIBUTES 0x00000200
85 #define DARWIN_ACE_WRITE_EXTATTRIBUTES 0x00000400
86 #define DARWIN_ACE_READ_SECURITY 0x00000800
87 #define DARWIN_ACE_WRITE_SECURITY 0x00001000
88 #define DARWIN_ACE_TAKE_OWNERSHIP 0x00002000
90 /* Access Control List Entry (ACE) */
92 uuid_t darwin_ace_uuid;
93 uint32_t darwin_ace_flags;
94 uint32_t darwin_ace_rights;
97 /* Access Control List */
99 uint32_t darwin_acl_count;
100 uint32_t darwin_acl_flags;
101 } darwin_acl_header_t;
104 int afp_access (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen);
105 int afp_getacl (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen);
106 int afp_setacl (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen);
108 /* Parse afp_ldap.conf */
109 extern int acl_ldap_readconfig(char *name);