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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/smbsrv/smb.h
          +++ new/usr/src/uts/common/smbsrv/smb.h
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  24      - * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       24 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  25   25   */
  26   26  
  27   27  #ifndef _SMBSRV_SMB_H
  28   28  #define _SMBSRV_SMB_H
  29   29  
  30   30  
  31   31  /*
  32   32   * SMB definitions and interfaces, mostly defined in the SMB and CIFS specs.
  33   33   */
  34   34  #include <sys/types.h>
  35   35  #include <smbsrv/string.h>
  36   36  #include <smbsrv/msgbuf.h>
  37   37  
  38   38  #include <smb/ntstatus.h>
  39   39  #include <smb/nterror.h>
  40   40  #include <smb/lmerr.h>
  41   41  #include <smb/doserror.h>
  42      -#include <smbsrv/ntaccess.h>
       42 +#include <smb/ntaccess.h>
  43   43  
  44   44  /*
  45   45   * Macintosh Extensions for CIFS
  46   46   */
  47   47  #include <smbsrv/mac_cifs.h>
  48   48  
  49   49  /*
  50   50   * NT Installable File System (IFS) interface.
  51   51   */
  52   52  #include <smbsrv/ntifs.h>
↓ open down ↓ 142 lines elided ↑ open up ↑
 195  195   *
 196  196   * Creation Flag Name         Value  Description
 197  197   * ========================== ====== ==================================
 198  198   * NT_CREATE_REQUEST_OPLOCK   0x02   Level I oplock requested
 199  199   * NT_CREATE_REQUEST_OPBATCH  0x04   Batch oplock requested
 200  200   * NT_CREATE_OPEN_TARGET_DIR  0x08   Target for open is a directory
 201  201   */
 202  202  #define NT_CREATE_FLAG_REQUEST_OPLOCK           0x02
 203  203  #define NT_CREATE_FLAG_REQUEST_OPBATCH          0x04
 204  204  #define NT_CREATE_FLAG_OPEN_TARGET_DIR          0x08
      205 +#define NT_CREATE_FLAG_EXTENDED_RESPONSE        0x10
 205  206  
      207 +/*
      208 + * The option flags valid in the SMB nt_create_andx call are a subset of
      209 + * those defined in ntifs.h (ditto SMB nt_transact_create)
      210 + */
      211 +#define SMB_NTCREATE_VALID_OPTIONS (FILE_VALID_OPTION_FLAGS & ~( \
      212 +        FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT |\
      213 +        FILE_RESERVE_OPFILTER))
 206  214  
 207  215  /*
      216 + * Oplocks levels as expressed in the SMB procotol, i.e.
      217 + * in nt_create_andx and nt_transact_create responses.
      218 + * The FS-level oplock interface flags are in ntifs.h
      219 + * (See OPLOCK_LEVEL_...)
      220 + */
      221 +#define SMB_OPLOCK_NONE         0
      222 +#define SMB_OPLOCK_EXCLUSIVE    1
      223 +#define SMB_OPLOCK_BATCH        2
      224 +#define SMB_OPLOCK_LEVEL_II     3
      225 +
      226 +/*
 208  227   * Define the filter flags for NtNotifyChangeDirectoryFile
 209  228   */
 210  229  #define FILE_NOTIFY_CHANGE_FILE_NAME    0x00000001
 211  230  #define FILE_NOTIFY_CHANGE_DIR_NAME     0x00000002
 212  231  #define FILE_NOTIFY_CHANGE_NAME         0x00000003
 213  232  #define FILE_NOTIFY_CHANGE_ATTRIBUTES   0x00000004
 214  233  #define FILE_NOTIFY_CHANGE_SIZE         0x00000008
 215  234  #define FILE_NOTIFY_CHANGE_LAST_WRITE   0x00000010
 216  235  #define FILE_NOTIFY_CHANGE_LAST_ACCESS  0x00000020
 217  236  #define FILE_NOTIFY_CHANGE_CREATION     0x00000040
↓ open down ↓ 9 lines elided ↑ open up ↑
 227  246   * Define the file action type codes for NtNotifyChangeDirectoryFile
 228  247   */
 229  248  #define FILE_ACTION_ADDED               0x00000001
 230  249  #define FILE_ACTION_REMOVED             0x00000002
 231  250  #define FILE_ACTION_MODIFIED            0x00000003
 232  251  #define FILE_ACTION_RENAMED_OLD_NAME    0x00000004
 233  252  #define FILE_ACTION_RENAMED_NEW_NAME    0x00000005
 234  253  #define FILE_ACTION_ADDED_STREAM        0x00000006
 235  254  #define FILE_ACTION_REMOVED_STREAM      0x00000007
 236  255  #define FILE_ACTION_MODIFIED_STREAM     0x00000008
 237      -/*
 238      - * Note: These action values are not from MS-FSCC.
 239      - * FILE_ACTION_SUBDIR_CHANGED is used internally for
 240      - * "watch tree" support, posted to all parents of a
 241      - * directory that had one of the changes above.
 242      - * FILE_ACTION_DELETE_PENDING is used internally to tell
 243      - * notify change requests when the "delete-on-close" flag
 244      - * has been set on the directory being watched.
 245      - */
 246      -#define FILE_ACTION_SUBDIR_CHANGED      0x00000009
 247      -#define FILE_ACTION_DELETE_PENDING      0x0000000a
      256 +/* See also: FILE_ACTION_SUBDIR_CHANGED etc. */
 248  257  
 249      -
 250  258  /* Lock type flags */
 251  259  #define LOCKING_ANDX_NORMAL_LOCK        0x00
 252  260  #define LOCKING_ANDX_SHARED_LOCK        0x01
 253  261  #define LOCKING_ANDX_OPLOCK_RELEASE     0x02
 254  262  #define LOCKING_ANDX_CHANGE_LOCK_TYPE   0x04
 255  263  #define LOCKING_ANDX_CANCEL_LOCK        0x08
 256  264  #define LOCKING_ANDX_LARGE_FILES        0x10
 257  265  
 258  266  #define SMB_COM_CREATE_DIRECTORY        0x00
 259  267  #define SMB_COM_DELETE_DIRECTORY        0x01
↓ open down ↓ 150 lines elided ↑ open up ↑
 410  418  #define LM1_2X002                6  /* This is the first version of the full */
 411  419  #define DOS_LM1_2X002            7  /* This is the dos equivalent of the */
 412  420  #define DOS_LANMAN2_1            8  /* DOS LANMAN2.1 */
 413  421  #define LANMAN2_1                9  /* OS/2 LANMAN2.1 */
 414  422  #define Windows_for_Workgroups_3_1a 10 /* Windows for Workgroups Version 1.0 */
 415  423  #define NT_LM_0_12              11  /* The SMB protocol designed for NT */
 416  424  #define DIALECT_SMB2002         12  /* SMB 2.002 (switch to SMB2) */
 417  425  #define DIALECT_SMB2XXX         13  /* SMB 2.??? (switch to SMB2) */
 418  426  
 419  427  /*
      428 + * SMB_TREE_CONNECT_ANDX  request flags
      429 + *
      430 + * The tree specified by TID in the SMB header
      431 + * should be disconnected - disconnect errors
      432 + * should be ignored.
      433 + */
      434 +#define SMB_TCONX_DISCONECT_TID         0x0001
      435 +/*
      436 + * Client request for signing key protection.
      437 + */
      438 +#define SMB_TCONX_EXTENDED_SIGNATURES   0x0004
      439 +/*
      440 + * Client request for extended information.
      441 + */
      442 +#define SMB_TCONX_EXTENDED_RESPONSE     0x0008
      443 +
      444 +/*
 420  445   * SMB_TREE_CONNECT_ANDX OptionalSupport flags
 421  446   *
 422  447   * SMB_SUPPORT_SEARCH_BITS    The server supports SearchAttributes.
 423  448   * SMB_SHARE_IS_IN_DFS        The share is managed by DFS.
 424  449   * SMB_CSC_MASK               Offline-caching mask - see CSC values.
 425  450   * SMB_UNIQUE_FILE_NAME       The server uses long names and does not support
 426  451   *                            short names.  This indicates to clients that
 427  452   *                            they may perform directory name-space caching.
 428  453   * SMB_EXTENDED_SIGNATURES    The server will use signing key protection.
 429  454   *
↓ open down ↓ 200 lines elided ↑ open up ↑
 630  655   * where:
 631  656   *
 632  657   *    L - Opportunistic lock.  1 if lock granted, else 0.
 633  658   *
 634  659   *    O - Open action:
 635  660   *        1 - The file existed and was opened
 636  661   *        2 - The file did not exist but was created
 637  662   *        3 - The file existed and was truncated
 638  663   */
 639  664  
 640      -#define SMB_OACT_LOCK                   0x8000
 641  665  #define SMB_OACT_OPENED                 0x01
 642  666  #define SMB_OACT_CREATED                0x02
 643  667  #define SMB_OACT_TRUNCATED              0x03
 644      -
 645  668  #define SMB_OACT_OPLOCK                 0x8000
 646  669  
 647  670  #define SMB_FTYPE_DISK                  0
 648  671  #define SMB_FTYPE_BYTE_PIPE             1
 649  672  #define SMB_FTYPE_MESG_PIPE             2
 650  673  #define SMB_FTYPE_PRINTER               3
 651  674  #define SMB_FTYPE_UNKNOWN               0xFFFF
 652  675  
 653  676  #define SMB_DEVST_BLOCKING              0x8000
 654  677  #define SMB_DEVST_ENDPOINT              0x4000
↓ open down ↓ 732 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX