Commit Graph

14 Commits

Author SHA1 Message Date
Tobias Brunner 71dca60c31 settings: Don't allow dots in section/key names anymore
This requires config changes if filelog is used with a path that
contains dots. This path must now be defined in the `path` setting of an
arbitrarily named subsection of `filelog`.  Without that change the
whole strongswan.conf file will fail to load, which some users might
not notice immediately.
2018-09-11 18:30:18 +02:00
Tobias Brunner 35ca6a7b2f settings: Add reference feature
Similar to the `also` keyword in ipsec.conf, the new syntax allows adding
one or more references to other sections, which means all the settings and
subsections defined there are inherited (values may be overridden, even
with an empty value to clear it).

It's important to note that all subsections are inherited, so if this is
used to reference a connection in swanctl.conf all auth rounds and
children are inherited.  There is currently no syntax to limit the
inclusion level or clear inherited sections (but as mentioned, settings
in those inherited sections may be overridden).

Another property is that inherited settings or sections always follow
explicitly defined entries in the current section when they are enumerated.
This is relevant if the order is important (e.g. for auth rounds if `round`
is not specified).

References are evaluated dynamically at runtime, so referring to
sections later in the config file or included via other files is no
problem.

The colon used as separator to reference other sections may be used in
section names by writing :: (e.g. for Windows log file paths).

This is based on a patch originally written in 2016.
2018-06-27 14:19:35 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner 740133b12d settings: Parse assigned values in a different context
This allows us to accept characters like = or { without having to use
quoted strings.  And we can also properly warn about unexpected quoted
strings.
2018-05-23 12:01:50 +02:00
Tobias Brunner f8c20fb1c2 settings: Support CRLF in settings parser 2018-05-23 12:01:45 +02:00
Tobias Brunner 0dba2690c4 settings: Extend parser so we can parse settings from a string 2015-07-28 13:27:32 +02:00
Tobias Brunner 764960e8b9 settings: Add support for multi-line strings
Unterminated strings are now an error.
2015-07-28 13:27:32 +02:00
Tobias Brunner 9577b2d148 settings: Don't replace rarely used special characters 2015-07-28 13:27:31 +02:00
Tobias Brunner d148c7ab6c settings: Merge quoted strings that span multiple lines 2015-03-20 18:37:22 +01:00
Tobias Brunner b3dd0168f1 settings: Properly match } and # in include statements
Found due to %option nodefault.  A match for } was actually missing
and # was not properly matched if it was part of an include statement
on the last line of a file that did not end with a newline.
2014-05-15 12:03:07 +02:00
Tobias Brunner c92d44f2cf settings: Eliminate performance warning
This was useful during development, but we accept that matching \n together
with %option yylineno impacts performance.
2014-05-15 12:03:07 +02:00
Tobias Brunner 66248396c6 parser-helper: Make parser_helper_file_t private 2014-05-15 11:28:10 +02:00
Tobias Brunner 813e510d69 settings: Include generated header after others
Newer Bison versions declare the parser function in the header, which
requires custom types.
2014-05-15 11:28:09 +02:00
Tobias Brunner 1f669078ac settings: Add flex/bison based parser for strongswan.conf
This parser features several improvements over the existing one.
For instance, quoted strings (with escape sequences), unlimited includes,
relaxed newline handling (e.g. at the end of files or before/after { and }),
and the difference between empty and unset values (key = vs. key = "").

It also complains a lot more about invalid syntax. The current one accepts
pretty odd stuff (like settings or sections without name) without any
errors or warnings.
2014-05-15 11:28:06 +02:00