summaryrefslogtreecommitdiff
path: root/src/shared/conf-parser.c
Commit message (Collapse)AuthorAge
* util: unify how we parse mode_t stringsLennart Poettering2017-03-14
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* networkd: make IP forwarding for IPv4 and IPv6 individually configurableLennart Poettering2015-01-13
|
* conf-parse: make syntax logging functions behave more like other log functonsLennart Poettering2015-01-07
| | | | | | | In particular, don't patch the error number to EINVAL if 0, and don't negate it. (Also, add do {} while (false) around multi-line macro)
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-28
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* log: fix order of log_unit_struct() to match other logging callsLennart Poettering2014-11-28
| | | | | Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
* log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering2014-11-27
| | | | | | | | | | | | | | | | | | | | log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
* logind: Support logind.conf.d directories in the usual search pathsJosh Triplett2014-11-26
| | | | | | | | | | | This makes it possible to drop in logind configuration snippets from a package or other configuration management mechanism. Add documentation to the header of /etc/logind.conf pointing the user at /etc/logind.conf.d/*.conf. Introduce a new helper, conf_parse_many, to parse configuration files in a search path.
* config-parser: fix mem leakThomas Hindoe Paaboel Andersen2014-08-31
|
* Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | $ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek2014-07-16
| | | | | | | | Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
* Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek2014-07-15
|
* Do not unescape unit names in [Install] sectionMichal Sekletar2014-05-26
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=49316
* conf-parser: never consider it an error if we cannot load a drop-in file ↵Lennart Poettering2014-05-22
| | | | | | because it is missing After all, we want to be able to boot with /etc empty one day...
* conf-parser: silently ignore sections starting with "X-"Michael Marineau2014-05-17
| | | | | This allows external tools to keep additional unit information in a separate section without scaring users with a big warning.
* Do not print invalid UTF-8 in error messagesZbigniew Jędrzejewski-Szmek2014-03-04
| | | | | Inexplicably, 550a40ec ('core: do not print invalid utf-8 in error messages') only fixed two paths. Convert all of them now.
* Introduce strv_consume which takes ownershipZbigniew Jędrzejewski-Szmek2014-03-04
| | | | This mirrors set_consume and makes the common use a bit nicer.
* conf-parser: minor optimization in config_parse_string()Lennart Poettering2014-03-03
|
* conf-parser: drop special casing in config_parse_path()Lennart Poettering2014-03-03
| | | | | | The code checked for two lvalues that aren't even using config_parse_path(), so let's drop these checks and make the function completely generic again.
* conf-parser: config_parse_path_strv() is not generic, so let's move it into ↵Lennart Poettering2014-03-03
| | | | | | | load-fragment.c The parse code actually checked for specific lvalue names, which is really wrong for supposedly generic parsers...
* core: move config_parse_set_status() into load-fragment.cLennart Poettering2014-03-03
| | | | | Let's keep specific config parsers close to where they are needed. Only the really generic ones should be defined in conf-parser.[ch].
* core: move ShowStatus type into the coreLennart Poettering2014-03-03
| | | | | Let's make the scope of the show-status stuff a bit smaller, and make it private to the core, rather than shared API in shared/.
* conf-parse: rename config_parse_level() to config_parse_log_level()Lennart Poettering2014-03-03
| | | | | "level" is a bit too generic, let's clarify what kind of level we are referring to here.
* core: clean up some confusing regarding SI decimal and IEC binary suffixes ↵Lennart Poettering2014-02-23
| | | | | | | | | | | for sizes According to Wikipedia it is customary to specify hardware metrics and transfer speeds to the basis 1000 (SI decimal), while software metrics and physical volatile memory (RAM) sizes to the basis 1024 (IEC binary). So far we specified everything in IEC, let's fix that and be more true to what's otherwise customary. Since we don't want to parse "Mi" instead of "M" we document each time what the context used is.
* man: don't document ".include" in configuration files anymore as first step ↵Lennart Poettering2014-02-21
| | | | to deprecate them one day
* conf-parser: warn when we open configuration files with weird access bitsLennart Poettering2014-02-03
|
* manager: add systemd.show_status=auto modeZbigniew Jędrzejewski-Szmek2014-01-27
| | | | | | | | | | | | | When set to auto, status will shown when the first ephemeral message is shown (a job has been running for five seconds). Then until the boot or shutdown ends, status messages will be shown. No indication about the switch is done: I think it should be clear for the user that first the cylon eye and the ephemeral messages appear, and afterwards messages are displayed. The initial arming of the event source was still wrong, but now should really be fixed.
* conf-parser: distinguish between multiple sections with the same nameTom Gundersen2013-11-25
| | | | | | | | | | | | | | | | | | | | | | | Pass on the line on which a section was decleared to the parsers, so they can distinguish between multiple sections (if they chose to). Currently no parsers take advantage of this, but a follow-up patch will do that to distinguish [Address] Address=192.168.0.1/24 Label=one [Address] Address=192.168.0.2/24 Label=two from [Address] Address=192.168.0.1/24 Label=one Address=192.168.0.2/24 Label=two
* conf-parser: don't leak section namesTom Gundersen2013-11-20
| | | | | If we encounter an unknown section, we must free the previous section before clearing the pointer.
* Remove dead code and unexport some callsLennart Poettering2013-11-08
| | | | | | "make check-api-unused" informs us about code that is not used anymore or that is exported but only used internally. Fix these all over the place.
* udev: link-config - add proper parsingTom Gundersen2013-10-29
|
* "-" prefix for InaccessibleDirectories and ReadOnlyDirectoriesMaciej Wereski2013-08-23
|
* conf-parser: restrict .include usageLennart Poettering2013-04-25
| | | | | Disallow recursive .include, and make it unavailable in anything but unit files.
* move _cleanup_ attribute in front of the typeHarald Hoyer2013-04-18
| | | | http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
* Report about syntax errors with metadataZbigniew Jędrzejewski-Szmek2013-04-17
| | | | | | | | | | | | | The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
* conf-parser: generate 7 parsing functions from a macroZbigniew Jędrzejewski-Szmek2013-04-17
| | | | | | | Those functions were identical, apart from typos. Log message is modified to contain the type of destination var (int, double, ...). I think this might make it easier to understand why a value was rejected (e.g. a minus from an unsigned type).
* fileio: in envfiles, do not skip lines following empty linesZbigniew Jędrzejewski-Szmek2013-04-13
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=63477
* Use _cleanup_ when reading config filesZbigniew Jędrzejewski-Szmek2013-04-05
|
* util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering2013-04-03
| | | | | | | | Internally we store all time values in usec_t, however parse_usec() actually was used mostly to parse values in seconds (unless explicit units were specified to define a different unit). Hence, be clear about this and name the function about what we pass into it, not what we get out of it.
* conf-parser: when we parse a string list, always fill in somethingLennart Poettering2013-03-23
| | | | | | | | Some code really wants to know whether there was a string list parsed, so don't take the shortcut here, and always allocate a string list, even if it is an empty one. https://bugs.freedesktop.org/show_bug.cgi?id=62558
* bootchart: use conf-parser & CamelCase names in .confThomas Hindoe Paaboel Andersen2013-02-14
|
* core: properly validate environment data from Environment= lines in unit filesLennart Poettering2013-02-11
|
* units: for all unit settings that take lists, allow the empty string for ↵Lennart Poettering2013-01-17
| | | | | | resetting the lists https://bugzilla.redhat.com/show_bug.cgi?id=756787
* shared, libsystemd-daemon: check for empty strings in strto*l conversionsMichal Schmidt2012-10-30
| | | | | | | | strtol() and friends may set EINVAL if no conversion was performed, but they are not required to do so. In practice they don't. We need to check for it. https://bugzilla.redhat.com/show_bug.cgi?id=870577
* conf-parser: don't unescape parsed configuration strings by defaultLennart Poettering2012-09-17
| | | | | | | | | | In many cases this might have a negative effect since we drop escaping from strings where we better shouldn't have dropped it. If unescaping makes sense for some settings we can readd it later again, on a per-case basis. https://bugs.freedesktop.org/show_bug.cgi?id=54522
* conf-parser: make parsing exit status lists non-fatalLennart Poettering2012-08-16
|
* conf-parser: simplify a few things by using set_ensure_allocated() rather ↵Lennart Poettering2012-08-14
| | | | than set_new()
* service: add options RestartPreventExitStatus and SuccessExitStatusLukas Nykryn2012-08-14
| | | | | | | | | In some cases, like wrong configuration, restarting after error does not help, so administrator can specify statuses by RestartPreventExitStatus which will not cause restart of a service. Sometimes you have non-standart exit status, so this can be specified by SuccessfulExitStatus.