summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-29 15:37:27 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-29 08:57:27 +0200
commit8b04345a0edc0131f6d8449b672278b31bd4b734 (patch)
tree511bd7eb2fdc39e812a4f429578f48bef9d1a642 /source4
parent489f528857bfb4993cf44dd7a5391ac5196c0747 (diff)
downloadsamba-8b04345a0edc0131f6d8449b672278b31bd4b734.tar.gz
samba-8b04345a0edc0131f6d8449b672278b31bd4b734.tar.bz2
samba-8b04345a0edc0131f6d8449b672278b31bd4b734.zip
s4-param Handle BOOLREV parameters
Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Jun 29 08:57:27 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/param/loadparm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index a3c132ba57..a7a0ee2cf4 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2499,6 +2499,16 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
}
break;
+ case P_BOOLREV: {
+ bool b;
+ if (!set_boolean(pszParmValue, &b)) {
+ DEBUG(0,("lp_do_parameter(%s): value is not boolean!\n", pszParmValue));
+ return false;
+ }
+ *(int *)parm_ptr = !b;
+ }
+ break;
+
case P_INTEGER:
*(int *)parm_ptr = atoi(pszParmValue);
break;
@@ -2809,6 +2819,10 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
fprintf(f, "%s", BOOLSTR((bool)*(int *)ptr));
break;
+ case P_BOOLREV:
+ fprintf(f, "%s", BOOLSTR(!(bool)*(int *)ptr));
+ break;
+
case P_INTEGER:
case P_BYTES:
fprintf(f, "%d", *(int *)ptr);
@@ -2852,6 +2866,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
{
switch (type) {
case P_BOOL:
+ case P_BOOLREV:
return (*((int *)ptr1) == *((int *)ptr2));
case P_INTEGER:
@@ -2947,6 +2962,7 @@ static bool is_default(struct loadparm_service *sDefault, int i)
return strequal(parm_table[i].def.svalue,
*(char **)def_ptr);
case P_BOOL:
+ case P_BOOLREV:
return parm_table[i].def.bvalue ==
*(int *)def_ptr;
case P_INTEGER: