From 49bf9d35cd7fd87830ee2240e00919bd1bf3a1df Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 18 Apr 2008 10:20:01 +0200 Subject: loadparm: make it possible to just load the config without following "include =" statements metze (This used to be commit 6b5c76bf1e880ec60d6b044c58115940549049e5) --- source3/param/loadparm.c | 53 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 10 deletions(-) (limited to 'source3/param') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 9595ebdb18..84e8c1a2b7 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6727,11 +6727,16 @@ static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **pt /*************************************************************************** Handle the include operation. ***************************************************************************/ +static bool bNoIncludes = false; static bool handle_include(int snum, const char *pszParmValue, char **ptr) { char *fname; + if (bNoIncludes) { + return true; + } + if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) { if (bInGlobalSection) { return process_registry_globals(); @@ -8651,11 +8656,12 @@ bool lp_is_in_client(void) False on failure. ***************************************************************************/ -bool lp_load(const char *pszFname, - bool global_only, - bool save_defaults, - bool add_ipc, - bool initialize_globals) +bool lp_load_ex(const char *pszFname, + bool global_only, + bool save_defaults, + bool add_ipc, + bool initialize_globals, + bool no_includes) { char *n2 = NULL; bool bRetval; @@ -8663,10 +8669,11 @@ bool lp_load(const char *pszFname, bRetval = False; - DEBUG(3, ("lp_load: refreshing parameters\n")); + DEBUG(3, ("lp_load_ex: refreshing parameters\n")); bInGlobalSection = True; bGlobalOnly = global_only; + bNoIncludes = no_includes; init_globals(! initialize_globals); debug_init(); @@ -8694,7 +8701,7 @@ bool lp_load(const char *pszFname, current_user_info.domain, pszFname); if (!n2) { - smb_panic("lp_load: out of memory"); + smb_panic("lp_load_ex: out of memory"); } add_to_file_list(pszFname, n2); @@ -8722,12 +8729,12 @@ bool lp_load(const char *pszFname, */ config_backend = CONFIG_BACKEND_REGISTRY; /* start over */ - DEBUG(1, ("lp_load: changing to config backend " + DEBUG(1, ("lp_load_ex: changing to config backend " "registry\n")); init_globals(false); lp_kill_all_services(); - return lp_load(pszFname, global_only, save_defaults, - add_ipc, initialize_globals); + return lp_load_ex(pszFname, global_only, save_defaults, + add_ipc, initialize_globals, no_includes); } } else if (lp_config_backend_is_registry()) { bRetval = process_registry_globals(); @@ -8762,9 +8769,35 @@ bool lp_load(const char *pszFname, init_iconv(); + bNoIncludes = false; + return (bRetval); } +bool lp_load(const char *pszFname, + bool global_only, + bool save_defaults, + bool add_ipc, + bool initialize_globals) +{ + return lp_load_ex(pszFname, + global_only, + save_defaults, + add_ipc, + initialize_globals, + false); +} + +bool lp_load_initial_only(const char *pszFname) +{ + return lp_load_ex(pszFname, + true, + false, + false, + true, + true); +} + /*************************************************************************** Reset the max number of services. ***************************************************************************/ -- cgit