Commit Graph

650 Commits

Author SHA1 Message Date
Lennart Poettering c2bc710b24 string-util: imply NULL termination of strextend() argument list
The trailing NULL in the argument list is now implied (similar to
what we already have in place in strjoin()).
2021-01-06 17:24:46 +01:00
Luca Boccassi 8bab802910 basic: add make_mount_point_inode helper
Creates a file or a directory depending on the source path, useful
for creating mount points.
2020-12-21 21:48:13 +01:00
Lennart Poettering 52ef5dd798 hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()
Let's clean up hostname_is_valid() a bit: let's turn the second boolean
argument into a more explanatory flags field, and add a flag that
accepts the special name ".host" as valid. This is useful for the
container logic, where the special hostname ".host" refers to the "root
container", i.e. the host system itself, and can be specified at various
places.

let's also get rid of machine_name_is_valid(). It was just an alias,
which is confusing and even more so now that we have the flags param.
2020-12-15 17:59:48 +01:00
Lennart Poettering c4dd2d7575 machine: drop really old kdbus left-over
The "x-machine-kernel" dbus address has been removed a long time ago,
hence don't generate it either.
2020-12-15 17:59:37 +01:00
Zbigniew Jędrzejewski-Szmek 7e0079f95f Make support for nscd flushing optional
Fedora will deprecate support for nscd in the upcoming release [1] and plans to
drop it in the next one [2]. At that point we might as well build systemd
without that support too, since there'll be nothing to talk too.

[1] https://fedoraproject.org/wiki/Changes/DeprecateNSCD
[2] https://fedoraproject.org/wiki/Changes/RemoveNSCD
2020-12-07 19:46:02 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Frantisek Sumsal d7a0f1f4f9 tree-wide: assorted coccinelle fixes 2020-10-09 15:02:23 +02:00
Lennart Poettering 890084db03 tree-wide: port remaining umount() calls to umount_verbose() 2020-09-23 18:57:37 +02:00
Lennart Poettering 21935150a0 tree-wide: switch remaining mount() invocations over to mount_nofollow_verbose()
(Well, at least the ones where that makes sense. Where it does't make
sense are the ones that re invoked on the root path, which cannot
possibly be a symlink.)
2020-09-23 18:57:37 +02:00
Lennart Poettering d5bc4e6898 machine: fix error code propagation in two cases 2020-09-23 13:24:25 +02:00
Lennart Poettering 2a03b9ed21 tree-wide: don't needlessly negate error number passed to bus_error_message()
Like it's customary in our codebase bus_error_message() internally takes
abs() of the passed error anyway, hence no need to explicitly negate it.
We mostly got this right, but in too many cases we didn't. Fix that.
2020-09-14 21:42:22 +02:00
Lennart Poettering 652d90407a tree-wide: copy hardlinks wherever we deal with possibly large OS-style trees
Fixes: #7382
2020-09-09 20:21:49 +02:00
Zbigniew Jędrzejewski-Szmek 90e74a66e6 tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
fangxiuning 6d95e7d9b2
tree-wide: drop pointless zero initialization (#16900) 2020-08-30 06:21:20 +09:00
PhoenixDiscord e8607daf7d
Replace gendered pronouns with gender neutral ones. (#16844) 2020-08-27 11:52:48 +09:00
Zbigniew Jędrzejewski-Szmek 955a632971 tree-wide: use sd_bus_error_has_names() in more places 2020-08-24 19:48:26 +02:00
Lennart Poettering 5a27b39518 nspawn/machine: move mount propagation dir to /run/host/incoming
Previously we'd use a directory /run/systemd/nspawn/incoming for
accepting mounts to propagate from the host. This is a bit weird, since
we have a shared namespace: /run/systemd/ contains both stuff managed by
the surround nspawn as well as from the systemd inside.

We now have the /run/host/ hierarchy that has special stuff we want to
pass from host to container. Let's make use of that here, and move this
directory here too.

This is not a compat breakage, since the payload never interfaces with
that directory natively: it's only nspawn and machined that need to
agree on it.
2020-08-20 10:17:25 +02:00
Lennart Poettering 0a388dfcc5 core,home,machined: generate description fields for all groups we synthesize 2020-08-07 08:39:52 +02:00
Marti Raudsepp 09364a8043 machine: Pass machine, user, program values to polkit on OpenMachineShell
This allows more granular access control in PolicyKit rules, similar to
/etc/sudoers, for polkit actions:
* org.freedesktop.machine1.host-shell
* org.freedesktop.machine1.shell

Example configuration, place in /etc/polkit-1/rules.d/

polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.machine1.host-shell"
        && subject.user == "my-user"
        && action.lookup("user") == "target-user") {
            return polkit.Result.YES;
    }
});
2020-08-03 10:03:13 +02:00
fangxiuning ddbab78f9a bus: use bus_log_connect_error to print error message 2020-07-21 10:02:01 +09:00
Lennart Poettering 8e32ad9557 machine: fix if check
Fixes: coverity 1430462
2020-07-16 08:35:26 +02:00
Lennart Poettering 4751364e76 machined: implement user/group lookup varlink API in machined too
Let's natively support our own API in machined too.

This allows us to remove half of nss-mymachines in a later commit.
2020-07-14 17:06:23 +02:00
Lennart Poettering 74d1b7d2ad machined: refactor UID/GID machine translation
Let's move the heavy lifting out of the bus call implemntations, and
into generic code.

This allows us to expose them easily via Varlink too in a later commit.
2020-07-14 17:06:23 +02:00
fangxiuning 4b6607d949 table use table_log_print_error() instead of table_log_show_error 2020-07-08 15:16:52 +08:00
fangxiuning df83eb546b table add table_log_sort_error() 2020-07-08 10:53:57 +08:00
fangxiuning d836018a73 table add table_log_show_error() 2020-07-08 10:50:59 +08:00
Lennart Poettering 40af3d020f shared: split out property get helpers
No code changes, just some refactoring.
2020-06-30 15:10:17 +02:00
Lennart Poettering 9176326ba2 shared: split out code for printing properties
No code changes, just some refactoring.
2020-06-30 15:09:56 +02:00
Lennart Poettering 807542bece shared: split out code that maps properties to local structs
Just some refactoring, no code changes.
2020-06-30 15:09:35 +02:00
Lennart Poettering 9b71e4ab90 shared: actually move all BusLocator related calls to bus-locator.c 2020-06-30 15:09:19 +02:00
Lennart Poettering c664cf5607 shared: split out BusObjectImplementor APIs
Just some refactoring, no code changes
2020-06-30 15:08:35 +02:00
Filipe Brandenburger 41d1f469cf log: introduce log_parse_environment_cli() and log_setup_cli()
Presently, CLI utilities such as systemctl will check whether they have a tty
attached or not to decide whether to parse /proc/cmdline or EFI variable
SystemdOptions looking for systemd.log_* entries.

But this check will be misleading if these tools are being launched by a
daemon, such as a monitoring daemon or automation service that runs in
background.

Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI
variables to determine the logging level.

Furthermore, introduce a new log_setup_cli() shortcut to set up common options
used by most command-line utilities.
2020-06-24 16:49:26 +02:00
Vito Caputo 14456f7607 machine: switch to BusLocator-oriented helpers
Mechanical substitution reducing some verbosity
2020-05-07 08:46:43 -07:00
Benjamin Robin 0a0e594a26 tree-wide: Mark as _unused_ variables that are only used in assert()
Allow to build without any warning with NDEBUG defined
2020-05-06 23:03:25 +02:00
Zbigniew Jędrzejewski-Szmek 4faa530cf6 machined: convert to the new scheme and add --bus-introspect 2020-05-05 22:38:31 +02:00
Zbigniew Jędrzejewski-Szmek d4cc0edfce importd,logind: add --bus-introspect= option 2020-05-05 22:34:17 +02:00
Zbigniew Jędrzejewski-Szmek fc021a5bbf logind,importd,hostnamed,localed,timedated,machined,resolved: add option parsing stubs
--help and --version are implemented in the usual style.
help() prints full path, since the program is not expected to
be in $PATH.
2020-05-03 10:55:51 +02:00
Lennart Poettering ac9f55ed40 tree-wide: implement new log control API dbus interface in all our daemons 2020-04-21 17:08:16 +02:00
Zbigniew Jędrzejewski-Szmek bbe17ca1cb machined: add dbus parameter names 2020-04-12 19:48:01 +02:00
Vito Caputo 4fa744a35c *: convert amenable fdopen calls to take_fdopen
Mechanical change to eliminate some cruft by using the
new take_fdopen{_unlocked}() wrappers where trivial.
2020-03-31 06:48:03 -07:00
Lennart Poettering d93dda3afe systemctl: show logs for correct namespace of service 2020-01-31 15:02:52 +01:00
Lennart Poettering 269e4d2d6b shared: split out polkit stuff from bus-util.c → bus-polkit.c
It's enough, complex stuff to warrant its own source file.

No other changes, just splitting out.
2020-01-22 12:34:10 +01:00
Yu Watanabe ab1b472062
Merge pull request #14555 from poettering/table-multine
format-table: proper multi-line support
2020-01-14 06:48:57 +09:00
Lennart Poettering 04d8507f68
Merge pull request #14381 from keszybz/ifindex-cleanup
Resolve alternative names
2020-01-13 17:57:59 +01:00
Lennart Poettering fc6eb08e74 machinectl: modernize address table handling
Primarily, use the new multi-line support in table formatting.

Also, stream-line naming of the "max-addresses" options. We used three
names for the concept internall, let's just unify on the name we use for
this for external users, i.e. "max-addresses".
2020-01-13 16:38:40 +01:00
Zbigniew Jędrzejewski-Szmek 8571210a21 machinectl: reduce scope of iterator variables 2020-01-12 11:24:35 +01:00
Zbigniew Jędrzejewski-Szmek 597da51bae tree-wide: make parse_ifindex simply return the index
We don't need a seperate output parameter that is of type int.  glibc() says
that the type is "unsigned", but the kernel thinks it's "int".  And the
"alternative names" interface also uses ints. So let's standarize on ints,
since it's clearly not realisitic to have interface numbers in the upper half
of unsigned int range.
2020-01-11 12:06:08 +01:00
Yu Watanabe 12845a91b5 machinectl: do not truncate addresses when --full is specified 2020-01-10 19:19:15 +09:00
Yu Watanabe 679c7c7a67 machinectl: optimize table creation 2020-01-10 18:28:17 +09:00
Yu Watanabe a65e34ccb0 machinectl: do not ellipsize table when --full is specified 2020-01-10 12:24:51 +09:00