"ERRNO=%d", error > 0 ? error : EINVAL,
"MESSAGE=[%s:%u] %s", config_file, config_line, msg,
NULL);
- log_info("logged here: '%s': %d", msg, r);
+
return r;
}
ConfigItemLookup lookup,
void *table,
bool relaxed,
+ bool allow_include,
char **section,
char *l,
void *userdata) {
return 0;
if (startswith(l, ".include ")) {
- _cleanup_free_ char *fn;
+ _cleanup_free_ char *fn = NULL;
+
+ if (!allow_include) {
+ log_syntax(unit, LOG_ERR, filename, line, EBADMSG,
+ ".include not allowed here. Ignoring.");
+ return 0;
+ }
fn = file_in_same_dir(filename, strstrip(l+9));
if (!fn)
return -ENOMEM;
- return config_parse(unit, fn, NULL, sections, lookup, table, relaxed, userdata);
+ return config_parse(unit, fn, NULL, sections, lookup, table, relaxed, false, userdata);
}
if (*l == '[') {
ConfigItemLookup lookup,
void *table,
bool relaxed,
+ bool allow_include,
void *userdata) {
- unsigned line = 0;
_cleanup_free_ char *section = NULL, *continuation = NULL;
_cleanup_fclose_ FILE *ours = NULL;
+ unsigned line = 0;
int r;
assert(filename);
lookup,
table,
relaxed,
+ allow_include,
§ion,
p,
userdata);
char **s = data;
char *n;
+ int offset;
assert(filename);
assert(lvalue);
return 0;
}
- if (!path_is_absolute(rvalue)) {
+ offset = rvalue[0] == '-' && (streq(lvalue, "InaccessibleDirectories") ||
+ streq(lvalue, "ReadOnlyDirectories"));
+ if (!path_is_absolute(rvalue + offset)) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
"Not an absolute path, ignoring: %s", rvalue);
return 0;
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
_cleanup_free_ char *n;
+ int offset;
n = strndup(w, l);
if (!n)
continue;
}
- if (!path_is_absolute(n)) {
+ offset = n[0] == '-' && (streq(lvalue, "InaccessibleDirectories") ||
+ streq(lvalue, "ReadOnlyDirectories"));
+ if (!path_is_absolute(n + offset)) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
"Not an absolute path, ignoring: %s", rvalue);
continue;