Print this page
NEX-16604 Windows 10 SMB client exhausts smbauth sockets
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-13644 File access audit logging
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-4820 intended nbmand locking functionality is confused
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-17542 smb_export_t error message in mdb ::smbshare dcmd
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-16519 Panic while running IOmeter to a pool through an SMB share
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-2807 Restoring previous versions from snapshots doesn't work with nested folders.
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15958 panic importing CA share after failover
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Include in backports of:
  NEX-9808 SMB3 persistent handles
NEX-15958 panic importing CA share after failover
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Include in backports of:
  NEX-9808 SMB3 persistent handles
NEX-9808 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15578 SMB2 durable handle redesign
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15581 SMB keep-alive feature is just noise
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-5665 SMB2 oplock leases
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-15069 smtorture smb2.create.blob is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15555 SMB2 async redesign
NEX-15061 smtorture smb2.lock.cancel.cancel is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Also follow-up change to:
 NEX-1643 dtrace provider for smbsrv (remove "done2" probes,
 which don't make sense with the new async design)
NEX-9808 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15578 SMB2 durable handle redesign
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15581 SMB keep-alive feature is just noise
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-5665 SMB2 oplock leases
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-15069 smtorture smb2.create.blob is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15555 SMB2 async redesign
NEX-15061 smtorture smb2.lock.cancel.cancel is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Also follow-up change to:
 NEX-1643 dtrace provider for smbsrv (remove "done2" probes,
 which don't make sense with the new async design)
NEX-10231 SMB logon fails in fksmbd
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-9864 Some SMB cancel races remain after NEX-5845
Revert (part of) "NEX-5845 rework SMB immediate cancel"
reverts (part of) commit 7a5da69f6d42b17ebcc95ca3d02925d07a01343e.
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-5273 SMB 3 Encryption
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-8495 Panic after SMB flush on a named pipe
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-7267 Codenomicon causes panic in smb_authsock_cancel
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-5844 want SMB2 ioctl FSCTL_SRV_COPYCHUNK
NEX-6124 smb_fsop_read/write should allow file != sr->fid_ofile
NEX-6125 smbtorture invalid response with smb2.ioctl
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-6041 Should pass the smbtorture lock tests
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-5845 rework SMB immediate cancel
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-3553 SMB2/3 durable handles
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-5599 SMB needs a pointer-based hash table for durable handles
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-3776 SMB should handle PreviousSessionID
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-5560 smb2 should use 64-bit server-global uids
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-5537 Want reference counts for users, trees...
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-5330 SMB server should combine TCP+NBT session lists
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-5314 SMB server may wait for oplock break ack on disconnected session
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-5312 delete_on_close should be acted on earlier
Reviewed by: Gordon Ross <gwr@nexenta.com>
NEX-3906 Prefer that SMB change notify not tie up a worker thread
NEX-5278 SMB notify should buffer per file handle
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-5152 immediate SMB cancel may fail
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-4598 SMB2 credit shortage with Mac client
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-4147 Cancelled SMB2 requests sometimes have no response (missed things)
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-3738 Should support SMB2_CAP_LARGE_MTU
Reviewed by: Alek Pinchuk <alek@nexenta.com>
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-3620 need upstream cleanups for smbsrv
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
NEX-3610 CLONE NEX-3591 SMB3 signing
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-3080 SMB1 signing problem with Kerberos auth.
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-2781 SMB2 credit handling needs work
NEX-2485 SMB authentication flood handled poorly
SMB-136 Snapshots not visible in Windows previous versions
SMB-55 SMB2 signing
SMB-131 Don't allow setting delete-on-close on non empty dirs
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
SMB-74 Process oplock breaks as session requests (part two)
SMB-74 Process oplock breaks as session requests
SMB-56 extended security NTLMSSP, inbound
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>
SUP-694 panic on bad mutex in smb_event_wait()
SMB-65 SMB server in non-global zones (data structure changes)
Many things move to the smb_server_t object, and
many functions gain an sv arg (which server).
SMB-65 SMB server in non-global zones (kmem_caches)
common kmem_cache instances across zones
separate GZ-only init from NGZ init
SMB-64 smbsrv workers run at excessively high priority
SMB-63 taskq_create_proc ... TQ_DYNAMIC puts tasks in p0
re #11974 CIFS Share - Tree connect fails from Windows 7 Clients
SUP-599 smb_oplock_acquire thread deadlock
SMB-48 Panic with smbtorture raw.scan-eamax
re #13470 rb4432 Sync some SMB differences from illumos
re #7815 SMB server delivers old modification time...
re #11215 rb3676 sesctl to SGI JBOD hangs in biowait() with a command stuck in mptsas driver
re #10734 NT Trans. Notify returning too quickly
re #10733 Windows 7 directory listing keeps restarting
re #6813 rb1757 port 2976 Child folder visibility through shares

@@ -19,12 +19,12 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2016 Syneto S.R.L.  All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /*
  * Function prototypes for the SMB module.
  */

@@ -36,10 +36,11 @@
 extern "C" {
 #endif
 
 #include <sys/types.h>
 #include <sys/param.h>
+#include <sys/varargs.h>
 #include <sys/systm.h>
 #include <sys/debug.h>
 #include <sys/kmem.h>
 #include <sys/socket.h>
 #include <sys/ksocket.h>

@@ -53,72 +54,23 @@
 #include <smbsrv/smb_xdr.h>
 #include <smbsrv/smb_token.h>
 #include <smbsrv/smb_ktypes.h>
 #include <smbsrv/smb_ioctl.h>
 
-/*
- * DTrace SDT probes have different signatures in userland than they do in
- * kernel.  If we're compiling for user mode (libfksmbsrv) define them as
- * either no-op (for the SMB dtrace provider) or libfksmbsrv functions for
- * the other SDT probe sites.
- */
-#ifndef _KERNEL
-
-extern void smb_dtrace1(const char *f, const char *n,
-                        const char *t1, long v1);
-extern void smb_dtrace2(const char *f, const char *n,
-                        const char *t1, long v1,
-                        const char *t2, long v2);
-extern void smb_dtrace3(const char *f, const char *n,
-                        const char *t1, long v1,
-                        const char *t2, long v2,
-                        const char *t3, long v3);
-
-/*
- * These are for the SMB dtrace proivder, which for a user-mode build
- * are largely redundant with the fbt probes so make these no-ops.
- */
-#undef  DTRACE_SMB_1
-#define DTRACE_SMB_1(n, a, b)                   ((void)b)
-#undef  DTRACE_SMB_2
-#define DTRACE_SMB_2(n, a, b, c, d)             ((void)b, (void)d)
-
-/*
- * These are for the other (specialized) dtrace SDT probes sprinkled
- * through the smbsrv code.  In libfksmbsrv map these to functions.
- */
-
-#undef  DTRACE_PROBE1
-#define DTRACE_PROBE1(n, a, b) \
-        smb_dtrace1(__func__, #n, #a, (long)b)
-
-#undef  DTRACE_PROBE2
-#define DTRACE_PROBE2(n, a, b, c, d) \
-        smb_dtrace2(__func__, #n, #a, (long)b, #c, (long)d)
-
-#undef  DTRACE_PROBE3
-#define DTRACE_PROBE3(n, a, b, c, d, e, f) \
-        smb_dtrace3(__func__, #n, #a, (long)b, #c, (long)d, #e, (long)f)
-
-#endif  /* _KERNEL */
-
 extern  int smb_maxbufsize;
 extern  int smb_flush_required;
 extern  int smb_dirsymlink_enable;
-extern  int smb_oplock_levelII;
-extern  int smb_oplock_timeout;
-extern  int smb_oplock_min_timeout;
 extern  int smb_shortnames;
 extern  int smb_sign_debug;
-extern  int smb_raw_mode;
 extern  uint_t smb_audit_flags;
 extern  int smb_ssetup_threshold;
 extern  int smb_tcon_threshold;
 extern  int smb_opipe_threshold;
 extern  int smb_ssetup_timeout;
 extern  int smb_tcon_timeout;
 extern  int smb_opipe_timeout;
+extern  int smb_allow_advisory_locks;
 extern const uint32_t smb_vop_dosattr_settable;
 
 /* Thread priorities - see smb_init.c */
 extern  int smbsrv_base_pri;
 extern  int smbsrv_listen_pri;

@@ -133,10 +85,11 @@
 extern  kmem_cache_t            *smb_cache_tree;
 extern  kmem_cache_t            *smb_cache_ofile;
 extern  kmem_cache_t            *smb_cache_odir;
 extern  kmem_cache_t            *smb_cache_opipe;
 extern  kmem_cache_t            *smb_cache_event;
+extern  kmem_cache_t            *smb_cache_lock;
 
 extern  kmem_cache_t            *smb_kshare_cache_vfs;
 
 time_t smb_get_boottime(void);
 int smb_server_lookup(smb_server_t **);

@@ -276,10 +229,11 @@
     smb_quota_response_t *, smb_ofile_t *);
 void smb_quota_free_quotas(list_t *);
 
 void smb_query_shortname(smb_node_t *, smb_queryinfo_t *);
 
+uint32_t smb_dfs_fsctl(smb_request_t *, smb_fsctl_t *);
 uint32_t smb_dfs_get_referrals(smb_request_t *, smb_fsctl_t *);
 
 int smb1_newrq_negotiate(smb_request_t *);
 smb_sdrc_t smb1_negotiate_smb2(smb_request_t *sr);
 

@@ -297,37 +251,61 @@
 
 /*
  * Logging functions
  */
 void smb_log_flush(void);
-void smb_correct_keep_alive_values(uint32_t new_keep_alive);
 void smb_close_all_connections(void);
 
 int smb_net_id(uint32_t);
 
 /*
- * oplock functions - node operations
+ * Common oplock functions
  */
-void smb_oplock_acquire(smb_request_t *sr, smb_node_t *, smb_ofile_t *);
-void smb_oplock_release(smb_node_t *, smb_ofile_t *);
-int smb_oplock_break(smb_request_t *, smb_node_t *, uint32_t);
-void smb_oplock_break_levelII(smb_node_t *);
-void smb_oplock_ack(smb_node_t *, smb_ofile_t *, uint8_t);
-void smb_oplock_broadcast(smb_node_t *);
+uint32_t smb_oplock_request(smb_request_t *, smb_ofile_t *, uint32_t *);
+uint32_t smb_oplock_ack_break(smb_request_t *, smb_ofile_t *, uint32_t *);
+uint32_t smb_oplock_break_PARENT(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_OPEN(smb_node_t *, smb_ofile_t *,
+    uint32_t DesiredAccess, uint32_t CreateDisposition);
+uint32_t smb_oplock_break_BATCH(smb_node_t *, smb_ofile_t *,
+    uint32_t DesiredAccess, uint32_t CreateDisposition);
+uint32_t smb_oplock_break_HANDLE(smb_node_t *, smb_ofile_t *);
+void smb_oplock_break_CLOSE(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_READ(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_WRITE(smb_node_t *, smb_ofile_t *);
+uint32_t smb_oplock_break_SETINFO(smb_node_t *,
+    smb_ofile_t *ofile, uint32_t InfoClass);
+uint32_t smb_oplock_break_DELETE(smb_node_t *, smb_ofile_t *);
 
-void smb1_oplock_break_notification(smb_request_t *, uint8_t);
-void smb2_oplock_break_notification(smb_request_t *, uint8_t);
+void smb_oplock_move(smb_node_t *, smb_ofile_t *, smb_ofile_t *);
 
 /*
+ * Protocol-specific oplock functions
+ * (and "server-level" functions)
+ */
+void smb1_oplock_acquire(smb_request_t *, boolean_t);
+void smb1_oplock_break_notification(smb_request_t *, uint32_t);
+void smb2_oplock_break_notification(smb_request_t *, uint32_t);
+void smb2_lease_break_notification(smb_request_t *, uint32_t, boolean_t);
+void smb_oplock_ind_break(smb_ofile_t *, uint32_t, boolean_t, uint32_t);
+void smb_oplock_ind_break_in_ack(smb_request_t *, smb_ofile_t *,
+    uint32_t, boolean_t);
+void smb_oplock_send_brk(smb_request_t *);
+uint32_t smb_oplock_wait_break(smb_node_t *, int);
+
+/*
  * range lock functions - node operations
  */
 uint32_t smb_lock_get_lock_count(smb_node_t *, smb_ofile_t *);
-uint32_t smb_unlock_range(smb_request_t *, smb_node_t *,
-    uint64_t, uint64_t);
+uint32_t smb_unlock_range(smb_request_t *, uint64_t, uint64_t, uint32_t);
 uint32_t smb_lock_range(smb_request_t *, uint64_t, uint64_t, uint32_t,
-    uint32_t locktype);
+    uint32_t, uint32_t);
+uint32_t smb_lock_range_cancel(smb_request_t *, uint64_t, uint64_t, uint32_t);
 void smb_lock_range_error(smb_request_t *, uint32_t);
+
+int smb_lock_range_access(smb_request_t *, smb_node_t *,
+    uint64_t, uint64_t, boolean_t);
+
 DWORD smb_nbl_conflict(smb_node_t *, uint64_t, uint64_t, nbl_op_t);
 
 void smb_mangle(const char *, ino64_t, char *, size_t);
 int smb_unmangle(smb_node_t *, char *, char *, int, uint32_t);
 boolean_t smb_needs_mangled(const char *);

@@ -349,34 +327,35 @@
 
 int     smb_search(smb_request_t *);
 
 uint32_t smb_common_create(smb_request_t *);
 uint32_t smb_common_open(smb_request_t *);
+
 int smb_common_write(smb_request_t *, smb_rw_param_t *);
 
 void smb_pathname_init(smb_request_t *, smb_pathname_t *, char *);
 boolean_t smb_pathname_validate(smb_request_t *, smb_pathname_t *);
 boolean_t smb_validate_dirname(smb_request_t *, smb_pathname_t *);
 boolean_t smb_validate_object_name(smb_request_t *, smb_pathname_t *);
 boolean_t smb_validate_stream_name(smb_request_t *, smb_pathname_t *);
 boolean_t smb_is_stream_name(char *);
+boolean_t smb_strname_restricted(char *);
+
 void smb_stream_parse_name(char *, char *, char *);
 
 
 uint32_t smb_omode_to_amask(uint32_t desired_access);
 
 void    sshow_distribution_info(char *);
 
-uint32_t smb2sr_go_async(smb_request_t *sr,
-        smb_sdrc_t (*async_func)(smb_request_t *));
-
 void    smb_dispatch_stats_init(smb_server_t *);
 void    smb_dispatch_stats_fini(smb_server_t *);
 void    smb_dispatch_stats_update(smb_server_t *,
                 smb_kstat_req_t *, int, int);
 
 int     smb1sr_newrq(smb_request_t *);
+int     smb1sr_newrq_cancel(smb_request_t *);
 void    smb1sr_work(smb_request_t *);
 
 int     smbsr_encode_empty_result(smb_request_t *);
 void    smbsr_lookup_file(smb_request_t *);
 void    smbsr_release_file(smb_request_t *);

@@ -408,17 +387,15 @@
 int     smb_mbc_encodef(mbuf_chain_t *, const char *, ...);
 int     smb_mbc_peek(mbuf_chain_t *, int, const char *, ...);
 int     smb_mbc_poke(mbuf_chain_t *, int, const char *, ...);
 int     smb_mbc_put_mem(mbuf_chain_t *, void *, int);
 int     smb_mbc_copy(mbuf_chain_t *, const mbuf_chain_t *, int, int);
+int     smb_mbc_put_align(mbuf_chain_t *, int);
 
 void    smbsr_encode_header(smb_request_t *sr, int wct,
                     int bcc, const char *fmt, ...);
 
-int smb_lock_range_access(smb_request_t *, smb_node_t *,
-    uint64_t, uint64_t, boolean_t);
-
 void smb_encode_sd(mbuf_chain_t *, smb_sd_t *, uint32_t);
 void smb_encode_sid(mbuf_chain_t *, smb_sid_t *);
 smb_sid_t *smb_decode_sid(mbuf_chain_t *, uint32_t);
 uint32_t smb_decode_sd(mbuf_chain_t *, smb_sd_t *);
 

@@ -437,17 +414,18 @@
 
 /*
  * SMB RPC interface
  */
 void smb_opipe_dealloc(smb_opipe_t *);
-int smb_opipe_open(smb_request_t *, uint32_t);
+int smb_opipe_open(smb_request_t *, smb_ofile_t *);
 void smb_opipe_close(smb_ofile_t *);
 int smb_opipe_read(smb_request_t *, struct uio *);
 int smb_opipe_write(smb_request_t *, struct uio *);
 int smb_opipe_getattr(smb_ofile_t *, smb_attr_t *);
 int smb_opipe_getname(smb_ofile_t *, char *, size_t);
 uint32_t smb_opipe_fsctl(smb_request_t *, smb_fsctl_t *);
+uint32_t smb_opipe_transceive(smb_request_t *, smb_fsctl_t *);
 
 void smb_kdoor_init(smb_server_t *);
 void smb_kdoor_fini(smb_server_t *);
 int smb_kdoor_open(smb_server_t *, int);
 void smb_kdoor_close(smb_server_t *);

@@ -460,11 +438,11 @@
  */
 int smb_server_get_count(void);
 int smb_server_g_init(void);
 void smb_server_g_fini(void);
 int smb_server_create(void);
-int smb_server_delete(void);
+int smb_server_delete(smb_server_t *);
 int smb_server_configure(smb_ioc_cfg_t *);
 int smb_server_start(smb_ioc_start_t *);
 int smb_server_stop(void);
 boolean_t smb_server_is_stopping(smb_server_t *);
 void smb_server_cancel_event(smb_server_t *, uint32_t);

@@ -473,13 +451,15 @@
 int smb_server_set_gmtoff(smb_ioc_gmt_t *);
 int smb_server_numopen(smb_ioc_opennum_t *);
 int smb_server_enum(smb_ioc_svcenum_t *);
 int smb_server_session_close(smb_ioc_session_t *);
 int smb_server_file_close(smb_ioc_fileid_t *);
-int smb_server_sharevp(smb_server_t *, const char *, vnode_t **);
+int smb_server_share_lookup(smb_server_t *, const char *, smb_node_t **);
 int smb_server_unshare(const char *);
 
+smb_user_t *smb_server_lookup_ssnid(smb_server_t *, uint64_t);
+
 void smb_server_get_cfg(smb_server_t *, smb_kmod_cfg_t *);
 
 int smb_server_spooldoc(smb_ioc_spooldoc_t *);
 int smb_spool_add_doc(smb_tree_t *, smb_kspooldoc_t *);
 void smb_spool_add_fid(smb_server_t *, uint16_t);

@@ -498,10 +478,12 @@
 void smb_server_dec_pipes(smb_server_t *);
 void smb_server_add_rxb(smb_server_t *, int64_t);
 void smb_server_add_txb(smb_server_t *, int64_t);
 void smb_server_inc_req(smb_server_t *);
 
+void smb_server_post_session(smb_session_t *);
+
 smb_event_t *smb_event_create(smb_server_t *, int);
 void smb_event_destroy(smb_event_t *);
 uint32_t smb_event_txid(smb_event_t *);
 int smb_event_wait(smb_event_t *);
 void smb_event_notify(smb_server_t *, uint32_t);

@@ -546,22 +528,24 @@
 uint32_t smb_node_open_check(smb_node_t *, uint32_t, uint32_t);
 DWORD smb_node_rename_check(smb_node_t *);
 DWORD smb_node_delete_check(smb_node_t *);
 boolean_t smb_node_share_check(smb_node_t *);
 
-void smb_node_fcn_subscribe(smb_node_t *, smb_request_t *);
-void smb_node_fcn_unsubscribe(smb_node_t *, smb_request_t *);
+void smb_node_fcn_subscribe(smb_node_t *);
+void smb_node_fcn_unsubscribe(smb_node_t *);
 void smb_node_notify_change(smb_node_t *, uint_t, const char *);
-void smb_node_notify_parents(smb_node_t *);
+
 int smb_node_getattr(smb_request_t *, smb_node_t *, cred_t *,
     smb_ofile_t *, smb_attr_t *);
 int smb_node_setattr(smb_request_t *, smb_node_t *, cred_t *,
     smb_ofile_t *, smb_attr_t *);
 uint32_t smb_node_set_delete_on_close(smb_node_t *, cred_t *, uint32_t);
 void smb_node_reset_delete_on_close(smb_node_t *);
+void smb_node_delete_on_close(smb_node_t *);
 boolean_t smb_node_file_is_readonly(smb_node_t *);
 int smb_node_getpath(smb_node_t *, vnode_t *, char *, uint32_t);
+void smb_node_getpath_nofail(smb_node_t *, vnode_t *, char *, uint32_t);
 int smb_node_getmntpath(smb_node_t *, char *, uint32_t);
 int smb_node_getshrpath(smb_node_t *, smb_tree_t *, char *, uint32_t);
 
 /*
  * Pathname functions

@@ -569,26 +553,22 @@
 
 int smb_pathname_reduce(smb_request_t *, cred_t *,
     const char *, smb_node_t *, smb_node_t *, smb_node_t **, char *);
 
 int smb_pathname(smb_request_t *, char *, int, smb_node_t *,
-    smb_node_t *, smb_node_t **, smb_node_t **, cred_t *);
+    smb_node_t *, smb_node_t **, smb_node_t **, cred_t *, pathname_t *);
 
 /*
- * smb_vfs functions
+ * smb_notify.c
  */
+uint32_t smb_notify_act1(smb_request_t *, uint32_t, uint32_t);
+uint32_t smb_notify_act2(smb_request_t *);
+uint32_t smb_notify_act3(smb_request_t *);
+void smb_notify_ofile(smb_ofile_t *, uint_t, const char *);
+void smb_nt_transact_notify_finish(void *);
+void smb2_change_notify_finish(void *);
 
-int smb_vfs_hold(smb_export_t *, vfs_t *);
-void smb_vfs_rele(smb_export_t *, vfs_t *);
-void smb_vfs_rele_all(smb_export_t *);
-
-/* NOTIFY CHANGE */
-
-uint32_t smb_notify_common(smb_request_t *, mbuf_chain_t *, uint32_t);
-void smb_notify_event(smb_node_t *, uint_t, const char *);
-void smb_notify_file_closed(smb_ofile_t *);
-
 int smb_fem_fcn_install(smb_node_t *);
 void smb_fem_fcn_uninstall(smb_node_t *);
 int smb_fem_oplock_install(smb_node_t *);
 void smb_fem_oplock_uninstall(smb_node_t *);
 

@@ -600,16 +580,18 @@
 int smb_try_grow(smb_request_t *sr, int64_t new_size);
 
 unsigned short smb_worker_getnum();
 
 /* SMB signing routines smb_signing.c */
-int smb_sign_begin(smb_request_t *, smb_token_t *);
+void smb_sign_begin(smb_request_t *, smb_token_t *);
 int smb_sign_check_request(smb_request_t *);
 int smb_sign_check_secondary(smb_request_t *, unsigned int);
 void smb_sign_reply(smb_request_t *, mbuf_chain_t *);
 /* SMB2, but here because it's called from common code. */
-int smb2_sign_begin(smb_request_t *, smb_token_t *);
+void smb2_sign_begin(smb_request_t *, smb_token_t *);
+void smb3_encrypt_begin(smb_request_t *, smb_token_t *);
+void smb3_encrypt_fini(smb_session_t *);
 
 boolean_t smb_sattr_check(uint16_t, uint16_t);
 
 void smb_request_cancel(smb_request_t *);
 void smb_request_wait(smb_request_t *);

@@ -617,43 +599,45 @@
 /*
  * authentication support (smb_authenticate.c)
  */
 int smb_authenticate_ext(smb_request_t *);
 int smb_authenticate_old(smb_request_t *);
-void smb_authsock_close(smb_user_t *);
+void smb_authsock_close(smb_user_t *, ksocket_t);
 
 /*
  * session functions (file smb_session.c)
  */
 smb_session_t *smb_session_create(ksocket_t, uint16_t, smb_server_t *, int);
+smb_session_t *smb_server_find_session_byptr(smb_server_t *, void *);
+
+void smb_session_hold(smb_session_t *);
+void smb_session_release(smb_session_t *);
 void smb_session_receiver(smb_session_t *);
 void smb_session_disconnect(smb_session_t *);
-void smb_session_timers(smb_llist_t *);
+void smb_session_timers(smb_server_t *);
 void smb_session_delete(smb_session_t *session);
 void smb_session_cancel_requests(smb_session_t *, smb_tree_t *,
     smb_request_t *);
 void smb_session_config(smb_session_t *session);
 void smb_session_disconnect_from_share(smb_llist_t *, char *);
 smb_user_t *smb_session_dup_user(smb_session_t *, char *, char *);
+smb_user_t *smb_session_lookup_ssnid(smb_session_t *, uint64_t);
 smb_user_t *smb_session_lookup_uid(smb_session_t *, uint16_t);
-smb_user_t *smb_session_lookup_uid_st(smb_session_t *session,
-    uint16_t uid, smb_user_state_t st);
-void smb_session_post_user(smb_session_t *, smb_user_t *);
-void smb_session_post_tree(smb_session_t *, smb_tree_t *);
+smb_user_t *smb_session_lookup_uid_st(smb_session_t *,
+    uint64_t, uint16_t, smb_user_state_t);
 smb_tree_t *smb_session_lookup_tree(smb_session_t *, uint16_t);
 smb_tree_t *smb_session_lookup_share(smb_session_t *, const char *,
     smb_tree_t *);
 smb_tree_t *smb_session_lookup_volume(smb_session_t *, const char *,
     smb_tree_t *);
 void smb_session_close_pid(smb_session_t *, uint32_t);
 void smb_session_disconnect_owned_trees(smb_session_t *, smb_user_t *);
-void smb_session_disconnect_trees(smb_session_t *);
 void smb_session_disconnect_share(smb_session_t *, const char *);
+void smb_session_logoff(smb_session_t *);
 void smb_session_getclient(smb_session_t *, char *, size_t);
 boolean_t smb_session_isclient(smb_session_t *, const char *);
 void smb_session_correct_keep_alive_values(smb_llist_t *, uint32_t);
-void smb_session_oplock_break(smb_request_t *, uint8_t);
 int smb_session_send(smb_session_t *, uint8_t type, mbuf_chain_t *);
 int smb_session_xprt_gethdr(smb_session_t *, smb_xprt_t *);
 boolean_t smb_session_oplocks_enable(smb_session_t *);
 boolean_t smb_session_levelII_oplocks(smb_session_t *);
 

@@ -665,35 +649,40 @@
 /*
  * ofile functions (file smb_ofile.c)
  */
 smb_ofile_t *smb_ofile_lookup_by_fid(smb_request_t *, uint16_t);
 smb_ofile_t *smb_ofile_lookup_by_uniqid(smb_tree_t *, uint32_t);
+smb_ofile_t *smb_ofile_lookup_by_persistid(smb_request_t *, uint64_t);
 boolean_t smb_ofile_disallow_fclose(smb_ofile_t *);
-smb_ofile_t *smb_ofile_open(smb_request_t *, smb_node_t *,
-    smb_arg_open_t *, uint16_t, uint32_t, smb_error_t *);
+smb_ofile_t *smb_ofile_alloc(smb_request_t *, smb_arg_open_t *, smb_node_t *,
+    uint16_t, uint16_t);
+void smb_ofile_open(smb_request_t *, smb_arg_open_t *, smb_ofile_t *);
 void smb_ofile_close(smb_ofile_t *, int32_t);
-void smb_ofile_delete(void *);
+void smb_ofile_free(smb_ofile_t *);
 uint32_t smb_ofile_access(smb_ofile_t *, cred_t *, uint32_t);
 int smb_ofile_seek(smb_ofile_t *, ushort_t, int32_t, uint32_t *);
 void smb_ofile_flush(smb_request_t *, smb_ofile_t *);
 boolean_t smb_ofile_hold(smb_ofile_t *);
+boolean_t smb_ofile_hold_olbrk(smb_ofile_t *);
 void smb_ofile_release(smb_ofile_t *);
-void smb_ofile_request_complete(smb_ofile_t *);
-void smb_ofile_close_all(smb_tree_t *);
-void smb_ofile_close_all_by_pid(smb_tree_t *, uint16_t);
+void smb_ofile_close_all(smb_tree_t *, uint32_t);
 void smb_ofile_set_flags(smb_ofile_t *, uint32_t);
 boolean_t smb_ofile_is_open(smb_ofile_t *);
 int smb_ofile_enum(smb_ofile_t *, smb_svcenum_t *);
 uint32_t smb_ofile_open_check(smb_ofile_t *, uint32_t, uint32_t);
 uint32_t smb_ofile_rename_check(smb_ofile_t *);
 uint32_t smb_ofile_delete_check(smb_ofile_t *);
 boolean_t smb_ofile_share_check(smb_ofile_t *);
 cred_t *smb_ofile_getcred(smb_ofile_t *);
-void smb_ofile_set_delete_on_close(smb_ofile_t *);
+void smb_ofile_set_delete_on_close(smb_request_t *, smb_ofile_t *);
 void smb_delayed_write_timer(smb_llist_t *);
 void smb_ofile_set_quota_resume(smb_ofile_t *, char *);
 void smb_ofile_get_quota_resume(smb_ofile_t *, char *, int);
+void smb_ofile_del_persistid(smb_ofile_t *);
+void smb_ofile_set_persistid_dh(smb_ofile_t *);
+void smb_ofile_set_persistid_ph(smb_ofile_t *);
+int smb_ofile_insert_persistid(smb_ofile_t *, uint64_t);
 
 #define SMB_OFILE_GET_SESSION(of)       ((of)->f_session)
 #define SMB_OFILE_GET_TREE(of)          ((of)->f_tree)
 #define SMB_OFILE_GET_FID(of)           ((of)->f_fid)
 #define SMB_OFILE_GET_NODE(of)          ((of)->f_node)

@@ -710,11 +699,10 @@
 uint32_t smb_odir_openat(smb_request_t *, smb_node_t *, smb_odir_t **);
 void smb_odir_reopen(smb_odir_t *, const char *, uint16_t);
 void smb_odir_close(smb_odir_t *);
 boolean_t smb_odir_hold(smb_odir_t *);
 void smb_odir_release(smb_odir_t *);
-void smb_odir_delete(void *);
 
 int smb_odir_read(smb_request_t *, smb_odir_t *,
     smb_odirent_t *, boolean_t *);
 int smb_odir_read_fileinfo(smb_request_t *, smb_odir_t *,
     smb_fileinfo_t *, uint16_t *);

@@ -730,13 +718,13 @@
  * SMB user functions (file smb_user.c)
  */
 smb_user_t *smb_user_new(smb_session_t *);
 int smb_user_logon(smb_user_t *, cred_t *,
     char *, char *, uint32_t, uint32_t, uint32_t);
-smb_user_t *smb_user_dup(smb_user_t *);
 void smb_user_logoff(smb_user_t *);
-void smb_user_delete(void *);
+void smb_user_auth_tmo(void *);
+
 boolean_t smb_user_is_admin(smb_user_t *);
 boolean_t smb_user_namecmp(smb_user_t *, const char *);
 int smb_user_enum(smb_user_t *, smb_svcenum_t *);
 boolean_t smb_user_hold(smb_user_t *);
 void smb_user_hold_internal(smb_user_t *);

@@ -745,31 +733,32 @@
 cred_t *smb_user_getprivcred(smb_user_t *);
 void smb_user_netinfo_init(smb_user_t *, smb_netuserinfo_t *);
 void smb_user_netinfo_fini(smb_netuserinfo_t *);
 int smb_user_netinfo_encode(smb_user_t *, uint8_t *, size_t, uint32_t *);
 smb_token_t *smb_get_token(smb_session_t *, smb_logon_t *);
-cred_t *smb_cred_create(smb_token_t *);
+cred_t *smb_cred_create(smb_token_t *, smb_session_t *);
+cred_t *smb_kcred_create(void);
 void smb_user_setcred(smb_user_t *, cred_t *, uint32_t);
+boolean_t smb_is_same_user(cred_t *, cred_t *);
 
 /*
  * SMB tree functions (file smb_tree.c)
  */
 uint32_t smb_tree_connect(smb_request_t *);
+uint32_t smb_tree_connect_disk(smb_request_t *, smb_arg_tcon_t *);
 void smb_tree_disconnect(smb_tree_t *, boolean_t);
-void smb_tree_dealloc(void *);
-void smb_tree_post_ofile(smb_tree_t *, smb_ofile_t *);
-void smb_tree_post_odir(smb_tree_t *, smb_odir_t *);
 void smb_tree_close_pid(smb_tree_t *, uint32_t);
 boolean_t smb_tree_has_feature(smb_tree_t *, uint_t);
 int smb_tree_enum(smb_tree_t *, smb_svcenum_t *);
 int smb_tree_fclose(smb_tree_t *, uint32_t);
 boolean_t smb_tree_hold(smb_tree_t *);
 void smb_tree_hold_internal(smb_tree_t *);
 void smb_tree_release(smb_tree_t *);
 smb_odir_t *smb_tree_lookup_odir(smb_request_t *, uint16_t);
 boolean_t smb_tree_is_connected(smb_tree_t *);
-#define SMB_TREE_GET_TID(tree)          ((tree)->t_tid)
+smb_tree_t *smb_tree_alloc(smb_request_t *, const smb_kshare_t *,
+    smb_node_t *, uint32_t, uint32_t);
 
 smb_xa_t *smb_xa_create(smb_session_t *session, smb_request_t *sr,
     uint32_t total_parameter_count, uint32_t total_data_count,
     uint32_t max_parameter_count, uint32_t max_data_count,
     uint32_t max_setup_count, uint32_t setup_word_count);

@@ -783,13 +772,10 @@
 
 struct mbuf *smb_mbuf_get(uchar_t *buf, int nbytes);
 struct mbuf *smb_mbuf_allocate(struct uio *uio);
 void smb_mbuf_trim(struct mbuf *mhead, int nbytes);
 
-void smb_check_status(void);
-int smb_handle_write_raw(smb_session_t *session, smb_request_t *sr);
-
 int32_t smb_time_gmt_to_local(smb_request_t *, int32_t);
 int32_t smb_time_local_to_gmt(smb_request_t *, int32_t);
 int32_t smb_time_dos_to_unix(int16_t, int16_t);
 void smb_time_unix_to_dos(int32_t, int16_t *, int16_t *);
 void smb_time_nt_to_unix(uint64_t nt_time, timestruc_t *unix_time);

@@ -812,19 +798,19 @@
  */
 void    smb_llist_init(void);
 void    smb_llist_fini(void);
 void    smb_llist_constructor(smb_llist_t *, size_t, size_t);
 void    smb_llist_destructor(smb_llist_t *);
+void    smb_llist_enter(smb_llist_t *ll, krw_t);
 void    smb_llist_exit(smb_llist_t *);
 void    smb_llist_post(smb_llist_t *, void *, smb_dtorproc_t);
 void    smb_llist_flush(smb_llist_t *);
 void    smb_llist_insert_head(smb_llist_t *ll, void *obj);
 void    smb_llist_insert_tail(smb_llist_t *ll, void *obj);
 void    smb_llist_remove(smb_llist_t *ll, void *obj);
 int     smb_llist_upgrade(smb_llist_t *ll);
 uint32_t smb_llist_get_count(smb_llist_t *ll);
-#define smb_llist_enter(ll, mode)       rw_enter(&(ll)->ll_lock, mode)
 #define smb_llist_head(ll)              list_head(&(ll)->ll_list)
 #define smb_llist_next(ll, obj)         list_next(&(ll)->ll_list, obj)
 int     smb_account_connected(smb_user_t *user);
 
 /*

@@ -843,17 +829,14 @@
 #define smb_slist_head(sl)              list_head(&(sl)->sl_list)
 #define smb_slist_next(sl, obj)         list_next(&(sl)->sl_list, obj)
 
 void    smb_rwx_init(smb_rwx_t *rwx);
 void    smb_rwx_destroy(smb_rwx_t *rwx);
-#define smb_rwx_rwenter(rwx, mode)      rw_enter(&(rwx)->rwx_lock, mode)
+void    smb_rwx_rwenter(smb_rwx_t *rwx, krw_t);
 void    smb_rwx_rwexit(smb_rwx_t *rwx);
-int     smb_rwx_rwwait(smb_rwx_t *rwx, clock_t timeout);
-#define smb_rwx_xenter(rwx)             mutex_enter(&(rwx)->rwx_mutex)
-#define smb_rwx_xexit(rwx)              mutex_exit(&(rwx)->rwx_mutex)
-krw_t   smb_rwx_rwupgrade(smb_rwx_t *rwx);
-void    smb_rwx_rwdowngrade(smb_rwx_t *rwx, krw_t mode);
+int     smb_rwx_cvwait(smb_rwx_t *rwx, clock_t timeout);
+void    smb_rwx_cvbcast(smb_rwx_t *rwx);
 
 void    smb_thread_init(smb_thread_t *, char *, smb_thread_ep_t,
                 void *, pri_t);
 void    smb_thread_destroy(smb_thread_t *);
 int     smb_thread_start(smb_thread_t *);

@@ -881,13 +864,13 @@
 boolean_t smb_ace_is_generic(int);
 boolean_t smb_ace_is_access(int);
 boolean_t smb_ace_is_audit(int);
 
 uint32_t smb_vss_enum_snapshots(smb_request_t *, smb_fsctl_t *);
-int smb_vss_lookup_nodes(smb_request_t *, smb_node_t *, smb_node_t *,
-    char *, smb_node_t **, smb_node_t **);
+int smb_vss_lookup_nodes(smb_request_t *, smb_node_t *, smb_node_t **, char *);
 vnode_t *smb_lookuppathvptovp(smb_request_t *, char *, vnode_t *, vnode_t *);
+int smb_vss_extract_gmttoken(char *, char *);
 
 void smb_panic(char *, const char *, int);
 #pragma does_not_return(smb_panic)
 #define SMB_PANIC()     smb_panic(__FILE__, __func__, __LINE__)
 

@@ -957,10 +940,25 @@
 void smb_threshold_fini(smb_cmd_threshold_t *);
 int smb_threshold_enter(smb_cmd_threshold_t *);
 void smb_threshold_exit(smb_cmd_threshold_t *);
 void smb_threshold_wake_all(smb_cmd_threshold_t *);
 
+/* SMB hash function prototypes */
+smb_hash_t *smb_hash_create(size_t, size_t, uint32_t);
+void smb_hash_destroy(smb_hash_t *);
+uint_t smb_hash_uint64(smb_hash_t *, uint64_t);
+
+/* SMB auditing helper functions */
+boolean_t smb_audit_init(smb_request_t *);
+void smb_audit_fini(smb_request_t *, uint32_t, smb_node_t *, boolean_t);
+boolean_t smb_audit_rename_init(smb_request_t *);
+void smb_audit_rename_fini(smb_request_t *, char *, smb_node_t *, char *,
+    boolean_t, boolean_t);
+void smb_audit_save(void);
+void smb_audit_load(void);
+vnode_t *smb_audit_rootvp(smb_request_t *);
+
 #ifdef  __cplusplus
 }
 #endif
 
 #endif /* _SMB_KPROTO_H_ */