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 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #ifndef _SMBFS_NTACL_H
28 #define _SMBFS_NTACL_H
29
30 /*
31 * Internal functions for dealing with
32 * NT Security data structures.
33 */
34
35 #include <netsmb/mchain.h>
36
37 /*
38 * Internal form of an NT SID
39 * Same as on the wire, but possibly byte-swapped.
40 */
41 typedef struct i_ntsid {
42 uint8_t sid_revision;
43 uint8_t sid_subauthcount;
44 uint8_t sid_authority[6];
105 } i_ntsd_t;
106
107 /*
108 * Import a raw SD (mb chain) into "internal" form.
109 * (like "absolute" form per. NT docs)
110 * Returns allocated data in sdp
111 */
112 int md_get_ntsd(mdchain_t *mbp, i_ntsd_t **sdp);
113
114 /*
115 * Export an "internal" SD into an raw SD (mb chain).
116 * (a.k.a "self-relative" form per. NT docs)
117 * Returns allocated mbchain in mbp.
118 */
119 int mb_put_ntsd(mbchain_t *mbp, i_ntsd_t *sd);
120
121 /*
122 * Convert an internal SD to a ZFS-style ACL.
123 * Get uid/gid too if pointers != NULL.
124 */
125 #ifdef _KERNEL
126 int smbfs_acl_sd2zfs(i_ntsd_t *, vsecattr_t *, uid_t *, gid_t *);
127 #else /* _KERNEL */
128 /* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
129 int smbfs_acl_sd2zfs(struct i_ntsd *, acl_t *, uid_t *, gid_t *);
130 #endif /* _KERNEL */
131
132 /*
133 * Convert a ZFS-style ACL to an internal SD.
134 * Set owner/group too if selector indicates.
135 * Always need to pass uid+gid, either the new
136 * (when setting them) or existing, so that any
137 * owner@ or group@ ACEs can be translated.
138 */
139 #ifdef _KERNEL
140 int smbfs_acl_zfs2sd(vsecattr_t *, uid_t, gid_t, uint32_t, i_ntsd_t **);
141 #else /* _KERNEL */
142 /* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
143 int smbfs_acl_zfs2sd(acl_t *, uid_t, gid_t, uint32_t, struct i_ntsd **);
144 #endif /* _KERNEL */
145
146 /*
147 * Free an i_ntsd_t from md_get_ntsd() or smbfs_acl_zfs2sd().
148 * See also: lib/libsmbfs/netsmb/smbfs_acl.h
149 */
150 void smbfs_acl_free_sd(struct i_ntsd *);
151
152 /*
153 * Convert an NT SID to string format.
154 */
155 int smbfs_sid2str(i_ntsid_t *sid,
156 char *obuf, size_t olen, uint32_t *ridp);
157
158 #endif /* _SMBFS_NTACL_H */
|
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 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #ifndef _SMBFS_NTACL_H
30 #define _SMBFS_NTACL_H
31
32 /*
33 * Internal functions for dealing with
34 * NT Security data structures.
35 */
36
37 #include <netsmb/mchain.h>
38
39 /*
40 * Internal form of an NT SID
41 * Same as on the wire, but possibly byte-swapped.
42 */
43 typedef struct i_ntsid {
44 uint8_t sid_revision;
45 uint8_t sid_subauthcount;
46 uint8_t sid_authority[6];
107 } i_ntsd_t;
108
109 /*
110 * Import a raw SD (mb chain) into "internal" form.
111 * (like "absolute" form per. NT docs)
112 * Returns allocated data in sdp
113 */
114 int md_get_ntsd(mdchain_t *mbp, i_ntsd_t **sdp);
115
116 /*
117 * Export an "internal" SD into an raw SD (mb chain).
118 * (a.k.a "self-relative" form per. NT docs)
119 * Returns allocated mbchain in mbp.
120 */
121 int mb_put_ntsd(mbchain_t *mbp, i_ntsd_t *sd);
122
123 /*
124 * Convert an internal SD to a ZFS-style ACL.
125 * Get uid/gid too if pointers != NULL.
126 */
127 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
128 int smbfs_acl_sd2zfs(i_ntsd_t *, vsecattr_t *, uid_t *, gid_t *);
129 #else /* _KERNEL */
130 /* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
131 int smbfs_acl_sd2zfs(struct i_ntsd *, acl_t *, uid_t *, gid_t *);
132 #endif /* _KERNEL */
133
134 /*
135 * Convert a ZFS-style ACL to an internal SD.
136 * Set owner/group too if selector indicates.
137 * Always need to pass uid+gid, either the new
138 * (when setting them) or existing, so that any
139 * owner@ or group@ ACEs can be translated.
140 */
141 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
142 int smbfs_acl_zfs2sd(vsecattr_t *, uid_t, gid_t, uint32_t, i_ntsd_t **);
143 #else /* _KERNEL */
144 /* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
145 int smbfs_acl_zfs2sd(acl_t *, uid_t, gid_t, uint32_t, struct i_ntsd **);
146 #endif /* _KERNEL */
147
148 /*
149 * Free an i_ntsd_t from md_get_ntsd() or smbfs_acl_zfs2sd().
150 * See also: lib/libsmbfs/netsmb/smbfs_acl.h
151 */
152 void smbfs_acl_free_sd(struct i_ntsd *);
153
154 /*
155 * Convert an NT SID to string format.
156 */
157 int smbfs_sid2str(i_ntsid_t *sid,
158 char *obuf, size_t olen, uint32_t *ridp);
159
160 #endif /* _SMBFS_NTACL_H */
|