summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/param/loadparm.c28
-rw-r--r--source4/script/mks3param.pl4
2 files changed, 30 insertions, 2 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 18e2df1c70..b18f8fc429 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -1311,6 +1311,9 @@ struct loadparm_context {
struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx)
{
+ if (lp_ctx->s3_fns) {
+ return lp_ctx->s3_fns->get_default_loadparm_service();
+ }
return lp_ctx->sDefault;
}
@@ -1428,6 +1431,9 @@ static struct loadparm_context *global_loadparm_context;
return lp_ctx->globals->var_name; \
}
+/* Local parameters don't need the ->s3_fns because the struct
+ * loadparm_service is shared and lpcfg_service() checks the ->s3_fns
+ * hook */
#define FN_LOCAL_STRING(fn_name,val) \
_PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \
struct loadparm_service *sDefault) { \
@@ -2079,6 +2085,10 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx
{
int iService;
+ if (lp_ctx->s3_fns) {
+ return lp_ctx->s3_fns->get_service(pszServiceName);
+ }
+
for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--)
if (lp_ctx->services[iService] != NULL &&
strwicmp(lp_ctx->services[iService]->szService, pszServiceName) == 0) {
@@ -2724,9 +2734,15 @@ bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
const char *pszParmValue)
{
- int parmnum = map_parameter(pszParmName);
+ int parmnum;
int i;
+ if (lp_ctx->s3_fns) {
+ return lp_ctx->s3_fns->set_cmdline(pszParmName, pszParmValue);
+ }
+
+ parmnum = map_parameter(pszParmName);
+
while (isspace((unsigned char)*pszParmValue)) pszParmValue++;
@@ -3544,6 +3560,10 @@ bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename)
int lpcfg_numservices(struct loadparm_context *lp_ctx)
{
+ if (lp_ctx->s3_fns) {
+ return lp_ctx->s3_fns->get_numservices();
+ }
+
return lp_ctx->iNumServices;
}
@@ -3579,8 +3599,12 @@ void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *servic
}
struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
- int snum)
+ int snum)
{
+ if (lp_ctx->s3_fns) {
+ return lp_ctx->s3_fns->get_servicebynum(snum);
+ }
+
return lp_ctx->services[snum];
}
diff --git a/source4/script/mks3param.pl b/source4/script/mks3param.pl
index dee3da192f..761cd6980f 100644
--- a/source4/script/mks3param.pl
+++ b/source4/script/mks3param.pl
@@ -89,6 +89,10 @@ sub print_header($$)
$file->("\tstruct parm_struct * (*get_parm_struct)(const char *param_name);\n");
$file->("\tvoid * (*get_parm_ptr)(struct loadparm_service *service, struct parm_struct *parm);\n");
$file->("\tstruct loadparm_service * (*get_service)(const char *service_name);\n");
+ $file->("\tstruct loadparm_service * (*get_default_loadparm_service)(void);\n");
+ $file->("\tstruct loadparm_service * (*get_servicebynum)(int snum);\n");
+ $file->("\tint (*get_numservices)(void);\n");
+ $file->("\tbool (*set_cmdline)(const char *pszParmName, const char *pszParmValue);\n");
}
sub print_footer($$)