[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-1107-g16f36ce

Jelmer Vernooij jelmer at samba.org
Thu Feb 28 19:07:23 GMT 2008


The branch, v4-0-test has been updated
       via  16f36ce499e93860dd535034a584ec2b93e7a172 (commit)
       via  6cbb241c05539cc62526a366094c9c472e6422a5 (commit)
       via  fe1d3e69990a71d7639ac8718f6ca51de4d7e6d2 (commit)
       via  239bdf5e81f4ede4cd70bd9907e785d60a755e98 (commit)
       via  990135517618afcef873f0cd0e6f8c3098247b50 (commit)
       via  84b677285250d9b9a1120fcfd6e4bbbb8f939fe8 (commit)
       via  f920e78ea7bb8aa575e6a2ebb5cc53462fbe2fe9 (commit)
       via  11289759cae6a8062ea3556dbcbddfd44a3c0331 (commit)
       via  d96fcc52a70fd1236b767b1d88a39d78c4e8c48c (commit)
       via  a16c9a2129ce92e7e1a613b2badd168e42ead436 (commit)
       via  ccb29c0b463f5ccb53553f0a1c411ad77a84482a (commit)
       via  184988866fe8e740f58e3683eefcaa70f8b51d11 (commit)
       via  f4b31ad76771d674ec85cd155b023eed377e6eb4 (commit)
       via  5de88728ac5c567d3711d1ac6862bbdaced84b75 (commit)
       via  a1280252ce924df69d911e597b7f65d8038abef9 (commit)
       via  e01c1e87c0fe9709df7eb5b863f7ce85564174cd (commit)
       via  efd577cb5035f1b83bb8cd8958dcecb0ac0d055b (commit)
       via  639afe3a21ee71f6786fc559b99d9e21a9839ce2 (commit)
       via  b84f19f6783cbeaa8d04848fdc0b6f21b5e379a3 (commit)
       via  4d6fd9381f7fe4c823b47ebc43d7b272a92edffd (commit)
       via  705d5c3282399a2c531aefecff6ca1df405476b6 (commit)
      from  608e5cd881d64b8db9146dfc4b3a1778a93a0f8e (commit)

http://gitweb.samba.org/?samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 16f36ce499e93860dd535034a584ec2b93e7a172
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 28 20:04:58 2008 +0100

    Remove sDefault as static variable.

commit 6cbb241c05539cc62526a366094c9c472e6422a5
Merge: fe1d3e69990a71d7639ac8718f6ca51de4d7e6d2 11289759cae6a8062ea3556dbcbddfd44a3c0331
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 28 18:27:29 2008 +0100

    Merge branch 'v4-0-trivial' into v4-0-test

commit fe1d3e69990a71d7639ac8718f6ca51de4d7e6d2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:41:38 2008 +0100

    Cache iconv_convenience.

commit 239bdf5e81f4ede4cd70bd9907e785d60a755e98
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:23:52 2008 +0100

    torture/t_strcmp.c: Remove obsolete file - proper testing is now done in the libutil testsuite.

commit 990135517618afcef873f0cd0e6f8c3098247b50
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:21:32 2008 +0100

    More share_init to more apprioriate place.

commit 84b677285250d9b9a1120fcfd6e4bbbb8f939fe8
Merge: f920e78ea7bb8aa575e6a2ebb5cc53462fbe2fe9 608e5cd881d64b8db9146dfc4b3a1778a93a0f8e
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 28 14:11:45 2008 +0100

    Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test

commit f920e78ea7bb8aa575e6a2ebb5cc53462fbe2fe9
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:18:23 2008 +0100

    Remove more global_loadparm uses.

commit 11289759cae6a8062ea3556dbcbddfd44a3c0331
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Feb 27 17:36:49 2008 +0100

    Set lp_ctx properly.

commit d96fcc52a70fd1236b767b1d88a39d78c4e8c48c
Merge: a16c9a2129ce92e7e1a613b2badd168e42ead436 d2eb404ba1711abf6bb2718f8bb1dbbd104e7d4d
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Feb 27 16:03:00 2008 +0100

    Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-trivial

commit a16c9a2129ce92e7e1a613b2badd168e42ead436
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 25 12:51:55 2008 +0100

    Remove uses of global_loadparm.

commit ccb29c0b463f5ccb53553f0a1c411ad77a84482a
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 18:43:02 2008 +0100

    Remove another global_loadparm instance.

commit 184988866fe8e740f58e3683eefcaa70f8b51d11
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 18:21:44 2008 +0100

    Introduce mprLpCtx() similar to mprMemCtx() for loadparm_context used by
    all EJS code.

commit f4b31ad76771d674ec85cd155b023eed377e6eb4
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 18:11:44 2008 +0100

    Fix the build.

commit 5de88728ac5c567d3711d1ac6862bbdaced84b75
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 18:09:47 2008 +0100

    Remove yet more global_loadparm instances.

commit a1280252ce924df69d911e597b7f65d8038abef9
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 17:54:24 2008 +0100

    Remove more global_loadparm instance.s

commit e01c1e87c0fe9709df7eb5b863f7ce85564174cd
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 17:17:37 2008 +0100

    Remove yet more uses of global_loadparm.

commit efd577cb5035f1b83bb8cd8958dcecb0ac0d055b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:41:38 2008 +0100

    Cache iconv_convenience.

commit 639afe3a21ee71f6786fc559b99d9e21a9839ce2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:23:52 2008 +0100

    torture/t_strcmp.c: Remove obsolete file - proper testing is now done in the libutil testsuite.

commit b84f19f6783cbeaa8d04848fdc0b6f21b5e379a3
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:21:32 2008 +0100

    More share_init to more apprioriate place.

commit 4d6fd9381f7fe4c823b47ebc43d7b272a92edffd
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:18:23 2008 +0100

    Remove more global_loadparm uses.

commit 705d5c3282399a2c531aefecff6ca1df405476b6
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Feb 21 16:18:01 2008 +0100

    Clarify comments.

-----------------------------------------------------------------------

Summary of changes:
 source/cldap_server/cldap_server.c      |    2 +-
 source/kdc/hdb-ldb.c                    |    4 +-
 source/kdc/kdc.c                        |    5 +-
 source/kdc/kdc.h                        |    1 +
 source/lib/appweb/mpr/miniMpr.c         |    7 ++
 source/lib/appweb/mpr/miniMpr.h         |    2 +
 source/lib/charset/util_unistr.c        |   34 +++++---
 source/lib/registry/hive.c              |    3 +-
 source/lib/registry/hive.h              |    3 +-
 source/lib/registry/ldb.c               |   14 ++-
 source/lib/registry/patchfile.c         |    9 ++-
 source/lib/registry/patchfile.h         |    1 +
 source/lib/registry/patchfile_dotreg.c  |    3 +-
 source/lib/registry/patchfile_preg.c    |   17 ++--
 source/lib/registry/regf.c              |   10 ++-
 source/lib/registry/tests/hive.c        |    4 +-
 source/lib/registry/tools/regdiff.c     |    2 +-
 source/libcli/cldap/cldap.c             |    8 +-
 source/libcli/cldap/cldap.h             |    4 +-
 source/libcli/dgram/dgramsocket.c       |    5 +-
 source/libcli/dgram/libdgram.h          |    3 +-
 source/libcli/finddcs.c                 |    4 +-
 source/libcli/nbt/libnbt.h              |    1 +
 source/libcli/nbt/nbtsocket.c           |   10 ++-
 source/libcli/raw/clisession.c          |    4 +
 source/libcli/raw/clisocket.c           |    4 +-
 source/libcli/raw/libcliraw.h           |    6 ++
 source/libcli/resolve/bcast.c           |   10 ++-
 source/libcli/resolve/nbtlist.c         |    8 ++-
 source/libcli/resolve/wins.c            |   10 ++-
 source/libcli/smb_composite/sesssetup.c |   12 ++--
 source/libcli/swig/libcli_nbt.i         |    3 +-
 source/libcli/swig/libcli_nbt_wrap.c    |   34 ++++++--
 source/libcli/wrepl/winsrepl.c          |   23 ++++--
 source/libcli/wrepl/winsrepl.h          |    2 +
 source/libnet/libnet_become_dc.c        |    3 +-
 source/libnet/libnet_site.c             |    2 +-
 source/libnet/libnet_unbecome_dc.c      |    3 +-
 source/librpc/rpc/dcerpc.c              |    8 +-
 source/librpc/rpc/dcerpc_util.c         |    3 +-
 source/nbt_server/dgram/request.c       |    7 +-
 source/nbt_server/interfaces.c          |    5 +-
 source/ntvfs/common/notify.c            |   10 ++-
 source/ntvfs/posix/pvfs_rename.c        |    4 +-
 source/ntvfs/posix/pvfs_resolve.c       |    7 +-
 source/ntvfs/posix/pvfs_xattr.c         |    2 +-
 source/ntvfs/sysdep/inotify.c           |    9 +-
 source/param/generic.c                  |    7 +-
 source/param/loadparm.c                 |  128 ++++++++++++++-----------------
 source/param/loadparm.h                 |    3 +
 source/param/param.h                    |    1 -
 source/param/param.i                    |    7 +-
 source/param/param.py                   |    1 +
 source/param/param_wrap.c               |  111 +++++++++++++++++++++------
 source/param/share_classic.c            |   48 ++++++------
 source/param/tests/loadparm.c           |    4 +-
 source/rpc_server/dcerpc_server.c       |   10 +--
 source/rpc_server/dcesrv_auth.c         |    2 +-
 source/script/mkproto.pl                |    2 +-
 source/scripting/ejs/ejsnet/net_ctx.c   |    4 +-
 source/scripting/ejs/smbcalls.c         |    4 +-
 source/scripting/ejs/smbcalls_auth.c    |   12 ++--
 source/scripting/ejs/smbcalls_cli.c     |   10 +-
 source/scripting/ejs/smbcalls_config.c  |   22 +++---
 source/scripting/ejs/smbcalls_creds.c   |    4 +-
 source/scripting/ejs/smbcalls_data.c    |    4 +-
 source/scripting/ejs/smbcalls_ldb.c     |    2 +-
 source/scripting/ejs/smbcalls_nbt.c     |    2 +-
 source/scripting/ejs/smbcalls_reg.c     |    2 +-
 source/scripting/ejs/smbcalls_rpc.c     |    6 +-
 source/scripting/ejs/smbcalls_sys.c     |    2 +-
 source/scripting/python/config.mk       |    2 +-
 source/smb_server/smb/request.c         |    2 +-
 source/smb_server/smb_server.c          |    3 +-
 source/smbd/server.c                    |    2 -
 source/smbd/service_stream.c            |    2 +-
 source/torture/ldap/cldap.c             |    4 +-
 source/torture/ldap/cldapbench.c        |    2 +-
 source/torture/nbt/dgram.c              |    9 ++-
 source/torture/nbt/query.c              |    3 +-
 source/torture/nbt/register.c           |    6 +-
 source/torture/nbt/wins.c               |    2 +-
 source/torture/nbt/winsbench.c          |    2 +-
 source/torture/nbt/winsreplication.c    |   32 ++++----
 source/torture/rpc/dssync.c             |    2 +-
 source/torture/t_strcmp.c               |   20 -----
 source/utils/nmblookup.c                |    2 +-
 source/utils/testparm.c                 |   10 +-
 source/winbind/wb_pam_auth.c            |    2 +-
 source/wrepl_server/wrepl_out_helpers.c |    5 +-
 90 files changed, 493 insertions(+), 352 deletions(-)
 delete mode 100644 source/torture/t_strcmp.c


Changeset truncated at 500 lines:

diff --git a/source/cldap_server/cldap_server.c b/source/cldap_server/cldap_server.c
index 7858ee2..783e31d 100644
--- a/source/cldap_server/cldap_server.c
+++ b/source/cldap_server/cldap_server.c
@@ -92,7 +92,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_
 	NTSTATUS status;
 
 	/* listen for unicasts on the CLDAP port (389) */
-	cldapsock = cldap_socket_init(cldapd, cldapd->task->event_ctx);
+	cldapsock = cldap_socket_init(cldapd, cldapd->task->event_ctx, lp_iconv_convenience(cldapd->task->lp_ctx));
 	NT_STATUS_HAVE_NO_MEMORY(cldapsock);
 
 	socket_address = socket_address_from_strings(cldapsock, cldapsock->sock->backend_name, 
diff --git a/source/kdc/hdb-ldb.c b/source/kdc/hdb-ldb.c
index ff226e5..9a17e58 100644
--- a/source/kdc/hdb-ldb.c
+++ b/source/kdc/hdb-ldb.c
@@ -1168,8 +1168,8 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
 krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char *arg)
 {
 	NTSTATUS nt_status;
-	/* The global kdc_mem_ctx, Disgusting, ugly hack, but it means one less private hook */
-	nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, global_loadparm, 
+	/* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */
+	nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx, 
 				       context, db, arg);
 
 	if (NT_STATUS_IS_OK(nt_status)) {
diff --git a/source/kdc/kdc.c b/source/kdc/kdc.c
index 52ee475..92a5dc2 100644
--- a/source/kdc/kdc.c
+++ b/source/kdc/kdc.c
@@ -41,8 +41,10 @@
 #include "param/param.h"
 
 
-/* Disgusting hack to get a mem_ctx into the hdb plugin, when used as a keytab */
+/* Disgusting hack to get a mem_ctx and lp_ctx into the hdb plugin, when 
+ * used as a keytab */
 TALLOC_CTX *kdc_mem_ctx;
+struct loadparm_context *kdc_lp_ctx;
 
 /* hold all the info needed to send a reply */
 struct kdc_reply {
@@ -648,6 +650,7 @@ static void kdc_task_init(struct task_server *task)
 	krb5_kdc_windc_init(kdc->smb_krb5_context->krb5_context);
 
 	kdc_mem_ctx = kdc->smb_krb5_context;
+	kdc_lp_ctx = task->lp_ctx;
 
 	/* start listening on the configured network interfaces */
 	status = kdc_startup_interfaces(kdc, task->lp_ctx, ifaces);
diff --git a/source/kdc/kdc.h b/source/kdc/kdc.h
index 3a1f9bd..9be1511 100644
--- a/source/kdc/kdc.h
+++ b/source/kdc/kdc.h
@@ -30,6 +30,7 @@ struct kdc_server;
 struct socket_address;
 
 extern TALLOC_CTX *kdc_mem_ctx;
+extern struct loadparm_context *kdc_lp_ctx;
 
 bool kpasswdd_process(struct kdc_server *kdc,
 		      TALLOC_CTX *mem_ctx, 
diff --git a/source/lib/appweb/mpr/miniMpr.c b/source/lib/appweb/mpr/miniMpr.c
index 949d64f..52b2360 100644
--- a/source/lib/appweb/mpr/miniMpr.c
+++ b/source/lib/appweb/mpr/miniMpr.c
@@ -30,6 +30,7 @@
  */
 
 #include	"miniMpr.h"
+#include "param/param.h"
 
 /************************************ Code ************************************/
 #if !BLD_APPWEB
@@ -49,6 +50,12 @@ void *mprMemCtx(void)
 	return mpr_ctx;
 }
 
+/* return the loadparm context being used for all ejs variables */
+struct loadparm_context *mprLpCtx(void)
+{
+	return global_loadparm;
+}
+
 void mprFree(void *ptr)
 {
 	talloc_free(ptr);
diff --git a/source/lib/appweb/mpr/miniMpr.h b/source/lib/appweb/mpr/miniMpr.h
index 836fdab..15ce30c 100644
--- a/source/lib/appweb/mpr/miniMpr.h
+++ b/source/lib/appweb/mpr/miniMpr.h
@@ -272,6 +272,8 @@ extern int 		mprMemcpy(char *dest, int destMax, const char *src, int nbytes);
 
 extern void mprSetCtx(void *ctx);
 extern void *mprMemCtx(void);
+struct loadparm_context;
+extern struct loadparm_context *mprLpCtx(void);
 
 /* This function needs to be provided by anyone using ejs */
 void ejs_exception(const char *reason);
diff --git a/source/lib/charset/util_unistr.c b/source/lib/charset/util_unistr.c
index e0e1aed..9b87f49 100644
--- a/source/lib/charset/util_unistr.c
+++ b/source/lib/charset/util_unistr.c
@@ -123,6 +123,7 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
 {
 	codepoint_t c1=0, c2=0;
 	size_t size1, size2;
+	struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
 
 	/* handle null ptr comparisons to simplify the use in qsort */
 	if (s1 == s2) return 0;
@@ -130,8 +131,8 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2)
 	if (s2 == NULL) return 1;
 
 	while (*s1 && *s2) {
-		c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
-		c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
+		c1 = next_codepoint(iconv_convenience, s1, &size1);
+		c2 = next_codepoint(iconv_convenience, s2, &size2);
 
 		s1 += size1;
 		s2 += size2;
@@ -207,6 +208,7 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n)
 {
 	codepoint_t c1=0, c2=0;
 	size_t size1, size2;
+	struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
 
 	/* handle null ptr comparisons to simplify the use in qsort */
 	if (s1 == s2) return 0;
@@ -216,8 +218,8 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n)
 	while (*s1 && *s2 && n) {
 		n--;
 
-		c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1);
-		c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2);
+		c1 = next_codepoint(iconv_convenience, s1, &size1);
+		c2 = next_codepoint(iconv_convenience, s2, &size2);
 
 		s1 += size1;
 		s2 += size2;
@@ -480,6 +482,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
 {
 	size_t size=0;
 	char *dest;
+	struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
 
 	/* this takes advantage of the fact that upper/lower can't
 	   change the length of a character by more than 1 byte */
@@ -490,12 +493,12 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
 
 	while (*src) {
 		size_t c_size;
-		codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
+		codepoint_t c = next_codepoint(iconv_convenience, src, &c_size);
 		src += c_size;
 
 		c = tolower_w(c);
 
-		c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
+		c_size = push_codepoint(iconv_convenience, dest+size, c);
 		if (c_size == -1) {
 			talloc_free(dest);
 			return NULL;
@@ -520,6 +523,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
 {
 	size_t size=0;
 	char *dest;
+	struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
 	
 	if (!src) {
 		return NULL;
@@ -534,12 +538,12 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
 
 	while (*src) {
 		size_t c_size;
-		codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size);
+		codepoint_t c = next_codepoint(iconv_convenience, src, &c_size);
 		src += c_size;
 
 		c = toupper_w(c);
 
-		c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c);
+		c_size = push_codepoint(iconv_convenience, dest+size, c);
 		if (c_size == -1) {
 			talloc_free(dest);
 			return NULL;
@@ -563,6 +567,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
 _PUBLIC_ void strlower_m(char *s)
 {
 	char *d;
+	struct smb_iconv_convenience *iconv_convenience;
 
 	/* this is quite a common operation, so we want it to be
 	   fast. We optimise for the ascii case, knowing that all our
@@ -576,12 +581,14 @@ _PUBLIC_ void strlower_m(char *s)
 	if (!*s)
 		return;
 
+	iconv_convenience = lp_iconv_convenience(global_loadparm);
+
 	d = s;
 
 	while (*s) {
 		size_t c_size, c_size2;
-		codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
-		c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, tolower_w(c));
+		codepoint_t c = next_codepoint(iconv_convenience, s, &c_size);
+		c_size2 = push_codepoint(iconv_convenience, d, tolower_w(c));
 		if (c_size2 > c_size) {
 			DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strlower_m\n",
 				 c, tolower_w(c), (int)c_size, (int)c_size2));
@@ -599,6 +606,7 @@ _PUBLIC_ void strlower_m(char *s)
 _PUBLIC_ void strupper_m(char *s)
 {
 	char *d;
+	struct smb_iconv_convenience *iconv_convenience;
 
 	/* this is quite a common operation, so we want it to be
 	   fast. We optimise for the ascii case, knowing that all our
@@ -612,12 +620,14 @@ _PUBLIC_ void strupper_m(char *s)
 	if (!*s)
 		return;
 
+	iconv_convenience = lp_iconv_convenience(global_loadparm);
+
 	d = s;
 
 	while (*s) {
 		size_t c_size, c_size2;
-		codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size);
-		c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, toupper_w(c));
+		codepoint_t c = next_codepoint(iconv_convenience, s, &c_size);
+		c_size2 = push_codepoint(iconv_convenience, d, toupper_w(c));
 		if (c_size2 > c_size) {
 			DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strupper_m\n",
 				 c, toupper_w(c), (int)c_size, (int)c_size2));
diff --git a/source/lib/registry/hive.c b/source/lib/registry/hive.c
index 5d56a30..ad6a642 100644
--- a/source/lib/registry/hive.c
+++ b/source/lib/registry/hive.c
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "hive.h"
 #include "system/filesys.h"
+#include "param/param.h"
 
 /** Open a registry file/host/etc */
 _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
@@ -52,7 +53,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
 
 	if (!strncmp(peek, "regf", 4)) {
 		close(fd);
-		return reg_open_regf_file(parent_ctx, location, lp_ctx, root);
+		return reg_open_regf_file(parent_ctx, location, lp_iconv_convenience(lp_ctx), root);
 	} else if (!strncmp(peek, "TDB file", 8)) {
 		close(fd);
 		return reg_open_ldb_file(parent_ctx, location, session_info,
diff --git a/source/lib/registry/hive.h b/source/lib/registry/hive.h
index 6d9a69c..87f3356 100644
--- a/source/lib/registry/hive.h
+++ b/source/lib/registry/hive.h
@@ -188,7 +188,7 @@ WERROR hive_key_flush(struct hive_key *key);
 WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
 			  const char *location, struct hive_key **key);
 WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
-			  const char *location, struct loadparm_context *lp_ctx,
+			  const char *location, struct smb_iconv_convenience *iconv_convenience,
 			  struct hive_key **key);
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
 			 struct auth_session_info *session_info,
@@ -200,6 +200,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
 WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
 			    const char *location, struct hive_key **key);
 WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
+			    struct smb_iconv_convenience *iconv_convenience,
 			    const char *location,
 			    int major_version,
 			    struct hive_key **key);
diff --git a/source/lib/registry/ldb.c b/source/lib/registry/ldb.c
index 0c8a553..dfd368e 100644
--- a/source/lib/registry/ldb.c
+++ b/source/lib/registry/ldb.c
@@ -36,7 +36,9 @@ struct ldb_key_data
 	int subkey_count, value_count;
 };
 
-static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, 
+				 struct smb_iconv_convenience *iconv_convenience,
+				 struct ldb_message *msg,
 				 const char **name, uint32_t *type,
 				 DATA_BLOB *data)
 {
@@ -57,7 +59,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
 	{
 	case REG_SZ:
 	case REG_EXPAND_SZ:
-		data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16,
+		data->length = convert_string_talloc(mem_ctx, iconv_convenience, CH_UTF8, CH_UTF16,
 						     val->data, val->length,
 						     (void **)&data->data);
 		break;
@@ -281,7 +283,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k,
 	if (idx >= kd->value_count)
 		return WERR_NO_MORE_ITEMS;
 
-	reg_ldb_unpack_value(mem_ctx, kd->values[idx],
+	reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), kd->values[idx],
 			     name, data_type, data);
 
 	return WERR_OK;
@@ -310,7 +312,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
 	if (res->count == 0)
 		return WERR_BADFILE;
 
-	reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data);
+	reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), res->msgs[0], NULL, data_type, data);
 
 	return WERR_OK;
 }
@@ -607,7 +609,9 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
 
 			if (max_valbufsize != NULL) {
 				DATA_BLOB data;
-				reg_ldb_unpack_value(mem_ctx, kd->values[i], NULL, 
+				reg_ldb_unpack_value(mem_ctx, 
+						     lp_iconv_convenience(global_loadparm),
+						     kd->values[i], NULL, 
 						     NULL, &data);
 				*max_valbufsize = MAX(*max_valbufsize, data.length);
 				talloc_free(data.data);
diff --git a/source/lib/registry/patchfile.c b/source/lib/registry/patchfile.c
index a457901..687fd4b 100644
--- a/source/lib/registry/patchfile.c
+++ b/source/lib/registry/patchfile.c
@@ -27,6 +27,7 @@
 
 
 _PUBLIC_ WERROR reg_preg_diff_load(int fd,
+				   struct smb_iconv_convenience *iconv_convenience, 
 				   const struct reg_diff_callbacks *callbacks,
 				   void *callback_data);
 
@@ -273,6 +274,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
  * Load diff file
  */
 _PUBLIC_ WERROR reg_diff_load(const char *filename,
+			      struct smb_iconv_convenience *iconv_convenience,
 			      const struct reg_diff_callbacks *callbacks,
 			      void *callback_data)
 {
@@ -305,10 +307,10 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
 #endif
 	if (strncmp(hdr, "PReg", 4) == 0) {
 		/* Must be a GPO Registry.pol file */
-		return reg_preg_diff_load(fd, callbacks, callback_data);
+		return reg_preg_diff_load(fd, iconv_convenience, callbacks, callback_data);
 	} else {
 		/* Must be a normal .REG file */
-		return reg_dotreg_diff_load(fd, lp_iconv_convenience(global_loadparm), callbacks, callback_data);
+		return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data);
 	}
 }
 
@@ -442,5 +444,6 @@ _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx, const char *filenam
 	callbacks.del_all_values = reg_diff_apply_del_all_values;
 	callbacks.done = NULL;
 
-	return reg_diff_load(filename, &callbacks, ctx);
+	return reg_diff_load(filename, lp_iconv_convenience(global_loadparm), 
+			     &callbacks, ctx);
 }
diff --git a/source/lib/registry/patchfile.h b/source/lib/registry/patchfile.h
index 08a977d..9289390 100644
--- a/source/lib/registry/patchfile.h
+++ b/source/lib/registry/patchfile.h
@@ -43,6 +43,7 @@ WERROR reg_generate_diff(struct registry_context *ctx1,
 			 const struct reg_diff_callbacks *callbacks,
 			 void *callback_data);
 WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
+			    struct smb_iconv_convenience *iconv_convenience,
 			    struct reg_diff_callbacks **callbacks,
 			    void **callback_data);
 WERROR reg_generate_diff_key(struct registry_key *oldkey,
diff --git a/source/lib/registry/patchfile_dotreg.c b/source/lib/registry/patchfile_dotreg.c
index 46ea7c0..6de642e 100644
--- a/source/lib/registry/patchfile_dotreg.c
+++ b/source/lib/registry/patchfile_dotreg.c
@@ -101,6 +101,7 @@ static WERROR reg_dotreg_diff_del_all_values(void *callback_data,
  * Save registry diff
  */
 _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
+				     struct smb_iconv_convenience *iconv_convenience,
 				     struct reg_diff_callbacks **callbacks,
 				     void **callback_data)
 {
@@ -109,7 +110,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
 	data = talloc_zero(ctx, struct dotreg_data);
 	*callback_data = data;
 
-	data->iconv_convenience = lp_iconv_convenience(global_loadparm);
+	data->iconv_convenience = iconv_convenience;
 
 	if (filename) {
 		data->fd = open(filename, O_CREAT, 0755);
diff --git a/source/lib/registry/patchfile_preg.c b/source/lib/registry/patchfile_preg.c
index 9cc9a5d..0d39e67 100644
--- a/source/lib/registry/patchfile_preg.c
+++ b/source/lib/registry/patchfile_preg.c
@@ -29,14 +29,14 @@ struct preg_data {
 	int fd;
 };
 
-static WERROR preg_read_utf16(int fd, char *c)
+static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
 {
 	uint16_t v;
 
 	if (read(fd, &v, 2) < 2) {
 		return WERR_GENERAL_FAILURE;
 	}
-	push_codepoint(lp_iconv_convenience(global_loadparm), c, v);
+	push_codepoint(ic, c, v);
 	return WERR_OK;
 }
 
@@ -123,6 +123,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
  * Load diff file
  */
 _PUBLIC_ WERROR reg_preg_diff_load(int fd,
+				   struct smb_iconv_convenience *iconv_convenience, 
 				   const struct reg_diff_callbacks *callbacks,
 				   void *callback_data)
 {
@@ -162,7 +163,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 	while(1) {
 		uint32_t value_type, length;
 
-		if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) {
+		if (!W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr))) {
 			break;
 		}
 		if (*buf_ptr != '[') {
@@ -173,7 +174,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 
 		/* Get the path */
 		buf_ptr = buf;
-		while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+		while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
 		       *buf_ptr != ';' && buf_ptr-buf < buf_size) {
 			buf_ptr++;
 		}
@@ -181,7 +182,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 
 		/* Get the name */
 		buf_ptr = buf;
-		while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+		while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
 		       *buf_ptr != ';' && buf_ptr-buf < buf_size) {
 			buf_ptr++;
 		}
@@ -195,7 +196,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 		}
 		/* Read past delimiter */
 		buf_ptr = buf;
-		if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+		if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
 		    *buf_ptr == ';') && buf_ptr-buf < buf_size) {
 			DEBUG(0, ("Error in PReg file.\n"));
 			ret = WERR_GENERAL_FAILURE;
@@ -209,7 +210,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 		}
 		/* Read past delimiter */
 		buf_ptr = buf;
-		if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+		if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
 		    *buf_ptr == ';') && buf_ptr-buf < buf_size) {
 			DEBUG(0, ("Error in PReg file.\n"));
 			ret = WERR_GENERAL_FAILURE;
@@ -227,7 +228,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 
 		/* Check if delimiter is in place (whine if it isn't) */
 		buf_ptr = buf;
-		if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+		if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
 		    *buf_ptr == ']') && buf_ptr-buf < buf_size) {
 			DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n",
 				*buf_ptr, *buf_ptr));
diff --git a/source/lib/registry/regf.c b/source/lib/registry/regf.c
index 15b6074..cf3e564 100644
--- a/source/lib/registry/regf.c
+++ b/source/lib/registry/regf.c
@@ -1863,7 +1863,9 @@ static WERROR regf_save_hbin(struct regf_data *regf)
 	return WERR_OK;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list