The Samba-Bugzilla – Attachment 2895 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]
New smbtorture null dacl test
smbtorture_dacl.patch (text/plain), 3.54 KB, created by
Matthias Dieter Wallnöfer
on 2007-08-27 15:45:17 UTC
(
hide
)
Description:
New smbtorture null dacl test
Filename:
MIME Type:
Creator:
Matthias Dieter Wallnöfer
Created:
2007-08-27 15:45:17 UTC
Size:
3.54 KB
patch
obsolete
>Index: acls.c >=================================================================== >--- acls.c (revision 24700) >+++ acls.c (working copy) >@@ -246,7 +246,88 @@ > } \ > } while (0) > >+/* >+ test using NTTRANS CREATE to create a file with a null ACL set >+*/ >+static BOOL test_nttrans_create_null_dacl(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) >+{ >+ NTSTATUS status; >+ union smb_open io; >+ const char *fname = BASEDIR "\\acl3.txt"; >+ BOOL ret = True; >+ int fnum = -1; >+ union smb_fileinfo q; >+ struct security_descriptor *sd = security_descriptor_initialise(mem_ctx); > >+ 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_FLAG_MAXIMUM_ALLOWED; >+ 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_CREATE; >+ 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, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ fnum = io.ntcreatex.out.file.fnum; >+ >+ q.query_secdesc.in.file.fnum = fnum; >+ status = smb_raw_fileinfo(cli->tree, mem_ctx, &q); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ >+ if (!security_acl_equal(q.query_secdesc.out.sd->dacl, sd->dacl)) { >+ printf("%s: security descriptors don't match!\n", __location__); >+ printf("got:\n"); >+ NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd); >+ printf("expected:\n"); >+ NDR_PRINT_DEBUG(security_descriptor, sd); >+ ret = False; >+ } >+ >+ printf("try open for write\n"); >+ io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA; >+ status = smb_raw_open(cli->tree, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); >+ >+ printf("try open for read\n"); >+ io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA; >+ status = smb_raw_open(cli->tree, mem_ctx, &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, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); >+ >+ printf("try open for generic read\n"); >+ io.ntcreatex.in.access_mask = SEC_GENERIC_READ; >+ status = smb_raw_open(cli->tree, mem_ctx, &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 > mapping bits >@@ -1365,6 +1446,7 @@ > 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); > >@@ -1744,6 +1826,7 @@ > > ret &= test_sd(cli, mem_ctx); > ret &= test_nttrans_create(cli, mem_ctx); >+ ret &= test_nttrans_create_null_dacl(cli, mem_ctx); > ret &= test_creator_sid(cli, mem_ctx); > ret &= test_generic_bits(cli, mem_ctx); > ret &= test_owner_bits(cli, mem_ctx);
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