Samba config grammar

Jelmer Vernooij jelmer at samba.org
Wed Dec 21 11:31:01 MST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/21/2011 07:35 PM, Adam Przybyla wrote:
> On Wed, Dec 21, 2011 at 10:13:07AM -0600, Christopher R. Hertel wrote:
>> Do you mean the grammar of the smb.conf file or the grammar of the
protocol?
> ... grammar of the config file.
The closest thing we have is probably the header of lib/util/params.c in
the source tree.

 *  This module performs lexical analysis and initial parsing of a
 *  Windows-like parameter file.  It recognizes and handles four token
 *  types:  section-name, parameter-name, parameter-value, and
 *  end-of-file.  Comments and line continuation are handled
 *  internally.
 *
 *  The entry point to the module is function pm_process().  This
 *  function opens the source file, calls the Parse() function to parse
 *  the input, and then closes the file when either the EOF is reached
 *  or a fatal error is encountered.
 *
 *  A sample parameter file might look like this:
 *
 *  [section one]
 *  parameter one = value string
 *  parameter two = another value
 *  [section two]
 *  new parameter = some value or t'other
 *
 *  The parameter file is divided into sections by section headers:
 *  section names enclosed in square brackets (eg. [section one]).
 *  Each section contains parameter lines, each of which consist of a
 *  parameter name and value delimited by an equal sign.  Roughly, the
 *  syntax is:
 *
 *    <file>            :==  { <section> } EOF
 *
 *    <section>         :==  <section header> { <parameter line> }
 *
 *    <section header>  :==  '[' NAME ']'
 *
 *    <parameter line>  :==  NAME '=' VALUE '\n'
 *
 *  Blank lines and comment lines are ignored.  Comment lines are lines
 *  beginning with either a semicolon (';') or a pound sign ('#').
 *
 *  All whitespace in section names and parameter names is compressed
 *  to single spaces.  Leading and trailing whitespace is stipped from
 *  both names and values.
 *
 *  Only the first equals sign in a parameter line is significant.
 *  Parameter values may contain equals signs, square brackets and
 *  semicolons.  Internal whitespace is retained in parameter values,
 *  with the exception of the '\r' character, which is stripped for
 *  historic reasons.  Parameter names may not start with a left square
 *  bracket, an equal sign, a pound sign, or a semicolon, because these
 *  are used to identify other tokens.

Cheers,

Jelmer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJO8iXlAAoJEACAbyvXKaRXNwwQAJeB5an8NLtRZAZ7LWXrR0H4
Par1wgttGjU89tXkjppE14HpzEQ8X8jU5yjLmebQve5d4SfIlwZz7JKyOoIYO2YT
YFadeVCdbn/60YVQahxbbhav4iJNc7qtDMXQETZYnvWz8ytkSfNDV0Lfqtu3PHja
uHvOq2pIa86Fq9ZZiNCcd9K4W2caIzxsOn1I+1vEXbuuuEzM2AovK8KY3bWz8thG
jW2awC8brNsT/nolcL3wT22Rm5ZVK4FFVyRSPbyLE+lEyV9t06dwo24d+nuh3mzb
mGpig7xPRwGknUVkz2eXqY2WSNL90+8FXKzZtqZA84CkiAwxZ8jntVqFkI6iHFW8
tB5Ch5j6uHqNTEOEM1otITYXrIGqsaISUhcJvZZebnONEXZejXYl2NYxn1uI1H9G
1AJORIXJRfT+yIC8sfcaFE+7H0qbbqNcvq21agNNVdjAMPPnkFtddDfPwibDC/pz
auZa/2DBgm1k2RXfjfcBQ/6HGoNR3HizN1sImHdzYncP/ihTS+5yV2eMPGSZLx96
/Y/q3nG8XqOLqNL9YTzMwDIwu74QdAJZZfj235pnAs2DwVLY0RJv4t/xHbx6LKhQ
4LJ2TN3N8hP0+hf1MJ8JS8uDc1TCTKv9ETzH9SVZwqHl5Pwjek01QnPBt0H0mfn3
aSGcH4LKE0WnOwB4pCLf
=LRXd
-----END PGP SIGNATURE-----



More information about the samba-technical mailing list