xref: /titanic_52/usr/src/lib/libsmbfs/netsmb/smbfs_acl.h (revision 55f5292c612446ce6f93ddd248c0019b5974618b)
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 2009 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 /*
31  * Get/set ACL via contracted interface in libsmbfs.
32  * The ACL is in the form used by libsec (type=ACE_T)
33  * but we need to carry the uid/gid info here too.
34  */
35 
36 #include <sys/acl.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Get a ZFS-style acl from an FD opened in smbfs.
44  * Intentionally similar to: facl_get(3SEC)
45  *
46  * Allocates an acl_t via libsec.  Free with: acl_free(3SEC)
47  * Get owner/group IDs too if ID pointers != NULL
48  */
49 int smbfs_acl_get(int fd, acl_t **, uid_t *, gid_t *);
50 
51 /*
52  * Set a ZFS-style acl onto an FD opened in smbfs.
53  * Intentionally similar to: facl_set(3SEC)
54  *
55  * The acl_t must be of type ACE_T (from libsec).
56  * Set owner/group IDs too if ID values != -1
57  */
58 int smbfs_acl_set(int fd, acl_t *, uid_t, gid_t);
59 
60 
61 /*
62  * Slightly lower-level functions, allowing access to
63  * the raw Windows Security Descriptor (SD)
64  */
65 typedef struct i_ntsd i_ntsd_t;
66 
67 /*
68  * Get an "internal form" SD from the FD (opened in smbfs).
69  * Allocates a hierarchy in isdp.  Caller must free it via
70  * smbfs_acl_free_isd()
71  */
72 int smbfs_acl_getsd(int fd, uint32_t, i_ntsd_t **);
73 
74 /*
75  * Set an "internal form" SD onto the FD (opened in smbfs).
76  */
77 int smbfs_acl_setsd(int fd, uint32_t, i_ntsd_t *);
78 
79 /*
80  * Convert an internal SD to a ZFS-style ACL.
81  * Get uid/gid too if pointers != NULL.
82  */
83 int smbfs_acl_sd2zfs(i_ntsd_t *, acl_t *, uid_t *, gid_t *);
84 
85 /*
86  * Convert an internal SD to a ZFS-style ACL.
87  * Include owner/group too if uid/gid != -1.
88  */
89 int smbfs_acl_zfs2sd(acl_t *, uid_t, gid_t, i_ntsd_t **);
90 
91 void smbfs_acl_free_sd(i_ntsd_t *);
92 
93 struct __FILE;
94 void smbfs_acl_print_sd(struct __FILE *, i_ntsd_t *);
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif	/* _NETSMB_SMBFS_ACL_H */
101