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 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* 27 * Structures and type definitions for the SMB module. 28 */ 29 30 #ifndef _SMBSRV_SMB_KTYPES_H 31 #define _SMBSRV_SMB_KTYPES_H 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #include <sys/note.h> 38 #include <sys/systm.h> 39 #include <sys/param.h> 40 #include <sys/types.h> 41 #include <sys/synch.h> 42 #include <sys/taskq.h> 43 #include <sys/socket.h> 44 #include <sys/acl.h> 45 #include <sys/sdt.h> 46 #include <sys/stat.h> 47 #include <sys/vnode.h> 48 #include <sys/cred.h> 49 #include <sys/fem.h> 50 #include <sys/door.h> 51 #include <smbsrv/smb.h> 52 #include <smbsrv/smbinfo.h> 53 #include <smbsrv/mbuf.h> 54 #include <smbsrv/smb_sid.h> 55 #include <smbsrv/smb_xdr.h> 56 #include <smbsrv/netbios.h> 57 #include <smbsrv/smb_vops.h> 58 #include <smbsrv/mlsvc.h> 59 60 struct smb_request; 61 struct smb_server; 62 struct smb_sd; 63 64 int smb_noop(void *, size_t, int); 65 66 #define SMB_AUDIT_STACK_DEPTH 16 67 #define SMB_AUDIT_BUF_MAX_REC 16 68 #define SMB_AUDIT_NODE 0x00000001 69 70 /* 71 * Maximum number of records returned in SMBsearch, SMBfind 72 * and SMBfindunique response. Value set to 10 for compatibility 73 * with Windows. 74 */ 75 #define SMB_MAX_SEARCH 10 76 77 #define SMB_SEARCH_HIDDEN(sattr) ((sattr) & FILE_ATTRIBUTE_HIDDEN) 78 #define SMB_SEARCH_SYSTEM(sattr) ((sattr) & FILE_ATTRIBUTE_SYSTEM) 79 #define SMB_SEARCH_DIRECTORY(sattr) ((sattr) & FILE_ATTRIBUTE_DIRECTORY) 80 81 82 extern uint32_t smb_audit_flags; 83 84 typedef struct { 85 uint32_t anr_refcnt; 86 int anr_depth; 87 pc_t anr_stack[SMB_AUDIT_STACK_DEPTH]; 88 } smb_audit_record_node_t; 89 90 typedef struct { 91 int anb_index; 92 int anb_max_index; 93 smb_audit_record_node_t anb_records[SMB_AUDIT_BUF_MAX_REC]; 94 } smb_audit_buf_node_t; 95 96 #define SMB_WORKER_PRIORITY 99 97 /* 98 * Thread State Machine 99 * -------------------- 100 * 101 * T5 T0 102 * smb_thread_destroy() <-------+ +------- smb_thread_init() 103 * | | 104 * | v 105 * +-----------------------------+ 106 * | SMB_THREAD_STATE_EXITED |<---+ 107 * +-----------------------------+ | 108 * | T1 | 109 * v | 110 * +-----------------------------+ | 111 * | SMB_THREAD_STATE_STARTING | | 112 * +-----------------------------+ | 113 * | T2 | T4 114 * v | 115 * +-----------------------------+ | 116 * | SMB_THREAD_STATE_RUNNING | | 117 * +-----------------------------+ | 118 * | T3 | 119 * v | 120 * +-----------------------------+ | 121 * | SMB_THREAD_STATE_EXITING |----+ 122 * +-----------------------------+ 123 * 124 * Transition T0 125 * 126 * This transition is executed in smb_thread_init(). 127 * 128 * Transition T1 129 * 130 * This transition is executed in smb_thread_start(). 131 * 132 * Transition T2 133 * 134 * This transition is executed by the thread itself when it starts running. 135 * 136 * Transition T3 137 * 138 * This transition is executed by the thread itself in 139 * smb_thread_entry_point() just before calling thread_exit(). 140 * 141 * 142 * Transition T4 143 * 144 * This transition is executed in smb_thread_stop(). 145 * 146 * Transition T5 147 * 148 * This transition is executed in smb_thread_destroy(). 149 * 150 * Comments 151 * -------- 152 * 153 * The field smb_thread_aw_t contains a function pointer that knows how to 154 * awake the thread. It is a temporary solution to work around the fact that 155 * kernel threads (not part of a userspace process) cannot be signaled. 156 */ 157 typedef enum smb_thread_state { 158 SMB_THREAD_STATE_STARTING = 0, 159 SMB_THREAD_STATE_RUNNING, 160 SMB_THREAD_STATE_EXITING, 161 SMB_THREAD_STATE_EXITED 162 } smb_thread_state_t; 163 164 struct _smb_thread; 165 166 typedef void (*smb_thread_ep_t)(struct _smb_thread *, void *ep_arg); 167 typedef void (*smb_thread_aw_t)(struct _smb_thread *, void *aw_arg); 168 169 #define SMB_THREAD_MAGIC 0x534D4254 /* SMBT */ 170 171 typedef struct _smb_thread { 172 uint32_t sth_magic; 173 char sth_name[16]; 174 smb_thread_state_t sth_state; 175 kthread_t *sth_th; 176 kt_did_t sth_did; 177 smb_thread_ep_t sth_ep; 178 void *sth_ep_arg; 179 smb_thread_aw_t sth_aw; 180 void *sth_aw_arg; 181 boolean_t sth_kill; 182 kmutex_t sth_mtx; 183 kcondvar_t sth_cv; 184 } smb_thread_t; 185 186 /* 187 * Pool of IDs 188 * ----------- 189 * 190 * A pool of IDs is a pool of 16 bit numbers. It is implemented as a bitmap. 191 * A bit set to '1' indicates that that particular value has been allocated. 192 * The allocation process is done shifting a bit through the whole bitmap. 193 * The current position of that index bit is kept in the smb_idpool_t 194 * structure and represented by a byte index (0 to buffer size minus 1) and 195 * a bit index (0 to 7). 196 * 197 * The pools start with a size of 8 bytes or 64 IDs. Each time the pool runs 198 * out of IDs its current size is doubled until it reaches its maximum size 199 * (8192 bytes or 65536 IDs). The IDs 0 and 65535 are never given out which 200 * means that a pool can have a maximum number of 65534 IDs available. 201 */ 202 #define SMB_IDPOOL_MAGIC 0x4944504C /* IDPL */ 203 #define SMB_IDPOOL_MIN_SIZE 64 /* Number of IDs to begin with */ 204 #define SMB_IDPOOL_MAX_SIZE 64 * 1024 205 206 typedef struct smb_idpool { 207 uint32_t id_magic; 208 kmutex_t id_mutex; 209 uint8_t *id_pool; 210 uint32_t id_size; 211 uint8_t id_bit; 212 uint8_t id_bit_idx; 213 uint32_t id_idx; 214 uint32_t id_idx_msk; 215 uint32_t id_free_counter; 216 uint32_t id_max_free_counter; 217 } smb_idpool_t; 218 219 /* 220 * Maximum size of a Transport Data Unit 221 * 4 --> NBT/TCP Transport Header. 222 * 32 --> SMB Header 223 * 1 --> Word Count byte 224 * 510 --> Maximum Number of bytes of the Word Table (2 * 255) 225 * 2 --> Byte count of the data 226 * 65535 --> Maximum size of the data 227 * ----- 228 * 66084 229 */ 230 #define SMB_REQ_MAX_SIZE 66080 231 #define SMB_XPRT_MAX_SIZE (SMB_REQ_MAX_SIZE + NETBIOS_HDR_SZ) 232 233 #define SMB_TXREQ_MAGIC 0X54524251 /* 'TREQ' */ 234 typedef struct { 235 uint32_t tr_magic; 236 list_node_t tr_lnd; 237 int tr_len; 238 uint8_t tr_buf[SMB_XPRT_MAX_SIZE]; 239 } smb_txreq_t; 240 241 #define SMB_TXLST_MAGIC 0X544C5354 /* 'TLST' */ 242 typedef struct { 243 uint32_t tl_magic; 244 kmutex_t tl_mutex; 245 boolean_t tl_active; 246 list_t tl_list; 247 } smb_txlst_t; 248 249 /* 250 * Maximum buffer size for NT is 37KB. If all clients are Windows 2000, this 251 * can be changed to 64KB. 37KB must be used with a mix of NT/Windows 2000 252 * clients because NT loses directory entries when values greater than 37KB are 253 * used. 254 * 255 * Note: NBT_MAXBUF will be subtracted from the specified max buffer size to 256 * account for the NBT header. 257 */ 258 #define NBT_MAXBUF 8 259 #define SMB_NT_MAXBUF (37 * 1024) 260 261 #define OUTBUFSIZE (65 * 1024) 262 #define SMBHEADERSIZE 32 263 #define SMBND_HASH_MASK (0xFF) 264 #define MAX_IOVEC 512 265 #define MAX_READREF (8 * 1024) 266 267 #define SMB_WORKER_MIN 4 268 #define SMB_WORKER_DEFAULT 64 269 #define SMB_WORKER_MAX 1024 270 271 /* 272 * Fix align a pointer or offset appropriately so that fields will not 273 * cross word boundaries. 274 */ 275 #define PTRALIGN(x) \ 276 (((uintptr_t)(x) + (uintptr_t)(_POINTER_ALIGNMENT) - 1l) & \ 277 ~((uintptr_t)(_POINTER_ALIGNMENT) - 1l)) 278 279 /* 280 * native os types are defined in win32/smbinfo.h 281 */ 282 283 /* 284 * All 4 different time / date formats that will bee seen in SMB 285 */ 286 typedef struct { 287 uint16_t Day : 5; 288 uint16_t Month : 4; 289 uint16_t Year : 7; 290 } SMB_DATE; 291 292 typedef struct { 293 uint16_t TwoSeconds : 5; 294 uint16_t Minutes : 6; 295 uint16_t Hours : 5; 296 } SMB_TIME; 297 298 299 typedef uint32_t UTIME; /* seconds since Jan 1 1970 */ 300 301 typedef struct smb_malloc_list { 302 struct smb_malloc_list *forw; 303 struct smb_malloc_list *back; 304 } smb_malloc_list; 305 306 typedef struct smb_llist { 307 krwlock_t ll_lock; 308 list_t ll_list; 309 uint32_t ll_count; 310 uint64_t ll_wrop; 311 } smb_llist_t; 312 313 typedef struct smb_slist { 314 kmutex_t sl_mutex; 315 kcondvar_t sl_cv; 316 list_t sl_list; 317 uint32_t sl_count; 318 boolean_t sl_waiting; 319 } smb_slist_t; 320 321 typedef struct smb_session_list { 322 krwlock_t se_lock; 323 uint64_t se_wrop; 324 struct { 325 list_t lst; 326 uint32_t count; 327 } se_rdy; 328 struct { 329 list_t lst; 330 uint32_t count; 331 } se_act; 332 } smb_session_list_t; 333 334 typedef struct { 335 kcondvar_t rwx_cv; 336 kmutex_t rwx_mutex; 337 krwlock_t rwx_lock; 338 boolean_t rwx_waiting; 339 } smb_rwx_t; 340 341 /* NOTIFY CHANGE */ 342 343 typedef struct smb_notify_change_req { 344 list_node_t nc_lnd; 345 struct smb_node *nc_node; 346 uint32_t nc_reply_type; 347 uint32_t nc_flags; 348 } smb_notify_change_req_t; 349 350 /* 351 * SMB operates over a NetBIOS-over-TCP transport (NBT) or directly 352 * over TCP, which is also known as direct hosted NetBIOS-less SMB 353 * or SMB-over-TCP. 354 * 355 * NBT messages have a 4-byte header that defines the message type 356 * (8-bits), a 7-bit flags field and a 17-bit length. 357 * 358 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 359 * | TYPE | FLAGS |E| LENGTH | 360 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 361 * 362 * 8-bit type Defined in RFC 1002 363 * 7-bit flags Bits 0-6 reserved (must be 0) 364 * Bit 7: Length extension bit (E) 365 * 17-bit length Includes bit 7 of the flags byte 366 * 367 * 368 * SMB-over-TCP is defined to use a modified version of the NBT header 369 * containing an 8-bit message type and 24-bit message length. 370 * 371 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 372 * | TYPE | LENGTH | 373 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 374 * 375 * 8-bit type Must be 0 376 * 24-bit length 377 * 378 * The following structure is used to represent a generic, in-memory 379 * SMB transport header; it is not intended to map directly to either 380 * of the over-the-wire formats. 381 */ 382 typedef struct { 383 uint8_t xh_type; 384 uint32_t xh_length; 385 } smb_xprt_t; 386 387 int MBC_LENGTH(struct mbuf_chain *); 388 int MBC_MAXBYTES(struct mbuf_chain *); 389 void MBC_SETUP(struct mbuf_chain *, uint32_t); 390 void MBC_INIT(struct mbuf_chain *, uint32_t); 391 void MBC_FLUSH(struct mbuf_chain *); 392 void MBC_ATTACH_MBUF(struct mbuf_chain *, struct mbuf *); 393 void MBC_APPEND_MBUF(struct mbuf_chain *, struct mbuf *); 394 void MBC_ATTACH_BUF(struct mbuf_chain *MBC, unsigned char *BUF, int LEN); 395 int MBC_SHADOW_CHAIN(struct mbuf_chain *SUBMBC, struct mbuf_chain *MBC, 396 int OFF, int LEN); 397 398 #define MBC_ROOM_FOR(b, n) (((b)->chain_offset + (n)) <= (b)->max_bytes) 399 400 typedef struct smb_oplock { 401 struct smb_ofile *op_ofile; 402 uint32_t op_flags; 403 uint32_t op_ipaddr; 404 uint64_t op_kid; 405 } smb_oplock_t; 406 407 #define OPLOCK_FLAG_BREAKING 1 408 409 #define OPLOCK_RELEASE_LOCK_RELEASED 0 410 #define OPLOCK_RELEASE_FILE_CLOSED 1 411 412 #define DOS_ATTR_VALID 0x80000000 413 414 #define SMB_VFS_MAGIC 0x534D4256 /* 'SMBV' */ 415 416 typedef struct smb_vfs { 417 uint32_t sv_magic; 418 list_node_t sv_lnd; 419 uint32_t sv_refcnt; 420 vfs_t *sv_vfsp; 421 vnode_t *sv_rootvp; 422 } smb_vfs_t; 423 424 typedef struct smb_unexport { 425 list_node_t ux_lnd; 426 char ux_sharename[MAXNAMELEN]; 427 } smb_unexport_t; 428 429 #define SMB_NODE_MAGIC 0x4E4F4445 /* 'NODE' */ 430 431 typedef enum { 432 SMB_NODE_STATE_AVAILABLE = 0, 433 SMB_NODE_STATE_DESTROYING 434 } smb_node_state_t; 435 436 typedef struct smb_node { 437 uint32_t n_magic; 438 smb_rwx_t n_lock; 439 krwlock_t n_share_lock; 440 list_node_t n_lnd; 441 smb_node_state_t n_state; 442 uint32_t n_refcnt; 443 uint32_t n_hashkey; 444 struct smb_request *n_sr; 445 kmem_cache_t *n_cache; 446 smb_llist_t *n_hash_bucket; 447 uint64_t n_orig_session_id; 448 uint32_t n_orig_uid; 449 smb_llist_t n_ofile_list; 450 smb_llist_t n_lock_list; 451 struct smb_ofile *readonly_creator; 452 volatile int flags; /* FILE_NOTIFY_CHANGE_* */ 453 volatile int waiting_event; /* # of clients requesting FCN */ 454 smb_attr_t attr; 455 unsigned int what; 456 u_offset_t n_size; 457 smb_oplock_t n_oplock; 458 struct smb_node *dir_snode; /* Directory of node */ 459 struct smb_node *unnamed_stream_node; /* set in stream nodes */ 460 /* Credentials for delayed delete */ 461 cred_t *delete_on_close_cred; 462 char od_name[MAXNAMELEN]; 463 vnode_t *vp; 464 smb_audit_buf_node_t *n_audit_buf; 465 } smb_node_t; 466 467 #define NODE_FLAGS_NOTIFY_CHANGE 0x10000fff 468 #define NODE_OPLOCKS_IN_FORCE 0x0000f000 469 #define NODE_OPLOCK_NONE 0x00000000 470 #define NODE_EXCLUSIVE_OPLOCK 0x00001000 471 #define NODE_BATCH_OPLOCK 0x00002000 472 #define NODE_LEVEL_II_OPLOCK 0x00003000 473 #define NODE_CAP_LEVEL_II 0x00010000 474 #define NODE_PROTOCOL_LOCK 0x00020000 475 #define NODE_FLAGS_WRITE_THROUGH 0x00100000 476 #define NODE_FLAGS_SYNCATIME 0x00200000 477 #define NODE_FLAGS_LOCKED 0x00400000 478 #define NODE_FLAGS_ATTR_VALID 0x00800000 479 #define NODE_XATTR_DIR 0x01000000 480 #define NODE_FLAGS_CREATED 0x04000000 481 #define NODE_FLAGS_CHANGED 0x08000000 482 #define NODE_FLAGS_WATCH_TREE 0x10000000 483 #define NODE_FLAGS_SET_SIZE 0x20000000 484 #define NODE_FLAGS_DELETE_ON_CLOSE 0x40000000 485 #define NODE_FLAGS_EXECUTABLE 0x80000000 486 487 #define OPLOCK_TYPE(n) ((n)->flags & NODE_OPLOCKS_IN_FORCE) 488 #define OPLOCKS_IN_FORCE(n) (OPLOCK_TYPE(n) != NODE_OPLOCK_NONE) 489 #define EXCLUSIVE_OPLOCK_IN_FORCE(n) \ 490 (OPLOCK_TYPE(n) == NODE_EXCLUSIVE_OPLOCK) 491 #define BATCH_OPLOCK_IN_FORCE(n) (OPLOCK_TYPE(n) == NODE_BATCH_OPLOCK) 492 #define LEVEL_II_OPLOCK_IN_FORCE(n) (OPLOCK_TYPE(n) == NODE_LEVEL_II_OPLOCK) 493 494 #define SMB_NODE_VFS(node) ((node)->vp->v_vfsp) 495 #define SMB_NODE_FSID(node) ((node)->vp->v_vfsp->vfs_fsid) 496 497 /* 498 * Based on section 2.6.1.2 (Connection Management) of the June 13, 499 * 1996 CIFS spec, a server may terminate the transport connection 500 * due to inactivity. The client software is expected to be able to 501 * automatically reconnect to the server if this happens. Like much 502 * of the useful background information, this section appears to 503 * have been dropped from later revisions of the document. 504 * 505 * Each session has an activity timestamp that's updated whenever a 506 * request is dispatched. If the session is idle, i.e. receives no 507 * requests, for SMB_SESSION_INACTIVITY_TIMEOUT minutes it will be 508 * closed. 509 * 510 * Each session has an I/O semaphore to serialize communication with 511 * the client. For example, after receiving a raw-read request, the 512 * server is not allowed to send an oplock break to the client until 513 * after it has sent the raw-read data. 514 */ 515 #define SMB_SESSION_INACTIVITY_TIMEOUT (15 * 60) 516 517 #define SMB_SESSION_OFILE_MAX (16 * 1024) 518 519 /* 520 * When a connection is set up we need to remember both the client 521 * (peer) IP address and the local IP address used to establish the 522 * connection. When a client connects with a vc number of zero, we 523 * are supposed to abort any existing connections with that client 524 * (see notes in smb_negotiate.c and smb_session_setup_andx.c). For 525 * servers with multiple network interfaces or IP aliases, however, 526 * each interface has to be managed independently since the client 527 * is not aware of the server configuration. We have to allow the 528 * client to establish a connection on each interface with a vc 529 * number of zero without aborting the other connections. 530 * 531 * ipaddr: the client (peer) IP address for the session. 532 * local_ipaddr: the local IP address used to connect to the server. 533 */ 534 535 #define SMB_MAC_KEYSZ 512 536 537 struct smb_sign { 538 unsigned int seqnum; 539 unsigned int mackey_len; 540 unsigned int flags; 541 unsigned char mackey[SMB_MAC_KEYSZ]; 542 }; 543 544 #define SMB_SIGNING_ENABLED 1 545 #define SMB_SIGNING_CHECK 2 546 547 /* 548 * Session State Machine 549 * --------------------- 550 * 551 * +-----------------------------+ +------------------------------+ 552 * | SMB_SESSION_STATE_CONNECTED | | SMB_SESSION_STATE_TERMINATED | 553 * +-----------------------------+ +------------------------------+ 554 * T0| ^ 555 * +--------------------+ |T13 556 * v |T14 | 557 * +-------------------------------+ | +--------------------------------+ 558 * | SMB_SESSION_STATE_ESTABLISHED |---+--->| SMB_SESSION_STATE_DISCONNECTED | 559 * +-------------------------------+ +--------------------------------+ 560 * T1| ^ ^ ^ ^ 561 * +----------+ |T9 | | | 562 * v | | | | 563 * +------------------------------+ | | | 564 * | SMB_SESSION_STATE_NEGOTIATED | | | | 565 * +------------------------------+ | | | 566 * ^| ^| | ^ | | | 567 * +----------------+| || | | | | | 568 * |+----------------+ || T7| |T8 | | | 569 * || || | | | | | 570 * || +----------------+| | | | | | 571 * || |+----------------+ | | | | | 572 * || || v | | | | 573 * || || +-----------------------------------+ T10| | | 574 * || || | SMB_SESSION_STATE_OPLOCK_BREAKING |----+ | | 575 * || || +-----------------------------------+ | | 576 * || ||T5 | | 577 * || |+-->+-----------------------------------+ T11| | 578 * || |T6 | SMB_SESSION_STATE_READ_RAW_ACTIVE |------+ | 579 * || +----+-----------------------------------+ | 580 * ||T3 | 581 * |+------->+------------------------------------+ T12| 582 * |T4 | SMB_SESSION_STATE_WRITE_RAW_ACTIVE |-------+ 583 * +---------+------------------------------------+ 584 * 585 * Transition T0 586 * 587 * 588 * 589 * Transition T1 590 * 591 * 592 * 593 * Transition T2 594 * 595 * 596 * 597 * Transition T3 598 * 599 * 600 * 601 * Transition T4 602 * 603 * 604 * 605 * Transition T5 606 * 607 * 608 * 609 * Transition T6 610 * 611 * 612 * 613 * Transition T7 614 * 615 * 616 * 617 * Transition T8 618 * 619 * 620 * 621 * Transition T9 622 * 623 * 624 * 625 * Transition T10 626 * 627 * 628 * 629 * Transition T11 630 * 631 * 632 * 633 * Transition T12 634 * 635 * 636 * 637 * Transition T13 638 * 639 * 640 * 641 * Transition T14 642 * 643 * 644 * 645 */ 646 #define SMB_SESSION_MAGIC 0x53455353 /* 'SESS' */ 647 648 typedef enum { 649 SMB_SESSION_STATE_INITIALIZED = 0, 650 SMB_SESSION_STATE_DISCONNECTED, 651 SMB_SESSION_STATE_CONNECTED, 652 SMB_SESSION_STATE_ESTABLISHED, 653 SMB_SESSION_STATE_NEGOTIATED, 654 SMB_SESSION_STATE_OPLOCK_BREAKING, 655 SMB_SESSION_STATE_WRITE_RAW_ACTIVE, 656 SMB_SESSION_STATE_TERMINATED, 657 SMB_SESSION_STATE_SENTINEL 658 } smb_session_state_t; 659 660 typedef struct smb_session { 661 uint32_t s_magic; 662 smb_rwx_t s_lock; 663 list_node_t s_lnd; 664 uint64_t s_kid; 665 smb_session_state_t s_state; 666 uint32_t s_flags; 667 int s_write_raw_status; 668 kthread_t *s_thread; 669 kt_did_t s_ktdid; 670 smb_kmod_cfg_t s_cfg; 671 kmem_cache_t *s_cache; 672 kmem_cache_t *s_cache_request; 673 struct smb_server *s_server; 674 int32_t s_gmtoff; 675 uint32_t keep_alive; 676 uint64_t opentime; 677 uint16_t vcnumber; 678 uint16_t s_local_port; 679 uint32_t ipaddr; 680 uint32_t local_ipaddr; 681 char workstation[SMB_PI_MAX_HOST]; 682 int dialect; 683 int native_os; 684 uint32_t capabilities; 685 struct smb_sign signing; 686 687 struct sonode *sock; 688 689 smb_slist_t s_req_list; 690 smb_llist_t s_xa_list; 691 smb_llist_t s_user_list; 692 smb_idpool_t s_uid_pool; 693 smb_txlst_t s_txlst; 694 695 volatile uint32_t s_tree_cnt; 696 volatile uint32_t s_file_cnt; 697 volatile uint32_t s_dir_cnt; 698 699 uint16_t secmode; 700 uint32_t sesskey; 701 uint32_t challenge_len; 702 unsigned char challenge_key[8]; 703 unsigned char MAC_key[44]; 704 int64_t activity_timestamp; 705 /* 706 * Maximum negotiated buffer size between SMB client and server 707 * in SMB_SESSION_SETUP_ANDX 708 */ 709 uint16_t smb_msg_size; 710 uchar_t *outpipe_data; 711 int outpipe_datalen; 712 int outpipe_cookie; 713 } smb_session_t; 714 715 #define SMB_USER_MAGIC 0x55534552 /* 'USER' */ 716 717 #define SMB_USER_FLAG_GUEST SMB_ATF_GUEST 718 #define SMB_USER_FLAG_IPC SMB_ATF_ANON 719 #define SMB_USER_FLAG_ADMIN SMB_ATF_ADMIN 720 #define SMB_USER_FLAG_POWER_USER SMB_ATF_POWERUSER 721 #define SMB_USER_FLAG_BACKUP_OPERATOR SMB_ATF_BACKUPOP 722 723 #define SMB_USER_PRIV_TAKE_OWNERSHIP 0x00000001 724 #define SMB_USER_PRIV_BACKUP 0x00000002 725 #define SMB_USER_PRIV_RESTORE 0x00000004 726 #define SMB_USER_PRIV_SECURITY 0x00000008 727 728 729 typedef enum { 730 SMB_USER_STATE_LOGGED_IN = 0, 731 SMB_USER_STATE_LOGGING_OFF, 732 SMB_USER_STATE_LOGGED_OFF, 733 SMB_USER_STATE_SENTINEL 734 } smb_user_state_t; 735 736 typedef struct smb_user { 737 uint32_t u_magic; 738 list_node_t u_lnd; 739 kmutex_t u_mutex; 740 smb_user_state_t u_state; 741 742 struct smb_server *u_server; 743 smb_session_t *u_session; 744 uint16_t u_name_len; 745 char *u_name; 746 uint16_t u_domain_len; 747 char *u_domain; 748 time_t u_logon_time; 749 cred_t *u_cred; 750 751 smb_llist_t u_tree_list; 752 smb_idpool_t u_tid_pool; 753 754 uint32_t u_refcnt; 755 uint32_t u_flags; 756 uint32_t u_privileges; 757 uint16_t u_uid; 758 uint32_t u_audit_sid; 759 } smb_user_t; 760 761 #define SMB_TREE_MAGIC 0x54524545 /* 'TREE' */ 762 763 #define SMB_TYPENAMELEN _ST_FSTYPSZ 764 #define SMB_VOLNAMELEN 32 765 766 #define SMB_TREE_READONLY 0x00000001 767 #define SMB_TREE_SUPPORTS_ACLS 0x00000002 768 #define SMB_TREE_STREAMS 0x00000004 769 #define SMB_TREE_CASEINSENSITIVE 0x00000008 770 #define SMB_TREE_NO_CASESENSITIVE 0x00000010 771 #define SMB_TREE_NO_EXPORT 0x00000020 772 #define SMB_TREE_NO_OPLOCKS 0x00000040 773 #define SMB_TREE_NO_ATIME 0x00000080 774 #define SMB_TREE_XVATTR 0x00000100 775 #define SMB_TREE_DIRENTFLAGS 0x00000200 776 #define SMB_TREE_ACLONCREATE 0x00000400 777 #define SMB_TREE_ACEMASKONACCESS 0x00000800 778 #define SMB_TREE_NFS_MOUNTED 0x00001000 779 780 typedef enum { 781 SMB_TREE_STATE_CONNECTED = 0, 782 SMB_TREE_STATE_DISCONNECTING, 783 SMB_TREE_STATE_DISCONNECTED, 784 SMB_TREE_STATE_SENTINEL 785 } smb_tree_state_t; 786 787 typedef struct smb_tree { 788 uint32_t t_magic; 789 kmutex_t t_mutex; 790 list_node_t t_lnd; 791 smb_tree_state_t t_state; 792 793 struct smb_server *t_server; 794 smb_session_t *t_session; 795 smb_user_t *t_user; 796 smb_node_t *t_snode; 797 798 smb_llist_t t_ofile_list; 799 smb_idpool_t t_fid_pool; 800 801 smb_llist_t t_odir_list; 802 smb_idpool_t t_sid_pool; 803 804 uint32_t t_refcnt; 805 uint32_t t_flags; 806 int32_t t_res_type; 807 uint16_t t_tid; 808 uint16_t t_umask; 809 char t_sharename[MAXNAMELEN]; 810 char t_resource[MAXPATHLEN]; 811 char t_typename[SMB_TYPENAMELEN]; 812 char t_volume[SMB_VOLNAMELEN]; 813 acl_type_t t_acltype; 814 } smb_tree_t; 815 816 #define SMB_TREE_VFS(tree) ((tree)->t_snode->vp->v_vfsp) 817 #define SMB_TREE_FSID(tree) ((tree)->t_snode->vp->v_vfsp->vfs_fsid) 818 819 #define SMB_TREE_IS_READONLY(sr) \ 820 (((sr) && (sr)->tid_tree) ? \ 821 smb_tree_has_feature((sr)->tid_tree, SMB_TREE_READONLY) : 0) 822 823 #define SMB_TREE_IS_CASEINSENSITIVE(sr) \ 824 (((sr) && (sr)->tid_tree) ? \ 825 smb_tree_has_feature((sr)->tid_tree, SMB_TREE_CASEINSENSITIVE) : 0) 826 827 /* 828 * SMB_TREE_CONTAINS_NODE is used to check that a node is in the same 829 * file system as the tree. 830 */ 831 #define SMB_TREE_CONTAINS_NODE(sr, node) \ 832 (((sr) && (sr)->tid_tree) ? \ 833 (SMB_TREE_VFS((sr)->tid_tree) == SMB_NODE_VFS(node)) : 1) 834 835 /* 836 * SMB_NODE_IS_READONLY(node) 837 * 838 * This macro indicates whether the DOS readonly bit is set in the node's 839 * attribute cache. The cache reflects what is on-disk. 840 */ 841 842 #define SMB_NODE_IS_READONLY(node) \ 843 ((node) && (node)->attr.sa_dosattr & FILE_ATTRIBUTE_READONLY) 844 845 /* 846 * SMB_OFILE_IS_READONLY reflects whether an ofile is readonly or not. 847 * The macro takes into account 848 * - the tree readonly state 849 * - the node readonly state 850 * - whether the specified ofile is the readonly creator 851 * The readonly creator has write permission until the ofile is closed. 852 */ 853 854 #define SMB_OFILE_IS_READONLY(of) \ 855 (((of)->f_flags & SMB_OFLAGS_READONLY) || \ 856 SMB_NODE_IS_READONLY((of)->f_node) || \ 857 (((of)->f_node->readonly_creator) && \ 858 ((of)->f_node->readonly_creator != (of)))) 859 860 /* 861 * SMB_PATHFILE_IS_READONLY indicates whether or not a file is 862 * readonly when the caller has a path rather than an ofile. Unlike 863 * SMB_OFILE_IS_READONLY, the caller cannot be the readonly creator, 864 * since that requires an ofile. 865 */ 866 867 #define SMB_PATHFILE_IS_READONLY(sr, node) \ 868 (SMB_TREE_IS_READONLY((sr)) || \ 869 SMB_NODE_IS_READONLY((node)) || \ 870 ((node)->readonly_creator)) 871 872 #define PIPE_STATE_AUTH_VERIFY 0x00000001 873 874 /* 875 * Data structure for SMB_FTYPE_MESG_PIPE ofiles, which is used 876 * at the interface between SMB and NDR RPC. 877 */ 878 typedef struct smb_opipe { 879 kmutex_t p_mutex; 880 kcondvar_t p_cv; 881 char *p_name; 882 uint32_t p_busy; 883 smb_opipe_hdr_t p_hdr; 884 smb_opipe_context_t p_context; 885 uint8_t *p_doorbuf; 886 uint8_t *p_data; 887 } smb_opipe_t; 888 889 /* 890 * The of_ftype of an open file should contain the SMB_FTYPE value 891 * (cifs.h) returned when the file/pipe was opened. The following 892 * assumptions are currently made: 893 * 894 * File Type Node PipeInfo 895 * --------- -------- -------- 896 * SMB_FTYPE_DISK Valid Null 897 * SMB_FTYPE_BYTE_PIPE Undefined Undefined 898 * SMB_FTYPE_MESG_PIPE Null Valid 899 * SMB_FTYPE_PRINTER Undefined Undefined 900 * SMB_FTYPE_UNKNOWN Undefined Undefined 901 */ 902 903 /* 904 * Some flags for ofile structure 905 * 906 * SMB_OFLAGS_SET_DELETE_ON_CLOSE 907 * Set this flag when the corresponding open operation whose 908 * DELETE_ON_CLOSE bit of the CreateOptions is set. If any 909 * open file instance has this bit set, the NODE_FLAGS_DELETE_ON_CLOSE 910 * will be set for the file node upon close. 911 */ 912 913 #define SMB_OFLAGS_READONLY 0x0001 914 #define SMB_OFLAGS_SET_DELETE_ON_CLOSE 0x0004 915 #define SMB_OFLAGS_LLF_POS_VALID 0x0008 916 917 #define SMB_OFILE_MAGIC 0x4F464C45 /* 'OFLE' */ 918 919 typedef enum { 920 SMB_OFILE_STATE_OPEN = 0, 921 SMB_OFILE_STATE_CLOSING, 922 SMB_OFILE_STATE_CLOSED, 923 SMB_OFILE_STATE_SENTINEL 924 } smb_ofile_state_t; 925 926 typedef struct smb_ofile { 927 uint32_t f_magic; 928 kmutex_t f_mutex; 929 list_node_t f_lnd; 930 list_node_t f_nnd; 931 smb_ofile_state_t f_state; 932 933 struct smb_server *f_server; 934 smb_session_t *f_session; 935 smb_user_t *f_user; 936 smb_tree_t *f_tree; 937 smb_node_t *f_node; 938 smb_opipe_t *f_pipe; 939 940 uint32_t f_uniqid; 941 uint32_t f_refcnt; 942 uint64_t f_seek_pos; 943 uint32_t f_flags; 944 uint32_t f_granted_access; 945 uint32_t f_share_access; 946 uint32_t f_create_options; 947 uint16_t f_fid; 948 uint16_t f_opened_by_pid; 949 uint16_t f_ftype; 950 uint64_t f_llf_pos; 951 int f_mode; 952 cred_t *f_cr; 953 pid_t f_pid; 954 } smb_ofile_t; 955 956 /* odir flags bits */ 957 #define SMB_DIR_FLAG_OPEN 0x0001 958 #define SMB_DIR_FLAG_CLOSE 0x0002 959 #define SMB_DIR_CLOSED(dir) ((dir)->d_flags & SMB_DIR_FLAG_CLOSE) 960 961 #define SMB_ODIR_MAGIC 0x4F444952 /* 'ODIR' */ 962 963 typedef enum { 964 SMB_ODIR_STATE_OPEN = 0, 965 SMB_ODIR_STATE_CLOSING, 966 SMB_ODIR_STATE_CLOSED, 967 SMB_ODIR_STATE_SENTINEL 968 } smb_odir_state_t; 969 970 typedef struct smb_odir { 971 uint32_t d_magic; 972 kmutex_t d_mutex; 973 list_node_t d_lnd; 974 smb_odir_state_t d_state; 975 976 smb_session_t *d_session; 977 smb_user_t *d_user; 978 smb_tree_t *d_tree; 979 980 uint32_t d_refcnt; 981 uint32_t d_cookie; 982 uint32_t d_cookies[SMB_MAX_SEARCH]; 983 uint16_t d_sid; 984 uint16_t d_opened_by_pid; 985 uint16_t d_sattr; 986 char d_pattern[MAXNAMELEN]; 987 struct smb_node *d_dir_snode; 988 unsigned int d_wildcards; 989 } smb_odir_t; 990 991 typedef struct smb_odir_context { 992 uint32_t dc_cookie; 993 uint16_t dc_dattr; 994 char dc_name[MAXNAMELEN]; /* Real 'Xxxx.yyy.xx' */ 995 char dc_name83[SMB_SHORTNAMELEN]; /* w/ dot 'XXXX .XX ' */ 996 char dc_shortname[SMB_SHORTNAMELEN]; /* w/ dot 'XXXX.XX' */ 997 smb_attr_t dc_attr; 998 } smb_odir_context_t; 999 1000 #define SMB_LOCK_MAGIC 0x4C4F434B /* 'LOCK' */ 1001 1002 typedef struct smb_lock { 1003 uint32_t l_magic; 1004 kmutex_t l_mutex; 1005 list_node_t l_lnd; 1006 kcondvar_t l_cv; 1007 1008 list_node_t l_conflict_lnd; 1009 smb_slist_t l_conflict_list; 1010 1011 smb_session_t *l_session; 1012 smb_ofile_t *l_file; 1013 struct smb_request *l_sr; 1014 1015 uint32_t l_flags; 1016 uint64_t l_session_kid; 1017 struct smb_lock *l_blocked_by; /* Debug info only */ 1018 1019 uint16_t l_pid; 1020 uint16_t l_uid; 1021 uint32_t l_type; 1022 uint64_t l_start; 1023 uint64_t l_length; 1024 clock_t l_end_time; 1025 } smb_lock_t; 1026 1027 #define SMB_LOCK_FLAG_INDEFINITE 0x0004 1028 #define SMB_LOCK_INDEFINITE_WAIT(lock) \ 1029 ((lock)->l_flags & SMB_LOCK_FLAG_INDEFINITE) 1030 1031 #define SMB_LOCK_TYPE_READWRITE 101 1032 #define SMB_LOCK_TYPE_READONLY 102 1033 1034 typedef struct vardata_block { 1035 uint8_t tag; 1036 uint16_t len; 1037 struct uio uio; 1038 struct iovec iovec[MAX_IOVEC]; 1039 } smb_vdb_t; 1040 1041 #define SMB_RW_MAGIC 0x52445257 /* 'RDRW' */ 1042 1043 typedef struct smb_rw_param { 1044 uint32_t rw_magic; 1045 smb_vdb_t rw_vdb; 1046 uint64_t rw_offset; 1047 uint32_t rw_last_write; 1048 uint16_t rw_mode; 1049 uint16_t rw_count; 1050 uint16_t rw_mincnt; 1051 uint16_t rw_dsoff; /* SMB data offset */ 1052 uint8_t rw_andx; /* SMB secondary andx command */ 1053 } smb_rw_param_t; 1054 1055 struct smb_fqi { /* fs_query_info */ 1056 char *path; 1057 uint16_t srch_attr; 1058 struct smb_node *dir_snode; 1059 smb_attr_t dir_attr; 1060 char last_comp[MAXNAMELEN]; 1061 int last_comp_was_found; 1062 char last_comp_od[MAXNAMELEN]; 1063 struct smb_node *last_snode; 1064 smb_attr_t last_attr; 1065 }; 1066 1067 #define SMB_NULL_FQI_NODES(fqi) \ 1068 (fqi).last_snode = NULL; \ 1069 (fqi).dir_snode = NULL; 1070 1071 #define FQM_DIR_MUST_EXIST 1 1072 #define FQM_PATH_MUST_EXIST 2 1073 #define FQM_PATH_MUST_NOT_EXIST 3 1074 1075 #define MYF_OPLOCK_MASK 0x000000F0 1076 #define MYF_OPLOCK_NONE 0x00000000 1077 #define MYF_EXCLUSIVE_OPLOCK 0x00000010 1078 #define MYF_BATCH_OPLOCK 0x00000020 1079 #define MYF_LEVEL_II_OPLOCK 0x00000030 1080 #define MYF_MUST_BE_DIRECTORY 0x00000100 1081 1082 #define MYF_OPLOCK_TYPE(o) ((o) & MYF_OPLOCK_MASK) 1083 #define MYF_OPLOCKS_REQUEST(o) (MYF_OPLOCK_TYPE(o) != MYF_OPLOCK_NONE) 1084 #define MYF_IS_EXCLUSIVE_OPLOCK(o) (MYF_OPLOCK_TYPE(o) == MYF_EXCLUSIVE_OPLOCK) 1085 #define MYF_IS_BATCH_OPLOCK(o) (MYF_OPLOCK_TYPE(o) == MYF_BATCH_OPLOCK) 1086 #define MYF_IS_LEVEL_II_OPLOCK(o) (MYF_OPLOCK_TYPE(o) == MYF_LEVEL_II_OPLOCK) 1087 1088 #define OPLOCK_MIN_TIMEOUT (5 * 1000) 1089 #define OPLOCK_STD_TIMEOUT (15 * 1000) 1090 #define OPLOCK_RETRIES 2 1091 1092 typedef struct { 1093 uint32_t severity; 1094 uint32_t status; 1095 uint16_t errcls; 1096 uint16_t errcode; 1097 } smb_error_t; 1098 1099 /* 1100 * SMB Request State Machine 1101 * ------------------------- 1102 * 1103 * T4 +------+ T0 1104 * +--------------------------->| FREE |---------------------------+ 1105 * | +------+ | 1106 * +-----------+ | 1107 * | COMPLETED | | 1108 * +-----------+ 1109 * ^ | 1110 * | T15 +----------+ v 1111 * +------------+ T6 | | +--------------+ 1112 * | CLEANED_UP |<-----------------| CANCELED | | INITIALIZING | 1113 * +------------+ | | +--------------+ 1114 * | ^ +----------+ | 1115 * | | ^ ^ ^ ^ | 1116 * | | +-------------+ | | | | 1117 * | | T3 | | | | T13 | T1 1118 * | +-------------------------+ | | +----------------------+ | 1119 * +----------------------------+ | | | | | 1120 * T16 | | | | +-----------+ | | 1121 * | \/ | | T5 | | v 1122 * +-----------------+ | T12 +--------+ | T2 +-----------+ 1123 * | EVENT_OCCURRED |------------->| ACTIVE |<--------------------| SUBMITTED | 1124 * +-----------------+ | +--------+ | +-----------+ 1125 * ^ | | ^ | | 1126 * | | T8 | | | T7 | 1127 * | T10 T9 | +----------+ | +-------+ | T11 1128 * | | | +-------+ | | 1129 * | | | T14 | | | 1130 * | | v | v | 1131 * +----------------------+ +--------------+ 1132 * | WAITING_EVENT | | WAITING_LOCK | 1133 * +----------------------+ +--------------+ 1134 * 1135 * 1136 * 1137 * 1138 * 1139 * Transition T0 1140 * 1141 * This transition occurs when the request is allocated and is still under the 1142 * control of the session thread. 1143 * 1144 * Transition T1 1145 * 1146 * This transition occurs when the session thread dispatches a task to treat the 1147 * request. 1148 * 1149 * Transition T2 1150 * 1151 * 1152 * 1153 * Transition T3 1154 * 1155 * A request completes and smbsr_cleanup is called to release resources 1156 * associated with the request (but not the smb_request_t itself). This 1157 * includes references on smb_ofile_t, smb_node_t, and other structures. 1158 * CLEANED_UP state exists to detect if we attempt to cleanup a request 1159 * multiple times and to allow us to detect that we are accessing a 1160 * request that has already been cleaned up. 1161 * 1162 * Transition T4 1163 * 1164 * 1165 * 1166 * Transition T5 1167 * 1168 * 1169 * 1170 * Transition T6 1171 * 1172 * 1173 * 1174 * Transition T7 1175 * 1176 * 1177 * 1178 * Transition T8 1179 * 1180 * 1181 * 1182 * Transition T9 1183 * 1184 * 1185 * 1186 * Transition T10 1187 * 1188 * 1189 * 1190 * Transition T11 1191 * 1192 * 1193 * 1194 * Transition T12 1195 * 1196 * 1197 * 1198 * Transition T13 1199 * 1200 * 1201 * 1202 * Transition T14 1203 * 1204 * 1205 * 1206 * Transition T15 1207 * 1208 * Request processing is completed (control returns from smb_dispatch) 1209 * 1210 * Transition T16 1211 * 1212 * Multipart (andx) request was cleaned up with smbsr_cleanup but more "andx" 1213 * sections remain to be processed. 1214 * 1215 */ 1216 1217 #define SMB_REQ_MAGIC 0x534D4252 /* 'SMBR' */ 1218 1219 typedef enum smb_req_state { 1220 SMB_REQ_STATE_FREE = 0, 1221 SMB_REQ_STATE_INITIALIZING, 1222 SMB_REQ_STATE_SUBMITTED, 1223 SMB_REQ_STATE_ACTIVE, 1224 SMB_REQ_STATE_WAITING_EVENT, 1225 SMB_REQ_STATE_EVENT_OCCURRED, 1226 SMB_REQ_STATE_WAITING_LOCK, 1227 SMB_REQ_STATE_COMPLETED, 1228 SMB_REQ_STATE_CANCELED, 1229 SMB_REQ_STATE_CLEANED_UP, 1230 SMB_REQ_STATE_SENTINEL 1231 } smb_req_state_t; 1232 1233 typedef struct smb_request { 1234 uint32_t sr_magic; 1235 kmutex_t sr_mutex; 1236 list_node_t sr_session_lnd; 1237 smb_req_state_t sr_state; 1238 boolean_t sr_keep; 1239 kmem_cache_t *sr_cache; 1240 struct smb_server *sr_server; 1241 pid_t *sr_pid; 1242 int32_t sr_gmtoff; 1243 smb_session_t *session; 1244 smb_kmod_cfg_t *sr_cfg; 1245 smb_notify_change_req_t sr_ncr; 1246 1247 /* Info from session service header */ 1248 uint32_t sr_req_length; /* Excluding NBT header */ 1249 1250 /* Request buffer excluding NBT header */ 1251 void *sr_request_buf; 1252 1253 /* Fields for raw writes */ 1254 uint32_t sr_raw_data_length; 1255 void *sr_raw_data_buf; 1256 1257 smb_lock_t *sr_awaiting; 1258 struct mbuf_chain command; 1259 struct mbuf_chain reply; 1260 struct mbuf_chain raw_data; 1261 smb_malloc_list request_storage; 1262 struct smb_xa *r_xa; 1263 int andx_prev_wct; 1264 int cur_reply_offset; 1265 int orig_request_hdr; 1266 unsigned int reply_seqnum; /* reply sequence number */ 1267 unsigned char first_smb_com; /* command code */ 1268 unsigned char smb_com; /* command code */ 1269 1270 uint8_t smb_rcls; /* error code class */ 1271 uint8_t smb_reh; /* rsvd (AH DOS INT-24 ERR) */ 1272 uint16_t smb_err; /* error code */ 1273 smb_error_t smb_error; 1274 1275 uint8_t smb_flg; /* flags */ 1276 uint16_t smb_flg2; /* flags */ 1277 uint16_t smb_pid_high; /* high part of pid */ 1278 unsigned char smb_sig[8]; /* signiture */ 1279 uint16_t smb_tid; /* tree id # */ 1280 uint16_t smb_pid; /* caller's process id # */ 1281 uint16_t smb_uid; /* user id # */ 1282 uint16_t smb_mid; /* mutiplex id # */ 1283 unsigned char smb_wct; /* count of parameter words */ 1284 uint16_t smb_bcc; /* data byte count */ 1285 1286 /* Parameters */ 1287 struct mbuf_chain smb_vwv; /* variable width value */ 1288 1289 /* Data */ 1290 struct mbuf_chain smb_data; 1291 1292 uint16_t smb_fid; /* not in hdr, but common */ 1293 uint16_t smb_sid; /* not in hdr, but common */ 1294 1295 unsigned char andx_com; 1296 uint16_t andx_off; 1297 1298 struct smb_tree *tid_tree; 1299 struct smb_ofile *fid_ofile; 1300 struct smb_odir *sid_odir; 1301 smb_user_t *uid_user; 1302 1303 union { 1304 struct tcon { 1305 char *path; 1306 char *service; 1307 int pwdlen; 1308 char *password; 1309 uint16_t flags; 1310 } tcon; 1311 1312 struct open_param { 1313 struct smb_fqi fqi; 1314 uint16_t omode; 1315 uint16_t oflags; 1316 uint16_t ofun; 1317 uint32_t my_flags; 1318 uint32_t timeo; 1319 uint32_t dattr; 1320 timestruc_t crtime; 1321 timestruc_t mtime; 1322 uint64_t dsize; 1323 uint32_t desired_access; 1324 uint32_t share_access; 1325 uint32_t create_options; 1326 uint32_t create_disposition; 1327 boolean_t created_readonly; 1328 uint32_t ftype, devstate; 1329 uint32_t action_taken; 1330 uint64_t fileid; 1331 uint32_t rootdirfid; 1332 /* This is only set by NTTransactCreate */ 1333 struct smb_sd *sd; 1334 } open; 1335 1336 struct dirop { 1337 struct smb_fqi fqi; 1338 struct smb_fqi dst_fqi; 1339 } dirop; 1340 1341 smb_rw_param_t *rw; 1342 uint32_t timestamp; 1343 } arg; 1344 1345 cred_t *user_cr; 1346 } smb_request_t; 1347 1348 #define SMB_READ_PROTOCOL(smb_nh_ptr) \ 1349 LE_IN32(((smb_nethdr_t *)(smb_nh_ptr))->sh_protocol) 1350 1351 #define SMB_PROTOCOL_MAGIC_INVALID(rd_sr) \ 1352 (SMB_READ_PROTOCOL((rd_sr)->sr_request_buf) != SMB_PROTOCOL_MAGIC) 1353 1354 #define SMB_READ_COMMAND(smb_nh_ptr) \ 1355 (((smb_nethdr_t *)(smb_nh_ptr))->sh_command) 1356 1357 #define SMB_IS_WRITERAW(rd_sr) \ 1358 (SMB_READ_COMMAND((rd_sr)->sr_request_buf) == SMB_COM_WRITE_RAW) 1359 1360 1361 #define SR_FLG_OFFSET 9 1362 1363 #define MAX_TRANS_NAME 64 1364 1365 #define SMB_XA_FLAG_OPEN 0x0001 1366 #define SMB_XA_FLAG_CLOSE 0x0002 1367 #define SMB_XA_FLAG_COMPLETE 0x0004 1368 #define SMB_XA_CLOSED(xa) (!((xa)->xa_flags & SMB_XA_FLAG_OPEN)) 1369 1370 #define SMB_XA_MAGIC 0x534D4258 /* 'SMBX' */ 1371 1372 typedef struct smb_xa { 1373 uint32_t xa_magic; 1374 kmutex_t xa_mutex; 1375 list_node_t xa_lnd; 1376 1377 uint32_t xa_refcnt; 1378 uint32_t xa_flags; 1379 1380 struct smb_session *xa_session; 1381 1382 unsigned char smb_com; /* which TRANS type */ 1383 unsigned char smb_flg; /* flags */ 1384 uint16_t smb_flg2; /* flags */ 1385 uint16_t smb_tid; /* tree id number */ 1386 uint16_t smb_pid; /* caller's process id number */ 1387 uint16_t smb_uid; /* user id number */ 1388 uint32_t smb_func; /* NT_TRANS function */ 1389 1390 uint16_t xa_smb_mid; /* mutiplex id number */ 1391 uint16_t xa_smb_fid; /* TRANS2 secondary */ 1392 1393 unsigned int reply_seqnum; /* reply sequence number */ 1394 1395 uint32_t smb_tpscnt; /* total parameter bytes being sent */ 1396 uint32_t smb_tdscnt; /* total data bytes being sent */ 1397 uint32_t smb_mprcnt; /* max parameter bytes to return */ 1398 uint32_t smb_mdrcnt; /* max data bytes to return */ 1399 uint32_t smb_msrcnt; /* max setup words to return */ 1400 uint32_t smb_flags; /* additional information: */ 1401 /* bit 0 - if set, disconnect TID in smb_tid */ 1402 /* bit 1 - if set, transaction is one way */ 1403 /* (no final response) */ 1404 int32_t smb_timeout; /* number of milliseconds to await completion */ 1405 uint32_t smb_suwcnt; /* set up word count */ 1406 1407 1408 char *xa_smb_trans_name; 1409 1410 int req_disp_param; 1411 int req_disp_data; 1412 1413 struct mbuf_chain req_setup_mb; 1414 struct mbuf_chain req_param_mb; 1415 struct mbuf_chain req_data_mb; 1416 1417 struct mbuf_chain rep_setup_mb; 1418 struct mbuf_chain rep_param_mb; 1419 struct mbuf_chain rep_data_mb; 1420 } smb_xa_t; 1421 1422 1423 #define SDDF_NO_FLAGS 0 1424 #define SDDF_SUPPRESS_TID 0x0001 1425 #define SDDF_SUPPRESS_UID 0x0002 1426 1427 /* 1428 * SMB dispatch return codes. 1429 */ 1430 typedef enum { 1431 SDRC_SUCCESS = 0, 1432 SDRC_ERROR, 1433 SDRC_DROP_VC, 1434 SDRC_NO_REPLY, 1435 SDRC_NOT_IMPLEMENTED 1436 } smb_sdrc_t; 1437 1438 #define VAR_BCC ((short)-1) 1439 1440 #define SMB_SERVER_MAGIC 0x53534552 /* 'SSER' */ 1441 1442 typedef struct { 1443 kstat_named_t open_files; 1444 kstat_named_t open_trees; 1445 kstat_named_t open_users; 1446 } smb_server_stats_t; 1447 1448 typedef struct { 1449 kthread_t *ld_kth; 1450 kt_did_t ld_ktdid; 1451 struct sonode *ld_so; 1452 struct sockaddr_in ld_sin; 1453 smb_session_list_t ld_session_list; 1454 } smb_listener_daemon_t; 1455 1456 typedef enum smb_server_state { 1457 SMB_SERVER_STATE_CREATED = 0, 1458 SMB_SERVER_STATE_CONFIGURED, 1459 SMB_SERVER_STATE_RUNNING, 1460 SMB_SERVER_STATE_DELETING, 1461 SMB_SERVER_STATE_SENTINEL 1462 } smb_server_state_t; 1463 1464 typedef struct smb_server { 1465 uint32_t sv_magic; 1466 kcondvar_t sv_cv; 1467 kmutex_t sv_mutex; 1468 list_node_t sv_lnd; 1469 smb_server_state_t sv_state; 1470 uint32_t sv_refcnt; 1471 pid_t sv_pid; 1472 zoneid_t sv_zid; 1473 smb_listener_daemon_t sv_nbt_daemon; 1474 smb_listener_daemon_t sv_tcp_daemon; 1475 krwlock_t sv_cfg_lock; 1476 smb_kmod_cfg_t sv_cfg; 1477 smb_session_t *sv_session; 1478 1479 kstat_t *sv_ksp; 1480 kmutex_t sv_ksp_mutex; 1481 char sv_ksp_name[KSTAT_STRLEN]; 1482 smb_server_stats_t sv_ks_data; 1483 1484 door_handle_t sv_lmshrd; 1485 1486 int32_t si_gmtoff; 1487 1488 smb_thread_t si_thread_timers; 1489 smb_thread_t si_thread_unexport; 1490 1491 taskq_t *sv_thread_pool; 1492 1493 kmem_cache_t *si_cache_unexport; 1494 kmem_cache_t *si_cache_vfs; 1495 kmem_cache_t *si_cache_request; 1496 kmem_cache_t *si_cache_session; 1497 kmem_cache_t *si_cache_user; 1498 kmem_cache_t *si_cache_tree; 1499 kmem_cache_t *si_cache_ofile; 1500 kmem_cache_t *si_cache_odir; 1501 kmem_cache_t *si_cache_node; 1502 1503 volatile uint32_t sv_open_trees; 1504 volatile uint32_t sv_open_files; 1505 volatile uint32_t sv_open_users; 1506 1507 smb_node_t *si_root_smb_node; 1508 smb_llist_t sv_vfs_list; 1509 smb_slist_t sv_unexport_list; 1510 } smb_server_t; 1511 1512 #define SMB_INFO_NETBIOS_SESSION_SVC_RUNNING 0x0001 1513 #define SMB_INFO_NETBIOS_SESSION_SVC_FAILED 0x0002 1514 #define SMB_INFO_USER_LEVEL_SECURITY 0x40000000 1515 #define SMB_INFO_ENCRYPT_PASSWORDS 0x80000000 1516 1517 #define SMB_NEW_KID() atomic_inc_64_nv(&smb_kids) 1518 #define SMB_UNIQ_FID() atomic_inc_32_nv(&smb_fids) 1519 1520 /* 1521 * This is to be used by Trans2SetFileInfo 1522 * and Trans2SetPathInfo 1523 */ 1524 typedef struct smb_trans2_setinfo { 1525 uint16_t level; 1526 struct smb_xa *ts_xa; 1527 struct smb_node *node; 1528 char *path; 1529 char name[MAXNAMELEN]; 1530 } smb_trans2_setinfo_t; 1531 1532 #define SMB_IS_STREAM(node) ((node)->unnamed_stream_node) 1533 1534 #ifdef DEBUG 1535 extern uint_t smb_tsd_key; 1536 #endif 1537 1538 typedef struct smb_tsd { 1539 void (*proc)(); 1540 void *arg; 1541 char name[100]; 1542 } smb_tsd_t; 1543 1544 #define SMB_INVALID_AMASK -1 1545 #define SMB_INVALID_SHAREMODE -1 1546 #define SMB_INVALID_CRDISPOSITION -1 1547 1548 typedef struct smb_dispatch_table { 1549 smb_sdrc_t (*sdt_pre_op)(smb_request_t *); 1550 smb_sdrc_t (*sdt_function)(smb_request_t *); 1551 void (*sdt_post_op)(smb_request_t *); 1552 char sdt_dialect; 1553 unsigned char sdt_flags; 1554 krw_t sdt_slock_mode; 1555 kstat_named_t sdt_dispatch_stats; /* invocations */ 1556 } smb_dispatch_table_t; 1557 1558 /* 1559 * Discretionary Access Control List (DACL) 1560 * 1561 * A Discretionary Access Control List (DACL), often abbreviated to 1562 * ACL, is a list of access controls which either allow or deny access 1563 * for users or groups to a resource. There is a list header followed 1564 * by a list of access control entries (ACE). Each ACE specifies the 1565 * access allowed or denied to a single user or group (identified by 1566 * a SID). 1567 * 1568 * There is another access control list object called a System Access 1569 * Control List (SACL), which is used to control auditing, but no 1570 * support is provideed for SACLs at this time. 1571 * 1572 * ACL header format: 1573 * 1574 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1575 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 1576 * +-------------------------------+---------------+---------------+ 1577 * | AclSize | Sbz1 | AclRevision | 1578 * +-------------------------------+---------------+---------------+ 1579 * | Sbz2 | AceCount | 1580 * +-------------------------------+-------------------------------+ 1581 * 1582 * AclRevision specifies the revision level of the ACL. This value should 1583 * be ACL_REVISION, unless the ACL contains an object-specific ACE, in which 1584 * case this value must be ACL_REVISION_DS. All ACEs in an ACL must be at the 1585 * same revision level. 1586 * 1587 * ACE header format: 1588 * 1589 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1590 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 1591 * +---------------+-------+-------+---------------+---------------+ 1592 * | AceSize | AceFlags | AceType | 1593 * +---------------+-------+-------+---------------+---------------+ 1594 * 1595 * Access mask format: 1596 * 1597 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1598 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 1599 * +---------------+---------------+-------------------------------+ 1600 * |G|G|G|G|Res'd|A| StandardRights| SpecificRights | 1601 * |R|W|E|A| |S| | | 1602 * +-+-------------+---------------+-------------------------------+ 1603 * 1604 * typedef struct ACCESS_MASK { 1605 * WORD SpecificRights; 1606 * BYTE StandardRights; 1607 * BYTE AccessSystemAcl : 1; 1608 * BYTE Reserved : 3; 1609 * BYTE GenericAll : 1; 1610 * BYTE GenericExecute : 1; 1611 * BYTE GenericWrite : 1; 1612 * BYTE GenericRead : 1; 1613 * } ACCESS_MASK; 1614 * 1615 */ 1616 1617 #define ACL_REVISION1 1 1618 #define ACL_REVISION2 2 1619 #define MIN_ACL_REVISION2 ACL_REVISION2 1620 #define ACL_REVISION3 3 1621 #define ACL_REVISION4 4 1622 #define MAX_ACL_REVISION ACL_REVISION4 1623 1624 /* 1625 * Current ACE and ACL revision Levels 1626 */ 1627 #define ACE_REVISION 1 1628 #define ACL_REVISION ACL_REVISION2 1629 #define ACL_REVISION_DS ACL_REVISION4 1630 1631 1632 #define ACCESS_ALLOWED_ACE_TYPE 0 1633 #define ACCESS_DENIED_ACE_TYPE 1 1634 #define SYSTEM_AUDIT_ACE_TYPE 2 1635 #define SYSTEM_ALARM_ACE_TYPE 3 1636 1637 /* 1638 * se_flags 1639 * ---------- 1640 * Specifies a set of ACE type-specific control flags. This member can be a 1641 * combination of the following values. 1642 * 1643 * CONTAINER_INHERIT_ACE: Child objects that are containers, such as 1644 * directories, inherit the ACE as an effective ACE. The inherited 1645 * ACE is inheritable unless the NO_PROPAGATE_INHERIT_ACE bit flag 1646 * is also set. 1647 * 1648 * INHERIT_ONLY_ACE: Indicates an inherit-only ACE which does not control 1649 * access to the object to which it is attached. 1650 * If this flag is not set, 1651 * the ACE is an effective ACE which controls access to the object 1652 * to which it is attached. 1653 * Both effective and inherit-only ACEs can be inherited 1654 * depending on the state of the other inheritance flags. 1655 * 1656 * INHERITED_ACE: Windows 2000/XP: Indicates that the ACE was inherited. 1657 * The system sets this bit when it propagates an 1658 * inherited ACE to a child object. 1659 * 1660 * NO_PROPAGATE_INHERIT_ACE: If the ACE is inherited by a child object, the 1661 * system clears the OBJECT_INHERIT_ACE and CONTAINER_INHERIT_ACE 1662 * flags in the inherited ACE. 1663 * This prevents the ACE from being inherited by 1664 * subsequent generations of objects. 1665 * 1666 * OBJECT_INHERIT_ACE: Noncontainer child objects inherit the ACE as an 1667 * effective ACE. For child objects that are containers, 1668 * the ACE is inherited as an inherit-only ACE unless the 1669 * NO_PROPAGATE_INHERIT_ACE bit flag is also set. 1670 */ 1671 #define OBJECT_INHERIT_ACE 0x01 1672 #define CONTAINER_INHERIT_ACE 0x02 1673 #define NO_PROPOGATE_INHERIT_ACE 0x04 1674 #define INHERIT_ONLY_ACE 0x08 1675 #define INHERITED_ACE 0x10 1676 #define INHERIT_MASK_ACE 0x1F 1677 1678 1679 /* 1680 * These flags are only used in system audit or alarm ACEs to 1681 * indicate when an audit message should be generated, i.e. 1682 * on successful access or on unsuccessful access. 1683 */ 1684 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40 1685 #define FAILED_ACCESS_ACE_FLAG 0x80 1686 1687 /* 1688 * se_bsize is the size, in bytes, of ACE as it appears on the wire. 1689 * se_sln is used to sort the ACL when it's required. 1690 */ 1691 typedef struct smb_acehdr { 1692 uint8_t se_type; 1693 uint8_t se_flags; 1694 uint16_t se_bsize; 1695 } smb_acehdr_t; 1696 1697 typedef struct smb_ace { 1698 smb_acehdr_t se_hdr; 1699 uint32_t se_mask; 1700 list_node_t se_sln; 1701 smb_sid_t *se_sid; 1702 } smb_ace_t; 1703 1704 /* 1705 * sl_bsize is the size of ACL in bytes as it appears on the wire. 1706 */ 1707 typedef struct smb_acl { 1708 uint8_t sl_revision; 1709 uint16_t sl_bsize; 1710 uint16_t sl_acecnt; 1711 smb_ace_t *sl_aces; 1712 list_t sl_sorted; 1713 } smb_acl_t; 1714 1715 /* 1716 * ACE/ACL header size, in byte, as it appears on the wire 1717 */ 1718 #define SMB_ACE_HDRSIZE 4 1719 #define SMB_ACL_HDRSIZE 8 1720 1721 /* 1722 * Security Descriptor (SD) 1723 * 1724 * Security descriptors provide protection for objects, for example 1725 * files and directories. It identifies the owner and primary group 1726 * (SIDs) and contains an access control list. When a user tries to 1727 * access an object his SID is compared to the permissions in the 1728 * DACL to determine if access should be allowed or denied. Note that 1729 * this is a simplification because there are other factors, such as 1730 * default behavior and privileges to be taken into account (see also 1731 * access tokens). 1732 * 1733 * The boolean flags have the following meanings when set: 1734 * 1735 * SE_OWNER_DEFAULTED indicates that the SID pointed to by the Owner 1736 * field was provided by a defaulting mechanism rather than explicitly 1737 * provided by the original provider of the security descriptor. This 1738 * may affect the treatment of the SID with respect to inheritance of 1739 * an owner. 1740 * 1741 * SE_GROUP_DEFAULTED indicates that the SID in the Group field was 1742 * provided by a defaulting mechanism rather than explicitly provided 1743 * by the original provider of the security descriptor. This may 1744 * affect the treatment of the SID with respect to inheritance of a 1745 * primary group. 1746 * 1747 * SE_DACL_PRESENT indicates that the security descriptor contains a 1748 * discretionary ACL. If this flag is set and the Dacl field of the 1749 * SECURITY_DESCRIPTOR is null, then a null ACL is explicitly being 1750 * specified. 1751 * 1752 * SE_DACL_DEFAULTED indicates that the ACL pointed to by the Dacl 1753 * field was provided by a defaulting mechanism rather than explicitly 1754 * provided by the original provider of the security descriptor. This 1755 * may affect the treatment of the ACL with respect to inheritance of 1756 * an ACL. This flag is ignored if the DaclPresent flag is not set. 1757 * 1758 * SE_SACL_PRESENT indicates that the security descriptor contains a 1759 * system ACL pointed to by the Sacl field. If this flag is set and 1760 * the Sacl field of the SECURITY_DESCRIPTOR is null, then an empty 1761 * (but present) ACL is being specified. 1762 * 1763 * SE_SACL_DEFAULTED indicates that the ACL pointed to by the Sacl 1764 * field was provided by a defaulting mechanism rather than explicitly 1765 * provided by the original provider of the security descriptor. This 1766 * may affect the treatment of the ACL with respect to inheritance of 1767 * an ACL. This flag is ignored if the SaclPresent flag is not set. 1768 * 1769 * SE_DACL_PROTECTED Prevents ACEs set on the DACL of the parent container 1770 * (and any objects above the parent container in the directory hierarchy) 1771 * from being applied to the object's DACL. 1772 * 1773 * SE_SACL_PROTECTED Prevents ACEs set on the SACL of the parent container 1774 * (and any objects above the parent container in the directory hierarchy) 1775 * from being applied to the object's SACL. 1776 * 1777 * Note that the SE_DACL_PRESENT flag needs to be present to set 1778 * SE_DACL_PROTECTED and SE_SACL_PRESENT needs to be present to set 1779 * SE_SACL_PROTECTED. 1780 * 1781 * SE_SELF_RELATIVE indicates that the security descriptor is in self- 1782 * relative form. In this form, all fields of the security descriptor 1783 * are contiguous in memory and all pointer fields are expressed as 1784 * offsets from the beginning of the security descriptor. 1785 * 1786 * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1787 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 1788 * +---------------------------------------------------------------+ 1789 * | Control |Reserved1 (SBZ)| Revision | 1790 * +---------------------------------------------------------------+ 1791 * | Owner | 1792 * +---------------------------------------------------------------+ 1793 * | Group | 1794 * +---------------------------------------------------------------+ 1795 * | Sacl | 1796 * +---------------------------------------------------------------+ 1797 * | Dacl | 1798 * +---------------------------------------------------------------+ 1799 * 1800 */ 1801 1802 #define SMB_OWNER_SECINFO 0x0001 1803 #define SMB_GROUP_SECINFO 0x0002 1804 #define SMB_DACL_SECINFO 0x0004 1805 #define SMB_SACL_SECINFO 0x0008 1806 #define SMB_ALL_SECINFO 0x000F 1807 #define SMB_ACL_SECINFO (SMB_DACL_SECINFO | SMB_SACL_SECINFO) 1808 1809 #define SECURITY_DESCRIPTOR_REVISION 1 1810 1811 1812 #define SE_OWNER_DEFAULTED 0x0001 1813 #define SE_GROUP_DEFAULTED 0x0002 1814 #define SE_DACL_PRESENT 0x0004 1815 #define SE_DACL_DEFAULTED 0x0008 1816 #define SE_SACL_PRESENT 0x0010 1817 #define SE_SACL_DEFAULTED 0x0020 1818 #define SE_DACL_AUTO_INHERIT_REQ 0x0100 1819 #define SE_SACL_AUTO_INHERIT_REQ 0x0200 1820 #define SE_DACL_AUTO_INHERITED 0x0400 1821 #define SE_SACL_AUTO_INHERITED 0x0800 1822 #define SE_DACL_PROTECTED 0x1000 1823 #define SE_SACL_PROTECTED 0x2000 1824 #define SE_SELF_RELATIVE 0x8000 1825 1826 #define SE_DACL_INHERITANCE_MASK 0x1500 1827 #define SE_SACL_INHERITANCE_MASK 0x2A00 1828 1829 /* 1830 * Security descriptor structures: 1831 * 1832 * smb_sd_t SD in SMB pointer form 1833 * smb_fssd_t SD in filesystem form 1834 * 1835 * Filesystems (e.g. ZFS/UFS) don't have something equivalent 1836 * to SD. The items comprising a SMB SD are kept separately in 1837 * filesystem. smb_fssd_t is introduced as a helper to provide 1838 * the required abstraction for CIFS code. 1839 */ 1840 1841 typedef struct smb_sd { 1842 uint8_t sd_revision; 1843 uint16_t sd_control; 1844 smb_sid_t *sd_owner; /* SID file owner */ 1845 smb_sid_t *sd_group; /* SID group (for POSIX) */ 1846 smb_acl_t *sd_sacl; /* ACL System (audits) */ 1847 smb_acl_t *sd_dacl; /* ACL Discretionary (perm) */ 1848 } smb_sd_t; 1849 1850 /* 1851 * SD header size as it appears on the wire 1852 */ 1853 #define SMB_SD_HDRSIZE 20 1854 1855 /* 1856 * values for smb_fssd.sd_flags 1857 */ 1858 #define SMB_FSSD_FLAGS_DIR 0x01 1859 1860 typedef struct smb_fssd { 1861 uint32_t sd_secinfo; 1862 uint32_t sd_flags; 1863 uid_t sd_uid; 1864 gid_t sd_gid; 1865 acl_t *sd_zdacl; 1866 acl_t *sd_zsacl; 1867 } smb_fssd_t; 1868 1869 #ifdef __cplusplus 1870 } 1871 #endif 1872 1873 #endif /* _SMBSRV_SMB_KTYPES_H */ 1874