|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
From 7802260b72f064fedf744f1071cd80123c3499d4 Mon Sep 17 00:00:00 2001
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
Date: Wed, 11 Sep 2013 21:50:16 -0400
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
Subject: [PATCH] Allow tabs in environment files
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
bash allows them, and so should we.
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
string_has_cc is changed to allow tabs, and if they are not wanted,
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
they must be now checked for explicitly. There are two other callers,
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
apart from the env file loaders, and one already checked anyway, and
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
the other is changed to check.
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
https://bugs.freedesktop.org/show_bug.cgi?id=68592
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
https://bugs.gentoo.org/show_bug.cgi?id=481554
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
Conflicts:
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
src/test/test-fileio.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
---
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
src/hostname/hostnamed.c | 3 ++-
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
src/shared/util.c | 4 ++++
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
2 files changed, 6 insertions(+), 1 deletion(-)
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
index 0437e33..6a43aeb 100644
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
--- a/src/hostname/hostnamed.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+++ b/src/hostname/hostnamed.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
@@ -553,7 +553,8 @@ static DBusHandlerResult hostname_message_handler(
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
* safe than sorry */
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
if (k == PROP_ICON_NAME && !filename_is_safe(name))
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
return bus_send_error_reply(connection, message, NULL, -EINVAL);
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
- if (k == PROP_PRETTY_HOSTNAME && string_has_cc(name))
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+ if (k == PROP_PRETTY_HOSTNAME &&
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+ (string_has_cc(name) || chars_intersect(name, "\t")))
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
return bus_send_error_reply(connection, message, NULL, -EINVAL);
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
if (k == PROP_CHASSIS && !valid_chassis(name))
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
return bus_send_error_reply(connection, message, NULL, -EINVAL);
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
diff --git a/src/shared/util.c b/src/shared/util.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
index 7f633a3..acf4ca2 100644
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
--- a/src/shared/util.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+++ b/src/shared/util.c
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
@@ -5328,6 +5328,10 @@ bool string_is_safe(const char *p) {
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
return true;
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
}
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+/**
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+ * Check if a string contains control characters.
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+ * Spaces and tabs are not considered control characters.
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
+ */
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
bool string_has_cc(const char *p) {
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
const char *t;
|
|
![](https://seccdn.libravatar.org/avatar/74d2a4e8b5849d63c6838ef3fb9772b27447d57f0ac32af5cd03096343616233?s=16&d=retro) |
46a556f |
|