mirror of
https://github.com/systemd/systemd.git
synced 2025-03-01 08:58:29 +03:00
Merge pull request #12137 from poettering/socket-var-run
warn about sockets in /var/run/ too
This commit is contained in:
commit
983616735e
3
TODO
3
TODO
@ -69,9 +69,6 @@ Features:
|
|||||||
|
|
||||||
* bootctl,sd-boot: actually honour the "architecture" key
|
* bootctl,sd-boot: actually honour the "architecture" key
|
||||||
|
|
||||||
* when a socket unit is spawned with an AF_UNIX path in /var/run, complain and
|
|
||||||
patch it to use /run instead
|
|
||||||
|
|
||||||
* set memory.oom.group in cgroup v2 for all leaf cgroups (kernel v4.19+)
|
* set memory.oom.group in cgroup v2 for all leaf cgroups (kernel v4.19+)
|
||||||
|
|
||||||
* add a new syscall group "@esoteric" for more esoteric stuff such as bpf() and
|
* add a new syscall group "@esoteric" for more esoteric stuff such as bpf() and
|
||||||
|
@ -312,23 +312,50 @@ int config_parse_unit_path_strv_printf(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = strv_push(x, k);
|
r = strv_consume(x, TAKE_PTR(k));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
k = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_parse_socket_listen(const char *unit,
|
static int patch_var_run(
|
||||||
const char *filename,
|
const char *unit,
|
||||||
unsigned line,
|
const char *filename,
|
||||||
const char *section,
|
unsigned line,
|
||||||
unsigned section_line,
|
const char *lvalue,
|
||||||
const char *lvalue,
|
char **path) {
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
const char *e;
|
||||||
void *data,
|
char *z;
|
||||||
void *userdata) {
|
|
||||||
|
e = path_startswith(*path, "/var/run/");
|
||||||
|
if (!e)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
z = path_join("/run/", e);
|
||||||
|
if (!z)
|
||||||
|
return log_oom();
|
||||||
|
|
||||||
|
log_syntax(unit, LOG_NOTICE, filename, line, 0,
|
||||||
|
"%s= references a path below legacy directory /var/run/, updating %s → %s; "
|
||||||
|
"please update the unit file accordingly.", lvalue, *path, z);
|
||||||
|
|
||||||
|
free_and_replace(*path, z);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int config_parse_socket_listen(
|
||||||
|
const char *unit,
|
||||||
|
const char *filename,
|
||||||
|
unsigned line,
|
||||||
|
const char *section,
|
||||||
|
unsigned section_line,
|
||||||
|
const char *lvalue,
|
||||||
|
int ltype,
|
||||||
|
const char *rvalue,
|
||||||
|
void *data,
|
||||||
|
void *userdata) {
|
||||||
|
|
||||||
_cleanup_free_ SocketPort *p = NULL;
|
_cleanup_free_ SocketPort *p = NULL;
|
||||||
SocketPort *tail;
|
SocketPort *tail;
|
||||||
@ -365,6 +392,12 @@ int config_parse_socket_listen(const char *unit,
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (ltype == SOCKET_FIFO) {
|
||||||
|
r = patch_var_run(unit, filename, line, lvalue, &k);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
free_and_replace(p->path, k);
|
free_and_replace(p->path, k);
|
||||||
p->type = ltype;
|
p->type = ltype;
|
||||||
|
|
||||||
@ -394,6 +427,12 @@ int config_parse_socket_listen(const char *unit,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (k[0] == '/') { /* Only for AF_UNIX file system sockets… */
|
||||||
|
r = patch_var_run(unit, filename, line, lvalue, &k);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
r = socket_address_parse_and_warn(&p->address, k);
|
r = socket_address_parse_and_warn(&p->address, k);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
if (r != -EAFNOSUPPORT)
|
if (r != -EAFNOSUPPORT)
|
||||||
@ -4259,7 +4298,6 @@ int config_parse_pid_file(
|
|||||||
_cleanup_free_ char *k = NULL, *n = NULL;
|
_cleanup_free_ char *k = NULL, *n = NULL;
|
||||||
Unit *u = userdata;
|
Unit *u = userdata;
|
||||||
char **s = data;
|
char **s = data;
|
||||||
const char *e;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
@ -4289,20 +4327,11 @@ int config_parse_pid_file(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
e = path_startswith(n, "/var/run/");
|
r = patch_var_run(unit, filename, line, lvalue, &n);
|
||||||
if (e) {
|
if (r < 0)
|
||||||
char *z;
|
return r;
|
||||||
|
|
||||||
z = strjoin("/run/", e);
|
|
||||||
if (!z)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
log_syntax(unit, LOG_NOTICE, filename, line, 0, "PIDFile= references path below legacy directory /var/run/, updating %s → %s; please update the unit file accordingly.", n, z);
|
|
||||||
|
|
||||||
free_and_replace(*s, z);
|
|
||||||
} else
|
|
||||||
free_and_replace(*s, n);
|
|
||||||
|
|
||||||
|
free_and_replace(*s, n);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user