summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/gentest.c17
-rw-r--r--source4/torture/smb2/compound.c19
2 files changed, 23 insertions, 13 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 9b6e7fc0fd..c7e32de359 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -38,6 +38,7 @@
#include "dynconfig/dynconfig.h"
#include "libcli/security/security.h"
#include "libcli/raw/raw_proto.h"
+#include "../libcli/smb/smbXcli_base.h"
#define NSERVERS 2
#define NINSTANCES 2
@@ -279,13 +280,21 @@ static bool connect_servers(struct tevent_context *ev,
static unsigned int time_skew(void)
{
unsigned int ret;
+ NTTIME nt0, nt1;
+
if (options.smb2) {
- ret = labs(servers[0].smb2_tree[0]->session->transport->negotiate.system_time -
- servers[1].smb2_tree[0]->session->transport->negotiate.system_time);
+ struct smbXcli_conn *c0, *c1;
+
+ c0 = servers[0].smb2_tree[0]->session->transport->conn;
+ c1 = servers[1].smb2_tree[0]->session->transport->conn;
+
+ nt0 = smbXcli_conn_server_system_time(c0);
+ nt1 = smbXcli_conn_server_system_time(c1);
} else {
- ret = labs(servers[0].smb_tree[0]->session->transport->negotiate.server_time -
- servers[1].smb_tree[0]->session->transport->negotiate.server_time);
+ nt0 = servers[0].smb_tree[0]->session->transport->negotiate.server_time;
+ nt1 = servers[1].smb_tree[0]->session->transport->negotiate.server_time;
}
+ ret = labs(nt0 - nt1);
return ret + 300;
}
diff --git a/source4/torture/smb2/compound.c b/source4/torture/smb2/compound.c
index 1caa688a35..cb5b744c5d 100644
--- a/source4/torture/smb2/compound.c
+++ b/source4/torture/smb2/compound.c
@@ -24,6 +24,7 @@
#include "libcli/smb2/smb2_calls.h"
#include "torture/torture.h"
#include "torture/smb2/proto.h"
+#include "../libcli/smb/smbXcli_base.h"
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
@@ -47,7 +48,7 @@ static bool test_compound_related1(struct torture_context *tctx,
bool ret = true;
struct smb2_request *req[2];
uint32_t saved_tid = tree->tid;
- uint64_t saved_uid = tree->session->uid;
+ uint64_t saved_uid = smb2cli_session_current_id(tree->session->smbXcli);
smb2_transport_credits_ask_num(tree->session->transport, 2);
@@ -86,7 +87,7 @@ static bool test_compound_related1(struct torture_context *tctx,
cl.in.file.handle = hd;
tree->tid = 0xFFFFFFFF;
- tree->session->uid = UINT64_MAX;
+ smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
req[1] = smb2_close_send(tree, &cl);
@@ -96,7 +97,7 @@ static bool test_compound_related1(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK);
tree->tid = saved_tid;
- tree->session->uid = saved_uid;
+ smb2cli_session_set_id_and_flags(tree->session->smbXcli, saved_uid, 0);
smb2_util_unlink(tree, fname);
done:
@@ -114,7 +115,7 @@ static bool test_compound_related2(struct torture_context *tctx,
bool ret = true;
struct smb2_request *req[5];
uint32_t saved_tid = tree->tid;
- uint64_t saved_uid = tree->session->uid;
+ uint64_t saved_uid = smb2cli_session_current_id(tree->session->smbXcli);
smb2_transport_credits_ask_num(tree->session->transport, 5);
@@ -152,7 +153,7 @@ static bool test_compound_related2(struct torture_context *tctx,
ZERO_STRUCT(cl);
cl.in.file.handle = hd;
tree->tid = 0xFFFFFFFF;
- tree->session->uid = UINT64_MAX;
+ smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
req[1] = smb2_close_send(tree, &cl);
req[2] = smb2_close_send(tree, &cl);
@@ -171,7 +172,7 @@ static bool test_compound_related2(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
tree->tid = saved_tid;
- tree->session->uid = saved_uid;
+ smb2cli_session_set_id_and_flags(tree->session->smbXcli, saved_uid, 0);
smb2_util_unlink(tree, fname);
done:
@@ -314,7 +315,7 @@ static bool test_compound_invalid2(struct torture_context *tctx,
bool ret = true;
struct smb2_request *req[5];
uint32_t saved_tid = tree->tid;
- uint64_t saved_uid = tree->session->uid;
+ uint64_t saved_uid = smb2cli_session_current_id(tree->session->smbXcli);
smb2_transport_credits_ask_num(tree->session->transport, 5);
@@ -352,7 +353,7 @@ static bool test_compound_invalid2(struct torture_context *tctx,
ZERO_STRUCT(cl);
cl.in.file.handle = hd;
tree->tid = 0xFFFFFFFF;
- tree->session->uid = UINT64_MAX;
+ smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
req[1] = smb2_close_send(tree, &cl);
/* strange that this is not generating invalid parameter */
@@ -374,7 +375,7 @@ static bool test_compound_invalid2(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
tree->tid = saved_tid;
- tree->session->uid = saved_uid;
+ smb2cli_session_set_id_and_flags(tree->session->smbXcli, saved_uid, 0);
smb2_util_unlink(tree, fname);
done: