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-10455 Ricoh scanner error after DFS get referral
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Dan Fields <dan.fields@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>
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-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>
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).


   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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  26  */
  27 
  28 #include <smbsrv/smb_kproto.h>
  29 #include <smbsrv/winioctl.h>
  30 
  31 /*
  32  * [MS-CIFS]
  33  *
  34  * 2.2.6.17    TRANS2_REPORT_DFS_INCONSISTENCY (0x0011)
  35  *
  36  *  This Transaction2 subcommand was introduced in the NT LAN Manager dialect.
  37  *  This subcommand is reserved but not implemented.
  38  *
  39  *  Clients SHOULD NOT send requests using this command code. Servers receiving
  40  *  requests with this command code SHOULD return STATUS_NOT_IMPLEMENTED
  41  *  (ERRDOS/ERRbadfunc).
  42  */
  43 smb_sdrc_t /*ARGSUSED*/
  44 smb_com_trans2_report_dfs_inconsistency(smb_request_t *sr)
  45 {
  46         return (SDRC_NOT_IMPLEMENTED);
  47 }
  48 
  49 /*


  55         smb_fsctl_t fsctl;
  56         uint32_t status;
  57         uint16_t doserr;
  58 
  59         /* This request is only valid over IPC connections */
  60         if (!STYPE_ISIPC(sr->tid_tree->t_res_type)) {
  61                 smbsr_error(sr, NT_STATUS_ACCESS_DENIED, ERRDOS,
  62                     ERROR_ACCESS_DENIED);
  63                 return (SDRC_ERROR);
  64         }
  65 
  66         fsctl.CtlCode = FSCTL_DFS_GET_REFERRALS;
  67         fsctl.InputCount = xa->smb_tpscnt;
  68         fsctl.OutputCount = 0;
  69         fsctl.MaxOutputResp = xa->smb_mdrcnt;
  70         fsctl.in_mbc = &xa->req_param_mb;
  71         fsctl.out_mbc = &xa->rep_data_mb;
  72 
  73         status = smb_dfs_get_referrals(sr, &fsctl);
  74 
  75         /* Out param is the API-level return code. */



  76         doserr = smb_status2doserr(status);
  77         (void) smb_mbc_encodef(&xa->rep_param_mb, "w", doserr);
  78 
  79 #if 0   /* XXX - Is API-level return code enough? */
  80         if (status) {
  81                 smbsr_error(sr, NT_STATUS_NO_SUCH_DEVICE, 0, 0);
  82                 return (SDRC_ERROR);
  83         }
  84 #endif
  85 
  86         return (SDRC_SUCCESS);
  87 }


   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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  26  */
  27 
  28 #include <smbsrv/smb_kproto.h>
  29 #include <smb/winioctl.h>
  30 
  31 /*
  32  * [MS-CIFS]
  33  *
  34  * 2.2.6.17    TRANS2_REPORT_DFS_INCONSISTENCY (0x0011)
  35  *
  36  *  This Transaction2 subcommand was introduced in the NT LAN Manager dialect.
  37  *  This subcommand is reserved but not implemented.
  38  *
  39  *  Clients SHOULD NOT send requests using this command code. Servers receiving
  40  *  requests with this command code SHOULD return STATUS_NOT_IMPLEMENTED
  41  *  (ERRDOS/ERRbadfunc).
  42  */
  43 smb_sdrc_t /*ARGSUSED*/
  44 smb_com_trans2_report_dfs_inconsistency(smb_request_t *sr)
  45 {
  46         return (SDRC_NOT_IMPLEMENTED);
  47 }
  48 
  49 /*


  55         smb_fsctl_t fsctl;
  56         uint32_t status;
  57         uint16_t doserr;
  58 
  59         /* This request is only valid over IPC connections */
  60         if (!STYPE_ISIPC(sr->tid_tree->t_res_type)) {
  61                 smbsr_error(sr, NT_STATUS_ACCESS_DENIED, ERRDOS,
  62                     ERROR_ACCESS_DENIED);
  63                 return (SDRC_ERROR);
  64         }
  65 
  66         fsctl.CtlCode = FSCTL_DFS_GET_REFERRALS;
  67         fsctl.InputCount = xa->smb_tpscnt;
  68         fsctl.OutputCount = 0;
  69         fsctl.MaxOutputResp = xa->smb_mdrcnt;
  70         fsctl.in_mbc = &xa->req_param_mb;
  71         fsctl.out_mbc = &xa->rep_data_mb;
  72 
  73         status = smb_dfs_get_referrals(sr, &fsctl);
  74 
  75         /*
  76          * Out param is the API-level return code.
  77          * Out data (rep_data_mb) is the referral.
  78          */
  79         doserr = smb_status2doserr(status);
  80         (void) smb_mbc_encodef(&xa->rep_param_mb, "w", doserr);
  81         if (status != 0) {
  82                 smbsr_error(sr, status, ERRDOS, doserr);


  83                 return (SDRC_ERROR);
  84         }

  85 
  86         return (SDRC_SUCCESS);
  87 }