diff --git a/meson.build b/meson.build index 3bdd87fc6b..bdde42b996 100644 --- a/meson.build +++ b/meson.build @@ -680,9 +680,16 @@ 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) +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/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; 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 - - -