The Samba-Bugzilla – Attachment 4526 Details for
Bug 6620
Renames of directories can incorrectly return NT_STATUS_ACCESS_DENIED
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Torture test to verify the fix
0001-s4-torture-Extend-the-RAW-RENAME-test-to-more-fully-.patch (text/plain), 2.98 KB, created by
Tim Prouty
on 2009-08-07 12:24:34 UTC
(
hide
)
Description:
Torture test to verify the fix
Filename:
MIME Type:
Creator:
Tim Prouty
Created:
2009-08-07 12:24:34 UTC
Size:
2.98 KB
patch
obsolete
>From df8ed63c32f865ebc0ea175fce1d0fc203329e79 Mon Sep 17 00:00:00 2001 >From: Tim Prouty <tprouty@samba.org> >Date: Thu, 6 Aug 2009 11:23:23 -0700 >Subject: [PATCH 1/2] s4 torture: Extend the RAW-RENAME test to more fully test directory renames. > >The existing test was only covering files opened underneath the >directory that was being renamed. It is not uncommon for windows >clients to actually hold a read-only handle to a directory open across >the rename, which it turns out doesn't return NT_STATUS_ACCESS_DENIED. >Additionally, holding a handle open to a stream on the directory is >also allowed. >--- > source4/torture/raw/rename.c | 50 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 50 insertions(+), 0 deletions(-) > >diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c >index 951d91a..9748719 100644 >--- a/source4/torture/raw/rename.c >+++ b/source4/torture/raw/rename.c >@@ -527,6 +527,7 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c > const char *dname1 = BASEDIR "\\dir_for_rename"; > const char *dname2 = BASEDIR "\\renamed_dir"; > const char *fname = BASEDIR "\\dir_for_rename\\file.txt"; >+ const char *sname = BASEDIR "\\dir_for_rename:a stream:$DATA"; > bool ret = true; > int fnum = -1; > >@@ -591,6 +592,55 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c > status = smb_raw_rename(cli->tree, &ren_io); > CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); > >+ /* Close the file and try the rename. */ >+ smbcli_close(cli->tree, fnum); >+ >+ status = smb_raw_rename(cli->tree, &ren_io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ >+ /* >+ * Now try just holding a second handle on the directory and holding >+ * it open across a rename. This should be allowed. >+ */ >+ io.ntcreatex.in.fname = dname2; >+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; >+ >+ io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL | >+ SEC_FILE_READ_ATTRIBUTE | SEC_FILE_READ_EA | SEC_FILE_READ_DATA; >+ >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ fnum = io.ntcreatex.out.file.fnum; >+ >+ ren_io.generic.level = RAW_RENAME_RENAME; >+ ren_io.rename.in.pattern1 = dname2; >+ ren_io.rename.in.pattern2 = dname1; >+ ren_io.rename.in.attrib = 0; >+ >+ status = smb_raw_rename(cli->tree, &ren_io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ >+ /* close our handle to the directory. */ >+ smbcli_close(cli->tree, fnum); >+ >+ /* >+ * Now try opening a stream on the directory and holding it open >+ * across a rename. This should be allowed. >+ */ >+ io.ntcreatex.in.fname = sname; >+ >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ fnum = io.ntcreatex.out.file.fnum; >+ >+ ren_io.generic.level = RAW_RENAME_RENAME; >+ ren_io.rename.in.pattern1 = dname1; >+ ren_io.rename.in.pattern2 = dname2; >+ ren_io.rename.in.attrib = 0; >+ >+ status = smb_raw_rename(cli->tree, &ren_io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ > done: > > if (fnum != -1) { >-- >1.6.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6620
: 4526 |
4527