summaryrefslogtreecommitdiffstats
path: root/src/shared/conf-parser.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* conf-parser,login: logs description of error in parsing sizeYu Watanabe2018-07-031-4/+8
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-06-131-1/+1
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* conf-parser: simplify conf_parse_path()Yu Watanabe2018-06-131-6/+2
| | | | Follow-up for 97651797e83d0548aef9f808657d3518d89e5aee.
* conf-parser: add config_parse_permille()Marc Kleine-Budde2018-06-091-0/+31
|
* tree-wide: fix a number of log calls that use %m but have no errno setLennart Poettering2018-06-071-2/+2
| | | | | | | | This is mostly fall-out from d1a1f0aaf0d2f08c60d1e0d32e646439d99f58dc, however some cases are older bugs. There might be more issues lurking, this was a simple grep for "%m" across the tree, with all lines removed that mention "errno" at all.
* conf-parser: fix memleak (#9177)Yu Watanabe2018-06-041-1/+2
| | | | | Fixes CID#1391437. Closes #9180.
* conf-parser: remove redundant utf8-validity checkYu Watanabe2018-06-031-11/+0
|
* conf-parse: use free_and_replace()Yu Watanabe2018-06-031-4/+1
| | | | Also removes unnecessary empty lines.
* conf-parser: reject utf8-invalid linesYu Watanabe2018-06-031-0/+3
|
* conf-parse: use path_simplify_and_warn() in config_parse_path()Yu Watanabe2018-06-031-15/+5
|
* path-util: introduce path_simplify()Yu Watanabe2018-06-031-1/+1
| | | | | | | | The function is similar to path_kill_slashes() but also removes initial './', trailing '/.', and '/./' in the path. When the second argument of path_simplify() is false, then it behaves as the same as path_kill_slashes(). Hence, this also replaces path_kill_slashes() with path_simplify().
* conf-parser: introduce DEFINE_CONFIG_PARSE*() macrosYu Watanabe2018-05-311-28/+1
| | | | | | | | This introduces several macros for defining config parsers. Also this fixes errno in DEFINE_CONFIG_PARSE_ENUM() and _ENUMV() and makes the log level lower when a duplicated item is specified to the settings parsed by the function defined by DEFINE_CONFIG_PARSE_ENUMV().
* conf-parser: add a bit more whitespaceLennart Poettering2018-05-291-1/+5
| | | | | | | | We usually seperate case statements within a switch from each other by empty lines. We also often add an empty line after multi-line function prototypes, let's do so here too Also, no trailing ; after }...
* conf-parser: shorten config_parse_string() by using free_and_strdup() and ↵Lennart Poettering2018-05-171-11/+3
| | | | empty_to_null()
* core: move config_parse_limit() to the generic conf-parser.[ch]Lennart Poettering2018-05-171-0/+40
| | | | | | | That way we can use it in nspawn. Also, while we are at it, let's rename the call config_parse_rlimit(), i.e. insert the "r", to clarify what kind of limit this is about.
* conf-parser: accept trailing backslash at the end of the file (#8941)Filipe Brandenburger2018-05-101-0/+21
| | | | | | | | | This makes it behave the same whether there is a blank line or not at the end of the file. This is also consistent with the behavior of the shell on a shell script that ends on a trailing backslash at the last line. Added tests to test_config_parse(), which only pass if the corresponding change to config_parse() is included.
* util: rename signal_from_string_try_harder() to signal_from_string()Yu Watanabe2018-05-031-1/+1
| | | | | Also this makes the new `signal_from_string()` function reject e.g, `SIG3` or `SIG+5`.
* conf-parse: add a generic config_parse_mtu() conf file parser functionLennart Poettering2018-04-261-0/+35
| | | | | | | It's mostly a wrapper around parse_mtu() but with some nicer logging. The address family is initialized from the "ltype" parameter, so that configuration file parser tables can be easily declare it.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-051-2/+1
|
* conf-parse: small prettificationLennart Poettering2018-03-211-3/+4
| | | | | | Let's use first_word() instead of startswith(), it's more explanatory and a bit more correct. Also, let's use the return value instead of adding +9 when looking for the second part of the directive.
* conf-parser: let's explicitly deprecate .include in unit filesLennart Poettering2018-03-211-0/+4
| | | | | | | | | | | | .include lines are already deprecated somewhat, and for example explicitly not mentioned in the documentation for this reason. Let's get one step further and generatea warning when we encounter them (but still process them). Why are they deprecated? Because they are semantically awful — they complicate stat() based mtime checks for configuration files and they allow arbitrary loops we currently have zero protection against and really shouldn't have to have.
* shared/conf-parser: fix outdated commentZbigniew Jędrzejewski-Szmek2018-03-211-1/+1
|
* systemd-link: Remove UDP Fragmentation Offload support. (#8183)Rosen Penev2018-03-181-0/+31
| | | | | | | | Support was killed in kernel 4.15 as well as ethtool 4.13. Justification was lack of use by drivers and too much of a maintenance burden. https://www.spinics.net/lists/netdev/msg443815.html Also moved config_parse_warn_compat to conf-parser.[ch] to fix compile errors.
* core: drop unnecessary __useless_struct_to_allow_trailing_semicolon__Zbigniew Jędrzejewski-Szmek2018-03-061-2/+1
| | | | | | | | | | | | | | ISO C does not allow empty statements outside of functions, and gcc will warn the trailing semicolons when compiling with -pedantic: warning: ISO C does not allow extra ‘;’ outside of a function [-Wpedantic] But our code cannot compile with -pedantic anyway, at least because warning: ISO C does not support ‘__PRETTY_FUNCTION__’ predefined identifier [-Wpedantic] Without -pedatnic, clang and even old gcc (3.4) generate no warnings about those semicolons, so let's just drop __useless_struct_to_allow_trailing_semicolon__.
* pid1: do not initialize join_controllers by defaultZbigniew Jędrzejewski-Szmek2018-02-191-0/+11
| | | | | We're moving towards unified cgroup hierarchy where this is not necessary. This makes main.c a bit simpler.
* Move config_parse_join_controllers to shared, add testZbigniew Jędrzejewski-Szmek2018-02-191-0/+105
| | | | | | config_parse_join_controllers would free the destination argument on failure, which is contrary to our normal style, where failed parsing has no effect. Moving it to shared also allows a test to be added.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* core: implement /run/systemd/units/-based path for passing unit info from ↵Lennart Poettering2017-11-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PID 1 to journald And let's make use of it to implement two new unit settings with it: 1. LogLevelMax= is a new per-unit setting that may be used to configure log priority filtering: set it to LogLevelMax=notice and only messages of level "notice" and lower (i.e. more important) will be processed, all others are dropped. 2. LogExtraFields= is a new per-unit setting for configuring per-unit journal fields, that are implicitly included in every log record generated by the unit's processes. It takes field/value pairs in the form of FOO=BAR. Also, related to this, one exisiting unit setting is ported to this new facility: 3. The invocation ID is now pulled from /run/systemd/units/ instead of cgroupfs xattrs. This substantially relaxes requirements of systemd on the kernel version and the privileges it runs with (specifically, cgroupfs xattrs are not available in containers, since they are stored in kernel memory, and hence are unsafe to permit to lesser privileged code). /run/systemd/units/ is a new directory, which contains a number of files and symlinks encoding the above information. PID 1 creates and manages these files, and journald reads them from there. Note that this is supposed to be a direct path between PID 1 and the journal only, due to the special runtime environment the journal runs in. Normally, today we shouldn't introduce new interfaces that (mis-)use a file system as IPC framework, and instead just an IPC system, but this is very hard to do between the journal and PID 1, as long as the IPC system is a subject PID 1 manages, and itself a client to the journal. This patch cleans up a couple of types used in journal code: specifically we switch to size_t for a couple of memory-sizing values, as size_t is the right choice for everything that is memory. Fixes: #4089 Fixes: #3041 Fixes: #4441
* conf-parser: reindent some strangely indented function headersLennart Poettering2017-11-131-20/+22
|
* conf-parser: turn three bool function params into a flags fieldsLennart Poettering2017-11-131-54/+50
| | | | | This makes things more readable and fixes some issues with incorrect flag propagation between the various flavours of config_parse().
* conf-parser: simplify things a bit by using strextend()Lennart Poettering2017-11-131-11/+7
|
* conf-parse: remove 4K line length limitLennart Poettering2017-09-231-11/+32
| | | | | | Let's use read_line() to solve our long line limitation. Fixes #3302.
* conf-parser: when the empty string assigned to Personality= reset itLennart Poettering2017-09-141-4/+8
| | | | | Let's support assigning the empty string to reset things in one more place.
* core: don't synthesize empty list when empty string is read in ↵Lennart Poettering2017-09-141-23/+13
| | | | | | | | | config_parse_strv() This was added to make https://bugs.freedesktop.org/show_bug.cgi?id=62558 work, which has long been removed, hence let's revert to the original behaviour and fully flush out the list when an empty string is assigned.
* Merge pull request #6746 from yuwata/parse-empty-stringLennart Poettering2017-09-141-0/+6
|\ | | | | allow to input empty string to config_parse_xxx()
| * shared: allow to input empty string to config_parse_path()Yu Watanabe2017-09-051-0/+6
| | | | | | | | Fixes #6633.
* | exec-util,conf-files: skip non-executable files in execute_directories()Lennart Poettering2017-09-131-2/+2
|/ | | | Fixes: #6787
* core/load-fragment: refuse units with errors in ↵Zbigniew Jędrzejewski-Szmek2017-07-111-5/+11
| | | | | | | RootDirectory/RootImage/DynamicUser Behaviour of the service is completely different with the option off, so the service would probably mess up state on disk and do unexpected things.
* conf-parser: fix wrong argument given to log_syntax_invalid_utf8Ronny Chevalier2017-05-141-1/+1
| | | | | | | | | | The condition is on "word", hence we give word instead of rvalue. An assert would be triggered if !utf8_is_valid(word) is true and rvalue == NULL, since log_syntax_invalid_utf8 calls utf8_escape_invalid which calls assert(str). A test case has been added to test with valid and invalid utf8.
* config parser: Introduce config_parse_ip_portSusant Sahani2017-04-291-0/+37
|
* config parser: Introduce config_parse_uint8Susant Sahani2017-04-251-0/+1
|
* tree-wide: drop unneded WHITESPACE param to extract_first_wordZbigniew Jędrzejewski-Szmek2016-11-051-1/+1
| | | | It's the default, and NULL is shorter.
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2016-10-231-1/+1
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* shared/conf-parser: add config_parse_many which takes strv with dirsZbigniew Jędrzejewski-Szmek2016-09-161-8/+52
| | | | This way we don't have to create a nulstr just to unpack it in a moment.
* tree-wide: rename config_parse_many to …_nulstrZbigniew Jędrzejewski-Szmek2016-09-161-7/+9
| | | | In preparation for adding a version which takes a strv.
* networkd: add options to bridge (#4051)Tobias Jungel2016-08-311-0/+1
| | | | This patch allows to configure AgeingTimeSec, Priority and DefaultPVID for bridge interfaces.
* Use "return log_error_errno" in more places"Zbigniew Jędrzejewski-Szmek2016-07-231-2/+1
|