From 87aea25f1ac7caf3a788f17c62164c0103ec3d35 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 10 May 2002 12:20:24 +1000 Subject: - (djm) Try to drop supplemental groups at daemon startup. Patch from RedHat --- sshd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sshd.c') diff --git a/sshd.c b/sshd.c index f3e4d835e..589a1160d 100644 --- a/sshd.c +++ b/sshd.c @@ -1005,6 +1005,16 @@ main(int ac, char **av) if (test_flag) exit(0); + /* + * Clear out any supplemental groups we may have inherited. This + * prevents inadvertent creation of files with bad modes (in the + * portable version at least, it's certainly possible for PAM + * to create a file, and we can't control the code in every + * module which might be used). + */ + if (setgroups(0, NULL) < 0) + debug("setgroups() failed: %.200s", strerror(errno)); + /* Initialize the log (it is reinitialized below in case we forked). */ if (debug_flag && !inetd_flag) log_stderr = 1; -- cgit v1.2.3