[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Fri Feb 3 04:46:03 MST 2012
The branch, master has been updated
via 877d4e0 s4:torture: add a smb2.durable_open.reopen4 test
via a4fd3eb s4:torture: add a torture_smb2_session_setup() utility function
via adb9b7f s4:torture: add smb2.durable_open test reopen3
via 7c7e1fd s4:torture: add torture_smb2_tree_connect() utility function
via 1d8fbff s4:torture: add smb2.durable_open test reopen2
via f9e85d0 s4:torture: add smb2.durable_open test reopen1
via 6a93475 s4:libcli:smb2: don't allocate the smb2_tree struct earlier than necessary in smb2_connect()
via 97823b6 s4:libcli/torture:smb2: change smb2_tree_connect to take a smb2_session instead of smb2_tree arguement.
via ce5fc22 s4:torture:smb2: talloc_free the right tree structure in secondary_tcon()
via 87cf808 s4:torture:smb2: check for success of talloc in secondary_tcon()
via 5f19eb8 s4:torture:smb2:notify: remove an unused variable
via 48ee2c3 s4:torture:smb2:notify: remove an unused variable
via 3116592 s4:torture:smb2: remove an unused variable from torture_smb2_setinfo()
via 2b92993 loadparm: fix a load of uninitialized memory errors found by valgrind.
from 357631b s3-nmbd: don't discard DGRAM frames from local addresses when we are a DC
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 877d4e048ed2d6f62123c886c2bbcda402399c62
Author: Michael Adam <obnox at samba.org>
Date: Mon Jan 30 12:08:38 2012 +0100
s4:torture: add a smb2.durable_open.reopen4 test
open a durable handle, logoff, new sessions setup, try durable reopen (fail),
open tcon, durable reopen (succeed)
Autobuild-User: Michael Adam <obnox at samba.org>
Autobuild-Date: Fri Feb 3 12:45:34 CET 2012 on sn-devel-104
commit a4fd3eb4a906df3289a0401e41c1703f58cee046
Author: Michael Adam <obnox at samba.org>
Date: Mon Jan 30 12:07:07 2012 +0100
s4:torture: add a torture_smb2_session_setup() utility function
commit adb9b7fbf06509457107dab514ed216adf78e222
Author: Michael Adam <obnox at samba.org>
Date: Fri Jan 27 17:21:25 2012 +0100
s4:torture: add smb2.durable_open test reopen3
Do a durable open, tdis, tree_connect, durable reopen -> fail
commit 7c7e1fd5c7028fa242213bfa13551dbcff181077
Author: Michael Adam <obnox at samba.org>
Date: Fri Jan 27 17:20:23 2012 +0100
s4:torture: add torture_smb2_tree_connect() utility function
This does a tcon based on an existing session, using the
name an host present in the torture context.
commit 1d8fbff7ffbea58ae8ed55fd887f4be022f1cc97
Author: Michael Adam <obnox at samba.org>
Date: Fri Jan 27 13:06:09 2012 +0100
s4:torture: add smb2.durable_open test reopen2
durable open, disconnect, new seession, durable reopen
commit f9e85d09b35345d3161a1fed5040206f7ba1f3d0
Author: Michael Adam <obnox at samba.org>
Date: Fri Jan 27 13:03:08 2012 +0100
s4:torture: add smb2.durable_open test reopen1
commit 6a93475dd04236133cee4327087ccaef69a05225
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 13:41:40 2012 +0100
s4:libcli:smb2: don't allocate the smb2_tree struct earlier than necessary in smb2_connect()
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
commit 97823b69e9624a1cd59a42fe4c6a6e14896b7ae7
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 13:39:56 2012 +0100
s4:libcli/torture:smb2: change smb2_tree_connect to take a smb2_session instead of smb2_tree arguement.
Only the tree->session is needed. This way it is less confusing.
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
commit ce5fc22896a5475a33ee03ab6a1babf4159ebe57
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 13:38:08 2012 +0100
s4:torture:smb2: talloc_free the right tree structure in secondary_tcon()
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
commit 87cf808edb6878187caf2ee533b59ac4d4415767
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 13:36:20 2012 +0100
s4:torture:smb2: check for success of talloc in secondary_tcon()
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
commit 5f19eb8e5813c7e089d12f8b7803740f9c2a94fa
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 15:56:48 2012 +0100
s4:torture:smb2:notify: remove an unused variable
commit 48ee2c34505099c2bdf84d2c074e94c1a95a3f60
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 15:53:26 2012 +0100
s4:torture:smb2:notify: remove an unused variable
commit 31165925521150b04e907f2fd6869183a7a3b8ef
Author: Michael Adam <obnox at samba.org>
Date: Thu Feb 2 15:42:16 2012 +0100
s4:torture:smb2: remove an unused variable from torture_smb2_setinfo()
commit 2b9299310fdce8d4298089bf67cafd6e9e748ec2
Author: Michael Adam <obnox at samba.org>
Date: Fri Feb 3 00:21:50 2012 +0100
loadparm: fix a load of uninitialized memory errors found by valgrind.
-----------------------------------------------------------------------
Summary of changes:
lib/util/params.c | 2 +-
source4/libcli/smb2/connect.c | 12 +-
source4/libcli/smb2/tcon.c | 10 +-
source4/torture/smb2/durable_open.c | 285 +++++++++++++++++++++++++++++++++++
source4/torture/smb2/notify.c | 12 +-
source4/torture/smb2/setinfo.c | 2 -
source4/torture/smb2/util.c | 73 +++++++++
7 files changed, 376 insertions(+), 20 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/params.c b/lib/util/params.c
index 45fcd5b..3f1d535 100644
--- a/lib/util/params.c
+++ b/lib/util/params.c
@@ -556,7 +556,7 @@ bool pm_process( const char *FileName,
else /* If we don't have a buffer */
{ /* allocate one, then parse, */
InFile->bSize = BUFR_INC; /* then free. */
- InFile->bufr = talloc_array(InFile, char, InFile->bSize );
+ InFile->bufr = talloc_zero_array(InFile, char, InFile->bSize );
if( NULL == InFile->bufr )
{
DEBUG(0,("%s memory allocation failure.\n", func));
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index 6b980f2..a6a5690 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -202,11 +202,6 @@ static void smb2_connect_session_done(struct tevent_req *subreq)
return;
}
- state->tree = smb2_tree_init(state->session, state, true);
- if (tevent_req_nomem(state->tree, req)) {
- return;
- }
-
state->tcon.in.reserved = 0;
state->tcon.in.path = talloc_asprintf(state, "\\\\%s\\%s",
state->host, state->share);
@@ -214,7 +209,7 @@ static void smb2_connect_session_done(struct tevent_req *subreq)
return;
}
- smb2req = smb2_tree_connect_send(state->tree, &state->tcon);
+ smb2req = smb2_tree_connect_send(state->session, &state->tcon);
if (tevent_req_nomem(smb2req, req)) {
return;
}
@@ -237,6 +232,11 @@ static void smb2_connect_tcon_done(struct smb2_request *smb2req)
return;
}
+ state->tree = smb2_tree_init(state->session, state, true);
+ if (tevent_req_nomem(state->tree, req)) {
+ return;
+ }
+
state->tree->tid = state->tcon.out.tid;
tevent_req_done(req);
diff --git a/source4/libcli/smb2/tcon.c b/source4/libcli/smb2/tcon.c
index c5e5b99..3a0f246 100644
--- a/source4/libcli/smb2/tcon.c
+++ b/source4/libcli/smb2/tcon.c
@@ -46,17 +46,17 @@ struct smb2_tree *smb2_tree_init(struct smb2_session *session,
/*
send a tree connect
*/
-struct smb2_request *smb2_tree_connect_send(struct smb2_tree *tree,
+struct smb2_request *smb2_tree_connect_send(struct smb2_session *session,
struct smb2_tree_connect *io)
{
struct smb2_request *req;
NTSTATUS status;
- req = smb2_request_init(tree->session->transport, SMB2_OP_TCON,
+ req = smb2_request_init(session->transport, SMB2_OP_TCON,
0x08, true, 0);
if (req == NULL) return NULL;
- req->session = tree->session;
+ req->session = session;
SSVAL(req->out.body, 0x02, io->in.reserved);
status = smb2_push_o16s16_string(&req->out, 0x04, io->in.path);
@@ -104,8 +104,8 @@ NTSTATUS smb2_tree_connect_recv(struct smb2_request *req, struct smb2_tree_conne
/*
sync tree connect request
*/
-NTSTATUS smb2_tree_connect(struct smb2_tree *tree, struct smb2_tree_connect *io)
+NTSTATUS smb2_tree_connect(struct smb2_session *session, struct smb2_tree_connect *io)
{
- struct smb2_request *req = smb2_tree_connect_send(tree, io);
+ struct smb2_request *req = smb2_tree_connect_send(session, io);
return smb2_tree_connect_recv(req, io);
}
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 512f432..09c6407 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -319,6 +319,287 @@ done:
return ret;
}
+/**
+ * basic test for doing a durable open
+ * and do a durable reopen on the same connection
+ */
+bool test_durable_open_reopen1(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ char fname[256];
+ struct smb2_handle _h;
+ struct smb2_handle *h = NULL;
+ struct smb2_create io1, io2;
+ bool ret = true;
+
+ /* Choose a random name in case the state is left a little funky. */
+ snprintf(fname, 256, "durable_open_reopen1_%s.dat",
+ generate_random_str(tctx, 8));
+
+ smb2_util_unlink(tree, fname);
+
+ smb2_oplock_create_share(&io1, fname,
+ smb2_util_share_access(""),
+ smb2_util_oplock_level("b"));
+ io1.in.durable_open = true;
+
+ status = smb2_create(tree, mem_ctx, &io1);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ _h = io1.out.file.handle;
+ h = &_h;
+ CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io1.out.durable_open, true);
+ CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
+
+ /* try a durable reconnect while the file is still open */
+ ZERO_STRUCT(io2);
+ io2.in.fname = fname;
+ io2.in.durable_handle = h;
+
+ status = smb2_create(tree, mem_ctx, &io2);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+done:
+ if (h != NULL) {
+ smb2_util_close(tree, *h);
+ }
+
+ smb2_util_unlink(tree, fname);
+
+ talloc_free(tree);
+
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
+/**
+ * basic test for doing a durable open
+ * tcp disconnect, reconnect, do a durable reopen (succeeds)
+ */
+bool test_durable_open_reopen2(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ char fname[256];
+ struct smb2_handle _h;
+ struct smb2_handle *h = NULL;
+ struct smb2_create io1, io2;
+ bool ret = true;
+
+ /* Choose a random name in case the state is left a little funky. */
+ snprintf(fname, 256, "durable_open_reopen2_%s.dat",
+ generate_random_str(tctx, 8));
+
+ smb2_util_unlink(tree, fname);
+
+ smb2_oplock_create_share(&io1, fname,
+ smb2_util_share_access(""),
+ smb2_util_oplock_level("b"));
+ io1.in.durable_open = true;
+
+ status = smb2_create(tree, mem_ctx, &io1);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ _h = io1.out.file.handle;
+ h = &_h;
+ CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io1.out.durable_open, true);
+ CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
+
+ /* disconnect, reconnect and then do durable reopen */
+ talloc_free(tree);
+ tree = NULL;
+
+ if (!torture_smb2_connection(tctx, &tree)) {
+ torture_warning(tctx, "couldn't reconnect, bailing\n");
+ ret = false;
+ goto done;
+ }
+
+ ZERO_STRUCT(io2);
+ io2.in.fname = fname;
+ io2.in.durable_handle = h;
+
+ status = smb2_create(tree, mem_ctx, &io2);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io2.out.durable_open, true);
+ CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
+ _h = io2.out.file.handle;
+ h = &_h;
+
+done:
+ if (h != NULL) {
+ smb2_util_close(tree, *h);
+ }
+
+ smb2_util_unlink(tree, fname);
+
+ talloc_free(tree);
+
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
+/**
+ * basic test for doing a durable open:
+ * tdis, new tcon, try durable reopen (fails)
+ */
+bool test_durable_open_reopen3(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ char fname[256];
+ struct smb2_handle _h;
+ struct smb2_handle *h = NULL;
+ struct smb2_create io1, io2;
+ bool ret = true;
+ struct smb2_tree *tree2;
+
+ /* Choose a random name in case the state is left a little funky. */
+ snprintf(fname, 256, "durable_open_reopen3_%s.dat",
+ generate_random_str(tctx, 8));
+
+ smb2_util_unlink(tree, fname);
+
+ smb2_oplock_create_share(&io1, fname,
+ smb2_util_share_access(""),
+ smb2_util_oplock_level("b"));
+ io1.in.durable_open = true;
+
+ status = smb2_create(tree, mem_ctx, &io1);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ _h = io1.out.file.handle;
+ h = &_h;
+ CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io1.out.durable_open, true);
+ CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
+
+ /* disconnect, reconnect and then do durable reopen */
+ status = smb2_tdis(tree);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ if (!torture_smb2_tree_connect(tctx, tree->session, mem_ctx, &tree2)) {
+ torture_warning(tctx, "couldn't reconnect to share, bailing\n");
+ ret = false;
+ goto done;
+ }
+
+
+ ZERO_STRUCT(io2);
+ io2.in.fname = fname;
+ io2.in.durable_handle = h;
+
+ status = smb2_create(tree2, mem_ctx, &io2);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
+done:
+ if (h != NULL) {
+ smb2_util_close(tree, *h);
+ }
+
+ smb2_util_unlink(tree2, fname);
+
+ talloc_free(tree);
+
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
+/**
+ * basic test for doing a durable open:
+ * logoff, create a new session, do a durable reopen (succeeds)
+ */
+bool test_durable_open_reopen4(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ char fname[256];
+ struct smb2_handle _h;
+ struct smb2_handle *h = NULL;
+ struct smb2_create io1, io2;
+ bool ret = true;
+ struct smb2_transport *transport;
+ struct smb2_tree *tree2;
+
+ /* Choose a random name in case the state is left a little funky. */
+ snprintf(fname, 256, "durable_open_reopen4_%s.dat",
+ generate_random_str(tctx, 8));
+
+ smb2_util_unlink(tree, fname);
+
+ smb2_oplock_create_share(&io1, fname,
+ smb2_util_share_access(""),
+ smb2_util_oplock_level("b"));
+ io1.in.durable_open = true;
+ io1.in.create_options |= NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
+
+ status = smb2_create(tree, mem_ctx, &io1);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ _h = io1.out.file.handle;
+ h = &_h;
+ CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io1.out.durable_open, true);
+ CHECK_VAL(io1.out.oplock_level, smb2_util_oplock_level("b"));
+
+ /* disconnect, reconnect and then do durable reopen */
+ transport = tree->session->transport;
+ status = smb2_logoff(tree->session);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ if (!torture_smb2_session_setup(tctx, transport, mem_ctx, &tree->session)) {
+ torture_warning(tctx, "session setup failed.\n");
+ ret = false;
+ goto done;
+ }
+
+ ZERO_STRUCT(io2);
+ io2.in.fname = fname;
+ io2.in.durable_handle = h;
+
+ status = smb2_create(tree, mem_ctx, &io2);
+ CHECK_STATUS(status, NT_STATUS_NETWORK_NAME_DELETED);
+
+ if (!torture_smb2_tree_connect(tctx, tree->session, mem_ctx, &tree2)) {
+ torture_warning(tctx, "tree connect failed.\n");
+ ret = false;
+ goto done;
+ }
+
+ ZERO_STRUCT(io2);
+ io2.in.fname = fname;
+ io2.in.durable_handle = h;
+
+ status = smb2_create(tree2, mem_ctx, &io2);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ _h = io2.out.file.handle;
+ h = &_h;
+ CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
+ CHECK_VAL(io2.out.durable_open, true);
+ CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b"));
+
+done:
+ if (h != NULL) {
+ smb2_util_close(tree, *h);
+ }
+
+ smb2_util_unlink(tree2, fname);
+
+ talloc_free(tree);
+
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
/*
basic testing of SMB2 durable opens
regarding the position information on the handle
@@ -790,6 +1071,10 @@ struct torture_suite *torture_smb2_durable_open_init(void)
torture_suite_add_1smb2_test(suite, "open1", test_durable_open_open1);
torture_suite_add_1smb2_test(suite, "open2", test_durable_open_open2);
+ torture_suite_add_1smb2_test(suite, "reopen1", test_durable_open_reopen1);
+ torture_suite_add_1smb2_test(suite, "reopen2", test_durable_open_reopen2);
+ torture_suite_add_1smb2_test(suite, "reopen3", test_durable_open_reopen3);
+ torture_suite_add_1smb2_test(suite, "reopen4", test_durable_open_reopen4);
torture_suite_add_2smb2_test(suite, "file-position",
test_durable_open_file_position);
torture_suite_add_2smb2_test(suite, "oplock", test_durable_open_oplock);
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 0e6d702..e4e2636 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -845,8 +845,6 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
uint32_t mask;
int i;
char c = 1;
- struct timeval tv;
- NTTIME t;
union smb_setfileinfo sinfo;
smb2_deltree(tree1, BASEDIR);
@@ -854,8 +852,6 @@ static bool torture_smb2_notify_mask(struct torture_context *torture,
torture_comment(torture, "TESTING CHANGE NOTIFY COMPLETION FILTERS\n");
- tv = timeval_current_ofs(1000, 0);
- t = timeval_to_nttime(&tv);
/*
get a handle on the directory
@@ -1808,13 +1804,17 @@ static struct smb2_tree *secondary_tcon(struct smb2_tree *tree,
torture_comment(tctx,
"create a second tree context on the same session\n");
tree1 = smb2_tree_init(tree->session, tctx, false);
+ if (tree1 == NULL) {
+ torture_comment(tctx, "Out of memory\n");
+ return NULL;
+ }
ZERO_STRUCT(tcon.smb2);
tcon.generic.level = RAW_TCON_SMB2;
tcon.smb2.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
- status = smb2_tree_connect(tree, &(tcon.smb2));
+ status = smb2_tree_connect(tree->session, &(tcon.smb2));
if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tree);
+ talloc_free(tree1);
torture_comment(tctx,"Failed to create secondary tree\n");
return NULL;
}
diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c
index 734cf1f..fb012ee 100644
--- a/source4/torture/smb2/setinfo.c
+++ b/source4/torture/smb2/setinfo.c
@@ -51,7 +51,6 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
bool ret = true;
struct smb2_handle handle;
char *fname;
- char *fname_new;
union smb_fileinfo finfo2;
union smb_setfileinfo sfinfo;
struct security_ace ace;
@@ -65,7 +64,6 @@ bool torture_smb2_setinfo(struct torture_context *tctx)
ZERO_STRUCT(handle);
fname = talloc_asprintf(tctx, BASEDIR "fnum_test_%d.txt", n);
- fname_new = talloc_asprintf(tctx, BASEDIR "fnum_test_new_%d.txt", n);
if (!torture_smb2_connection(tctx, &tree)) {
return false;
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 094161e..5dca5c3 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -259,6 +259,79 @@ void torture_smb2_all_info(struct smb2_tree *tree, struct smb2_handle handle)
talloc_free(tmp_ctx);
}
+/**
+ * open a smb2 tree connect
+ */
+bool torture_smb2_tree_connect(struct torture_context *tctx,
+ struct smb2_session *session,
+ TALLOC_CTX *mem_ctx,
+ struct smb2_tree **_tree)
+{
+ NTSTATUS status;
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
+ struct smb2_tree_connect tcon;
+ struct smb2_tree *tree;
+
+ ZERO_STRUCT(tcon);
+ tcon.in.reserved = 0;
+ tcon.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
+ if (tcon.in.path == NULL) {
+ printf("talloc failed\n");
+ return false;
+ }
+
+ status = smb2_tree_connect(session, &tcon);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Failed to tree_connect to SMB2 share \\\\%s\\%s - %s\n",
+ host, share, nt_errstr(status));
+ return false;
+ }
+
+ tree = smb2_tree_init(session, mem_ctx, true);
+ if (tree == NULL) {
+ printf("talloc failed\n");
+ return false;
+ }
+
+ tree->tid = tcon.out.tid;
+
+ *_tree = tree;
+
+ return true;
+}
--
Samba Shared Repository
More information about the samba-cvs
mailing list