The Samba-Bugzilla – Attachment 3683 Details for
Bug 4284
Null Dacl denies access in samba in contradiction to windows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Latest version of smbtorture NULL DACL patch
tortureNullDacl.patch (text/plain), 4.81 KB, created by
Matthias Dieter Wallnöfer
on 2008-10-18 05:29:48 UTC
(
hide
)
Description:
Latest version of smbtorture NULL DACL patch
Filename:
MIME Type:
Creator:
Matthias Dieter Wallnöfer
Created:
2008-10-18 05:29:48 UTC
Size:
4.81 KB
patch
obsolete
>diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c >index 95e7282..9d3169c 100644 >--- a/source4/torture/raw/acls.c >+++ b/source4/torture/raw/acls.c >@@ -146,7 +146,7 @@ done: > test using nttrans create to create a file with an initial acl set > */ > static bool test_nttrans_create(struct torture_context *tctx, >- struct smbcli_state *cli) >+ struct smbcli_state *cli) > { > NTSTATUS status; > union smb_open io; >@@ -248,6 +248,72 @@ done: > } \ > } while (0) > >+/* >+ test using NTTRANS CREATE to create a file with a null ACL set >+*/ >+static bool test_nttrans_create_null_dacl(struct torture_context *tctx, >+ struct smbcli_state *cli) >+{ >+ NTSTATUS status; >+ union smb_open io; >+ const char *fname = BASEDIR "\\acl3.txt"; >+ bool ret = true; >+ int fnum = -1; >+ struct security_descriptor *sd = security_descriptor_initialise(tctx); >+ >+ printf("TESTING SEC_DESC WITH A NULL DACL\n"); >+ >+ io.generic.level = RAW_OPEN_NTTRANS_CREATE; >+ io.ntcreatex.in.root_fid = 0; >+ io.ntcreatex.in.flags = 0; >+ io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL | SEC_STD_WRITE_DAC >+ | SEC_STD_WRITE_OWNER; >+ io.ntcreatex.in.create_options = 0; >+ io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; >+ io.ntcreatex.in.share_access = >+ NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE; >+ io.ntcreatex.in.alloc_size = 0; >+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF; >+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; >+ io.ntcreatex.in.security_flags = 0; >+ io.ntcreatex.in.fname = fname; >+ io.ntcreatex.in.sec_desc = sd; >+ io.ntcreatex.in.ea_list = NULL; >+ >+ printf("creating a file with a null dacl\n"); >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ fnum = io.ntcreatex.out.file.fnum; >+ >+ printf("try open for write\n"); >+ io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA; >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ >+ printf("try open for read\n"); >+ io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA; >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum, >+ SEC_FILE_READ_DATA | SEC_FILE_READ_ATTRIBUTE); >+ smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); >+ >+ printf("try open for generic write\n"); >+ io.ntcreatex.in.access_mask = SEC_GENERIC_WRITE; >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ >+ printf("try open for generic read\n"); >+ io.ntcreatex.in.access_mask = SEC_GENERIC_READ; >+ status = smb_raw_open(cli->tree, tctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ CHECK_ACCESS_FLAGS(io.ntcreatex.out.file.fnum, SEC_RIGHTS_FILE_READ); >+ smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); >+ >+done: >+ smbcli_close(cli->tree, fnum); >+ return ret; >+} > > /* > test the behaviour of the well known SID_CREATOR_OWNER sid, and some generic >@@ -959,7 +1025,7 @@ done: > test the inheritance of ACL flags onto new files and directories > */ > static bool test_inheritance(struct torture_context *tctx, >- struct smbcli_state *cli) >+ struct smbcli_state *cli) > { > NTSTATUS status; > union smb_open io; >@@ -1368,11 +1434,13 @@ static bool test_inheritance(struct torture_context *tctx, > smbcli_rmdir(cli->tree, dname); > > done: >- set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC; >- set.set_secdesc.in.file.fnum = fnum; >- set.set_secdesc.in.secinfo_flags = SECINFO_DACL; >- set.set_secdesc.in.sd = sd_orig; >- status = smb_raw_setfileinfo(cli->tree, &set); >+ if (sd_orig) { >+ set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC; >+ set.set_secdesc.in.file.fnum = fnum; >+ set.set_secdesc.in.secinfo_flags = SECINFO_DACL; >+ set.set_secdesc.in.sd = sd_orig; >+ status = smb_raw_setfileinfo(cli->tree, &set); >+ } > > smbcli_close(cli->tree, fnum); > return ret; >@@ -1506,13 +1574,14 @@ static bool test_inheritance_dynamic(struct torture_context *tctx, > smbcli_unlink(cli->tree, fname1); > > done: >- printf("put back original sd\n"); >- set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC; >- set.set_secdesc.in.file.fnum = fnum; >- set.set_secdesc.in.secinfo_flags = SECINFO_DACL; >- set.set_secdesc.in.sd = sd_orig; >- status = smb_raw_setfileinfo(cli->tree, &set); >- >+ if (sd_orig) { >+ printf("put back original sd\n"); >+ set.set_secdesc.level = RAW_SFILEINFO_SEC_DESC; >+ set.set_secdesc.in.file.fnum = fnum; >+ set.set_secdesc.in.secinfo_flags = SECINFO_DACL; >+ set.set_secdesc.in.sd = sd_orig; >+ status = smb_raw_setfileinfo(cli->tree, &set); >+ } > smbcli_close(cli->tree, fnum); > smbcli_rmdir(cli->tree, dname); > >@@ -1744,6 +1813,7 @@ bool torture_raw_acls(struct torture_context *tctx, struct smbcli_state *cli) > > ret &= test_sd(tctx, cli); > ret &= test_nttrans_create(tctx, cli); >+ ret &= test_nttrans_create_null_dacl(tctx, cli); > ret &= test_creator_sid(tctx, cli); > ret &= test_generic_bits(tctx, cli); > ret &= test_owner_bits(tctx, cli);
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 4284
:
2887
|
2895
|
2949
|
2950
|
3089
|
3682
|
3683
|
3689