aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/settings.c
Commit message (Collapse)AuthorAgeFilesLines
* settings: Move to a separate folderTobias Brunner2014-05-151-1520/+0
|
* settings: Reduce log verbosity if strongswan.conf does not existTobias Brunner2014-03-311-1/+10
| | | | | In some situations we expect strongswan.conf to not exist, for instance, when running the unit tests before installation.
* settings: Log all errors on level 1Tobias Brunner2014-03-041-4/+3
| | | | Closes #539.
* settings: Avoid conf file parsing beyond allocated bufferThomas Egerer2014-03-031-2/+2
| | | | | | | | | | | | | | | A valgrind analysis of libstrongswan revealed an invalid read of 1 in the function starts_with(). A more thorough analysis proved this to be true and showed that with a specially crafted config file (e.g. a single '#'-character not followed by a newline), the parser might even interpret the random memory contents following the allocated buffer as part of the configuration file. The way the parser is designed, it must be able to skip an inserted '\0' and continue parsing. Since it is not able to skip two '\0' characters, the 'fix' of allocating two more bytes than the size of the parsed file and setting them to '\0' seems to be a safe bet. Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
* settings: Use thread-safe dirname(3)Tobias Brunner2014-02-241-5/+3
|
* settings: Use dirname(3) correctlyTobias Brunner2014-02-241-4/+4
| | | | | | | | dirname(3) may return a pointer to a statically allocated buffer. So freeing the returned value can result to undefined behavior. This was noticed on FreeBSD where it caused very strange crashes. It is also not thread-safe, which will be addressed later.
* settings: Add support to enumerate sections and key/value pairs with fallbacksTobias Brunner2014-02-121-28/+157
|
* settings: Implement subsections and key/value pairs with sorted arraysTobias Brunner2014-02-121-68/+74
| | | | | | Is a bit more memory efficient (also due to lazy instantiation) and lookups for sections with lots of subsections/keys (e.g. charon.plugins) are faster.
* settings: Add method that allows to define fallback sections for other sectionsTobias Brunner2014-02-121-13/+141
| | | | | The fallbacks are currently only used for single value lookups. Enumerators are not affected by them.
* settings: Make print_key() not rely on null-terminated beginning of key bufferTobias Brunner2014-02-121-10/+5
| | | | | The key to print (e.g. until the next .) still has to be null-terminated.
* settings: Allow empty strings in section keyTobias Brunner2014-02-121-23/+31
|
* settings: Add a set_default_str() to set a different default for a keyMartin Willi2013-05-061-0/+21
| | | | | The value is set only if it is not configured in strongswan.conf or has not been set() otherwise.
* Moved settings_t to utils folderTobias Brunner2012-10-241-0/+1227