1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

CI: add a test for @GMT mask in SMB1 find

Without FLAGS2_REPARSE_PATH a path containing an @GMT token can be used to
create a file including the @GMT token in the name and a directory list will
also return the file as result. Verified against Windows. Samba behaves exactly
the same.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 13 01:13:01 UTC 2023 on sn-devel-184
This commit is contained in:
Ralph Boehme 2022-11-24 16:59:49 +01:00 committed by Jeremy Allison
parent 425aaf6f7e
commit 1421969b86

View File

@ -1979,6 +1979,44 @@ static bool torture_smb1_twrp_openroot(struct torture_context *tctx,
return ret;
}
static void torture_smb1_find_gmt_mask_list_fn(struct clilist_file_info *finfo,
const char *name,
void *state)
{
}
/**
* SMB1 @GMT token as search mask is valid
*/
static bool torture_smb1_find_gmt_mask(struct torture_context *tctx,
struct smbcli_state *cli)
{
const char *dname = "\\torture_smb1_find_gmt_mask";
const char *path = "\\torture_smb1_find_gmt_mask\\@GMT-2022.11.24-16.24.00";
int fnum;
int n;
NTSTATUS status;
bool ret = true;
smbcli_unlink(cli->tree, path);
smbcli_rmdir(cli->tree, dname);
status = smbcli_mkdir(cli->tree, dname);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smbcli_mkdir() failed\n");
fnum = smbcli_open(cli->tree, path, O_RDWR | O_CREAT, DENY_NONE);
smbcli_close(cli->tree, fnum);
/* Note: we don't set FLAGS2_REPARSE_PATH, so this is just a path */
n = smbcli_list(cli->tree, path, 0, torture_smb1_find_gmt_mask_list_fn, cli);
torture_assert_int_equal_goto(tctx, n, 1, ret, done, "Wrong count\n");
done:
smbcli_unlink(cli->tree, path);
smbcli_rmdir(cli->tree, dname);
return ret;
}
NTSTATUS torture_base_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(ctx, "base");
@ -2039,6 +2077,9 @@ NTSTATUS torture_base_init(TALLOC_CTX *ctx)
torture_suite_add_1smb_test(suite,
"smb1-twrp-openroot",
torture_smb1_twrp_openroot);
torture_suite_add_1smb_test(suite,
"smb1-find-gmt-mask",
torture_smb1_find_gmt_mask);
suite->description = talloc_strdup(suite,
"Basic SMB tests (imported from the original smbtorture)");