diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-07-07 20:33:55 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-07-08 11:23:23 +0200 |
commit | 6b2749f8a9f527c1d52ba76566c661cab30b59c6 (patch) | |
tree | e2a07d6c5bd59d387c27ebd926841dad701f9a01 /source4/param | |
parent | 198ad4df31e5e4ab177d0abb851cb5c0c527f8d4 (diff) | |
download | samba-6b2749f8a9f527c1d52ba76566c661cab30b59c6.tar.gz samba-6b2749f8a9f527c1d52ba76566c661cab30b59c6.tar.bz2 samba-6b2749f8a9f527c1d52ba76566c661cab30b59c6.zip |
param: Add hooks to s3 parm_struct and the parameters void * pointer
This is to that the pyparam hooks can use the hooks to connect with
the s3 loadparm system. This now also includes per-service
parameters.
Andrew Bartlett
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/loadparm.c | 31 | ||||
-rw-r--r-- | source4/param/param.h | 3 | ||||
-rw-r--r-- | source4/param/pyparam.c | 4 |
3 files changed, 21 insertions, 17 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index eafe8333ea..0a71d02771 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -1311,14 +1311,6 @@ struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx) return lp_ctx->sDefault; } -/* - return the parameter table -*/ -struct parm_struct *lpcfg_parm_table(void) -{ - return parm_table; -} - /** * Convenience routine to grab string parameters into temporary memory * and run standard_sub_basic on them. @@ -1597,8 +1589,7 @@ const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx, return NULL; if (lp_ctx->s3_fns) { - SMB_ASSERT(service == NULL); - return lp_ctx->s3_fns->get_parametric(type, option); + return lp_ctx->s3_fns->get_parametric(service, type, option); } data = (service == NULL ? lp_ctx->globals->param_opt : service->param_opt); @@ -2047,9 +2038,15 @@ static int map_parameter(const char *pszParmName) /** return the parameter structure for a parameter */ -struct parm_struct *lpcfg_parm_struct(const char *name) +struct parm_struct *lpcfg_parm_struct(struct loadparm_context *lp_ctx, const char *name) { - int parmnum = map_parameter(name); + int parmnum; + + if (lp_ctx->s3_fns) { + return lp_ctx->s3_fns->get_parm_struct(name); + } + + parmnum = map_parameter(name); if (parmnum == -1) return NULL; return &parm_table[parmnum]; } @@ -2060,6 +2057,10 @@ struct parm_struct *lpcfg_parm_struct(const char *name) void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx, struct loadparm_service *service, struct parm_struct *parm) { + if (lp_ctx->s3_fns) { + return lp_ctx->s3_fns->get_parm_ptr(service, parm); + } + if (service == NULL) { if (parm->p_class == P_LOCAL) return ((char *)lp_ctx->sDefault)+parm->offset; @@ -3058,7 +3059,7 @@ bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx, struct parm_struct *parm; void *ptr; - parm = lpcfg_parm_struct(parm_name); + parm = lpcfg_parm_struct(lp_ctx, parm_name); if (!parm) { return false; } @@ -3580,6 +3581,10 @@ struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx, int iService; char *serviceName; + if (lp_ctx->s3_fns) { + return lp_ctx->s3_fns->get_service(service_name); + } + for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--) { if (lp_ctx->services[iService] && lp_ctx->services[iService]->szService) { diff --git a/source4/param/param.h b/source4/param/param.h index ebf41f7213..02837c56d9 100644 --- a/source4/param/param.h +++ b/source4/param/param.h @@ -68,7 +68,6 @@ int lpcfg_server_role(struct loadparm_context *); void reload_charcnv(struct loadparm_context *lp_ctx); struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx); -struct parm_struct *lpcfg_parm_table(void); char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *); @@ -117,7 +116,7 @@ bool lpcfg_add_home(struct loadparm_context *lp_ctx, bool lpcfg_add_printer(struct loadparm_context *lp_ctx, const char *pszPrintername, struct loadparm_service *default_service); -struct parm_struct *lpcfg_parm_struct(const char *name); +struct parm_struct *lpcfg_parm_struct(struct loadparm_context *lp_ctx, const char *name); void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx, struct loadparm_service *service, struct parm_struct *parm); bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx); diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index cab009746d..c07892cc54 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -73,7 +73,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha return PyString_FromString(value); } - parm = lpcfg_parm_struct(param_name); + parm = lpcfg_parm_struct(lp_ctx, param_name); if (parm == NULL || parm->p_class == P_GLOBAL) { return NULL; } @@ -93,7 +93,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha return PyString_FromString(value); } else { /* its a global parameter */ - parm = lpcfg_parm_struct(param_name); + parm = lpcfg_parm_struct(lp_ctx, param_name); if (parm == NULL) { return NULL; } |