From 47dfe299c8a5a64ade88d15ecf71f99800ea40cd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 26 Mar 2004 02:39:48 +0000 Subject: - moved some of the base tests into torture/basic/ - added a CHARSET set of tests, which determines how the server deals with some specific charset issues related to UTF-16 support. Interestingly, Samba3 already passes all but one of these tests, because our incorrect UCS-2 and UTF-8 implementations where we don't check the validity of characters actually matches what Windows does! This means that adding UTF-16 support to Samba is going to be _much_ easier than we expected. (This used to be commit c8497a42364d186f08102224d5062d176ee81f5b) --- source4/torture/basic/charset.c | 269 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+) create mode 100644 source4/torture/basic/charset.c (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c new file mode 100644 index 0000000000..1a708ac055 --- /dev/null +++ b/source4/torture/basic/charset.c @@ -0,0 +1,269 @@ +/* + Unix SMB/CIFS implementation. + + SMB torture tester - charset test routines + + Copyright (C) Andrew Tridgell 2001 + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +#define BASEDIR "\\chartest\\" + +/* + open a file using a set of unicode code points for the name + + the prefix BASEDIR is added before the name +*/ +static NTSTATUS unicode_open(struct cli_tree *tree, + TALLOC_CTX *mem_ctx, + uint32 open_disposition, + const uint32 *u_name, + size_t u_name_len) +{ + union smb_open io; + char *fname, *fname2=NULL, *ucs_name; + int i; + NTSTATUS status; + + ucs_name = malloc((1+u_name_len)*2); + if (!ucs_name) { + return NT_STATUS_NO_MEMORY; + } + + for (i=0;itree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 2); + if (!NT_STATUS_IS_OK(status1)) { + printf("Failed to create composed name - %s\n", + nt_errstr(status1)); + return False; + } + + status2 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + + if (!NT_STATUS_IS_OK(status2)) { + printf("Failed to create accented character - %s\n", + nt_errstr(status2)); + return False; + } + + return True; +} + +/* + see if the server recognises a naked diacritical +*/ +static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx) +{ + const uint32 name1[] = {0x308}; + const uint32 name2[] = {0x308, 0x308}; + NTSTATUS status1, status2; + + printf("Testing naked diacritical (umlaut)\n"); + + status1 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + + if (!NT_STATUS_IS_OK(status1)) { + printf("Failed to create naked diacritical - %s\n", + nt_errstr(status1)); + return False; + } + + /* try a double diacritical */ + status2 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 2); + + if (!NT_STATUS_IS_OK(status2)) { + printf("Failed to create double naked diacritical - %s\n", + nt_errstr(status2)); + return False; + } + + return True; +} + +/* + see if the server recognises a partial surrogate pair +*/ +static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx) +{ + const uint32 name1[] = {0xd800}; + const uint32 name2[] = {0xdc00}; + const uint32 name3[] = {0xd800, 0xdc00}; + NTSTATUS status; + + printf("Testing partial surrogate\n"); + + status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to create partial surrogate 1 - %s\n", + nt_errstr(status)); + return False; + } + + status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to create partial surrogate 2 - %s\n", + nt_errstr(status)); + return False; + } + + status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 2); + + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to create full surrogate - %s\n", + nt_errstr(status)); + return False; + } + + return True; +} + +/* + see if the server recognises wide-a characters +*/ +static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx) +{ + const uint32 name1[] = {'a'}; + const uint32 name2[] = {0xff41}; + const uint32 name3[] = {0xff21}; + NTSTATUS status; + + printf("Testing wide-a\n"); + + status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to create 'a' - %s\n", + nt_errstr(status)); + return False; + } + + status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to create wide-a - %s\n", + nt_errstr(status)); + return False; + } + + status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 1); + + if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { + printf("Expected %s creating wide-A - %s\n", + nt_errstr(NT_STATUS_OBJECT_NAME_COLLISION), + nt_errstr(status)); + return False; + } + + return True; +} + +BOOL torture_charset(int dummy) +{ + static struct cli_state *cli; + BOOL ret = True; + TALLOC_CTX *mem_ctx; + + mem_ctx = talloc_init("torture_charset"); + + if (!torture_open_connection(&cli)) { + return False; + } + + printf("Starting charset tests\n"); + + if (cli_deltree(cli->tree, BASEDIR) == -1) { + printf("Failed to clean " BASEDIR "\n"); + return False; + } + if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) { + printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree)); + return False; + } + + if (!test_composed(cli, mem_ctx)) { + ret = False; + } + + if (!test_diacritical(cli, mem_ctx)) { + ret = False; + } + + if (!test_surrogate(cli, mem_ctx)) { + ret = False; + } + + if (!test_widea(cli, mem_ctx)) { + ret = False; + } + + return ret; +} -- cgit From f9d8f8843dc0ab8c9d59abde7222e0f118b86b5d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 25 May 2004 16:24:13 +0000 Subject: r884: convert samba4 to use [u]int32_t instead of [u]int32 metze (This used to be commit 0e5517d937a2eb7cf707991d1c7498c1ab456095) --- source4/torture/basic/charset.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 1a708ac055..5febf873bd 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -31,8 +31,8 @@ */ static NTSTATUS unicode_open(struct cli_tree *tree, TALLOC_CTX *mem_ctx, - uint32 open_disposition, - const uint32 *u_name, + uint32_t open_disposition, + const uint32_t *u_name, size_t u_name_len) { union smb_open io; @@ -92,8 +92,8 @@ static NTSTATUS unicode_open(struct cli_tree *tree, */ static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx) { - const uint32 name1[] = {0x61, 0x308}; - const uint32 name2[] = {0xe4}; + const uint32_t name1[] = {0x61, 0x308}; + const uint32_t name2[] = {0xe4}; NTSTATUS status1, status2; printf("Testing composite character (a umlaut)\n"); @@ -121,8 +121,8 @@ static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx) */ static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx) { - const uint32 name1[] = {0x308}; - const uint32 name2[] = {0x308, 0x308}; + const uint32_t name1[] = {0x308}; + const uint32_t name2[] = {0x308, 0x308}; NTSTATUS status1, status2; printf("Testing naked diacritical (umlaut)\n"); @@ -152,9 +152,9 @@ static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx) */ static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx) { - const uint32 name1[] = {0xd800}; - const uint32 name2[] = {0xdc00}; - const uint32 name3[] = {0xd800, 0xdc00}; + const uint32_t name1[] = {0xd800}; + const uint32_t name2[] = {0xdc00}; + const uint32_t name3[] = {0xd800, 0xdc00}; NTSTATUS status; printf("Testing partial surrogate\n"); @@ -191,9 +191,9 @@ static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx) */ static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx) { - const uint32 name1[] = {'a'}; - const uint32 name2[] = {0xff41}; - const uint32 name3[] = {0xff21}; + const uint32_t name1[] = {'a'}; + const uint32_t name2[] = {0xff41}; + const uint32_t name3[] = {0xff21}; NTSTATUS status; printf("Testing wide-a\n"); -- cgit From c5fbb6f23c2d399c7510bc552cdb1a27b1ef66a8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 4 Aug 2004 13:23:35 +0000 Subject: r1654: rename cli_ -> smbcli_ rename CLI_ -> SMBCLI_ metze (This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038) --- source4/torture/basic/charset.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 5febf873bd..d769501326 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -29,7 +29,7 @@ the prefix BASEDIR is added before the name */ -static NTSTATUS unicode_open(struct cli_tree *tree, +static NTSTATUS unicode_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, uint32_t open_disposition, const uint32_t *u_name, @@ -90,7 +90,7 @@ static NTSTATUS unicode_open(struct cli_tree *tree, /* see if the server recognises composed characters */ -static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_composed(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {0x61, 0x308}; const uint32_t name2[] = {0xe4}; @@ -119,7 +119,7 @@ static BOOL test_composed(struct cli_state *cli, TALLOC_CTX *mem_ctx) /* see if the server recognises a naked diacritical */ -static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {0x308}; const uint32_t name2[] = {0x308, 0x308}; @@ -150,7 +150,7 @@ static BOOL test_diacritical(struct cli_state *cli, TALLOC_CTX *mem_ctx) /* see if the server recognises a partial surrogate pair */ -static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {0xd800}; const uint32_t name2[] = {0xdc00}; @@ -189,7 +189,7 @@ static BOOL test_surrogate(struct cli_state *cli, TALLOC_CTX *mem_ctx) /* see if the server recognises wide-a characters */ -static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {'a'}; const uint32_t name2[] = {0xff41}; @@ -228,7 +228,7 @@ static BOOL test_widea(struct cli_state *cli, TALLOC_CTX *mem_ctx) BOOL torture_charset(int dummy) { - static struct cli_state *cli; + static struct smbcli_state *cli; BOOL ret = True; TALLOC_CTX *mem_ctx; @@ -240,12 +240,12 @@ BOOL torture_charset(int dummy) printf("Starting charset tests\n"); - if (cli_deltree(cli->tree, BASEDIR) == -1) { + if (smbcli_deltree(cli->tree, BASEDIR) == -1) { printf("Failed to clean " BASEDIR "\n"); return False; } - if (NT_STATUS_IS_ERR(cli_mkdir(cli->tree, BASEDIR))) { - printf("Failed to create " BASEDIR " - %s\n", cli_errstr(cli->tree)); + if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) { + printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree)); return False; } -- cgit From e89e5eee387b511b89de55048eb34bba326c024d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 23 Aug 2004 07:28:15 +0000 Subject: r1997: fix compiler warning metze (This used to be commit eb9de893b8b93857c648f4df907aac9e9cb199dc) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index d769501326..330dcf1707 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -50,7 +50,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, } SSVAL(ucs_name, i*2, 0); - i = convert_string_allocate(CH_UCS2, CH_UNIX, ucs_name, (1+u_name_len)*2, &fname); + i = convert_string_allocate(CH_UCS2, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { free(ucs_name); return NT_STATUS_NO_MEMORY; -- cgit From 31c1c7846f6b6e5848bc39a28a65118bfa98e35d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 1 Sep 2004 04:39:06 +0000 Subject: r2159: converted samba4 over to UTF-16. I had previously thought this was unnecessary, as windows doesn't use standards compliant UTF-16, and for filesystem operations treats bytes as UCS-2, but Bjoern Jacke has pointed out to me that this means we don't correctly store extended UTF-16 characters as UTF-8 on disk. This can be seen with (for example) the gothic characters with codepoints above 64k. This commit also adds a LOCAL-ICONV torture test that tests the first 1 million codepoints against the system iconv library, and tests 5 million random UTF-16LE buffers for identical error handling to the system iconv library. the lib/iconv.c changes need backporting to samba3 (This used to be commit 756f28ac95feaa84b42402723d5f7286865c78db) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 330dcf1707..879f20617f 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -50,7 +50,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, } SSVAL(ucs_name, i*2, 0); - i = convert_string_allocate(CH_UCS2, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); + i = convert_string_allocate(CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { free(ucs_name); return NT_STATUS_NO_MEMORY; -- cgit From 8ab562dcb2996c3b1c1efbc7e7653dd5bc3a4823 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 22 Sep 2004 22:06:21 +0000 Subject: r2536: This is a classic case for the use of our new talloc code, and convert_string_talloc(). Andrew Bartlett (This used to be commit 79776006b37fa9df0586711edaba5335467461ac) --- source4/torture/basic/charset.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 879f20617f..cb29645de6 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -40,8 +40,9 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, int i; NTSTATUS status; - ucs_name = malloc((1+u_name_len)*2); + ucs_name = talloc(NULL, (1+u_name_len)*2); if (!ucs_name) { + printf("Failed to create UCS2 Name - talloc() failure\n"); return NT_STATUS_NO_MEMORY; } @@ -50,16 +51,16 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, } SSVAL(ucs_name, i*2, 0); - i = convert_string_allocate(CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); + i = convert_string_talloc(ucs_name, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { - free(ucs_name); + printf("Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); + talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; } - asprintf(&fname2, "%s%s", BASEDIR, fname); + fname2 = talloc_asprintf(ucs_name, "%s%s", BASEDIR, fname); if (!fname2) { - free(fname); - free(ucs_name); + talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; } @@ -79,9 +80,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, status = smb_raw_open(tree, mem_ctx, &io); - free(fname); - free(fname2); - free(ucs_name); + talloc_free(ucs_name); return status; } -- cgit From 223e78990a16f134a01d1223a0dad8b2accd5fed Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 25 Sep 2004 11:48:30 +0000 Subject: r2628: got rid of some warnings and converted a few more places to use hierarchical memory allocation (This used to be commit 26da45a8019a2d6c9ff2ac2a6739c7d0b42b00de) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index cb29645de6..d36c9f5b91 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -40,7 +40,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, int i; NTSTATUS status; - ucs_name = talloc(NULL, (1+u_name_len)*2); + ucs_name = talloc(mem_ctx, (1+u_name_len)*2); if (!ucs_name) { printf("Failed to create UCS2 Name - talloc() failure\n"); return NT_STATUS_NO_MEMORY; -- cgit From ba6d5fcb97b9831dddf7dfe09fb02fbb23d864b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Oct 2004 13:40:50 +0000 Subject: r3324: made the smbtorture code completely warning free (This used to be commit 7067bb9b52223cafa28470f264f0b60646a07a01) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index d36c9f5b91..090303ac30 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -225,7 +225,7 @@ static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return True; } -BOOL torture_charset(int dummy) +BOOL torture_charset(void) { static struct smbcli_state *cli; BOOL ret = True; -- cgit From 0e255bb542b1f79c32e9295617199ea8d60753d4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 12 Nov 2004 09:37:59 +0000 Subject: r3699: - split the delayed write testing out of RAW-WRITE, as it is not yet clear what the correct behaviour is for delayed stat info update. - use a common torture_setup_dir() function for setting up a test directory in torture tests. (This used to be commit f7fb34715b7d6ea3c35ddd684cfb27459a420339) --- source4/torture/basic/charset.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 090303ac30..4f57eba64a 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -239,12 +239,7 @@ BOOL torture_charset(void) printf("Starting charset tests\n"); - if (smbcli_deltree(cli->tree, BASEDIR) == -1) { - printf("Failed to clean " BASEDIR "\n"); - return False; - } - if (NT_STATUS_IS_ERR(smbcli_mkdir(cli->tree, BASEDIR))) { - printf("Failed to create " BASEDIR " - %s\n", smbcli_errstr(cli->tree)); + if (!torture_setup_dir(cli, BASEDIR)) { return False; } -- cgit From fdc9f417d89fdf9dd6afbc22843d70585e195c9d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 30 Nov 2004 04:33:27 +0000 Subject: r4011: get rid of rpc_secdes.h and replace it with a single sane set of definitions for security access masks, in security.idl The previous definitions were inconsistently named, and contained many duplicate and misleading entries. I kept finding myself tripping up while using them. (This used to be commit 01c0fa722f80ceeb3f81f01987de95f365a2ed3d) --- source4/torture/basic/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 4f57eba64a..1024c1cd26 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "librpc/gen_ndr/ndr_security.h" #define BASEDIR "\\chartest\\" @@ -67,7 +68,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; io.ntcreatex.in.root_fid = 0; - io.ntcreatex.in.access_mask = GENERIC_RIGHTS_FILE_ALL_ACCESS; + io.ntcreatex.in.access_mask = SEC_RIGHTS_FULL_CONTROL; io.ntcreatex.in.alloc_size = 0; io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE; -- cgit From cc8f4358cca2404895015e2351394f2f4a16e025 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 2 Dec 2004 04:37:36 +0000 Subject: r4035: more effort on consistent naming of the access mask bits. This removes the duplicate named SEC_RIGHTS_MAXIMUM_ALLOWED and SEC_RIGHTS_FULL_CONTROL, which are just other names for SEC_FLAG_MAXIMUM_ALLOWED and SEC_RIGHTS_FILE_ALL. The latter names match the new naming conventions in security.idl Also added names for the generic->specific mappings for files are directories (This used to be commit 17a4e0b3aca227b40957ed1e0c57e498debc6ddf) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 1024c1cd26..5154da8563 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -68,7 +68,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED; io.ntcreatex.in.root_fid = 0; - io.ntcreatex.in.access_mask = SEC_RIGHTS_FULL_CONTROL; + io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL; io.ntcreatex.in.alloc_size = 0; io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_NONE; -- cgit From ddc10d4d37984246a6547e34a32d629c689c40d1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Jan 2005 03:06:58 +0000 Subject: r4549: got rid of a lot more uses of plain talloc(), instead using talloc_size() or talloc_array_p() where appropriate. also fixed a memory leak in pvfs_copy_file() (failed to free a memory context) (This used to be commit 89b74b53546e1570b11b3702f40bee58aed8c503) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 5154da8563..af6020da17 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -41,7 +41,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, int i; NTSTATUS status; - ucs_name = talloc(mem_ctx, (1+u_name_len)*2); + ucs_name = talloc_size(mem_ctx, (1+u_name_len)*2); if (!ucs_name) { printf("Failed to create UCS2 Name - talloc() failure\n"); return NT_STATUS_NO_MEMORY; -- cgit From 2cd5ca7d25f12aa9198bf8c2deb6aea282f573ee Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 28 Dec 2005 15:38:36 +0000 Subject: r12542: Move some more prototypes out to seperate headers (This used to be commit 0aca5fd5130d980d07398f3291d294202aefe3c2) --- source4/torture/basic/charset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index af6020da17..a216ebc05a 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -22,6 +22,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_security.h" +#include "libcli/raw/libcliraw.h" #define BASEDIR "\\chartest\\" -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/torture/basic/charset.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index a216ebc05a..2b49690d51 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -21,7 +21,6 @@ */ #include "includes.h" -#include "librpc/gen_ndr/ndr_security.h" #include "libcli/raw/libcliraw.h" #define BASEDIR "\\chartest\\" -- cgit From 25bb00fbcd409572e1c19c05fdc42c883936780b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 13:41:17 +0000 Subject: r12693: Move core data structures out of smb.h into core.h torture prototypes in seperate header (This used to be commit 73610639b23ca3743077193fa0b1de7c7f65944d) --- source4/torture/basic/charset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 2b49690d51..7becdcd8e5 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "torture/torture.h" #include "libcli/raw/libcliraw.h" #define BASEDIR "\\chartest\\" -- cgit From 78c50015bb8bd5a1d831a6e7ec796b3367c73145 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 15:40:05 +0000 Subject: r12694: Move some headers to the directory of the subsystem they belong to. (This used to be commit c722f665c90103f3ed57621c460e32ad33e7a8a3) --- source4/torture/basic/charset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 7becdcd8e5..186b265e19 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "libcli/raw/libcliraw.h" +#include "libcli/libcli.h" #define BASEDIR "\\chartest\\" -- cgit From d09b70c98b8222eb293bc9d8713ec071188ed01d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 17 Mar 2006 17:59:58 +0000 Subject: r14527: Fix build problems. (This used to be commit 863ca4014d9b821706ee90f58ab5d5cf3899a4c7) --- source4/torture/basic/charset.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 186b265e19..81a9c6bb63 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -24,6 +24,7 @@ #include "torture/torture.h" #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" +#include "torture/util.h" #define BASEDIR "\\chartest\\" -- cgit From 909b111f587705a45f63540b39968f1af58a9b5d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 25 Mar 2006 16:01:28 +0000 Subject: r14720: Add torture_context argument to all torture tests (This used to be commit 3c7a5ce29108dd82210dc3e1f00414f545949e1d) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 81a9c6bb63..016d6a8a5e 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -229,7 +229,7 @@ static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return True; } -BOOL torture_charset(void) +BOOL torture_charset(struct torture_context *torture) { static struct smbcli_state *cli; BOOL ret = True; -- cgit From b7c5bc522b286e8e478b6f74a68bc68829e64c3c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 10 Jul 2006 08:00:06 +0000 Subject: r16907: Add an index parameter to torture_open_connection. Next step is to enable the unclist parameter for all tests that do two connections, to enable cluster testing. Volker (This used to be commit a5d6db09244d444986f8fded3fc6e72c74c8ca1f) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 016d6a8a5e..44875c6b8f 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -237,7 +237,7 @@ BOOL torture_charset(struct torture_context *torture) mem_ctx = talloc_init("torture_charset"); - if (!torture_open_connection(&cli)) { + if (!torture_open_connection(&cli, 0)) { return False; } -- cgit From 4f913d91cb75377555d2858becde0f34ab7f6f49 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 22 Sep 2006 03:50:15 +0000 Subject: r18807: don't overtax the imaginations of servers that can't do mkdir on \\dirname\\ (This used to be commit 6f2b585f8eb0feb79c0a9d11f1cae3b16e8f162f) --- source4/torture/basic/charset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 44875c6b8f..d7e53ae92a 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -26,7 +26,7 @@ #include "libcli/libcli.h" #include "torture/util.h" -#define BASEDIR "\\chartest\\" +#define BASEDIR "\\chartest" /* open a file using a set of unicode code points for the name @@ -62,7 +62,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, return NT_STATUS_NO_MEMORY; } - fname2 = talloc_asprintf(ucs_name, "%s%s", BASEDIR, fname); + fname2 = talloc_asprintf(ucs_name, "%s\\%s", BASEDIR, fname); if (!fname2) { talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; -- cgit From 8773e743c518578584d07d35ffdafdd598af88b0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 16 Oct 2006 13:06:41 +0000 Subject: r19339: Merge my 4.0-unittest branch. This adds an API for more fine-grained output in the testsuite rather than just True or False for a set of tests. The aim is to use this for: * known failure lists (run all tests and detect tests that started working or started failing). This would allow us to get rid of the RPC-SAMBA3-* tests * nicer torture output * simplification of the testsuite system * compatibility with other unit testing systems * easier usage of smbtorture (being able to run one test and automatically set up the environment for that) This is still a work-in-progress; expect more updates over the next couple of days. (This used to be commit 0eb6097305776325c75081356309115f445a7218) --- source4/torture/basic/charset.c | 58 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index d7e53ae92a..d7172e9cec 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -26,14 +26,15 @@ #include "libcli/libcli.h" #include "torture/util.h" -#define BASEDIR "\\chartest" +#define BASEDIR "\\chartest\\" /* open a file using a set of unicode code points for the name the prefix BASEDIR is added before the name */ -static NTSTATUS unicode_open(struct smbcli_tree *tree, +static NTSTATUS unicode_open(struct torture_context *tctx, + struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, uint32_t open_disposition, const uint32_t *u_name, @@ -57,12 +58,12 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, i = convert_string_talloc(ucs_name, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { - printf("Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); + torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; } - fname2 = talloc_asprintf(ucs_name, "%s\\%s", BASEDIR, fname); + fname2 = talloc_asprintf(ucs_name, "%s%s", BASEDIR, fname); if (!fname2) { talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; @@ -93,7 +94,8 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree, /* see if the server recognises composed characters */ -static BOOL test_composed(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_composed(struct torture_context *tctx, + struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {0x61, 0x308}; const uint32_t name2[] = {0xe4}; @@ -101,14 +103,14 @@ static BOOL test_composed(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Testing composite character (a umlaut)\n"); - status1 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 2); + status1 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 2); if (!NT_STATUS_IS_OK(status1)) { printf("Failed to create composed name - %s\n", nt_errstr(status1)); return False; } - status2 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + status2 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); if (!NT_STATUS_IS_OK(status2)) { printf("Failed to create accented character - %s\n", @@ -122,7 +124,8 @@ static BOOL test_composed(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* see if the server recognises a naked diacritical */ -static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_diacritical(struct torture_context *tctx, + struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {0x308}; const uint32_t name2[] = {0x308, 0x308}; @@ -130,7 +133,7 @@ static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Testing naked diacritical (umlaut)\n"); - status1 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + status1 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); if (!NT_STATUS_IS_OK(status1)) { printf("Failed to create naked diacritical - %s\n", @@ -139,7 +142,7 @@ static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } /* try a double diacritical */ - status2 = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 2); + status2 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 2); if (!NT_STATUS_IS_OK(status2)) { printf("Failed to create double naked diacritical - %s\n", @@ -153,7 +156,8 @@ static BOOL test_diacritical(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* see if the server recognises a partial surrogate pair */ -static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_surrogate(struct torture_context *tctx, + struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {0xd800}; const uint32_t name2[] = {0xdc00}; @@ -162,7 +166,7 @@ static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Testing partial surrogate\n"); - status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); if (!NT_STATUS_IS_OK(status)) { printf("Failed to create partial surrogate 1 - %s\n", @@ -170,7 +174,7 @@ static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); if (!NT_STATUS_IS_OK(status)) { printf("Failed to create partial surrogate 2 - %s\n", @@ -178,7 +182,7 @@ static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 2); + status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 2); if (!NT_STATUS_IS_OK(status)) { printf("Failed to create full surrogate - %s\n", @@ -192,7 +196,8 @@ static BOOL test_surrogate(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* see if the server recognises wide-a characters */ -static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static BOOL test_widea(struct torture_context *tctx, + struct smbcli_state *cli, TALLOC_CTX *mem_ctx) { const uint32_t name1[] = {'a'}; const uint32_t name2[] = {0xff41}; @@ -201,7 +206,7 @@ static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Testing wide-a\n"); - status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); if (!NT_STATUS_IS_OK(status)) { printf("Failed to create 'a' - %s\n", @@ -209,7 +214,7 @@ static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); if (!NT_STATUS_IS_OK(status)) { printf("Failed to create wide-a - %s\n", @@ -217,7 +222,7 @@ static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return False; } - status = unicode_open(cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 1); + status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 1); if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { printf("Expected %s creating wide-A - %s\n", @@ -229,37 +234,30 @@ static BOOL test_widea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) return True; } -BOOL torture_charset(struct torture_context *torture) +BOOL torture_charset(struct torture_context *tctx, struct smbcli_state *cli) { - static struct smbcli_state *cli; BOOL ret = True; TALLOC_CTX *mem_ctx; mem_ctx = talloc_init("torture_charset"); - if (!torture_open_connection(&cli, 0)) { - return False; - } - - printf("Starting charset tests\n"); - if (!torture_setup_dir(cli, BASEDIR)) { return False; } - if (!test_composed(cli, mem_ctx)) { + if (!test_composed(tctx, cli, mem_ctx)) { ret = False; } - if (!test_diacritical(cli, mem_ctx)) { + if (!test_diacritical(tctx, cli, mem_ctx)) { ret = False; } - if (!test_surrogate(cli, mem_ctx)) { + if (!test_surrogate(tctx, cli, mem_ctx)) { ret = False; } - if (!test_widea(cli, mem_ctx)) { + if (!test_widea(tctx, cli, mem_ctx)) { ret = False; } -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/basic/charset.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index d7172e9cec..3fa094e05c 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -7,7 +7,7 @@ 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 2 of the License, or + 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, @@ -16,8 +16,7 @@ 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From ac2a7014837b1ce135e732fd7a9b950d9fbc1401 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Sep 2007 02:07:55 +0000 Subject: r24882: Use the torture API in BASE-CHARSET. (This used to be commit 93910d92cd431add876e98a12712253bee8c52e7) --- source4/torture/basic/charset.c | 160 +++++++++++++--------------------------- 1 file changed, 53 insertions(+), 107 deletions(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 3fa094e05c..b1e3b96c2b 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -33,7 +33,7 @@ the prefix BASEDIR is added before the name */ static NTSTATUS unicode_open(struct torture_context *tctx, - struct smbcli_tree *tree, + struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, uint32_t open_disposition, const uint32_t *u_name, @@ -82,7 +82,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, io.ntcreatex.in.fname = fname2; io.ntcreatex.in.open_disposition = open_disposition; - status = smb_raw_open(tree, mem_ctx, &io); + status = smb_raw_open(tree, tctx, &io); talloc_free(ucs_name); @@ -93,172 +93,118 @@ static NTSTATUS unicode_open(struct torture_context *tctx, /* see if the server recognises composed characters */ -static BOOL test_composed(struct torture_context *tctx, - struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_composed(struct torture_context *tctx, + struct smbcli_state *cli) { const uint32_t name1[] = {0x61, 0x308}; const uint32_t name2[] = {0xe4}; NTSTATUS status1, status2; - printf("Testing composite character (a umlaut)\n"); - - status1 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 2); - if (!NT_STATUS_IS_OK(status1)) { - printf("Failed to create composed name - %s\n", - nt_errstr(status1)); - return False; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), + "setting up basedir"); - status2 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + status1 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 2); + torture_assert_ntstatus_ok(tctx, status1, "Failed to create composed name"); - if (!NT_STATUS_IS_OK(status2)) { - printf("Failed to create accented character - %s\n", - nt_errstr(status2)); - return False; - } + status2 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 1); + + torture_assert_ntstatus_ok(tctx, status2, "Failed to create accented character"); - return True; + return true; } /* see if the server recognises a naked diacritical */ -static BOOL test_diacritical(struct torture_context *tctx, - struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_diacritical(struct torture_context *tctx, + struct smbcli_state *cli) { const uint32_t name1[] = {0x308}; const uint32_t name2[] = {0x308, 0x308}; NTSTATUS status1, status2; - printf("Testing naked diacritical (umlaut)\n"); - - status1 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), + "setting up basedir"); - if (!NT_STATUS_IS_OK(status1)) { - printf("Failed to create naked diacritical - %s\n", - nt_errstr(status1)); - return False; - } + status1 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 1); + + torture_assert_ntstatus_ok(tctx, status1, "Failed to create naked diacritical"); /* try a double diacritical */ - status2 = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 2); + status2 = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 2); - if (!NT_STATUS_IS_OK(status2)) { - printf("Failed to create double naked diacritical - %s\n", - nt_errstr(status2)); - return False; - } + torture_assert_ntstatus_ok(tctx, status2, "Failed to create double naked diacritical"); - return True; + return true; } /* see if the server recognises a partial surrogate pair */ -static BOOL test_surrogate(struct torture_context *tctx, - struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_surrogate(struct torture_context *tctx, + struct smbcli_state *cli) { const uint32_t name1[] = {0xd800}; const uint32_t name2[] = {0xdc00}; const uint32_t name3[] = {0xd800, 0xdc00}; NTSTATUS status; - printf("Testing partial surrogate\n"); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), + "setting up basedir"); - status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 1); - if (!NT_STATUS_IS_OK(status)) { - printf("Failed to create partial surrogate 1 - %s\n", - nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, status, "Failed to create partial surrogate 1"); - status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 1); - if (!NT_STATUS_IS_OK(status)) { - printf("Failed to create partial surrogate 2 - %s\n", - nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, status, "Failed to create partial surrogate 2"); - status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 2); + status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name3, 2); - if (!NT_STATUS_IS_OK(status)) { - printf("Failed to create full surrogate - %s\n", - nt_errstr(status)); - return False; - } + torture_assert_ntstatus_ok(tctx, status, "Failed to create full surrogate"); - return True; + return true; } /* see if the server recognises wide-a characters */ -static BOOL test_widea(struct torture_context *tctx, - struct smbcli_state *cli, TALLOC_CTX *mem_ctx) +static bool test_widea(struct torture_context *tctx, + struct smbcli_state *cli) { const uint32_t name1[] = {'a'}; const uint32_t name2[] = {0xff41}; const uint32_t name3[] = {0xff21}; NTSTATUS status; - printf("Testing wide-a\n"); - - status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1); + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), + "setting up basedir"); - if (!NT_STATUS_IS_OK(status)) { - printf("Failed to create 'a' - %s\n", - nt_errstr(status)); - return False; - } + status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name1, 1); - status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1); + torture_assert_ntstatus_ok(tctx, status, "Failed to create 'a'"); - if (!NT_STATUS_IS_OK(status)) { - printf("Failed to create wide-a - %s\n", - nt_errstr(status)); - return False; - } + status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name2, 1); - status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 1); + torture_assert_ntstatus_ok(tctx, status, "Failed to create wide-a"); - if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { - printf("Expected %s creating wide-A - %s\n", - nt_errstr(NT_STATUS_OBJECT_NAME_COLLISION), - nt_errstr(status)); - return False; - } + status = unicode_open(tctx, cli->tree, tctx, NTCREATEX_DISP_CREATE, name3, 1); - return True; + torture_assert_ntstatus_equal(tctx, status, NT_STATUS_OBJECT_NAME_COLLISION, + "Failed to create wide-A"); + + return true; } -BOOL torture_charset(struct torture_context *tctx, struct smbcli_state *cli) +struct torture_suite *torture_charset(TALLOC_CTX *mem_ctx) { - BOOL ret = True; - TALLOC_CTX *mem_ctx; - - mem_ctx = talloc_init("torture_charset"); - - if (!torture_setup_dir(cli, BASEDIR)) { - return False; - } - - if (!test_composed(tctx, cli, mem_ctx)) { - ret = False; - } + struct torture_suite *suite = torture_suite_create(mem_ctx, "CHARSET"); - if (!test_diacritical(tctx, cli, mem_ctx)) { - ret = False; - } - - if (!test_surrogate(tctx, cli, mem_ctx)) { - ret = False; - } - - if (!test_widea(tctx, cli, mem_ctx)) { - ret = False; - } + torture_suite_add_1smb_test(suite, "Testing composite character (a umlaut)", test_composed); + torture_suite_add_1smb_test(suite, "Testing naked diacritical (umlaut)", test_diacritical); + torture_suite_add_1smb_test(suite, "Testing partial surrogate", test_surrogate); + torture_suite_add_1smb_test(suite, "Testing wide-a", test_widea); - return ret; + return suite; } -- cgit From 39ee38d9c1aabf4db065b433d067d0da053d7d61 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 17:52:23 +0100 Subject: r26316: Use contexts for conversion functions. (This used to be commit f6420d933b5b011d428974f3a2a57edf19e6f482) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index b1e3b96c2b..6b993aad8c 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -55,7 +55,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, } SSVAL(ucs_name, i*2, 0); - i = convert_string_talloc(ucs_name, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); + i = convert_string_talloc(ucs_name, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); -- cgit From d891c0c74a03d797aed1c5ac0329fd9d1d78da63 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:09 +0100 Subject: r26429: Avoid use of global_smb_iconv_convenience. (This used to be commit d37136b7abfbba75ef2e5ab855eb3382b9648b8c) --- source4/torture/basic/charset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 6b993aad8c..7dfbdebe7f 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -24,6 +24,7 @@ #include "libcli/raw/libcliraw.h" #include "libcli/libcli.h" #include "torture/util.h" +#include "param/param.h" #define BASEDIR "\\chartest\\" @@ -55,7 +56,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, } SSVAL(ucs_name, i*2, 0); - i = convert_string_talloc(ucs_name, global_smb_iconv_convenience, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); + i = convert_string_talloc(ucs_name, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); -- cgit From 5e00673a4063c9a51580a36ba1f824bd8ea0de66 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:47 +0100 Subject: r26438: Store iconv convenience in tdr push contexts. (This used to be commit dffef3162778aebe2f8d77e2da60b22adb7d60ef) --- source4/torture/basic/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/basic/charset.c') diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index 7dfbdebe7f..a5d534b92b 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -56,7 +56,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, } SSVAL(ucs_name, i*2, 0); - i = convert_string_talloc(ucs_name, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); + i = convert_string_talloc(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname); if (i == -1) { torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); -- cgit