fix(feuille.c): don't check user if not running as root
This commit is contained in:
parent
ef6d5debfb
commit
58db0b6b33
1 changed files with 11 additions and 8 deletions
19
feuille.c
19
feuille.c
|
@ -234,17 +234,20 @@ int main(int argc, char *argv[])
|
||||||
chdir(path);
|
chdir(path);
|
||||||
|
|
||||||
/* user checks */
|
/* user checks */
|
||||||
if (strlen(settings.user) == 0)
|
int uid, gid;
|
||||||
settings.user = "nobody";
|
if (getuid() == 0) {
|
||||||
|
if (strlen(settings.user) == 0)
|
||||||
|
settings.user = "nobody";
|
||||||
|
|
||||||
verbose(2, "getting uid and gid of user `%s'...", settings.user);
|
verbose(2, "getting uid and gid of user `%s'...", settings.user);
|
||||||
|
|
||||||
struct passwd *user;
|
struct passwd *user;
|
||||||
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) */
|
||||||
|
|
Reference in a new issue