From: Jeremy Allison Date: Tue, 5 May 2020 00:56:46 +0000 (-0700) Subject: s4: torture: Add an SMB1-specific open root of share with @GMT-path test - base.smb1... X-Git-Tag: ldb-2.2.0~649 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9881c3f9ab5c6792575e912730aa063d60f9aa57;p=thirdparty%2Fsamba.git s4: torture: Add an SMB1-specific open root of share with @GMT-path test - base.smb1-twrp-openroot Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index a4a328e5cf4..e91fef1d6c2 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -1934,6 +1934,50 @@ static bool run_birthtimetest(struct torture_context *tctx, return correct; } +/** + SMB1 TWRP open on root of share. + */ +static bool torture_smb1_twrp_openroot(struct torture_context *tctx, + struct smbcli_state *cli) +{ + const char *snapshot = NULL; + const char *p = NULL; + NTSTATUS status; + struct tm tm; + bool ret = true; + + snapshot = torture_setting_string(tctx, "twrp_snapshot", NULL); + if (snapshot == NULL) { + torture_skip(tctx, "missing 'twrp_snapshot' option\n"); + } + + torture_comment(tctx, "Testing open of root of " + "share with timewarp (%s)\n", + snapshot); + + setenv("TZ", "GMT", 1); + + p = strptime(snapshot, "@GMT-%Y.%m.%d-%H.%M.%S", &tm); + torture_assert_goto(tctx, p != NULL, ret, done, "strptime\n"); + torture_assert_goto(tctx, *p == '\0', ret, done, "strptime\n"); + + cli->session->flags2 |= FLAGS2_REPARSE_PATH; + status = smbcli_chkpath(cli->tree, snapshot); + cli->session->flags2 &= ~FLAGS2_REPARSE_PATH; + + if (NT_STATUS_IS_ERR(status)) { + torture_result(tctx, + TORTURE_FAIL, + "smbcli_chkpath on %s : %s\n", + snapshot, + smbcli_errstr(cli->tree)); + return false; + } + + done: + + return ret; +} NTSTATUS torture_base_init(TALLOC_CTX *ctx) { @@ -1992,6 +2036,9 @@ NTSTATUS torture_base_init(TALLOC_CTX *ctx) torture_suite_add_1smb_test(suite, "scan-pipe_number", run_pipe_number); torture_suite_add_1smb_test(suite, "scan-ioctl", torture_ioctl_test); torture_suite_add_1smb_test(suite, "scan-maxfid", torture_maxfid_test); + torture_suite_add_1smb_test(suite, + "smb1-twrp-openroot", + torture_smb1_twrp_openroot); suite->description = talloc_strdup(suite, "Basic SMB tests (imported from the original smbtorture)");