Author: jelmer
Date: 2007-12-13 12:19:33 +0000 (Thu, 13 Dec 2007)
New Revision: 26427

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26427

Log:
Avoid global_smb_iconv_convenience.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/auth/ntlm_check.c
   branches/SAMBA_4_0/source/kdc/kpasswdd.c
   branches/SAMBA_4_0/source/lib/charset/tests/iconv.c
   branches/SAMBA_4_0/source/lib/registry/tests/generic.c
   branches/SAMBA_4_0/source/libnet/libnet_samdump.c
   branches/SAMBA_4_0/source/librpc/ndr/libndr.h
   branches/SAMBA_4_0/source/librpc/ndr/ndr.c
   branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c
   branches/SAMBA_4_0/source/param/util.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/auth/ntlm_check.c
===================================================================
--- branches/SAMBA_4_0/source/auth/ntlm_check.c 2007-12-13 11:41:47 UTC (rev 
26426)
+++ branches/SAMBA_4_0/source/auth/ntlm_check.c 2007-12-13 12:19:33 UTC (rev 
26427)
@@ -320,7 +320,7 @@
                mdfour(client_nt.hash, nt_response->data, nt_response->length);
                
                if (lm_response->length && 
-                   (convert_string_talloc(mem_ctx, 
global_smb_iconv_convenience, CH_DOS, CH_UNIX, 
+                   (convert_string_talloc(mem_ctx, 
lp_iconv_convenience(lp_ctx), CH_DOS, CH_UNIX, 
                                          lm_response->data, 
lm_response->length, 
                                           (void **)&unix_pw) != -1)) {
                        if (E_deshash(unix_pw, client_lm.hash)) {

Modified: branches/SAMBA_4_0/source/kdc/kpasswdd.c
===================================================================
--- branches/SAMBA_4_0/source/kdc/kpasswdd.c    2007-12-13 11:41:47 UTC (rev 
26426)
+++ branches/SAMBA_4_0/source/kdc/kpasswdd.c    2007-12-13 12:19:33 UTC (rev 
26427)
@@ -62,7 +62,7 @@
        
        DEBUG(result_code ? 3 : 10, ("kpasswdd: %s\n", error_string));
 
-       len = push_utf8_talloc(mem_ctx, global_smb_iconv_convenience, 
&error_string_utf8, error_string);
+       len = push_utf8_talloc(mem_ctx, 
lp_iconv_convenience(kdc->task->lp_ctx), &error_string_utf8, error_string);
        if (len == -1) {
                return false;
        }

Modified: branches/SAMBA_4_0/source/lib/charset/tests/iconv.c
===================================================================
--- branches/SAMBA_4_0/source/lib/charset/tests/iconv.c 2007-12-13 11:41:47 UTC 
(rev 26426)
+++ branches/SAMBA_4_0/source/lib/charset/tests/iconv.c 2007-12-13 12:19:33 UTC 
(rev 26427)
@@ -288,7 +288,7 @@
        size_t size, size2;
        codepoint_t c;
 
-       size = push_codepoint(global_smb_iconv_convenience, (char *)buf, 
codepoint);
+       size = push_codepoint(lp_iconv_convenience(tctx->lp_ctx), (char *)buf, 
codepoint);
        torture_assert(tctx, size != -1 || (codepoint >= 0xd800 && codepoint <= 
0x10000), 
                       "Invalid Codepoint range");
 
@@ -299,7 +299,7 @@
        buf[size+2] = random();
        buf[size+3] = random();
 
-       c = next_codepoint(global_smb_iconv_convenience, (char *)buf, &size2);
+       c = next_codepoint(lp_iconv_convenience(tctx->lp_ctx), (char *)buf, 
&size2);
 
        torture_assert(tctx, c == codepoint, 
                       talloc_asprintf(tctx, 

Modified: branches/SAMBA_4_0/source/lib/registry/tests/generic.c
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/tests/generic.c      2007-12-13 
11:41:47 UTC (rev 26426)
+++ branches/SAMBA_4_0/source/lib/registry/tests/generic.c      2007-12-13 
12:19:33 UTC (rev 26427)
@@ -23,6 +23,7 @@
 #include "lib/registry/registry.h"
 #include "torture/torture.h"
 #include "librpc/gen_ndr/winreg.h"
+#include "param/param.h"
 
 struct torture_suite *torture_registry_hive(TALLOC_CTX *mem_ctx);
 struct torture_suite *torture_registry_registry(TALLOC_CTX *mem_ctx);
@@ -52,7 +53,7 @@
 static bool test_reg_val_data_string_sz(struct torture_context *ctx)
 {
        DATA_BLOB db;
-       db.length = convert_string_talloc(ctx, global_smb_iconv_convenience, 
CH_UNIX, CH_UTF16,
+       db.length = convert_string_talloc(ctx, 
lp_iconv_convenience(ctx->lp_ctx), CH_UNIX, CH_UTF16,
                                          "bla", 3, (void **)&db.data);
        torture_assert_str_equal(ctx, "bla",
                                 reg_val_data_string(ctx, REG_SZ, db),
@@ -87,7 +88,7 @@
 static bool test_reg_val_description(struct torture_context *ctx)
 {
        DATA_BLOB data;
-       data.length = convert_string_talloc(ctx, global_smb_iconv_convenience, 
CH_UNIX, CH_UTF16,
+       data.length = convert_string_talloc(ctx, 
lp_iconv_convenience(ctx->lp_ctx), CH_UNIX, CH_UTF16,
                                            "stationary traveller",
                                            strlen("stationary traveller"),
                                            (void **)&data.data);
@@ -101,7 +102,7 @@
 static bool test_reg_val_description_nullname(struct torture_context *ctx)
 {
        DATA_BLOB data;
-       data.length = convert_string_talloc(ctx, global_smb_iconv_convenience, 
CH_UNIX, CH_UTF16,
+       data.length = convert_string_talloc(ctx, 
lp_iconv_convenience(ctx->lp_ctx), CH_UNIX, CH_UTF16,
                                            "west berlin",
                                            strlen("west berlin"),
                                            (void **)&data.data);

Modified: branches/SAMBA_4_0/source/libnet/libnet_samdump.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet_samdump.c   2007-12-13 11:41:47 UTC 
(rev 26426)
+++ branches/SAMBA_4_0/source/libnet/libnet_samdump.c   2007-12-13 12:19:33 UTC 
(rev 26427)
@@ -185,7 +185,7 @@
                        if (strcasecmp_m(s->name, secret_name) != 0) {
                                continue;
                        }
-                       if (convert_string_talloc(mem_ctx, 
global_smb_iconv_convenience, CH_UTF16, CH_UNIX, 
+                       if (convert_string_talloc(mem_ctx, 
lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, 
                                                  s->secret.data, 
s->secret.length, 
                                                  (void **)&secret_string) == 
-1) {
                                r->out.error_string = talloc_asprintf(mem_ctx, 

Modified: branches/SAMBA_4_0/source/librpc/ndr/libndr.h
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/libndr.h       2007-12-13 11:41:47 UTC 
(rev 26426)
+++ branches/SAMBA_4_0/source/librpc/ndr/libndr.h       2007-12-13 12:19:33 UTC 
(rev 26427)
@@ -52,6 +52,8 @@
        uint32_t data_size;
        uint32_t offset;
 
+       struct smb_iconv_convenience *iconv_convenience;
+
        uint32_t relative_base_offset;
        struct ndr_token_list *relative_base_list;
 
@@ -84,6 +86,8 @@
 
        /* this is used to ensure we generate unique reference IDs */
        uint32_t ptr_count;
+
+       struct smb_iconv_convenience *iconv_convenience;
 };
 
 /* structure passed to functions that print IDL structures */

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr.c  2007-12-13 11:41:47 UTC (rev 
26426)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr.c  2007-12-13 12:19:33 UTC (rev 
26427)
@@ -66,6 +66,7 @@
 
        ndr->data = blob->data;
        ndr->data_size = blob->length;
+       ndr->iconv_convenience = talloc_reference(ndr, 
global_smb_iconv_convenience);
 
        return ndr;
 }
@@ -114,6 +115,7 @@
        if (!ndr->data) {
                return NULL;
        }
+       ndr->iconv_convenience = talloc_reference(ndr, 
global_smb_iconv_convenience);
 
        return ndr;
 }
@@ -438,6 +440,7 @@
        subndr->data = ndr->data + ndr->offset;
        subndr->offset = 0;
        subndr->data_size = r_content_size;
+       subndr->iconv_convenience = talloc_reference(subndr, 
ndr->iconv_convenience);
 
        *_subndr = subndr;
        return NDR_ERR_SUCCESS;

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c   2007-12-13 11:41:47 UTC 
(rev 26426)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_string.c   2007-12-13 12:19:33 UTC 
(rev 26427)
@@ -82,7 +82,7 @@
                        as = talloc_strdup(ndr->current_mem_ctx, "");
                } else {
                        ret = convert_string_talloc(ndr->current_mem_ctx,
-                                                   
global_smb_iconv_convenience, chset, CH_UNIX, 
+                                                   ndr->iconv_convenience, 
chset, CH_UNIX, 
                                                    ndr->data+ndr->offset, 
                                                    (len2 + 
c_len_term)*byte_mul,
                                                    (void **)&as);
@@ -119,7 +119,7 @@
                        as = talloc_strdup(ndr->current_mem_ctx, "");
                } else {
                        ret = convert_string_talloc(ndr->current_mem_ctx,
-                                                   
global_smb_iconv_convenience, 
+                                                   ndr->iconv_convenience, 
                                                    chset, CH_UNIX, 
                                                    ndr->data+ndr->offset, 
                                                    (len1 + 
c_len_term)*byte_mul,
@@ -158,7 +158,7 @@
                        as = talloc_strdup(ndr->current_mem_ctx, "");
                } else {
                        ret = convert_string_talloc(ndr->current_mem_ctx,
-                                                   
global_smb_iconv_convenience, 
+                                                   ndr->iconv_convenience, 
                                                    chset, CH_UNIX, 
                                                    ndr->data+ndr->offset, 
                                                    (len1 + 
c_len_term)*byte_mul,
@@ -193,7 +193,7 @@
                        as = talloc_strdup(ndr->current_mem_ctx, "");
                } else {
                        ret = convert_string_talloc(ndr->current_mem_ctx,
-                                                   
global_smb_iconv_convenience,
+                                                   ndr->iconv_convenience,
                                                    chset, CH_UNIX, 
                                                    ndr->data+ndr->offset, 
                                                    (len3 + 
c_len_term)*byte_mul,
@@ -226,7 +226,7 @@
                        as = talloc_strdup(ndr->current_mem_ctx, "");
                } else {
                        ret = convert_string_talloc(ndr->current_mem_ctx,
-                                                   
global_smb_iconv_convenience, 
+                                                   ndr->iconv_convenience, 
                                                    chset, CH_UNIX, 
                                                    ndr->data+ndr->offset, 
                                                    len3,
@@ -247,7 +247,7 @@
                        len1 = utf16_len_n(ndr->data+ndr->offset, 
ndr->data_size - ndr->offset);
                }
                ret = convert_string_talloc(ndr->current_mem_ctx,
-                                           global_smb_iconv_convenience, 
chset, CH_UNIX, 
+                                           ndr->iconv_convenience, chset, 
CH_UNIX, 
                                            ndr->data+ndr->offset, 
                                            len1,
                                            (void **)&as);
@@ -264,7 +264,7 @@
                len1 = (flags & LIBNDR_FLAG_STR_FIXLEN32)?32:15;
                NDR_PULL_NEED_BYTES(ndr, len1*byte_mul);
                ret = convert_string_talloc(ndr->current_mem_ctx,
-                                           global_smb_iconv_convenience,
+                                           ndr->iconv_convenience,
                                            chset, CH_UNIX, 
                                            ndr->data+ndr->offset, 
                                            len1*byte_mul,
@@ -290,7 +290,7 @@
                        as = talloc_strdup(ndr->current_mem_ctx, "");
                } else {
                        ret = convert_string_talloc(ndr->current_mem_ctx,
-                                                   
global_smb_iconv_convenience,
+                                                   ndr->iconv_convenience,
                                                    chset, CH_UNIX, 
                                                    ndr->data+ndr->offset, 
                                                    len1,
@@ -355,7 +355,7 @@
               LIBNDR_FLAG_STR_FIXLEN32))) {
                s_len++;
        }
-       d_len = convert_string_talloc(ndr, global_smb_iconv_convenience, 
CH_UNIX, chset, s, s_len, (void **)&dest);
+       d_len = convert_string_talloc(ndr, ndr->iconv_convenience, CH_UNIX, 
chset, s, s_len, (void **)&dest);
        if (d_len == -1) {
                return ndr_push_error(ndr, NDR_ERR_CHARCNV, 
                                      "Bad character conversion");
@@ -689,7 +689,8 @@
 
        NDR_PULL_NEED_BYTES(ndr, length*byte_mul);
 
-       ret = convert_string_talloc(ndr->current_mem_ctx, 
global_smb_iconv_convenience,
+       ret = convert_string_talloc(ndr->current_mem_ctx, 
+                                   ndr->iconv_convenience,
                                    chset, CH_UNIX, 
                                    ndr->data+ndr->offset, 
                                    length*byte_mul,
@@ -714,7 +715,7 @@
        required = byte_mul * length;
        
        NDR_PUSH_NEED_BYTES(ndr, required);
-       ret = convert_string(global_smb_iconv_convenience, CH_UNIX, chset, 
+       ret = convert_string(ndr->iconv_convenience, CH_UNIX, chset, 
                             var, strlen(var),
                             ndr->data+ndr->offset, required);
        if (ret == -1) {

Modified: branches/SAMBA_4_0/source/param/util.c
===================================================================
--- branches/SAMBA_4_0/source/param/util.c      2007-12-13 11:41:47 UTC (rev 
26426)
+++ branches/SAMBA_4_0/source/param/util.c      2007-12-13 12:19:33 UTC (rev 
26427)
@@ -285,6 +285,11 @@
 
 struct smb_iconv_convenience *global_smb_iconv_convenience = NULL;
 
+struct smb_iconv_convenience *lp_iconv_convenience(struct loadparm_context 
*lp_ctx)
+{
+       return global_smb_iconv_convenience;
+}
+
 struct smb_iconv_convenience *smb_iconv_convenience_init_lp(TALLOC_CTX 
*mem_ctx,
                                                         struct 
loadparm_context *lp_ctx)
 {

Reply via email to