| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifdef SUPPORT_ACLS |
| 23 |
|
| 24 |
#ifdef HAVE_SYS_ACL_H |
| 25 |
#include <sys/acl.h> |
| 26 |
#endif |
| 27 |
#ifdef HAVE_ACL_LIBACL_H |
| 28 |
#include <acl/libacl.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
#define SMB_MALLOC(cnt) new_array(char, cnt) |
| 32 |
#define SMB_MALLOC_P(obj) new_array(obj, 1) |
| 33 |
#define SMB_MALLOC_ARRAY(obj, cnt) new_array(obj, cnt) |
| 34 |
#define SMB_REALLOC(mem, cnt) realloc_array(mem, char, cnt) |
| 35 |
#define slprintf snprintf |
| 36 |
|
| 37 |
#if defined HAVE_POSIX_ACLS |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#define SMB_ACL_TAG_T acl_tag_t |
| 42 |
#define SMB_ACL_TYPE_T acl_type_t |
| 43 |
|
| 44 |
|
| 45 |
#define SMB_ACL_USER ACL_USER |
| 46 |
#define SMB_ACL_USER_OBJ ACL_USER_OBJ |
| 47 |
#define SMB_ACL_GROUP ACL_GROUP |
| 48 |
#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ |
| 49 |
#define SMB_ACL_OTHER ACL_OTHER |
| 50 |
#define SMB_ACL_MASK ACL_MASK |
| 51 |
|
| 52 |
#define SMB_ACL_T acl_t |
| 53 |
|
| 54 |
#define SMB_ACL_ENTRY_T acl_entry_t |
| 55 |
|
| 56 |
#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY |
| 57 |
#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY |
| 58 |
|
| 59 |
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS |
| 60 |
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT |
| 61 |
|
| 62 |
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) |
| 63 |
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) |
| 64 |
|
| 65 |
#define SMB_ACL_NEED_SORT |
| 66 |
|
| 67 |
#elif defined HAVE_TRU64_ACLS |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
#define SMB_ACL_TAG_T acl_tag_t |
| 72 |
#define SMB_ACL_TYPE_T acl_type_t |
| 73 |
|
| 74 |
|
| 75 |
#define SMB_ACL_USER ACL_USER |
| 76 |
#define SMB_ACL_USER_OBJ ACL_USER_OBJ |
| 77 |
#define SMB_ACL_GROUP ACL_GROUP |
| 78 |
#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ |
| 79 |
#define SMB_ACL_OTHER ACL_OTHER |
| 80 |
#define SMB_ACL_MASK ACL_MASK |
| 81 |
|
| 82 |
#define SMB_ACL_T acl_t |
| 83 |
|
| 84 |
#define SMB_ACL_ENTRY_T acl_entry_t |
| 85 |
|
| 86 |
#define SMB_ACL_FIRST_ENTRY 0 |
| 87 |
#define SMB_ACL_NEXT_ENTRY 1 |
| 88 |
|
| 89 |
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS |
| 90 |
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT |
| 91 |
|
| 92 |
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) |
| 93 |
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) |
| 94 |
|
| 95 |
#define SMB_ACL_NEED_SORT |
| 96 |
|
| 97 |
#elif defined HAVE_UNIXWARE_ACLS || defined HAVE_SOLARIS_ACLS |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
typedef int SMB_ACL_TAG_T; |
| 104 |
typedef int SMB_ACL_TYPE_T; |
| 105 |
|
| 106 |
|
| 107 |
#define SMB_ACL_USER USER |
| 108 |
#define SMB_ACL_USER_OBJ USER_OBJ |
| 109 |
#define SMB_ACL_GROUP GROUP |
| 110 |
#define SMB_ACL_GROUP_OBJ GROUP_OBJ |
| 111 |
#define SMB_ACL_OTHER OTHER_OBJ |
| 112 |
#define SMB_ACL_MASK CLASS_OBJ |
| 113 |
|
| 114 |
typedef struct SMB_ACL_T { |
| 115 |
int size; |
| 116 |
int count; |
| 117 |
int next; |
| 118 |
struct acl acl[1]; |
| 119 |
} *SMB_ACL_T; |
| 120 |
|
| 121 |
typedef struct acl *SMB_ACL_ENTRY_T; |
| 122 |
|
| 123 |
#define SMB_ACL_FIRST_ENTRY 0 |
| 124 |
#define SMB_ACL_NEXT_ENTRY 1 |
| 125 |
|
| 126 |
#define SMB_ACL_TYPE_ACCESS 0 |
| 127 |
#define SMB_ACL_TYPE_DEFAULT 1 |
| 128 |
|
| 129 |
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) |
| 130 |
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) |
| 131 |
|
| 132 |
#define SMB_ACL_NEED_SORT |
| 133 |
|
| 134 |
#ifdef __CYGWIN__ |
| 135 |
#define SMB_ACL_LOSES_SPECIAL_MODE_BITS |
| 136 |
#endif |
| 137 |
|
| 138 |
#elif defined HAVE_HPUX_ACLS |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
#ifndef __TANDEM |
| 143 |
#undef GROUP |
| 144 |
#endif |
| 145 |
#include <sys/aclv.h> |
| 146 |
|
| 147 |
|
| 148 |
typedef int SMB_ACL_TAG_T; |
| 149 |
typedef int SMB_ACL_TYPE_T; |
| 150 |
|
| 151 |
|
| 152 |
#define SMB_ACL_USER USER |
| 153 |
#define SMB_ACL_USER_OBJ USER_OBJ |
| 154 |
#define SMB_ACL_GROUP GROUP |
| 155 |
#define SMB_ACL_GROUP_OBJ GROUP_OBJ |
| 156 |
#define SMB_ACL_OTHER OTHER_OBJ |
| 157 |
#define SMB_ACL_MASK CLASS_OBJ |
| 158 |
|
| 159 |
typedef struct SMB_ACL_T { |
| 160 |
int size; |
| 161 |
int count; |
| 162 |
int next; |
| 163 |
struct acl acl[1]; |
| 164 |
} *SMB_ACL_T; |
| 165 |
|
| 166 |
typedef struct acl *SMB_ACL_ENTRY_T; |
| 167 |
|
| 168 |
#define SMB_ACL_FIRST_ENTRY 0 |
| 169 |
#define SMB_ACL_NEXT_ENTRY 1 |
| 170 |
|
| 171 |
#define SMB_ACL_TYPE_ACCESS 0 |
| 172 |
#define SMB_ACL_TYPE_DEFAULT 1 |
| 173 |
|
| 174 |
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) |
| 175 |
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) |
| 176 |
|
| 177 |
#define SMB_ACL_NEED_SORT |
| 178 |
|
| 179 |
#elif defined HAVE_IRIX_ACLS |
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
#define SMB_ACL_TAG_T acl_tag_t |
| 184 |
#define SMB_ACL_TYPE_T acl_type_t |
| 185 |
|
| 186 |
|
| 187 |
#define SMB_ACL_USER ACL_USER |
| 188 |
#define SMB_ACL_USER_OBJ ACL_USER_OBJ |
| 189 |
#define SMB_ACL_GROUP ACL_GROUP |
| 190 |
#define SMB_ACL_GROUP_OBJ ACL_GROUP_OBJ |
| 191 |
#define SMB_ACL_OTHER ACL_OTHER_OBJ |
| 192 |
#define SMB_ACL_MASK ACL_MASK |
| 193 |
|
| 194 |
typedef struct SMB_ACL_T { |
| 195 |
int next; |
| 196 |
BOOL freeaclp; |
| 197 |
struct acl *aclp; |
| 198 |
} *SMB_ACL_T; |
| 199 |
|
| 200 |
#define SMB_ACL_ENTRY_T acl_entry_t |
| 201 |
|
| 202 |
#define SMB_ACL_FIRST_ENTRY 0 |
| 203 |
#define SMB_ACL_NEXT_ENTRY 1 |
| 204 |
|
| 205 |
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_ACCESS |
| 206 |
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT |
| 207 |
|
| 208 |
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) |
| 209 |
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) |
| 210 |
|
| 211 |
#define SMB_ACL_NEED_SORT |
| 212 |
|
| 213 |
#elif defined HAVE_AIX_ACLS |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
#include "/usr/include/acl.h" |
| 218 |
|
| 219 |
struct acl_entry_link{ |
| 220 |
struct acl_entry_link *prevp; |
| 221 |
struct new_acl_entry *entryp; |
| 222 |
struct acl_entry_link *nextp; |
| 223 |
int count; |
| 224 |
}; |
| 225 |
|
| 226 |
struct new_acl_entry{ |
| 227 |
unsigned short ace_len; |
| 228 |
unsigned short ace_type; |
| 229 |
unsigned int ace_access; |
| 230 |
struct ace_id ace_id[1]; |
| 231 |
}; |
| 232 |
|
| 233 |
#define SMB_ACL_ENTRY_T struct new_acl_entry* |
| 234 |
#define SMB_ACL_T struct acl_entry_link* |
| 235 |
|
| 236 |
#define SMB_ACL_TAG_T unsigned short |
| 237 |
#define SMB_ACL_TYPE_T int |
| 238 |
|
| 239 |
|
| 240 |
#define SMB_ACL_USER ACEID_USER |
| 241 |
#define SMB_ACL_USER_OBJ 3 |
| 242 |
#define SMB_ACL_GROUP ACEID_GROUP |
| 243 |
#define SMB_ACL_GROUP_OBJ 4 |
| 244 |
#define SMB_ACL_OTHER 5 |
| 245 |
#define SMB_ACL_MASK 6 |
| 246 |
|
| 247 |
#define SMB_ACL_FIRST_ENTRY 1 |
| 248 |
#define SMB_ACL_NEXT_ENTRY 2 |
| 249 |
|
| 250 |
#define SMB_ACL_TYPE_ACCESS 0 |
| 251 |
#define SMB_ACL_TYPE_DEFAULT 1 |
| 252 |
|
| 253 |
#define SMB_ACL_VALID_NAME_BITS (4 | 2 | 1) |
| 254 |
#define SMB_ACL_VALID_OBJ_BITS (4 | 2 | 1) |
| 255 |
|
| 256 |
#define SMB_ACL_NEED_SORT |
| 257 |
|
| 258 |
#elif defined(HAVE_OSX_ACLS) |
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
#define SMB_ACL_TAG_T acl_tag_t |
| 263 |
#define SMB_ACL_TYPE_T acl_type_t |
| 264 |
|
| 265 |
#define SMB_ACL_T acl_t |
| 266 |
|
| 267 |
#define SMB_ACL_ENTRY_T acl_entry_t |
| 268 |
|
| 269 |
#define SMB_ACL_USER 1 |
| 270 |
#define SMB_ACL_GROUP 2 |
| 271 |
|
| 272 |
#define SMB_ACL_FIRST_ENTRY ACL_FIRST_ENTRY |
| 273 |
#define SMB_ACL_NEXT_ENTRY ACL_NEXT_ENTRY |
| 274 |
|
| 275 |
#define SMB_ACL_TYPE_ACCESS ACL_TYPE_EXTENDED |
| 276 |
#define SMB_ACL_TYPE_DEFAULT ACL_TYPE_DEFAULT |
| 277 |
|
| 278 |
#define SMB_ACL_VALID_NAME_BITS ((1<<25)-1) |
| 279 |
#define SMB_ACL_VALID_OBJ_BITS 0 |
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
#else |
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
#error Cannot handle ACLs on this platform! |
| 288 |
|
| 289 |
#endif |
| 290 |
|
| 291 |
int sys_acl_get_entry(SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p); |
| 292 |
int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); |
| 293 |
int sys_acl_get_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T *tag_type_p, uint32 *bits_p, id_t *u_g_id_p); |
| 294 |
SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type); |
| 295 |
SMB_ACL_T sys_acl_get_fd(int fd); |
| 296 |
SMB_ACL_T sys_acl_init(int count); |
| 297 |
int sys_acl_create_entry(SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry); |
| 298 |
int sys_acl_set_info(SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype, uint32 bits, id_t u_g_id); |
| 299 |
int sys_acl_set_access_bits(SMB_ACL_ENTRY_T entry, uint32 bits); |
| 300 |
int sys_acl_valid(SMB_ACL_T theacl); |
| 301 |
int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl); |
| 302 |
int sys_acl_set_fd(int fd, SMB_ACL_T theacl); |
| 303 |
int sys_acl_delete_def_file(const char *name); |
| 304 |
#ifdef HAVE_SOLARIS_ACLS |
| 305 |
SMB_ACL_T sys_acl_get_fd_type(int fd, SMB_ACL_TYPE_T type); |
| 306 |
int sys_acl_set_fd_type(int fd, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); |
| 307 |
int sys_acl_delete_def_fd(int fd); |
| 308 |
#endif |
| 309 |
int sys_acl_free_acl(SMB_ACL_T the_acl); |
| 310 |
int no_acl_syscall_error(int err); |
| 311 |
|
| 312 |
#ifdef HAVE_LIBACL_AT |
| 313 |
SMB_ACL_T sys_acl_get_file_at(int dirfd, const char *path_p, int at_flags, SMB_ACL_TYPE_T type); |
| 314 |
int sys_acl_set_file_at(int dirfd, const char *path_p, int at_flags, SMB_ACL_TYPE_T type, SMB_ACL_T theacl); |
| 315 |
int sys_acl_delete_def_file_at(int dirfd, const char *path_p, int at_flags); |
| 316 |
#endif |
| 317 |
|
| 318 |
#endif |