mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
s4:torture: Convert samba3.raw.mkdir test to smb2
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Noel Power <noel.power@suse.com> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 888abcaf8ffbec45fc47520bd3f544e3aa6f58f2) Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Apr 28 19:46:32 UTC 2020 on sn-devel-184
This commit is contained in:
parent
34311553d7
commit
dedb4f24af
@ -160,3 +160,4 @@ bench # don't run benchmarks in our selftest
|
||||
^samba.tests.dcerpc.unix # This contains a server-side getpwuid call which hangs the server when nss_winbindd is in use
|
||||
^samba4.smb2.mangle.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
|
||||
^samba4.smb2.tcon.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
|
||||
^samba4.smb2.mkdir.*\(ad_dc_ntvfs\)$ # Ignore ad_dc_ntvfs since this is a new test
|
||||
|
@ -100,8 +100,6 @@ samba3.raw.composite(nt4_dc_smb1)
|
||||
samba3.raw.eas(ad_dc_smb1)
|
||||
samba3.raw.eas(nt4_dc_smb1)
|
||||
samba3.raw.lock(nt4_dc_smb1)
|
||||
samba3.raw.mkdir(ad_dc_smb1)
|
||||
samba3.raw.mkdir(nt4_dc_smb1)
|
||||
samba3.raw.notify(nt4_dc_smb1)
|
||||
samba3.raw.open(ad_dc_smb1)
|
||||
samba3.raw.open(nt4_dc_smb1)
|
||||
|
@ -826,7 +826,7 @@ for t in tests:
|
||||
"raw.write",]) :
|
||||
plansmbtorture4testsuite(t, "nt4_dc_smb1", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
|
||||
plansmbtorture4testsuite(t, "ad_dc_smb1", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
|
||||
elif t in ["base.mangle", "base.tcon"]:
|
||||
elif t in ["base.mangle", "base.tcon", "raw.mkdir"]:
|
||||
plansmbtorture4testsuite(t, "nt4_dc_smb1_done", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
|
||||
plansmbtorture4testsuite(t, "ad_dc_smb1_done", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
|
||||
else:
|
||||
|
105
source4/torture/smb2/mkdir.c
Normal file
105
source4/torture/smb2/mkdir.c
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
RAW_MKDIR_* and RAW_RMDIR_* individual test suite
|
||||
Copyright (C) Andrew Tridgell 2003
|
||||
Copyright (C) David Mulder 2020
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "libcli/smb2/smb2.h"
|
||||
#include "libcli/smb2/smb2_calls.h"
|
||||
#include "torture/util.h"
|
||||
#include "torture/smb2/proto.h"
|
||||
#include "libcli/smb_composite/smb_composite.h"
|
||||
|
||||
#define BASEDIR "mkdirtest"
|
||||
|
||||
/*
|
||||
test mkdir ops
|
||||
*/
|
||||
bool torture_smb2_mkdir(struct torture_context *tctx, struct smb2_tree *tree)
|
||||
{
|
||||
struct smb2_handle h = {{0}};
|
||||
const char *path = BASEDIR "\\mkdir.dir";
|
||||
NTSTATUS status;
|
||||
bool ret = true;
|
||||
|
||||
ret = smb2_util_setup_dir(tctx, tree, BASEDIR);
|
||||
torture_assert(tctx, ret, "Failed to setup up test directory: " BASEDIR);
|
||||
|
||||
/*
|
||||
basic mkdir
|
||||
*/
|
||||
status = smb2_util_mkdir(tree, path);
|
||||
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
|
||||
"Incorrect status");
|
||||
|
||||
torture_comment(tctx, "Testing mkdir collision\n");
|
||||
|
||||
/* 2nd create */
|
||||
status = smb2_util_mkdir(tree, path);
|
||||
torture_assert_ntstatus_equal_goto(tctx, status,
|
||||
NT_STATUS_OBJECT_NAME_COLLISION,
|
||||
ret, done, "Incorrect status");
|
||||
|
||||
/* basic rmdir */
|
||||
status = smb2_util_rmdir(tree, path);
|
||||
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
|
||||
"Incorrect status");
|
||||
|
||||
status = smb2_util_rmdir(tree, path);
|
||||
torture_assert_ntstatus_equal_goto(tctx, status,
|
||||
NT_STATUS_OBJECT_NAME_NOT_FOUND,
|
||||
ret, done, "Incorrect status");
|
||||
|
||||
torture_comment(tctx, "Testing mkdir collision with file\n");
|
||||
|
||||
/* name collision with a file */
|
||||
smb2_create_complex_file(tctx, tree, path, &h);
|
||||
smb2_util_close(tree, h);
|
||||
status = smb2_util_mkdir(tree, path);
|
||||
torture_assert_ntstatus_equal_goto(tctx, status,
|
||||
NT_STATUS_OBJECT_NAME_COLLISION,
|
||||
ret, done, "Incorrect status");
|
||||
|
||||
torture_comment(tctx, "Testing rmdir with file\n");
|
||||
|
||||
/* delete a file with rmdir */
|
||||
status = smb2_util_rmdir(tree, path);
|
||||
torture_assert_ntstatus_equal_goto(tctx, status,
|
||||
NT_STATUS_NOT_A_DIRECTORY,
|
||||
ret, done, "Incorrect status");
|
||||
|
||||
smb2_util_unlink(tree, path);
|
||||
|
||||
torture_comment(tctx, "Testing invalid dir\n");
|
||||
|
||||
/* create an invalid dir */
|
||||
status = smb2_util_mkdir(tree, "..\\..\\..");
|
||||
torture_assert_ntstatus_equal_goto(tctx, status,
|
||||
NT_STATUS_OBJECT_PATH_SYNTAX_BAD,
|
||||
ret, done, "Incorrect status");
|
||||
|
||||
torture_comment(tctx, "Testing t2mkdir bad path\n");
|
||||
status = smb2_util_mkdir(tree, BASEDIR "\\bad_path\\bad_path");
|
||||
torture_assert_ntstatus_equal_goto(tctx, status,
|
||||
NT_STATUS_OBJECT_PATH_NOT_FOUND,
|
||||
ret, done, "Incorrect status");
|
||||
|
||||
done:
|
||||
smb2_deltree(tree, BASEDIR);
|
||||
return ret;
|
||||
}
|
@ -206,6 +206,7 @@ NTSTATUS torture_smb2_init(TALLOC_CTX *ctx)
|
||||
torture_suite_add_1smb2_test(suite, "maximum_allowed", torture_smb2_maximum_allowed);
|
||||
torture_suite_add_1smb2_test(suite, "mangle", torture_smb2_mangle);
|
||||
torture_suite_add_1smb2_test(suite, "tcon", run_tcon_test);
|
||||
torture_suite_add_1smb2_test(suite, "mkdir", torture_smb2_mkdir);
|
||||
|
||||
torture_suite_add_suite(suite, torture_smb2_charset(suite));
|
||||
suite->description = talloc_strdup(suite, "SMB2-specific tests");
|
||||
|
@ -24,6 +24,7 @@ bld.SAMBA_MODULE('TORTURE_SMB2',
|
||||
mangle.c
|
||||
maxfid.c
|
||||
maxwrite.c
|
||||
mkdir.c
|
||||
multichannel.c
|
||||
oplock_break_handler.c
|
||||
notify.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user