summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-11-12 07:19:49 +0100
committerStefan Metzmacher <metze@samba.org>2014-11-27 16:45:05 +0100
commit683b9569487bd30ecd0ba677367dbe9e0eff16c2 (patch)
tree540b73dadd651e2c969b6a8a8ff5855197ba7572
parent38b0fded58f9e066ad7190f7797cdfb92d3d23ff (diff)
downloadsamba-683b9569487bd30ecd0ba677367dbe9e0eff16c2.tar.gz
s4:torture/smb2: skip lease tests if the server doesn't support them
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source4/torture/smb2/lease.c62
1 files changed, 56 insertions, 6 deletions
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index 43269582662..e06faea86a5 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -142,12 +142,14 @@ static bool test_lease_request(struct torture_context *tctx,
CHECK_LEASE(&io, "RHW", true, LEASE1);
/* But will reject leases on directories. */
- smb2_lease_create(&io, &ls, true, dname, LEASE2, smb2_util_lease_state("RHW"));
- status = smb2_create(tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_OK);
- CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_DIRECTORY);
- CHECK_LEASE(&io, "", false, 0);
- smb2_util_close(tree, io.out.file.handle);
+ if (!(caps & SMB2_CAP_DIRECTORY_LEASING)) {
+ smb2_lease_create(&io, &ls, true, dname, LEASE2, smb2_util_lease_state("RHW"));
+ status = smb2_create(tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_DIRECTORY);
+ CHECK_LEASE(&io, "", false, 0);
+ smb2_util_close(tree, io.out.file.handle);
+ }
/* Also rejects multiple files leased under the same key. */
smb2_lease_create(&io, &ls, true, fname2, LEASE1, smb2_util_lease_state("RHW"));
@@ -1191,6 +1193,21 @@ static bool test_lease_v2_request_parent(struct torture_context *tctx,
NTSTATUS status;
const char *fname = "lease.dat";
bool ret = true;
+ uint32_t caps;
+ enum protocol_types protocol;
+
+ caps = smb2cli_conn_server_capabilities(tree->session->transport->conn);
+ if (!(caps & SMB2_CAP_LEASING)) {
+ torture_skip(tctx, "leases are not supported");
+ }
+ if (!(caps & SMB2_CAP_DIRECTORY_LEASING)) {
+ torture_skip(tctx, "directory leases are not supported");
+ }
+
+ protocol = smbXcli_conn_protocol(tree->session->transport->conn);
+ if (protocol < PROTOCOL_SMB3_00) {
+ torture_skip(tctx, "v2 leases are not supported");
+ }
smb2_util_unlink(tree, fname);
@@ -1230,6 +1247,7 @@ static bool test_lease_break_twice(struct torture_context *tctx,
const char *fname = "lease.dat";
bool ret = true;
uint32_t caps;
+ enum protocol_types protocol;
caps = smb2cli_conn_server_capabilities(
tree->session->transport->conn);
@@ -1237,6 +1255,11 @@ static bool test_lease_break_twice(struct torture_context *tctx,
torture_skip(tctx, "leases are not supported");
}
+ protocol = smbXcli_conn_protocol(tree->session->transport->conn);
+ if (protocol < PROTOCOL_SMB3_00) {
+ torture_skip(tctx, "v2 leases are not supported");
+ }
+
smb2_util_unlink(tree, fname);
ZERO_STRUCT(break_info);
@@ -1297,6 +1320,21 @@ static bool test_lease_v2_request(struct torture_context *tctx,
const char *dnamefname = "lease.dir\\lease.dat";
const char *dnamefname2 = "lease.dir\\lease2.dat";
bool ret = true;
+ uint32_t caps;
+ enum protocol_types protocol;
+
+ caps = smb2cli_conn_server_capabilities(tree->session->transport->conn);
+ if (!(caps & SMB2_CAP_LEASING)) {
+ torture_skip(tctx, "leases are not supported");
+ }
+ if (!(caps & SMB2_CAP_DIRECTORY_LEASING)) {
+ torture_skip(tctx, "directory leases are not supported");
+ }
+
+ protocol = smbXcli_conn_protocol(tree->session->transport->conn);
+ if (protocol < PROTOCOL_SMB3_00) {
+ torture_skip(tctx, "v2 leases are not supported");
+ }
smb2_util_unlink(tree, fname);
smb2_deltree(tree, dname);
@@ -1427,6 +1465,18 @@ static bool test_lease_v2_epoch1(struct torture_context *tctx,
const char *fname = "lease.dat";
bool ret = true;
NTSTATUS status;
+ uint32_t caps;
+ enum protocol_types protocol;
+
+ caps = smb2cli_conn_server_capabilities(tree->session->transport->conn);
+ if (!(caps & SMB2_CAP_LEASING)) {
+ torture_skip(tctx, "leases are not supported");
+ }
+
+ protocol = smbXcli_conn_protocol(tree->session->transport->conn);
+ if (protocol < PROTOCOL_SMB3_00) {
+ torture_skip(tctx, "v2 leases are not supported");
+ }
smb2_util_unlink(tree, fname);