summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-30 20:21:00 +0200
committerLennart Poettering <lennart@poettering.net>2015-05-05 15:06:42 -0700
commit7410616cd9dbbec97cf98d75324da5cda2b2f7a2 (patch)
tree6d968995b3bdf961603ab4853bf078c0dbdce27c /src/login
parent6442185ab674cc202d63c18605057b9a51ca2722 (diff)
core: rework unit name validation and manipulation logic
A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-user.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index b00e9b17dc..71bff96728 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -378,7 +378,7 @@ static int user_start_slice(User *u) {
char lu[DECIMAL_STR_MAX(uid_t) + 1], *slice;
sprintf(lu, UID_FMT, u->uid);
- r = build_subslice(SPECIAL_USER_SLICE, lu, &slice);
+ r = slice_build_subslice(SPECIAL_USER_SLICE, lu, &slice);
if (r < 0)
return r;
@@ -411,9 +411,9 @@ static int user_start_service(User *u) {
char lu[DECIMAL_STR_MAX(uid_t) + 1], *service;
sprintf(lu, UID_FMT, u->uid);
- service = unit_name_build("user", lu, ".service");
- if (!service)
- return log_oom();
+ r = unit_name_build("user", lu, ".service", &service);
+ if (r < 0)
+ return log_error_errno(r, "Failed to build service name: %m");
r = manager_start_unit(u->manager, service, &error, &job);
if (r < 0) {