summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-22 18:01:26 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-22 18:01:26 +0100
commit737732a41e5702540f51c760bebd3b8152c04727 (patch)
tree79db5c5a879606ef485d8b25d0e504602a932d8c
parentaa3c5cf8eefa36a3ae727fe136587381e590d333 (diff)
hostnamed: pretty_string_is_safe() already exists in string_has_cc(), so use that
-rw-r--r--src/hostname/hostnamed.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 25e154b224..859b5a0784 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -159,19 +159,6 @@ static bool valid_chassis(const char *chassis) {
chassis);
}
-static bool pretty_string_is_safe(const char *p) {
- const char *t;
-
- assert(p);
-
- for (t = p; *t; t++) {
- if (*t >= '\0' && *t < ' ')
- return false;
- }
-
- return true;
-}
-
static const char* fallback_chassis(void) {
int r;
char *type;
@@ -566,7 +553,7 @@ static DBusHandlerResult hostname_message_handler(
* safe than sorry */
if (k == PROP_ICON_NAME && !filename_is_safe(name))
return bus_send_error_reply(connection, message, NULL, -EINVAL);
- if (k == PROP_PRETTY_HOSTNAME && !pretty_string_is_safe(name))
+ if (k == PROP_PRETTY_HOSTNAME && string_has_cc(name))
return bus_send_error_reply(connection, message, NULL, -EINVAL);
if (k == PROP_CHASSIS && !valid_chassis(name))
return bus_send_error_reply(connection, message, NULL, -EINVAL);