Print this page
12513 SMB 3.1.1 support for server


   4  * The contents of this file are subject to the terms of the
   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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.

  24  */
  25 
  26 #include <sys/atomic.h>
  27 #include <sys/synch.h>
  28 #include <sys/types.h>
  29 #include <sys/sdt.h>
  30 #include <sys/random.h>
  31 #include <smbsrv/netbios.h>
  32 #include <smbsrv/smb2_kproto.h>
  33 #include <smbsrv/string.h>
  34 #include <netinet/tcp.h>
  35 
  36 /* How many iovec we'll handle as a local array (no allocation) */
  37 #define SMB_LOCAL_IOV_MAX       16
  38 
  39 #define SMB_NEW_KID()   atomic_inc_64_nv(&smb_kids)
  40 
  41 static volatile uint64_t smb_kids;
  42 
  43 /*


 839         session->s_magic = SMB_SESSION_MAGIC;
 840         return (session);
 841 }
 842 
 843 void
 844 smb_session_delete(smb_session_t *session)
 845 {
 846 
 847         ASSERT(session->s_magic == SMB_SESSION_MAGIC);
 848 
 849         if (session->enc_mech != NULL)
 850                 smb3_encrypt_fini(session);
 851 
 852         if (session->sign_fini != NULL)
 853                 session->sign_fini(session);
 854 
 855         if (session->signing.mackey != NULL) {
 856                 kmem_free(session->signing.mackey,
 857                     session->signing.mackey_len);
 858         }



 859 
 860         session->s_magic = 0;
 861 
 862         smb_rwx_destroy(&session->s_lock);
 863         smb_net_txl_destructor(&session->s_txlst);
 864 
 865         mutex_destroy(&session->s_credits_mutex);
 866 
 867         smb_slist_destructor(&session->s_req_list);
 868         smb_llist_destructor(&session->s_tree_list);
 869         smb_llist_destructor(&session->s_user_list);
 870         smb_llist_destructor(&session->s_xa_list);
 871 
 872         ASSERT(session->s_tree_cnt == 0);
 873         ASSERT(session->s_file_cnt == 0);
 874         ASSERT(session->s_dir_cnt == 0);
 875 
 876         smb_idpool_destructor(&session->s_tid_pool);
 877         smb_idpool_destructor(&session->s_uid_pool);
 878         if (session->sock != NULL) {




   4  * The contents of this file are subject to the terms of the
   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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright 2020 RackTop Systems, Inc.
  25  */
  26 
  27 #include <sys/atomic.h>
  28 #include <sys/synch.h>
  29 #include <sys/types.h>
  30 #include <sys/sdt.h>
  31 #include <sys/random.h>
  32 #include <smbsrv/netbios.h>
  33 #include <smbsrv/smb2_kproto.h>
  34 #include <smbsrv/string.h>
  35 #include <netinet/tcp.h>
  36 
  37 /* How many iovec we'll handle as a local array (no allocation) */
  38 #define SMB_LOCAL_IOV_MAX       16
  39 
  40 #define SMB_NEW_KID()   atomic_inc_64_nv(&smb_kids)
  41 
  42 static volatile uint64_t smb_kids;
  43 
  44 /*


 840         session->s_magic = SMB_SESSION_MAGIC;
 841         return (session);
 842 }
 843 
 844 void
 845 smb_session_delete(smb_session_t *session)
 846 {
 847 
 848         ASSERT(session->s_magic == SMB_SESSION_MAGIC);
 849 
 850         if (session->enc_mech != NULL)
 851                 smb3_encrypt_fini(session);
 852 
 853         if (session->sign_fini != NULL)
 854                 session->sign_fini(session);
 855 
 856         if (session->signing.mackey != NULL) {
 857                 kmem_free(session->signing.mackey,
 858                     session->signing.mackey_len);
 859         }
 860 
 861         if (session->preauth_mech != NULL)
 862                 smb31_preauth_fini(session);
 863 
 864         session->s_magic = 0;
 865 
 866         smb_rwx_destroy(&session->s_lock);
 867         smb_net_txl_destructor(&session->s_txlst);
 868 
 869         mutex_destroy(&session->s_credits_mutex);
 870 
 871         smb_slist_destructor(&session->s_req_list);
 872         smb_llist_destructor(&session->s_tree_list);
 873         smb_llist_destructor(&session->s_user_list);
 874         smb_llist_destructor(&session->s_xa_list);
 875 
 876         ASSERT(session->s_tree_cnt == 0);
 877         ASSERT(session->s_file_cnt == 0);
 878         ASSERT(session->s_dir_cnt == 0);
 879 
 880         smb_idpool_destructor(&session->s_tid_pool);
 881         smb_idpool_destructor(&session->s_uid_pool);
 882         if (session->sock != NULL) {