mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Move the setlogin() call a little earlier.. It was being done in the child
process - which would be no longer allowed if the setlogin() changes go through. Now the parent (the session leader, when started by inetd) does it.
This commit is contained in:
parent
a07ffb0cda
commit
b048c73588
1 changed files with 5 additions and 4 deletions
|
|
@ -469,6 +469,11 @@ fail:
|
|||
error("Logins currently disabled.\n");
|
||||
exit(1);
|
||||
}
|
||||
#if BSD > 43
|
||||
/* before fork, while we're session leader */
|
||||
if (setlogin(pwd->pw_name) < 0)
|
||||
syslog(LOG_ERR, "setlogin() failed: %m");
|
||||
#endif
|
||||
|
||||
(void) write(STDERR_FILENO, "\0", 1);
|
||||
sent_null = 1;
|
||||
|
|
@ -643,10 +648,6 @@ fail:
|
|||
}
|
||||
if (*pwd->pw_shell == '\0')
|
||||
pwd->pw_shell = _PATH_BSHELL;
|
||||
#if BSD > 43
|
||||
if (setlogin(pwd->pw_name) < 0)
|
||||
syslog(LOG_ERR, "setlogin() failed: %m");
|
||||
#endif
|
||||
(void) setgid((gid_t)pwd->pw_gid);
|
||||
initgroups(pwd->pw_name, pwd->pw_gid);
|
||||
(void) setuid((uid_t)pwd->pw_uid);
|
||||
|
|
|
|||
Loading…
Reference in a new issue