sysusers: allow the shell to be specified

This is necessary for some system users where the "login shell" is
set to a specific binary.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-02-02 10:35:30 +01:00
parent 1b600bd522
commit 7b1aaf6633
4 changed files with 111 additions and 64 deletions
+2
View File
@@ -645,6 +645,8 @@ bool valid_gecos(const char *d) {
}
bool valid_home(const char *p) {
/* Note that this function is also called by valid_shell(), any
* changes must account for that. */
if (isempty(p))
return false;
+9
View File
@@ -98,6 +98,15 @@ bool valid_user_group_name_or_id(const char *u);
bool valid_gecos(const char *d);
bool valid_home(const char *p);
static inline bool valid_shell(const char *p) {
/* We have the same requirements, so just piggy-back on the home check.
*
* Let's ignore /etc/shells because this is only applicable to real and
* not system users. It is also incompatible with the idea of empty /etc.
*/
return valid_home(p);
}
int maybe_setgroups(size_t size, const gid_t *list);
bool synthesize_nobody(void);