From a97fa8124f9ca23a88a68f1986a2eab4bb6b6277 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 15 Aug 2007 22:59:06 +0000 Subject: r24469: Start adding in the torture tests that prove that NT_STATUS_OBJECT_NAME_COLLISION should map to ERRDOS, ERRfilexists not ERRDOS, ERRrename as it currently does in the errormap. This will break the build farm against Samba3 until I start adding in the hand mapping from the above. Tridge - we may need to reconsider the mapping here. Jeremy. (This used to be commit 74a871ce705a8362cfcc3e9f46ffdb63edc02b32) --- source4/torture/raw/samba3misc.c | 86 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) (limited to 'source4/torture') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 59b9adfb1b..3eaed687c8 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -183,7 +183,9 @@ static NTSTATUS raw_smbcli_open(struct smbcli_tree *tree, const char *fname, int accessmode |= OPENX_MODE_ACCESS_RDWR; } else if ((flags & O_ACCMODE) == O_WRONLY) { accessmode |= OPENX_MODE_ACCESS_WRITE; - } + } else if ((flags & O_ACCMODE) == O_RDONLY) { + accessmode |= OPENX_MODE_ACCESS_READ; + } #if defined(O_SYNC) if ((flags & O_SYNC) == O_SYNC) { @@ -216,6 +218,77 @@ static NTSTATUS raw_smbcli_open(struct smbcli_tree *tree, const char *fname, int return status; } +static NTSTATUS raw_smbcli_t2open(struct smbcli_tree *tree, const char *fname, int flags, int share_mode, int *fnum) +{ + union smb_open io; + uint_t openfn=0; + uint_t accessmode=0; + TALLOC_CTX *mem_ctx; + NTSTATUS status; + + mem_ctx = talloc_init("raw_t2open"); + if (!mem_ctx) return NT_STATUS_NO_MEMORY; + + if (flags & O_CREAT) { + openfn |= OPENX_OPEN_FUNC_CREATE; + } + if (!(flags & O_EXCL)) { + if (flags & O_TRUNC) { + openfn |= OPENX_OPEN_FUNC_TRUNC; + } else { + openfn |= OPENX_OPEN_FUNC_OPEN; + } + } + + accessmode = (share_mode<tree, "<\\bla", O_RDONLY, DENY_NONE, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + /* Let's test EEXIST error code mapping. */ + status = raw_smbcli_open(cli_nt->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); + status = raw_smbcli_open(cli_dos->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists)); + + status = raw_smbcli_t2open(cli_nt->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); + 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)); + goto done; fail: -- cgit