summaryrefslogtreecommitdiff
path: root/security/openssh/patches/patch-an
blob: 1f9b109f87741778055cef8456b6faa9e145fed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
$NetBSD: patch-an,v 1.3 2004/08/04 06:43:52 minskim Exp $

--- sshd.c.orig	Sun Mar 21 16:36:01 2004
+++ sshd.c
@@ -52,6 +52,9 @@ RCSID("$OpenBSD: sshd.c,v 1.290 2004/03/
 #include <sys/security.h>
 #include <prot.h>
 #endif
+#ifdef __INTERIX
+#include <interix/security.h>
+#endif /* __INTERIX */
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -570,10 +573,15 @@ privsep_preauth_child(void)
 	/* XXX not ready, too heavy after chroot */
 	do_setusercontext(pw);
 #else
+#ifdef __INTERIX
+	if (setuser(SSH_PRIVSEP_USER, NULL, SU_COMPLETE) != 0)
+		fatal("setuser: %s, %.100s", SSH_PRIVSEP_USER, strerror(errno));
+#else /* __INTERIX */
 	gidset[0] = pw->pw_gid;
 	if (setgroups(1, gidset) < 0)
 		fatal("setgroups: %.100s", strerror(errno));
 	permanently_set_uid(pw);
+#endif /* __INTERIX */
 #endif
 }
 
@@ -817,8 +825,10 @@ main(int ac, char **av)
 	av = saved_argv;
 #endif
 
+#ifndef __INTERIX
 	if (geteuid() == 0 && setgroups(0, NULL) == -1)
 		debug("setgroups(): %.200s", strerror(errno));
+#endif
 
 	/* Initialize configuration options to their default values. */
 	initialize_server_options(&options);
@@ -1062,8 +1072,10 @@ main(int ac, char **av)
 	 * to create a file, and we can't control the code in every
 	 * module which might be used).
 	 */
+#ifndef __INTERIX
 	if (setgroups(0, NULL) < 0)
 		debug("setgroups() failed: %.200s", strerror(errno));
+#endif /* __INTERIX */
 
 	/* Initialize the log (it is reinitialized below in case we forked). */
 	if (debug_flag && !inetd_flag)