Print this page
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-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@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>
SUP-672 Zero-padded IP address strings returned by SMB server...
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
SUP-866 smbd lwps stuck in libsocket recv() for no apparent reason
SMB-152 mem leak in smb_authenticate_ext/smb_authsock_sendrecv
SMB-55 SMB2 signing
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>
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).

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/smbsrv/smb_session_setup_andx.c
          +++ new/usr/src/uts/common/fs/smbsrv/smb_session_setup_andx.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  24   24   */
  25   25  
  26   26  #include <sys/types.h>
  27   27  #include <sys/sid.h>
  28   28  #include <sys/priv_names.h>
  29   29  #include <sys/socket.h>
  30   30  #include <netinet/in.h>
  31   31  #include <smbsrv/smb_idmap.h>
  32   32  #include <smbsrv/smb_kproto.h>
  33   33  #include <smbsrv/smb_token.h>
↓ open down ↓ 148 lines elided ↑ open up ↑
 182  182                  sinfo->ssi_native_lm = smbnative_lm_value(native_lm);
 183  183          rc = 0;
 184  184  
 185  185  done:
 186  186          if (rc != 0) {
 187  187                  cmn_err(CE_NOTE,
 188  188                      "SmbSessonSetupX: client %s invalid request",
 189  189                      sr->session->ip_addr_str);
 190  190          }
 191  191  
 192      -        DTRACE_SMB_2(op__SessionSetupX__start, smb_request_t *, sr,
 193      -            smb_arg_sessionsetup_t, sinfo);
      192 +        DTRACE_SMB_START(op__SessionSetupX, smb_request_t *, sr);
 194  193          return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
 195  194  }
 196  195  
 197  196  void
 198  197  smb_post_session_setup_andx(smb_request_t *sr)
 199  198  {
 200  199          smb_arg_sessionsetup_t  *sinfo = sr->sr_ssetup;
 201  200  
 202      -        DTRACE_SMB_2(op__SessionSetupX__done, smb_request_t *, sr,
 203      -            smb_arg_sessionsetup_t, sinfo);
      201 +        DTRACE_SMB_DONE(op__SessionSetupX, smb_request_t *, sr);
 204  202  
 205  203          if (sinfo->ssi_lmpwd != NULL)
 206  204                  bzero(sinfo->ssi_lmpwd, sinfo->ssi_lmpwlen);
 207  205  
 208  206          if (sinfo->ssi_ntpwd != NULL)
 209  207                  bzero(sinfo->ssi_ntpwd, sinfo->ssi_ntpwlen);
 210  208  }
 211  209  
 212  210  /*
 213  211   *
↓ open down ↓ 16 lines elided ↑ open up ↑
 230  228           * Some stuff we do only in the first in a (possible)
 231  229           * sequence of session setup requests.
 232  230           */
 233  231          if (sinfo->ssi_type != SMB_SSNSETUP_NTLM012_EXTSEC ||
 234  232              sr->smb_uid == 0 || sr->smb_uid == 0xFFFF) {
 235  233  
 236  234                  /* This is a first (or only) call */
 237  235                  sr->session->smb_msg_size = sinfo->ssi_maxbufsize;
 238  236                  sr->session->smb_max_mpx = sinfo->ssi_maxmpxcount;
 239  237                  sr->session->capabilities = sinfo->ssi_capabilities;
 240      -
 241      -                if (!smb_oplock_levelII)
 242      -                        sr->session->capabilities &= ~CAP_LEVEL_II_OPLOCKS;
 243      -
 244  238                  sr->session->native_os = sinfo->ssi_native_os;
 245  239                  sr->session->native_lm = sinfo->ssi_native_lm;
 246  240          }
 247  241  
      242 +        /* RejectUnencryptedAccess precludes SMB1 access */
      243 +        if (sr->sr_server->sv_cfg.skc_encrypt == SMB_CONFIG_REQUIRED) {
      244 +                smbsr_error(sr, NT_STATUS_ACCESS_DENIED,
      245 +                    ERRDOS, ERROR_ACCESS_DENIED);
      246 +                return (SDRC_ERROR);
      247 +        }
      248 +
 248  249          /*
 249  250           * The "meat" of authentication happens here.
 250  251           */
 251  252          if (sinfo->ssi_type == SMB_SSNSETUP_NTLM012_EXTSEC)
 252  253                  status = smb_authenticate_ext(sr);
 253  254          else
 254  255                  status = smb_authenticate_old(sr);
 255  256  
 256  257          switch (status) {
 257  258  
↓ open down ↓ 29 lines elided ↑ open up ↑
 287  288                  return (SDRC_ERROR);
 288  289  
 289  290          case NT_STATUS_INSUFF_SERVER_RESOURCES:
 290  291                  smbsr_error(sr, status, ERRSRV, ERRnoresource);
 291  292                  return (SDRC_ERROR);
 292  293  
 293  294          case NT_STATUS_INTERNAL_ERROR:
 294  295          default:
 295  296                  smbsr_error(sr, status, ERRSRV, ERRsrverror);
 296  297                  return (SDRC_ERROR);
      298 +
 297  299          }
 298  300  
 299  301          action = SMB_USER_IS_GUEST(sr->uid_user) ? 1 : 0;
 300  302  
 301  303          switch (sinfo->ssi_type) {
 302  304  
 303  305          default:
 304  306          case SMB_SSNSETUP_PRE_NTLM012:
 305  307          case SMB_SSNSETUP_NTLM012_NOEXT:
 306  308  
↓ open down ↓ 32 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX