Patch to add UnixWare ACLs from Michael Davidson <md@sco.COM>. With some
[tprouty/samba.git] / source / lib / sysacls.c
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 2.2.
4    Samba system utilities for ACL support.
5    Copyright (C) Jeremy Allison 2000.
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "includes.h"
23
24 extern int DEBUGLEVEL;
25
26 /*
27  This file wraps all differing system ACL interfaces into a consistent
28  one based on the POSIX interface. It also returns the correct errors
29  for older UNIX systems that don't support ACLs.
30
31  The interfaces that each ACL implementation must support are as follows :
32
33  int sys_acl_get_entry( SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
34  int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
35  int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p
36  void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d)
37  SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
38  SMB_ACL_T sys_acl_get_fd(int fd)
39  int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset);
40  int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
41  char *sys_acl_to_text( SMB_ACL_T theacl, ssize_t *plen)
42  SMB_ACL_T sys_acl_init( int count)
43  int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
44  int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
45  int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual)
46  int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
47  int sys_acl_valid( SMB_ACL_T theacl )
48  int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
49  int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
50
51  This next one is not POSIX complient - but we *have* to have it !
52  More POSIX braindamage.
53
54  int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
55
56  The generic POSIX free is the following call. We split this into
57  several different free functions as we may need to add tag info
58  to structures when emulating the POSIX interface.
59
60  int sys_acl_free( void *obj_p)
61
62  The calls we actually use are :
63
64  int sys_acl_free_text(char *text) - free acl_to_text
65  int sys_acl_free_acl(SMB_ACL_T posix_acl)
66
67 */
68
69 #if defined(HAVE_POSIX_ACLS)
70
71 /* Identity mapping - easy. */
72
73 int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
74 {
75         return acl_get_entry( the_acl, entry_id, entry_p);
76 }
77
78 int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
79 {
80         return acl_get_tag_type( entry_d, tag_type_p);
81 }
82
83 int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
84 {
85         return acl_get_permset( entry_d, permset_p);
86 }
87
88 void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d)
89 {
90         return acl_get_qualifier( entry_d);
91 }
92
93 SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
94 {
95         return acl_get_file( path_p, type);
96 }
97
98 SMB_ACL_T sys_acl_get_fd(int fd)
99 {
100         return acl_get_fd(fd);
101 }
102
103 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset)
104 {
105         return acl_clear_perms(permset);
106 }
107
108 int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
109 {
110         return acl_add_perm(permset, perm);
111 }
112
113 int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
114 {
115         return acl_get_perm(permset, perm);
116 }
117
118 char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen)
119 {
120         return acl_to_text( the_acl, plen);
121 }
122
123 SMB_ACL_T sys_acl_init( int count)
124 {
125         return acl_init(count);
126 }
127
128 int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
129 {
130         return acl_create_entry(pacl, pentry);
131 }
132
133 int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
134 {
135         return acl_set_tag_type(entry, tagtype);
136 }
137
138 int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual)
139 {
140         return acl_set_qualifier(entry, qual);
141 }
142
143 int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
144 {
145         return acl_set_permset(entry, permset);
146 }
147
148 int sys_acl_valid( SMB_ACL_T theacl )
149 {
150         return acl_valid(theacl);
151 }
152
153 int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
154 {
155         return acl_set_file(name, acltype, theacl);
156 }
157
158 int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
159 {
160         return acl_set_fd(fd, theacl);
161 }
162
163 int sys_acl_free_text(char *text)
164 {
165         return acl_free(text);
166 }
167
168 int sys_acl_free_acl(SMB_ACL_T the_acl) 
169 {
170         return acl_free(the_acl);
171 }
172
173 #elif defined(HAVE_UNIXWARE_ACLS)
174
175 /*
176  * Donated by Michael Davidson <md@sco.COM> for UnixWare.
177  * As this is generic SVR4.x code, it may also work for Solaris !
178  */
179
180 #define INITIAL_ACL_SIZE        16
181 #ifndef SETACL
182 #define SETACL          ACL_SET
183 #endif
184
185 #ifndef GETACL
186 #define GETACL          ACL_GET
187 #endif
188
189 #ifndef GETACLCNT
190 #define GETACLCNT       ACL_CNT
191 #endif
192
193 #ifndef HAVE__FACL
194 /*
195  * until official facl() support shows up in UW 7.1.2
196  */
197 int facl(int fd, int cmd, int nentries, struct acl *aclbufp)
198 {
199         return syscall(188, fd, cmd, nentries, aclbufp);
200 }
201 #endif
202
203
204 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p)
205 {
206         if (entry_id != SMB_ACL_FIRST_ENTRY && entry_id != SMB_ACL_NEXT_ENTRY) {
207                 errno = EINVAL;
208                 return -1;
209         }
210
211         if (entry_p == NULL) {
212                 errno = EINVAL;
213                 return -1;
214         }
215
216         if (entry_id == SMB_ACL_FIRST_ENTRY) {
217                 acl_d->next = 0;
218         }
219
220         if (acl_d->next < 0) {
221                 errno = EINVAL;
222                 return -1;
223         }
224
225         if (acl_d->next >= acl_d->count) {
226                 return 0;
227         }
228
229         *entry_p = &acl_d->acl[acl_d->next++];
230
231         return 1;
232 }
233
234 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p)
235 {
236         *type_p = entry_d->a_type;
237
238         return 0;
239 }
240
241 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
242 {
243         *permset_p = &entry_d->a_perm;
244
245         return 0;
246 }
247
248 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d)
249 {
250         if (entry_d->a_type != SMB_ACL_USER
251             && entry_d->a_type != SMB_ACL_GROUP) {
252                 errno = EINVAL;
253                 return NULL;
254         }
255
256         return &entry_d->a_id;
257 }
258
259 SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
260 {
261         SMB_ACL_T       acl_d;
262         int             count;          /* # of ACL entries allocated   */
263         int             naccess;        /* # of access ACL entries      */
264         int             ndefault;       /* # of default ACL entries     */
265
266         if (type != SMB_ACL_TYPE_ACCESS && type != SMB_ACL_TYPE_DEFAULT) {
267                 errno = EINVAL;
268                 return NULL;
269         }
270
271         count = INITIAL_ACL_SIZE;
272         if ((acl_d = sys_acl_init(count)) == NULL) {
273                 return NULL;
274         }
275
276         while ((count = acl(path_p, GETACL, count, &acl_d->acl[0])) < 0
277             && errno == ENOSPC) {
278
279                 if ((count = acl(path_p, GETACLCNT, 0, NULL)) < 0) {
280                         return NULL;
281                 }
282
283                 sys_acl_free_acl(acl_d);
284
285                 if ((acl_d = sys_acl_init(count)) == NULL) {
286                         return NULL;
287                 }
288         }
289
290         if (count < 0) {
291                 return NULL;
292         }
293
294         /*
295          * calculate the number of access and default ACL entries
296          *
297          * Note: we assume that the acl() system call returned a
298          * well formed ACL which is sorted so that all of the
299          * access ACL entries preceed any default ACL entries
300          */
301         for (naccess = 0; naccess < count; naccess++) {
302                 if (acl_d->acl[naccess].a_type & ACL_DEFAULT)
303                         break;
304         }
305         ndefault = count - naccess;
306         
307         /*
308          * if the caller wants the default ACL we have to copy
309          * the entries down to the start of the acl[] buffer
310          * and mask out the ACL_DEFAULT flag from the type field
311          */
312         if (type == SMB_ACL_TYPE_DEFAULT) {
313                 int     i, j;
314
315                 for (i = 0, j = naccess; i < ndefault; i++, j++) {
316                         acl_d->acl[i] = acl_d->acl[j];
317                         acl_d->acl[i].a_type &= ~ACL_DEFAULT;
318                 }
319
320                 acl_d->count = ndefault;
321         } else {
322                 acl_d->count = naccess;
323         }
324
325         return acl_d;
326 }
327
328 SMB_ACL_T sys_acl_get_fd(int fd)
329 {
330         SMB_ACL_T       acl_d;
331         int             count;          /* # of ACL entries allocated   */
332         int             naccess;        /* # of access ACL entries      */
333
334         count = INITIAL_ACL_SIZE;
335         if ((acl_d = sys_acl_init(count)) == NULL) {
336                 return NULL;
337         }
338
339         while ((count = facl(fd, GETACL, count, &acl_d->acl[0])) < 0
340             && errno == ENOSPC) {
341
342                 if ((count = facl(fd, GETACLCNT, 0, NULL)) < 0) {
343                         return NULL;
344                 }
345
346                 sys_acl_free_acl(acl_d);
347
348                 if ((acl_d = sys_acl_init(count)) == NULL) {
349                         return NULL;
350                 }
351         }
352
353         if (count < 0) {
354                 return NULL;
355         }
356
357         /*
358          * calculate the number of access ACL entries
359          */
360         for (naccess = 0; naccess < count; naccess++) {
361                 if (acl_d->acl[naccess].a_type & ACL_DEFAULT)
362                         break;
363         }
364         
365         acl_d->count = naccess;
366
367         return acl_d;
368 }
369
370 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d)
371 {
372         *permset_d = 0;
373
374         return 0;
375 }
376
377 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm)
378 {
379         if (perm != SMB_ACL_READ && perm != SMB_ACL_WRITE
380             && perm != SMB_ACL_EXECUTE) {
381                 errno = EINVAL;
382                 return -1;
383         }
384
385         if (permset_d == NULL) {
386                 errno = EINVAL;
387                 return -1;
388         }
389
390         *permset_d |= perm;
391
392         return 0;
393 }
394
395 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm)
396 {
397         return *permset_d & perm;
398 }
399
400 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p)
401 {
402         int     i;
403         int     len, maxlen;
404         char    *text;
405
406         /*
407          * use an initial estimate of 20 bytes per ACL entry
408          * when allocating memory for the text representation
409          * of the ACL
410          */
411         len     = 0;
412         maxlen  = 20 * acl_d->count;
413         if ((text = malloc(maxlen)) == NULL) {
414                 errno = ENOMEM;
415                 return NULL;
416         }
417
418         for (i = 0; i < acl_d->count; i++) {
419                 struct acl      *ap     = &acl_d->acl[i];
420                 struct passwd   *pw;
421                 struct group    *gr;
422                 char            tagbuf[12];
423                 char            idbuf[12];
424                 char            *tag;
425                 char            *id     = "";
426                 char            perms[4];
427                 int             nbytes;
428
429                 switch (ap->a_type) {
430                         /*
431                          * for debugging purposes it's probably more
432                          * useful to dump unknown tag types rather
433                          * than just returning an error
434                          */
435                         default:
436                                 snprintf(tagbuf, sizeof tagbuf, "0x%x",
437                                         ap->a_type);
438                                 tag = tagbuf;
439                                 snprintf(idbuf, sizeof idbuf, "%ld",
440                                         (long)ap->a_id);
441                                 id = idbuf;
442                                 break;
443
444                         case SMB_ACL_USER:
445                                 if ((pw = getpwuid(ap->a_id)) == NULL) {
446                                         snprintf(idbuf, sizeof idbuf, "%ld",
447                                                 (long)ap->a_id);
448                                         id = idbuf;
449                                 } else {
450                                         id = pw->pw_name;
451                                 }
452                         case SMB_ACL_USER_OBJ:
453                                 tag = "user";
454                                 break;
455
456                         case SMB_ACL_GROUP:
457                                 if ((gr = getgrgid(ap->a_id)) == NULL) {
458                                         snprintf(idbuf, sizeof idbuf, "%ld",
459                                                 (long)ap->a_id);
460                                         id = idbuf;
461                                 } else {
462                                         id = gr->gr_name;
463                                 }
464                         case SMB_ACL_GROUP_OBJ:
465                                 tag = "group";
466                                 break;
467
468                         case SMB_ACL_OTHER:
469                                 tag = "other";
470                                 break;
471
472                         case SMB_ACL_MASK:
473                                 tag = "mask";
474                                 break;
475
476                 }
477
478                 perms[0] = (ap->a_perm & S_IRUSR) ? 'r' : '-';
479                 perms[1] = (ap->a_perm & S_IWUSR) ? 'w' : '-';
480                 perms[2] = (ap->a_perm & S_IXUSR) ? 'x' : '-';
481                 perms[3] = '\0';
482
483                 /*          <tag>      :  <qualifier>   :  rwx \n  \0 */
484                 nbytes = strlen(tag) + 1 + strlen(id) + 1 + 3 + 1 + 1;
485
486                 if ((len + nbytes) > maxlen) {
487                         /*
488                          * allocate enough additional memory for this
489                          * entry and an estimate of another 20 bytes
490                          * for each entry still to be processed
491                          */
492                         maxlen += nbytes + 20 * (acl_d->count - i);
493
494                         if ((text = realloc(text, maxlen)) == NULL) {
495                                 errno = ENOMEM;
496                                 return NULL;
497                         }
498                 }
499
500                 snprintf(&text[len], nbytes, "%s:%s:%s\n", tag, id, perms);
501                 len += nbytes - 1;
502         }
503
504         if (len_p)
505                 *len_p = len;
506
507         return text;
508 }
509
510 SMB_ACL_T sys_acl_init(int count)
511 {
512         SMB_ACL_T       a;
513
514         if (count < 0) {
515                 errno = EINVAL;
516                 return NULL;
517         }
518
519         /*
520          * note that since the definition of the structure pointed
521          * to by the SMB_ACL_T includes the first element of the
522          * acl[] array, this actually allocates an ACL with room
523          * for (count+1) entries
524          */
525         if ((a = malloc(sizeof(*a) + count * sizeof(struct acl))) == NULL) {
526                 errno = ENOMEM;
527                 return NULL;
528         }
529
530         a->size = count + 1;
531         a->count = 0;
532         a->next = -1;
533
534         return a;
535 }
536
537
538 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p)
539 {
540         SMB_ACL_T       acl_d;
541         SMB_ACL_ENTRY_T entry_d;
542
543         if (acl_p == NULL || entry_p == NULL || (acl_d = *acl_p) == NULL) {
544                 errno = EINVAL;
545                 return -1;
546         }
547
548         if (acl_d->count >= acl_d->size) {
549                 errno = ENOSPC;
550                 return -1;
551         }
552
553         entry_d         = &acl_d->acl[acl_d->count++];
554         entry_d->a_type = 0;
555         entry_d->a_id   = -1;
556         entry_d->a_perm = 0;
557         *entry_p        = entry_d;
558
559         return 0;
560 }
561
562 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type)
563 {
564         switch (tag_type) {
565                 case SMB_ACL_USER:
566                 case SMB_ACL_USER_OBJ:
567                 case SMB_ACL_GROUP:
568                 case SMB_ACL_GROUP_OBJ:
569                 case SMB_ACL_OTHER:
570                 case SMB_ACL_MASK:
571                         entry_d->a_type = tag_type;
572                         break;
573                 default:
574                         errno = EINVAL;
575                         return -1;
576         }
577
578         return 0;
579 }
580
581 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p)
582 {
583         if (entry_d->a_type != SMB_ACL_GROUP
584             && entry_d->a_type != SMB_ACL_USER) {
585                 errno = EINVAL;
586                 return -1;
587         }
588
589         entry_d->a_id = *((id_t *)qual_p);
590
591         return 0;
592 }
593
594 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d)
595 {
596         if (*permset_d & ~(SMB_ACL_READ|SMB_ACL_WRITE|SMB_ACL_EXECUTE)) {
597                 return EINVAL;
598         }
599
600         entry_d->a_perm = *permset_d;
601
602         return 0;
603 }
604
605 int sys_acl_valid(SMB_ACL_T acl_d)
606 {
607         if (aclsort(acl_d->count, 0, acl_d->acl) != 0) {
608                 errno = EINVAL;
609                 return -1;
610         }
611
612         return 0;
613 }
614
615 int sys_acl_set_file(char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
616 {
617         struct stat     s;
618         struct acl      *acl_p;
619         int             acl_count;
620         struct acl      *acl_buf        = NULL;
621         int             ret;
622
623         if (type != SMB_ACL_TYPE_ACCESS && type != SMB_ACL_TYPE_DEFAULT) {
624                 errno = EINVAL;
625                 return -1;
626         }
627
628         if (stat(name, &s) != 0) {
629                 return -1;
630         }
631
632         acl_p           = &acl_d->acl[0];
633         acl_count       = acl_d->count;
634
635         /*
636          * if it's a directory there is extra work to do
637          * since the acl() system call will replace both
638          * the access ACLs and the default ACLs (if any)
639          */
640         if (S_ISDIR(s.st_mode)) {
641                 SMB_ACL_T       acc_acl;
642                 SMB_ACL_T       def_acl;
643                 SMB_ACL_T       tmp_acl;
644                 int             i;
645
646                 if (type == SMB_ACL_TYPE_ACCESS) {
647                         acc_acl = acl_d;
648                         def_acl = 
649                         tmp_acl = sys_acl_get_file(name, SMB_ACL_TYPE_DEFAULT);
650
651                 } else {
652                         def_acl = acl_d;
653                         acc_acl = 
654                         tmp_acl = sys_acl_get_file(name, SMB_ACL_TYPE_ACCESS);
655                 }
656
657                 if (tmp_acl == NULL) {
658                         return -1;
659                 }
660
661                 /*
662                  * allocate a temporary buffer for the complete ACL
663                  */
664                 acl_count       = acc_acl->count + def_acl->count;
665                 acl_p           =
666                 acl_buf         = malloc(acl_count * sizeof(acl_buf[0]));
667
668                 if (acl_buf == NULL) {
669                         sys_acl_free_acl(tmp_acl);
670                         errno = ENOMEM;
671                         return -1;
672                 }
673
674                 /*
675                  * copy the access control and default entries into the buffer
676                  */
677                 memcpy(&acl_buf[0], &acc_acl->acl[0],
678                         acc_acl->count * sizeof(acl_buf[0]));
679
680                 memcpy(&acl_buf[acc_acl->count], &def_acl->acl[0],
681                         def_acl->count * sizeof(acl_buf[0]));
682
683                 /*
684                  * set the ACL_DEFAULT flag on the default entries
685                  */
686                 for (i = acc_acl->count; i < acl_count; i++) {
687                         acl_buf[i].a_type |= ACL_DEFAULT;
688                 }
689
690                 sys_acl_free_acl(tmp_acl);
691
692         } else if (type != SMB_ACL_TYPE_ACCESS) {
693                 errno = EINVAL;
694                 return -1;
695         }
696
697         if (aclsort(acl_count, 0, acl_p) != 0) {
698                 errno = EINVAL;
699                 ret = -1;
700         } else {
701                 ret = acl(name, SETACL, acl_count, acl_p);
702         }
703
704         if (acl_buf) {
705                 free(acl_buf);
706         }
707
708         return ret;
709 }
710
711 int sys_acl_set_fd(int fd, SMB_ACL_T acl_d)
712 {
713         if (aclsort(acl_d->count, 0, acl_d->acl) != 0) {
714                 errno = EINVAL;
715                 return -1;
716         }
717
718         return facl(fd, SETACL, acl_d->count, &acl_d->acl[0]);
719 }
720
721 int sys_acl_free_text(char *text)
722 {
723         free(text);
724         return 0;
725 }
726
727 int sys_acl_free_acl(SMB_ACL_T acl_d) 
728 {
729         free(acl_d);
730         return 0;
731 }
732 #elif defined(HAVE_SOLARIS_ACLS)
733
734 #elif defined(HAVE_IRIX_ACLS)
735
736 #else /* No ACLs. */
737
738 int sys_acl_get_entry( SMB_ACL_T the_acl, int entry_id, SMB_ACL_ENTRY_T *entry_p)
739 {
740         return -1;
741 }
742
743 int sys_acl_get_tag_type( SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p)
744 {
745         return -1;
746 }
747
748 int sys_acl_get_permset( SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p)
749 {
750         return -1;
751 }
752
753 void *sys_acl_get_qualifier( SMB_ACL_ENTRY_T entry_d)
754 {
755         return NULL;
756 }
757
758 SMB_ACL_T sys_acl_get_file( const char *path_p, SMB_ACL_TYPE_T type)
759 {
760         return (SMB_ACL_T)NULL;
761 }
762
763 SMB_ACL_T sys_acl_get_fd(int fd)
764 {
765         return (SMB_ACL_T)NULL;
766 }
767
768 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset)
769 {
770         return -1;
771 }
772
773 int sys_acl_add_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
774 {
775         return -1;
776 }
777
778 int sys_acl_get_perm( SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm)
779 {
780         return (permset & perm) ? 1 : 0;
781 }
782
783 char *sys_acl_to_text( SMB_ACL_T the_acl, ssize_t *plen)
784 {
785         return NULL;
786 }
787
788 int sys_acl_free_text(char *text)
789 {
790         return -1;
791 }
792
793 SMB_ACL_T sys_acl_init( int count)
794 {
795         return NULL;
796 }
797
798 int sys_acl_create_entry( SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry)
799 {
800         return -1;
801 }
802
803 int sys_acl_set_tag_type( SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype)
804 {
805         return -1;
806 }
807
808 int sys_acl_set_qualifier( SMB_ACL_ENTRY_T entry, void *qual)
809 {
810         return -1;
811 }
812
813 int sys_acl_set_permset( SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset)
814 {
815         return -1;
816 }
817
818 int sys_acl_valid( SMB_ACL_T theacl )
819 {
820         return -1;
821 }
822
823 int sys_acl_set_file( char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
824 {
825         return -1;
826 }
827
828 int sys_acl_set_fd( int fd, SMB_ACL_T theacl)
829 {
830         return -1;
831 }
832
833 int sys_acl_free_acl(SMB_ACL_T the_acl) 
834 {
835         return -1;
836 }
837 #endif /* No ACLs. */