From 414c47633d89d87011fda08c3c2b8dcbbfbcc2a8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 28 Jun 2006 22:09:03 +0000 Subject: r16657: Test Jerry's iTunes bug, along with some more error conditions Volker (This used to be commit 12aa900eb2ffde3711a30c7e063bfba95128e91d) --- source4/torture/raw/samba3misc.c | 157 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 source4/torture/raw/samba3misc.c (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c new file mode 100644 index 0000000000..cc996ca4a8 --- /dev/null +++ b/source4/torture/raw/samba3misc.c @@ -0,0 +1,157 @@ +/* + Unix SMB/CIFS implementation. + Test some misc Samba3 code paths + Copyright (C) Volker Lendecke 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "torture/torture.h" +#include "libcli/raw/libcliraw.h" +#include "system/time.h" +#include "system/filesys.h" +#include "libcli/libcli.h" +#include "torture/util.h" + +#define CHECK_STATUS(status, correct) do { \ + if (!NT_STATUS_EQUAL(status, correct)) { \ + printf("(%s) Incorrect status %s - should be %s\n", \ + __location__, nt_errstr(status), nt_errstr(correct)); \ + ret = False; \ + } \ +} while (0) + +BOOL torture_samba3_checkfsp(struct torture_context *torture) +{ + struct smbcli_state *cli; + const char *fname = "test.txt"; + const char *dirname = "testdir"; + int fnum; + NTSTATUS status; + BOOL ret = True; + TALLOC_CTX *mem_ctx; + ssize_t nread; + char buf[16]; + struct smbcli_tree *tree2; + + if ((mem_ctx = talloc_init("torture_samba3_checkfsp")) == NULL) { + d_printf("talloc_init failed\n"); + return False; + } + + if (!torture_open_connection_share( + torture, &cli, lp_parm_string(-1, "torture", "host"), + lp_parm_string(-1, "torture", "share"), NULL)) { + d_printf("torture_open_connection_share failed\n"); + ret = False; + goto done; + } + + smbcli_deltree(cli->tree, dirname); + + status = torture_second_tcon(torture, cli->session, + lp_parm_string(-1, "torture", "share"), + &tree2); + CHECK_STATUS(status, NT_STATUS_OK); + if (!NT_STATUS_IS_OK(status)) + goto done; + + /* Try a read on an invalid FID */ + + nread = smbcli_read(cli->tree, 4711, buf, 0, sizeof(buf)); + CHECK_STATUS(smbcli_nt_error(cli->tree), NT_STATUS_INVALID_HANDLE); + + /* Try a read on a directory handle */ + + status = smbcli_mkdir(cli->tree, dirname); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); + ret = False; + goto done; + } + + /* Open the directory */ + { + union smb_open io; + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; + io.ntcreatex.in.root_fid = 0; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; + io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY; + io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.fname = dirname; + status = smb_raw_open(cli->tree, mem_ctx, &io); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smb_open on the directory failed: %s\n", + nt_errstr(status)); + ret = False; + goto done; + } + fnum = io.ntcreatex.out.file.fnum; + } + + /* Try a read on the directory */ + + nread = smbcli_read(cli->tree, fnum, buf, 0, sizeof(buf)); + if (nread >= 0) { + d_printf("smbcli_read on a directory succeeded, expected " + "failure\n"); + ret = False; + } + + CHECK_STATUS(smbcli_nt_error(cli->tree), + NT_STATUS_INVALID_DEVICE_REQUEST); + + /* Same test on the second tcon */ + + nread = smbcli_read(tree2, fnum, buf, 0, sizeof(buf)); + if (nread >= 0) { + d_printf("smbcli_read on a directory succeeded, expected " + "failure\n"); + ret = False; + } + + CHECK_STATUS(smbcli_nt_error(tree2), NT_STATUS_INVALID_HANDLE); + + smbcli_close(cli->tree, fnum); + + /* Try a normal file read on a second tcon */ + + fnum = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); + if (fnum == -1) { + d_printf("Failed to create %s - %s\n", fname, + smbcli_errstr(cli->tree)); + ret = False; + goto done; + } + + nread = smbcli_read(tree2, fnum, buf, 0, sizeof(buf)); + CHECK_STATUS(smbcli_nt_error(tree2), NT_STATUS_INVALID_HANDLE); + + smbcli_close(cli->tree, fnum); + + done: + smbcli_deltree(cli->tree, dirname); + torture_close_connection(cli); + talloc_free(mem_ctx); + + return ret; +} -- cgit From 81d09a7f2ede7e1a25a14dbf942a5850d4f97bf0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 2 Jul 2006 17:40:35 +0000 Subject: r16759: Jeremy, another little error case for you :-) For the paths with illegal characters we should return ERRDOS:ERRbadpath in the DOS error case. We return ERRDOS:ERRinvalidname... Volker (This used to be commit c2203068f46064d067bf43fe50f330ce49dfc08a) --- source4/torture/raw/samba3misc.c | 135 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index cc996ca4a8..8b2fbd99a2 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -155,3 +155,138 @@ BOOL torture_samba3_checkfsp(struct torture_context *torture) return ret; } + +BOOL torture_samba3_badpath(struct torture_context *torture) +{ + struct smbcli_state *cli_nt; + struct smbcli_state *cli_dos; + const char *fname = "test.txt"; + const char *dirname = "testdir"; + char *fpath; + int fnum; + NTSTATUS status; + BOOL ret = True; + TALLOC_CTX *mem_ctx; + ssize_t nread; + char buf[16]; + struct smbcli_tree *tree2; + BOOL nt_status_support; + + if (!(mem_ctx = talloc_init("torture_samba3_badpath"))) { + d_printf("talloc_init failed\n"); + return False; + } + + nt_status_support = lp_nt_status_support(); + + if (!lp_set_cmdline("nt status support", "yes")) { + printf("Could not set 'nt status support = yes'\n"); + goto fail; + } + + if (!torture_open_connection(&cli_nt)) { + goto fail; + } + + if (!lp_set_cmdline("nt status support", "no")) { + printf("Could not set 'nt status support = yes'\n"); + goto fail; + } + + if (!torture_open_connection(&cli_dos)) { + goto fail; + } + + if (!lp_set_cmdline("nt status support", + nt_status_support ? "yes":"no")) { + printf("Could not reset 'nt status support = yes'"); + goto fail; + } + + smbcli_deltree(cli_nt->tree, dirname); + + status = smbcli_mkdir(cli_nt->tree, dirname); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); + ret = False; + goto done; + } + + status = smbcli_chkpath(cli_nt->tree, dirname); + CHECK_STATUS(status, NT_STATUS_OK); + + status = smbcli_chkpath(cli_nt->tree, + talloc_asprintf(mem_ctx, "%s\\bla", dirname)); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + + status = smbcli_chkpath(cli_dos->tree, + talloc_asprintf(mem_ctx, "%s\\bla", dirname)); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_chkpath(cli_nt->tree, + talloc_asprintf(mem_ctx, "%s\\bla\\blub", + dirname)); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_chkpath(cli_dos->tree, + talloc_asprintf(mem_ctx, "%s\\bla\\blub", + dirname)); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + if (!(fpath = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname))) { + goto fail; + } + fnum = smbcli_open(cli_nt->tree, fpath, O_RDWR | O_CREAT, DENY_NONE); + if (fnum == -1) { + d_printf("Could not create file %s: %s\n", fpath, + smbcli_errstr(cli_nt->tree)); + goto fail; + } + smbcli_close(cli_nt->tree, fnum); + + status = smbcli_chkpath(cli_nt->tree, fpath); + CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY); + status = smbcli_chkpath(cli_dos->tree, fpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_chkpath(cli_nt->tree, ".."); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); + status = smbcli_chkpath(cli_dos->tree, ".."); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); + + status = smbcli_chkpath(cli_nt->tree, "\t"); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_chkpath(cli_dos->tree, "\t"); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_chkpath(cli_nt->tree, "\t\\bla"); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_chkpath(cli_dos->tree, "\t\\bla"); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_chkpath(cli_nt->tree, "<"); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_chkpath(cli_dos->tree, "<"); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_chkpath(cli_nt->tree, "<\\bla"); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_chkpath(cli_dos->tree, "<\\bla"); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + goto done; + + fail: + ret = False; + + done: + if (cli_nt != NULL) { + smbcli_deltree(cli_nt->tree, dirname); + torture_close_connection(cli_nt); + } + if (cli_dos != NULL) { + torture_close_connection(cli_dos); + } + talloc_free(mem_ctx); + + return ret; +} -- cgit From 5517249fadfced980db5eb47bf04ece5edcb6c53 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sun, 2 Jul 2006 21:05:19 +0000 Subject: r16761: Added additional NTSTATUS and DOS error test for "." This confirms a theory of mine... Added RAW-SAMBA3BADPATH to selectable options. Jeremy. (This used to be commit 4cd7a8ed621d6215202d4b60d183a013a221581b) --- source4/torture/raw/samba3misc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 8b2fbd99a2..e64aefa81e 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -253,6 +253,11 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_chkpath(cli_dos->tree, ".."); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); + status = smbcli_chkpath(cli_nt->tree, "."); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_chkpath(cli_dos->tree, "."); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + status = smbcli_chkpath(cli_nt->tree, "\t"); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); status = smbcli_chkpath(cli_dos->tree, "\t"); -- cgit From a5cbc9a01cb995edf0328d46352b6024d373133a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 6 Jul 2006 20:34:18 +0000 Subject: r16842: Jeremy, I almost don't dare checking this in..... Volker (This used to be commit ec36c49c08bdd222d5514611a39f3caf096dac7b) --- source4/torture/raw/samba3misc.c | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index e64aefa81e..9af4ae346e 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -243,6 +243,10 @@ BOOL torture_samba3_badpath(struct torture_context *torture) } smbcli_close(cli_nt->tree, fnum); + /* + * Do a whole bunch of error code checks on chkpath + */ + status = smbcli_chkpath(cli_nt->tree, fpath); CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY); status = smbcli_chkpath(cli_dos->tree, fpath); @@ -278,6 +282,46 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_chkpath(cli_dos->tree, "<\\bla"); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + /* + * .... And the same gang against getatr. Note that the error codes + * differ.... + */ + + status = smbcli_getatr(cli_nt->tree, fpath, NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OK); + status = smbcli_getatr(cli_dos->tree, fpath, NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OK); + + status = smbcli_getatr(cli_nt->tree, "..", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); + status = smbcli_getatr(cli_dos->tree, "..", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); + + status = smbcli_getatr(cli_nt->tree, ".", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_getatr(cli_dos->tree, ".", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = smbcli_getatr(cli_nt->tree, "\t", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_getatr(cli_dos->tree, "\t", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = smbcli_getatr(cli_nt->tree, "\t\\bla", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_getatr(cli_dos->tree, "\t\\bla", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = smbcli_getatr(cli_nt->tree, "<", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_getatr(cli_dos->tree, "<", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + + status = smbcli_getatr(cli_nt->tree, "<\\bla", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_getatr(cli_dos->tree, "<\\bla", NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + goto done; fail: -- cgit 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(-) (limited to 'source4/torture/raw/samba3misc.c') 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 From b7c5bc522b286e8e478b6f74a68bc68829e64c3c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 10 Jul 2006 08:00:06 +0000 Subject: r16907: Add an index parameter to torture_open_connection. Next step is to enable the unclist parameter for all tests that do two connections, to enable cluster testing. Volker (This used to be commit a5d6db09244d444986f8fded3fc6e72c74c8ca1f) --- source4/torture/raw/samba3misc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index f9f926fb11..0cbc7912ed 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -228,9 +228,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) NTSTATUS status; BOOL ret = True; TALLOC_CTX *mem_ctx; - ssize_t nread; - char buf[16]; - struct smbcli_tree *tree2; BOOL nt_status_support; if (!(mem_ctx = talloc_init("torture_samba3_badpath"))) { @@ -245,7 +242,7 @@ BOOL torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!torture_open_connection(&cli_nt)) { + if (!torture_open_connection(&cli_nt, 0)) { goto fail; } @@ -254,7 +251,7 @@ BOOL torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!torture_open_connection(&cli_dos)) { + if (!torture_open_connection(&cli_dos, 1)) { goto fail; } -- cgit From a39f239cb28e4ac6be207d4179bacffce97f1b3e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 18 Oct 2006 14:23:19 +0000 Subject: r19392: Use torture_setting_* rather than lp_parm_* where possible. (This used to be commit b28860978fe29c5b10abfb8c59d7182864e21dd6) --- source4/torture/raw/samba3misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 0cbc7912ed..0b196b1587 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -53,8 +53,8 @@ BOOL torture_samba3_checkfsp(struct torture_context *torture) } if (!torture_open_connection_share( - torture, &cli, lp_parm_string(-1, "torture", "host"), - lp_parm_string(-1, "torture", "share"), NULL)) { + torture, &cli, torture_setting_string(torture, "host", NULL), + torture_setting_string(torture, "share", NULL), NULL)) { d_printf("torture_open_connection_share failed\n"); ret = False; goto done; @@ -63,7 +63,7 @@ BOOL torture_samba3_checkfsp(struct torture_context *torture) smbcli_deltree(cli->tree, dirname); status = torture_second_tcon(torture, cli->session, - lp_parm_string(-1, "torture", "share"), + torture_setting_string(torture, "share", NULL), &tree2); CHECK_STATUS(status, NT_STATUS_OK); if (!NT_STATUS_IS_OK(status)) -- cgit From cc8e2febb897f6e6a41c5062e533e332304843a9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 3 Jan 2007 12:02:44 +0000 Subject: r20508: Confirm a special case in samba3 reply_getatr that getatr("") always returns HIDDEN. Volker (This used to be commit 83a20912061c663ff422b038b41f01a9c7583afe) --- source4/torture/raw/samba3misc.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 0b196b1587..490b0c8cde 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -340,6 +340,11 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_chkpath(cli_dos->tree, "<\\bla"); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + status = smbcli_chkpath(cli_nt->tree, ""); + CHECK_STATUS(status, NT_STATUS_OK); + status = smbcli_chkpath(cli_dos->tree, ""); + CHECK_STATUS(status, NT_STATUS_OK); + /* * .... And the same gang against getatr. Note that the DOS error codes * differ.... @@ -380,6 +385,35 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_getatr(cli_dos->tree, "<\\bla", NULL, NULL, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + { + uint16_t attr; + + status = smbcli_getatr(cli_nt->tree, "", &attr, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OK); + if (attr != (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY)) { + d_printf("(%s) getatr(\"\") returned 0x%x, expected " + "0x%x\n", __location__, attr, + FILE_ATTRIBUTE_HIDDEN + |FILE_ATTRIBUTE_DIRECTORY); + ret = False; + } + + status = smbcli_setatr(cli_nt->tree, "", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); + status = smbcli_setatr(cli_dos->tree, "", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnoaccess)); + + status = smbcli_setatr(cli_nt->tree, ".", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_setatr(cli_dos->tree, ".", + FILE_ATTRIBUTE_DIRECTORY, -1); + 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); -- cgit From 3bc9704ce0210ea86c916eacc1755f3d0308ff00 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 7 Jan 2007 10:29:12 +0000 Subject: r20595: W2k and XP don't always show the top directory as hidden, w2k3 does. I think Samba should follow w2k3 in this respect. Volker (This used to be commit 6094ee9df5820cd26858e9c4eff5dfc7e60181ab) --- source4/torture/raw/samba3misc.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 490b0c8cde..eea6fe2bc6 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -229,6 +229,8 @@ BOOL torture_samba3_badpath(struct torture_context *torture) BOOL ret = True; TALLOC_CTX *mem_ctx; BOOL nt_status_support; + uint16_t attr; + if (!(mem_ctx = talloc_init("torture_samba3_badpath"))) { d_printf("talloc_init failed\n"); @@ -385,8 +387,13 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_getatr(cli_dos->tree, "<\\bla", NULL, NULL, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); - { - uint16_t attr; + if (lp_parm_bool(-1, "torture", "w2k3", False) || + lp_parm_bool(-1, "torture", "samba3", False)) { + + /* + * XP and w2k don't show this behaviour, but I think + * Samba3 should follow W2k3 + */ status = smbcli_getatr(cli_nt->tree, "", &attr, NULL, NULL); CHECK_STATUS(status, NT_STATUS_OK); @@ -397,22 +404,21 @@ BOOL torture_samba3_badpath(struct torture_context *torture) |FILE_ATTRIBUTE_DIRECTORY); ret = False; } - - status = smbcli_setatr(cli_nt->tree, "", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); - status = smbcli_setatr(cli_dos->tree, "", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnoaccess)); - - status = smbcli_setatr(cli_nt->tree, ".", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); - status = smbcli_setatr(cli_dos->tree, ".", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); } - + + status = smbcli_setatr(cli_nt->tree, "", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); + status = smbcli_setatr(cli_dos->tree, "", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnoaccess)); + + status = smbcli_setatr(cli_nt->tree, ".", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); + status = smbcli_setatr(cli_dos->tree, ".", + FILE_ATTRIBUTE_DIRECTORY, -1); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); /* Try the same set with openX. */ -- cgit From 36f78c139ab4389163c6e9b26fd4659a16ede3c8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 8 Jan 2007 14:14:18 +0000 Subject: r20609: Additional torture test for our bad_path handling. Most of it is disabled for now, there are calls (for example trans2ffirst) which are quite dubious. Volker (This used to be commit 79846f09b98965af0817b362f45d11e69e23c3e4) --- source4/torture/raw/samba3misc.c | 212 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 210 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index eea6fe2bc6..66462ca5b1 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -25,6 +25,7 @@ #include "system/filesys.h" #include "libcli/libcli.h" #include "torture/util.h" +#include "torture/raw/proto.h" #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ @@ -219,10 +220,12 @@ static NTSTATUS raw_smbcli_open(struct smbcli_tree *tree, const char *fname, int BOOL torture_samba3_badpath(struct torture_context *torture) { - struct smbcli_state *cli_nt; - struct smbcli_state *cli_dos; + struct smbcli_state *cli_nt = NULL; + struct smbcli_state *cli_dos = NULL; const char *fname = "test.txt"; const char *dirname = "testdir"; + const char *invname = "testdir\\notthere.txt"; + const char *invpath = "test.txt\\test.txt"; char *fpath; int fnum; NTSTATUS status; @@ -263,6 +266,7 @@ BOOL torture_samba3_badpath(struct torture_context *torture) goto fail; } + smbcli_unlink(cli_nt->tree, fname); smbcli_deltree(cli_nt->tree, dirname); status = smbcli_mkdir(cli_nt->tree, dirname); @@ -303,6 +307,14 @@ BOOL torture_samba3_badpath(struct torture_context *torture) } smbcli_close(cli_nt->tree, fnum); + fnum = smbcli_open(cli_nt->tree, fname, O_RDWR | O_CREAT, DENY_NONE); + if (fnum == -1) { + d_printf("Could not create file %s: %s\n", fname, + smbcli_errstr(cli_nt->tree)); + goto fail; + } + smbcli_close(cli_nt->tree, fnum); + /* * Do a whole bunch of error code checks on chkpath */ @@ -452,6 +464,201 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = raw_smbcli_open(cli_dos->tree, "<\\bla", O_RDONLY, DENY_NONE, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); + /* + * Walk the Samba3 unix_convert bad_path handling. Some interesting + * error paths around... + */ + + status = smbcli_chkpath(cli_nt->tree, invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_chkpath(cli_dos->tree, invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_getatr(cli_nt->tree, invpath, NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_getatr(cli_dos->tree, invpath, NULL, NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_setatr(cli_nt->tree, invpath, 0, 0); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_setatr(cli_dos->tree, invpath, 0, 0); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_setatr(cli_nt->tree, invpath, FILE_ATTRIBUTE_NORMAL, + 0); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_setatr(cli_dos->tree, invpath, FILE_ATTRIBUTE_NORMAL, + 0); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_setatr(cli_nt->tree, invname, 0, 0); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + status = smbcli_setatr(cli_dos->tree, invname, 0, 0); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadfile)); + + /* + * reply_search returns STATUS_NO_MORE_FILES on invalid path + */ + + goto done; /* We're not yet fully there, but keep it + * in */ + + status = torture_single_search(cli_nt, mem_ctx, invpath, + RAW_SEARCH_SEARCH, + RAW_SEARCH_DATA_SEARCH, 0, NULL); + CHECK_STATUS(status, STATUS_NO_MORE_FILES); + status = torture_single_search(cli_dos, mem_ctx, invpath, + RAW_SEARCH_SEARCH, + RAW_SEARCH_DATA_SEARCH, 0, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnofiles)); + + /* + * ... whereas t2search gets you NT_STATUS_INVALID_PARAMETER + */ + + status = torture_single_search(cli_nt, mem_ctx, dirname, + RAW_SEARCH_TRANS2, + RAW_SEARCH_DATA_STANDARD, 0xf, NULL); + CHECK_STATUS(status, STATUS_NO_MORE_FILES); + status = torture_single_search(cli_dos, mem_ctx, dirname, + RAW_SEARCH_TRANS2, + RAW_SEARCH_DATA_STANDARD, 0xf, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnofiles)); + + status = torture_single_search(cli_nt, mem_ctx, invpath, + RAW_SEARCH_TRANS2, + RAW_SEARCH_DATA_STANDARD, 0xf, NULL); + CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + status = torture_single_search(cli_dos, mem_ctx, invpath, + RAW_SEARCH_TRANS2, + RAW_SEARCH_DATA_STANDARD, 0xf, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidparam)); + + { + union smb_open o; + o.openold.level = RAW_OPEN_OPEN; + o.openold.in.open_mode = 0; + o.openold.in.search_attrs = 0; + o.openold.in.fname = invpath; + + status = smb_raw_open(cli_nt->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smb_raw_open(cli_dos->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + ZERO_STRUCT(o); + o.openx.level = RAW_OPEN_OPENX; + o.openx.in.fname = invpath; + o.openx.in.open_func = OPENX_OPEN_FUNC_OPEN; + + status = smb_raw_open(cli_nt->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smb_raw_open(cli_dos->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + ZERO_STRUCT(o); + o.mknew.level = RAW_OPEN_MKNEW; + o.mknew.in.fname = invpath; + + status = smb_raw_open(cli_nt->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smb_raw_open(cli_dos->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + ZERO_STRUCT(o); + o.ntcreatex.level = RAW_OPEN_NTCREATEX; + o.ntcreatex.in.fname = invpath; + + status = smb_raw_open(cli_nt->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smb_raw_open(cli_dos->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + ZERO_STRUCT(o); + o.nttrans.level = RAW_OPEN_NTTRANS_CREATE; + o.nttrans.in.fname = invpath; + + status = smb_raw_open(cli_nt->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smb_raw_open(cli_dos->tree, mem_ctx, &o); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + /* + * TODO: Check t2open + */ + +#if 0 + /* + * This call seems completely broken on W2k3. It gives back a + * fid, and when you later want to close it the server returns + * INVALID_HANDLE.... + */ + + /* + * W2k3 puts the ctemp files into the root of the share, it + * seems to ignore the directory given. And, the file name + * given back seems to be bogus. The real file name is + * prepended with a "t"... + */ + + ZERO_STRUCT(o); + o.ctemp.level = RAW_OPEN_CTEMP; + o.ctemp.in.directory = invpath; + + status = smb_raw_open(cli_nt->tree, mem_ctx, &o); + if (NT_STATUS_IS_OK(status)) { + smbcli_nt_delete_on_close( + cli_nt->tree, o.ctemp.out.file.fnum, True); + smbcli_close(cli_nt->tree, o.ctemp.out.file.fnum); + } + CHECK_STATUS(status, NT_STATUS_OK); + status = smb_raw_open(cli_dos->tree, mem_ctx, &o); + if (NT_STATUS_IS_OK(status)) { + smbcli_nt_delete_on_close( + cli_nt->tree, o.ctemp.out.file.fnum, True); + smbcli_close(cli_nt->tree, o.ctemp.out.file.fnum); + } + CHECK_STATUS(status, NT_STATUS_OK); +#endif + } + + status = smbcli_unlink(cli_nt->tree, invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_unlink(cli_dos->tree, invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_mkdir(cli_nt->tree, invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_mkdir(cli_dos->tree, invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_rmdir(cli_nt->tree, invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_rmdir(cli_dos->tree, invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_rename(cli_nt->tree, invpath, ""); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); + status = smbcli_rename(cli_dos->tree, invpath, ""); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); + + status = smbcli_rename(cli_nt->tree, "", invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); + status = smbcli_rename(cli_dos->tree, "", invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); + + status = smbcli_rename(cli_nt->tree, invpath, invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_rename(cli_dos->tree, invpath, invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + status = smbcli_qpathinfo(cli_nt->tree, invpath, NULL, NULL, NULL, + NULL, NULL); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_qpathinfo(cli_dos->tree, invpath, NULL, NULL, NULL, + NULL, NULL); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + goto done; fail: @@ -460,6 +667,7 @@ BOOL torture_samba3_badpath(struct torture_context *torture) done: if (cli_nt != NULL) { smbcli_deltree(cli_nt->tree, dirname); + smbcli_unlink(cli_nt->tree, fname); torture_close_connection(cli_nt); } if (cli_dos != NULL) { -- cgit From dff70f76bcfc4abe6ce24fb7c66efd0476c0522d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 8 Jan 2007 21:08:31 +0000 Subject: r20618: Fix a bug in bad_path handling that also exists in 3.0.23: For reply_unlink under Linux we returned NT_STATUS_NOT_A_DIRECTORY. This is because in the bad_path==True condition lstat(2) returns ENOTDIR and not ENOENT. Not sure if we want to necessarily replicate the INVALID_PARAMETER here, but this is what W2k3 does. Jeremy, I tried to call you, but you were not around. So I'll leave it up to you to merge this. Volker (This used to be commit 838afa8f7d2b10460725c1f0b519ce54fb84de88) --- source4/torture/raw/samba3misc.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 66462ca5b1..695abfbb8a 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -496,6 +496,22 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_setatr(cli_dos->tree, invname, 0, 0); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadfile)); + status = smbcli_unlink(cli_nt->tree, invpath); + CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); + status = smbcli_unlink(cli_dos->tree, invpath); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); + + /* + * W2k3 returns INVALID_PARAMETER for a wildcard unlink if the + * directory does not exist. They seem to use the t2ffirst, this also + * returns INVALID_PARAMETER under this condition. + */ + + status = smbcli_unlink(cli_nt->tree, "test.txt\\*.*"); + CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + status = smbcli_unlink(cli_dos->tree, "test.txt\\*.*"); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidparam)); + /* * reply_search returns STATUS_NO_MORE_FILES on invalid path */ @@ -622,11 +638,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) #endif } - status = smbcli_unlink(cli_nt->tree, invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_unlink(cli_dos->tree, invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - status = smbcli_mkdir(cli_nt->tree, invpath); CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); status = smbcli_mkdir(cli_dos->tree, invpath); -- cgit From c5c8a33831f96640b975558766aadf59b0820043 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 9 Jan 2007 15:50:40 +0000 Subject: r20632: The extended RAW-SAMBA3BADPATH test led me to some wrong assumptions, in particular the NT_STATUS_INVALID_PARAMETER thing was badly wrong. Remove the changes based on it. Using gentest is much more effective in this respect, but it will take a while to figure out the wildcard error handling of W2k3. Volker (This used to be commit 33d842e27d7611dd1d3cbfa71d44d63c273ba785) --- source4/torture/raw/samba3misc.c | 263 +-------------------------------------- 1 file changed, 2 insertions(+), 261 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 695abfbb8a..0b196b1587 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -25,7 +25,6 @@ #include "system/filesys.h" #include "libcli/libcli.h" #include "torture/util.h" -#include "torture/raw/proto.h" #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ @@ -220,20 +219,16 @@ static NTSTATUS raw_smbcli_open(struct smbcli_tree *tree, const char *fname, int BOOL torture_samba3_badpath(struct torture_context *torture) { - struct smbcli_state *cli_nt = NULL; - struct smbcli_state *cli_dos = NULL; + struct smbcli_state *cli_nt; + struct smbcli_state *cli_dos; const char *fname = "test.txt"; const char *dirname = "testdir"; - const char *invname = "testdir\\notthere.txt"; - const char *invpath = "test.txt\\test.txt"; char *fpath; int fnum; NTSTATUS status; BOOL ret = True; TALLOC_CTX *mem_ctx; BOOL nt_status_support; - uint16_t attr; - if (!(mem_ctx = talloc_init("torture_samba3_badpath"))) { d_printf("talloc_init failed\n"); @@ -266,7 +261,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) goto fail; } - smbcli_unlink(cli_nt->tree, fname); smbcli_deltree(cli_nt->tree, dirname); status = smbcli_mkdir(cli_nt->tree, dirname); @@ -307,14 +301,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) } smbcli_close(cli_nt->tree, fnum); - fnum = smbcli_open(cli_nt->tree, fname, O_RDWR | O_CREAT, DENY_NONE); - if (fnum == -1) { - d_printf("Could not create file %s: %s\n", fname, - smbcli_errstr(cli_nt->tree)); - goto fail; - } - smbcli_close(cli_nt->tree, fnum); - /* * Do a whole bunch of error code checks on chkpath */ @@ -354,11 +340,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_chkpath(cli_dos->tree, "<\\bla"); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - status = smbcli_chkpath(cli_nt->tree, ""); - CHECK_STATUS(status, NT_STATUS_OK); - status = smbcli_chkpath(cli_dos->tree, ""); - CHECK_STATUS(status, NT_STATUS_OK); - /* * .... And the same gang against getatr. Note that the DOS error codes * differ.... @@ -399,39 +380,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = smbcli_getatr(cli_dos->tree, "<\\bla", NULL, NULL, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); - if (lp_parm_bool(-1, "torture", "w2k3", False) || - lp_parm_bool(-1, "torture", "samba3", False)) { - - /* - * XP and w2k don't show this behaviour, but I think - * Samba3 should follow W2k3 - */ - - status = smbcli_getatr(cli_nt->tree, "", &attr, NULL, NULL); - CHECK_STATUS(status, NT_STATUS_OK); - if (attr != (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY)) { - d_printf("(%s) getatr(\"\") returned 0x%x, expected " - "0x%x\n", __location__, attr, - FILE_ATTRIBUTE_HIDDEN - |FILE_ATTRIBUTE_DIRECTORY); - ret = False; - } - } - - status = smbcli_setatr(cli_nt->tree, "", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED); - status = smbcli_setatr(cli_dos->tree, "", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnoaccess)); - - status = smbcli_setatr(cli_nt->tree, ".", - FILE_ATTRIBUTE_DIRECTORY, -1); - CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID); - status = smbcli_setatr(cli_dos->tree, ".", - FILE_ATTRIBUTE_DIRECTORY, -1); - 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); @@ -464,212 +412,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = raw_smbcli_open(cli_dos->tree, "<\\bla", O_RDONLY, DENY_NONE, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname)); - /* - * Walk the Samba3 unix_convert bad_path handling. Some interesting - * error paths around... - */ - - status = smbcli_chkpath(cli_nt->tree, invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_chkpath(cli_dos->tree, invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_getatr(cli_nt->tree, invpath, NULL, NULL, NULL); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_getatr(cli_dos->tree, invpath, NULL, NULL, NULL); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_setatr(cli_nt->tree, invpath, 0, 0); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_setatr(cli_dos->tree, invpath, 0, 0); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_setatr(cli_nt->tree, invpath, FILE_ATTRIBUTE_NORMAL, - 0); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_setatr(cli_dos->tree, invpath, FILE_ATTRIBUTE_NORMAL, - 0); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_setatr(cli_nt->tree, invname, 0, 0); - CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); - status = smbcli_setatr(cli_dos->tree, invname, 0, 0); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadfile)); - - status = smbcli_unlink(cli_nt->tree, invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_unlink(cli_dos->tree, invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - /* - * W2k3 returns INVALID_PARAMETER for a wildcard unlink if the - * directory does not exist. They seem to use the t2ffirst, this also - * returns INVALID_PARAMETER under this condition. - */ - - status = smbcli_unlink(cli_nt->tree, "test.txt\\*.*"); - CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); - status = smbcli_unlink(cli_dos->tree, "test.txt\\*.*"); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidparam)); - - /* - * reply_search returns STATUS_NO_MORE_FILES on invalid path - */ - - goto done; /* We're not yet fully there, but keep it - * in */ - - status = torture_single_search(cli_nt, mem_ctx, invpath, - RAW_SEARCH_SEARCH, - RAW_SEARCH_DATA_SEARCH, 0, NULL); - CHECK_STATUS(status, STATUS_NO_MORE_FILES); - status = torture_single_search(cli_dos, mem_ctx, invpath, - RAW_SEARCH_SEARCH, - RAW_SEARCH_DATA_SEARCH, 0, NULL); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnofiles)); - - /* - * ... whereas t2search gets you NT_STATUS_INVALID_PARAMETER - */ - - status = torture_single_search(cli_nt, mem_ctx, dirname, - RAW_SEARCH_TRANS2, - RAW_SEARCH_DATA_STANDARD, 0xf, NULL); - CHECK_STATUS(status, STATUS_NO_MORE_FILES); - status = torture_single_search(cli_dos, mem_ctx, dirname, - RAW_SEARCH_TRANS2, - RAW_SEARCH_DATA_STANDARD, 0xf, NULL); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnofiles)); - - status = torture_single_search(cli_nt, mem_ctx, invpath, - RAW_SEARCH_TRANS2, - RAW_SEARCH_DATA_STANDARD, 0xf, NULL); - CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); - status = torture_single_search(cli_dos, mem_ctx, invpath, - RAW_SEARCH_TRANS2, - RAW_SEARCH_DATA_STANDARD, 0xf, NULL); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidparam)); - - { - union smb_open o; - o.openold.level = RAW_OPEN_OPEN; - o.openold.in.open_mode = 0; - o.openold.in.search_attrs = 0; - o.openold.in.fname = invpath; - - status = smb_raw_open(cli_nt->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smb_raw_open(cli_dos->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - ZERO_STRUCT(o); - o.openx.level = RAW_OPEN_OPENX; - o.openx.in.fname = invpath; - o.openx.in.open_func = OPENX_OPEN_FUNC_OPEN; - - status = smb_raw_open(cli_nt->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smb_raw_open(cli_dos->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - ZERO_STRUCT(o); - o.mknew.level = RAW_OPEN_MKNEW; - o.mknew.in.fname = invpath; - - status = smb_raw_open(cli_nt->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smb_raw_open(cli_dos->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - ZERO_STRUCT(o); - o.ntcreatex.level = RAW_OPEN_NTCREATEX; - o.ntcreatex.in.fname = invpath; - - status = smb_raw_open(cli_nt->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smb_raw_open(cli_dos->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - ZERO_STRUCT(o); - o.nttrans.level = RAW_OPEN_NTTRANS_CREATE; - o.nttrans.in.fname = invpath; - - status = smb_raw_open(cli_nt->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smb_raw_open(cli_dos->tree, mem_ctx, &o); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - /* - * TODO: Check t2open - */ - -#if 0 - /* - * This call seems completely broken on W2k3. It gives back a - * fid, and when you later want to close it the server returns - * INVALID_HANDLE.... - */ - - /* - * W2k3 puts the ctemp files into the root of the share, it - * seems to ignore the directory given. And, the file name - * given back seems to be bogus. The real file name is - * prepended with a "t"... - */ - - ZERO_STRUCT(o); - o.ctemp.level = RAW_OPEN_CTEMP; - o.ctemp.in.directory = invpath; - - status = smb_raw_open(cli_nt->tree, mem_ctx, &o); - if (NT_STATUS_IS_OK(status)) { - smbcli_nt_delete_on_close( - cli_nt->tree, o.ctemp.out.file.fnum, True); - smbcli_close(cli_nt->tree, o.ctemp.out.file.fnum); - } - CHECK_STATUS(status, NT_STATUS_OK); - status = smb_raw_open(cli_dos->tree, mem_ctx, &o); - if (NT_STATUS_IS_OK(status)) { - smbcli_nt_delete_on_close( - cli_nt->tree, o.ctemp.out.file.fnum, True); - smbcli_close(cli_nt->tree, o.ctemp.out.file.fnum); - } - CHECK_STATUS(status, NT_STATUS_OK); -#endif - } - - status = smbcli_mkdir(cli_nt->tree, invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_mkdir(cli_dos->tree, invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_rmdir(cli_nt->tree, invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_rmdir(cli_dos->tree, invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_rename(cli_nt->tree, invpath, ""); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); - status = smbcli_rename(cli_dos->tree, invpath, ""); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); - - status = smbcli_rename(cli_nt->tree, "", invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD); - status = smbcli_rename(cli_dos->tree, "", invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidpath)); - - status = smbcli_rename(cli_nt->tree, invpath, invpath); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_rename(cli_dos->tree, invpath, invpath); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - - status = smbcli_qpathinfo(cli_nt->tree, invpath, NULL, NULL, NULL, - NULL, NULL); - CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND); - status = smbcli_qpathinfo(cli_dos->tree, invpath, NULL, NULL, NULL, - NULL, NULL); - CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath)); - goto done; fail: @@ -678,7 +420,6 @@ BOOL torture_samba3_badpath(struct torture_context *torture) done: if (cli_nt != NULL) { smbcli_deltree(cli_nt->tree, dirname); - smbcli_unlink(cli_nt->tree, fname); torture_close_connection(cli_nt); } if (cli_dos != NULL) { -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/raw/samba3misc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 0b196b1587..59b9adfb1b 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -5,7 +5,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit 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/raw/samba3misc.c') 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 From e42ff21109190a110138e2ceeef02e616399aeaa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 15 Aug 2007 23:30:12 +0000 Subject: 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) --- source4/torture/raw/samba3misc.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') 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: -- cgit From 255c24eb8f6a341dbb9453d48119d8d6399bed43 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 16 Aug 2007 00:54:16 +0000 Subject: r24477: Add a rename test to prove that NT_STATUS_OBJECT_NAME_COLLISION is mapped to ERRDOS, ERRrename on a rename error, but mapped to ERRDOS, ERRfilexists on an open error. Jeremy. (This used to be commit e634c627b155b8ce9d325b7b23236861993cfd59) --- source4/torture/raw/samba3misc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index b8a00ab4ed..ded230a423 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -327,8 +327,10 @@ BOOL torture_samba3_badpath(struct torture_context *torture) struct smbcli_state *cli_nt; struct smbcli_state *cli_dos; const char *fname = "test.txt"; + const char *fname1 = "test1.txt"; const char *dirname = "testdir"; char *fpath; + char *fpath1; int fnum; NTSTATUS status; BOOL ret = True; @@ -406,6 +408,17 @@ BOOL torture_samba3_badpath(struct torture_context *torture) } smbcli_close(cli_nt->tree, fnum); + if (!(fpath1 = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname1))) { + goto fail; + } + fnum = smbcli_open(cli_nt->tree, fpath1, O_RDWR | O_CREAT, DENY_NONE); + if (fnum == -1) { + d_printf("Could not create file %s: %s\n", fpath1, + smbcli_errstr(cli_nt->tree)); + goto fail; + } + smbcli_close(cli_nt->tree, fnum); + /* * Do a whole bunch of error code checks on chkpath */ @@ -533,6 +546,18 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = raw_smbcli_ntcreate(cli_dos->tree, fpath, NULL); CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists)); + /* Try the rename test. */ + { + union smb_rename io; + io.rename.in.pattern1 = fpath1; + io.rename.in.pattern2 = fpath; + + status = smb_raw_rename(cli_nt->tree, &io); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); + status = smb_raw_rename(cli_dos->tree, &io); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRrename)); + } + goto done; fail: -- cgit From 103b1ead98ace55649ebba9276e2ee58ba0d9ff2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 16 Aug 2007 01:05:18 +0000 Subject: r24478: Check that NTrename also maps NT_STATUS_OBJECT_NAME_COLLISION to ERRDOS, ERRrename. Jeremy. (This used to be commit 7cc8be50b6c64bc1d0a3f43ab5d78a28260a3c93) --- source4/torture/raw/samba3misc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index ded230a423..fe413495ea 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -549,9 +549,24 @@ BOOL torture_samba3_badpath(struct torture_context *torture) /* Try the rename test. */ { union smb_rename io; + memset(&io, '\0', sizeof(io)); io.rename.in.pattern1 = fpath1; io.rename.in.pattern2 = fpath; + /* Try with SMBmv rename. */ + status = smb_raw_rename(cli_nt->tree, &io); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); + status = smb_raw_rename(cli_dos->tree, &io); + CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRrename)); + + /* Try with NT rename. */ + io.generic.level = RAW_RENAME_NTRENAME; + io.ntrename.in.old_name = fpath1; + io.ntrename.in.new_name = fpath; + io.ntrename.in.attrib = 0; + io.ntrename.in.cluster_size = 0; + io.ntrename.in.flags = RENAME_FLAG_RENAME; + status = smb_raw_rename(cli_nt->tree, &io); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_COLLISION); status = smb_raw_rename(cli_dos->tree, &io); -- cgit From fb19fe7a512db0da16b9dfe226f51d99b86df0a6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 17 Aug 2007 19:48:27 +0000 Subject: r24529: Against samba3, treat EAS_NOT_SUPPORTED as acceptable for t2open Many hosts in the build farm don't have EA support (This used to be commit 3cca299c72e0ae7da3d28d7284f1993eef9f1cea) --- source4/torture/raw/samba3misc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index fe413495ea..e36be6436a 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -537,9 +537,17 @@ BOOL torture_samba3_badpath(struct torture_context *torture) 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); + if (!NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED) + || !lp_parm_bool(-1, "torture", "samba3", False)) { + /* Against samba3, treat EAS_NOT_SUPPORTED as acceptable */ + 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)); + if (!NT_STATUS_EQUAL(status, NT_STATUS_DOS(ERRDOS,ERReasnotsupported)) + || !lp_parm_bool(-1, "torture", "samba3", False)) { + /* Against samba3, treat EAS_NOT_SUPPORTED as acceptable */ + 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); -- cgit From 7e43f973c4e3c76369e690707055f233d15fa37d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 20 Aug 2007 05:24:19 +0000 Subject: r24569: Add two tests A subtest for rename to check if case-changing renames work A test that exposes the case insensitivity unix_convert bug (This used to be commit 786706322a920fd54585bec72d860ed112398f12) --- source4/torture/raw/samba3misc.c | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index e36be6436a..c019c4e2ee 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -598,3 +598,70 @@ BOOL torture_samba3_badpath(struct torture_context *torture) return ret; } + +static void count_fn(struct clilist_file_info *info, const char *name, + void *private_data) +{ + int *counter = (int *)private_data; + *counter += 1; +} + +BOOL torture_samba3_caseinsensitive(struct torture_context *torture) +{ + struct smbcli_state *cli; + TALLOC_CTX *mem_ctx; + NTSTATUS status; + const char *dirname = "insensitive"; + const char *ucase_dirname = "InSeNsItIvE"; + const char *fname = "foo"; + char *fpath; + int fnum; + int counter = 0; + BOOL ret = True; + + if (!(mem_ctx = talloc_init("torture_samba3_caseinsensitive"))) { + d_printf("talloc_init failed\n"); + return False; + } + + if (!torture_open_connection(&cli, 0)) { + goto done; + } + + smbcli_deltree(cli->tree, dirname); + + status = smbcli_mkdir(cli->tree, dirname); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); + goto done; + } + + if (!(fpath = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname))) { + goto done; + } + fnum = smbcli_open(cli->tree, fpath, O_RDWR | O_CREAT, DENY_NONE); + if (fnum == -1) { + d_printf("Could not create file %s: %s\n", fpath, + smbcli_errstr(cli->tree)); + goto done; + } + smbcli_close(cli->tree, fnum); + + smbcli_list(cli->tree, talloc_asprintf( + mem_ctx, "%s\\*", ucase_dirname), + FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN + |FILE_ATTRIBUTE_SYSTEM, + count_fn, (void *)&counter); + + if (counter == 3) { + ret = True; + } + else { + d_fprintf(stderr, "expected 3 entries, got %d\n", counter); + ret = False; + } + + done: + talloc_free(mem_ctx); + return ret; +} -- cgit From 2fefa818a95138fc7d6508093f426cb4ed92138f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 28 Aug 2007 00:16:58 +0000 Subject: r24728: Use more stock torture functions. (This used to be commit da3a7ee407a2b41bd01f45072cad12bf29250b33) --- source4/torture/raw/samba3misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index c019c4e2ee..52ace05314 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -538,13 +538,13 @@ BOOL torture_samba3_badpath(struct torture_context *torture) status = raw_smbcli_t2open(cli_nt->tree, fpath, O_RDONLY | O_CREAT| O_EXCL, DENY_NONE, NULL); if (!NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED) - || !lp_parm_bool(-1, "torture", "samba3", False)) { + || !torture_setting_bool(torture, "samba3", false)) { /* Against samba3, treat EAS_NOT_SUPPORTED as acceptable */ 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); if (!NT_STATUS_EQUAL(status, NT_STATUS_DOS(ERRDOS,ERReasnotsupported)) - || !lp_parm_bool(-1, "torture", "samba3", False)) { + || !torture_setting_bool(torture, "samba3", false)) { /* Against samba3, treat EAS_NOT_SUPPORTED as acceptable */ CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS,ERRfilexists)); } -- cgit From afe87d6cfc7e13005b1a5b8b8110e480410bb4a0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 30 Aug 2007 09:51:33 +0000 Subject: r24798: RAW-SAMBA3POSIXTIMEDLOCK This adds the torture:localdir option, smbtorture expects the share to actually reside in this directory. This might open up more solid posix vs cifs tests. (This used to be commit b0a40dd277c343f5c77c851b26981ddd8166f6bb) --- source4/torture/raw/samba3misc.c | 151 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 52ace05314..e1b1fcaf6d 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -24,6 +24,7 @@ #include "system/filesys.h" #include "libcli/libcli.h" #include "torture/util.h" +#include "lib/events/events.h" #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ @@ -665,3 +666,153 @@ BOOL torture_samba3_caseinsensitive(struct torture_context *torture) talloc_free(mem_ctx); return ret; } + +/* + * Check that Samba3 correctly deals with conflicting posix byte range locks + * on an underlying file + */ + +BOOL torture_samba3_posixtimedlock(struct torture_context *tctx) +{ + struct smbcli_state *cli; + NTSTATUS status; + BOOL ret = True; + const char *dirname = "posixlock"; + const char *fname = "locked"; + const char *fpath; + const char *localdir; + const char *localname; + int fnum = -1; + + int fd = -1; + struct flock posix_lock; + + union smb_lock io; + struct smb_lock_entry lock_entry; + struct smbcli_request *req; + + if (!torture_open_connection(&cli, 0)) { + ret = False; + goto done; + } + + smbcli_deltree(cli->tree, dirname); + + status = smbcli_mkdir(cli->tree, dirname); + if (!NT_STATUS_IS_OK(status)) { + torture_warning(tctx, "smbcli_mkdir failed: %s\n", + nt_errstr(status)); + ret = False; + goto done; + } + + if (!(fpath = talloc_asprintf(tctx, "%s\\%s", dirname, fname))) { + torture_warning(tctx, "talloc failed\n"); + ret = False; + goto done; + } + fnum = smbcli_open(cli->tree, fpath, O_RDWR | O_CREAT, DENY_NONE); + if (fnum == -1) { + torture_warning(tctx, "Could not create file %s: %s\n", fpath, + smbcli_errstr(cli->tree)); + ret = False; + goto done; + } + + if (!(localdir = torture_setting_string(tctx, "localdir", NULL))) { + torture_warning(tctx, "Need 'localdir' setting\n"); + ret = False; + goto done; + } + + if (!(localname = talloc_asprintf(tctx, "%s/%s/%s", localdir, dirname, + fname))) { + torture_warning(tctx, "talloc failed\n"); + ret = False; + goto done; + } + + /* + * Lock a byte range from posix + */ + + fd = open(localname, O_RDWR); + if (fd == -1) { + torture_warning(tctx, "open(%s) failed: %s\n", + localname, strerror(errno)); + goto done; + } + + posix_lock.l_type = F_WRLCK; + posix_lock.l_whence = SEEK_SET; + posix_lock.l_start = 0; + posix_lock.l_len = 1; + + if (fcntl(fd, F_SETLK, &posix_lock) == -1) { + torture_warning(tctx, "fcntl failed: %s\n", strerror(errno)); + ret = False; + goto done; + } + + /* + * Try a cifs brlock without timeout to see if posix locking = yes + */ + + io.lockx.in.ulock_cnt = 0; + io.lockx.in.lock_cnt = 1; + + lock_entry.count = 1; + lock_entry.offset = 0; + lock_entry.pid = cli->tree->session->pid; + + io.lockx.level = RAW_LOCK_LOCKX; + io.lockx.in.mode = LOCKING_ANDX_LARGE_FILES; + io.lockx.in.timeout = 0; + io.lockx.in.locks = &lock_entry; + io.lockx.in.file.fnum = fnum; + + status = smb_raw_lock(cli->tree, &io); + + ret = True; + CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT); + + if (!ret) { + goto done; + } + + /* + * Now fire off a timed brlock, unlock the posix lock and see if the + * timed lock gets through. + */ + + io.lockx.in.timeout = 5000; + + req = smb_raw_lock_send(cli->tree, &io); + if (req == NULL) { + torture_warning(tctx, "smb_raw_lock_send failed\n"); + ret = False; + goto done; + } + + /* + * Ship the async timed request to the server + */ + event_loop_once(req->transport->socket->event.ctx); + msleep(500); + + close(fd); + + status = smbcli_request_simple_recv(req); + + CHECK_STATUS(status, NT_STATUS_OK); + + done: + if (fnum != -1) { + smbcli_close(cli->tree, fnum); + } + if (fd != -1) { + close(fd); + } + smbcli_deltree(cli->tree, dirname); + return ret; +} -- cgit From cd962355abad90a2161765a7be7d26e63572cab7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 15:08:14 +0000 Subject: r25000: Fix some more C++ compatibility warnings. (This used to be commit 08bb1ef643ab906f1645cf6f32763dc73b1884e4) --- source4/torture/raw/samba3misc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index e1b1fcaf6d..57595dab44 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -34,7 +34,7 @@ } \ } while (0) -BOOL torture_samba3_checkfsp(struct torture_context *torture) +bool torture_samba3_checkfsp(struct torture_context *torture) { struct smbcli_state *cli; const char *fname = "test.txt"; @@ -323,7 +323,7 @@ static NTSTATUS raw_smbcli_ntcreate(struct smbcli_tree *tree, const char *fname, } -BOOL torture_samba3_badpath(struct torture_context *torture) +bool torture_samba3_badpath(struct torture_context *torture) { struct smbcli_state *cli_nt; struct smbcli_state *cli_dos; @@ -607,7 +607,7 @@ static void count_fn(struct clilist_file_info *info, const char *name, *counter += 1; } -BOOL torture_samba3_caseinsensitive(struct torture_context *torture) +bool torture_samba3_caseinsensitive(struct torture_context *torture) { struct smbcli_state *cli; TALLOC_CTX *mem_ctx; @@ -672,7 +672,7 @@ BOOL torture_samba3_caseinsensitive(struct torture_context *torture) * on an underlying file */ -BOOL torture_samba3_posixtimedlock(struct torture_context *tctx) +bool torture_samba3_posixtimedlock(struct torture_context *tctx) { struct smbcli_state *cli; NTSTATUS status; -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/torture/raw/samba3misc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 57595dab44..74c32728a1 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -25,6 +25,7 @@ #include "libcli/libcli.h" #include "torture/util.h" #include "lib/events/events.h" +#include "param/param.h" #define CHECK_STATUS(status, correct) do { \ if (!NT_STATUS_EQUAL(status, correct)) { \ -- cgit From 5f280af0125043bc3e7ebce34ad80a635ca4ce09 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 24 Sep 2007 19:48:10 +0000 Subject: r25310: Make sure we do not regress on r25309 (This used to be commit 4eb0ec51aae4d05ce7bace7ea6dce2511e9a670a) --- source4/torture/raw/samba3misc.c | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 74c32728a1..3f6c552cb4 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -817,3 +817,73 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) smbcli_deltree(cli->tree, dirname); return ret; } + +bool torture_samba3_rootdirfid(struct torture_context *tctx) +{ + struct smbcli_state *cli; + NTSTATUS status; + uint16_t dnum; + union smb_open io; + const char *fname = "testfile"; + bool ret = false; + + if (!torture_open_connection(&cli, 0)) { + ret = false; + goto done; + } + + smbcli_unlink(cli->tree, fname); + + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; + io.ntcreatex.in.root_fid = 0; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.access_mask = + SEC_STD_SYNCHRONIZE | SEC_FILE_EXECUTE; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_DIRECTORY; + io.ntcreatex.in.share_access = + NTCREATEX_SHARE_ACCESS_READ + | NTCREATEX_SHARE_ACCESS_READ; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.fname = "\\"; + status = smb_raw_open(cli->tree, tctx, &io); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smb_open on the directory failed: %s\n", + nt_errstr(status)); + ret = false; + goto done; + } + dnum = io.ntcreatex.out.file.fnum; + + io.ntcreatex.in.flags = + NTCREATEX_FLAGS_REQUEST_OPLOCK + | NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK; + io.ntcreatex.in.root_fid = dnum; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF; + 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_NONE; + io.ntcreatex.in.create_options = 0; + io.ntcreatex.in.fname = fname; + + status = smb_raw_open(cli->tree, tctx, &io); + if (!NT_STATUS_IS_OK(status)) { + d_printf("smb_open on the file %s failed: %s\n", + fname, nt_errstr(status)); + ret = false; + goto done; + } + + smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); + smbcli_close(cli->tree, dnum); + smbcli_unlink(cli->tree, fname); + + ret = true; + done: + return ret; +} + -- cgit From 3048e9ad654506219b169a934edded388d10fcad Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 27 Sep 2007 23:31:28 +0000 Subject: r25392: Add loadparm context as argument in a couple more places. (This used to be commit c62f51cc28a37959128e78a1f34cfd4c6d3ba069) --- source4/torture/raw/samba3misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 3f6c552cb4..aad13ecd8f 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -346,7 +346,7 @@ bool torture_samba3_badpath(struct torture_context *torture) nt_status_support = lp_nt_status_support(); - if (!lp_set_cmdline("nt status support", "yes")) { + if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) { printf("Could not set 'nt status support = yes'\n"); goto fail; } @@ -355,7 +355,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!lp_set_cmdline("nt status support", "no")) { + if (!lp_set_cmdline(global_loadparm, "nt status support", "no")) { printf("Could not set 'nt status support = yes'\n"); goto fail; } @@ -364,7 +364,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!lp_set_cmdline("nt status support", + if (!lp_set_cmdline(global_loadparm, "nt status support", nt_status_support ? "yes":"no")) { printf("Could not reset 'nt status support = yes'"); goto fail; -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/torture/raw/samba3misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index aad13ecd8f..ec53af93e8 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -344,7 +344,7 @@ bool torture_samba3_badpath(struct torture_context *torture) return False; } - nt_status_support = lp_nt_status_support(); + nt_status_support = lp_nt_status_support(global_loadparm); if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) { printf("Could not set 'nt status support = yes'\n"); -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/torture/raw/samba3misc.c | 56 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index ec53af93e8..988405e806 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -31,7 +31,7 @@ if (!NT_STATUS_EQUAL(status, correct)) { \ printf("(%s) Incorrect status %s - should be %s\n", \ __location__, nt_errstr(status), nt_errstr(correct)); \ - ret = False; \ + ret = false; \ } \ } while (0) @@ -42,7 +42,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) const char *dirname = "testdir"; int fnum; NTSTATUS status; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; ssize_t nread; char buf[16]; @@ -50,14 +50,14 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if ((mem_ctx = talloc_init("torture_samba3_checkfsp")) == NULL) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!torture_open_connection_share( torture, &cli, torture_setting_string(torture, "host", NULL), torture_setting_string(torture, "share", NULL), NULL)) { d_printf("torture_open_connection_share failed\n"); - ret = False; + ret = false; goto done; } @@ -80,7 +80,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) status = smbcli_mkdir(cli->tree, dirname); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -103,7 +103,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { d_printf("smb_open on the directory failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } fnum = io.ntcreatex.out.file.fnum; @@ -115,7 +115,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (nread >= 0) { d_printf("smbcli_read on a directory succeeded, expected " "failure\n"); - ret = False; + ret = false; } CHECK_STATUS(smbcli_nt_error(cli->tree), @@ -127,7 +127,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (nread >= 0) { d_printf("smbcli_read on a directory succeeded, expected " "failure\n"); - ret = False; + ret = false; } CHECK_STATUS(smbcli_nt_error(tree2), NT_STATUS_INVALID_HANDLE); @@ -140,7 +140,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (fnum == -1) { d_printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } @@ -335,13 +335,13 @@ bool torture_samba3_badpath(struct torture_context *torture) char *fpath1; int fnum; NTSTATUS status; - BOOL ret = True; + bool ret = true; TALLOC_CTX *mem_ctx; - BOOL nt_status_support; + bool nt_status_support; if (!(mem_ctx = talloc_init("torture_samba3_badpath"))) { d_printf("talloc_init failed\n"); - return False; + return false; } nt_status_support = lp_nt_status_support(global_loadparm); @@ -375,7 +375,7 @@ bool torture_samba3_badpath(struct torture_context *torture) status = smbcli_mkdir(cli_nt->tree, dirname); if (!NT_STATUS_IS_OK(status)) { d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } @@ -586,7 +586,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto done; fail: - ret = False; + ret = false; done: if (cli_nt != NULL) { @@ -619,11 +619,11 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture) char *fpath; int fnum; int counter = 0; - BOOL ret = True; + bool ret = true; if (!(mem_ctx = talloc_init("torture_samba3_caseinsensitive"))) { d_printf("talloc_init failed\n"); - return False; + return false; } if (!torture_open_connection(&cli, 0)) { @@ -656,11 +656,11 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture) count_fn, (void *)&counter); if (counter == 3) { - ret = True; + ret = true; } else { d_fprintf(stderr, "expected 3 entries, got %d\n", counter); - ret = False; + ret = false; } done: @@ -677,7 +677,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) { struct smbcli_state *cli; NTSTATUS status; - BOOL ret = True; + bool ret = true; const char *dirname = "posixlock"; const char *fname = "locked"; const char *fpath; @@ -693,7 +693,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) struct smbcli_request *req; if (!torture_open_connection(&cli, 0)) { - ret = False; + ret = false; goto done; } @@ -703,33 +703,33 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) if (!NT_STATUS_IS_OK(status)) { torture_warning(tctx, "smbcli_mkdir failed: %s\n", nt_errstr(status)); - ret = False; + ret = false; goto done; } if (!(fpath = talloc_asprintf(tctx, "%s\\%s", dirname, fname))) { torture_warning(tctx, "talloc failed\n"); - ret = False; + ret = false; goto done; } fnum = smbcli_open(cli->tree, fpath, O_RDWR | O_CREAT, DENY_NONE); if (fnum == -1) { torture_warning(tctx, "Could not create file %s: %s\n", fpath, smbcli_errstr(cli->tree)); - ret = False; + ret = false; goto done; } if (!(localdir = torture_setting_string(tctx, "localdir", NULL))) { torture_warning(tctx, "Need 'localdir' setting\n"); - ret = False; + ret = false; goto done; } if (!(localname = talloc_asprintf(tctx, "%s/%s/%s", localdir, dirname, fname))) { torture_warning(tctx, "talloc failed\n"); - ret = False; + ret = false; goto done; } @@ -751,7 +751,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) if (fcntl(fd, F_SETLK, &posix_lock) == -1) { torture_warning(tctx, "fcntl failed: %s\n", strerror(errno)); - ret = False; + ret = false; goto done; } @@ -774,7 +774,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) status = smb_raw_lock(cli->tree, &io); - ret = True; + ret = true; CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT); if (!ret) { @@ -791,7 +791,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) req = smb_raw_lock_send(cli->tree, &io); if (req == NULL) { torture_warning(tctx, "smb_raw_lock_send failed\n"); - ret = False; + ret = false; goto done; } -- cgit From a67d2e0a83c9b97c23d74f5ea9cc5d1521f18b62 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 11 Nov 2007 14:06:02 +0100 Subject: r25925: torture/raw: fix sending unitialized bytes in RAW-SAMBA3ROOTDIRFID (found by make valgrindtest) metze (This used to be commit e95c2ffe009ebdc9993b75ecc1a47175ff840ec4) --- source4/torture/raw/samba3misc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 988405e806..8e41469963 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -834,6 +834,7 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx) smbcli_unlink(cli->tree, fname); + ZERO_STRUCT(io); io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; io.ntcreatex.in.root_fid = 0; -- cgit From bbdfbf8d9d486aee51117976b8f825759a4c4a37 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 00:28:22 +0100 Subject: r26238: Add a loadparm context parameter to torture_context, remove more uses of global_loadparm. (This used to be commit a33a5530545086b81a3b205aa109dff11c546926) --- source4/torture/raw/samba3misc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 8e41469963..a075277efb 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -344,9 +344,9 @@ bool torture_samba3_badpath(struct torture_context *torture) return false; } - nt_status_support = lp_nt_status_support(global_loadparm); + nt_status_support = lp_nt_status_support(torture->lp_ctx); - if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) { + if (!lp_set_cmdline(torture->lp_ctx, "nt status support", "yes")) { printf("Could not set 'nt status support = yes'\n"); goto fail; } @@ -355,7 +355,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!lp_set_cmdline(global_loadparm, "nt status support", "no")) { + if (!lp_set_cmdline(torture->lp_ctx, "nt status support", "no")) { printf("Could not set 'nt status support = yes'\n"); goto fail; } @@ -364,7 +364,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!lp_set_cmdline(global_loadparm, "nt status support", + if (!lp_set_cmdline(torture->lp_ctx, "nt status support", nt_status_support ? "yes":"no")) { printf("Could not reset 'nt status support = yes'"); goto fail; -- cgit From 0a2f1a46a02d2c9497d05d7e534829dc6e9430dc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 15:53:07 +0100 Subject: r26249: Remove a couple more uses of global_loadparm. (This used to be commit 80a61200508a00d5b16a3e748ce92d54b9fefcd2) --- source4/torture/raw/samba3misc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index a075277efb..749b10cc07 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -54,7 +54,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) } if (!torture_open_connection_share( - torture, &cli, torture_setting_string(torture, "host", NULL), + torture, &cli, torture, torture_setting_string(torture, "host", NULL), torture_setting_string(torture, "share", NULL), NULL)) { d_printf("torture_open_connection_share failed\n"); ret = false; @@ -351,7 +351,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!torture_open_connection(&cli_nt, 0)) { + if (!torture_open_connection(&cli_nt, torture, 0)) { goto fail; } @@ -360,7 +360,7 @@ bool torture_samba3_badpath(struct torture_context *torture) goto fail; } - if (!torture_open_connection(&cli_dos, 1)) { + if (!torture_open_connection(&cli_dos, torture, 1)) { goto fail; } @@ -626,7 +626,7 @@ bool torture_samba3_caseinsensitive(struct torture_context *torture) return false; } - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, torture, 0)) { goto done; } @@ -692,7 +692,7 @@ bool torture_samba3_posixtimedlock(struct torture_context *tctx) struct smb_lock_entry lock_entry; struct smbcli_request *req; - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, tctx, 0)) { ret = false; goto done; } @@ -827,7 +827,7 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx) const char *fname = "testfile"; bool ret = false; - if (!torture_open_connection(&cli, 0)) { + if (!torture_open_connection(&cli, tctx, 0)) { ret = false; goto done; } -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/torture/raw/samba3misc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 749b10cc07..15a7f6c4a3 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -20,6 +20,7 @@ #include "includes.h" #include "torture/torture.h" #include "libcli/raw/libcliraw.h" +#include "libcli/raw/raw_proto.h" #include "system/time.h" #include "system/filesys.h" #include "libcli/libcli.h" -- cgit From 7f464f062899c96ebae04c899665500b998ce658 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 22 Apr 2008 16:37:54 -0400 Subject: Fix more failing tests to pass the event context. (This used to be commit d6c5d8baf0c48a6078a47bba33993a841ff526d9) --- source4/torture/raw/samba3misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/raw/samba3misc.c') diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index 15a7f6c4a3..27b4d42dd8 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -56,7 +56,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture) if (!torture_open_connection_share( torture, &cli, torture, torture_setting_string(torture, "host", NULL), - torture_setting_string(torture, "share", NULL), NULL)) { + torture_setting_string(torture, "share", NULL), torture->ev)) { d_printf("torture_open_connection_share failed\n"); ret = false; goto done; -- cgit