summaryrefslogtreecommitdiff
path: root/src/shared/install-printf.c
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/shared/install-printf.c
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/shared/install-printf.c')
-rw-r--r--src/shared/install-printf.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index 9996649424..7c25d36931 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -29,30 +29,18 @@
static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
InstallInfo *i = userdata;
- char *n;
assert(i);
- n = unit_name_to_prefix_and_instance(i->name);
- if (!n)
- return -ENOMEM;
-
- *ret = n;
- return 0;
+ return unit_name_to_prefix_and_instance(i->name, ret);
}
static int specifier_prefix(char specifier, void *data, void *userdata, char **ret) {
InstallInfo *i = userdata;
- char *n;
assert(i);
- n = unit_name_to_prefix(i->name);
- if (!n)
- return -ENOMEM;
-
- *ret = n;
- return 0;
+ return unit_name_to_prefix(i->name, ret);
}
static int specifier_instance(char specifier, void *data, void *userdata, char **ret) {