summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/torture/raw/raw.c2
-rw-r--r--source4/torture/raw/rename.c20
-rw-r--r--source4/torture/raw/samba3misc.c67
3 files changed, 89 insertions, 0 deletions
diff --git a/source4/torture/raw/raw.c b/source4/torture/raw/raw.c
index 55e9350144..67d79ef78c 100644
--- a/source4/torture/raw/raw.c
+++ b/source4/torture/raw/raw.c
@@ -62,6 +62,8 @@ NTSTATUS torture_raw_init(void)
torture_suite_add_simple_test(suite, "SAMBA3CLOSEERR", torture_samba3_closeerr);
torture_suite_add_simple_test(suite, "SAMBA3CHECKFSP", torture_samba3_checkfsp);
torture_suite_add_simple_test(suite, "SAMBA3BADPATH", torture_samba3_badpath);
+ torture_suite_add_simple_test(suite, "SAMBA3CASEINSENSITIVE",
+ torture_samba3_caseinsensitive);
torture_suite_add_simple_test(suite, "SCAN-EAMAX", torture_max_eas);
suite->description = talloc_strdup(suite,
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 22e91a44a9..9e99770503 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -51,6 +51,8 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
int fnum = -1;
const char *fname1 = BASEDIR "\\test1.txt";
const char *fname2 = BASEDIR "\\test2.txt";
+ const char *Fname1 = BASEDIR "\\Test1.txt";
+ union smb_fileinfo finfo;
union smb_open op;
printf("Testing SMBmv\n");
@@ -109,6 +111,24 @@ static BOOL test_mv(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
+ printf("Trying case-changing rename\n");
+ io.rename.in.pattern1 = fname1;
+ io.rename.in.pattern2 = Fname1;
+ status = smb_raw_rename(cli->tree, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ finfo.generic.level = RAW_FILEINFO_ALL_INFO;
+ finfo.all_info.in.file.path = fname1;
+ status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ if (strcmp(finfo.all_info.out.fname.s, Fname1) != 0) {
+ printf("(%s) Incorrect filename [%s] after case-changing "
+ "rename, should be [%s]\n", __location__,
+ finfo.all_info.out.fname.s, Fname1);
+ ret = False;
+ goto done;
+ }
+
io.rename.in.pattern1 = fname1;
io.rename.in.pattern2 = fname2;
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index e36be6436a..c019c4e2ee 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -598,3 +598,70 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
return ret;
}
+
+static void count_fn(struct clilist_file_info *info, const char *name,
+ void *private_data)
+{
+ int *counter = (int *)private_data;
+ *counter += 1;
+}
+
+BOOL torture_samba3_caseinsensitive(struct torture_context *torture)
+{
+ struct smbcli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ NTSTATUS status;
+ const char *dirname = "insensitive";
+ const char *ucase_dirname = "InSeNsItIvE";
+ const char *fname = "foo";
+ char *fpath;
+ int fnum;
+ int counter = 0;
+ BOOL ret = True;
+
+ if (!(mem_ctx = talloc_init("torture_samba3_caseinsensitive"))) {
+ d_printf("talloc_init failed\n");
+ return False;
+ }
+
+ if (!torture_open_connection(&cli, 0)) {
+ goto done;
+ }
+
+ smbcli_deltree(cli->tree, dirname);
+
+ status = smbcli_mkdir(cli->tree, dirname);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("smbcli_mkdir failed: %s\n", nt_errstr(status));
+ goto done;
+ }
+
+ if (!(fpath = talloc_asprintf(mem_ctx, "%s\\%s", dirname, fname))) {
+ goto done;
+ }
+ fnum = smbcli_open(cli->tree, fpath, O_RDWR | O_CREAT, DENY_NONE);
+ if (fnum == -1) {
+ d_printf("Could not create file %s: %s\n", fpath,
+ smbcli_errstr(cli->tree));
+ goto done;
+ }
+ smbcli_close(cli->tree, fnum);
+
+ smbcli_list(cli->tree, talloc_asprintf(
+ mem_ctx, "%s\\*", ucase_dirname),
+ FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN
+ |FILE_ATTRIBUTE_SYSTEM,
+ count_fn, (void *)&counter);
+
+ if (counter == 3) {
+ ret = True;
+ }
+ else {
+ d_fprintf(stderr, "expected 3 entries, got %d\n", counter);
+ ret = False;
+ }
+
+ done:
+ talloc_free(mem_ctx);
+ return ret;
+}