summaryrefslogtreecommitdiffstats
path: root/source3/param
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-28 11:58:55 +1300
committerAndrew Bartlett <abartlet@samba.org>2014-07-07 23:32:36 +0200
commit8947af1bd20638114a32631986325e013bfa0104 (patch)
tree49596931efbcce0a34177694f04da8a64fc447ea /source3/param
parent21d5c667d8538933e4b106394c4e06231813a2e8 (diff)
downloadsamba-8947af1bd20638114a32631986325e013bfa0104.tar.gz
samba-8947af1bd20638114a32631986325e013bfa0104.tar.xz
samba-8947af1bd20638114a32631986325e013bfa0104.zip
param: Use set_variable instead of set_variable_helper in lp_do_parameter
This extends the usage of the temporary s3 context in lp_do_parameter to beyond the special functions. At least for now, this will be necessary for sorting out the differences between the do_parameter code. Change-Id: Iac380d11a927e466ab1a56d34cebe343c3608707 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c53
1 files changed, 14 insertions, 39 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d9e4a91017..af4555c74d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -2576,6 +2576,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
TALLOC_CTX *mem_ctx;
TALLOC_CTX *frame = talloc_stackframe();
bool ok;
+ struct loadparm_context *lp_ctx;
parmnum = lpcfg_map_parameter(pszParmName);
@@ -2644,50 +2645,24 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
mem_ctx = ServicePtrs[snum];
}
- /* if it is a special case then go ahead */
- if (parm_table[parmnum].special) {
- struct loadparm_context *lp_ctx = loadparm_init_s3(frame,
- loadparm_s3_helpers());
- if (lp_ctx == NULL) {
- DEBUG(0, ("loadparm_init_s3 failed\n"));
- TALLOC_FREE(frame);
- return false;
- }
-
- lp_ctx->sDefault = &sDefault;
- lp_ctx->services = ServicePtrs;
- lp_ctx->bInGlobalSection = bInGlobalSection;
- lp_ctx->flags = flags_list;
- ok = parm_table[parmnum].special(lp_ctx, snum, pszParmValue,
- (char **)parm_ptr);
+ lp_ctx = loadparm_init_s3(frame,
+ loadparm_s3_helpers());
+ if (lp_ctx == NULL) {
+ DEBUG(0, ("loadparm_init_s3 failed\n"));
TALLOC_FREE(frame);
-
- if (!ok) {
- return false;
- }
- goto mark_non_default;
+ return false;
}
- TALLOC_FREE(frame);
-
- ok = set_variable_helper(mem_ctx, parmnum, parm_ptr, pszParmName, pszParmValue);
+ lp_ctx->sDefault = &sDefault;
+ lp_ctx->services = ServicePtrs;
+ lp_ctx->bInGlobalSection = bInGlobalSection;
+ lp_ctx->flags = flags_list;
- if (!ok) {
- return false;
- }
+ ok = set_variable(mem_ctx, snum, parmnum, parm_ptr, pszParmName, pszParmValue,
+ lp_ctx, (snum < 0));
+ TALLOC_FREE(frame);
-mark_non_default:
- if (snum < 0 && (flags_list[parmnum] & FLAG_DEFAULT)) {
- flags_list[parmnum] &= ~FLAG_DEFAULT;
- /* we have to also unset FLAG_DEFAULT on aliases */
- for (i=parmnum-1;i>=0 && parm_table[i].offset == parm_table[parmnum].offset;i--) {
- flags_list[i] &= ~FLAG_DEFAULT;
- }
- for (i=parmnum+1;i<num_parameters() && parm_table[i].offset == parm_table[parmnum].offset;i++) {
- flags_list[i] &= ~FLAG_DEFAULT;
- }
- }
- return true;
+ return ok;
}
/***************************************************************************