Print this page
1575 untangle libmlrpc ... (smbsrv)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/common/smbsrv/smb_token_xdr.c
+++ new/usr/src/common/smbsrv/smb_token_xdr.c
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.
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 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 *
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
25 25 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
26 26 */
27 27
28 28 /*
29 29 * This file was originally generated using rpcgen.
30 30 */
31 31
32 32 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
33 33 #include <stdlib.h>
34 34 #endif /* !_KERNEL */
35 -#include <smbsrv/wintypes.h>
35 +#include <smb/wintypes.h>
36 36 #include <smbsrv/smb_sid.h>
37 37 #include <smbsrv/smb_xdr.h>
38 38 #include <smbsrv/smb_token.h>
39 39
40 40 static bool_t smb_privset_xdr(XDR *, smb_privset_t *);
41 41 static bool_t smb_sid_xdr(XDR *, smb_sid_t *);
42 42
43 43 static bool_t
44 44 smb_privset_helper_xdr(XDR *xdrs, char **privs)
45 45 {
46 46 uint32_t pos, len;
47 47 uint32_t cnt;
48 48 bool_t rc;
49 49 smb_privset_t *p;
50 50
51 51 if (xdrs->x_op == XDR_DECODE) {
52 52 pos = xdr_getpos(xdrs);
53 53
54 54 if (!xdr_bool(xdrs, &rc))
55 55 return (FALSE);
56 56
57 57 if (!xdr_uint32_t(xdrs, &cnt))
58 58 return (FALSE);
59 59
60 60 rc = xdr_setpos(xdrs, pos);
61 61
62 62 if (rc == FALSE)
63 63 return (FALSE);
64 64 } else {
65 65 if (*privs == NULL)
66 66 return (FALSE);
67 67
68 68 p = (smb_privset_t *)(uintptr_t)*privs;
69 69 cnt = p->priv_cnt;
70 70 }
71 71
72 72 len = sizeof (smb_privset_t)
73 73 - sizeof (smb_luid_attrs_t)
74 74 + (cnt * sizeof (smb_luid_attrs_t));
75 75
76 76 if (!xdr_pointer(xdrs, privs, len, (xdrproc_t)smb_privset_xdr))
77 77 return (FALSE);
78 78
79 79 return (TRUE);
80 80 }
81 81
82 82 static bool_t
83 83 smb_id_xdr(XDR *xdrs, smb_id_t *objp)
84 84 {
85 85 uint8_t len;
86 86
87 87 if ((xdrs->x_op == XDR_ENCODE) || (xdrs->x_op == XDR_FREE))
88 88 len = smb_sid_len(objp->i_sid);
89 89
90 90 if (!xdr_uint32_t(xdrs, &objp->i_attrs))
91 91 return (FALSE);
92 92
93 93 if (!xdr_uint8_t(xdrs, &len))
94 94 return (FALSE);
95 95
96 96 if (!xdr_pointer(xdrs, (char **)&objp->i_sid, len,
97 97 (xdrproc_t)smb_sid_xdr))
98 98 return (FALSE);
99 99
100 100 if (!xdr_uint32_t(xdrs, (uint32_t *)&objp->i_id))
101 101 return (FALSE);
102 102
103 103 return (TRUE);
104 104 }
105 105
106 106 static bool_t
107 107 smb_ids_xdr(XDR *xdrs, smb_ids_t *objp)
108 108 {
109 109 if (!xdr_array(xdrs, (char **)&objp->i_ids, (uint32_t *)&objp->i_cnt,
110 110 ~0, sizeof (smb_id_t), (xdrproc_t)smb_id_xdr))
111 111 return (FALSE);
112 112
113 113 return (TRUE);
114 114 }
115 115
116 116 static bool_t
117 117 smb_posix_grps_xdr(XDR *xdrs, smb_posix_grps_t *objp)
118 118 {
119 119 if (!xdr_uint32_t(xdrs, &objp->pg_ngrps))
120 120 return (FALSE);
121 121 if (!xdr_vector(xdrs, (char *)objp->pg_grps, objp->pg_ngrps,
122 122 sizeof (uint32_t), (xdrproc_t)xdr_uint32_t))
123 123 return (FALSE);
124 124 return (TRUE);
125 125 }
126 126
127 127 static bool_t
128 128 smb_posix_grps_helper_xdr(XDR *xdrs, char **identity)
129 129 {
130 130 uint32_t pos, len;
131 131 uint32_t cnt;
132 132 bool_t rc;
133 133
134 134 if (xdrs->x_op == XDR_DECODE) {
135 135 pos = xdr_getpos(xdrs);
136 136
137 137 if (!xdr_bool(xdrs, &rc))
138 138 return (FALSE);
139 139
140 140 if (!xdr_uint32_t(xdrs, &cnt))
141 141 return (FALSE);
142 142
143 143 rc = xdr_setpos(xdrs, pos);
144 144 if (rc == FALSE)
145 145 return (FALSE);
146 146 } else {
147 147 if (*identity == NULL)
148 148 return (FALSE);
149 149 cnt = ((smb_posix_grps_t *)(uintptr_t)*identity)->pg_ngrps;
150 150 }
151 151
152 152 len = SMB_POSIX_GRPS_SIZE(cnt);
153 153
154 154 if (!xdr_pointer(xdrs, identity, len, (xdrproc_t)smb_posix_grps_xdr))
155 155 return (FALSE);
156 156 return (TRUE);
157 157 }
158 158
159 159 bool_t
160 160 smb_logon_xdr(XDR *xdrs, smb_logon_t *objp)
161 161 {
162 162 if (!xdr_uint16_t(xdrs, &objp->lg_level))
163 163 return (FALSE);
164 164 if (!xdr_string(xdrs, &objp->lg_username, ~0))
165 165 return (FALSE);
166 166 if (!xdr_string(xdrs, &objp->lg_domain, ~0))
167 167 return (FALSE);
168 168 if (!xdr_string(xdrs, &objp->lg_e_username, ~0))
169 169 return (FALSE);
170 170 if (!xdr_string(xdrs, &objp->lg_e_domain, ~0))
171 171 return (FALSE);
172 172 if (!xdr_string(xdrs, &objp->lg_workstation, ~0))
173 173 return (FALSE);
174 174 if (!smb_inaddr_xdr(xdrs, &objp->lg_clnt_ipaddr))
175 175 return (FALSE);
176 176 if (!smb_inaddr_xdr(xdrs, &objp->lg_local_ipaddr))
177 177 return (FALSE);
178 178 if (!xdr_uint16_t(xdrs, &objp->lg_local_port))
179 179 return (FALSE);
180 180 if (!smb_buf32_xdr(xdrs, &objp->lg_challenge_key))
181 181 return (FALSE);
182 182 if (!smb_buf32_xdr(xdrs, &objp->lg_nt_password))
183 183 return (FALSE);
184 184 if (!smb_buf32_xdr(xdrs, &objp->lg_lm_password))
185 185 return (FALSE);
186 186 if (!xdr_uint32_t(xdrs, &objp->lg_ntlm_flags))
187 187 return (FALSE);
188 188 if (!xdr_int(xdrs, &objp->lg_native_os))
189 189 return (FALSE);
190 190 if (!xdr_int(xdrs, &objp->lg_native_lm))
191 191 return (FALSE);
192 192 if (!xdr_uint32_t(xdrs, &objp->lg_flags))
193 193 return (FALSE);
194 194 if (!xdr_uint32_t(xdrs, &objp->lg_logon_id))
195 195 return (FALSE);
196 196 if (!xdr_uint32_t(xdrs, &objp->lg_domain_type))
197 197 return (FALSE);
198 198 if (!xdr_uint32_t(xdrs, &objp->lg_secmode))
199 199 return (FALSE);
200 200 if (!xdr_uint32_t(xdrs, &objp->lg_status))
201 201 return (FALSE);
202 202 return (TRUE);
203 203 }
204 204
205 205 static bool_t
206 206 smb_sid_xdr(XDR *xdrs, smb_sid_t *objp)
207 207 {
208 208 if (!xdr_uint8_t(xdrs, &objp->sid_revision))
209 209 return (FALSE);
210 210 if (!xdr_uint8_t(xdrs, &objp->sid_subauthcnt))
211 211 return (FALSE);
212 212 if (!xdr_vector(xdrs, (char *)objp->sid_authority, NT_SID_AUTH_MAX,
213 213 sizeof (uint8_t), (xdrproc_t)xdr_uint8_t))
214 214 return (FALSE);
215 215 if (!xdr_vector(xdrs, (char *)objp->sid_subauth, objp->sid_subauthcnt,
216 216 sizeof (uint32_t), (xdrproc_t)xdr_uint32_t))
217 217 return (FALSE);
218 218 return (TRUE);
219 219 }
220 220
221 221 static bool_t
222 222 smb_luid_xdr(XDR *xdrs, smb_luid_t *objp)
223 223 {
224 224 if (!xdr_uint32_t(xdrs, &objp->lo_part))
225 225 return (FALSE);
226 226 if (!xdr_uint32_t(xdrs, &objp->hi_part))
227 227 return (FALSE);
228 228 return (TRUE);
229 229 }
230 230
231 231 static bool_t
232 232 smb_luid_attrs_xdr(XDR *xdrs, smb_luid_attrs_t *objp)
233 233 {
234 234 if (!smb_luid_xdr(xdrs, &objp->luid))
235 235 return (FALSE);
236 236 if (!xdr_uint32_t(xdrs, &objp->attrs))
237 237 return (FALSE);
238 238 return (TRUE);
239 239 }
240 240
241 241 static bool_t
242 242 smb_privset_xdr(XDR *xdrs, smb_privset_t *objp)
243 243 {
244 244 if (!xdr_uint32_t(xdrs, &objp->priv_cnt))
245 245 return (FALSE);
246 246 if (!xdr_uint32_t(xdrs, &objp->control))
247 247 return (FALSE);
248 248 if (!xdr_vector(xdrs, (char *)objp->priv, objp->priv_cnt,
249 249 sizeof (smb_luid_attrs_t),
250 250 (xdrproc_t)smb_luid_attrs_xdr))
251 251 return (FALSE);
252 252 return (TRUE);
253 253 }
254 254
255 255 bool_t
256 256 smb_token_xdr(XDR *xdrs, smb_token_t *objp)
257 257 {
258 258 if (!smb_id_xdr(xdrs, &objp->tkn_user))
259 259 return (FALSE);
260 260 if (!smb_id_xdr(xdrs, &objp->tkn_owner))
261 261 return (FALSE);
262 262 if (!smb_id_xdr(xdrs, &objp->tkn_primary_grp))
263 263 return (FALSE);
264 264 if (!smb_ids_xdr(xdrs, &objp->tkn_win_grps))
265 265 return (FALSE);
266 266 if (!smb_privset_helper_xdr(xdrs, (char **)&objp->tkn_privileges))
267 267 return (FALSE);
268 268 if (!xdr_string(xdrs, &objp->tkn_account_name, ~0))
269 269 return (FALSE);
270 270 if (!xdr_string(xdrs, &objp->tkn_domain_name, ~0))
271 271 return (FALSE);
272 272 if (!xdr_uint32_t(xdrs, &objp->tkn_flags))
273 273 return (FALSE);
274 274 if (!xdr_uint32_t(xdrs, &objp->tkn_audit_sid))
275 275 return (FALSE);
276 276 if (!smb_buf32_xdr(xdrs, &objp->tkn_ssnkey))
277 277 return (FALSE);
278 278 if (!smb_posix_grps_helper_xdr(xdrs, (char **)&objp->tkn_posix_grps))
279 279 return (FALSE);
280 280 return (TRUE);
281 281 }
↓ open down ↓ |
236 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX