summaryrefslogtreecommitdiff
path: root/src/basic/user-util.c
Commit message (Collapse)AuthorAge
* Prep v239: Add missing updates that evaded migration.Sven Eden2018-08-24
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* user-util: trivial coding style fixesLennart Poettering2018-08-24
| | | | | Use C's downgrade-to-bool feature when comparing pointers against NULL, as we usually do.
* sysusers: make sure to reset the returned value when EOF is reached in ↵Franck Bui2018-08-24
| | | | | | | | | | | | fget*ent_sane() wrappers (#8737) To indicate that the there're no more entries, these wrappers return false but did leave the passed pointed unmodified. However EOF is not an error and is a very common case so initialize the output argument to NULL even in this case so callers don't need to do that. Fixes: #8721
* util-lib: introduce new empty_or_root() helper (#8746)Lennart Poettering2018-08-24
| | | | | | | | We check the same condition at various places. Let's add a trivial, common helper for this, and use it everywhere. It's not going to make things much faster or much shorter, but I think a lot more readable
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* user-util: add new wrappers for reading/writing {passwd,shadow,gshadow} ↵Franck Bui2018-08-24
| | | | | | | | | database files (#8521) The API povided by the glibc is too error-prone as one has to deal directly with errno in order to detect if errors occured. Suggested by Zbigniew.
* user-util: also consider /bin/false and /bin/true as non-shellLennart Poettering2018-05-30
|
* sysusers: allow the shell to be specifiedZbigniew Jędrzejewski-Szmek2018-05-30
| | | | | This is necessary for some system users where the "login shell" is set to a specific binary.
* sysusers: emit a bit more info at debug level when locking failsZbigniew Jędrzejewski-Szmek2018-05-30
| | | | | | This is the first error message when running unprivileged, and the message is unspecific, so let's at least add some logging at debug level to make this less confusing.
* nss-systemd,user-util: add a way how synthesizing "nobody" can be turned offLennart Poettering2018-05-30
| | | | | | | | | | | This is quite ugly, but provides us with an avenue for moving distributions to define the "nobody" user properly without breaking legacy systems that us the name for other stuff. The idea is basically, that the distribution adopts the new definition of "nobody" (and thus recompiles systemd with it) and then touches /etc/systemd/dont-synthesize-nobody on legacy systems to turn off possibly conflicting synthesizing of the nobody name by systemd.
* user-util: minor updates of in_gid()Lennart Poettering2018-05-30
| | | | | Let's use newa() and use the right type for storing sysconf() return values.
* Prep v236 : Add missing SPDX-License-Identifier (2/9) src/basicSven Eden2018-03-26
|
* tree-wide: use IN_SET macro (#6977)Yu Watanabe2017-12-08
|
* util-lib: add a comment explaining the user name rules we enforceLennart Poettering2017-07-17
|
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* Prep v232.2: Mask more unneeded functionsSven Eden2017-07-07
|
* Prep v232: Add missing includesSven Eden2017-07-05
|
* user-util: rework maybe_setgroups() a bitLennart Poettering2017-07-05
| | | | | | | | | | | | | | | Let's drop the caching of the setgroups /proc field for now. While there's a strict regime in place when it changes states, let's better not cache it since we cannot really be sure we follow that regime correctly. More importantly however, this is not in performance sensitive code, and there's no indication the cache is really beneficial, hence let's drop the caching and make things a bit simpler. Also, while we are at it, rework the error handling a bit, and always return negative errno-style error codes, following our usual coding style. This has the benefit that we can sensible hanld read_one_line_file() errors, without having to updat errno explicitly.
* core: do not fail in a container if we can't use setgroupsGiuseppe Scrivano2017-07-05
| | | | It might be blocked through /proc/PID/setgroups
* execute: move suppression of HOME=/ and SHELL=/bin/nologin into user-util.cLennart Poettering2017-07-05
| | | | | | | This adds a new call get_user_creds_clean(), which is just like get_user_creds() but returns NULL in the home/shell parameters if they contain no useful information. This code previously lived in execute.c, but by generalizing this we can reuse it in run.c.
* sysusers: move various user credential validity checks to src/basic/Lennart Poettering2017-07-05
| | | | | | | This way we can reuse them for validating User=/Group= settings in unit files (to be added in a later commit). Also, add some tests for them.
* treewide: fix typos and remove accidental repetition of wordsTorstein Husebø2017-06-16
|
* Prep v230: Add utmp support to make wall message to work properly.Sven Eden2017-06-16
|
* basic: user-utils.c needs missing.h for secure_getenv (#3059)michaelolbrich2017-06-16
| | | | | | | Otherwise building may fail with: src/basic/user-util.c: In function 'get_home_dir': src/basic/user-util.c:343:9: error: implicit declaration of function 'secure_getenv' [-Werror=implicit-function-declaration]
* Prep v229: Add missing fixes from upstream [1/6] src/basicSven Eden2017-05-17
|
* basic: add missing word in commentZbigniew Jędrzejewski-Szmek2017-05-17
|
* Prep v228: Condense elogind source masks (3/5)Sven Eden2017-04-26
|
* Prep v228: Clean up the new src/basic/*-util-[hc] files:Sven Eden2017-04-26
| | | | | | | | | | | | | - src/basic/capability-util.[hc] - src/basic/cgroup-util.[hc] - src/basic/fd-util.[hc] - src/basic/fs-util.[hc] - src/basic/memfd-util.[hc] - src/basic/path-util.[hc] - src/basic/socket-util.[hc] - src/basic/terminal-util.[hc] - src/basic/user-util.[hc] - src/basic/xattr-util.[hc]
* Prep v228: Add remaining updates from upstream (1/3)Sven Eden2017-04-26
The util.[hc] files have been stripped of a lot of functions, that got sorted into various new files representing the type of utility. This commit adds the missing files.