gp: Skip site GP list if no site is found
[Samba.git] / source4 / libcli / smb2 / tcon.c
blob702e308aa63f2d71831c72cab489a16f50837257
1 /*
2 Unix SMB/CIFS implementation.
4 SMB2 client tree handling
6 Copyright (C) Andrew Tridgell 2005
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.
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.
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/>.
22 #include "includes.h"
23 #include "libcli/smb2/smb2.h"
24 #include "libcli/smb2/smb2_calls.h"
25 #include "../libcli/smb/smbXcli_base.h"
28 initialise a smb2_session structure
30 struct smb2_tree *smb2_tree_init(struct smb2_session *session,
31 TALLOC_CTX *parent_ctx, bool primary)
33 struct smb2_tree *tree;
35 tree = talloc_zero(parent_ctx, struct smb2_tree);
36 if (!session) {
37 return NULL;
39 if (primary) {
40 tree->session = talloc_steal(tree, session);
41 } else {
42 tree->session = talloc_reference(tree, session);
45 tree->smbXcli = smbXcli_tcon_create(tree);
46 if (tree->smbXcli == NULL) {
47 talloc_free(tree);
48 return NULL;
51 return tree;