summaryrefslogtreecommitdiffstats
path: root/libexec/rshd
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-11-12 18:31:23 +0000
committerpeter <peter@FreeBSD.org>1995-11-12 18:31:23 +0000
commitf27a7effacf3dace14c48a4863a259dbfcd96139 (patch)
tree206875b98a4a846c369352cc15899629214162b9 /libexec/rshd
parenta01aa9429168245f1480fadaa22f17c436e9cf79 (diff)
downloadFreeBSD-src-f27a7effacf3dace14c48a4863a259dbfcd96139.zip
FreeBSD-src-f27a7effacf3dace14c48a4863a259dbfcd96139.tar.gz
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.
Diffstat (limited to 'libexec/rshd')
-rw-r--r--libexec/rshd/rshd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c
index 7763601..4469d4a 100644
--- a/libexec/rshd/rshd.c
+++ b/libexec/rshd/rshd.c
@@ -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);
OpenPOWER on IntegriCloud