summaryrefslogtreecommitdiffstats
path: root/src/userdb (follow)
Commit message (Collapse)AuthorAgeFilesLines
* table: drop last SIZE_MAX from table_set_sort() and table_set_display()Yu Watanabe2021-03-041-6/+6
|
* tree-wide: use parse_boolean_argument() for variables with non-boolean typeZbigniew Jędrzejewski-Szmek2021-02-171-4/+5
| | | | | This still works nicely, but we need to assign the return value ourselves. As before, one nice effect is that error messages are uniform.
* tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | | 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.
* tree-wide: enable colorized logging for daemons when run in consoleYu Watanabe2021-01-313-3/+3
| | | | It may be useful when debugging daemons.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-5/+5
| | | | | | | | | | | | 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: unsetenv cannot failZbigniew Jędrzejewski-Szmek2020-11-101-4/+2
| | | | | | ... when called with a valid environment variable name. This means that any time we call it with a fixed string, it is guaranteed to return 0. (Also when the variable is not present in the environment block.)
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-096-6/+6
|
* shared: merge {user,group}-record-nss.{c,h}Zbigniew Jędrzejewski-Szmek2020-09-011-1/+0
| | | | | They both are both short and contain similar parts and various helper will be shared between both parts of the code so it's easier to use a single file.
* userdb: fix typoZbigniew Jędrzejewski-Szmek2020-09-011-1/+1
|
* userdbctl: add forgotten --output mode in helpZbigniew Jędrzejewski-Szmek2020-09-011-1/+2
|
* shared: merge {user,group}-record-show.[ch]Zbigniew Jędrzejewski-Szmek2020-09-011-1/+0
| | | | | It is natural to include both, and in total they declared three functions. Let's merge them for simplicity.
* userdb: add "description" field to group recordsLennart Poettering2020-08-071-2/+4
| | | | | | | | | User records have the realname/gecos fields, groups never had that, but it would really be useful to have it, hence let's add it with similar semantics. We enforce the same syntax as for GECOS, since it's better to start with strict rules and losen them later instead of the opposite.
* Merge pull request #16385 from JackFangXN/masterLennart Poettering2020-07-081-3/+3
|\ | | | | table add table_log_xx_error()
| * table use table_log_print_error() instead of table_log_show_errorfangxiuning2020-07-081-3/+3
| |
| * table add table_log_show_error()fangxiuning2020-07-081-3/+3
| |
* | Merge pull request #16344 from keszybz/update-utmp-erofsLennart Poettering2020-07-061-1/+1
|\ \ | |/ |/| Make update-utmp not fail if it only fails to write wtmp records
| * various daemons: emit Stopping... notification before destructing the ↵Zbigniew Jędrzejewski-Szmek2020-07-021-1/+1
| | | | | | | | | | | | | | | | manager object This is mostly cosmetic, but let's reorder the destructors so that we do the final sd_notify() call before we run the destructor for the manager object.
* | userdbctl homectl use table_log_add_error()fangxiuning2020-07-061-4/+4
|/ | | | Signed-off-by: fangxiuning <fangxiuning123@126.com>
* log: introduce log_parse_environment_cli() and log_setup_cli()Filipe Brandenburger2020-06-241-3/+1
| | | | | | | | | | | | | | | | 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.
* Merge pull request #16112 from poettering/nss-systemd-block-fixLennart Poettering2020-06-241-3/+2
|\ | | | | rework nss-systemd recursion lock
| * userdb: replace recursion lockLennart Poettering2020-06-231-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we'd used the existance of a specific AF_UNIX socket in the abstract namespace as lock for disabling lookup recursions. (for breaking out of the loop: userdb synthesized from nss → nss synthesized from userdb → userdb synthesized from nss → …) I did it like that because it promised to work the same both in static and in dynmically linked environments and is accessible easily from any programming language. However, it has a weakness regarding reuse attacks: the socket is securely hashed (siphash) from the thread ID in combination with the AT_RANDOM secret. Thus it should not be guessable from an attacker in advance. That's only true if a thread takes the lock only once and keeps it forever. However, if a thread takes and releases it multiple times an attacker might monitor that and quickly take the lock after the first iteration for follow-up iterations. It's not a big issue given that userdb (as the primary user for this) never released the lock and we never made the concept a public interface, and it was only included in one release so far, but it's something that deserves fixing. (moreover it's a local DoS only, only permitting to disable native userdb lookups) With this rework the libnss_systemd.so.2 module will now export two additional symbols. These symbols are not used by glibc, but can be used by arbitrary programs: one can be used to disable nss-systemd, the other to check if it is currently disabled. The lock is per-thread. It's slightly less pretty, since it requires people to manually link against C code via dlopen()/dlsym(), but it should work safely without the aforementioned weakness.
* | tree-wide: port to fd_wait_for_event()Lennart Poettering2020-06-101-10/+5
| | | | | | | | | | | | | | | | Prompted by the discussion on #16110, let's migrate more code to fd_wait_for_event(). This only leaves 7 places where we call into poll()/poll() directly in our entire codebase. (one of which is fd_wait_for_event() itself)
* | tree-wide: check POLLNVAL everywhereLennart Poettering2020-06-101-0/+2
|/ | | | | | | | | | | | | 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)
* userwork: remove trailing comma in messageZbigniew Jędrzejewski-Szmek2020-05-271-1/+1
|
* userwork: fix typos in commentZbigniew Jędrzejewski-Szmek2020-05-261-3/+5
|
* userdbctl: make --help fit in 80 columnsZbigniew Jędrzejewski-Szmek2020-04-281-16/+16
|
* tree-wide: spellcheck using codespellZbigniew Jędrzejewski-Szmek2020-04-161-1/+1
| | | | Fixes #15436.
* Merge pull request #15377 from poettering/userdb-no-shadowZbigniew Jędrzejewski-Szmek2020-04-111-5/+5
|\ | | | | don't try to access shadow from logind
| * userdb: when doing client-side NSS look-ups optionally avoid shadow look-upsLennart Poettering2020-04-091-5/+5
| |
* | userdbctl: drop redundant user name validity checkLennart Poettering2020-04-081-6/+5
|/ | | | | | | The userdb_by_name() invocation immediately following does the same check anyway, no need to do this twice. (Also, make sure we exit the function early on failure)
* userwork: fix signal worker sends to manager requesting more workersLennart Poettering2020-03-301-1/+1
| | | | | | | | | That's what you get for changing these signals around, after checking everything works, not before. Bad, Lennart, bad! Fixes: #15085
* homed,userdb: don't use sockaddr_un_set_path() on fixed addressesZbigniew Jędrzejewski-Szmek2020-03-021-5/+4
| | | | Let's use structured initialization and let the compiler do its job.
* tree-wide: use the return value from sockaddr_un_set_path()Zbigniew Jędrzejewski-Szmek2020-03-021-1/+3
| | | | | | | | | 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.)
* userdb: fix memleakYu Watanabe2020-02-261-1/+1
| | | | Fixes #14947.
* systemd: Fix busctl crash on aarch64 when setting output table formatAlin Popa2020-02-151-6/+6
| | | | | | | | The enum used for column names is integer type while table_set_display() is parsing arguments on size_t alignment which may result in assert in table_set_display() if the size between types missmatch. This patch cast the enums to size_t. It also fixes all other occurences for table_set_display() and table_set_sort().
* userdbd: fix memleakYu Watanabe2020-01-311-1/+1
| | | | Fixes CID#1412416.
* userdbd: add userdbctl tool as client for userdbdLennart Poettering2020-01-152-0/+794
|
* userdbd: add new service that can merge userdb queries from multiple clientsLennart Poettering2020-01-155-0/+1181