diff options
author | Michael Biebl <biebl@debian.org> | 2019-07-18 01:24:00 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2019-07-18 12:46:35 +0200 |
commit | 6db904625d413739c480ddbe7667d3f40acc4ae0 (patch) | |
tree | 36462ca0acf0bf85407d860c55e49b032a5495a7 /src | |
parent | ea582a0f1b052330a45b5d7bbc9fb860d1c0d98b (diff) | |
download | systemd-6db904625d413739c480ddbe7667d3f40acc4ae0.tar.gz systemd-6db904625d413739c480ddbe7667d3f40acc4ae0.tar.bz2 systemd-6db904625d413739c480ddbe7667d3f40acc4ae0.zip |
meson: make nologin path build time configurable
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
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/user-util.c | 4 | ||||
-rw-r--r-- | src/nss-mymachines/nss-mymachines.c | 4 | ||||
-rw-r--r-- | src/nss-systemd/nss-systemd.c | 4 | ||||
-rw-r--r-- | src/sysusers/sysusers.c | 2 | ||||
-rw-r--r-- | src/test/test-user-util.c | 4 |
5 files changed, 9 insertions, 9 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c index b8eb894f40..d127b0c107 100644 --- a/src/basic/user-util.c +++ b/src/basic/user-util.c @@ -148,7 +148,7 @@ static int synthesize_user_creds( *home = FLAGS_SET(flags, USER_CREDS_CLEAN) ? NULL : "/"; if (shell) - *shell = FLAGS_SET(flags, USER_CREDS_CLEAN) ? NULL : "/sbin/nologin"; + *shell = FLAGS_SET(flags, USER_CREDS_CLEAN) ? NULL : NOLOGIN; return 0; } @@ -538,7 +538,7 @@ int get_shell(char **_s) { } if (synthesize_nobody() && u == UID_NOBODY) { - s = strdup("/sbin/nologin"); + s = strdup(NOLOGIN); if (!s) return -ENOMEM; diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c index 0e76c43172..364356da56 100644 --- a/src/nss-mymachines/nss-mymachines.c +++ b/src/nss-mymachines/nss-mymachines.c @@ -503,7 +503,7 @@ enum nss_status _nss_mymachines_getpwnam_r( pwd->pw_gecos = buffer; pwd->pw_passwd = (char*) "*"; /* locked */ pwd->pw_dir = (char*) "/"; - pwd->pw_shell = (char*) "/sbin/nologin"; + pwd->pw_shell = (char*) NOLOGIN; return NSS_STATUS_SUCCESS; @@ -583,7 +583,7 @@ enum nss_status _nss_mymachines_getpwuid_r( pwd->pw_gecos = buffer; pwd->pw_passwd = (char*) "*"; /* locked */ pwd->pw_dir = (char*) "/"; - pwd->pw_shell = (char*) "/sbin/nologin"; + pwd->pw_shell = (char*) NOLOGIN; return NSS_STATUS_SUCCESS; diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c index 8beae06d87..8ef1cd5ea9 100644 --- a/src/nss-systemd/nss-systemd.c +++ b/src/nss-systemd/nss-systemd.c @@ -24,7 +24,7 @@ #define DYNAMIC_USER_GECOS "Dynamic User" #define DYNAMIC_USER_PASSWD "*" /* locked */ #define DYNAMIC_USER_DIR "/" -#define DYNAMIC_USER_SHELL "/sbin/nologin" +#define DYNAMIC_USER_SHELL NOLOGIN static const struct passwd root_passwd = { .pw_name = (char*) "root", @@ -43,7 +43,7 @@ static const struct passwd nobody_passwd = { .pw_gid = GID_NOBODY, .pw_gecos = (char*) "User Nobody", .pw_dir = (char*) "/", - .pw_shell = (char*) "/sbin/nologin", + .pw_shell = (char*) NOLOGIN, }; static const struct group root_group = { diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 990a2f927b..f9cb338d8a 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -361,7 +361,7 @@ static int rename_and_apply_smack(const char *temp_path, const char *dest_path) } static const char* default_shell(uid_t uid) { - return uid == 0 ? "/bin/sh" : "/sbin/nologin"; + return uid == 0 ? "/bin/sh" : NOLOGIN; } static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char **tmpfile_path) { diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c index fd7878fde2..e6d7262e78 100644 --- a/src/test/test-user-util.c +++ b/src/test/test-user-util.c @@ -219,8 +219,8 @@ int main(int argc, char *argv[]) { test_get_user_creds_one("root", "root", 0, 0, "/root", "/bin/sh"); test_get_user_creds_one("0", "root", 0, 0, "/root", "/bin/sh"); - test_get_user_creds_one(NOBODY_USER_NAME, NOBODY_USER_NAME, UID_NOBODY, GID_NOBODY, "/", "/sbin/nologin"); - test_get_user_creds_one("65534", NOBODY_USER_NAME, UID_NOBODY, GID_NOBODY, "/", "/sbin/nologin"); + test_get_user_creds_one(NOBODY_USER_NAME, NOBODY_USER_NAME, UID_NOBODY, GID_NOBODY, "/", NOLOGIN); + test_get_user_creds_one("65534", NOBODY_USER_NAME, UID_NOBODY, GID_NOBODY, "/", NOLOGIN); test_get_group_creds_one("root", "root", 0); test_get_group_creds_one("0", "root", 0); |