From a3d37fe9a359c81475a5d2db8c6574e05e88aa71 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 7 Dec 2017 15:48:44 +0900 Subject: [PATCH 1/3] test: use NOBODY_USER_NAME instead of hard-coded string "noody" --- src/test/test-acl-util.c | 2 +- src/test/test-capability.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/test-acl-util.c b/src/test/test-acl-util.c index 7b66e189ba..70ffdbc519 100644 --- a/src/test/test-acl-util.c +++ b/src/test/test-acl-util.c @@ -49,7 +49,7 @@ static void test_add_acls_for_user(void) { assert_se(system(cmd) == 0); if (getuid() == 0) { - const char *nobody = "nobody"; + const char *nobody = NOBODY_USER_NAME; r = get_user_creds(&nobody, &uid, NULL, NULL, NULL); if (r < 0) uid = 0; diff --git a/src/test/test-capability.c b/src/test/test-capability.c index 6c41e1ca15..e5db52d404 100644 --- a/src/test/test-capability.c +++ b/src/test/test-capability.c @@ -108,7 +108,7 @@ static int setup_tests(bool *run_ambient) { struct passwd *nobody; int r; - nobody = getpwnam("nobody"); + nobody = getpwnam(NOBODY_USER_NAME); if (!nobody) { log_error_errno(errno, "Could not find nobody user: %m"); return -EXIT_TEST_SKIP; From 60712021651ad0e22515469784d0bee9e040e132 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 7 Dec 2017 15:49:16 +0900 Subject: [PATCH 2/3] sysusers: use NOBODY_USER_NAME --- meson.build | 2 ++ sysusers.d/basic.conf.in | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3bdd87fc6b..c70a9874ad 100644 --- a/meson.build +++ b/meson.build @@ -683,6 +683,8 @@ endif conf.set_quoted('NOBODY_USER_NAME', nobody_user) conf.set_quoted('NOBODY_GROUP_NAME', nobody_group) +substs.set('NOBODY_USER_NAME', nobody_user) +substs.set('NOBODY_GROUP_NAME', nobody_group) tty_gid = get_option('tty-gid') conf.set('TTY_GID', tty_gid) diff --git a/sysusers.d/basic.conf.in b/sysusers.d/basic.conf.in index 78b764bdef..8e358c02d6 100644 --- a/sysusers.d/basic.conf.in +++ b/sysusers.d/basic.conf.in @@ -9,7 +9,7 @@ u root 0 "Super User" /root # The nobody user for NFS file systems -u nobody 65534 "Nobody" - +u @NOBODY_USER_NAME@ 65534 "Nobody" - # Administrator group: can *see* more than normal users g adm - - - From 8374cc623579e57ae79b62fce2f11627957148e2 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 7 Dec 2017 17:19:11 +0900 Subject: [PATCH 3/3] meson: warn if nobody-user and nobody-group are set to different name It may work, but is very strange. So, let's warn about that. v2: Debian uses nobody and nogroup. Do not warn such case. --- meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meson.build b/meson.build index c70a9874ad..bdde42b996 100644 --- a/meson.build +++ b/meson.build @@ -680,6 +680,11 @@ if id_result.returncode() == 0 ' Your build will result in an group table setup that is incompatible with the local system.') endif endif +if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup') + message('WARNING:\n' + + ' The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) + + ' Please re-check that both "nobody-user" and "nobody-group" options are correctly set.') +endif conf.set_quoted('NOBODY_USER_NAME', nobody_user) conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)