Print this page
NEX-14666 Need to provide SMB 2.1 Client
NEX-17187 panic in smbfs_acl_store
NEX-17231 smbfs create xattr files finds wrong file
NEX-17224 smbfs lookup EINVAL should be ENOENT
NEX-17260 SMB1 client fails to list directory after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
and: (cleanup)
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-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-4538 SMB1 create file should support extended_response format (2)
NEX-6116 Failures in smbtorture raw.open
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Include this commit if upstreaming/backporting any of:
NEX-4540 SMB server declines EA support incorrectly
NEX-4239 smbtorture create failures re. allocation size
(illumos) 6398 SMB should support path names longer than 1024
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-4538 SMB1 create file should support extended_response format
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
NEX-4473 SMB1 tree connect missing some features
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-3611 CLONE NEX-3550 Replace smb2_enable with max_protocol
Reviewed by: Yuri Pankov <Yuri.Pankov@nexenta.com>
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-56 extended security NTLMSSP, inbound
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>
        
@@ -19,11 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #ifndef _SMBSRV_SMB_H
 #define _SMBSRV_SMB_H
 
@@ -37,11 +37,11 @@
 
 #include <smb/ntstatus.h>
 #include <smb/nterror.h>
 #include <smb/lmerr.h>
 #include <smb/doserror.h>
-#include <smbsrv/ntaccess.h>
+#include <smb/ntaccess.h>
 
 /*
  * Macintosh Extensions for CIFS
  */
 #include <smbsrv/mac_cifs.h>
@@ -200,13 +200,32 @@
  * NT_CREATE_OPEN_TARGET_DIR  0x08   Target for open is a directory
  */
 #define NT_CREATE_FLAG_REQUEST_OPLOCK           0x02
 #define NT_CREATE_FLAG_REQUEST_OPBATCH          0x04
 #define NT_CREATE_FLAG_OPEN_TARGET_DIR          0x08
+#define NT_CREATE_FLAG_EXTENDED_RESPONSE        0x10
 
+/*
+ * The option flags valid in the SMB nt_create_andx call are a subset of
+ * those defined in ntifs.h (ditto SMB nt_transact_create)
+ */
+#define SMB_NTCREATE_VALID_OPTIONS (FILE_VALID_OPTION_FLAGS & ~( \
+        FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT |\
+        FILE_RESERVE_OPFILTER))
 
 /*
+ * Oplocks levels as expressed in the SMB procotol, i.e.
+ * in nt_create_andx and nt_transact_create responses.
+ * The FS-level oplock interface flags are in ntifs.h
+ * (See OPLOCK_LEVEL_...)
+ */
+#define SMB_OPLOCK_NONE         0
+#define SMB_OPLOCK_EXCLUSIVE    1
+#define SMB_OPLOCK_BATCH        2
+#define SMB_OPLOCK_LEVEL_II     3
+
+/*
  * Define the filter flags for NtNotifyChangeDirectoryFile
  */
 #define FILE_NOTIFY_CHANGE_FILE_NAME    0x00000001
 #define FILE_NOTIFY_CHANGE_DIR_NAME     0x00000002
 #define FILE_NOTIFY_CHANGE_NAME         0x00000003
@@ -232,23 +251,12 @@
 #define FILE_ACTION_RENAMED_OLD_NAME    0x00000004
 #define FILE_ACTION_RENAMED_NEW_NAME    0x00000005
 #define FILE_ACTION_ADDED_STREAM        0x00000006
 #define FILE_ACTION_REMOVED_STREAM      0x00000007
 #define FILE_ACTION_MODIFIED_STREAM     0x00000008
-/*
- * Note: These action values are not from MS-FSCC.
- * FILE_ACTION_SUBDIR_CHANGED is used internally for
- * "watch tree" support, posted to all parents of a
- * directory that had one of the changes above.
- * FILE_ACTION_DELETE_PENDING is used internally to tell
- * notify change requests when the "delete-on-close" flag
- * has been set on the directory being watched.
- */
-#define FILE_ACTION_SUBDIR_CHANGED      0x00000009
-#define FILE_ACTION_DELETE_PENDING      0x0000000a
+/* See also: FILE_ACTION_SUBDIR_CHANGED etc. */
 
-
 /* Lock type flags */
 #define LOCKING_ANDX_NORMAL_LOCK        0x00
 #define LOCKING_ANDX_SHARED_LOCK        0x01
 #define LOCKING_ANDX_OPLOCK_RELEASE     0x02
 #define LOCKING_ANDX_CHANGE_LOCK_TYPE   0x04
@@ -415,10 +423,27 @@
 #define NT_LM_0_12              11  /* The SMB protocol designed for NT */
 #define DIALECT_SMB2002         12  /* SMB 2.002 (switch to SMB2) */
 #define DIALECT_SMB2XXX         13  /* SMB 2.??? (switch to SMB2) */
 
 /*
+ * SMB_TREE_CONNECT_ANDX  request flags
+ *
+ * The tree specified by TID in the SMB header
+ * should be disconnected - disconnect errors
+ * should be ignored.
+ */
+#define SMB_TCONX_DISCONECT_TID         0x0001
+/*
+ * Client request for signing key protection.
+ */
+#define SMB_TCONX_EXTENDED_SIGNATURES   0x0004
+/*
+ * Client request for extended information.
+ */
+#define SMB_TCONX_EXTENDED_RESPONSE     0x0008
+
+/*
  * SMB_TREE_CONNECT_ANDX OptionalSupport flags
  *
  * SMB_SUPPORT_SEARCH_BITS    The server supports SearchAttributes.
  * SMB_SHARE_IS_IN_DFS        The share is managed by DFS.
  * SMB_CSC_MASK               Offline-caching mask - see CSC values.
@@ -635,15 +660,13 @@
  *        1 - The file existed and was opened
  *        2 - The file did not exist but was created
  *        3 - The file existed and was truncated
  */
 
-#define SMB_OACT_LOCK                   0x8000
 #define SMB_OACT_OPENED                 0x01
 #define SMB_OACT_CREATED                0x02
 #define SMB_OACT_TRUNCATED              0x03
-
 #define SMB_OACT_OPLOCK                 0x8000
 
 #define SMB_FTYPE_DISK                  0
 #define SMB_FTYPE_BYTE_PIPE             1
 #define SMB_FTYPE_MESG_PIPE             2