xref: /titanic_44/usr/src/lib/libsmbfs/netsmb/smbfs_acl.h (revision 62a24de03df1f2399ceda704cb3874dabc98bbbd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _NETSMB_SMBFS_ACL_H
28 #define	_NETSMB_SMBFS_ACL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Get/set ACL via contracted interface in libsmbfs.
34  * The ACL is in the form used by libsec (type=ACE_T)
35  * but we need to carry the uid/gid info here too.
36  */
37 
38 #include <sys/acl.h>
39 
40 /*
41  * Get a ZFS-style acl from an FD opened in smbfs.
42  * Intentionally similar to: facl_get(3SEC)
43  *
44  * Allocates an acl_t via libsec.  Free with: acl_free(3SEC)
45  * Get owner/group IDs too if ID pointers != NULL
46  */
47 int smbfs_acl_get(int fd, acl_t **, uid_t *, gid_t *);
48 
49 /*
50  * Set a ZFS-style acl onto an FD opened in smbfs.
51  * Intentionally similar to: facl_set(3SEC)
52  *
53  * The acl_t must be of type ACE_T (from libsec).
54  * Set owner/group IDs too if ID values != -1
55  */
56 int smbfs_acl_set(int fd, acl_t *, uid_t, gid_t);
57 
58 
59 /*
60  * Slightly lower-level functions, allowing access to
61  * the raw Windows Security Descriptor (SD)
62  */
63 typedef struct i_ntsd i_ntsd_t;
64 
65 /*
66  * Get an "internal form" SD from the FD (opened in smbfs).
67  * Allocates a hierarchy in isdp.  Caller must free it via
68  * smbfs_acl_free_isd()
69  */
70 int smbfs_acl_getsd(int fd, uint32_t, i_ntsd_t **);
71 
72 /*
73  * Set an "internal form" SD onto the FD (opened in smbfs).
74  */
75 int smbfs_acl_setsd(int fd, uint32_t, i_ntsd_t *);
76 
77 /*
78  * Convert an internal SD to a ZFS-style ACL.
79  * Get uid/gid too if pointers != NULL.
80  */
81 int smbfs_acl_sd2zfs(i_ntsd_t *, acl_t *, uid_t *, gid_t *);
82 
83 /*
84  * Convert an internal SD to a ZFS-style ACL.
85  * Include owner/group too if uid/gid != -1.
86  */
87 int smbfs_acl_zfs2sd(acl_t *, uid_t, gid_t, i_ntsd_t **);
88 
89 void smbfs_acl_free_sd(i_ntsd_t *);
90 void smbfs_acl_print_sd(FILE *, i_ntsd_t *);
91 
92 #endif	/* _NETSMB_SMBFS_ACL_H */
93