summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/loadparm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 6e7716b1f2..3d079f3e3e 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2228,6 +2228,44 @@ static void dump_a_service(service * pService, FILE * f)
}
}
+BOOL lp_dump_a_parameter(int snum, char *parm_name, FILE * f, BOOL isGlobal)
+{
+ service * pService = ServicePtrs[snum];
+ int i, result = False;
+ parm_class p_class;
+ unsigned flag = 0;
+
+ if (isGlobal) {
+ p_class = P_GLOBAL;
+ flag = FLAG_GLOBAL;
+ } else
+ p_class = P_LOCAL;
+
+ for (i = 0; parm_table[i].label; i++) {
+ if (strwicmp(parm_table[i].label, parm_name) == 0 &&
+ (parm_table[i].class == p_class || parm_table[i].flags & flag) &&
+ parm_table[i].ptr &&
+ (*parm_table[i].label != '-') &&
+ (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
+ {
+ void *ptr;
+
+ if (isGlobal)
+ ptr = parm_table[i].ptr;
+ else
+ ptr = ((char *)pService) +
+ PTR_DIFF(parm_table[i].ptr, &sDefault);
+
+ print_parameter(&parm_table[i],
+ ptr, f);
+ fprintf(f, "\n");
+ result = True;
+ break;
+ }
+ }
+
+ return result;
+}
/***************************************************************************
Return info about the next service in a service. snum==-1 gives the globals.