core: enforce user/group name validity also when creating transient units

This commit is contained in:
Lennart Poettering 2016-07-14 19:17:18 +02:00
parent 29206d4619
commit 6f3e79859d
1 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,7 @@
#endif
#include "strv.h"
#include "syslog-util.h"
#include "user-util.h"
#include "utf8.h"
BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
@ -841,6 +842,9 @@ int bus_exec_context_set_transient_property(
if (r < 0)
return r;
if (!isempty(uu) && !valid_user_group_name_or_id(uu))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid user name: %s", uu);
if (mode != UNIT_CHECK) {
if (isempty(uu))
@ -860,6 +864,9 @@ int bus_exec_context_set_transient_property(
if (r < 0)
return r;
if (!isempty(gg) && !valid_user_group_name_or_id(gg))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid group name: %s", gg);
if (mode != UNIT_CHECK) {
if (isempty(gg))