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
This commit is contained in:
@@ -188,7 +188,7 @@ static int add_dbus(const char *path, const char *fname, const char *type) {
|
||||
}
|
||||
|
||||
if (service) {
|
||||
if (!unit_name_is_valid(service, TEMPLATE_INVALID)) {
|
||||
if (!unit_name_is_valid(service, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {
|
||||
log_warning("Unit name %s is not valid, ignoring.", service);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user