From c7e3a003967ba50e2eeb311fd5e8ac5f641064c4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 3 Jun 2020 21:23:21 -0700 Subject: [PATCH] s3: torture: Add simple tests to samba3.base.attr to check INVALID_PARAMETER returned on SMB1 out-of-range attribute use. Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- source3/torture/torture.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 00fc7529c50..ce9c56056f5 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -4015,6 +4015,13 @@ static bool run_attrtest(int dummy) return False; } + /* Ensure we can't unlink with out-of-range (unknown) attribute. */ + status = cli_unlink(cli, fname, 0x20000); + if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { + correct = false; + goto out; + } + cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN); cli_openx(cli, fname, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE, &fnum); @@ -4035,6 +4042,13 @@ static bool run_attrtest(int dummy) t2 = t-60*60*24; /* 1 day ago */ + /* Ensure we can't set with out-of-range (unknown) attribute. */ + status = cli_setatr(cli, fname, 0x20000, t2); + if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) { + correct = false; + goto out; + } + status = cli_setatr(cli, fname, 0, t2); if (!NT_STATUS_IS_OK(status)) { printf("setatr failed (%s)\n", nt_errstr(status)); -- 2.34.1