Having a little trouble with SWAT in Samba 3.0.3.
When an option in smb.conf contains quotes, for example:
add group script = /path/to/addgroupscript "%g"
SWAT will, upon parsing smb.conf, display
add group script = /path/to/addgroupscript
and committing it causes the quoted portion to be dropped in smb.conf.
Note that anything in double quotes (or, rather, after the first double
quote) is dropped. Using single quotes seems to be OK.
In some instances, placing items in quotes is necessary to avoid
breaking things when an item contains spaces.
This problem appears to be with SWAT and not Samba itself. Perhaps the
documentation should say a little more clearly that single quotes are
preferable to double quotes when using SWAT?
I found this in the archives, is it something that needs to be
revisited by the Samba team?:
> List: samba
> Subject: [Samba] [PATCH] Display of quoted parameters in Swat
> From: <dj () 4ict ! com>
> Date: 2002-04-24 8:34:00
>
> Hello,
>
> There is a problem with Swat and it's handling of quoted strings.
> I've tested this on the latest released version of Samba (2.2.3a).
>
> Problem description:
>
> When you put quoted strings into the smb.conf file they are not
> displayed in swat. For example : valid users = @"DOM+Domain
Users" in
> smb.conf will result in @ in swat.
>
> The reason for this is that the in the html form created by swat the
> value of the form item (textfield) is also quoted using ". So the
> result, for example value="@"DOM+Domain Users"" is
wrongly parsed by
> the browsers.
>
> Fix:
>
> I replaced the " quotes in the swat code with ' quotes, the
resulting
> html now is value='@"DOM+Domain Users"' and is correctly
parsed by
> the browsers. I've tested this on Linux with Mozilla 0.9.9, Netscape
> 4.7 and KDE4s 2.2 Konquerer. And on Windows 2K Prof with Mozilla
> 0.9.9 and IE (5.5 I think). They all worked fine in displaying and
> editing quoted and non-quoted parameter values.
>
> Remarks:
>
> When ' is used to quote parameters values this fix won't work of
> course. So either we add to the smb.conf documentation that " is the
> only legal character to quote and test this. Or we add extra code to
> swat that parses quote characters from smb.conf to html coded chars
> ("e;) and back, but i haven't had a change to test if this
would
> work.
>
> As stated, the diff included is against the 2.2.3a sourcecode, and is
> for the source/web/swat.c file. Or the fix could be done manually by
> changing the " character to '.
>
> Regards,
> Tim
>
>
> --
>
> ["swat.c.diff" (TEXT/PLAIN)]
>
> 185c185
>
> < printf("<input type=text size=40 name=\"parm_%s\"
> value=\"%s\">",
>
> ---
> > printf("<input type=text size=40 name=\"parm_%s\"
> value=\'%s\'>",
>
--Jon Johnson
Sutinen Consulting, Inc.
jon@sutinen.com
(360) 270-9317 cell