summaryrefslogtreecommitdiff
path: root/src/sysusers
Commit message (Collapse)AuthorAgeFilesLines
* Revert "sysusers: properly mark generated accounts as locked"Zbigniew Jędrzejewski-Szmek2019-10-221-1/+1
| | | | | | | | | | This reverts the gist of commit 636e72bce63e7e99b76357f7d524d16f61558775. The comment and the tiny cleanup are left alone. We shouldn't lock the accounts because people actually need to use them, and if they are locked, various tools will refuse. See https://github.com/systemd/systemd/pull/13277#issuecomment-529964578 and follow-up comments.
* sysusers: properly mark generated accounts as lockedLennart Poettering2019-08-141-3/+3
| | | | | | | | | | | | | | | | | | Previously, we'd only set the shell to /usr/bin/nologin and lock the password for system users. Let's go one step further and also lock the whole account. This is a paranoid safety precaution, since neither disabling the shell like this nor disabling the password is sufficient to lock an account, since remote shell tools generally allow passing different shells, and logins into ftp or similar protocols don't know the shell concept anyway. Moreover, in times of ssh authentication by password is just one option of authentication among many. Takes inspiration from the recommendations in usermod(8)'s -L switch: "Note: if you wish to lock the account (not only access with a password), you should also set the EXPIRE_DATE to 1."
* Merge pull request #13096 from keszybz/unit-loadingZbigniew Jędrzejewski-Szmek2019-07-191-35/+2
|\ | | | | Preparatory work for the unit loading rework
| * sysusers,strv: export the hash ops to map char* → strvZbigniew Jędrzejewski-Szmek2019-07-191-35/+2
| | | | | | | | Also make string_strv_hashmap_put return 0 only if the entry already existed.
* | meson: make nologin path build time configurableMichael Biebl2019-07-181-1/+1
|/ | | | | | | | | Some distros install nologin as /usr/sbin/nologin, others as /sbin/nologin. Since we can't really on merged-usr everywhere (where the path wouldn't matter), make the path build time configurable via -Dnologin-path=. Closes #13028
* Rename EXTRACT_QUOTES to EXTRACT_UNQUOTEZbigniew Jędrzejewski-Szmek2019-06-281-1/+1
| | | | | | Whenever I see EXTRACT_QUOTES, I'm always confused whether it means to leave the quotes in or to take them out. Let's say "unquote", like we say "cunescape".
* tree-wide: introduce empty_or_dash() helperLennart Poettering2019-04-081-5/+5
| | | | | At quite a few places we check isempty() || streq(…, "-"), let's add a helper to simplify that, and replace that by a single function call.
* sysusers: use return_error_errno() where possibleZbigniew Jędrzejewski-Szmek2019-04-071-140/+119
|
* sysusers: add missing initalizerZbigniew Jędrzejewski-Szmek2019-04-071-1/+1
| | | | | I assume that this is the error causing the invalid free in https://bugzilla.redhat.com/show_bug.cgi?id=1670679.
* tree-wide: (void)ify a few unlink() and rmdir()Lennart Poettering2019-03-271-1/+1
| | | | | | Let's be helpful to static analyzers which care about whether we knowingly ignore return values. We do in these cases, since they are usually part of error paths.
* Merge pull request #10920 from yuwata/hashmap-destructorLennart Poettering2018-12-031-127/+88
|\ | | | | hashmap: make hashmap_free() call destructors of key or value
| * sysusers: define main through macroYu Watanabe2018-12-021-119/+86
| | | | | | | | | | This also fixes possible memleak when uid/gid or user/group name in database are conflicted.
| * sysusers: use fgetgrent_sane()Yu Watanabe2018-12-021-8/+2
| |
* | util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-021-0/+1
| | | | | | | | | | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* | util-lib: don't include fileio.h from fileio-label.hLennart Poettering2018-12-021-1/+1
|/ | | | There's no reason for doing that, hence simply don't.
* sysusers: use ordered_hashmap_steal_first_key_and_value()Yu Watanabe2018-11-231-4/+4
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-16/+13
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-1/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* basic/pager: convert the pager options to a flags argumentZbigniew Jędrzejewski-Szmek2018-11-141-3/+3
| | | | | Pretty much everything uses just the first argument, and this doesn't make this common pattern more complicated, but makes it simpler to pass multiple options.
* sysusers: FOREACH_LINE excorcismLennart Poettering2018-10-181-2/+8
|
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-4/+15
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* Merge pull request #9274 from poettering/comment-header-cleanupZbigniew Jędrzejewski-Szmek2018-06-141-5/+0
|\ | | | | drop "this file is part of systemd" and lennart's copyright from header
| * tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | | | | | | | | | | | | 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-06-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | sysusers: use fchmod_and_chown()Yu Watanabe2018-06-141-12/+4
|/
* binfmt,sysctl,sysuers,tmpfiles: add auto-paging for --cat-config commandsLennart Poettering2018-06-131-1/+15
| | | | | The output of these commands is really long, and already enriched with color. Let's add auto-paging to make this easier to digest.
* path-util: introduce path_simplify()Yu Watanabe2018-06-031-4/+2
| | | | | | | | The function is similar to path_kill_slashes() but also removes initial './', trailing '/.', and '/./' in the path. When the second argument of path_simplify() is false, then it behaves as the same as path_kill_slashes(). Hence, this also replaces path_kill_slashes() with path_simplify().
* sysusers: support specifier expansion for GECOS and home directory fieldsYu Watanabe2018-05-311-8/+20
|
* core: introduce specifiers for /tmp and /var/tmpLennart Poettering2018-05-291-3/+5
| | | | | | | | | | | This corresponds nicely with the specifiers we already pass for /var/lib, /var/cache, /run and so on. This is particular useful to update the test-path service files to operate without guessable files, thus allowing multiple parallel test-path invocations to pass without issues (the idea is to set $TMPDIR early on in the test to some private directory, and then only use the new %T or %V specifier to refer to it).
* sysusers: drop an unused variableYu Watanabe2018-05-151-1/+0
| | | | Follow-up for ec0327d69c260d9a3770e9d722dbdcde996651cc.
* Eliminate config_dirs vars which hold a static strvZbigniew Jędrzejewski-Szmek2018-05-071-5/+3
|
* sysusers: add --cat-configZbigniew Jędrzejewski-Szmek2018-04-271-22/+42
|
* sysusers: use uniform order for variablesZbigniew Jędrzejewski-Szmek2018-04-201-3/+3
| | | | Follow-up for 43e948eea6.
* Merge pull request #8754 from poettering/sysusers-fixZbigniew Jędrzejewski-Szmek2018-04-191-7/+9
|\ | | | | two minor memleak fixes for sysusers, fixing #8718
| * sysusers: fix minor memory leakLennart Poettering2018-04-181-0/+2
| |
| * sysusers: clarify that we knowingly ignore process_items() return valuesLennart Poettering2018-04-181-2/+2
| |
| * sysusers: fix memory leak when /etc/passwd contains multiple identical linesLennart Poettering2018-04-181-5/+5
| | | | | | | | Fixes: #8718
* | tree-wide: drop spurious newlines (#8764)Lennart Poettering2018-04-191-1/+0
|/ | | | | | | | Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | 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.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-051-30/+16
|
* user-util: add new wrappers for reading/writing {passwd,shadow,gshadow} ↵Franck Bui2018-03-211-94/+58
| | | | | | | | 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.
* sysusers: make sure to reset errno before calling fget*ent()Franck Bui2018-03-201-1/+8
| | | | | Due to the glibc interface we have to test errno in various places to detect if an error occured after calling fget*ent() helpers.
* sysusers: also add support for NIS entries in /etc/shadowFranck Bui2018-03-201-1/+19
| | | | | | Commit 563dc6f8e2cda4114dd20f32655890ed378c3740 added support for /etc/{passwd,group} only but since nsswitch.conf(5) appears to document the NIS entries also for shadow, let's support this case too.
* sysusers: do not append entries after the NIS onesFranck Bui2018-03-161-2/+32
| | | | | | | | | | | | | | | The NIS-catchall entry switches from files to NIS lookup and never goes back, so it must be the last entry in /etc/passwd (the other +/-{user,@netgroup} entries don't have to be). That's how the nss_compat mode for /etc/passwd (and /etc/group) traditionally works. It's age-old historic behaviour that the NIS entry must be the last one. It doesn't seem to be specified somewhere, but it worked like this since very early SunOS when NIS was first included. Fixes: #8467
* sysusers: support `u username -:300` style syntax (#8325)Michael Vogt2018-03-021-5/+6
| | | | | | | | This PR implements the first part of RFE #8046. I.e. this allows to write: ``` u username -:300 ``` Where the uid is chosen automatically but the gid is fixed.
* sysusers: do not implicitly create group by 'm' if 'u' with the same name existsYu Watanabe2018-03-021-31/+26
| | | | | | The commit e2c2060f7b3b11fa3cca8899d80963b7a05cc4ab makes 'm' lines disturb 'u' lines. This fixes the disturbance.
* sysusers: do not create duplicated groups when create usersYu Watanabe2018-03-021-4/+17
| | | | | | | The commit e2c2060f7b3b11fa3cca8899d80963b7a05cc4ab introduces the issue #8315. Fixes #8315.
* tmpfiles: allow admin/runtime overrides to runtime configZbigniew Jędrzejewski-Szmek2018-02-051-1/+1
| | | | | This is very similar to d16a1c1bb6. For tmpfiles this is much less useful compared to sysusers, but let's add this anyway for consistency.
* sysusers: use the usual comment styleZbigniew Jędrzejewski-Szmek2018-02-021-2/+5
|