systemd/0006-parse_boolean-require-exact-matches.patch
Stephan Kulow 20ad5f583e Accepting request 242699 from Base:System
- Add patch shut-up-rpmlint-on-var-log-journal.patch to avoid
  rpmlink warning
- Add upstream patches
  0001-bus-proxyd-fix-incorrect-comparison.patch
  0002-shell-completion-prevent-mangling-unit-names.patch
  0003-Always-check-asprintf-return-code.patch
  0004-bash-completion-use-list-unit-files-to-get-all-units.patch
  0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch
  0006-parse_boolean-require-exact-matches.patch
  0007-drop_duplicates-copy-full-BindMount-struct.patch
  0008-shell-completion-prevent-mangling-unit-names-bash.patch
  0009-journald-always-add-syslog-facility-for-messages-com.patch

- Add patch shut-up-rpmlint-on-var-log-journal.patch to avoid
  rpmlink warning
- Add upstream patches
  0001-bus-proxyd-fix-incorrect-comparison.patch
  0002-shell-completion-prevent-mangling-unit-names.patch
  0003-Always-check-asprintf-return-code.patch
  0004-bash-completion-use-list-unit-files-to-get-all-units.patch
  0005-core-only-set-the-kernel-s-timezone-when-the-RTC-run.patch
  0006-parse_boolean-require-exact-matches.patch
  0007-drop_duplicates-copy-full-BindMount-struct.patch
  0008-shell-completion-prevent-mangling-unit-names-bash.patch
  0009-journald-always-add-syslog-facility-for-messages-com.patch

OBS-URL: https://build.opensuse.org/request/show/242699
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=196
2014-07-29 19:21:37 +00:00

49 lines
1.8 KiB
Diff

From 0f625d0b87139fc18cd565c9b6da05c53a0eb7ab Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <ansgar@debian.org>
Date: Sun, 27 Jul 2014 15:19:00 +0200
Subject: [PATCH] parse_boolean: require exact matches
Require exact matches in all cases instead of treating strings
starting with 't' ('f') as true (false).
This is required for config_parse_protect_system to parse ProtectSystem=full
correctly: it uses parse_boolean and only tries a more specific parsing
function if that did not return a valid result. Thus "full" was treated as
"false" before.
---
src/shared/util.c | 4 ++--
src/test/test-util.c | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git src/shared/util.c src/shared/util.c
index 4fda31c..49c17ef 100644
--- src/shared/util.c
+++ src/shared/util.c
@@ -231,9 +231,9 @@ int unlink_noerrno(const char *path) {
int parse_boolean(const char *v) {
assert(v);
- if (streq(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || strcaseeq(v, "on"))
+ if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on"))
return 1;
- else if (streq(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || strcaseeq(v, "off"))
+ else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off"))
return 0;
return -EINVAL;
diff --git src/test/test-util.c src/test/test-util.c
index ed91a67..9a28ef9 100644
--- src/test/test-util.c
+++ src/test/test-util.c
@@ -129,6 +129,7 @@ static void test_parse_boolean(void) {
assert_se(parse_boolean("garbage") < 0);
assert_se(parse_boolean("") < 0);
+ assert_se(parse_boolean("full") < 0);
}
static void test_parse_pid(void) {
--
1.7.9.2