summaryrefslogtreecommitdiff
path: root/src/login
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: reopen log after fork when neededSergey Bugaev2021-03-221-1/+1
| | | | | | | | This follows up on 0b1f3c768ce1bd1490a5e53f539976dcef8ca765, adding more places where we should reopen the log after forking with FORK_CLOSE_ALL_FDS. When immediately calling exec in the child, prefer to explicitly reopen the log after exec fails. In other cases, just use FORK_REOPEN_LOG.
* logind: add …WithFlags methods to policyZbigniew Jędrzejewski-Szmek2021-03-091-0/+28
| | | | | | | | Without this, privilege escalation through polkit does not work, because all methods fail with permission errors. Forgotten in 8885fed4e3a52cf1bf105e42043203c485ed9d92. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1933335.
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-054-5/+5
|
* table: drop last SIZE_MAX from table_set_sort() and table_set_display()Yu Watanabe2021-03-052-2/+2
|
* tree-wide: use usec_add() and usec_sub_unsigned()Yu Watanabe2021-03-051-1/+1
|
* signal-util: make -1 termination of ignore_signals() argument list unnecessaryLennart Poettering2021-02-252-2/+2
| | | | | | | | | | Clean up ignore_signals() + default_signals() + sigaction_many() a bit: make it unnecessary to explicitly terminate the signal list with -1. Merge all three calls into a single function that is just called with slightly different parameters. And eliminate an unnecessary extra iteration in its inner for() loop. No change in behaviour.
* Merge pull request #18659 from poettering/permyriadificationYu Watanabe2021-02-192-6/+8
|\ | | | | use scaling relative to UINT32_MAX instead of percentages/permyriads wherever we can
| * tree-wide: port various pieces of code over to UINT32_SCALE_FROM_PERMYRIAD()Lennart Poettering2021-02-181-1/+1
| |
| * util: move percent/permille/permyriad parser into percent-util.[ch]Lennart Poettering2021-02-182-1/+3
| | | | | | | | | | | | | | A good chunk of parse-util.[ch] has been about parsing parts per hundred/thousand/ten-thousand. Let's split that out into its own file. No code changes, just some shuffling around.
| * tree-wide: parse permyriads wherever we canLennart Poettering2021-02-182-5/+5
| | | | | | | | | | | | Given that we now have a parser for permyriads, let's use it everywhere for greater accuracy. This means wherever we previously supported % and ‰, we now also support ‱.
* | Recommend drop-ins over modifications to the main config fileZbigniew Jędrzejewski-Szmek2021-02-191-7/+8
|/ | | | As discussed in https://github.com/systemd/systemd/pull/18347.
* sd-device: add sd_device_get_action() + sd_device_get_seqnum() + ↵Lennart Poettering2021-02-182-3/+3
| | | | | | | | | | | | | | | | 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.
* Merge pull request #18616 from keszybz/argv-fuzzer-quick-fixLennart Poettering2021-02-161-3/+3
|\ | | | | fuzz-systemctl-parse-argv: avoid "leak" of bus object
| * tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-3/+3
| | | | | | | | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* | logind: Restore chvt as non-root user without polkitJoshua Watt2021-02-166-54/+44
|/ | | | | | | | | | | | | | | 4acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke the ability to write user sessions that run graphical sessions (e.g. weston/X11). This was partially amended in 19bb87fbfa ("login: allow non-console sessions to change vt") by changing the default PolicyKit policy so that non-root users with a session are again allowed to switch the VT. This makes the policy when PolKit is not enabled (as on many embedded systems) closer the default PolKit policy and allows launching graphical sessions as a non-root user. Closes #17473 Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
* systemctl,loginctl,machinectl: use a shared helper for arg_signalZbigniew Jędrzejewski-Szmek2021-02-141-8/+4
| | | | | I seems frivolous to yet another two -util.[ch] files, but the helper should be in shared/ and it doesn't seem to fit anywhere else.
* Merge pull request #11484 from keszybz/udevadm-error-logsYu Watanabe2021-02-115-13/+11
|\ | | | | Use real return codes in _from_string() functions
| * tree-wide: propagate error code from _from_string() functionsZbigniew Jędrzejewski-Szmek2021-02-101-4/+2
| | | | | | | | Now that we know we have something useful, no need to make an answer up.
| * tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-104-9/+9
| | | | | | | | | | | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* | inhibit: cut off overly long "who" fieldsLennart Poettering2021-02-091-0/+1
|/ | | | | | | | systemd-inhibit when invoked with a command line will put the whole command line in the "who" field of the inhibitor lock. This can get extremely long for shell expressions, making the table "systemd-inhibit --list" shows ridiculously weirdly formatted. Let's put a limit on the column width: half of the screen, not more.
* Merge pull request #18375 from yuwata/cli-tools-also-read-kernel-command-lineZbigniew Jędrzejewski-Szmek2021-02-082-2/+2
|\ | | | | tree-wide: make CLI tools also read kernel command line when run as service
| * tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-02-012-2/+2
| | | | | | | | It may be useful when debugging daemons.
* | logind: simplify flags handling a bitLennart Poettering2021-02-031-12/+18
| | | | | | | | | | | | | | | | | | | | | | Let's split out the two codepaths a bit, and emphasize which ones it the new-style and which the old-style codepath, and let's clearly convert the params of the old-stye into the new style for further processing, so that the old style path is brief and isolated. No change in behaviour. Follow-up for: 8885fed4e3a52cf1bf105e42043203c485ed9d92
* | logind: Introduce RebootWithFlags and othersDeepak Rawat2021-02-021-14/+83
|/ | | | | Add new systemd-logind WithFlags version for Reboot and others. These methods add a unit64 parameter, with which can send additional control flags.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-312-11/+10
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* tree-wide: add spdx header on all scripts and helpersZbigniew Jędrzejewski-Szmek2021-01-281-0/+1
| | | | | | Even though many of those scripts are very simple, it is easier to include the header than to try to say whether each of those files is trivial enough not to require one.
* logind: Use hashmap_ensure_putSusant Sahani2021-01-201-5/+4
|
* meson: move test or fuzzer definitions to relevant meson.build in subdirectoriesYu Watanabe2021-01-191-0/+14
|
* login: move src/login/logind-acl.[ch] -> src/shared/devnode-acl.[ch]Yu Watanabe2021-01-194-297/+1
| | | | | | The files are used by logind and udevd. And the functions in the files are not specific to logind, and quite general enough to move to libshared.
* Add install-sysconfdir=no-samples option for (non-)installation of sample ↵Josh Triplett2021-01-141-1/+1
| | | | | | | | | | | | | configs By default, systemd installs various sample configuration files containing commented-out defaults. Systems seeking to minimize the number of files in /etc may wish to install directories and configuration files that have semantic effects, but not install not commented-out sample configuration files. Turn install-sysconfdir into a multi-valued option, with a "no-samples" value to skip installing sample-only configuration files.
* logind: use free_and_strdup() where appropriateLennart Poettering2020-12-091-11/+1
|
* logind: fix closing of button input devicesLennart Poettering2020-12-091-12/+6
| | | | | | | | | | | | | | | | | | | This is a fix of #17751. Specifically: 1. Sort #include headers again 2. Remove tabs, as per coding style 3. Don't install fds in half-initialized objects 4. Use asynchronous_close() everywhere That all said: Quit frankly, I am not convinced we should do all this at all. If close()ing of these input devices is really that slow, then this should probably be fixed in the kernel, not worked around in userspace like this.
* Update logind-button.cnihilix-melix2020-11-281-3/+6
|
* meson: add option to skip installing to $sysconfdirJörg Thalheim2020-11-121-2/+4
| | | | | | | | | | | | | | | | | | | | | This is useful for development where overwriting files out side the configured prefix will affect the host as well as stateless systems such as NixOS that don't let packages install to /etc but handle configuration on their own. Alternative to https://github.com/systemd/systemd/pull/17501 tested with: $ mkdir inst build && cd build $ meson \ -Dcreate-log-dirs=false \ -Dsysvrcnd-path=$(realpath ../inst)/etc/rc.d \ -Dsysvinit-path=$(realpath ../inst)/etc/init.d \ -Drootprefix=$(realpath ../inst) \ -Dinstall-sysconfdir=false \ --prefix=$(realpath ../inst) .. $ ninja install
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-0950-50/+50
|
* tree-wide: cast result of get_process_comm() to (void) where we ignore itLennart Poettering2020-10-271-1/+1
|
* Merge pull request #17390 from keszybz/logind-notifications-and-linksYu Watanabe2020-10-202-39/+28
|\ | | | | Fix sd_notify() usage in various daemons and update some documentation links
| * logind: minor indentation adjustmentsZbigniew Jędrzejewski-Szmek2020-10-192-26/+24
| |
| * logind: use notify_start/notify_on_cleanupZbigniew Jędrzejewski-Szmek2020-10-191-13/+4
| | | | | | | | Logging about the pid is dropped, pid1 does that better.
* | sd-bus: add custom return code when $XDG_RUNTIME_DIR is not setZbigniew Jędrzejewski-Szmek2020-10-141-1/+1
|/ | | | | | | We would return ENOENT, which is extremely confusing. Strace is not helpful because no *file* is actually missing. So let's add some logs at debug level and also use a custom return code. Let all user-facing utilities print a custom error message in that case.
* Merge pull request #17302 from keszybz/fix-inhibitorsLennart Poettering2020-10-122-1/+4
|\ | | | | Fix inhibitors
| * logind: fix taking of inhibitorsZbigniew Jędrzejewski-Szmek2020-10-101-0/+1
| | | | | | | | Ooops made in 0a9bf7fa593682326f1c5c2d7ec3d29a9d59e5cb.
| * logind: print what action is ignoredZbigniew Jędrzejewski-Szmek2020-10-101-1/+3
| | | | | | | | | | | | | | | | | | | | My logs have lines like this: Oct 10 09:38:38 krowka systemd-logind[1889]: External (2) displays connected. Oct 10 09:38:38 krowka systemd-logind[1889]: Refusing operation, as it is turned off. Without some hint *what* operation is ignored, this is not very informative. (I remember this came up before, but I don't remember why we didn't change this log line back then...)
* | tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-092-4/+3
|/
* loginctl: add -P as short for --value --property=Ronan Pigott2020-09-301-1/+6
|
* Merge pull request #17143 from keszybz/late-exec-resolution-altLennart Poettering2020-09-241-2/+1
|\ | | | | Late exec resolution (subset)
| * Add CLOSE_AND_REPLACE helperZbigniew Jędrzejewski-Szmek2020-09-181-2/+1
| | | | | | | | | | | | Similar to free_and_replace. I think this should be uppercase to make it clear that this is a macro. free_and_replace should probably be uppercased too.
* | tree-wide: switch remaining mount() invocations over to mount_nofollow_verbose()Lennart Poettering2020-09-231-4/+5
| | | | | | | | | | | | (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.)
* | logind: use _cleanup_ in one more placeZbigniew Jędrzejewski-Szmek2020-09-221-16/+6
|/
* tree-wide: don't needlessly negate error number passed to bus_error_message()Lennart Poettering2020-09-141-8/+8
| | | | | | 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.