summaryrefslogtreecommitdiff
path: root/src/login/logind-core.c
Commit message (Collapse)AuthorAgeFilesLines
* logind-core: drop unneeded check for NULLDavid Tardon2023-04-271-7/+3
|
* src: changed instances of sd_bus_call_method() to bus_call_method() (#26819)OMOJOLA JOSHUA2023-03-151-9/+2
| | | * src: changed instances of sd_bus_call_method() to bus_call_method()
* conf: replace config_parse_many_nulstr() with config_parse_config_file()Franck Bui2023-03-141-7/+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.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -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.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-5/+2
|
* logind: add option to stop idle sessions after specified timeoutMichal Sekletar2022-08-241-0/+2
| | | | | Thanks to Jan Pazdziora <jpazdziora@redhat.com> for providing a patch which implemeted a PoC of this feature.
* logind: downgrade message about /run/utmp missing to LOG_DEBUGLennart Poettering2021-11-091-1/+3
| | | | | This isn't really anything to really complain about, let's debug log about this, and continue quietly as if utmp was empty.
* tree-wide: mark set-but-not-used variables as unused to make LLVM happyFrantisek Sumsal2021-09-151-1/+1
| | | | | | | | | | | | | | LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which trips over some intentionally set-but-not-used variables or variables attached to cleanup handlers with side effects (`_cleanup_umask_`, `_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.): ``` ../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable] _cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL; ^ 1 error generated. ```
* logind: allow binding different operation to reboot key long pressesYegor Alexeyev2021-07-081-3/+17
|
* userdb: rename userdb lookup flags a bitLennart Poettering2021-05-071-2/+2
| | | | | | | | | | | | | Let's use "exclude" for flags that really exclude records from our lookup. Let's use "avoid" referring to concepts that when flag is set we'll not use but we have a fallback path for that should yield the same result. Let' use "suppress" for suppressing partial info, even if we return the record otherwise. So far we used "avoid" for all these cases, which was confusing. Whiel we are at it, let's reassign the bits a bit, leaving some space for bits follow-up commits are going to add.
* tree-wide: avoid uninitialized warning on _cleanup_ variablesLuca Boccassi2021-04-141-1/+1
| | | | | | | With some versions of the compiler, the _cleanup_ attr makes it think the variable might be freed/closed when uninitialized, even though it cannot happen. The added cost is small enough to be worth the benefit, and optimized builds will help reduce it even further.
* sd-device: add sd_device_get_action() + sd_device_get_seqnum() + ↵Lennart Poettering2021-02-181-2/+2
| | | | | | | | | | | | | | | | sd_device_new_from_stat_rdev() To make sd-device properly usable for all programs we need to provide an API for the "action" field of an event, it's one of the most relevant ones, and it was so far missing. This also adds sd_device_get_seqnum(), which isn't that interesting, except for generating pretty debug output, which we use it ourselves for. This also makes device_new_from_stat_rdev() public, as it is truly useful, as we can see in our own uses of it, and I think is fairly generic to show up in the public APIs.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-091-1/+2
|
* login: downgrade log level if the error will be ignoredYu Watanabe2020-09-101-2/+4
|
* login: Add KEY_RESTART handlingRobert Marko2020-09-091-0/+4
| | | | | | | KEY_RESTART is widely used in Linux to indicate device reboot. So lets handle it in the same fashion as KEY_POWER. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-6/+3
|
* logind: always check current tag list before using a deviceLennart Poettering2020-09-011-3/+5
|
* tree-wide: drop pointless zero initialization (#16900)fangxiuning2020-08-301-1/+1
|
* Define _cleanup_ helper for setutxent()+endutxent()Zbigniew Jędrzejewski-Szmek2020-07-051-16/+8
|
* tree-wide: avoid some loaded termsLennart Poettering2020-06-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | https://tools.ietf.org/html/draft-knodel-terminology-02 https://lwn.net/Articles/823224/ This gets rid of most but not occasions of these loaded terms: 1. scsi_id and friends are something that is supposed to be removed from our tree (see #7594) 2. The test suite defines an API used by the ubuntu CI. We can remove this too later, but this needs to be done in sync with the ubuntu CI. 3. In some cases the terms are part of APIs we call or where we expose concepts the kernel names the way it names them. (In particular all remaining uses of the word "slave" in our codebase are like this, it's used by the POSIX PTY layer, by the network subsystem, the mount API and the block device subsystem). Getting rid of the term in these contexts would mean doing some major fixes of the kernel ABI first. Regarding the replacements: when whitelist/blacklist is used as noun we replace with with allow list/deny list, and when used as verb with allow-list/deny-list.
* conf-parser: return mtime in config_parse() and friendsLennart Poettering2020-06-021-5/+7
| | | | | | | | | | | | | This is a follow-up for 9f83091e3cceb646a66fa9df89de6d9a77c21d86. Instead of reading the mtime off the configuration files after reading, let's do so before reading, but with the fd we read the data from. This is not only cleaner (as it allows us to save one stat()), but also has the benefit that we'll detect changes that happen while we read the files. This also reworks unit file drop-ins to use the common code for determining drop-in mtime, instead of reading system clock for that.
* efi: cache LoaderEntries EFI variableLennart Poettering2020-05-291-0/+25
| | | | | | Based-on: https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
* login: limit nr_inodes for /run/user/$UIDTopi Miettinen2020-05-241-0/+1
| | | | | Limit number of inodes for tmpfs mounts on /run/user/$UID. Default is RuntimeDirectorySize= divided by 4096.
* logind: avoid shadow lookups when doing userdb client sideLennart Poettering2020-04-091-2/+2
| | | | | | | | | | | | | | Let's not trigger MACs needlessly. Ideally everybody would turn on userdb, but if people insist in not doing so, then let's not attempt to open shadow. It's a bit ugly to implement this, since shadow information is more than just passwords (but accound validity metadata), and thus userdb's own "privieleged" scheme is orthogonal to this, but let's still do this for the client side. Fixes: #15105
* logind: port to UserRecord objectLennart Poettering2020-01-151-19/+20
| | | | | | | This changes the user tracking of logind to use the new-style UserRecord object. In a later commit this enables us to do per-user resource management.
* logind: drop unused user_tasks_max fieldZbigniew Jędrzejewski-Szmek2019-11-141-1/+0
| | | | | | | | | We would only write to the field, and take the address. All *readers* were removed in 284149392755f086d0a714071c33aa609e61505e. (The explanation for why the field wasn't removed back then is that the patch underwent a few iterations, with the initial version adding translation back and forth. Later versions of the patch simply emit a warning and ignore the old value. Apparently nobody noticed that the value became unused.)
* tree-wide: drop pwd.h and grp.h when user-util.h is includedYu Watanabe2019-11-041-1/+0
|
* logind: shorten code a bitZbigniew Jędrzejewski-Szmek2019-09-161-26/+7
|
* logind: use newer ret var naming styleZbigniew Jędrzejewski-Szmek2019-09-161-19/+19
|
* logind: rework allocation/freeing of inhibitorsLennart Poettering2019-07-231-12/+8
| | | | | | | | | | | | | Let's follow our modern style (i.e. return proper errors, use structure initialization and _cleanup_). Most importantly: remove state file and FIFO removal from inhibitor_free() and let's move it to inhibitor_stop(). This makes sure that state files/FIFOs are not removed when the we terminate logind, i.e. that they can survive logind restarts. Fixes: #11825
* tree-wide: make use of errno_or_else() everywhereLennart Poettering2019-07-111-1/+2
|
* tree-wide: code improvements suggested by CoccinelleFrantisek Sumsal2019-04-301-2/+1
|
* util: split out some stuff into a new file limits-util.[ch]Lennart Poettering2019-03-131-0/+1
|
* login: use device_is_in_action()Yu Watanabe2019-03-121-6/+4
|
* tree-wide: port various places over to STARTSWITH_SET()Lennart Poettering2018-11-261-12/+5
|
* logind: make sure that if we can't figure out whether we are on AC we ↵Lennart Poettering2018-11-161-5/+3
| | | | | | | presume we are It's safer to assume that we are on AC than to assume we are on battery, if we can't figure it out.
* logind: expose a boolean on the bus explaining whether logind thinks the lid ↵Lennart Poettering2018-11-161-0/+11
| | | | | | | is closed This copies how we already expose a "Docked" boolean the reflects whether we are in a docking station or not.
* logind: fix compilation without utmp (#10674)Steven Allen2018-11-071-1/+1
|
* login: use log_device_*()Yu Watanabe2018-10-231-1/+1
|
* tree-wide: replace 'unsigned int' with 'unsigned'Yu Watanabe2018-10-191-3/+3
|
* logind: add a RequiresMountsFor= dependency from the session scope unit to ↵Lennart Poettering2018-10-131-6/+18
| | | | | | | | | | | | the home directory of the user This is useful so that during shutdown scope units are always terminated before the mounts necessary for the home directory. (Ideally we'd also add a similar dependency from the user@.service instance to the home directory, but this isn't as easy as that service is defined statically and not dynamically, and hence not easy to modify dynamically, in particular when it comes to deps)
* logind: optionally watch utmp for login dataLennart Poettering2018-10-131-0/+143
| | | | | | | This allows us to determine the TTY an ssh session is for, which is useful to to proper idle detection for ssh sessions. Fixes: #9622
* logind: add hashtable for finding session by leader PIDLennart Poettering2018-10-131-6/+9
| | | | | This is useful later on, when we quickly want to find the session for a leader PID.
* logind: optionally, keep the user@.service instance for eached logged in ↵Lennart Poettering2018-10-131-0/+2
| | | | | | | | | | | user around for a while This should speed up rapid logout/login cycles a bit. By default this timeout is now set to 10s. Fixes: #8410 Replaces: #4434
* logind: rework Seat/Session/User object allocation and freeing a bitLennart Poettering2018-10-131-6/+8
| | | | | | | | | | | | Let's update things a bit to follow current practices: - User structure initialization rather than zero-initialized allocation - Always propagate proper errors from allocation functions - Use _cleanup_ for freeing objects when allocation fails half-way - Make destructors return NULL
* logind: fix blacklist/whitelist confusion in comment (#10165)Lennart Poettering2018-09-251-6/+4
| | | | | Triggered by this: https://github.com/systemd/systemd/commit/602a41c22ac2df33b4b5e5083719c1cfaf58acf9#r30575293
* tree-wide: drop unnecessary initializationsYu Watanabe2018-09-231-1/+1
|
* tree-wide: use streq() instead of streq_ptr()Yu Watanabe2018-09-231-6/+6
|
* tree-wide: replace ↵Yu Watanabe2018-09-101-6/+2
| | | | device_enumerator_scan_devices()+FOREACH_DEVICE_AND_SUBSYSTEM() by FOREACH_DEVICE()