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 | struct smb2_tree *smb2_tree_init(struct smb2_session *session,
|
---|
31 | TALLOC_CTX *parent_ctx, bool primary)
|
---|
32 | {
|
---|
33 | struct smb2_tree *tree;
|
---|
34 |
|
---|
35 | tree = talloc_zero(parent_ctx, struct smb2_tree);
|
---|
36 | if (!session) {
|
---|
37 | return NULL;
|
---|
38 | }
|
---|
39 | if (primary) {
|
---|
40 | tree->session = talloc_steal(tree, session);
|
---|
41 | } else {
|
---|
42 | tree->session = talloc_reference(tree, session);
|
---|
43 | }
|
---|
44 |
|
---|
45 | tree->smbXcli = smbXcli_tcon_create(tree);
|
---|
46 | if (tree->smbXcli == NULL) {
|
---|
47 | talloc_free(tree);
|
---|
48 | return NULL;
|
---|
49 | }
|
---|
50 |
|
---|
51 | return tree;
|
---|
52 | }
|
---|