2 Unix SMB/Netbios implementation.
3 VFS module to get and set Solaris ACLs
4 Copyright (C) Michael Adam 2006,2008
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "system/filesys.h"
23 #include "smbd/smbd.h"
24 #include "modules/vfs_solarisacl.h"
26 /* typedef struct acl SOLARIS_ACE_T; */
27 typedef aclent_t SOLARIS_ACE_T
;
28 typedef aclent_t
*SOLARIS_ACL_T
;
29 typedef int SOLARIS_ACL_TAG_T
; /* the type of an ACL entry */
30 typedef o_mode_t SOLARIS_PERM_T
;
32 /* for convenience: check if solaris acl entry is a default entry? */
33 #define _IS_DEFAULT(ace) ((ace).a_type & ACL_DEFAULT)
34 #define _IS_OF_TYPE(ace, type) ( \
35 (((type) == SMB_ACL_TYPE_ACCESS) && !_IS_DEFAULT(ace)) \
37 (((type) == SMB_ACL_TYPE_DEFAULT) && _IS_DEFAULT(ace)) \
41 /* prototypes for private functions */
43 static SOLARIS_ACL_T
solaris_acl_init(int count
);
44 static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl
,
45 SOLARIS_ACL_T
*solariacl
, int *count
,
47 static SMB_ACL_T
solaris_acl_to_smb_acl(SOLARIS_ACL_T solarisacl
, int count
,
48 SMB_ACL_TYPE_T type
, TALLOC_CTX
*mem_ctx
);
49 static SOLARIS_ACL_TAG_T
smb_tag_to_solaris_tag(SMB_ACL_TAG_T smb_tag
);
50 static SMB_ACL_TAG_T
solaris_tag_to_smb_tag(SOLARIS_ACL_TAG_T solaris_tag
);
51 static bool solaris_add_to_acl(SOLARIS_ACL_T
*solaris_acl
, int *count
,
52 SOLARIS_ACL_T add_acl
, int add_count
, SMB_ACL_TYPE_T type
);
53 static bool solaris_acl_get_file(const char *name
, SOLARIS_ACL_T
*solarisacl
,
55 static bool solaris_acl_get_fd(int fd
, SOLARIS_ACL_T
*solarisacl
, int *count
);
56 static bool solaris_acl_sort(SOLARIS_ACL_T theacl
, int count
);
57 static SMB_ACL_PERM_T
solaris_perm_to_smb_perm(const SOLARIS_PERM_T perm
);
58 static SOLARIS_PERM_T
smb_perm_to_solaris_perm(const SMB_ACL_PERM_T perm
);
60 static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl
, int count
);
63 /* public functions - the api */
65 SMB_ACL_T
solarisacl_sys_acl_get_file(vfs_handle_struct
*handle
,
66 const struct smb_filename
*smb_fname
,
70 SMB_ACL_T result
= NULL
;
72 SOLARIS_ACL_T solaris_acl
= NULL
;
73 const char *path_p
= smb_fname
->base_name
;
75 DEBUG(10, ("solarisacl_sys_acl_get_file called for file '%s'.\n",
78 if (type
!= SMB_ACL_TYPE_ACCESS
&& type
!= SMB_ACL_TYPE_DEFAULT
) {
79 DEBUG(10, ("invalid SMB_ACL_TYPE given (%d)\n", type
));
84 DEBUGADD(10, ("getting %s acl\n",
85 ((type
== SMB_ACL_TYPE_ACCESS
) ? "access" : "default")));
87 if (!solaris_acl_get_file(path_p
, &solaris_acl
, &count
)) {
90 result
= solaris_acl_to_smb_acl(solaris_acl
, count
, type
, mem_ctx
);
92 DEBUG(10, ("conversion solaris_acl -> smb_acl failed (%s).\n",
97 DEBUG(10, ("solarisacl_sys_acl_get_file %s.\n",
98 ((result
== NULL
) ? "failed" : "succeeded" )));
99 SAFE_FREE(solaris_acl
);
105 * get the access ACL of a file referred to by a fd
107 SMB_ACL_T
solarisacl_sys_acl_get_fd(vfs_handle_struct
*handle
,
108 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
110 SMB_ACL_T result
= NULL
;
112 SOLARIS_ACL_T solaris_acl
= NULL
;
114 DEBUG(10, ("entering solarisacl_sys_acl_get_fd.\n"));
116 if (!solaris_acl_get_fd(fsp
->fh
->fd
, &solaris_acl
, &count
)) {
120 * The facl call returns both ACCESS and DEFAULT acls (as present).
121 * The posix acl_get_fd function returns only the
122 * access acl. So we need to filter this out here.
124 result
= solaris_acl_to_smb_acl(solaris_acl
, count
,
125 SMB_ACL_TYPE_ACCESS
, mem_ctx
);
126 if (result
== NULL
) {
127 DEBUG(10, ("conversion solaris_acl -> smb_acl failed (%s).\n",
132 DEBUG(10, ("solarisacl_sys_acl_get_fd %s.\n",
133 ((result
== NULL
) ? "failed" : "succeeded")));
134 SAFE_FREE(solaris_acl
);
138 int solarisacl_sys_acl_set_file(vfs_handle_struct
*handle
,
139 const struct smb_filename
*smb_fname_in
,
144 SOLARIS_ACL_T solaris_acl
= NULL
;
146 struct smb_filename
*smb_fname
= NULL
;
148 smb_fname
= cp_smb_filename_nostream(talloc_tos(), smb_fname_in
);
149 if (smb_fname
== NULL
) {
154 DEBUG(10, ("solarisacl_sys_acl_set_file called for file '%s'\n",
155 smb_fname
->base_name
));
157 if ((type
!= SMB_ACL_TYPE_ACCESS
) && (type
!= SMB_ACL_TYPE_DEFAULT
)) {
159 DEBUG(10, ("invalid smb acl type given (%d).\n", type
));
162 DEBUGADD(10, ("setting %s acl\n",
163 ((type
== SMB_ACL_TYPE_ACCESS
) ? "access" : "default")));
165 if(!smb_acl_to_solaris_acl(theacl
, &solaris_acl
, &count
, type
)) {
166 DEBUG(10, ("conversion smb_acl -> solaris_acl failed (%s).\n",
172 * if the file is a directory, there is extra work to do:
173 * since the solaris acl call stores both the access acl and
174 * the default acl as provided, we have to get the acl part
175 * that has not been specified in "type" from the file first
176 * and concatenate it with the acl provided.
178 * We can directly use SMB_VFS_STAT here, as if this was a
179 * POSIX call on a symlink, we've already refused it.
180 * For a Windows acl mapped call on a symlink, we want to follow
183 ret
= SMB_VFS_STAT(handle
->conn
, smb_fname
);
185 DEBUG(10, ("Error in stat call: %s\n", strerror(errno
)));
188 if (S_ISDIR(smb_fname
->st
.st_ex_mode
)) {
189 SOLARIS_ACL_T other_acl
= NULL
;
191 SMB_ACL_TYPE_T other_type
;
193 other_type
= (type
== SMB_ACL_TYPE_ACCESS
)
194 ? SMB_ACL_TYPE_DEFAULT
195 : SMB_ACL_TYPE_ACCESS
;
196 DEBUGADD(10, ("getting acl from filesystem\n"));
197 if (!solaris_acl_get_file(smb_fname
->base_name
,
198 &other_acl
, &other_count
)) {
199 DEBUG(10, ("error getting acl from directory\n"));
202 DEBUG(10, ("adding %s part of fs acl to given acl\n",
203 ((other_type
== SMB_ACL_TYPE_ACCESS
)
206 if (!solaris_add_to_acl(&solaris_acl
, &count
, other_acl
,
207 other_count
, other_type
))
209 DEBUG(10, ("error adding other acl.\n"));
210 SAFE_FREE(other_acl
);
213 SAFE_FREE(other_acl
);
215 else if (type
!= SMB_ACL_TYPE_ACCESS
) {
220 if (!solaris_acl_sort(solaris_acl
, count
)) {
221 DEBUG(10, ("resulting acl is not valid!\n"));
225 ret
= acl(smb_fname
->base_name
, SETACL
, count
, solaris_acl
);
228 DEBUG(10, ("solarisacl_sys_acl_set_file %s.\n",
229 ((ret
!= 0) ? "failed" : "succeeded")));
230 SAFE_FREE(solaris_acl
);
231 TALLOC_FREE(smb_fname
);
236 * set the access ACL on the file referred to by a fd
238 int solarisacl_sys_acl_set_fd(vfs_handle_struct
*handle
,
242 SOLARIS_ACL_T solaris_acl
= NULL
;
243 SOLARIS_ACL_T default_acl
= NULL
;
244 int count
, default_count
;
247 DEBUG(10, ("entering solarisacl_sys_acl_set_fd\n"));
250 * the posix acl_set_fd call sets the access acl of the
251 * file referred to by fd. the solaris facl-SETACL call
252 * sets the access and default acl as provided, so we
253 * have to retrieve the default acl of the file and
254 * concatenate it with the access acl provided.
256 if (!smb_acl_to_solaris_acl(theacl
, &solaris_acl
, &count
,
257 SMB_ACL_TYPE_ACCESS
))
259 DEBUG(10, ("conversion smb_acl -> solaris_acl failed (%s).\n",
263 if (!solaris_acl_get_fd(fsp
->fh
->fd
, &default_acl
, &default_count
)) {
264 DEBUG(10, ("error getting (default) acl from fd\n"));
267 if (!solaris_add_to_acl(&solaris_acl
, &count
,
268 default_acl
, default_count
,
269 SMB_ACL_TYPE_DEFAULT
))
271 DEBUG(10, ("error adding default acl to solaris acl\n"));
274 if (!solaris_acl_sort(solaris_acl
, count
)) {
275 DEBUG(10, ("resulting acl is not valid!\n"));
279 ret
= facl(fsp
->fh
->fd
, SETACL
, count
, solaris_acl
);
281 DEBUG(10, ("call of facl failed (%s).\n", strerror(errno
)));
285 DEBUG(10, ("solarisacl_sys_acl_set_fd %s.\n",
286 ((ret
== 0) ? "succeeded" : "failed" )));
287 SAFE_FREE(solaris_acl
);
288 SAFE_FREE(default_acl
);
293 * delete the default ACL of a directory
295 * This is achieved by fetching the access ACL and rewriting it
296 * directly, via the solaris system call: the SETACL call on
297 * directories writes both the access and the default ACL as provided.
299 * XXX: posix acl_delete_def_file returns an error if
300 * the file referred to by path is not a directory.
301 * this function does not complain but the actions
302 * have no effect on a file other than a directory.
303 * But sys_acl_delete_default_file is only called in
304 * smbd/posixacls.c after having checked that the file
305 * is a directory, anyways. So implementing the extra
306 * check is considered unnecessary. --- Agreed? XXX
308 int solarisacl_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
309 const struct smb_filename
*smb_fname
)
313 SOLARIS_ACL_T solaris_acl
= NULL
;
316 DEBUG(10, ("entering solarisacl_sys_acl_delete_def_file.\n"));
318 smb_acl
= solarisacl_sys_acl_get_file(handle
, smb_fname
->base_name
,
319 SMB_ACL_TYPE_ACCESS
, talloc_tos());
320 if (smb_acl
== NULL
) {
321 DEBUG(10, ("getting file acl failed!\n"));
324 if (!smb_acl_to_solaris_acl(smb_acl
, &solaris_acl
, &count
,
325 SMB_ACL_TYPE_ACCESS
))
327 DEBUG(10, ("conversion smb_acl -> solaris_acl failed.\n"));
330 if (!solaris_acl_sort(solaris_acl
, count
)) {
331 DEBUG(10, ("resulting acl is not valid!\n"));
334 ret
= acl(smb_fname
->base_name
, SETACL
, count
, solaris_acl
);
336 DEBUG(10, ("settinge file acl failed!\n"));
340 DEBUG(10, ("solarisacl_sys_acl_delete_def_file %s.\n",
341 ((ret
!= 0) ? "failed" : "succeeded" )));
342 TALLOC_FREE(smb_acl
);
347 /* private functions */
349 static SOLARIS_ACL_T
solaris_acl_init(int count
)
351 SOLARIS_ACL_T solaris_acl
=
352 (SOLARIS_ACL_T
)SMB_MALLOC(sizeof(aclent_t
) * count
);
353 if (solaris_acl
== NULL
) {
360 * Convert the SMB acl to the ACCESS or DEFAULT part of a
361 * solaris ACL, as desired.
363 static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl
,
364 SOLARIS_ACL_T
*solaris_acl
, int *count
,
370 DEBUG(10, ("entering smb_acl_to_solaris_acl\n"));
375 for (i
= 0; i
< smb_acl
->count
; i
++) {
376 const struct smb_acl_entry
*smb_entry
= &(smb_acl
->acl
[i
]);
377 SOLARIS_ACE_T solaris_entry
;
379 ZERO_STRUCT(solaris_entry
);
381 solaris_entry
.a_type
= smb_tag_to_solaris_tag(smb_entry
->a_type
);
382 if (solaris_entry
.a_type
== 0) {
383 DEBUG(10, ("smb_tag to solaris_tag failed\n"));
386 switch(solaris_entry
.a_type
) {
388 DEBUG(10, ("got tag type USER with uid %u\n",
389 (unsigned int)smb_entry
->info
.user
.uid
));
390 solaris_entry
.a_id
= (uid_t
)smb_entry
->info
.user
.uid
;
393 DEBUG(10, ("got tag type GROUP with gid %u\n",
394 (unsigned int)smb_entry
->info
.group
.gid
));
395 solaris_entry
.a_id
= (uid_t
)smb_entry
->info
.group
.gid
;
400 if (type
== SMB_ACL_TYPE_DEFAULT
) {
401 DEBUG(10, ("adding default bit to solaris ace\n"));
402 solaris_entry
.a_type
|= ACL_DEFAULT
;
405 solaris_entry
.a_perm
=
406 smb_perm_to_solaris_perm(smb_entry
->a_perm
);
407 DEBUG(10, ("assembled the following solaris ace:\n"));
408 DEBUGADD(10, (" - type: 0x%04x\n", solaris_entry
.a_type
));
409 DEBUGADD(10, (" - id: %u\n", (unsigned int)solaris_entry
.a_id
));
410 DEBUGADD(10, (" - perm: o%o\n", solaris_entry
.a_perm
));
411 if (!solaris_add_to_acl(solaris_acl
, count
, &solaris_entry
,
414 DEBUG(10, ("error adding acl entry\n"));
417 DEBUG(10, ("count after adding: %d (i: %d)\n", *count
, i
));
418 DEBUG(10, ("test, if entry has been copied into acl:\n"));
419 DEBUGADD(10, (" - type: 0x%04x\n",
420 (*solaris_acl
)[(*count
)-1].a_type
));
421 DEBUGADD(10, (" - id: %u\n",
422 (unsigned int)(*solaris_acl
)[(*count
)-1].a_id
));
423 DEBUGADD(10, (" - perm: o%o\n",
424 (*solaris_acl
)[(*count
)-1].a_perm
));
431 SAFE_FREE(*solaris_acl
);
433 DEBUG(10, ("smb_acl_to_solaris_acl %s\n",
434 ((ret
== True
) ? "succeeded" : "failed")));
439 * convert either the access or the default part of a
440 * soaris acl to the SMB_ACL format.
442 static SMB_ACL_T
solaris_acl_to_smb_acl(SOLARIS_ACL_T solaris_acl
, int count
,
443 SMB_ACL_TYPE_T type
, TALLOC_CTX
*mem_ctx
)
448 if ((result
= sys_acl_init(mem_ctx
)) == NULL
) {
449 DEBUG(10, ("error allocating memory for SMB_ACL\n"));
452 for (i
= 0; i
< count
; i
++) {
453 SMB_ACL_ENTRY_T smb_entry
;
454 SMB_ACL_PERM_T smb_perm
;
456 if (!_IS_OF_TYPE(solaris_acl
[i
], type
)) {
459 result
->acl
= talloc_realloc(result
, result
->acl
, struct smb_acl_entry
, result
->count
+ 1);
460 if (result
->acl
== NULL
) {
461 DEBUG(10, ("error reallocating memory for SMB_ACL\n"));
464 smb_entry
= &result
->acl
[result
->count
];
465 if (sys_acl_set_tag_type(smb_entry
,
466 solaris_tag_to_smb_tag(solaris_acl
[i
].a_type
)) != 0)
468 DEBUG(10, ("invalid tag type given: 0x%04x\n",
469 solaris_acl
[i
].a_type
));
472 /* intentionally not checking return code here: */
473 sys_acl_set_qualifier(smb_entry
, (void *)&solaris_acl
[i
].a_id
);
474 smb_perm
= solaris_perm_to_smb_perm(solaris_acl
[i
].a_perm
);
475 if (sys_acl_set_permset(smb_entry
, &smb_perm
) != 0) {
476 DEBUG(10, ("invalid permset given: %d\n",
477 solaris_acl
[i
].a_perm
));
487 DEBUG(10, ("solaris_acl_to_smb_acl %s\n",
488 ((result
== NULL
) ? "failed" : "succeeded")));
494 static SOLARIS_ACL_TAG_T
smb_tag_to_solaris_tag(SMB_ACL_TAG_T smb_tag
)
496 SOLARIS_ACL_TAG_T solaris_tag
= 0;
498 DEBUG(10, ("smb_tag_to_solaris_tag\n"));
499 DEBUGADD(10, (" --> got smb tag 0x%04x\n", smb_tag
));
505 case SMB_ACL_USER_OBJ
:
506 solaris_tag
= USER_OBJ
;
511 case SMB_ACL_GROUP_OBJ
:
512 solaris_tag
= GROUP_OBJ
;
515 solaris_tag
= OTHER_OBJ
;
518 solaris_tag
= CLASS_OBJ
;
521 DEBUGADD(10, (" !!! unknown smb tag type 0x%04x\n", smb_tag
));
525 DEBUGADD(10, (" --> determined solaris tag 0x%04x\n", solaris_tag
));
530 static SMB_ACL_TAG_T
solaris_tag_to_smb_tag(SOLARIS_ACL_TAG_T solaris_tag
)
532 SMB_ACL_TAG_T smb_tag
= 0;
534 DEBUG(10, ("solaris_tag_to_smb_tag:\n"));
535 DEBUGADD(10, (" --> got solaris tag 0x%04x\n", solaris_tag
));
537 solaris_tag
&= ~ACL_DEFAULT
;
539 switch (solaris_tag
) {
541 smb_tag
= SMB_ACL_USER
;
544 smb_tag
= SMB_ACL_USER_OBJ
;
547 smb_tag
= SMB_ACL_GROUP
;
550 smb_tag
= SMB_ACL_GROUP_OBJ
;
553 smb_tag
= SMB_ACL_OTHER
;
556 smb_tag
= SMB_ACL_MASK
;
559 DEBUGADD(10, (" !!! unknown solaris tag type: 0x%04x\n",
564 DEBUGADD(10, (" --> determined smb tag 0x%04x\n", smb_tag
));
570 static SMB_ACL_PERM_T
solaris_perm_to_smb_perm(const SOLARIS_PERM_T perm
)
572 SMB_ACL_PERM_T smb_perm
= 0;
573 smb_perm
|= ((perm
& SMB_ACL_READ
) ? SMB_ACL_READ
: 0);
574 smb_perm
|= ((perm
& SMB_ACL_WRITE
) ? SMB_ACL_WRITE
: 0);
575 smb_perm
|= ((perm
& SMB_ACL_EXECUTE
) ? SMB_ACL_EXECUTE
: 0);
580 static SOLARIS_PERM_T
smb_perm_to_solaris_perm(const SMB_ACL_PERM_T perm
)
582 SOLARIS_PERM_T solaris_perm
= 0;
583 solaris_perm
|= ((perm
& SMB_ACL_READ
) ? SMB_ACL_READ
: 0);
584 solaris_perm
|= ((perm
& SMB_ACL_WRITE
) ? SMB_ACL_WRITE
: 0);
585 solaris_perm
|= ((perm
& SMB_ACL_EXECUTE
) ? SMB_ACL_EXECUTE
: 0);
590 static bool solaris_acl_get_file(const char *name
, SOLARIS_ACL_T
*solaris_acl
,
595 DEBUG(10, ("solaris_acl_get_file called for file '%s'\n", name
));
598 * The original code tries some INITIAL_ACL_SIZE
599 * and only did the GETACLCNT call upon failure
600 * (for performance reasons).
601 * For the sake of simplicity, I skip this for now.
603 *count
= acl(name
, GETACLCNT
, 0, NULL
);
605 DEBUG(10, ("acl GETACLCNT failed: %s\n", strerror(errno
)));
608 *solaris_acl
= solaris_acl_init(*count
);
609 if (*solaris_acl
== NULL
) {
610 DEBUG(10, ("error allocating memory for solaris acl...\n"));
613 *count
= acl(name
, GETACL
, *count
, *solaris_acl
);
615 DEBUG(10, ("acl GETACL failed: %s\n", strerror(errno
)));
621 DEBUG(10, ("solaris_acl_get_file %s.\n",
622 ((result
== True
) ? "succeeded" : "failed" )));
627 static bool solaris_acl_get_fd(int fd
, SOLARIS_ACL_T
*solaris_acl
, int *count
)
631 DEBUG(10, ("entering solaris_acl_get_fd\n"));
634 * see solaris_acl_get_file for comment about omission
635 * of INITIAL_ACL_SIZE...
637 *count
= facl(fd
, GETACLCNT
, 0, NULL
);
639 DEBUG(10, ("facl GETACLCNT failed: %s\n", strerror(errno
)));
642 *solaris_acl
= solaris_acl_init(*count
);
643 if (*solaris_acl
== NULL
) {
644 DEBUG(10, ("error allocating memory for solaris acl...\n"));
647 *count
= facl(fd
, GETACL
, *count
, *solaris_acl
);
649 DEBUG(10, ("facl GETACL failed: %s\n", strerror(errno
)));
655 DEBUG(10, ("solaris_acl_get_fd %s\n",
656 ((ret
== True
) ? "succeeded" : "failed")));
663 * Add entries to a solaris ACL.
665 * Entries are directly added to the solarisacl parameter.
666 * if memory allocation fails, this may result in solarisacl
667 * being NULL. if the resulting acl is to be checked and is
668 * not valid, it is kept in solarisacl but False is returned.
670 * The type of ACEs (access/default) to be added to the ACL can
671 * be selected via the type parameter.
672 * I use the SMB_ACL_TYPE_T type here. Since SMB_ACL_TYPE_ACCESS
673 * is defined as "0", this means that one can only add either
674 * access or default ACEs, not both at the same time. If it
675 * should become necessary to add all of an ACL, one would have
676 * to replace this parameter by another type.
678 static bool solaris_add_to_acl(SOLARIS_ACL_T
*solaris_acl
, int *count
,
679 SOLARIS_ACL_T add_acl
, int add_count
,
684 if ((type
!= SMB_ACL_TYPE_ACCESS
) && (type
!= SMB_ACL_TYPE_DEFAULT
))
686 DEBUG(10, ("invalid acl type given: %d\n", type
));
690 for (i
= 0; i
< add_count
; i
++) {
691 if (!_IS_OF_TYPE(add_acl
[i
], type
)) {
694 ADD_TO_ARRAY(NULL
, SOLARIS_ACE_T
, add_acl
[i
],
696 if (solaris_acl
== NULL
) {
697 DEBUG(10, ("error enlarging acl.\n"));
707 * sort the ACL and check it for validity
709 * [original comment from lib/sysacls.c:]
711 * if it's a minimal ACL with only 4 entries then we
712 * need to recalculate the mask permissions to make
713 * sure that they are the same as the GROUP_OBJ
714 * permissions as required by the UnixWare acl() system call.
716 * (note: since POSIX allows minimal ACLs which only contain
717 * 3 entries - ie there is no mask entry - we should, in theory,
718 * check for this and add a mask entry if necessary - however
719 * we "know" that the caller of this interface always specifies
720 * a mask, so in practice "this never happens" (tm) - if it *does*
721 * happen aclsort() will fail and return an error and someone will
724 static bool solaris_acl_sort(SOLARIS_ACL_T solaris_acl
, int count
)
726 int fixmask
= (count
<= 4);
728 if (aclsort(count
, fixmask
, solaris_acl
) != 0) {
737 * acl check function:
738 * unused at the moment but could be used to get more
739 * concrete error messages for debugging...
740 * (acl sort just says that the acl is invalid...)
742 static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl
, int count
)
747 check_rc
= aclcheck(solaris_acl
, count
, &check_which
);
749 DEBUG(10, ("acl is not valid:\n"));
750 DEBUGADD(10, (" - return code: %d\n", check_rc
));
751 DEBUGADD(10, (" - which: %d\n", check_which
));
752 if (check_which
!= -1) {
753 DEBUGADD(10, (" - invalid entry:\n"));
754 DEBUGADD(10, (" * type: %d:\n",
755 solaris_acl
[check_which
].a_type
));
756 DEBUGADD(10, (" * id: %d\n",
757 solaris_acl
[check_which
].a_id
));
758 DEBUGADD(10, (" * perm: 0o%o\n",
759 solaris_acl
[check_which
].a_perm
));
767 static struct vfs_fn_pointers solarisacl_fns
= {
768 .sys_acl_get_file_fn
= solarisacl_sys_acl_get_file
,
769 .sys_acl_get_fd_fn
= solarisacl_sys_acl_get_fd
,
770 .sys_acl_blob_get_file_fn
= posix_sys_acl_blob_get_file
,
771 .sys_acl_blob_get_fd_fn
= posix_sys_acl_blob_get_fd
,
772 .sys_acl_set_file_fn
= solarisacl_sys_acl_set_file
,
773 .sys_acl_set_fd_fn
= solarisacl_sys_acl_set_fd
,
774 .sys_acl_delete_def_file_fn
= solarisacl_sys_acl_delete_def_file
,
778 NTSTATUS
vfs_solarisacl_init(TALLOC_CTX
*ctx
)
780 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "solarisacl",