summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-03-12 22:27:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:21 -0500
commitd245d5c0171c918f2d691160aecde43608bf2264 (patch)
tree7aca4be463704aa99faf289c20527ce6ffbaf730 /source3/param
parent06f7ee5d4b9d2f94c0178a0c979f50fa2f96b905 (diff)
downloadsamba-d245d5c0171c918f2d691160aecde43608bf2264.tar.gz
samba-d245d5c0171c918f2d691160aecde43608bf2264.tar.bz2
samba-d245d5c0171c918f2d691160aecde43608bf2264.zip
r14255: Revert r14204 which was horribly broken.
(This used to be commit 950ed28f9f3f57dc449bd3bd6e7be7acb1e3d26d)
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index e285bd6087..97e876a542 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1022,7 +1022,7 @@ static struct parm_struct parm_table[] = {
{"max open files", P_INTEGER, P_GLOBAL, &Globals.max_open_files, NULL, NULL, FLAG_ADVANCED},
{"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
- {"socket options", P_STRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_ADVANCED},
+ {"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_ADVANCED},
{"strict allocate", P_BOOL, P_LOCAL, &sDefault.bStrictAllocate, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
{"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
{"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
@@ -2722,8 +2722,8 @@ void show_parameter_list(void)
BOOL hadFlag;
const char *section_names[] = { "local", "global", NULL};
const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
- "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
- "P_ENUM", "P_SEP"};
+ "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING", "P_GSTRING",
+ "P_UGSTRING", "P_ENUM", "P_SEP"};
unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
FLAG_HIDE, FLAG_DOS_STRING};
@@ -3518,6 +3518,15 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
strupper_m(*(char **)parm_ptr);
break;
+ case P_GSTRING:
+ pstrcpy((char *)parm_ptr, pszParmValue);
+ break;
+
+ case P_UGSTRING:
+ pstrcpy((char *)parm_ptr, pszParmValue);
+ strupper_m((char *)parm_ptr);
+ break;
+
case P_ENUM:
lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
break;
@@ -3596,6 +3605,13 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
}
break;
+ case P_GSTRING:
+ case P_UGSTRING:
+ if ((char *)ptr) {
+ fprintf(f, "%s", (char *)ptr);
+ }
+ break;
+
case P_STRING:
case P_USTRING:
if (*(char **)ptr) {
@@ -3629,6 +3645,16 @@ static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2)
case P_LIST:
return str_list_compare(*(char ***)ptr1, *(char ***)ptr2);
+ case P_GSTRING:
+ case P_UGSTRING:
+ {
+ char *p1 = (char *)ptr1, *p2 = (char *)ptr2;
+ if (p1 && !*p1)
+ p1 = NULL;
+ if (p2 && !*p2)
+ p2 = NULL;
+ return (p1 == p2 || strequal(p1, p2));
+ }
case P_STRING:
case P_USTRING:
{
@@ -3722,6 +3748,10 @@ static BOOL is_default(int i)
case P_USTRING:
return strequal(parm_table[i].def.svalue,
*(char **)parm_table[i].ptr);
+ case P_GSTRING:
+ case P_UGSTRING:
+ return strequal(parm_table[i].def.svalue,
+ (char *)parm_table[i].ptr);
case P_BOOL:
case P_BOOLREV:
return parm_table[i].def.bvalue ==
@@ -4084,6 +4114,14 @@ static void lp_save_defaults(void)
parm_table[i].def.svalue = NULL;
}
break;
+ case P_GSTRING:
+ case P_UGSTRING:
+ if (parm_table[i].ptr) {
+ parm_table[i].def.svalue = SMB_STRDUP((char *)parm_table[i].ptr);
+ } else {
+ parm_table[i].def.svalue = NULL;
+ }
+ break;
case P_BOOL:
case P_BOOLREV:
parm_table[i].def.bvalue =