summaryrefslogtreecommitdiff
path: root/src/home
Commit message (Collapse)AuthorAgeFilesLines
* mkfs-util: Add quiet argument to make_filesystem()Daan De Meyer2023-05-121-1/+9
| | | | | | | | We default to quiet operation everywhere except for repart, where we disable quiet and have the mkfs tools write to stdout. We also make sure --quiet or equivalent is implemented for all mkfs tools.
* Merge pull request #27424 from dtardon/auto-cleanupYu Watanabe2023-04-281-4/+4
|\ | | | | More automatic cleanup
| * homed-manager-bus: use _cleanup_David Tardon2023-04-281-4/+4
| |
* | pam-systemd: disconnect bus connection when leaving session hook, even on errorLennart Poettering2023-04-271-18/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for systematically destroying connections in pam_sm_session_open() even on failure, so that under no circumstances unserved dbus connection are around while the invoking process waits for the session to end. Previously we'd only do this on success, now do it in all cases. This matters since so far we suggested people hook pam_systemd into their pam stacks prefixed with "-", so that login proceeds even if pam_systemd fails. This however means that in an error case our cached connection doesn't get disconnected even if the session then is invoked. This fixes that.
* | homed: rename make_userns() to avoid name conflict with mount-util.[ch]Lennart Poettering2023-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't really matter too much as both are static functions. But it's confusing as hell both when debugging and reading code, given that homed actually uses mount-util.c Hence, let's just rename one of the two, to minimize confusion. No actual change in behaviour. (and sooner or later we might want to export mount-util.c's version of the function, since it's generically useful)
* | pam: cache sd-bus separately per moduleLuca Boccassi2023-04-241-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sd-bus connection is cached by the two pam modules globally, but this can lead to issues due to hashmaps (used by sd-bus) using a global static variable for the shared hash key, which is different per module as both modules are loaded in the same process. This happens because the sd-bus object is create in one module, but used in the other, so global state does not match. Use a different pam cache identifier for the sd-bus pointer, so that each module uses a different sd-bus connection as a workaround. Fixes https://github.com/systemd/systemd/issues/27216 Fixes https://github.com/systemd/systemd/issues/17266
* | pam_systemd_home: clean up sd-bus when called about something else's userLuca Boccassi2023-04-241-1/+2
|/ | | | | | | | | | | | | | acquire_home() takes a reference to a sd-bus object, which the open_session hook cleans on success. But only when handling a user actually owned by homed, it did not clean it up when skipping because it is being invoked on a system user. We need to be careful with sd-bus here as pam_sm_open_session is the last hook before forking, and we want to clean up sd-bus before that happens, or we'll have a broken reference (FDs are cloexec) in the child process, which will then assert when attempting to close them, or leak the bus connection which causes dbus to complain loudly: dbus-daemon[62]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30020ms)
* fsck: use execv_p_ and execl_p_Florian Klink2023-04-171-10/+1
| | | | | Instead of invoking find_executable on our own, use the variants of exec provided by glibc which does this for us.
* fsck: look for fsck binary not just in /sbinFlorian Klink2023-04-151-1/+10
| | | | | | | | | This removes remaining hardcoded occurences of `/sbin/fsck`, and instead uses `find_executable` to find `fsck`. We also use `fsck_exists_for_fstype` to check for the `fsck.*` executable, which also checks in `$PATH`, so it's fair to assume fsck itself is also available.
* tree-wide: port more code over to CMSG_TYPED_DATA()Lennart Poettering2023-04-131-2/+2
|
* various: simplify calls to parse_boolean_argument()Zbigniew Jędrzejewski-Szmek2023-04-051-21/+10
| | | | | parse_boolean_argument() returns the same information via both the output argument and normal return.
* fs-util: Drop unlink_noerrno()Daan De Meyer2023-03-151-3/+4
|
* treewide: memfd_create: use exec flagsThomas Weißschuh2023-03-151-2/+4
| | | | | | | | | | | | | Use the flags MEMFD_EXEC or MEMFD_NOEXEC_SEAL as applicable. These warnings instruct the kernel wether the memfd is executable or not. Without specifying those flags the kernel will emit the following warning since version 6.3, commit 105ff5339f49 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC"): kernel: memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=1 'systemd'
* conf: replace config_parse_many_nulstr() with config_parse_config_file()Franck Bui2023-03-141-14/+3
| | | | | | | | | | | | | | | | | All daemons use a similar scheme to read their main config files and theirs drop-ins. The main config files are always stored in /etc/systemd directory and it's easy enough to construct the name of the drop-in directories based on the name of the main config file. Hence the new helper does that internally, which allows to reduce and simplify the args passed previously to config_parse_many_nulstr(). Besides the overall code simplification it results: 16 files changed, 87 insertions(+), 159 deletions(-) it allows to identify clearly the locations in the code where configuration files are parsed.
* basic: add RuntimeScope enumLennart Poettering2023-03-101-1/+1
| | | | | | | | | | | | In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
* repart: Add support for reading mkfs options from environmentDaan De Meyer2023-03-101-20/+2
|
* doc: correct wrong use "'s" contractionsJan Engelhardt2023-03-071-1/+1
|
* doc: replace wrong idiom in homed commentJan Engelhardt2023-03-071-2/+2
|
* homed: hook up memory pressure/SIGRTMIN+18 handlingLennart Poettering2023-03-012-1/+11
|
* homectl: make the new caps field configurable via homectlLennart Poettering2023-02-281-1/+68
|
* Merge pull request #26349 from yuwata/safe-fork-rearrange-stdioLuca Boccassi2023-02-211-9/+3
|\ | | | | process-util: introduce FORK_REARRANGE_STDIO
| * tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDSYu Watanabe2023-02-211-10/+3
| |
| * process-util: rename FORK_NULL_STDIO -> FORK_REARRANGE_STDIOYu Watanabe2023-02-211-0/+1
| | | | | | | | And make safe_fork_full() takes fds to be assigned to stdio.
* | homectl: add missing breakLennart Poettering2023-02-211-0/+2
|/
* treewide: fix a few typos in NEWS, docs and commentsDmitry V. Levin2023-02-151-1/+1
|
* meson: Do not include headers in source listsJan Janssen2023-01-241-32/+0
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* homework: when creating/resizing GPT partitions, also set sector size explicitlyLennart Poettering2023-01-181-6/+13
|
* loop-util: always tell kernel explicitly about loopback sector sizeLennart Poettering2023-01-181-2/+18
| | | | | | Let's not leave the sector size unspecified: either set a user supplied value, or auto-detect the right size by probing the disk image accordingly.
* Merge pull request #26044 from DaanDeMeyer/repart-sector-sizeDaan De Meyer2023-01-182-21/+1
|\ | | | | repart: Allow configuring sector size
| * repart: Allow configuring sector sizeDaan De Meyer2023-01-172-21/+1
| | | | | | | | | | | | Let's allow users to configure the (logical) sector size of their image. This is required when building images for a 4k sector size disk on a 512b sector size host or vice-versa.
* | tree-wide: use CLEANUP_ERASE() at various placesLennart Poettering2023-01-161-40/+18
|/ | | | | | Let's use this new macro wherever it makes sense, as it allows us to shorten or clean-up paths, and makes it less likely to miss a return path.
* tree-wide: fix return value handling of base64mem()Lennart Poettering2023-01-114-16/+21
| | | | | | | | | | | This returns an ssize_t, not an int. On populare archs that's the difference between 64bit and 32bit. hence, let's be more careful here, and not silently drop half the bits on the ground by assigning the return value to "int". As noticed by @malikabhi05: https://github.com/systemd/systemd/pull/24754#discussion_r1062903159
* homed: move away from basename()Lennart Poettering2022-12-231-8/+8
|
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-1912-36/+36
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* Implement SYSTEMD_HOME_MKFS_OPTIONS_* envvars to configure mkfs options for ↵Aidan Dang2022-12-151-1/+24
| | | | homed LUKS directories
* treewide: drop "RUN_" from "RUN_WITH_UMASK"Zbigniew Jędrzejewski-Szmek2022-12-131-1/+1
| | | | | | RUN_WITH_UMASK was initially conceived for spawning externals progs with the umask set. But nowadays we use it various syscalls and stuff that doesn't "run" anything, so the "RUN_" prefix has outlived its usefulness.
* Implement --luks-pbkdf-force-iterations for homedAidan Dang2022-12-062-1/+9
|
* tree-wide: fix typoYu Watanabe2022-12-021-1/+1
|
* blkid-util: define enum for blkid_do_safeprobe() return valuesLennart Poettering2022-12-011-6/+10
| | | | | | libblkid really should define an enum for this on its own, but it currently doesn't and returns literal numeric values. Lets make this more readable by adding our own symbolic names via an enum.
* tree-wide: use errno_or_else() more, instead of homegrown checksLennart Poettering2022-12-011-5/+5
|
* blkid: add helpers that get gpt partition uuid as sd_id128_tLennart Poettering2022-11-291-10/+6
| | | | just some refactoring to make things simpler.
* fdisk: introduce common fdisk_new_context_fd() helperLennart Poettering2022-11-261-27/+5
| | | | | We do the same thing over and over again and it's a bit ugly, hence let's unify the code for it at one common place.
* homed: handle EINTR gracefully when waiting for device nodeLennart Poettering2022-11-221-2/+5
|
* tmpfile-util: Introduce fopen_temporary_child()Daan De Meyer2022-11-171-1/+1
| | | | | | | Instead of having fopen_temporary() create the file either next to an existing file or in tmp/, let's split this up clearly into two different functions, one for creating temporary files next to existing files, and one for creating a temporary file in a directory.
* nulstr-util: Declare NULSTR_FOREACH() iterator inlineDaan De Meyer2022-11-111-2/+0
|
* copy: Support passing a deny list of files/directories to not copyDaan De Meyer2022-11-101-1/+1
|
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
|
* homed: properly initialize all return paramsLennart Poettering2022-10-241-0/+1
|
* Merge pull request #24933 from keszybz/erradicate-strerrorLuca Boccassi2022-10-111-219/+141
|\ | | | | Erradicate strerror