From ec3be5b90888aabddd15dcc1410ad3f69196810d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 6 Jul 2006 21:25:29 +0000 Subject: r16843: Confirm that openX uses the same mapping table as getatr. Jeremy. (This used to be commit 1c84e57e712b03f03035abe26fd8adb71aa16994) --- source4/torture/raw/samba3misc.c | 95 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 9af4ae346e..f9f926fb11 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -156,6 +156,67 @@ BOOL torture_samba3_checkfsp(struct torture_context *torture) return ret; } +static NTSTATUS raw_smbcli_open(struct smbcli_tree *tree, const char *fname, int flags, int share_mode, int *fnum) +{ + union smb_open open_parms; + uint_t openfn=0; + uint_t accessmode=0; + TALLOC_CTX *mem_ctx; + NTSTATUS status; + + mem_ctx = talloc_init("raw_open"); + 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", NULL, NULL, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + /* Try the same set with openX. */ + + status = raw_smbcli_open(cli_nt->tree, "..", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); + status = raw_smbcli_open(cli_dos->tree, "..", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); + + status = raw_smbcli_open(cli_nt->tree, ".", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = raw_smbcli_open(cli_dos->tree, ".", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = raw_smbcli_open(cli_nt->tree, "\t", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = raw_smbcli_open(cli_dos->tree, "\t", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = raw_smbcli_open(cli_nt->tree, "\t\\bla", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = raw_smbcli_open(cli_dos->tree, "\t\\bla", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = raw_smbcli_open(cli_nt->tree, "<", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = raw_smbcli_open(cli_dos->tree, "<", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = raw_smbcli_open(cli_nt->tree, "<\\bla", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = raw_smbcli_open(cli_dos->tree, "<\\bla", O_RDONLY, DENY_NONE, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + goto done; fail: -- cgit