LCOV - code coverage report
Current view: top level - source4/libcli/smb2 - tcon.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 10 13 76.9 %
Date: 2024-04-21 15:09:00 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    SMB2 client tree handling
       5             : 
       6             :    Copyright (C) Andrew Tridgell 2005
       7             :    
       8             :    This program is free software; you can redistribute it and/or modify
       9             :    it under the terms of the GNU General Public License as published by
      10             :    the Free Software Foundation; either version 3 of the License, or
      11             :    (at your option) any later version.
      12             :    
      13             :    This program is distributed in the hope that it will be useful,
      14             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :    GNU General Public License for more details.
      17             :    
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20             : */
      21             : 
      22             : #include "includes.h"
      23             : #include "libcli/smb2/smb2.h"
      24             : #include "libcli/smb2/smb2_calls.h"
      25             : #include "../libcli/smb/smbXcli_base.h"
      26             : 
      27             : /*
      28             :   initialise a smb2_session structure
      29             :  */
      30       12885 : struct smb2_tree *smb2_tree_init(struct smb2_session *session,
      31             :                                  TALLOC_CTX *parent_ctx, bool primary)
      32             : {
      33         703 :         struct smb2_tree *tree;
      34             : 
      35       12885 :         tree = talloc_zero(parent_ctx, struct smb2_tree);
      36       12885 :         if (!session) {
      37           0 :                 return NULL;
      38             :         }
      39       12885 :         if (primary) {
      40       12811 :                 tree->session = talloc_steal(tree, session);
      41             :         } else {
      42          74 :                 tree->session = talloc_reference(tree, session);
      43             :         }
      44             : 
      45       12885 :         tree->smbXcli = smbXcli_tcon_create(tree);
      46       12885 :         if (tree->smbXcli == NULL) {
      47           0 :                 talloc_free(tree);
      48           0 :                 return NULL;
      49             :         }
      50             : 
      51       12182 :         return tree;
      52             : }

Generated by: LCOV version 1.14