s3-param: Make sure we have talloc stack frame before calling in s3 code
[Samba.git] / source3 / param / loadparm_ctx.c
blob3aadda1bd080082f36a586eabdf4d1ddcfd3f77f
1 /*
2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Andrew Bartlett 2011
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "../source4/param/s3_param.h"
23 static bool lp_load_for_s4_ctx(const char *filename)
25 TALLOC_CTX *mem_ctx;
26 bool status;
28 mem_ctx = talloc_stackframe();
29 status = lp_load(filename, false, false, false, false);
30 talloc_free(mem_ctx);
32 return status;
35 /* These are in the order that they appear in the s4 loadparm file.
36 * All of the s4 loadparm functions should be here eventually, once
37 * they are implemented in the s3 loadparm, have the same format (enum
38 * values in particular) and defaults. */
39 static const struct loadparm_s3_context s3_fns =
41 .get_parametric = lp_parm_const_string_service,
42 .get_parm_struct = lp_get_parameter,
43 .get_parm_ptr = lp_parm_ptr,
44 .get_service = lp_service,
45 .get_servicebynum = lp_servicebynum,
46 .get_default_loadparm_service = lp_default_loadparm_service,
47 .get_numservices = lp_numservices,
48 .load = lp_load_for_s4_ctx,
49 .set_cmdline = lp_set_cmdline,
51 .server_role = lp_server_role,
53 .winbind_separator = lp_winbind_separator,
54 .template_homedir = lp_template_homedir,
55 .template_shell = lp_template_shell,
57 .dos_charset = lp_dos_charset,
58 .unix_charset = lp_unix_charset,
60 .realm = lp_realm,
61 .dnsdomain = lp_dnsdomain,
62 .socket_options = lp_socket_options,
63 .workgroup = lp_workgroup,
65 .netbios_name = lp_netbios_name,
66 .netbios_scope = lp_netbios_scope,
67 .netbios_aliases = lp_netbios_aliases,
69 .lanman_auth = lp_lanman_auth,
70 .ntlm_auth = lp_ntlm_auth,
72 .client_plaintext_auth = lp_client_plaintext_auth,
73 .client_lanman_auth = lp_client_lanman_auth,
74 .client_ntlmv2_auth = lp_client_ntlmv2_auth,
76 .private_dir = lp_private_dir,
77 .ncalrpc_dir = lp_ncalrpc_dir,
78 .lockdir = lp_lockdir
81 const struct loadparm_s3_context *loadparm_s3_context(void)
83 return &s3_fns;