s3-param: Make sure we have talloc stack frame before calling in s3 code
[idra/samba.git] / source3 / param / loadparm_ctx.c
index cc2468651ae82c56491b9b0c1ea02ec26c60ea25..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,
 
@@ -41,15 +56,15 @@ static const struct loadparm_s3_context s3_fns =
 
        .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,
+       .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,