1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r2151: Added some more ad-hoc tests. Found bugs in Samba3 with these :-).

Jeremy.
This commit is contained in:
Jeremy Allison 2004-08-31 21:34:14 +00:00 committed by Gerald (Jerry) Carter
parent 5ab362cede
commit fe6506e190

View File

@ -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);