1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r14255: Revert r14204 which was horribly broken.

This commit is contained in:
James Peach 2006-03-12 22:27:01 +00:00 committed by Gerald (Jerry) Carter
parent 37b6e2c8de
commit 950ed28f9f
3 changed files with 57 additions and 4 deletions

View File

@ -758,7 +758,7 @@ struct connections_data {
/* the following are used by loadparm for option lists */ /* the following are used by loadparm for option lists */
typedef enum { typedef enum {
P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
P_STRING,P_USTRING,P_ENUM,P_SEP P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP
} parm_type; } parm_type;
typedef enum { typedef enum {

View File

@ -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}, {"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}, {"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 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}, {"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}, {"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; BOOL hadFlag;
const char *section_names[] = { "local", "global", NULL}; const char *section_names[] = { "local", "global", NULL};
const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER", const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
"P_OCTAL", "P_LIST", "P_STRING", "P_USTRING", "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING", "P_GSTRING",
"P_ENUM", "P_SEP"}; "P_UGSTRING", "P_ENUM", "P_SEP"};
unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL, unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED, FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
FLAG_HIDE, FLAG_DOS_STRING}; 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); strupper_m(*(char **)parm_ptr);
break; 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: case P_ENUM:
lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr ); lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
break; break;
@ -3596,6 +3605,13 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
} }
break; break;
case P_GSTRING:
case P_UGSTRING:
if ((char *)ptr) {
fprintf(f, "%s", (char *)ptr);
}
break;
case P_STRING: case P_STRING:
case P_USTRING: case P_USTRING:
if (*(char **)ptr) { if (*(char **)ptr) {
@ -3629,6 +3645,16 @@ static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2)
case P_LIST: case P_LIST:
return str_list_compare(*(char ***)ptr1, *(char ***)ptr2); 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_STRING:
case P_USTRING: case P_USTRING:
{ {
@ -3722,6 +3748,10 @@ static BOOL is_default(int i)
case P_USTRING: case P_USTRING:
return strequal(parm_table[i].def.svalue, return strequal(parm_table[i].def.svalue,
*(char **)parm_table[i].ptr); *(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_BOOL:
case P_BOOLREV: case P_BOOLREV:
return parm_table[i].def.bvalue == return parm_table[i].def.bvalue ==
@ -4084,6 +4114,14 @@ static void lp_save_defaults(void)
parm_table[i].def.svalue = NULL; parm_table[i].def.svalue = NULL;
} }
break; 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_BOOL:
case P_BOOLREV: case P_BOOLREV:
parm_table[i].def.bvalue = parm_table[i].def.bvalue =

View File

@ -275,6 +275,16 @@ static void show_parameter(int snum, struct parm_struct *parm)
_("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue))); _("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
break; break;
case P_GSTRING:
case P_UGSTRING:
push_utf8_allocate(&utf8_s1, (char *)ptr);
printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">",
make_parm_name(parm->label), fix_quotes(utf8_s1));
SAFE_FREE(utf8_s1);
printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">",
_("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue)));
break;
case P_BOOL: case P_BOOL:
printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); printf("<select name=\"parm_%s\">",make_parm_name(parm->label));
printf("<option %s>Yes", (*(BOOL *)ptr)?"selected":""); printf("<option %s>Yes", (*(BOOL *)ptr)?"selected":"");
@ -368,6 +378,11 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte
if (!strcmp(*(char **)ptr,(char *)(parm->def.svalue))) continue; if (!strcmp(*(char **)ptr,(char *)(parm->def.svalue))) continue;
break; break;
case P_GSTRING:
case P_UGSTRING:
if (!strcmp((char *)ptr,(char *)(parm->def.svalue))) continue;
break;
case P_BOOL: case P_BOOL:
case P_BOOLREV: case P_BOOLREV:
if (*(BOOL *)ptr == (BOOL)(parm->def.bvalue)) continue; if (*(BOOL *)ptr == (BOOL)(parm->def.bvalue)) continue;