summaryrefslogtreecommitdiff
path: root/source3/param/loadparm.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-11-22 04:35:36 +0000
committerGerald Carter <jerry@samba.org>2003-11-22 04:35:36 +0000
commit3c101594ddb9b8be9378ddd00c175a1fcf04a577 (patch)
tree944f8060db8b491802dc312236a83e0a54e2eeca /source3/param/loadparm.c
parent1a125f5e402ad433a7192d9c5f5cfbb9593710b0 (diff)
downloadsamba-3c101594ddb9b8be9378ddd00c175a1fcf04a577.tar.gz
samba-3c101594ddb9b8be9378ddd00c175a1fcf04a577.tar.bz2
samba-3c101594ddb9b8be9378ddd00c175a1fcf04a577.zip
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 59e9d6e301c752e99fb6a50204d7941f7f84566a)
Diffstat (limited to 'source3/param/loadparm.c')
-rw-r--r--source3/param/loadparm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 8e6064ab59..b124c6fd3b 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -3310,9 +3310,13 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
if ((char ***)ptr && *(char ***)ptr) {
char **list = *(char ***)ptr;
- for (; *list; list++)
- fprintf(f, "%s%s", *list,
- ((*(list+1))?", ":""));
+ for (; *list; list++) {
+ /* surround strings with whitespace in single quotes */
+ if ( strchr_m( *list, ' ' ) )
+ fprintf(f, "\'%s\'%s", *list, ((*(list+1))?", ":""));
+ else
+ fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
+ }
}
break;