1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

Merge pull request #28079 from Geass-LL/comment

basic/env-file: also change to state PRE_KEY if we see NEWLINE in sta…
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2023-06-21 01:40:36 +02:00 committed by GitHub
commit c7d56f04fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 4 deletions

6
NEWS
View File

@ -2,6 +2,12 @@ systemd System and Service Manager
CHANGES WITH 254 in spe:
Announcements of Future Feature Removals and Incompatible Changes:
* EnvironmentFile now treats the line following a comment line trailing
with escape as a non comment line. For details, see:
https://github.com/systemd/systemd/issues/27975
Security relevant changes:
* pam_systemd will now by default pass the CAP_WAKE_ALARM ambient

View File

@ -243,7 +243,13 @@ static int parse_env_file_internal(
break;
case COMMENT_ESCAPE:
state = COMMENT;
log_debug("The line which doesn't begin with \";\" or \"#\", but follows a comment" \
" line trailing with escape is now treated as a non comment line since v254.");
if (strchr(NEWLINE, c)) {
state = PRE_KEY;
line++;
} else
state = COMMENT;
break;
}
}

View File

@ -31,9 +31,10 @@
#define env_file_3 \
"#SPAMD_ARGS=\"-d --socketpath=/var/lib/bulwark/spamd \\\n" \
"#--nouser-config \\\n" \
"normal=line \\\n" \
"normal1=line\\\n" \
"111\n" \
";normal=ignored \\\n" \
"normal_ignored \\\n" \
"normal2=line222\n" \
"normal ignored \\\n"
#define env_file_4 \
@ -89,7 +90,9 @@ TEST(load_env_file_3) {
_cleanup_strv_free_ char **data = NULL;
assert_se(load_env_file(NULL, name, &data) == 0);
assert_se(data == NULL);
assert_se(streq(data[0], "normal1=line111"));
assert_se(streq(data[1], "normal2=line222"));
assert_se(data[2] == NULL);
}
TEST(load_env_file_4) {