Martin Willi [Fri, 16 May 2014 09:57:54 +0000 (11:57 +0200)]
enum: Return boolean result for enum_from_name() lookup
Handling the result for enum_from_name() is difficult, as checking for
negative return values requires a cast if the enum type is unsigned. The new
signature clearly differentiates lookup result from lookup value.
Further, this actually allows to convert real -1 enum values, which could not
be distinguished from "not-found" and the -1 return value.
This also fixes several clang warnings where enums are unsigned.
Martin Willi [Thu, 8 May 2014 11:24:03 +0000 (13:24 +0200)]
unbound: Explicitly cast from ldns RR type/class to our types
These definitions are directly derived from the RFC, so it should be safe
to cast them. clang complains about the different types, so cast them
explicitly.
Martin Willi [Thu, 8 May 2014 12:29:16 +0000 (14:29 +0200)]
aes: Remove unused build variants
The AES code historically has different build options for various size/speed
trade-offs. We never made use of them, so just drop the obsolete code. The code
now has four hard-coded fixed tables, both inverse and original.
Tobias Brunner [Thu, 15 May 2014 10:03:25 +0000 (12:03 +0200)]
Merge branch 'settings-parser'
Adds a flex/bison based parser for settings_t. It provides several
improvements over the previous parser e.g. quoted strings (with escape
sequences), unlimited includes, more relaxed newline handling, better
syntax error reporting, and a distinction between empty and unset
values (key = vs. key = "").
Tobias Brunner [Thu, 15 May 2014 09:55:23 +0000 (11:55 +0200)]
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.
Tobias Brunner [Tue, 13 May 2014 08:50:36 +0000 (10:50 +0200)]
settings: Replace deprecated YYLEX_PARAM with %lex-param
With Bison 3.x support for YYLEX_PARAM has been removed and %lex-param
should be used. Unfortunately, that option does not take expressions.
Instead we use a wrapper function that calls the lexer with the proper
scanner object, which should also be backward compatible to older Bison
versions.
Tobias Brunner [Fri, 7 Mar 2014 16:21:19 +0000 (17:21 +0100)]
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.
enumerator: Add enumerator to enumerate files matching a pattern
This enumerator is a wrapper around glob(3). If that function is not
supported NULL is returned. If no files match or an error occurs during
the pattern expansion an error is logged and the enumerator simply returns
no items.
RFC: if GLOB_ERR is not supplied glob returns GLOB_NOMATCH if e.g. the
base directory of the pattern does not exist, which would otherwise
result in an error. This way there is at least a clear error message in
case of a typo.
Tobias Brunner [Tue, 13 May 2014 09:10:11 +0000 (11:10 +0200)]
conf: Fix sorting of options with Python 3
__cmp__() is not supported anymore with Python 3 and cmp() is deprecated.
Instead rich comparisons should be used (only __lt__() is required for
sorting).
Martin Willi [Fri, 25 Apr 2014 09:22:45 +0000 (11:22 +0200)]
swanctl: Change syntax of secrets to accept identities with special chars
Having identity strings in the settings key is problematic, as the parser can't
handle arbitrary characters in it. Further, the space separation makes it
impossible to define identities with spaces.
The new format uses key prefixes, similar to those used in local/remote auth
sections of connections. The secrets section takes subsections with type
prefixes, and each subsection uses "id" prefixes to define an arbitrary
number of identities.