summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-02-28 04:24:12 +0100
committerStefan Metzmacher <metze@samba.org>2012-02-28 05:22:50 +0100
commitc64a85ee191d1554cbbd662809de0a57d8de6c69 (patch)
treef39c09ee54c0b21774ba235af04e689b0ef6f3b5
parent62d8d03c8c6fcd006810613aaff6cd73d63a2774 (diff)
downloadsamba-c64a85ee191d1554cbbd662809de0a57d8de6c69.tar.gz
samba-c64a85ee191d1554cbbd662809de0a57d8de6c69.tar.bz2
samba-c64a85ee191d1554cbbd662809de0a57d8de6c69.zip
s3:torture/test_smb2: check directory listing during reauth
metze
-rw-r--r--source3/torture/test_smb2.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 9334ab73bc..b29f913ef6 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -1036,6 +1036,9 @@ bool run_smb2_session_reauth(int dummy)
NTSTATUS status;
bool ok;
uint64_t fid_persistent, fid_volatile;
+ uint64_t dir_persistent, dir_volatile;
+ uint8_t *dir_data;
+ uint32_t dir_data_length;
struct tevent_context *ev;
struct tevent_req *subreq;
DATA_BLOB in_blob = data_blob_null;
@@ -1094,6 +1097,33 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
+ status = smb2cli_create(cli, "",
+ SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
+ SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
+ SEC_STD_SYNCHRONIZE|
+ SEC_DIR_LIST|
+ SEC_DIR_READ_ATTRIBUTE, /* desired_access, */
+ 0, /* file_attributes, */
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access, */
+ FILE_OPEN, /* create_disposition, */
+ FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE, /* create_options, */
+ NULL, /* smb2_create_blobs *blobs */
+ &dir_persistent,
+ &dir_volatile);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("smb2cli_create returned %s\n", nt_errstr(status));
+ return false;
+ }
+
+ status = smb2cli_query_directory(
+ cli, 1, 0x3, 0, dir_persistent, dir_volatile,
+ "session-reauth.txt", 0xffff,
+ talloc_tos(), &dir_data, &dir_data_length);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("smb2cli_query_directory returned %s\n", nt_errstr(status));
+ return false;
+ }
+
status = auth_generic_client_prepare(talloc_tos(), &auth_generic_state);
if (!NT_STATUS_IS_OK(status)) {
printf("auth_generic_client_prepare returned %s\n", nt_errstr(status));
@@ -1178,6 +1208,15 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
+ status = smb2cli_query_directory(
+ cli, 1, 0x3, 0, dir_persistent, dir_volatile,
+ "session-reauth.txt", 0xffff,
+ talloc_tos(), &dir_data, &dir_data_length);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("smb2cli_query_directory returned %s\n", nt_errstr(status));
+ return false;
+ }
+
status = smb2cli_create(cli, "session-reauth-invalid.txt",
SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
@@ -1194,6 +1233,24 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
+ status = smb2cli_create(cli, "",
+ SMB2_OPLOCK_LEVEL_NONE, /* oplock_level, */
+ SMB2_IMPERSONATION_IMPERSONATION, /* impersonation_level, */
+ SEC_STD_SYNCHRONIZE|
+ SEC_DIR_LIST|
+ SEC_DIR_READ_ATTRIBUTE, /* desired_access, */
+ 0, /* file_attributes, */
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, /* share_access, */
+ FILE_OPEN, /* create_disposition, */
+ FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE, /* create_options, */
+ NULL, /* smb2_create_blobs *blobs */
+ &dir_persistent,
+ &dir_volatile);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
+ printf("smb2cli_create returned %s\n", nt_errstr(status));
+ return false;
+ }
+
subreq = smb2cli_session_setup_send(talloc_tos(), ev,
cli->conn,
cli->timeout,
@@ -1250,6 +1307,21 @@ bool run_smb2_session_reauth(int dummy)
return false;
}
+ status = smb2cli_query_directory(
+ cli, 1, 0x3, 0, dir_persistent, dir_volatile,
+ "session-reauth.txt", 0xffff,
+ talloc_tos(), &dir_data, &dir_data_length);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("smb2cli_query_directory returned %s\n", nt_errstr(status));
+ return false;
+ }
+
+ status = smb2cli_close(cli, 0, dir_persistent, dir_volatile);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("smb2cli_close returned %s\n", nt_errstr(status));
+ return false;
+ }
+
status = smb2cli_close(cli, 0, fid_persistent, fid_volatile);
if (!NT_STATUS_IS_OK(status)) {
printf("smb2cli_close returned %s\n", nt_errstr(status));