summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-29 13:18:57 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-29 15:44:08 +1000
commit7198d540e8abc31f831e9c13a031b905604176c6 (patch)
tree005d4c04d366901b76719e4f6144d1a522134d25
parent21756b7c7d3048ce3396ab63aebc80babf4819e9 (diff)
downloadsamba-7198d540e8abc31f831e9c13a031b905604176c6.tar.gz
samba-7198d540e8abc31f831e9c13a031b905604176c6.tar.bz2
samba-7198d540e8abc31f831e9c13a031b905604176c6.zip
param: Merge struct parm_struct definitions
This will allow the parameter tables to be shared between source3 and source4. Andrew Bartlett
-rw-r--r--source3/include/smb.h4
-rw-r--r--source3/param/loadparm.c50
-rw-r--r--source4/param/loadparm.c22
-rw-r--r--source4/param/loadparm.h3
4 files changed, 41 insertions, 38 deletions
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 25e3bacc72..152db48db5 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -726,13 +726,15 @@ struct enum_list {
};
struct loadparm_service;
+struct loadparm_context;
struct parm_struct {
const char *label;
parm_type type;
parm_class p_class;
offset_t offset;
- bool (*special)(int snum, const char *, char **);
+ bool (*special)(struct loadparm_context *lpcfg_ctx,
+ int snum, const char *, char **);
const struct enum_list *enum_list;
unsigned flags;
union {
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 430c2de5ac..3c213420ae 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -698,18 +698,18 @@ static int default_server_announce;
#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
/* prototypes for the special type handlers */
-static bool handle_include( int snum, const char *pszParmValue, char **ptr);
-static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
-static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr);
-static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
-static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
-static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
-static bool handle_realm( int snum, const char *pszParmValue, char **ptr );
-static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
-static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
-static bool handle_dos_charset( int snum, const char *pszParmValue, char **ptr );
-static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
-static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
+static bool handle_include(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
+static bool handle_copy(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
+static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
+static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
+static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
+static bool handle_debug_list(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
+static bool handle_realm(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
+static bool handle_netbios_aliases(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
+static bool handle_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
+static bool handle_dos_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
+static bool handle_printing(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
+static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
static void set_default_server_announce_type(void);
static void set_allowed_client_auth(void);
@@ -7388,7 +7388,7 @@ static void init_iconv(void)
true, global_iconv_handle);
}
-static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
+static bool handle_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
if (strcmp(*ptr, pszParmValue) != 0) {
string_set(ptr, pszParmValue);
@@ -7397,7 +7397,7 @@ static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
return True;
}
-static bool handle_dos_charset(int snum, const char *pszParmValue, char **ptr)
+static bool handle_dos_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
bool is_utf8 = false;
size_t len = strlen(pszParmValue);
@@ -7434,7 +7434,7 @@ static bool handle_dos_charset(int snum, const char *pszParmValue, char **ptr)
return true;
}
-static bool handle_realm(int snum, const char *pszParmValue, char **ptr)
+static bool handle_realm(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
bool ret = true;
char *realm = strupper_talloc(talloc_tos(), pszParmValue);
@@ -7449,7 +7449,7 @@ static bool handle_realm(int snum, const char *pszParmValue, char **ptr)
return ret;
}
-static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
+static bool handle_netbios_aliases(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
TALLOC_FREE(Globals.szNetbiosAliases);
Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
@@ -7461,7 +7461,7 @@ static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **pt
***************************************************************************/
static bool bAllowIncludeRegistry = true;
-static bool handle_include(int snum, const char *pszParmValue, char **ptr)
+static bool handle_include(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
char *fname;
@@ -7514,7 +7514,7 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
Handle the interpretation of the copy parameter.
***************************************************************************/
-static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
+static bool handle_copy(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
bool bRetval;
int iTemp;
@@ -7546,7 +7546,7 @@ static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
return (bRetval);
}
-static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
+static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
Globals.ldap_debug_level = lp_int(pszParmValue);
init_ldap_debugging();
@@ -7600,7 +7600,7 @@ bool lp_idmap_gid(gid_t *low, gid_t *high)
return True;
}
-static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr)
+static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
@@ -7609,14 +7609,14 @@ static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr)
/* Do some simple checks on "idmap [ug]id" parameter values */
-static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
+static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
lp_do_parameter(snum, "idmap config * : range", pszParmValue);
return True;
}
-static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
+static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
lp_do_parameter(snum, "idmap config * : range", pszParmValue);
@@ -7627,7 +7627,7 @@ static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
Handle the DEBUG level list.
***************************************************************************/
-static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
+static bool handle_debug_list(struct loadparm_context *unused, int snum, const char *pszParmValueIn, char **ptr )
{
string_set(ptr, pszParmValueIn);
return debug_parse_levels(pszParmValueIn);
@@ -7706,7 +7706,7 @@ static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue
/***************************************************************************
***************************************************************************/
-static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
+static bool handle_printing(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
{
static int parm_num = -1;
struct loadparm_service *s;
@@ -7840,7 +7840,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
/* if it is a special case then go ahead */
if (parm_table[parmnum].special) {
- return parm_table[parmnum].special(snum, pszParmValue,
+ return parm_table[parmnum].special(NULL, snum, pszParmValue,
(char **)parm_ptr);
}
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index b95a400b34..b1e3a00f4c 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -106,15 +106,15 @@ static bool defaults_saved = false;
/* prototypes for the special type handlers */
-static bool handle_include(struct loadparm_context *lp_ctx,
+static bool handle_include(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr);
-static bool handle_realm(struct loadparm_context *lp_ctx,
+static bool handle_realm(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr);
-static bool handle_copy(struct loadparm_context *lp_ctx,
+static bool handle_copy(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr);
-static bool handle_debuglevel(struct loadparm_context *lp_ctx,
+static bool handle_debuglevel(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr);
-static bool handle_logfile(struct loadparm_context *lp_ctx,
+static bool handle_logfile(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr);
static const struct enum_list enum_protocol[] = {
@@ -1367,7 +1367,7 @@ bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx)
Handle the "realm" parameter
***************************************************************************/
-static bool handle_realm(struct loadparm_context *lp_ctx,
+static bool handle_realm(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr)
{
string_set(lp_ctx, ptr, pszParmValue);
@@ -1385,7 +1385,7 @@ static bool handle_realm(struct loadparm_context *lp_ctx,
Handle the include operation.
***************************************************************************/
-static bool handle_include(struct loadparm_context *lp_ctx,
+static bool handle_include(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr)
{
char *fname = standard_sub_basic(lp_ctx, pszParmValue);
@@ -1406,7 +1406,7 @@ static bool handle_include(struct loadparm_context *lp_ctx,
Handle the interpretation of the copy parameter.
***************************************************************************/
-static bool handle_copy(struct loadparm_context *lp_ctx,
+static bool handle_copy(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr)
{
bool bRetval;
@@ -1436,7 +1436,7 @@ static bool handle_copy(struct loadparm_context *lp_ctx,
return bRetval;
}
-static bool handle_debuglevel(struct loadparm_context *lp_ctx,
+static bool handle_debuglevel(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr)
{
@@ -1447,7 +1447,7 @@ static bool handle_debuglevel(struct loadparm_context *lp_ctx,
return true;
}
-static bool handle_logfile(struct loadparm_context *lp_ctx,
+static bool handle_logfile(struct loadparm_context *lp_ctx, int unused,
const char *pszParmValue, char **ptr)
{
debug_set_logfile(pszParmValue);
@@ -1547,7 +1547,7 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
/* if it is a special case then go ahead */
if (parm_table[parmnum].special) {
bool ret;
- ret = parm_table[parmnum].special(lp_ctx, pszParmValue,
+ ret = parm_table[parmnum].special(lp_ctx, -1, pszParmValue,
(char **)parm_ptr);
if (!ret) {
return false;
diff --git a/source4/param/loadparm.h b/source4/param/loadparm.h
index 7a76321b06..4fc28e7f05 100644
--- a/source4/param/loadparm.h
+++ b/source4/param/loadparm.h
@@ -48,7 +48,8 @@ struct parm_struct {
parm_type type;
parm_class pclass;
int offset;
- bool (*special)(struct loadparm_context *, const char *, char **);
+ bool (*special)(struct loadparm_context *lpcfg_ctx,
+ int snum, const char *, char **);
const struct enum_list *enum_list;
union {
int bvalue;