Print this page
1575 untangle libmlrpc from SMB server
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
NEX-5560 smb2 should use 64-bit server-global uids
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-4083 Upstream changes from illumos 5917 and 5995
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-3662 Backport illumos 1501: taskq_create_proc ... TQ_DYNAMIC puts tasks in p0 (take 2)
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
NEX-3576 RPC error when displaying open files via Windows MMC
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
SMB-136 Snapshots not visible in Windows previous versions
SMB-108 Should have comments to relate types with their XDR functions
SMB-39 Use AF_UNIX pipes for RPC
SMB-50 User-mode SMB server
Includes work by these authors:
Thomas Keiser <thomas.keiser@nexenta.com>
Albert Lee <trisk@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/smbsrv/smb_xdr.h
+++ new/usr/src/uts/common/smbsrv/smb_xdr.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.
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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25
26 26 #ifndef _SMBSRV_SMB_XDR_H
|
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 #define _SMBSRV_SMB_XDR_H
28 28
29 29 #ifdef __cplusplus
30 30 extern "C" {
31 31 #endif
32 32
33 33 #include <rpc/xdr.h>
34 34 #include <sys/param.h>
35 35 #include <sys/avl.h>
36 36 #include <sys/list.h>
37 -#include <smbsrv/wintypes.h>
37 +#include <smb/wintypes.h>
38 38 #include <smbsrv/smb_sid.h>
39 39 #include <smbsrv/smbinfo.h>
40 40 #include <smbsrv/smb_ioctl.h>
41 41 #include <smbsrv/smb_sid.h>
42 42 #include <smbsrv/smb_share.h>
43 43 #include <smbsrv/smb_dfs.h>
44 -#include <smbsrv/wintypes.h>
45 44
46 45 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
47 46 #include <sys/sysmacros.h>
48 47 #define xdr_int8_t xdr_char
49 48 #define xdr_uint8_t xdr_u_char
50 49 #define xdr_int16_t xdr_short
51 50 #define xdr_uint16_t xdr_u_short
52 51 #else /* _KERNEL */
53 52 #include <stddef.h> /* offsetof */
54 53 #endif /* _KERNEL */
55 54
56 55 /*
57 56 * null-terminated string
58 57 * See also: smb_string_xdr()
59 58 */
60 59 typedef struct smb_string {
61 60 char *buf;
62 61 } smb_string_t;
63 62
64 63 struct smb_buf32;
65 64
66 65 /*
67 66 * Initial message on server named pipes.
68 67 * Followed by smb_netuserinfo
69 68 */
70 69 typedef struct smb_pipehdr {
71 70 uint32_t ph_magic;
72 71 uint32_t ph_uilen;
73 72 } smb_pipehdr_t;
74 73
75 74 #define SMB_PIPE_HDR_MAGIC 0x50495045 /* PIPE */
76 75
77 76 /*
78 77 * Maximum message size for SMB named pipes.
79 78 * Should be less than PIPE_BUF (5120).
80 79 * Use the same value Windows does.
81 80 */
82 81 #define SMB_PIPE_MAX_MSGSIZE 4280
83 82
84 83 /*
85 84 * Door up-call stuff shared with smbd
86 85 */
87 86
88 87 #define SMB_DOOR_HDR_MAGIC 0x444F4F52 /* DOOR */
89 88
90 89 /*
91 90 * Door header flags.
92 91 */
93 92 #define SMB_DF_ASYNC 0x00000001 /* Asynchronous call */
94 93 #define SMB_DF_SYSSPACE 0x00000002 /* Called from the kernel */
95 94 #define SMB_DF_USERSPACE 0x00000004 /* Called from user space */
96 95 #define SMB_DF_FAKE_KERNEL 0x00000008 /* Called from fake kernel */
97 96
98 97 /*
99 98 * Header for door calls. The op codes and return codes are defined
100 99 * in smb_door.h. The header is here to make it available to XDR.
101 100 *
102 101 * fid For opipe: the pipe identifier.
103 102 * op The door operation being invoked.
104 103 * txid Unique transaction id for the current door call.
105 104 * datalen Bytes of data following the header (excludes the header).
106 105 * resid For opipe: the number of bytes remaining in the server.
107 106 * door_rc Return code provided by the door server.
108 107 * status A pass-through status provided by the door operation.
109 108 *
110 109 * See also: smb_doorhdr_xdr()
111 110 */
112 111 typedef struct smb_doorhdr {
113 112 uint32_t dh_magic;
114 113 uint32_t dh_flags;
115 114 uint32_t dh_fid;
116 115 uint32_t dh_op;
117 116 uint32_t dh_txid;
118 117 uint32_t dh_datalen;
119 118 uint32_t dh_resid;
120 119 uint32_t dh_door_rc;
|
↓ open down ↓ |
66 lines elided |
↑ open up ↑ |
121 120 uint32_t dh_status;
122 121 } smb_doorhdr_t;
123 122
124 123 /*
125 124 * Information about the client of a named pipe, provided by smbsrv
126 125 * to the server side of the named pipe (the RPC service).
127 126 * See also: smb_netuserinfo_xdr()
128 127 */
129 128 typedef struct smb_netuserinfo {
130 129 uint64_t ui_session_id;
131 - uint16_t ui_smb_uid;
132 130 uint16_t ui_domain_len;
133 131 char *ui_domain;
134 132 uint16_t ui_account_len;
135 133 char *ui_account;
136 134 uid_t ui_posix_uid;
137 135 uint16_t ui_workstation_len;
138 136 char *ui_workstation;
139 137 smb_inaddr_t ui_ipaddr;
140 138 int32_t ui_native_os;
141 139 int64_t ui_logon_time;
142 140 uint32_t ui_numopens;
143 141 uint32_t ui_flags;
144 142 } smb_netuserinfo_t;
145 143
146 144 typedef struct smb_opennum {
147 145 uint32_t open_users;
148 146 uint32_t open_trees;
149 147 uint32_t open_files;
150 148 uint32_t qualtype;
151 149 char qualifier[MAXNAMELEN];
152 150 } smb_opennum_t;
153 151
154 152 /*
155 153 * SMB (internal) representation of a tree connection (etc.)
156 154 * See also: smb_netconnectinfo_xdr()
157 155 */
158 156 typedef struct smb_netconnectinfo {
159 157 uint32_t ci_id;
160 158 uint32_t ci_type;
161 159 uint32_t ci_numopens;
162 160 uint32_t ci_numusers;
163 161 uint32_t ci_time;
164 162 uint32_t ci_namelen;
165 163 uint32_t ci_sharelen;
166 164 char *ci_username;
167 165 char *ci_share;
168 166 } smb_netconnectinfo_t;
169 167
170 168 /*
171 169 * SMB (internal) representation of an open file.
172 170 * See also: smb_netfileinfo_xdr()
173 171 */
174 172 typedef struct smb_netfileinfo {
175 173 uint16_t fi_fid;
176 174 uint32_t fi_uniqid;
177 175 uint32_t fi_permissions;
178 176 uint32_t fi_numlocks;
179 177 uint32_t fi_pathlen;
180 178 uint32_t fi_namelen;
181 179 char *fi_path;
182 180 char *fi_username;
183 181 } smb_netfileinfo_t;
184 182
185 183 typedef struct smb_netsvcitem {
186 184 list_node_t nsi_lnd;
187 185 union {
188 186 smb_netuserinfo_t nsi_user;
189 187 smb_netconnectinfo_t nsi_tree;
190 188 smb_netfileinfo_t nsi_ofile;
191 189 } nsi_un;
192 190 } smb_netsvcitem_t;
193 191
194 192 typedef struct smb_netsvc {
195 193 list_t ns_list;
196 194 smb_netsvcitem_t *ns_items;
197 195 smb_ioc_svcenum_t *ns_ioc;
198 196 uint32_t ns_ioclen;
199 197 } smb_netsvc_t;
200 198
201 199
202 200 bool_t smb_buf32_xdr(XDR *, struct smb_buf32 *);
203 201 bool_t smb_string_xdr(XDR *, smb_string_t *);
204 202 bool_t smb_inaddr_xdr(XDR *, smb_inaddr_t *);
205 203
206 204 const char *smb_doorhdr_opname(uint32_t);
207 205 int smb_doorhdr_encode(smb_doorhdr_t *, uint8_t *, uint32_t);
208 206 int smb_doorhdr_decode(smb_doorhdr_t *, uint8_t *, uint32_t);
209 207 bool_t smb_doorhdr_xdr(XDR *xdrs, smb_doorhdr_t *objp);
210 208 int smb_netuserinfo_encode(smb_netuserinfo_t *, uint8_t *, uint32_t, uint_t *);
211 209 int smb_netuserinfo_decode(smb_netuserinfo_t *, uint8_t *, uint32_t, uint_t *);
212 210 bool_t smb_netuserinfo_xdr(XDR *, smb_netuserinfo_t *);
213 211 int smb_netconnectinfo_encode(smb_netconnectinfo_t *, uint8_t *, uint32_t,
214 212 uint_t *);
215 213 int smb_netconnectinfo_decode(smb_netconnectinfo_t *, uint8_t *, uint32_t,
216 214 uint_t *);
217 215 bool_t smb_netconnectinfo_xdr(XDR *, smb_netconnectinfo_t *);
218 216 int smb_netfileinfo_encode(smb_netfileinfo_t *, uint8_t *, uint32_t, uint_t *);
219 217 int smb_netfileinfo_decode(smb_netfileinfo_t *, uint8_t *, uint32_t, uint_t *);
220 218 bool_t smb_netfileinfo_xdr(XDR *, smb_netfileinfo_t *);
221 219
222 220 typedef uint16_t sid_type_t;
223 221
224 222 typedef struct lsa_account {
225 223 ntstatus_t a_status;
226 224 sid_type_t a_sidtype;
227 225 char a_domain[MAXNAMELEN];
228 226 char a_name[MAXNAMELEN];
229 227 char a_sid[SMB_SID_STRSZ];
230 228 } lsa_account_t;
231 229
232 230 int lsa_account_encode(lsa_account_t *, uint8_t *, uint32_t);
233 231 int lsa_account_decode(lsa_account_t *, uint8_t *, uint32_t);
234 232 bool_t lsa_account_xdr(XDR *, lsa_account_t *);
235 233
236 234 /*
237 235 * VSS Door Structures
238 236 */
239 237 #define SMB_VSS_GMT_SIZE sizeof ("@GMT-yyyy.mm.dd-hh.mm.ss")
240 238
241 239 /*
242 240 * Args for enumerating "previous versions".
243 241 * See also: smb_gmttoken_query_xdr()
244 242 */
245 243 typedef struct smb_gmttoken_query {
246 244 uint32_t gtq_count;
247 245 char *gtq_path;
248 246 } smb_gmttoken_query_t;
249 247
250 248 /*
251 249 * Part of response for enumerating "previous versions".
252 250 * See also: smb_gmttoken_xdr()
253 251 */
254 252 typedef char *smb_gmttoken_t;
255 253
256 254 /*
257 255 * Response for enumerating "previous versions".
258 256 * See also: smb_gmttoken_response_xdr()
259 257 */
260 258 typedef struct smb_gmttoken_response {
261 259 uint32_t gtr_count;
262 260 struct {
263 261 uint_t gtr_gmttokens_len;
264 262 smb_gmttoken_t *gtr_gmttokens_val;
265 263 } gtr_gmttokens;
266 264 } smb_gmttoken_response_t;
267 265
268 266 /*
269 267 * Args to lookup "previous versions" during open.
270 268 * See also: smb_gmttoken_snapname_xdr()
271 269 */
272 270 typedef struct smb_gmttoken_snapname {
273 271 char *gts_path;
274 272 char *gts_gmttoken;
275 273 uint64_t gts_toktime; /* seconds */
276 274 } smb_gmttoken_snapname_t;
277 275
278 276 bool_t smb_gmttoken_query_xdr(XDR *, smb_gmttoken_query_t *);
279 277 bool_t smb_gmttoken_response_xdr(XDR *, smb_gmttoken_response_t *);
280 278 bool_t smb_gmttoken_snapname_xdr(XDR *, smb_gmttoken_snapname_t *);
281 279
282 280 /*
283 281 * User and Group Quotas
284 282 *
285 283 * SMB User and Group quota values of SMB_QUOTA_UNLIMITED mean
286 284 * No Limit. This maps to 0 (none) on ZFS.
287 285 */
288 286 #define SMB_QUOTA_UNLIMITED 0xFFFFFFFFFFFFFFFF
289 287
290 288 /*
291 289 * SMB (internal) representation of a quota response
292 290 * See also: smb_quota_xdr()
293 291 */
294 292 typedef struct smb_quota {
295 293 list_node_t q_list_node;
296 294 char q_sidstr[SMB_SID_STRSZ];
297 295 uint32_t q_sidtype;
298 296 uint64_t q_used;
299 297 uint64_t q_thresh;
300 298 uint64_t q_limit;
301 299 avl_node_t q_avl_node;
302 300 } smb_quota_t;
303 301
304 302 /*
305 303 * Part of a quota response
306 304 * See also: smb_quota_sid_xdr()
307 305 */
308 306 typedef struct smb_quota_sid {
309 307 list_node_t qs_list_node;
310 308 char qs_sidstr[SMB_SID_STRSZ];
311 309 } smb_quota_sid_t;
312 310
313 311 typedef enum {
314 312 SMB_QUOTA_QUERY_INVALID_OP,
315 313 SMB_QUOTA_QUERY_SIDLIST,
316 314 SMB_QUOTA_QUERY_STARTSID,
317 315 SMB_QUOTA_QUERY_ALL
318 316 } smb_quota_query_op_t;
319 317
320 318 /*
321 319 * SMB (internal) form of a quota lookup
322 320 * See also: smb_quota_query_xdr()
323 321 */
324 322 typedef struct smb_quota_query {
325 323 char *qq_root_path;
326 324 uint32_t qq_query_op; /* smb_quota_query_op_t */
327 325 bool_t qq_single;
328 326 bool_t qq_restart;
329 327 uint32_t qq_max_quota;
330 328 list_t qq_sid_list; /* list of smb_quota_sid_t */
331 329 } smb_quota_query_t;
332 330
333 331 /*
334 332 * The get quota response (list of quota records)
335 333 * See also: smb_quota_response_xdr()
336 334 */
337 335 typedef struct smb_quota_response {
338 336 uint32_t qr_status;
339 337 list_t qr_quota_list; /* list of smb_quota_t */
340 338 } smb_quota_response_t;
341 339
342 340 /*
343 341 * The set quota request (list of quota records)
344 342 * See also: smb_quota_set_xdr()
345 343 */
346 344 typedef struct smb_quota_set {
347 345 char *qs_root_path;
348 346 list_t qs_quota_list; /* list of smb_quota_t */
349 347 } smb_quota_set_t;
350 348
351 349 bool_t smb_quota_query_xdr(XDR *, smb_quota_query_t *);
352 350 bool_t smb_quota_response_xdr(XDR *, smb_quota_response_t *);
353 351 bool_t smb_quota_set_xdr(XDR *, smb_quota_set_t *);
354 352
355 353 typedef struct dfs_referral_query {
356 354 dfs_reftype_t rq_type;
357 355 char *rq_path;
358 356 } dfs_referral_query_t;
359 357
360 358 typedef struct dfs_referral_response {
361 359 dfs_info_t rp_referrals;
362 360 uint32_t rp_status;
363 361 } dfs_referral_response_t;
364 362
365 363 bool_t dfs_referral_query_xdr(XDR *, dfs_referral_query_t *);
366 364 bool_t dfs_referral_response_xdr(XDR *, dfs_referral_response_t *);
367 365
368 366 typedef struct smb_shr_hostaccess_query {
369 367 char *shq_none;
370 368 char *shq_ro;
371 369 char *shq_rw;
372 370 uint32_t shq_flag;
373 371 smb_inaddr_t shq_ipaddr;
374 372 } smb_shr_hostaccess_query_t;
375 373
376 374 bool_t smb_shr_hostaccess_query_xdr(XDR *, smb_shr_hostaccess_query_t *);
377 375 bool_t smb_shr_execinfo_xdr(XDR *, smb_shr_execinfo_t *);
378 376
379 377 #ifdef __cplusplus
380 378 }
381 379 #endif
382 380
383 381 #endif /* _SMBSRV_SMB_XDR_H */
|
↓ open down ↓ |
242 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX