s3-param: Make sure we have talloc stack frame before calling in s3 code
[idra/samba.git] / source3 / param / loadparm_ctx.c
index e80f6f1844442ea703a0a2c9bda81e590544cf52..3aadda1bd080082f36a586eabdf4d1ddcfd3f77f 100644 (file)
 #include "includes.h"
 #include "../source4/param/s3_param.h"
 
-static const char *get_parametric(const char *type, const char *option)
+static bool lp_load_for_s4_ctx(const char *filename)
 {
-       return lp_parm_const_string(-1, type, option, NULL);
+       TALLOC_CTX *mem_ctx;
+       bool status;
+
+       mem_ctx = talloc_stackframe();
+       status =  lp_load(filename, false, false, false, false);
+       talloc_free(mem_ctx);
+
+       return status;
 }
 
 /* These are in the order that they appear in the s4 loadparm file.
@@ -31,7 +38,15 @@ static const char *get_parametric(const char *type, const char *option)
  * values in particular) and defaults. */
 static const struct loadparm_s3_context s3_fns = 
 {
-       .get_parametric = get_parametric,
+       .get_parametric = lp_parm_const_string_service,
+       .get_parm_struct = lp_get_parameter,
+       .get_parm_ptr = lp_parm_ptr,
+       .get_service = lp_service,
+       .get_servicebynum = lp_servicebynum,
+       .get_default_loadparm_service = lp_default_loadparm_service,
+       .get_numservices = lp_numservices,
+       .load = lp_load_for_s4_ctx,
+       .set_cmdline = lp_set_cmdline,
 
        .server_role = lp_server_role,
 
@@ -49,6 +64,7 @@ static const struct loadparm_s3_context s3_fns =
 
        .netbios_name = lp_netbios_name,
        .netbios_scope = lp_netbios_scope,
+       .netbios_aliases = lp_netbios_aliases,
 
        .lanman_auth = lp_lanman_auth,
        .ntlm_auth = lp_ntlm_auth,