[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Mon Jun 6 02:49:02 MDT 2011


The branch, master has been updated
       via  b9108ca s3-s4-param: Add hooks for parametric options in the s3/s4 glue layer
       via  d72b05c s3-passdb use new loadparm_init_s3 rather than reloading the smb.conf
       via  907cdb5 s4-modules Remove lp_ctx from init functions that no longer need it
       via  f67a149 s4-param Remove 'modules dir'
       via  de46ad9 lib/util use modules_path(), data_path() and shlib_ext() from source3
       via  876b1b3 s3-lib Remove unused lib_path()
       via  1dfc6fa s4-param Add hook between Samba3 and Samba4 loadparm systems.
       via  521687b s4-param make lpcfg_sam_name() cope with PDC and BDC roles
       via  698538e s3-param always allow the realm parameter
       via  a18efb1 s4-param Remove 'sid generator'
       via  834d590 s4-param Remove 'idmap database'
       via  1565da7 s4-param Remove 'secrets database' parameter
       via  c091a92 s4-param Remove 'sam database' parameter
       via  6bf8822 libcli/util Remove prototype for ntstatus_dos_equal()
      from  d168a5e s4-ipv6: fill in family when initialising from sockaddr

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b9108cac529dac4b4b392fab4bac4fd0e6da1b4b
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 16:47:32 2011 +1000

    s3-s4-param: Add hooks for parametric options in the s3/s4 glue layer
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Mon Jun  6 10:48:53 CEST 2011 on sn-devel-104

commit d72b05cfe7d5c020fa32c8906f6185e1427e0a88
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 11:16:19 2011 +1000

    s3-passdb use new loadparm_init_s3 rather than reloading the smb.conf

commit 907cdb5de7f16a2540299aeba211bf2a5ae6fafe
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 14:58:28 2011 +1000

    s4-modules Remove lp_ctx from init functions that no longer need it
    
    Now that we don't allow the smb.conf to change the modules dir, many
    functions that simply load modules or initialise a subsytem that may
    load modules no longer need an lp_ctx.
    
    Andrew Bartlett

commit f67a14976bd6ccdacd319df872e6add994f0e0f3
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 14:39:19 2011 +1000

    s4-param Remove 'modules dir'
    
    The Samba waf build ensures that dyn_MODULESDIR is always correct
    (even for in-tree binaries), so we don't need to allow the user to
    configure this at run time.
    
    Andrew Bartlett

commit de46ad9084aff4384f33660acf91da3b81554a88
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 14:37:06 2011 +1000

    lib/util use modules_path(), data_path() and shlib_ext() from source3
    
    This brings these helpful utility functions in common, as they are not
    based on either loadparm system.
    
    (The 'modules dir' parameter from Samba4 will shortly be removed, so
    there is no loss in functionality)
    
    Andrew Bartlett

commit 876b1b3d198e2306c36423bfb1449870c74181fd
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 14:22:12 2011 +1000

    s3-lib Remove unused lib_path()

commit 1dfc6fa558e7735341a7095aa46e5568a4f56cfe
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jun 1 23:22:24 2011 +1000

    s4-param Add hook between Samba3 and Samba4 loadparm systems.
    
    In the top level build, this allows calls to code that requires a
    lpcfg_ style loadparm_context, while using the global parameters
    loaded from the source3 loadparm code.
    
    Andrew Bartlett

commit 521687be0d4bcd6326417696fabdce6506824b99
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 11:38:04 2011 +1000

    s4-param make lpcfg_sam_name() cope with PDC and BDC roles
    
    These roles (ROLE_DOMAIN_CONTROLLER is ROLE_DOMAIN_BDC) will come in
    from the s3 loadparm.
    
    Andrew Bartlett

commit 698538e594f65dd7ae2bd3854371ae914328b536
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 6 10:56:19 2011 +1000

    s3-param always allow the realm parameter

commit a18efb1490cebd92205973c50ce1582b091a7676
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Jun 2 18:56:10 2011 +1000

    s4-param Remove 'sid generator'
    
    This was only used by the Fedora DS backend for Samba4.  We agreed to
    no longer support external LDAP backends.
    
    Andrew Bartlett

commit 834d590bcff79e2d458b9e193be0c64e849a6362
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Jun 2 15:49:36 2011 +1000

    s4-param Remove 'idmap database'
    
    This is now just idmap.ldb in the private dir, which remains.

commit 1565da76947f91add10a54096cdfe2ab67917b32
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Jun 2 15:47:44 2011 +1000

    s4-param Remove 'secrets database' parameter
    
    This is now just secrets.ldb in the private dir, which remains.

commit c091a92be51e8c14bf0b51ab83319fbcb704c91f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Jun 2 15:43:40 2011 +1000

    s4-param Remove 'sam database' parameter
    
    This now just relies on the private dir parameter, which remains.
    
    Andrew Bartlett

commit 6bf88222cc00ac765929ed6e844552a9a776109a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Wed Jun 1 22:16:08 2011 +1000

    libcli/util Remove prototype for ntstatus_dos_equal()
    
    This was removed recently.

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

Summary of changes:
 lib/util/util.h                                    |   26 +++
 source3/lib/namearray.c => lib/util/util_paths.c   |   46 ++++--
 lib/util/wscript_build                             |    2 +-
 libcli/util/error.h                                |    3 -
 libgpo/gpext/gpext.c                               |    3 +-
 source3/Makefile.in                                |    2 +-
 source3/include/proto.h                            |    9 +-
 source3/intl/lang_tdb.c                            |    2 +-
 source3/lib/module.c                               |    8 +-
 source3/lib/util.c                                 |   50 ------
 source3/param/loadparm.c                           |   25 +++-
 source3/param/loadparm_ctx.c                       |   69 ++++++++
 source3/passdb/pdb_samba4.c                        |   16 +--
 source3/smbd/mangle_hash.c                         |    2 +-
 source3/wscript_build                              |   10 +-
 source4/NEWS                                       |    9 +-
 source4/auth/gensec/gensec.c                       |    4 +-
 source4/auth/gensec/gensec.h                       |    2 +-
 source4/auth/gensec/pygensec.c                     |    4 +-
 source4/client/cifsdd.c                            |    2 +-
 source4/client/client.c                            |    2 +-
 source4/dsdb/samdb/ldb_modules/samldb.c            |   14 +-
 source4/dsdb/samdb/samdb.c                         |    2 +-
 source4/lib/ldb-samba/ldb_wrap.c                   |    5 +-
 source4/lib/ldb-samba/samba_extensions.c           |    2 +-
 source4/lib/registry/rpc.c                         |    2 +-
 source4/libcli/ldap/ldap_bind.c                    |    2 +-
 source4/libnet/libnet.c                            |    2 +-
 source4/librpc/rpc/dcerpc.c                        |    4 +-
 source4/librpc/rpc/dcerpc.h                        |    2 +-
 source4/librpc/rpc/pyrpc_util.c                    |    2 +-
 source4/ntptr/ntptr_base.c                         |    4 +-
 source4/ntvfs/ntvfs_base.c                         |    2 +-
 source4/ntvfs/posix/pvfs_acl.c                     |    4 +-
 source4/ntvfs/posix/vfs_posix.c                    |    2 +-
 source4/param/loadparm.c                           |  117 +++++++++-----
 source4/param/param.h                              |    9 +-
 source4/param/pyparam.c                            |   16 ++
 source4/param/secrets.c                            |    2 +-
 source4/param/util.c                               |   15 +--
 source4/param/wscript_build                        |    5 +
 source4/rpc_server/dcerpc_server.c                 |    2 +-
 source4/samba_tool/samba_tool.c                    |    2 +-
 source4/script/mks3param.pl                        |  176 ++++++++++++++++++++
 source4/scripting/bin/samba_dnsupdate              |    2 +-
 source4/scripting/bin/samba_spnupdate              |    6 +-
 source4/scripting/python/samba/__init__.py         |    5 +-
 source4/scripting/python/samba/hostconfig.py       |    2 +-
 source4/scripting/python/samba/idmap.py            |    2 +-
 .../scripting/python/samba/provision/__init__.py   |   17 +--
 source4/scripting/python/samba/samdb.py            |    2 +-
 source4/scripting/python/samba/tests/samba3sam.py  |    6 +-
 source4/setup/provision.smb.conf.dc                |    1 -
 source4/setup/provision.smb.conf.member            |    1 -
 source4/setup/provision.smb.conf.standalone        |    1 -
 source4/smbd/process_model.c                       |    2 +-
 source4/smbd/server.c                              |    6 +-
 source4/torture/drs/rpc/dssync.c                   |    5 +-
 source4/torture/drs/rpc/msds_intid.c               |    5 +-
 source4/torture/gentest.c                          |    2 +-
 source4/torture/libnet/libnet_BecomeDC.c           |   10 +-
 source4/torture/locktest.c                         |    2 +-
 source4/torture/masktest.c                         |    2 +-
 source4/torture/rpc/dsgetinfo.c                    |    2 +-
 source4/torture/rpc/rpc.c                          |    2 +-
 source4/torture/smbtorture.c                       |    2 +-
 source4/torture/torture.c                          |    2 +-
 source4/utils/ntlm_auth.c                          |    2 +-
 source4/winbind/idmap.c                            |    2 +-
 69 files changed, 530 insertions(+), 250 deletions(-)
 copy source3/lib/namearray.c => lib/util/util_paths.c (50%)
 create mode 100644 source3/param/loadparm_ctx.c
 create mode 100644 source4/script/mks3param.pl


Changeset truncated at 500 lines:

diff --git a/lib/util/util.h b/lib/util/util.h
index d1c5e82..e89c4ac 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -891,4 +891,30 @@ int samba_runcmd_recv(struct tevent_req *req, int *perrno);
 void samba_start_debugger(void);
 #endif
 
+/**
+ * @brief Returns an absolute path to a file in the Samba modules directory.
+ *
+ * @param name File to find, relative to MODULESDIR.
+ *
+ * @retval Pointer to a string containing the full path.
+ **/
+char *modules_path(TALLOC_CTX *mem_ctx, const char *name);
+
+/**
+ * @brief Returns an absolute path to a file in the Samba data directory.
+ *
+ * @param name File to find, relative to CODEPAGEDIR.
+ *
+ * @retval Pointer to a talloc'ed string containing the full path.
+ **/
+char *data_path(TALLOC_CTX *mem_ctx, const char *name);
+
+/**
+ * @brief Returns the platform specific shared library extension.
+ *
+ * @retval Pointer to a const char * containing the extension.
+ **/
+const char *shlib_ext(void);
+
+
 #endif /* _SAMBA_UTIL_H_ */
diff --git a/source3/lib/namearray.c b/lib/util/util_paths.c
similarity index 50%
copy from source3/lib/namearray.c
copy to lib/util/util_paths.c
index e5c3bd9..0baa680 100644
--- a/source3/lib/namearray.c
+++ b/lib/util/util_paths.c
@@ -1,4 +1,4 @@
-/*
+/* 
    Unix SMB/CIFS implementation.
    Samba utility functions
    Copyright (C) Andrew Tridgell 1992-1998
@@ -22,18 +22,42 @@
 */
 
 #include "includes.h"
-/****************************************************************************
- Routine to free a namearray.
-****************************************************************************/
+#include "dynconfig/dynconfig.h"
 
-void free_namearray(name_compare_entry *name_array)
+/**
+ * @brief Returns an absolute path to a file in the Samba modules directory.
+ *
+ * @param name File to find, relative to MODULESDIR.
+ *
+ * @retval Pointer to a string containing the full path.
+ **/
+
+char *modules_path(TALLOC_CTX *mem_ctx, const char *name)
+{
+	return talloc_asprintf(mem_ctx, "%s/%s", get_dyn_MODULESDIR(), name);
+}
+
+/**
+ * @brief Returns an absolute path to a file in the Samba data directory.
+ *
+ * @param name File to find, relative to CODEPAGEDIR.
+ *
+ * @retval Pointer to a talloc'ed string containing the full path.
+ **/
+
+char *data_path(TALLOC_CTX *mem_ctx, const char *name)
 {
-	int i;
+	return talloc_asprintf(mem_ctx, "%s/%s", get_dyn_CODEPAGEDIR(), name);
+}
 
-	if(name_array == NULL)
-		return;
+/**
+ * @brief Returns the platform specific shared library extension.
+ *
+ * @retval Pointer to a const char * containing the extension.
+ **/
 
-	for(i=0; name_array[i].name!=NULL; i++)
-		SAFE_FREE(name_array[i].name);
-	SAFE_FREE(name_array);
+const char *shlib_ext(void)
+{
+	return get_dyn_SHLIBEXT();
 }
+
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 3092b6c..8ce30eb 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -4,7 +4,7 @@ common_util_sources = '''talloc_stack.c smb_threads.c xfile.c data_blob.c
                     util_file.c time.c rbtree.c rfc1738.c select.c
                     genrand.c fsusage.c blocking.c become_daemon.c
                     signal.c system.c params.c util.c util_id.c util_net.c
-                    util_strlist.c idtree.c debug.c fault.c base64.c
+                    util_strlist.c util_paths.c idtree.c debug.c fault.c base64.c
                     util_str.c util_str_common.c substitute.c ms_fnmatch.c'''
 
 common_util_headers = 'debug.h'
diff --git a/libcli/util/error.h b/libcli/util/error.h
index 5a0027c..771d7a6 100644
--- a/libcli/util/error.h
+++ b/libcli/util/error.h
@@ -23,9 +23,6 @@
 #include "libcli/util/doserr.h"
 #include "libcli/util/ntstatus.h"
 
-/** NT error on DOS connection! (NT_STATUS_OK) */
-bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2);
-
 /*****************************************************************************
 convert a NT status code to a dos class/code
  *****************************************************************************/
diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c
index f38d873..ac6c181 100644
--- a/libgpo/gpext/gpext.c
+++ b/libgpo/gpext/gpext.c
@@ -492,7 +492,8 @@ static NTSTATUS gp_glob_ext_list(TALLOC_CTX *mem_ctx,
 	SMB_STRUCT_DIR *dir = NULL;
 	SMB_STRUCT_DIRENT *dirent = NULL;
 
-	dir = sys_opendir(modules_path(SAMBA_SUBSYSTEM_GPEXT));
+	dir = sys_opendir(modules_path(talloc_tos(), 
+				       SAMBA_SUBSYSTEM_GPEXT));
 	if (!dir) {
 		return map_nt_error_from_unix(errno);
 	}
diff --git a/source3/Makefile.in b/source3/Makefile.in
index f7458d3..d4b59b9 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -421,7 +421,7 @@ LIBSAMBAUTIL_OBJ = \
 UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \
 		   ../lib/util/xfile.o ../lib/util/util_strlist.o  \
 		   ../lib/util/util_file.o ../lib/util/data_blob.o \
-		   ../lib/util/util.o ../lib/util/fsusage.o \
+		   ../lib/util/util.o ../lib/util/util_paths.o ../lib/util/fsusage.o \
 		   ../lib/util/params.o ../lib/util/talloc_stack.o \
 		   ../lib/util/genrand.o ../lib/util/util_net.o \
 		   ../lib/util/become_daemon.o ../lib/util/system.o \
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c6fd38d..10a84f9 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -570,12 +570,8 @@ void *smb_xmalloc_array(size_t size, unsigned int count);
 char *myhostname(void);
 char *lock_path(const char *name);
 char *pid_path(const char *name);
-char *lib_path(const char *name);
-char *modules_path(const char *name);
-char *data_path(const char *name);
 char *state_path(const char *name);
 char *cache_path(const char *name);
-const char *shlib_ext(void);
 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
 		    const char **name);
 bool ms_has_wild(const char *s);
@@ -1210,6 +1206,7 @@ char *lp_passwd_chat(void);
 const char *lp_passwordserver(void);
 const char *lp_name_resolve_order(void);
 const char *lp_realm(void);
+const char *lp_dnsdomain(void);
 const char *lp_afs_username_map(void);
 int lp_afs_token_lifetime(void);
 char *lp_log_nt_token_command(void);
@@ -1662,6 +1659,10 @@ void lp_set_passdb_backend(const char *backend);
 void widelinks_warning(int snum);
 const char *lp_ncalrpc_dir(void);
 
+/* The following definitions come from param/loadparm_ctx.c  */
+
+const struct loadparm_s3_context *loadparm_s3_context(void);
+
 /* The following definitions come from param/loadparm_server_role.c  */
 
 int lp_server_role(void);
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c
index c6206c1..6070e29 100644
--- a/source3/intl/lang_tdb.c
+++ b/source3/intl/lang_tdb.c
@@ -131,7 +131,7 @@ bool lang_tdb_init(const char *lang)
 		return True;
 
 	if (asprintf(&msg_path, "%s.msg",
-		     data_path((const char *)lang)) == -1) {
+		     data_path(talloc_tos(), (const char *)lang)) == -1) {
 		DEBUG(0, ("asprintf failed\n"));
 		goto done;
 	}
diff --git a/source3/lib/module.c b/source3/lib/module.c
index de13668..bec4fdd 100644
--- a/source3/lib/module.c
+++ b/source3/lib/module.c
@@ -117,10 +117,10 @@ NTSTATUS smb_probe_module(const char *subsystem, const char *module)
 	}
 
 	full_path = talloc_asprintf(ctx,
-			"%s/%s.%s",
-			modules_path(subsystem),
-			module,
-			shlib_ext());
+				    "%s/%s.%s",
+				    modules_path(ctx, subsystem),
+				    module,
+				    shlib_ext());
 	if (!full_path) {
 		TALLOC_FREE(ctx);
 		return NT_STATUS_NO_MEMORY;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 173e906..a596385 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1514,45 +1514,6 @@ char *pid_path(const char *name)
 }
 
 /**
- * @brief Returns an absolute path to a file in the Samba lib directory.
- *
- * @param name File to find, relative to LIBDIR.
- *
- * @retval Pointer to a string containing the full path.
- **/
-
-char *lib_path(const char *name)
-{
-	return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_LIBDIR(), name);
-}
-
-/**
- * @brief Returns an absolute path to a file in the Samba modules directory.
- *
- * @param name File to find, relative to MODULESDIR.
- *
- * @retval Pointer to a string containing the full path.
- **/
-
-char *modules_path(const char *name)
-{
-	return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_MODULESDIR(), name);
-}
-
-/**
- * @brief Returns an absolute path to a file in the Samba data directory.
- *
- * @param name File to find, relative to CODEPAGEDIR.
- *
- * @retval Pointer to a talloc'ed string containing the full path.
- **/
-
-char *data_path(const char *name)
-{
-	return talloc_asprintf(talloc_tos(), "%s/%s", get_dyn_CODEPAGEDIR(), name);
-}
-
-/**
  * @brief Returns an absolute path to a file in the Samba state directory.
  *
  * @param name File to find, relative to STATEDIR.
@@ -1578,17 +1539,6 @@ char *cache_path(const char *name)
 	return xx_path(name, lp_cachedir());
 }
 
-/**
- * @brief Returns the platform specific shared library extension.
- *
- * @retval Pointer to a const char * containing the extension.
- **/
-
-const char *shlib_ext(void)
-{
-	return get_dyn_SHLIBEXT();
-}
-
 /*******************************************************************
  Given a filename - get its directory name
 ********************************************************************/
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index c4cb37b..dc79c36 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -159,6 +159,8 @@ struct global {
 	char *szPasswordServer;
 	char *szSocketOptions;
 	char *szRealm;
+	char *szRealmUpper;
+	char *szDnsDomain;
 	char *szAfsUsernameMap;
 	int iAfsTokenLifetime;
 	char *szLogNtTokenCommand;
@@ -705,6 +707,7 @@ static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
+static bool handle_realm( int snum, const char *pszParmValue, char **ptr );
 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
@@ -1014,17 +1017,15 @@ static struct parm_struct parm_table[] = {
 		.enum_list	= NULL,
 		.flags		= FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
 	},
-#ifdef WITH_ADS
 	{
 		.label		= "realm",
 		.type		= P_USTRING,
 		.p_class	= P_GLOBAL,
 		.ptr		= &Globals.szRealm,
-		.special	= NULL,
+		.special	= handle_realm,
 		.enum_list	= NULL,
 		.flags		= FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
 	},
-#endif
 	{
 		.label		= "netbios name",
 		.type		= P_USTRING,
@@ -5618,7 +5619,8 @@ FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
 FN_GLOBAL_CONST_STRING(lp_passwordserver, &Globals.szPasswordServer)
 FN_GLOBAL_CONST_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
-FN_GLOBAL_CONST_STRING(lp_realm, &Globals.szRealm)
+FN_GLOBAL_CONST_STRING(lp_realm, &Globals.szRealmUpper)
+FN_GLOBAL_CONST_STRING(lp_dnsdomain, &Globals.szDnsDomain)
 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
@@ -7595,6 +7597,21 @@ static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
 	return ret;
 }
 
+static bool handle_realm(int snum, const char *pszParmValue, char **ptr)
+{
+	bool ret = true;
+	char *realm = strupper_talloc(talloc_tos(), pszParmValue);
+	char *dnsdomain = strlower_talloc(talloc_tos(), pszParmValue);
+
+	ret &= string_set(&Globals.szRealm, pszParmValue);
+	ret &= string_set(&Globals.szRealmUpper, realm);
+	ret &= string_set(&Globals.szDnsDomain, dnsdomain);
+	TALLOC_FREE(realm);
+	TALLOC_FREE(dnsdomain);
+
+	return ret;
+}
+
 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
 {
 	bool ret;
diff --git a/source3/param/loadparm_ctx.c b/source3/param/loadparm_ctx.c
new file mode 100644
index 0000000..cc24686
--- /dev/null
+++ b/source3/param/loadparm_ctx.c
@@ -0,0 +1,69 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Parameter loading functions
+   Copyright (C) Andrew Bartlett 2011
+
+   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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "../source4/param/s3_param.h"
+
+static const char *get_parametric(const char *type, const char *option)
+{
+	return lp_parm_const_string(-1, type, option, NULL);
+}
+
+/* These are in the order that they appear in the s4 loadparm file.
+ * All of the s4 loadparm functions should be here eventually, once
+ * they are implemented in the s3 loadparm, have the same format (enum
+ * values in particular) and defaults. */
+static const struct loadparm_s3_context s3_fns = 
+{
+	.get_parametric = get_parametric,
+
+	.server_role = lp_server_role,
+
+	.winbind_separator = lp_winbind_separator,
+	.template_homedir = lp_template_homedir,
+	.template_shell = lp_template_shell,
+
+	.dos_charset = lp_dos_charset,
+	.unix_charset = lp_unix_charset,
+	.display_charset = lp_display_charset,
+
+	.realm = lp_realm,
+	.dnsdomain = lp_dnsdomain,
+	.socket_options = lp_socket_options,
+	.workgroup = lp_workgroup,
+
+	.netbios_name = global_myname,
+	.netbios_scope = global_scope,
+
+	.lanman_auth = lp_lanman_auth,
+	.ntlm_auth = lp_ntlm_auth,
+
+	.client_plaintext_auth = lp_client_plaintext_auth,
+	.client_lanman_auth = lp_client_lanman_auth,
+	.client_ntlmv2_auth = lp_client_ntlmv2_auth,
+
+	.private_dir = lp_private_dir,
+	.ncalrpc_dir = lp_ncalrpc_dir,
+	.lockdir = lp_lockdir
+};
+
+const struct loadparm_s3_context *loadparm_s3_context(void)
+{
+	return &s3_fns;
+}
diff --git a/source3/passdb/pdb_samba4.c b/source3/passdb/pdb_samba4.c
index 558f8d0..b8b11e4 100644
--- a/source3/passdb/pdb_samba4.c
+++ b/source3/passdb/pdb_samba4.c
@@ -2061,21 +2061,9 @@ static NTSTATUS pdb_init_samba4(struct pdb_methods **pdb_method,
 		goto fail;
 	}
 
-	state->lp_ctx = loadparm_init(state);
+	state->lp_ctx = loadparm_init_s3(state, loadparm_s3_context());
 	if (state->lp_ctx == NULL) {
-		DEBUG(10, ("loadparm_init failed\n"));
-		goto fail;
-	}
-
-	if (lp_loaded()) {
-		config_file = lp_configfile();
-	}
-	if (!config_file || !config_file[0]) {
-		config_file = get_dyn_CONFIGFILE();
-	}
-
-	if (!lpcfg_load(state->lp_ctx, config_file)) {
-		DEBUG(1, ("s4 lpcfg_load() of s3 config file %s failed", config_file));
+		DEBUG(10, ("loadparm_init_s3 failed\n"));
 		goto fail;
 	}
 
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index 575c35e..988251e 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -87,7 +87,7 @@ static void init_valid_table(void)
 		return;
 	}
 
-	valid_table = (uint8 *)map_file(data_path("valid.dat"), 0x10000);
+	valid_table = (uint8 *)map_file(data_path(talloc_tos(), "valid.dat"), 0x10000);
 	if (!valid_table) {
 		smb_panic("Could not load valid.dat file required for mangle method=hash");
 		return;
diff --git a/source3/wscript_build b/source3/wscript_build
index 4fd7a7b..b30c204 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -737,9 +737,15 @@ bld.SAMBA3_SUBSYSTEM('PARAM_UTIL',
                     source=PARAM_UTIL_SRC,
                     deps='samba-util-common')
 
+if bld.env.toplevel_build:
+    bld.SAMBA3_SUBSYSTEM('LOADPARM_CTX',
+                         source='param/loadparm_ctx.c',
+                         deps='''s3_param_h PARAM_WITHOUT_REG''',
+                         vars=locals())
+
 bld.SAMBA3_SUBSYSTEM('PARAM_WITHOUT_REG',
                     source=PARAM_WITHOUT_REG_SRC,
-                    deps='''PARAM_UTIL smbd_conn ldap lber''',
+                    deps='''PARAM_UTIL smbd_conn ldap lber LOADPARM_CTX''',
                     vars=locals())
 
 bld.SAMBA3_SUBSYSTEM('param',


-- 
Samba Shared Repository


More information about the samba-cvs mailing list