summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-08-31 21:34:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:27 -0500
commitebe1733768c2b3bfcb6d93e656c1cf52fc0f7b7e (patch)
treeee22b25b4049b0c0988db23cdab22b3d364de7e5 /source4/torture
parent468fe3e5db069faf012831c2d8220c093ec5aaff (diff)
downloadsamba-ebe1733768c2b3bfcb6d93e656c1cf52fc0f7b7e.tar.gz
samba-ebe1733768c2b3bfcb6d93e656c1cf52fc0f7b7e.tar.bz2
samba-ebe1733768c2b3bfcb6d93e656c1cf52fc0f7b7e.zip
r2151: Added some more ad-hoc tests. Found bugs in Samba3 with these :-).
Jeremy. (This used to be commit fe6506e190ed5e1987894d43caa51b33d80d5193)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/raw/chkpath.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c
index b5f03dd3a1..f5e86c8048 100644
--- a/source4/torture/raw/chkpath.c
+++ b/source4/torture/raw/chkpath.c
@@ -37,6 +37,7 @@ static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
NTSTATUS status;
BOOL ret = True;
int fnum = -1;
+ int fnum1 = -1;
io.in.path = BASEDIR;
@@ -80,6 +81,61 @@ static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_chkpath(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+ io.in.path = BASEDIR"\\.\\";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+
+ io.in.path = BASEDIR"\\.\\nt";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = BASEDIR"\\.\\.\\nt";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = BASEDIR"\\nt";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ io.in.path = BASEDIR".\\foo";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = ".\\";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+
+ io.in.path = ".\\.";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = ".\\.\\.\\.\\foo\\.\\.\\";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = BASEDIR".\\.\\.\\.\\foo\\.\\.\\";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = BASEDIR".\\.\\.\\.\\foo\\..\\.\\";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = BASEDIR".";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
io.in.path = "\\";
printf("testing %s\n", io.in.path);
status = smb_raw_chkpath(cli->tree, &io);
@@ -115,11 +171,33 @@ static BOOL test_chkpath(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_chkpath(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_NOT_A_DIRECTORY);
+ /* We expect this open to fail with the same error code as the chkpath below. */
+ fnum1 = smbcli_nt_create_full(cli->tree, BASEDIR "\\nt\\Visual Studio\\VB98\\vb6.exe\\3",
+ 0, GENERIC_RIGHTS_FILE_ALL_ACCESS,
+ FILE_ATTRIBUTE_NORMAL,
+ NTCREATEX_SHARE_ACCESS_DELETE|
+ NTCREATEX_SHARE_ACCESS_READ|
+ NTCREATEX_SHARE_ACCESS_WRITE,
+ NTCREATEX_DISP_OVERWRITE_IF,
+ 0, 0);
+ status = smbcli_nt_error(cli->tree);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
io.in.path = BASEDIR "\\nt\\Visual Studio\\VB98\\vb6.exe\\3";
printf("testing %s\n", io.in.path);
status = smb_raw_chkpath(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ io.in.path = BASEDIR "\\nt\\Visual Studio\\VB98\\vb6.exe\\3\\foo";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
+ io.in.path = BASEDIR "\\nt\\3\\foo";
+ printf("testing %s\n", io.in.path);
+ status = smb_raw_chkpath(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_NOT_FOUND);
+
io.in.path = BASEDIR "\\nt\\Visual Studio\\*\\vb6.exe\\3";
printf("testing %s\n", io.in.path);
status = smb_raw_chkpath(cli->tree, &io);