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