mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-26 13:45:14 +07:00
service: refuse to parse sysv scripts that are requested with a boot. prefix or .sh suffix
This commit is contained in:
parent
6c666e26c5
commit
d017c6ca11
@ -654,6 +654,12 @@ static int service_load_sysv_name(Service *s, const char *name) {
|
|||||||
assert(s);
|
assert(s);
|
||||||
assert(name);
|
assert(name);
|
||||||
|
|
||||||
|
/* For SysV services we strip the boot. or .sh
|
||||||
|
* prefixes/suffixes. */
|
||||||
|
if (startswith(name, "boot.") ||
|
||||||
|
endswith(name, ".sh.service"))
|
||||||
|
return -ENOENT;
|
||||||
|
|
||||||
STRV_FOREACH(p, UNIT(s)->meta.manager->sysvinit_path) {
|
STRV_FOREACH(p, UNIT(s)->meta.manager->sysvinit_path) {
|
||||||
char *path;
|
char *path;
|
||||||
int r;
|
int r;
|
||||||
@ -667,7 +673,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
|
|||||||
r = service_load_sysv_path(s, path);
|
r = service_load_sysv_path(s, path);
|
||||||
|
|
||||||
if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) {
|
if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) {
|
||||||
/* Try Debian style .sh source'able init scripts */
|
/* Try Debian style xxx.sh source'able init scripts */
|
||||||
strcat(path, ".sh");
|
strcat(path, ".sh");
|
||||||
r = service_load_sysv_path(s, path);
|
r = service_load_sysv_path(s, path);
|
||||||
}
|
}
|
||||||
@ -675,7 +681,7 @@ static int service_load_sysv_name(Service *s, const char *name) {
|
|||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) {
|
if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) {
|
||||||
/* Try Suse style boot.xxxx init scripts */
|
/* Try Suse style boot.xxx init scripts */
|
||||||
|
|
||||||
if (asprintf(&path, "%s/boot.%s", *p, name) < 0)
|
if (asprintf(&path, "%s/boot.%s", *p, name) < 0)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user