summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/param/loadparm.c8
-rw-r--r--lib/param/loadparm.h4
-rw-r--r--lib/param/param_table.c16
-rw-r--r--lib/param/wscript_build2
-rw-r--r--python/samba/tests/docs.py2
-rw-r--r--source3/param/loadparm.c4
6 files changed, 23 insertions, 13 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 811d802779d..d503534eac8 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -75,13 +75,7 @@ static bool defaults_saved = false;
#include "lib/param/param_global.h"
-#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
-
-#ifndef N_
-#define N_(x) x
-#endif
-
-#include "lib/param/param_table.c"
+#define NUMPARAMETERS (num_parameters())
struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx)
{
diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h
index 9be01ef7b96..4b3e68e2f66 100644
--- a/lib/param/loadparm.h
+++ b/lib/param/loadparm.h
@@ -84,6 +84,8 @@ struct parm_struct {
} def;
};
+extern struct parm_struct parm_table[];
+
struct file_lists {
struct file_lists *next;
char *name;
@@ -282,6 +284,8 @@ int getservicebyname(const char *, struct loadparm_service *);
bool lp_include(struct loadparm_context *, int, const char *, char **);
void init_printer_values(TALLOC_CTX *, struct loadparm_service *);
+int num_parameters(void);
+
/**
* Check if two parameters are equal.
*/
diff --git a/lib/param/param_table.c b/lib/param/param_table.c
index 8df7d1b5fa1..578b154e4b7 100644
--- a/lib/param/param_table.c
+++ b/lib/param/param_table.c
@@ -27,6 +27,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "includes.h"
+#include "lib/param/param.h"
+#include "lib/param/loadparm.h"
+#include "lib/param/param_global.h"
+#include "libcli/smb/smb_constants.h"
+
+#ifndef N_
+#define N_(x) x
+#endif
+
static const struct enum_list enum_protocol[] = {
{PROTOCOL_SMB2_10, "SMB2"}, /* for now keep PROTOCOL_SMB2_10 */
{PROTOCOL_SMB3_00, "SMB3"}, /* for now keep PROTOCOL_SMB3_00 */
@@ -276,7 +286,7 @@ static const struct enum_list enum_case[] = {
#define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
-static struct parm_struct parm_table[] = {
+struct parm_struct parm_table[] = {
{N_("Base Options"), P_SEP, P_SEPARATOR},
{
@@ -4398,3 +4408,7 @@ static struct parm_struct parm_table[] = {
{NULL, P_BOOL, P_NONE, 0, NULL, NULL, 0}
};
+int num_parameters(void)
+{
+ return (sizeof(parm_table) / sizeof(struct parm_struct));
+}
diff --git a/lib/param/wscript_build b/lib/param/wscript_build
index 3c72a73dffb..69746bc83ee 100644
--- a/lib/param/wscript_build
+++ b/lib/param/wscript_build
@@ -30,7 +30,7 @@ bld.SAMBA_LIBRARY('server-role',
private_library=True)
bld.SAMBA_LIBRARY('samba-hostconfig',
- source='loadparm.c generic.c util.c',
+ source='loadparm.c generic.c util.c param_table.c',
pc_files='samba-hostconfig.pc',
vnum='0.0.1',
deps='DYNCONFIG server-role tdb',
diff --git a/python/samba/tests/docs.py b/python/samba/tests/docs.py
index 31c66a61a7d..b11e4f19722 100644
--- a/python/samba/tests/docs.py
+++ b/python/samba/tests/docs.py
@@ -66,7 +66,7 @@ def get_implementation_parameters(sourcedir):
# burn through the preceding lines
while True:
l = f.readline()
- if l.startswith("static struct parm_struct parm_table"):
+ if l.startswith("struct parm_struct parm_table"):
break
for l in f.readlines():
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d5f7bacf1b0..100ef8d2e94 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -258,15 +258,13 @@ static bool bInGlobalSection = true;
static bool bGlobalOnly = false;
static struct file_lists *file_lists = NULL;
-#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
+#define NUMPARAMETERS (num_parameters())
static void set_allowed_client_auth(void);
static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
static void free_param_opts(struct parmlist_entry **popts);
-#include "lib/param/param_table.c"
-
/* this is used to prevent lots of mallocs of size 1 */
static const char null_string[] = "";