summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-08-15 23:30:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:55 -0500
commite42ff21109190a110138e2ceeef02e616399aeaa (patch)
tree47f813f683e3bb923a0efc77a1dfc2d988e9e0e6 /source4/torture/raw
parenta97fa8124f9ca23a88a68f1986a2eab4bb6b6277 (diff)
downloadsamba-e42ff21109190a110138e2ceeef02e616399aeaa.tar.gz
samba-e42ff21109190a110138e2ceeef02e616399aeaa.tar.bz2
samba-e42ff21109190a110138e2ceeef02e616399aeaa.zip
r24473: Prove this is also the same for NTcreateX. It's pretty much
guarenteed now that NT_STATUS_OBJECT_NAME_COLLISION should map to ERRDOS, ERRfilexists on all open calls at least. Jeremy. (This used to be commit 125590e008549b2784b38f3fd8ff45b47dc3e3e9)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/samba3misc.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index 3eaed687c8..b8a00ab4ed 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -288,6 +288,39 @@ static NTSTATUS raw_smbcli_t2open(struct smbcli_tree *tree, const char *fname, i
return status;
}
+static NTSTATUS raw_smbcli_ntcreate(struct smbcli_tree *tree, const char *fname, int *fnum)
+{
+ union smb_open io;
+ TALLOC_CTX *mem_ctx;
+ NTSTATUS status;
+
+ mem_ctx = talloc_init("raw_t2open");
+ if (!mem_ctx) return NT_STATUS_NO_MEMORY;
+
+ memset(&io, '\0', sizeof(io));
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
+ io.ntcreatex.in.root_fid = 0;
+ 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_READ | NTCREATEX_SHARE_ACCESS_WRITE;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+ io.ntcreatex.in.create_options = 0;
+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = fname;
+
+ status = smb_raw_open(tree, mem_ctx, &io);
+ talloc_free(mem_ctx);
+
+ if (fnum && NT_STATUS_IS_OK(status)) {
+ *fnum = io.openx.out.file.fnum;
+ }
+
+ return status;
+}
+
BOOL torture_samba3_badpath(struct torture_context *torture)
{
@@ -495,6 +528,11 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
status = raw_smbcli_t2open(cli_dos->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL);
CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists));
+ status = raw_smbcli_ntcreate(cli_nt->tree, fpath, NULL);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION);
+ status = raw_smbcli_ntcreate(cli_dos->tree, fpath, NULL);
+ CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists));
+
goto done;
fail: