From: Garming Sam Date: Fri, 21 Feb 2014 04:59:19 +0000 (+1300) Subject: param: setup more variables in for the temporary loadparm context for the special... X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=74e0a37fd34791099a32591ab607e9444fd441fe;p=mat%2Fsamba.git param: setup more variables in for the temporary loadparm context for the special functions In doing so, the loadparm context definition is now also moved to the loadparm.h header. This means that the loadparm context is no longer private to the lib/param code and that the source3 code can now override the values within it. Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison --- diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 63b8edd201..2b8ea237a0 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -93,26 +93,6 @@ static bool defaults_saved = false; #include "lib/param/param_table.c" -/* local variables */ -struct loadparm_context { - const char *szConfigFile; - struct loadparm_global *globals; - struct loadparm_service **services; - struct loadparm_service *sDefault; - struct smb_iconv_handle *iconv_handle; - int iNumServices; - struct loadparm_service *currentService; - bool bInGlobalSection; - struct file_lists *file_lists; - unsigned int flags[NUMPARAMETERS]; - bool loaded; - bool refuse_free; - bool global; /* Is this the global context, which may set - * global variables such as debug level etc? */ - const struct loadparm_s3_helpers *s3_fns; -}; - - struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx) { if (lp_ctx->s3_fns) { @@ -2079,6 +2059,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lp_ctx->bInGlobalSection = true; lp_ctx->globals = talloc_zero(lp_ctx, struct loadparm_global); lp_ctx->sDefault = talloc_zero(lp_ctx, struct loadparm_service); + lp_ctx->flags = talloc_zero_array(lp_ctx, unsigned int, NUMPARAMETERS); lp_ctx->sDefault->iMaxPrintJobs = 1000; lp_ctx->sDefault->bAvailable = true; diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h index 70443a97ea..3f934139d7 100644 --- a/lib/param/loadparm.h +++ b/lib/param/loadparm.h @@ -48,7 +48,23 @@ struct enum_list { }; struct loadparm_service; -struct loadparm_context; +struct loadparm_context { + const char *szConfigFile; + struct loadparm_global *globals; + struct loadparm_service **services; + struct loadparm_service *sDefault; + struct smb_iconv_handle *iconv_handle; + int iNumServices; + struct loadparm_service *currentService; + bool bInGlobalSection; + struct file_lists *file_lists; + unsigned int *flags; + bool loaded; + bool refuse_free; + bool global; /* Is this the global context, which may set + * global variables such as debug level etc? */ + const struct loadparm_s3_helpers *s3_fns; +}; struct parm_struct { const char *label; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 6e375aed3f..ff1f7250cb 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2768,6 +2768,8 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue bool ok; struct loadparm_context *lp_ctx = loadparm_init_s3(talloc_tos(), loadparm_s3_helpers()); + lp_ctx->sDefault = &sDefault; + lp_ctx->services = ServicePtrs; ok = parm_table[parmnum].special(lp_ctx, snum, pszParmValue, (char **)parm_ptr); TALLOC_FREE(lp_ctx);