Print this page
12513 SMB 3.1.1 support for server

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/smbsrv/smb2_dispatch.c
          +++ new/usr/src/uts/common/fs/smbsrv/smb2_dispatch.c
↓ open down ↓ 3 lines elided ↑ open up ↑
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13   13   * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  14      - * Copyright 2019 RackTop Systems.
       14 + * Copyright 2020 RackTop Systems, Inc.
  15   15   */
  16   16  
  17   17  
  18   18  #include <smbsrv/smb2_kproto.h>
  19   19  #include <smbsrv/smb_kstat.h>
  20   20  #include <smbsrv/smb2.h>
  21   21  
  22   22  #define SMB2_ASYNCID(sr) (sr->smb2_messageid ^ (1ULL << 62))
  23   23  
  24   24  smb_sdrc_t smb2_invalid_cmd(smb_request_t *);
↓ open down ↓ 941 lines elided ↑ open up ↑
 966  966                      sr->reply.chain_offset - sr->smb2_reply_hdr;
 967  967          } else {
 968  968                  ASSERT(sr->smb2_next_reply == 0);
 969  969          }
 970  970  
 971  971          /*
 972  972           * Overwrite the (now final) SMB2 header for this response.
 973  973           */
 974  974          (void) smb2_encode_header(sr, B_TRUE);
 975  975  
      976 +        /*
      977 +         * Cannot move this into smb2_session_setup() - encoded header required.
      978 +         */
      979 +        if (session->dialect >= SMB_VERS_3_11 &&
      980 +            sr->smb2_cmd_code == SMB2_SESSION_SETUP &&
      981 +            sr->smb2_status == NT_STATUS_MORE_PROCESSING_REQUIRED) {
      982 +                (void) smb31_preauth_sha512_calc(sr, &sr->reply,
      983 +                    session->smb31_preauth_hashval);
      984 +        }
      985 +
 976  986          /* Don't sign if we're going to encrypt */
 977  987          if (sr->tform_ssn == NULL &&
 978  988              (sr->smb2_hdr_flags & SMB2_FLAGS_SIGNED) != 0)
 979  989                  smb2_sign_reply(sr);
 980  990  
 981  991          /*
 982  992           * Non-async runs the whole compound before send.
 983  993           * When we've gone async, send each individually.
 984  994           */
 985  995          if (!sr->smb2_async && sr->smb2_next_command != 0)
↓ open down ↓ 116 lines elided ↑ open up ↑
1102 1112          /*
1103 1113           * Decode the request header
1104 1114           */
1105 1115          sr->smb2_cmd_hdr = sr->command.chain_offset;
1106 1116          if ((smb2_decode_header(sr)) != 0) {
1107 1117                  cmn_err(CE_WARN, "clnt %s bad SMB2 header",
1108 1118                      session->ip_addr_str);
1109 1119                  disconnect = B_TRUE;
1110 1120                  goto cleanup;
1111 1121          }
1112      -        sr->smb2_hdr_flags |=  (SMB2_FLAGS_SERVER_TO_REDIR |
1113      -                                SMB2_FLAGS_ASYNC_COMMAND);
     1122 +        sr->smb2_hdr_flags |= (SMB2_FLAGS_SERVER_TO_REDIR |
     1123 +            SMB2_FLAGS_ASYNC_COMMAND);
1114 1124          sr->smb2_async_id = SMB2_ASYNCID(sr);
1115 1125  
1116 1126          /*
1117 1127           * In case we bail out...
1118 1128           */
1119 1129          if (sr->smb2_credit_charge == 0)
1120 1130                  sr->smb2_credit_charge = 1;
1121 1131          sr->smb2_credit_response = sr->smb2_credit_charge;
1122 1132  
1123 1133          /*
↓ open down ↓ 639 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX