summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-05-15 02:34:24 +0000
committerMiles Bader <miles@gnu.org>1996-05-15 02:34:24 +0000
commit01e95358480684ba2337ff63fef11ca82553bdbc (patch)
tree3691e8a114f8513c1ed4b60303adcfc22d80697e /utils
parent4cd8531d6b0614d8081dc41c58592c2046b0e366 (diff)
(main): Fork login timeout watchdog before clearing the process owner.
Diffstat (limited to 'utils')
-rw-r--r--utils/login.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/utils/login.c b/utils/login.c
index 2e91e27c..b09dbc69 100644
--- a/utils/login.c
+++ b/utils/login.c
@@ -768,6 +768,22 @@ main(int argc, char *argv[])
proc_make_login_coll (proc_server);
}
+ if (eff_uids->num + avail_uids->num == 0 && parent_uids->num != 0)
+ /* We're transiting from having some uids to having none, which means
+ this is probably a new login session. Unless specified otherwise, set
+ a timer to kill this session if it hasn't aquired any ids by then.
+ Note that we fork off the timer process before clearing the process
+ owner: because we're interested in killing unowned processes, proc's
+ in-same-login-session rule should apply to us (allowing us to kill
+ them), and this way they can't kill the watchdog (because it *does*
+ have an owner). */
+ {
+ char *to = envz_get (args, args_len, "NOAUTH_TIMEOUT");
+ time_t timeout = to ? atoi (to) : 0;
+ if (timeout)
+ dog (timeout, pid);
+ }
+
if (eff_uids->num > 0)
proc_setowner (proc_server, eff_uids->ids[0], 0);
else
@@ -960,17 +976,6 @@ main(int argc, char *argv[])
/* Only add utmp entries for the session leader. */
add_utmp_entry (args, args_len, 0, !parent_has_uid (0));
- if (eff_uids->num + avail_uids->num == 0 && parent_uids->num != 0)
- /* We're transiting from having some uids to having none, which means
- this is probably a new login session. Unless specified otherwise, set
- a timer to kill this session if it hasn't aquired any ids by then. */
- {
- char *to = envz_get (args, args_len, "NOAUTH_TIMEOUT");
- time_t timeout = to ? atoi (to) : 0;
- if (timeout)
- dog (timeout, pid);
- }
-
if ((eff_uids->num | eff_gids->num) && !no_login)
{
char *tty = ttyname (0);