From 5f280af0125043bc3e7ebce34ad80a635ca4ce09 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Sep 2007 19:48:10 +0000 Subject: r25310: Make sure we do not regress on r25309 (This used to be commit 4eb0ec51aae4d05ce7bace7ea6dce2511e9a670a) --- source4/torture/raw/raw.c | 2 ++ source4/torture/raw/samba3misc.c | 70 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) (limited to 'source4') diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c index 88299c44cd..112c34d299 100644 --- a/source4/torture/raw/raw.c +++ b/source4/torture/raw/raw.c @@ -63,6 +63,8 @@ NTSTATUS torture_raw_init(void) torture_suite_add_1smb_test(suite, "COMPOSITE", torture_raw_composite); torture_suite_add_simple_test(suite, "SAMBA3HIDE", torture_samba3_hide); torture_suite_add_simple_test(suite, "SAMBA3CLOSEERR", torture_samba3_closeerr); + torture_suite_add_simple_test(suite, "SAMBA3ROOTDIRFID", + torture_samba3_rootdirfid); torture_suite_add_simple_test(suite, "SAMBA3CHECKFSP", torture_samba3_checkfsp); torture_suite_add_simple_test(suite, "SAMBA3BADPATH", torture_samba3_badpath); torture_suite_add_simple_test(suite, "SAMBA3CASEINSENSITIVE", diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 74c32728a1..3f6c552cb4 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -817,3 +817,73 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) smbcli_deltree(cli->tree, dirname); return ret; } + +bool torture_samba3_rootdirfid(struct torture_context *tctx) +{ + struct smbcli_state *cli; + NTSTATUS status; + uint16_t dnum; + union smb_open io; + const char *fname = "testfile"; + bool ret = false; + + if (!torture_open_connection(&cli, 0)) { + ret = false; + goto done; + } + + smbcli_unlink(cli->tree, fname); + + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; + io.ntcreatex.in.root_fid = 0; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.access_mask = + SEC_STD_SYNCHRONIZE | SEC_FILE_EXECUTE; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY; + io.ntcreatex.in.share_access = + NTCREATEX_SHARE_ACCESS_READ + | NTCREATEX_SHARE_ACCESS_READ; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.fname = "\\"; + status = smb_raw_open(cli->tree, tctx, &io); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smb_open on the directory failed: %s\n", + nt_errstr(status)); + ret = false; + goto done; + } + dnum = io.ntcreatex.out.file.fnum; + + io.ntcreatex.in.flags = + NTCREATEX_FLAGS_REQUEST_OPLOCK + | NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK; + io.ntcreatex.in.root_fid = dnum; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF; + io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; + io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.fname = fname; + + status = smb_raw_open(cli->tree, tctx, &io); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smb_open on the file %s failed: %s\n", + fname, nt_errstr(status)); + ret = false; + goto done; + } + + smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); + smbcli_close(cli->tree, dnum); + smbcli_unlink(cli->tree, fname); + + ret = true; + done: + return ret; +} + -- cgit