fix(feuille.c): don't check user if not running as root

This commit is contained in:
Tom MTT. 2022-11-22 06:45:46 +01:00
parent ef6d5debfb
commit 58db0b6b33

View file

@ -234,6 +234,8 @@ int main(int argc, char *argv[])
chdir(path); chdir(path);
/* user checks */ /* user checks */
int uid, gid;
if (getuid() == 0) {
if (strlen(settings.user) == 0) if (strlen(settings.user) == 0)
settings.user = "nobody"; settings.user = "nobody";
@ -243,8 +245,9 @@ int main(int argc, char *argv[])
if ((user = getpwnam(settings.user)) == NULL) if ((user = getpwnam(settings.user)) == NULL)
die(1, "User `%s' doesn't exist\n", settings.user); die(1, "User `%s' doesn't exist\n", settings.user);
int uid = user->pw_uid; uid = user->pw_uid;
int gid = user->pw_gid; gid = user->pw_gid;
}
/* server socket creation (before dropping root permissions) */ /* server socket creation (before dropping root permissions) */