mirror of
https://github.com/systemd/systemd
synced 2026-03-14 09:04:47 +01:00
Compare commits
30 Commits
fd7d8bf105
...
84e492cdba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84e492cdba | ||
|
|
00473ac804 | ||
|
|
3d396b2837 | ||
|
|
d8c1422439 | ||
|
|
d6eaee6e74 | ||
|
|
5971630cf6 | ||
|
|
f0373df1a7 | ||
|
|
c191e09230 | ||
|
|
52a89a5f08 | ||
|
|
3e2d0c6ab2 | ||
|
|
e17c95af8e | ||
|
|
7ecb052fb3 | ||
|
|
3968ccd0cd | ||
|
|
07b3075fad | ||
|
|
a687f50009 | ||
|
|
d762abece9 | ||
|
|
cc87b3f68f | ||
|
|
ecd64ffafd | ||
|
|
e51d5b9c8a | ||
|
|
002f6e92af | ||
|
|
fae95d9ff5 | ||
|
|
70fb7e5da5 | ||
|
|
78eb99c496 | ||
|
|
cc447b33f6 | ||
|
|
a9c6f9b8a6 | ||
|
|
5d66d89c42 | ||
|
|
c9816a9ac4 | ||
|
|
73ce91a05a | ||
|
|
6a3fff75ba | ||
|
|
2d94502724 |
1
.github/workflows/build_test.sh
vendored
1
.github/workflows/build_test.sh
vendored
@ -13,6 +13,7 @@ ARGS=(
|
|||||||
"--optimization=3 -Db_lto=true"
|
"--optimization=3 -Db_lto=true"
|
||||||
"--optimization=3 -Db_lto=false"
|
"--optimization=3 -Db_lto=false"
|
||||||
"--optimization=3 -Ddns-over-tls=openssl"
|
"--optimization=3 -Ddns-over-tls=openssl"
|
||||||
|
"--optimization=3 -Dfexecve=true -Dstandalone-binaries=true -Dstatic-libsystemd=true -Dstatic-libudev=true"
|
||||||
"-Db_ndebug=true"
|
"-Db_ndebug=true"
|
||||||
)
|
)
|
||||||
PACKAGES=(
|
PACKAGES=(
|
||||||
|
|||||||
@ -59,14 +59,14 @@ The "portable service" concept ultimately will not provide a fully isolated
|
|||||||
environment to the payload, like containers mostly intend to. Instead they are
|
environment to the payload, like containers mostly intend to. Instead they are
|
||||||
from the beginning more alike regular system services, can be controlled with
|
from the beginning more alike regular system services, can be controlled with
|
||||||
the same tools, are exposed the same way in all infrastructure and so on. Their
|
the same tools, are exposed the same way in all infrastructure and so on. Their
|
||||||
main difference is that the use a different root directory than the rest of the
|
main difference is that they use a different root directory than the rest of the
|
||||||
system. Hence, the intention is not to run code in a different, isolated world
|
system. Hence, the intention is not to run code in a different, isolated world
|
||||||
from the host — like most containers would do it —, but to run it in the same
|
from the host — like most containers would do it — but to run it in the same
|
||||||
world, but with stricter access controls on what the service can see and do.
|
world, but with stricter access controls on what the service can see and do.
|
||||||
|
|
||||||
As one point of differentiation: as programs run as "portable services" are
|
As one point of differentiation: as programs run as "portable services" are
|
||||||
pretty much regular system services, they won't run as PID 1 (like Docker would
|
pretty much regular system services, they won't run as PID 1 (like Docker would
|
||||||
do it), but as normal process. A corollary of that is that they aren't supposed
|
do it), but as normal processes. A corollary of that is that they aren't supposed
|
||||||
to manage anything in their own environment (such as the network) as the
|
to manage anything in their own environment (such as the network) as the
|
||||||
execution environment is mostly shared with the rest of the system.
|
execution environment is mostly shared with the rest of the system.
|
||||||
|
|
||||||
@ -77,12 +77,12 @@ focus includes system extensions otherwise sometimes called "super-privileged
|
|||||||
containers".
|
containers".
|
||||||
|
|
||||||
Note that portable services are only available for system services, not for
|
Note that portable services are only available for system services, not for
|
||||||
user services. i.e. the functionality cannot be used for the stuff
|
user services (i.e. the functionality cannot be used for the stuff
|
||||||
bubblewrap/flatpak is focusing on.
|
bubblewrap/flatpak is focusing on).
|
||||||
|
|
||||||
## Mode of Operation
|
## Mode of Operation
|
||||||
|
|
||||||
If you have portable service image, maybe in a raw disk image called
|
If you have a portable service image, maybe in a raw disk image called
|
||||||
`foobar_0.7.23.raw`, then attaching the services to the host is as easy as:
|
`foobar_0.7.23.raw`, then attaching the services to the host is as easy as:
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -135,7 +135,7 @@ This command does the following:
|
|||||||
|
|
||||||
And that's already it.
|
And that's already it.
|
||||||
|
|
||||||
Note that the images need to stay around (and the same location) as long as the
|
Note that the images need to stay around (and in the same location) as long as the
|
||||||
portable service is attached. If an image is moved, the `RootImage=` line
|
portable service is attached. If an image is moved, the `RootImage=` line
|
||||||
written to the unit drop-in would point to an non-existing place, and break the
|
written to the unit drop-in would point to an non-existing place, and break the
|
||||||
logic.
|
logic.
|
||||||
@ -144,7 +144,7 @@ The `portablectl detach` command executes the reverse operation: it looks for
|
|||||||
the drop-ins and the unit files associated with the image, and removes them
|
the drop-ins and the unit files associated with the image, and removes them
|
||||||
again.
|
again.
|
||||||
|
|
||||||
Note that `portable attach` won't enable or start any of the units it copies
|
Note that `portablectl attach` won't enable or start any of the units it copies
|
||||||
out. This still has to take place in a second, separate step. (That said We
|
out. This still has to take place in a second, separate step. (That said We
|
||||||
might add options to do this automatically later on.).
|
might add options to do this automatically later on.).
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ read-only, immutable images (e.g. squashfs images) all files and directories to
|
|||||||
over-mount must exist already.
|
over-mount must exist already.
|
||||||
|
|
||||||
Note that as no new image format or metadata is defined, it's very
|
Note that as no new image format or metadata is defined, it's very
|
||||||
straight-forward to define images than can be made use of it a number of
|
straightforward to define images than can be made use of in a number of
|
||||||
different ways. For example, by using `mkosi -b` you can trivially build a
|
different ways. For example, by using `mkosi -b` you can trivially build a
|
||||||
single, unified image that:
|
single, unified image that:
|
||||||
|
|
||||||
|
|||||||
@ -505,8 +505,7 @@ sensor:modalias:acpi:BMA250E*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-1030:*
|
|||||||
sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-830:*
|
sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-830:*
|
||||||
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, 1
|
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, 1
|
||||||
|
|
||||||
# IdeaPad D330 and D330-10IGM
|
# IdeaPad D330-10IGM (both 81H3 and 81MD product numbers)
|
||||||
sensor:modalias:acpi:BOSC0200*:dmi:*:svnLENOVO:pn81H3:*
|
|
||||||
sensor:modalias:acpi:BOSC0200*:dmi:*:svnLENOVO:*:cvrLenovoideapadD330-10IGM:*
|
sensor:modalias:acpi:BOSC0200*:dmi:*:svnLENOVO:*:cvrLenovoideapadD330-10IGM:*
|
||||||
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -301,7 +301,7 @@ def print_summary(fname, groups):
|
|||||||
error('{}: no matches or props'.format(fname))
|
error('{}: no matches or props'.format(fname))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = sys.argv[1:] or sorted(glob.glob(os.path.dirname(sys.argv[0]) + '/[67][0-9]-*.hwdb'))
|
args = sys.argv[1:] or sorted(glob.glob(os.path.dirname(sys.argv[0]) + '/[678][0-9]-*.hwdb'))
|
||||||
|
|
||||||
for fname in args:
|
for fname in args:
|
||||||
groups = parse(fname)
|
groups = parse(fname)
|
||||||
|
|||||||
@ -237,6 +237,19 @@
|
|||||||
cannot be written. Currently only applies to random seed operations.</para></listitem>
|
cannot be written. Currently only applies to random seed operations.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--make-machine-id-directory=yes|no|auto</option></term>
|
||||||
|
<listitem><para>Control creation and deletion of <literal>$ESP/$MACHINE_ID</literal> during
|
||||||
|
<option>install</option> and <option>remove</option>, respectively.
|
||||||
|
<literal>auto</literal> is equivalent to to <literal>yes</literal> if <literal>/etc/machine-id</literal>
|
||||||
|
resides on a filesystem other than tmpfs and <literal>no</literal> otherwise.
|
||||||
|
Defaults to <literal>auto</literal>.</para>
|
||||||
|
|
||||||
|
<para>Overriding this may be desired to hide the machine ID from the (unencrypted) ESP,
|
||||||
|
configure a <citerefentry><refentrytitle>kernel-install</refentrytitle><manvolnum>8</manvolnum></citerefentry> script, or,
|
||||||
|
conversely, commit a machine-id that only appears transient.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<xi:include href="standard-options.xml" xpointer="no-pager"/>
|
<xi:include href="standard-options.xml" xpointer="no-pager"/>
|
||||||
<xi:include href="standard-options.xml" xpointer="help"/>
|
<xi:include href="standard-options.xml" xpointer="help"/>
|
||||||
<xi:include href="standard-options.xml" xpointer="version"/>
|
<xi:include href="standard-options.xml" xpointer="version"/>
|
||||||
|
|||||||
@ -722,7 +722,7 @@ if time_epoch == -1
|
|||||||
if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
|
if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
|
||||||
# If we're in a git repository, use the creation time of the latest git tag.
|
# If we're in a git repository, use the creation time of the latest git tag.
|
||||||
latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
|
latest_tag = run_command('git', 'describe', '--abbrev=0', '--tags').stdout().strip()
|
||||||
time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout()
|
time_epoch = run_command('git', 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout()
|
||||||
endif
|
endif
|
||||||
if time_epoch == ''
|
if time_epoch == ''
|
||||||
NEWS = files('NEWS')
|
NEWS = files('NEWS')
|
||||||
|
|||||||
@ -49,11 +49,6 @@ SUBSYSTEM=="sound", GROUP="audio", \
|
|||||||
|
|
||||||
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
|
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664"
|
||||||
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video"
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video"
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video"
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video"
|
|
||||||
|
|
||||||
SUBSYSTEM=="firewire", TEST=="units", TEST=="model", \
|
SUBSYSTEM=="firewire", TEST=="units", TEST=="model", \
|
||||||
IMPORT{builtin}="hwdb 'ieee1394:node:ven$attr{vendor}mo$attr{model}units$attr{units}'"
|
IMPORT{builtin}="hwdb 'ieee1394:node:ven$attr{vendor}mo$attr{model}units$attr{units}'"
|
||||||
|
|
||||||
|
|||||||
@ -1431,10 +1431,9 @@ int log_syntax_invalid_utf8_internal(
|
|||||||
if (rvalue)
|
if (rvalue)
|
||||||
p = utf8_escape_invalid(rvalue);
|
p = utf8_escape_invalid(rvalue);
|
||||||
|
|
||||||
log_syntax_internal(unit, level, config_file, config_line, 0, file, line, func,
|
return log_syntax_internal(unit, level, config_file, config_line,
|
||||||
"String is not UTF-8 clean, ignoring assignment: %s", strna(p));
|
SYNTHETIC_ERRNO(EINVAL), file, line, func,
|
||||||
|
"String is not UTF-8 clean, ignoring assignment: %s", strna(p));
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_set_upgrade_syslog_to_journal(bool b) {
|
void log_set_upgrade_syslog_to_journal(bool b) {
|
||||||
|
|||||||
@ -1278,8 +1278,8 @@ int get_timezones(char ***ret) {
|
|||||||
f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
|
f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
|
||||||
if (f) {
|
if (f) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
_cleanup_free_ char *line = NULL;
|
_cleanup_free_ char *line = NULL, *w = NULL;
|
||||||
char *p, *w;
|
char *p;
|
||||||
size_t k;
|
size_t k;
|
||||||
|
|
||||||
r = read_line(f, LONG_LINE_MAX, &line);
|
r = read_line(f, LONG_LINE_MAX, &line);
|
||||||
@ -1310,12 +1310,10 @@ int get_timezones(char ***ret) {
|
|||||||
if (!w)
|
if (!w)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (!GREEDY_REALLOC(zones, n_allocated, n_zones + 2)) {
|
if (!GREEDY_REALLOC(zones, n_allocated, n_zones + 2))
|
||||||
free(w);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
zones[n_zones++] = w;
|
zones[n_zones++] = TAKE_PTR(w);
|
||||||
zones[n_zones] = NULL;
|
zones[n_zones] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ int unit_validate_alias_symlink_and_warn(const char *filename, const char *targe
|
|||||||
const char *src, *dst;
|
const char *src, *dst;
|
||||||
_cleanup_free_ char *src_instance = NULL, *dst_instance = NULL;
|
_cleanup_free_ char *src_instance = NULL, *dst_instance = NULL;
|
||||||
UnitType src_unit_type, dst_unit_type;
|
UnitType src_unit_type, dst_unit_type;
|
||||||
int src_name_type, dst_name_type;
|
UnitNameFlags src_name_type, dst_name_type;
|
||||||
|
|
||||||
/* Check if the *alias* symlink is valid. This applies to symlinks like
|
/* Check if the *alias* symlink is valid. This applies to symlinks like
|
||||||
* /etc/systemd/system/dbus.service → dbus-broker.service, but not to .wants or .requires symlinks
|
* /etc/systemd/system/dbus.service → dbus-broker.service, but not to .wants or .requires symlinks
|
||||||
|
|||||||
@ -139,7 +139,7 @@ int unit_name_to_prefix(const char *n, char **ret) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unit_name_to_instance(const char *n, char **ret) {
|
UnitNameFlags unit_name_to_instance(const char *n, char **ret) {
|
||||||
const char *p, *d;
|
const char *p, *d;
|
||||||
|
|
||||||
assert(n);
|
assert(n);
|
||||||
|
|||||||
@ -22,8 +22,8 @@ bool unit_instance_is_valid(const char *i) _pure_;
|
|||||||
bool unit_suffix_is_valid(const char *s) _pure_;
|
bool unit_suffix_is_valid(const char *s) _pure_;
|
||||||
|
|
||||||
int unit_name_to_prefix(const char *n, char **ret);
|
int unit_name_to_prefix(const char *n, char **ret);
|
||||||
int unit_name_to_instance(const char *n, char **ret);
|
UnitNameFlags unit_name_to_instance(const char *n, char **ret);
|
||||||
static inline int unit_name_classify(const char *n) {
|
static inline UnitNameFlags unit_name_classify(const char *n) {
|
||||||
return unit_name_to_instance(n, NULL);
|
return unit_name_to_instance(n, NULL);
|
||||||
}
|
}
|
||||||
int unit_name_to_prefix_and_instance(const char *n, char **ret);
|
int unit_name_to_prefix_and_instance(const char *n, char **ret);
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
#include "mkdir.h"
|
#include "mkdir.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
|
#include "parse-argument.h"
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
#include "pretty-print.h"
|
#include "pretty-print.h"
|
||||||
#include "random-util.h"
|
#include "random-util.h"
|
||||||
@ -52,6 +53,7 @@ static bool arg_print_dollar_boot_path = false;
|
|||||||
static bool arg_touch_variables = true;
|
static bool arg_touch_variables = true;
|
||||||
static PagerFlags arg_pager_flags = 0;
|
static PagerFlags arg_pager_flags = 0;
|
||||||
static bool arg_graceful = false;
|
static bool arg_graceful = false;
|
||||||
|
static int arg_make_machine_id_directory = -1;
|
||||||
|
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_esp_path, freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_esp_path, freep);
|
||||||
STATIC_DESTRUCTOR_REGISTER(arg_xbootldr_path, freep);
|
STATIC_DESTRUCTOR_REGISTER(arg_xbootldr_path, freep);
|
||||||
@ -112,6 +114,19 @@ static int acquire_xbootldr(bool unprivileged_mode, sd_id128_t *ret_uuid) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void settle_make_machine_id_directory(void) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if (arg_make_machine_id_directory >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
r = path_is_temporary_fs("/etc/machine-id");
|
||||||
|
if (r < 0)
|
||||||
|
log_debug_errno(r, "Couldn't determine whether /etc/machine-id is on a temporary file system, assuming so.");
|
||||||
|
|
||||||
|
arg_make_machine_id_directory = r == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* search for "#### LoaderInfo: systemd-boot 218 ####" string inside the binary */
|
/* search for "#### LoaderInfo: systemd-boot 218 ####" string inside the binary */
|
||||||
static int get_file_version(int fd, char **v) {
|
static int get_file_version(int fd, char **v) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -888,6 +903,24 @@ static int remove_subdirs(const char *root, const char *const *subdirs) {
|
|||||||
return r < 0 ? r : q;
|
return r < 0 ? r : q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int remove_machine_id_directory(const char *root) {
|
||||||
|
sd_id128_t machine_id;
|
||||||
|
char buf[SD_ID128_STRING_MAX];
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(root);
|
||||||
|
assert(arg_make_machine_id_directory >= 0);
|
||||||
|
|
||||||
|
if (!arg_make_machine_id_directory)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
r = sd_id128_get_machine(&machine_id);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to get machine id: %m");
|
||||||
|
|
||||||
|
return rmdir_one(root, sd_id128_to_string(machine_id, buf));
|
||||||
|
}
|
||||||
|
|
||||||
static int remove_binaries(const char *esp_path) {
|
static int remove_binaries(const char *esp_path) {
|
||||||
const char *p;
|
const char *p;
|
||||||
int r, q;
|
int r, q;
|
||||||
@ -974,9 +1007,13 @@ static int install_loader_config(const char *esp_path) {
|
|||||||
_cleanup_(unlink_and_freep) char *t = NULL;
|
_cleanup_(unlink_and_freep) char *t = NULL;
|
||||||
_cleanup_fclose_ FILE *f = NULL;
|
_cleanup_fclose_ FILE *f = NULL;
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
|
sd_id128_t machine_id;
|
||||||
|
char machine_string[SD_ID128_STRING_MAX];
|
||||||
const char *p;
|
const char *p;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
assert(arg_make_machine_id_directory >= 0);
|
||||||
|
|
||||||
p = prefix_roota(esp_path, "/loader/loader.conf");
|
p = prefix_roota(esp_path, "/loader/loader.conf");
|
||||||
if (access(p, F_OK) >= 0) /* Silently skip creation if the file already exists (early check) */
|
if (access(p, F_OK) >= 0) /* Silently skip creation if the file already exists (early check) */
|
||||||
return 0;
|
return 0;
|
||||||
@ -991,6 +1028,13 @@ static int install_loader_config(const char *esp_path) {
|
|||||||
|
|
||||||
fprintf(f, "#timeout 3\n"
|
fprintf(f, "#timeout 3\n"
|
||||||
"#console-mode keep\n");
|
"#console-mode keep\n");
|
||||||
|
if (arg_make_machine_id_directory) {
|
||||||
|
r = sd_id128_get_machine(&machine_id);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to get machine id: %m");
|
||||||
|
|
||||||
|
fprintf(f, "default %s-*\n", sd_id128_to_string(machine_id, machine_string));
|
||||||
|
}
|
||||||
|
|
||||||
r = fflush_sync_and_check(f);
|
r = fflush_sync_and_check(f);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
@ -1006,6 +1050,24 @@ static int install_loader_config(const char *esp_path) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int install_machine_id_directory(const char *root) {
|
||||||
|
sd_id128_t machine_id;
|
||||||
|
char buf[SD_ID128_STRING_MAX];
|
||||||
|
int r;
|
||||||
|
|
||||||
|
assert(root);
|
||||||
|
assert(arg_make_machine_id_directory >= 0);
|
||||||
|
|
||||||
|
if (!arg_make_machine_id_directory)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
r = sd_id128_get_machine(&machine_id);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(r, "Failed to get machine id: %m");
|
||||||
|
|
||||||
|
return mkdir_one(root, sd_id128_to_string(machine_id, buf));
|
||||||
|
}
|
||||||
|
|
||||||
static int help(int argc, char *argv[], void *userdata) {
|
static int help(int argc, char *argv[], void *userdata) {
|
||||||
_cleanup_free_ char *link = NULL;
|
_cleanup_free_ char *link = NULL;
|
||||||
int r;
|
int r;
|
||||||
@ -1043,6 +1105,8 @@ static int help(int argc, char *argv[], void *userdata) {
|
|||||||
" --no-pager Do not pipe output into a pager\n"
|
" --no-pager Do not pipe output into a pager\n"
|
||||||
" --graceful Don't fail when the ESP cannot be found or EFI\n"
|
" --graceful Don't fail when the ESP cannot be found or EFI\n"
|
||||||
" variables cannot be written\n"
|
" variables cannot be written\n"
|
||||||
|
" --make-machine-id-directory=yes|no|auto\n"
|
||||||
|
" Create $BOOT/$MACHINE_ID\n"
|
||||||
"\nSee the %2$s for details.\n",
|
"\nSee the %2$s for details.\n",
|
||||||
program_invocation_short_name,
|
program_invocation_short_name,
|
||||||
link,
|
link,
|
||||||
@ -1062,24 +1126,27 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
ARG_NO_VARIABLES,
|
ARG_NO_VARIABLES,
|
||||||
ARG_NO_PAGER,
|
ARG_NO_PAGER,
|
||||||
ARG_GRACEFUL,
|
ARG_GRACEFUL,
|
||||||
|
ARG_MAKE_MACHINE_ID_DIRECTORY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct option options[] = {
|
static const struct option options[] = {
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "version", no_argument, NULL, ARG_VERSION },
|
{ "version", no_argument, NULL, ARG_VERSION },
|
||||||
{ "esp-path", required_argument, NULL, ARG_ESP_PATH },
|
{ "esp-path", required_argument, NULL, ARG_ESP_PATH },
|
||||||
{ "path", required_argument, NULL, ARG_ESP_PATH }, /* Compatibility alias */
|
{ "path", required_argument, NULL, ARG_ESP_PATH }, /* Compatibility alias */
|
||||||
{ "boot-path", required_argument, NULL, ARG_BOOT_PATH },
|
{ "boot-path", required_argument, NULL, ARG_BOOT_PATH },
|
||||||
{ "print-esp-path", no_argument, NULL, 'p' },
|
{ "print-esp-path", no_argument, NULL, 'p' },
|
||||||
{ "print-path", no_argument, NULL, 'p' }, /* Compatibility alias */
|
{ "print-path", no_argument, NULL, 'p' }, /* Compatibility alias */
|
||||||
{ "print-boot-path", no_argument, NULL, 'x' },
|
{ "print-boot-path", no_argument, NULL, 'x' },
|
||||||
{ "no-variables", no_argument, NULL, ARG_NO_VARIABLES },
|
{ "no-variables", no_argument, NULL, ARG_NO_VARIABLES },
|
||||||
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
|
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
|
||||||
{ "graceful", no_argument, NULL, ARG_GRACEFUL },
|
{ "graceful", no_argument, NULL, ARG_GRACEFUL },
|
||||||
|
{ "make-machine-id-directory", required_argument, NULL, ARG_MAKE_MACHINE_ID_DIRECTORY },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
int c, r;
|
int c, r;
|
||||||
|
bool b;
|
||||||
|
|
||||||
assert(argc >= 0);
|
assert(argc >= 0);
|
||||||
assert(argv);
|
assert(argv);
|
||||||
@ -1132,6 +1199,17 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
arg_graceful = true;
|
arg_graceful = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_MAKE_MACHINE_ID_DIRECTORY:
|
||||||
|
if (streq(optarg, "auto"))
|
||||||
|
arg_make_machine_id_directory = -1; /* default */
|
||||||
|
else {
|
||||||
|
r = parse_boolean_argument("--make-machine-id-directory=", optarg, &b);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
arg_make_machine_id_directory = b;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -1530,6 +1608,8 @@ static int verb_install(int argc, char *argv[], void *userdata) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
settle_make_machine_id_directory();
|
||||||
|
|
||||||
install = streq(argv[0], "install");
|
install = streq(argv[0], "install");
|
||||||
|
|
||||||
RUN_WITH_UMASK(0002) {
|
RUN_WITH_UMASK(0002) {
|
||||||
@ -1555,6 +1635,10 @@ static int verb_install(int argc, char *argv[], void *userdata) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
r = install_machine_id_directory(arg_dollar_boot_path());
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
r = install_random_seed(arg_esp_path);
|
r = install_random_seed(arg_esp_path);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
@ -1584,6 +1668,8 @@ static int verb_remove(int argc, char *argv[], void *userdata) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
settle_make_machine_id_directory();
|
||||||
|
|
||||||
r = remove_binaries(arg_esp_path);
|
r = remove_binaries(arg_esp_path);
|
||||||
|
|
||||||
q = remove_file(arg_esp_path, "/loader/loader.conf");
|
q = remove_file(arg_esp_path, "/loader/loader.conf");
|
||||||
@ -1602,11 +1688,19 @@ static int verb_remove(int argc, char *argv[], void *userdata) {
|
|||||||
if (q < 0 && r >= 0)
|
if (q < 0 && r >= 0)
|
||||||
r = q;
|
r = q;
|
||||||
|
|
||||||
|
q = remove_machine_id_directory(arg_esp_path);
|
||||||
|
if (q < 0 && r >= 0)
|
||||||
|
r = 1;
|
||||||
|
|
||||||
if (arg_xbootldr_path) {
|
if (arg_xbootldr_path) {
|
||||||
/* Remove the latter two also in the XBOOTLDR partition if it exists */
|
/* Remove the latter two also in the XBOOTLDR partition if it exists */
|
||||||
q = remove_subdirs(arg_xbootldr_path, dollar_boot_subdirs);
|
q = remove_subdirs(arg_xbootldr_path, dollar_boot_subdirs);
|
||||||
if (q < 0 && r >= 0)
|
if (q < 0 && r >= 0)
|
||||||
r = q;
|
r = q;
|
||||||
|
|
||||||
|
q = remove_machine_id_directory(arg_xbootldr_path);
|
||||||
|
if (q < 0 && r >= 0)
|
||||||
|
r = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) sync_everything();
|
(void) sync_everything();
|
||||||
|
|||||||
@ -2213,14 +2213,14 @@ int config_parse_service_sockets(
|
|||||||
_cleanup_free_ char *word = NULL, *k = NULL;
|
_cleanup_free_ char *word = NULL, *k = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, 0);
|
r = extract_first_word(&p, &word, NULL, 0);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Trailing garbage in sockets, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Trailing garbage in sockets, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = unit_name_printf(UNIT(s), word, &k);
|
r = unit_name_printf(UNIT(s), word, &k);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -2488,14 +2488,14 @@ int config_parse_user_group_strv_compat(
|
|||||||
_cleanup_free_ char *word = NULL, *k = NULL;
|
_cleanup_free_ char *word = NULL, *k = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, 0);
|
r = extract_first_word(&p, &word, NULL, 0);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue);
|
log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = unit_full_printf(u, word, &k);
|
r = unit_full_printf(u, word, &k);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -2654,8 +2654,6 @@ int config_parse_environ(
|
|||||||
_cleanup_free_ char *word = NULL, *resolved = NULL;
|
_cleanup_free_ char *word = NULL, *resolved = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -2663,6 +2661,8 @@ int config_parse_environ(
|
|||||||
"Invalid syntax, ignoring: %s", rvalue);
|
"Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (u) {
|
if (u) {
|
||||||
r = unit_full_printf(u, word, &resolved);
|
r = unit_full_printf(u, word, &resolved);
|
||||||
@ -2719,8 +2719,6 @@ int config_parse_pass_environ(
|
|||||||
_cleanup_free_ char *word = NULL, *k = NULL;
|
_cleanup_free_ char *word = NULL, *k = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
break;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -2728,6 +2726,8 @@ int config_parse_pass_environ(
|
|||||||
"Trailing garbage in %s, ignoring: %s", lvalue, rvalue);
|
"Trailing garbage in %s, ignoring: %s", lvalue, rvalue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
if (u) {
|
if (u) {
|
||||||
r = unit_full_printf(u, word, &k);
|
r = unit_full_printf(u, word, &k);
|
||||||
@ -2794,8 +2794,6 @@ int config_parse_unset_environ(
|
|||||||
_cleanup_free_ char *word = NULL, *k = NULL;
|
_cleanup_free_ char *word = NULL, *k = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
break;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -2803,6 +2801,8 @@ int config_parse_unset_environ(
|
|||||||
"Trailing garbage in %s, ignoring: %s", lvalue, rvalue);
|
"Trailing garbage in %s, ignoring: %s", lvalue, rvalue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
if (u) {
|
if (u) {
|
||||||
r = unit_full_printf(u, word, &k);
|
r = unit_full_printf(u, word, &k);
|
||||||
@ -2868,14 +2868,14 @@ int config_parse_log_extra_fields(
|
|||||||
const char *eq;
|
const char *eq;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = unit_full_printf(u, word, &k);
|
r = unit_full_printf(u, word, &k);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3080,8 +3080,6 @@ int config_parse_unit_requires_mounts_for(
|
|||||||
_cleanup_free_ char *word = NULL, *resolved = NULL;
|
_cleanup_free_ char *word = NULL, *resolved = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3089,6 +3087,8 @@ int config_parse_unit_requires_mounts_for(
|
|||||||
"Invalid syntax, ignoring: %s", rvalue);
|
"Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = unit_full_printf(u, word, &resolved);
|
r = unit_full_printf(u, word, &resolved);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3218,8 +3218,6 @@ int config_parse_syscall_filter(
|
|||||||
int num;
|
int num;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, 0);
|
r = extract_first_word(&p, &word, NULL, 0);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3227,6 +3225,8 @@ int config_parse_syscall_filter(
|
|||||||
"Invalid syntax, ignoring: %s", rvalue);
|
"Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = parse_syscall_and_errno(word, &name, &num);
|
r = parse_syscall_and_errno(word, &name, &num);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3304,14 +3304,14 @@ int config_parse_syscall_log(
|
|||||||
_cleanup_free_ char *word = NULL;
|
_cleanup_free_ char *word = NULL;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, 0);
|
r = extract_first_word(&p, &word, NULL, 0);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = seccomp_parse_syscall_filter(
|
r = seccomp_parse_syscall_filter(
|
||||||
word, -1, c->syscall_log,
|
word, -1, c->syscall_log,
|
||||||
@ -3349,8 +3349,6 @@ int config_parse_syscall_archs(
|
|||||||
uint32_t a;
|
uint32_t a;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3358,6 +3356,8 @@ int config_parse_syscall_archs(
|
|||||||
"Invalid syntax, ignoring: %s", rvalue);
|
"Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
r = seccomp_arch_from_string(word, &a);
|
r = seccomp_arch_from_string(word, &a);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3463,8 +3463,6 @@ int config_parse_address_families(
|
|||||||
int af;
|
int af;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -3472,6 +3470,8 @@ int config_parse_address_families(
|
|||||||
"Invalid syntax, ignoring: %s", rvalue);
|
"Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
af = af_from_name(word);
|
af = af_from_name(word);
|
||||||
if (af < 0) {
|
if (af < 0) {
|
||||||
@ -3821,14 +3821,14 @@ int config_parse_delegate(
|
|||||||
CGroupController cc;
|
CGroupController cc;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
break;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
cc = cgroup_controller_from_string(word);
|
cc = cgroup_controller_from_string(word);
|
||||||
if (cc < 0) {
|
if (cc < 0) {
|
||||||
@ -3954,13 +3954,8 @@ int config_parse_device_allow(
|
|||||||
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Invalid syntax, ignoring: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
|
||||||
"Failed to extract device path and rights from '%s', ignoring.", rvalue);
|
"Failed to extract device path and rights from '%s', ignoring.", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4025,13 +4020,8 @@ int config_parse_io_device_weight(
|
|||||||
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0 || isempty(p)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Invalid syntax, ignoring: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0 || isempty(p)) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
|
||||||
"Failed to extract device path and weight from '%s', ignoring.", rvalue);
|
"Failed to extract device path and weight from '%s', ignoring.", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4099,13 +4089,8 @@ int config_parse_io_device_latency(
|
|||||||
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0 || isempty(p)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Invalid syntax, ignoring: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0 || isempty(p)) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
|
||||||
"Failed to extract device path and latency from '%s', ignoring.", rvalue);
|
"Failed to extract device path and latency from '%s', ignoring.", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4174,13 +4159,8 @@ int config_parse_io_limit(
|
|||||||
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0 || isempty(p)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Invalid syntax, ignoring: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0 || isempty(p)) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
|
||||||
"Failed to extract device node and bandwidth from '%s', ignoring.", rvalue);
|
"Failed to extract device node and bandwidth from '%s', ignoring.", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4265,13 +4245,8 @@ int config_parse_blockio_device_weight(
|
|||||||
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0 || isempty(p)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Invalid syntax, ignoring: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0 || isempty(p)) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
|
||||||
"Failed to extract device node and weight from '%s', ignoring.", rvalue);
|
"Failed to extract device node and weight from '%s', ignoring.", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4343,13 +4318,8 @@ int config_parse_blockio_bandwidth(
|
|||||||
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &path, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0 || isempty(p)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
"Invalid syntax, ignoring: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r == 0 || isempty(p)) {
|
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
|
||||||
"Failed to extract device node and bandwidth from '%s', ignoring.", rvalue);
|
"Failed to extract device node and bandwidth from '%s', ignoring.", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4751,14 +4721,14 @@ int config_parse_namespace_path_strv(
|
|||||||
bool ignore_enoent = false, shall_prefix = false;
|
bool ignore_enoent = false, shall_prefix = false;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
break;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract first word, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract first word, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
w = word;
|
w = word;
|
||||||
if (startswith(w, "-")) {
|
if (startswith(w, "-")) {
|
||||||
@ -4828,14 +4798,14 @@ int config_parse_temporary_filesystems(
|
|||||||
const char *w;
|
const char *w;
|
||||||
|
|
||||||
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE);
|
||||||
if (r == 0)
|
|
||||||
return 0;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract first word, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract first word, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
w = word;
|
w = word;
|
||||||
r = extract_first_word(&w, &path, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
r = extract_first_word(&w, &path, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||||
@ -4902,14 +4872,14 @@ int config_parse_bind_paths(
|
|||||||
bool rbind = true, ignore_enoent = false;
|
bool rbind = true, ignore_enoent = false;
|
||||||
|
|
||||||
r = extract_first_word(&p, &source, ":" WHITESPACE, EXTRACT_UNQUOTE|EXTRACT_DONT_COALESCE_SEPARATORS);
|
r = extract_first_word(&p, &source, ":" WHITESPACE, EXTRACT_UNQUOTE|EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||||
if (r == 0)
|
|
||||||
break;
|
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s, ignoring: %s", lvalue, rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (r == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
r = unit_full_printf(u, source, &sresolved);
|
r = unit_full_printf(u, source, &sresolved);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
@ -5630,7 +5600,7 @@ int config_parse_bpf_foreign_program(
|
|||||||
r = extract_first_word(&rvalue, &word, ":", 0);
|
r = extract_first_word(&rvalue, &word, ":", 0);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0) {
|
if (r <= 0 || isempty(rvalue)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse foreign BPF program, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse foreign BPF program, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5670,11 +5640,11 @@ int config_parse_cgroup_socket_bind(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
_cleanup_free_ CGroupSocketBindItem *item = NULL;
|
_cleanup_free_ CGroupSocketBindItem *item = NULL;
|
||||||
const char *address_family = NULL, *user_port;
|
const char *user_port;
|
||||||
uint16_t nr_ports = 0, port_min = 0;
|
uint16_t nr_ports = 0, port_min = 0;
|
||||||
CGroupSocketBindItem **head = data;
|
CGroupSocketBindItem **head = data;
|
||||||
_cleanup_free_ char *word = NULL;
|
_cleanup_free_ char *word = NULL;
|
||||||
int af = AF_UNSPEC, r;
|
int af, r;
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
if (isempty(rvalue)) {
|
||||||
cgroup_context_remove_socket_bind(head);
|
cgroup_context_remove_socket_bind(head);
|
||||||
@ -5684,29 +5654,40 @@ int config_parse_cgroup_socket_bind(
|
|||||||
r = extract_first_word(&rvalue, &word, ":", 0);
|
r = extract_first_word(&rvalue, &word, ":", 0);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
if (r <= 0) {
|
||||||
if (rvalue)
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
address_family = word;
|
"Unable to parse %s= assignment, ignoring: %s", lvalue, rvalue);
|
||||||
|
return 0;
|
||||||
if (address_family) {
|
}
|
||||||
if (streq(address_family, "IPv4"))
|
|
||||||
af = AF_INET;
|
if (rvalue) {
|
||||||
else if (streq(address_family, "IPv6"))
|
if (streq(word, "IPv4"))
|
||||||
af = AF_INET6;
|
af = AF_INET;
|
||||||
else
|
else if (streq(word, "IPv6"))
|
||||||
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
af = AF_INET6;
|
||||||
"Only IPv4 or IPv6 protocols are supported, ignoring");
|
else {
|
||||||
|
log_syntax(unit, LOG_WARNING, filename, line, 0,
|
||||||
|
"Only IPv4 and IPv6 protocols are supported, ignoring.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
user_port = rvalue;
|
||||||
|
} else {
|
||||||
|
af = AF_UNSPEC;
|
||||||
|
user_port = word;
|
||||||
}
|
}
|
||||||
|
|
||||||
user_port = rvalue ?: word;
|
|
||||||
if (!streq(user_port, "any")) {
|
if (!streq(user_port, "any")) {
|
||||||
uint16_t port_max;
|
uint16_t port_max;
|
||||||
|
|
||||||
r = parse_ip_port_range(user_port, &port_min, &port_max);
|
r = parse_ip_port_range(user_port, &port_min, &port_max);
|
||||||
if (r == -ENOMEM)
|
if (r == -ENOMEM)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
return log_warning_errno(r, "Invalid port or port range, ignoring: %m");
|
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||||
|
"Invalid port or port range, ignoring: %m");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
nr_ports = 1 + port_max - port_min;
|
nr_ports = 1 + port_max - port_min;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
if (size == 0)
|
if (size == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* We don't want to fill the logs with assert warnings.
|
||||||
|
* Disable most logging if not running standalone */
|
||||||
|
if (!getenv("SYSTEMD_LOG_LEVEL"))
|
||||||
|
log_set_max_level(LOG_CRIT);
|
||||||
|
|
||||||
dummy_server_init(&s, data, size);
|
dummy_server_init(&s, data, size);
|
||||||
dev_kmsg_record(&s, s.buffer, size);
|
dev_kmsg_record(&s, s.buffer, size);
|
||||||
server_done(&s);
|
server_done(&s);
|
||||||
|
|||||||
@ -245,72 +245,69 @@ _public_ int sd_device_new_from_devnum(sd_device **ret, char type, dev_t devnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname) {
|
_public_ int sd_device_new_from_subsystem_sysname(sd_device **ret, const char *subsystem, const char *sysname) {
|
||||||
char *name, *syspath;
|
char syspath[PATH_MAX], *name;
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
assert_return(ret, -EINVAL);
|
assert_return(ret, -EINVAL);
|
||||||
assert_return(subsystem, -EINVAL);
|
assert_return(subsystem, -EINVAL);
|
||||||
assert_return(sysname, -EINVAL);
|
assert_return(sysname, -EINVAL);
|
||||||
|
assert_return(strlen(sysname) < PATH_MAX - strlen("/sys/bus/"), -ENAMETOOLONG);
|
||||||
|
|
||||||
if (streq(subsystem, "subsystem")) {
|
if (streq(subsystem, "subsystem")) {
|
||||||
syspath = strjoina("/sys/subsystem/", sysname);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/subsystem/%s", sysname) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
syspath = strjoina("/sys/bus/", sysname);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/bus/%s", sysname) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
syspath = strjoina("/sys/class/", sysname);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/class/%s", sysname) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
} else if (streq(subsystem, "module")) {
|
} else if (streq(subsystem, "module")) {
|
||||||
syspath = strjoina("/sys/module/", sysname);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/module/%s", sysname) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
} else if (streq(subsystem, "drivers")) {
|
} else if (streq(subsystem, "drivers")) {
|
||||||
char subsys[PATH_MAX];
|
const char *subsys, *sep;
|
||||||
char *driver;
|
|
||||||
|
|
||||||
strscpy(subsys, sizeof(subsys), sysname);
|
sep = strchr(sysname, ':');
|
||||||
driver = strchr(subsys, ':');
|
if (sep && sep[1] != '\0') { /* Require ":" and something non-empty after that. */
|
||||||
if (driver) {
|
subsys = memdupa_suffix0(sysname, sep - sysname);
|
||||||
driver[0] = '\0';
|
|
||||||
driver++;
|
|
||||||
|
|
||||||
syspath = strjoina("/sys/subsystem/", subsys, "/drivers/", driver);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/subsystem/%s/drivers/%s", subsys, sep + 1) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
syspath = strjoina("/sys/bus/", subsys, "/drivers/", driver);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/bus/%s/drivers/%s", subsys, sep + 1) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translate sysname back to sysfs filename */
|
/* translate sysname back to sysfs filename */
|
||||||
name = strdupa(sysname);
|
name = strdupa(sysname);
|
||||||
while (name[len] != '\0') {
|
|
||||||
if (name[len] == '/')
|
|
||||||
name[len] = '!';
|
|
||||||
|
|
||||||
len++;
|
for (size_t i = 0; name[i]; i++)
|
||||||
}
|
if (name[i] == '/')
|
||||||
|
name[i] = '!';
|
||||||
|
|
||||||
syspath = strjoina("/sys/subsystem/", subsystem, "/devices/", name);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/subsystem/%s/devices/%s", subsystem, name) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
syspath = strjoina("/sys/bus/", subsystem, "/devices/", name);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/bus/%s/devices/%s", subsystem, name) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
syspath = strjoina("/sys/class/", subsystem, "/", name);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/class/%s/%s", subsystem, name) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
syspath = strjoina("/sys/firmware/", subsystem, "/", sysname);
|
if (snprintf_ok(syspath, sizeof syspath, "/sys/firmware/%s/%s", subsystem, sysname) &&
|
||||||
if (access(syspath, F_OK) >= 0)
|
access(syspath, F_OK) >= 0)
|
||||||
return sd_device_new_from_syspath(ret, syspath);
|
return sd_device_new_from_syspath(ret, syspath);
|
||||||
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -652,17 +649,15 @@ _public_ int sd_device_new_from_device_id(sd_device **ret, const char *id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case '+': {
|
case '+': {
|
||||||
char subsys[NAME_MAX+1]; /* NAME_MAX does not include the trailing NUL. */
|
const char *subsys, *sep;
|
||||||
const char *sysname;
|
|
||||||
|
|
||||||
sysname = strchr(id + 1, ':');
|
sep = strchr(id + 1, ':');
|
||||||
if (!sysname)
|
if (!sep || sep - id - 1 > NAME_MAX)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
(void) strnscpy(subsys, sizeof(subsys), id + 1, sysname - id - 1);
|
subsys = memdupa_suffix0(id + 1, sep - id - 1);
|
||||||
sysname++;
|
|
||||||
|
|
||||||
return sd_device_new_from_subsystem_sysname(ret, subsys, sysname);
|
return sd_device_new_from_subsystem_sysname(ret, subsys, sep + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -30,20 +30,11 @@ SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="uaccess
|
|||||||
SUBSYSTEM=="sound", TAG+="uaccess", \
|
SUBSYSTEM=="sound", TAG+="uaccess", \
|
||||||
OPTIONS+="static_node=snd/timer", OPTIONS+="static_node=snd/seq"
|
OPTIONS+="static_node=snd/timer", OPTIONS+="static_node=snd/seq"
|
||||||
|
|
||||||
# ffado is an userspace driver for firewire sound cards
|
|
||||||
SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="uaccess"
|
|
||||||
|
|
||||||
# Webcams, frame grabber, TV cards
|
# Webcams, frame grabber, TV cards
|
||||||
SUBSYSTEM=="video4linux", TAG+="uaccess"
|
SUBSYSTEM=="video4linux", TAG+="uaccess"
|
||||||
SUBSYSTEM=="dvb", TAG+="uaccess"
|
SUBSYSTEM=="dvb", TAG+="uaccess"
|
||||||
|
|
||||||
# IIDC devices: industrial cameras and some webcams
|
# industrial cameras, some webcams, camcorders, set-top boxes, TV sets, audio devices, and more
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="uaccess"
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="uaccess"
|
|
||||||
# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="uaccess"
|
|
||||||
SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="uaccess"
|
|
||||||
|
|
||||||
SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_MIDI}=="1", TAG+="uaccess"
|
SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_MIDI}=="1", TAG+="uaccess"
|
||||||
SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_AUDIO}=="1", TAG+="uaccess"
|
SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_AUDIO}=="1", TAG+="uaccess"
|
||||||
SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_VIDEO}=="1", TAG+="uaccess"
|
SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_VIDEO}=="1", TAG+="uaccess"
|
||||||
|
|||||||
@ -1754,12 +1754,12 @@ int unit_file_verify_alias(const UnitFileInstallInfo *i, const char *dst, char *
|
|||||||
"Invalid path \"%s\" in alias.", dir);
|
"Invalid path \"%s\" in alias.", dir);
|
||||||
*p = '\0'; /* dir should now be a unit name */
|
*p = '\0'; /* dir should now be a unit name */
|
||||||
|
|
||||||
r = unit_name_classify(dir);
|
UnitNameFlags type = unit_name_classify(dir);
|
||||||
if (r < 0)
|
if (type < 0)
|
||||||
return log_warning_errno(SYNTHETIC_ERRNO(EXDEV),
|
return log_warning_errno(SYNTHETIC_ERRNO(EXDEV),
|
||||||
"Invalid unit name component \"%s\" in alias.", dir);
|
"Invalid unit name component \"%s\" in alias.", dir);
|
||||||
|
|
||||||
const bool instance_propagation = r == UNIT_NAME_TEMPLATE;
|
const bool instance_propagation = type == UNIT_NAME_TEMPLATE;
|
||||||
|
|
||||||
/* That's the name we want to use for verification. */
|
/* That's the name we want to use for verification. */
|
||||||
r = unit_symlink_name_compatible(path_alias, i->name, instance_propagation);
|
r = unit_symlink_name_compatible(path_alias, i->name, instance_propagation);
|
||||||
@ -1776,11 +1776,11 @@ int unit_file_verify_alias(const UnitFileInstallInfo *i, const char *dst, char *
|
|||||||
if (unit_name_is_valid(dst, UNIT_NAME_TEMPLATE)) {
|
if (unit_name_is_valid(dst, UNIT_NAME_TEMPLATE)) {
|
||||||
_cleanup_free_ char *inst = NULL;
|
_cleanup_free_ char *inst = NULL;
|
||||||
|
|
||||||
r = unit_name_to_instance(i->name, &inst);
|
UnitNameFlags type = unit_name_to_instance(i->name, &inst);
|
||||||
if (r < 0)
|
if (type < 0)
|
||||||
return log_error_errno(r, "Failed to extract instance name from %s: %m", i->name);
|
return log_error_errno(type, "Failed to extract instance name from %s: %m", i->name);
|
||||||
|
|
||||||
if (r == UNIT_NAME_INSTANCE) {
|
if (type == UNIT_NAME_INSTANCE) {
|
||||||
r = unit_name_replace_instance(dst, inst, &dst_updated);
|
r = unit_name_replace_instance(dst, inst, &dst_updated);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to build unit name from %s+%s: %m",
|
return log_error_errno(r, "Failed to build unit name from %s+%s: %m",
|
||||||
|
|||||||
@ -68,7 +68,6 @@ static void test_random_u64_range_one(unsigned mod) {
|
|||||||
|
|
||||||
x = random_u64_range(mod);
|
x = random_u64_range(mod);
|
||||||
|
|
||||||
log_trace("%05u: %"PRIu64, i, x);
|
|
||||||
count[x]++;
|
count[x]++;
|
||||||
max = MAX(max, count[x]);
|
max = MAX(max, count[x]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -471,8 +471,8 @@ static void test_build_parent_slice(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_unit_name_to_instance(void) {
|
static void test_unit_name_to_instance(void) {
|
||||||
|
UnitNameFlags r;
|
||||||
char *instance;
|
char *instance;
|
||||||
int r;
|
|
||||||
|
|
||||||
log_info("/* %s */", __func__);
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
|
|||||||
4
test/fuzz/fuzz-journald-kmsg/oss-fuzz-33881
Normal file
4
test/fuzz/fuzz-journald-kmsg/oss-fuzz-33881
Normal file
File diff suppressed because one or more lines are too long
BIN
test/fuzz/fuzz-unit-file/oss-fuzz-33270
Normal file
BIN
test/fuzz/fuzz-unit-file/oss-fuzz-33270
Normal file
Binary file not shown.
BIN
test/fuzz/fuzz-unit-file/oss-fuzz-33876
Normal file
BIN
test/fuzz/fuzz-unit-file/oss-fuzz-33876
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user