r1740: fixed the torture suite for ASCII-only servers
authorAndrew Tridgell <tridge@samba.org>
Wed, 11 Aug 2004 21:11:37 +0000 (21:11 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:57:52 +0000 (12:57 -0500)
(This used to be commit c3bce90be745db3e7cbf8273c1c8496920332f5e)

source4/torture/raw/notify.c
source4/torture/raw/qfileinfo.c
source4/torture/raw/qfsinfo.c
source4/torture/raw/search.c
source4/torture/torture_util.c

index 6e7cf218ea8c153cdda247aa4366ad9b479837c7..aec92bf641d58976f84c2c86e20ec18fad08bbed 100644 (file)
@@ -40,7 +40,7 @@
        }} while (0)
 
 #define CHECK_WSTR(field, value, flags) do { \
-       if (!field.s || strcmp(field.s, value) || wire_bad_flags(&field, flags)) { \
+       if (!field.s || strcmp(field.s, value) || wire_bad_flags(&field, flags, cli)) { \
                printf("(%d) %s [%s] != %s\n",  __LINE__, #field, field.s, value); \
                        ret = False; \
                goto done; \
index 251a2de85d208ec5322a48dbd7f6280139caf813..951769d4da4a761b105cf8fd599be6201f41f6e9 100644 (file)
@@ -503,14 +503,14 @@ BOOL torture_raw_qfileinfo(int dummy)
 #define NAME_CHECK(sname, stype, tfield, flags) do { \
        s1 = fnum_find(sname); \
        if (s1 && (strcmp(s1->stype.out.tfield.s, correct_name) != 0 || \
-                       wire_bad_flags(&s1->stype.out.tfield, flags))) { \
+                       wire_bad_flags(&s1->stype.out.tfield, flags, cli))) { \
                printf("(%d) handle %s/%s incorrect - '%s/%d'\n", __LINE__, #stype, #tfield,  \
                       s1->stype.out.tfield.s, s1->stype.out.tfield.private_length); \
                ret = False; \
        } \
        s1 = fname_find(sname); \
        if (s1 && (strcmp(s1->stype.out.tfield.s, correct_name) != 0 || \
-                       wire_bad_flags(&s1->stype.out.tfield, flags))) { \
+                       wire_bad_flags(&s1->stype.out.tfield, flags, cli))) { \
                printf("(%d) path %s/%s incorrect - '%s/%d'\n", __LINE__, #stype, #tfield,  \
                       s1->stype.out.tfield.s, s1->stype.out.tfield.private_length); \
                ret = False; \
@@ -538,7 +538,7 @@ BOOL torture_raw_qfileinfo(int dummy)
                                ret = False;
                        }
                }
-               if (wire_bad_flags(&s1->all_info.out.fname, STR_UNICODE)) {
+               if (wire_bad_flags(&s1->all_info.out.fname, STR_UNICODE, cli)) {
                        printf("Should not null terminate all_info/fname\n");
                        ret = False;
                }
index 41bc09f94e8cd95bb63276ec90c2cc275d3c5ede..10b9605147e32bfd5680f0789e870cf0c75f3943 100644 (file)
@@ -275,7 +275,7 @@ BOOL torture_raw_qfsinfo(int dummy)
 #define STR_CHECK(sname, stype, field, flags) do { \
        s1 = find(sname); \
        if (s1) { \
-               if (wire_bad_flags(&s1->stype.out.field, flags)) { \
+               if (wire_bad_flags(&s1->stype.out.field, flags, cli)) { \
                        printf("(%d) incorrect string termination in %s/%s\n", \
                               __LINE__, #stype, #field); \
                        ret = False; \
index 55dd732e6aaee6a83d5c019d68437b230bdb7e92..f91c8083a517d626eb4f758fd87ecbf636845ee0 100644 (file)
@@ -235,7 +235,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        if (s) { \
                if (!s->sname1.field1.s || \
                    strcmp(s->sname1.field1.s, v.sname2.out.field2.s) || \
-                   wire_bad_flags(&s->sname1.field1, flags)) { \
+                   wire_bad_flags(&s->sname1.field1, flags, cli)) { \
                        printf("(%d) %s/%s [%s] != %s/%s [%s]\n", \
                               __LINE__, \
                                #sname1, #field1, s->sname1.field1.s, \
@@ -249,7 +249,7 @@ static BOOL test_one_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        if (s) { \
                if (!s->sname1.field1.s || \
                    strcmp(s->sname1.field1.s, fname) || \
-                   wire_bad_flags(&s->sname1.field1, flags)) { \
+                   wire_bad_flags(&s->sname1.field1, flags, cli)) { \
                        printf("(%d) %s/%s [%s] != %s\n", \
                               __LINE__, \
                                #sname1, #field1, s->sname1.field1.s, \
index bb7f6eb4c28e7effb05d646f02ce2cb7db5b1e34..c39aa0ad5e0c8c8eec9f627486041ea7fde9742c 100644 (file)
@@ -193,13 +193,20 @@ void *shm_setup(int size)
   check that a wire string matches the flags specified 
   not 100% accurate, but close enough for testing
 */
-BOOL wire_bad_flags(WIRE_STRING *str, int flags)
+BOOL wire_bad_flags(WIRE_STRING *str, int flags, struct smbcli_state *cli)
 {
+       BOOL server_unicode;
        int len;
        if (!str || !str->s) return True;
        len = strlen(str->s);
        if (flags & STR_TERMINATE) len++;
-       if ((flags & STR_UNICODE) || !getenv("CLI_FORCE_ASCII")) {
+
+       server_unicode = (cli->transport->negotiate.capabilities&CAP_UNICODE)?True:False;
+       if (getenv("CLI_FORCE_ASCII") || !lp_unicode()) {
+               server_unicode = False;
+       }
+
+       if ((flags & STR_UNICODE) || server_unicode) {
                len *= 2;
        } else if (flags & STR_TERMINATE_ASCII) {
                len++;