From 04cddfc739164aba6ee1466792ae542040604a07 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Fri, 23 May 2014 19:11:59 +0200 Subject: torture/smb2/dir: check create time match find This adds a check to ensure that the create time returned in the SMB2 create response matches the value found in the find response. Signed-off-by: David Disseldorp Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri May 23 22:42:24 CEST 2014 on sn-devel-104 --- source4/torture/smb2/dir.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c index 9cb85d7d570..0e409f2b70a 100644 --- a/source4/torture/smb2/dir.c +++ b/source4/torture/smb2/dir.c @@ -41,6 +41,7 @@ struct file_elem { char *name; + NTTIME create_time; bool found; }; @@ -89,6 +90,7 @@ static NTSTATUS populate_tree(struct torture_context *tctx, DNAME, files[i].name); status = smb2_create(tree, mem_ctx, &create); torture_assert_ntstatus_ok_goto(tctx, status, ret, done, ""); + files[i].create_time = create.out.create_time; smb2_util_close(tree, create.out.file.handle); } done: @@ -130,17 +132,27 @@ static bool test_find(struct torture_context *tctx, for (i = 0; i < count; i++) { bool expected; const char *found = d[i].both_directory_info.name.s; + NTTIME ctime = d[i].both_directory_info.create_time; if (!strcmp(found, ".") || !strcmp(found, "..")) continue; expected = false; for (j = 0; j < NFILES; j++) { - if (!strcmp(files[j].name, found)) { - files[j].found = true; - expected = true; - break; + if (strcmp(files[j].name, found) != 0) { + continue; } + + if (files[j].create_time != ctime) { + torture_result(tctx, TORTURE_FAIL, + "(%s): create_time mismatch for %s" + "\n", __location__, found); + ret = false; + goto done; + } + files[j].found = true; + expected = true; + break; } if (expected) -- cgit