diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:29 +0000 |
commit | 4f5791ebd03eaec1c7da0865a383175b05102712 (patch) | |
tree | 8ce7b00f7a76baa386372422adebbe64510812d4 /source3/torture/test_case_insensitive.c | |
parent | Initial commit. (diff) | |
download | samba-4f5791ebd03eaec1c7da0865a383175b05102712.tar.xz samba-4f5791ebd03eaec1c7da0865a383175b05102712.zip |
Adding upstream version 2:4.17.12+dfsg.upstream/2%4.17.12+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'source3/torture/test_case_insensitive.c')
-rw-r--r-- | source3/torture/test_case_insensitive.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/source3/torture/test_case_insensitive.c b/source3/torture/test_case_insensitive.c new file mode 100644 index 0000000..04e2dce --- /dev/null +++ b/source3/torture/test_case_insensitive.c @@ -0,0 +1,80 @@ +/* + Unix SMB/CIFS implementation. + reproducer for bug 8042 + Copyright (C) Volker Lendecke 2011 + + 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 "torture/proto.h" +#include "system/filesys.h" +#include "libsmb/libsmb.h" + +/* + * Regression test file creates on case insensitive file systems (e.g. OS/X) + * https://bugzilla.samba.org/show_bug.cgi?id=8042 + */ + +bool run_case_insensitive_create(int dummy) +{ + struct cli_state *cli; + uint16_t fnum; + NTSTATUS status; + + printf("Starting case_insensitive_create\n"); + + if (!torture_open_connection(&cli, 0)) { + return false; + } + + status = cli_mkdir(cli, "x"); + if (!NT_STATUS_IS_OK(status)) { + printf("cli_mkdir failed: %s\n", nt_errstr(status)); + goto done; + } + status = cli_chkpath(cli, "X"); + if (!NT_STATUS_IS_OK(status)) { + printf("cli_chkpath failed: %s\n", nt_errstr(status)); + goto rmdir; + } + status = cli_openx(cli, "x\\y", O_RDWR|O_CREAT, 0, &fnum); + if (!NT_STATUS_IS_OK(status)) { + printf("cli_openx failed: %s\n", nt_errstr(status)); + + if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) { + printf("Bug 8042 reappeared!!\n"); + } + goto unlink; + } + status = cli_close(cli, fnum); + if (!NT_STATUS_IS_OK(status)) { + printf("cli_close failed: %s\n", nt_errstr(status)); + goto done; + } +unlink: + status = cli_unlink(cli, "x\\y", 0); + if (!NT_STATUS_IS_OK(status)) { + printf("cli_unlink failed: %s\n", nt_errstr(status)); + goto done; + } +rmdir: + status = cli_rmdir(cli, "x"); + if (!NT_STATUS_IS_OK(status)) { + printf("cli_close failed: %s\n", nt_errstr(status)); + } +done: + torture_close_connection(cli); + return NT_STATUS_IS_OK(status); +} |