Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/common/smbclnt/smbfs_ntacl.h
+++ new/usr/src/common/smbclnt/smbfs_ntacl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 + *
26 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
25 27 */
26 28
27 29 #ifndef _SMBFS_NTACL_H
28 30 #define _SMBFS_NTACL_H
29 31
30 32 /*
31 33 * Internal functions for dealing with
32 34 * NT Security data structures.
33 35 */
34 36
35 37 #include <netsmb/mchain.h>
36 38
37 39 /*
38 40 * Internal form of an NT SID
39 41 * Same as on the wire, but possibly byte-swapped.
40 42 */
41 43 typedef struct i_ntsid {
42 44 uint8_t sid_revision;
43 45 uint8_t sid_subauthcount;
44 46 uint8_t sid_authority[6];
45 47 uint32_t sid_subauthvec[1]; /* actually len=subauthcount */
46 48 } i_ntsid_t;
47 49 #define I_SID_SIZE(sacnt) (8 + 4 * (sacnt))
48 50
49 51 /*
50 52 * Internal form of an NT ACE - first the header.
51 53 * See MS SDK: ACE_HEADER (For MS, it's the OtW form)
52 54 * Note: ace_size here is the in-memoy size, not OtW.
53 55 */
54 56 typedef struct i_ntace_hdr {
55 57 uint8_t ace_type;
56 58 uint8_t ace_flags;
57 59 uint16_t ace_size;
58 60 } i_ntace_hdr_t;
59 61
60 62 /*
61 63 * Simple ACE for types: ACCESS_ALLOWED through SYSTEM_ALARM
62 64 * See MS SDK: ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE,
63 65 * SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE.
64 66 *
65 67 * The above are the only types that appear in a V2 ACL.
66 68 * Note that in the Windows SDK, the SID is stored as
67 69 * "flat" data after the ACE header. This implementation
68 70 * stores the SID as a pointer instead.
69 71 */
70 72 typedef struct i_ntace_v2 {
71 73 i_ntace_hdr_t ace_hdr;
72 74 uint32_t ace_rights; /* generic, standard, specific, etc */
73 75 i_ntsid_t *ace_sid;
74 76 } i_ntace_v2_t;
75 77
76 78 /*
77 79 * A union for convenience of the conversion code.
78 80 * There are lots more ACE types, ignored for now.
79 81 */
80 82 typedef union i_ntace_u {
81 83 i_ntace_hdr_t ace_hdr;
82 84 i_ntace_v2_t ace_v2;
83 85 } i_ntace_t;
84 86
85 87 /*
86 88 * Internal form of an NT ACL (see sacl/dacl below)
87 89 */
88 90 typedef struct i_ntacl {
89 91 uint8_t acl_revision; /* 0x02 observed with W2K */
90 92 uint16_t acl_acecount;
91 93 i_ntace_t *acl_acevec[1]; /* actually, len=acecount */
92 94 } i_ntacl_t;
93 95
94 96 /*
95 97 * Internal form of an NT Security Descriptor (SD)
96 98 */
97 99 typedef struct i_ntsd {
98 100 uint8_t sd_revision; /* 0x01 observed between W2K */
99 101 uint8_t sd_rmctl; /* resource mgr control (MBZ) */
100 102 uint16_t sd_flags;
101 103 i_ntsid_t *sd_owner;
102 104 i_ntsid_t *sd_group;
103 105 i_ntacl_t *sd_sacl;
104 106 i_ntacl_t *sd_dacl;
105 107 } i_ntsd_t;
106 108
107 109 /*
108 110 * Import a raw SD (mb chain) into "internal" form.
109 111 * (like "absolute" form per. NT docs)
110 112 * Returns allocated data in sdp
111 113 */
112 114 int md_get_ntsd(mdchain_t *mbp, i_ntsd_t **sdp);
113 115
114 116 /*
|
↓ open down ↓ |
80 lines elided |
↑ open up ↑ |
115 117 * Export an "internal" SD into an raw SD (mb chain).
116 118 * (a.k.a "self-relative" form per. NT docs)
117 119 * Returns allocated mbchain in mbp.
118 120 */
119 121 int mb_put_ntsd(mbchain_t *mbp, i_ntsd_t *sd);
120 122
121 123 /*
122 124 * Convert an internal SD to a ZFS-style ACL.
123 125 * Get uid/gid too if pointers != NULL.
124 126 */
125 -#ifdef _KERNEL
127 +#if defined(_KERNEL) || defined(_FAKE_KERNEL)
126 128 int smbfs_acl_sd2zfs(i_ntsd_t *, vsecattr_t *, uid_t *, gid_t *);
127 129 #else /* _KERNEL */
128 130 /* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
129 131 int smbfs_acl_sd2zfs(struct i_ntsd *, acl_t *, uid_t *, gid_t *);
130 132 #endif /* _KERNEL */
131 133
132 134 /*
133 135 * Convert a ZFS-style ACL to an internal SD.
134 136 * Set owner/group too if selector indicates.
135 137 * Always need to pass uid+gid, either the new
136 138 * (when setting them) or existing, so that any
137 139 * owner@ or group@ ACEs can be translated.
138 140 */
139 -#ifdef _KERNEL
141 +#if defined(_KERNEL) || defined(_FAKE_KERNEL)
140 142 int smbfs_acl_zfs2sd(vsecattr_t *, uid_t, gid_t, uint32_t, i_ntsd_t **);
141 143 #else /* _KERNEL */
142 144 /* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
143 145 int smbfs_acl_zfs2sd(acl_t *, uid_t, gid_t, uint32_t, struct i_ntsd **);
144 146 #endif /* _KERNEL */
145 147
146 148 /*
147 149 * Free an i_ntsd_t from md_get_ntsd() or smbfs_acl_zfs2sd().
148 150 * See also: lib/libsmbfs/netsmb/smbfs_acl.h
149 151 */
150 152 void smbfs_acl_free_sd(struct i_ntsd *);
151 153
152 154 /*
153 155 * Convert an NT SID to string format.
154 156 */
155 157 int smbfs_sid2str(i_ntsid_t *sid,
156 158 char *obuf, size_t olen, uint32_t *ridp);
157 159
158 160 #endif /* _SMBFS_NTACL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX