From 11f4893145f94c85b4f1268544a84116d3a38751 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 22 Nov 2003 04:33:36 +0000 Subject: Ensure that items in a list of strings containing whitespace are written out surrounded by single quotes. This means that both double and single quotes are now used to surround strings in smb.conf. This is a slight change from the previous behavior but needed or else things like printer admin = +ntadmin, 'VALE\Domain, Admin' get written to smb.conf by SWAT. (This used to be commit 5bf91c79d620e34ac71d72c80f74e47754d49dcb) --- source3/web/swat.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source3/web') diff --git a/source3/web/swat.c b/source3/web/swat.c index f4046b46a2..1faef46e25 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -212,7 +212,11 @@ static void show_parameter(int snum, struct parm_struct *parm) if ((char ***)ptr && *(char ***)ptr && **(char ***)ptr) { char **list = *(char ***)ptr; for (;*list;list++) { - d_printf("%s%s", *list, ((*(list+1))?" ":"")); + /* enclose in quotes if the string contains a space */ + if ( strchr_m(*list, ' ') ) + d_printf("\'%s\'%s", *list, ((*(list+1))?", ":"")); + else + d_printf("%s%s", *list, ((*(list+1))?", ":"")); } } d_printf("\">"); @@ -221,7 +225,11 @@ static void show_parameter(int snum, struct parm_struct *parm) if (parm->def.lvalue) { char **list = (char **)(parm->def.lvalue); for (; *list; list++) { - d_printf("%s%s", *list, ((*(list+1))?" ":"")); + /* enclose in quotes if the string contains a space */ + if ( strchr_m(*list, ' ') ) + d_printf("\'%s\'%s", *list, ((*(list+1))?", ":"")); + else + d_printf("%s%s", *list, ((*(list+1))?", ":"")); } } d_printf("\'\">"); -- cgit