diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/user-util.c | 2 | ||||
-rw-r--r-- | src/basic/user-util.h | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c index ecb1e5fc8..defc30ba9 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -653,6 +653,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; diff --git a/src/basic/user-util.h b/src/basic/user-util.h index 6b2f1af52..2bd1ee9a7 100644 --- a/src/basic/user-util.h +++ b/src/basic/user-util.h @@ -108,6 +108,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); |