summaryrefslogtreecommitdiffstats
path: root/src/tty-ask-password-agent (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tty-askpw-agent: modernize wall_tty_match() a bitLennart Poettering2024-10-211-11/+9
|
* tty-ask-password-agent: support for watching both system-wide and per-user ↵Lennart Poettering2024-10-211-7/+24
| | | | | | askpw dir Fixes: #1232 #2217
* tty-ask-password-agent: minor modernizationsLennart Poettering2024-10-211-47/+43
|
* tree-wide: check if non-empty password is acquiredYu Watanabe2024-09-061-3/+1
|
* tree-wide: acquire /dev/console lock around any attempts to reset TTYLennart Poettering2024-07-191-1/+1
|
* terminal-util: add new helper terminal_reset_defensive() that combines ↵Lennart Poettering2024-07-191-3/+1
| | | | reset-by-ioctl and reset-by-sequence reasonably
* signal-util: use common definitions for ignore + default "struct sigaction"Lennart Poettering2024-07-121-5/+1
| | | | | | | | | | We use this at various places, let's unify this in one global constant. This changes flags in crash-handler.c in a tiny irrelevant way: we ask syscalls to be continued on signal arrival, which we previously didn't. But that shouldn't change anything, the only thing we'll do in the relevant process is call raise(), and that's it, hence there definitely are no syscalls to restart or not to restart.
* signal-util: imply sentinel -1 in sigprocmask_many() + sigset_add_many() ↵Lennart Poettering2024-02-231-2/+2
| | | | args list
* ask-password: rework how we pass request meta info when asking passwordsLennart Poettering2024-02-201-4/+12
| | | | | | | | | | | Rather than adding more and more parameters to ask_password_auto(), let's pass a structure of the fields that often are constant anyway. This way, callers can fill in what they need, and we take the filled structure which we can pass around internally as one. This is in particular preparation for adding one more field in one of the next commits.
* process-util: change pid_is_alive() to not eat up errors, and add ↵Lennart Poettering2023-10-181-1/+1
| | | | | | pidref_is_alive() Let's no eat up errors, but propagate unexpected ones.
* shared/wall: use logind if build without utmp supportThorsten Kukuk2023-09-061-4/+4
| | | | | If systemd is build without utmp support, use sd_get_sessions() in utmp_wall() to get a list of logged in users with the corresponding tty.
* meson: move declarations of ask-password and friendsYu Watanabe2023-08-011-0/+9
|
* tree-wide: use -EBADF moreYu Watanabe2022-12-201-1/+1
|
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-5/+5
| | | | | | | | | | | | | | | | -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.
* 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
|
* shared/utmp-wtmp: pass information if entry is local to filter functionZbigniew Jędrzejewski-Szmek2022-05-311-1/+1
| | | | | This just adds an unused parameter for future use. No change in behaviour.
* tty-ask-password-agent: drop unnecessary code for non-absolute pathsZbigniew Jędrzejewski-Szmek2022-05-311-2/+1
| | | | | utmp_wall() always prepends /dev/, so we don't need to do this a second time here.
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-4/+1
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* time-util: add macros around timespec_store() that operates on compund ↵Lennart Poettering2022-03-181-5/+2
| | | | | | | | literal allocated timespec struct This way we can convert usec_t to timespec on-the-fly, without a buffer. No actual behaviour change just some shortening of code.
* conf-parser: merge config_parse_string() and config_parse_safe_string()Yu Watanabe2022-03-101-7/+7
| | | | | This also makes unsafe strings escaped when logged. Otherwise, journalctl may not show the log message unless '--all' is specified.
* conf-parser: add specific parser for PID valuesLennart Poettering2022-02-091-5/+5
|
* tree-wide: use config_parse_safe_string() at various placesLennart Poettering2022-02-091-7/+7
|
* Define FOREACH_DIRENT through FOREACH_DIRENT_ALLZbigniew Jędrzejewski-Szmek2021-12-151-1/+0
| | | | As in the previous commit, 'de' is used as the iterator variable name.
* shared: clean up mkdir.h/label.h situationLennart Poettering2021-11-161-1/+1
| | | | | | | | | | Previously the mkdir_label() family of calls was implemented in src/shared/mkdir-label.c but its functions partly declared ins src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird (and wrong). Let's clean this up, and add a proper mkdir-label.h matching the .c file.
* basic: split out inotify-related calls from fs-util.h → inotify-util.hLennart Poettering2021-10-051-1/+1
|
* tree-wide: mark set-but-not-used variables as unused to make LLVM happyFrantisek Sumsal2021-09-151-1/+2
| | | | | | | | | | | | | | 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. ```
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* tree-wide: "a" -> "an"Yu Watanabe2021-06-301-1/+1
|
* tty-ask-password-agent: log when starting a query on the consoleZbigniew Jędrzejewski-Szmek2021-05-311-2/+5
| | | | | | | | | | | | When looking at logs from a boot with an encrypted device, I see (with unrelevant messages snipped): [ 2.751692] systemd[1]: Started Dispatch Password Requests to Console. [ 7.929199] systemd-cryptsetup[258]: Set cipher aes, mode xts-plain64, key size 512 bits for device /dev/disk/by-uuid/2d9b648a-15b1-4204-988b-ec085089f8ce. [ 9.499483] systemd[1]: Finished Cryptography Setup for luks-2d9b648a-15b1-4204-988b-ec085089f8ce. There is a hug gap in timing without any explanatory message. If I didn't type in the password, there would be no way to figure out why things blocked from this log, so let's log something to the log too.
* tty-ask-password-agent: highlight summary in helpZbigniew Jędrzejewski-Szmek2021-05-311-1/+3
|
* tty-ask-password-agent: mention optional argument in helpZbigniew Jędrzejewski-Szmek2021-05-311-8/+9
| | | | | | | | | 0cf84693877f060254f04cf38120f52c2aa3059c added --console. 6af621248f2255f9ce50b0bafdde475305dc4e57 added an optional argument, but didn't update the help texts. Note that there is no ambiguity with the optional argument because no positional arguments are allowed.
* Add crypttab option silentSebastian Blunt2021-05-151-1/+3
| | | | | | Adds a crypttab option 'silent' that enables the AskPasswordFlag ASK_PASSWORD_SILENT. This allows usage of systemd-cryptsetup to default to silent mode, rather than requiring the user to press tab every time.
* 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.
* tree-wide: use ppoll_usec()Yu Watanabe2021-03-031-12/+6
|
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-311-1/+1
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-4/+3
| | | | | | | | | | | | 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
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-3/+2
|
* tty-ask-pw-agent: properly propagate errorLennart Poettering2020-08-261-3/+2
|
* tty-ask-pw-agent: the message string might not be setLennart Poettering2020-08-261-6/+4
|
* tty-ask-pw-agent: make sure "--list" works correctlyLennart Poettering2020-08-261-2/+2
| | | | Fixes: #16836
* tree-wide: check POLLNVAL everywhereLennart Poettering2020-06-101-0/+4
| | | | | | | | | | | | | poll() sets POLLNVAL inside of the poll structures if an invalid fd is passed. So far we generally didn't check for that, thus not taking notice of the error. Given that this specific kind of error is generally indication of a programming error, and given that our code is embedded into our projects via NSS or because people link against our library, let's explicitly check for this and convert it to EBADF. (I ran into a busy loop because of this missing check when some of my test code accidentally closed an fd it shouldn't close, so this is a real thing)
* conf-parser: return mtime in config_parse() and friendsLennart Poettering2020-06-021-1/+3
| | | | | | | | | | | | | 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.
* tree-wide: use the return value from sockaddr_un_set_path()Zbigniew Jędrzejewski-Szmek2020-03-021-6/+8
| | | | | | | | | It fully initializes the address structure, so no need for pre-initialization, and also returns the length of the address, so no need to recalculate using SOCKADDR_UN_LEN(). socklen_t is unsigned, so let's not use an int for it. (It doesn't matter, but seems cleaner and more portable to not assume anything about the type.)
* tree-wide: drop signal.h when signal-util.h is includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop socket.h when socket-util.h is includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-031-1/+0
|
* tty-ask-password: fix dead code pathZbigniew Jędrzejewski-Szmek2019-10-211-6/+4
| | | | | | | Coverity was complaining that watch==1 always at this point. CID #1405882. Use structured initialization while at it.
* tty-ask-pwd-agent: move ask_password_plymouth() in ask-password-api.cFranck Bui2019-10-051-181/+0
|