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
|
$NetBSD: patch-bc,v 1.2 2005/12/30 16:05:55 joerg Exp $
--- connsh.c.orig 1998-09-21 16:50:12.000000000 +0000
+++ connsh.c
@@ -21,6 +21,10 @@ extern struct passwd *getpwent(), *getpw
#define vfork fork
#endif
+#ifdef USE_SERVER
+extern int skkservsock;
+#endif
+
#define DEVICELEN 16
#define DEFAULT_SHELL "/bin/csh"
@@ -94,8 +98,6 @@ int ShellPID;
char SlaveName[DEVICELEN];
-extern int errno;
-
#ifdef NO_SETEUID
# ifdef HAVE_SETREUID
# define seteuid(e) setreuid(-1, (e))
@@ -171,8 +173,9 @@ establishShell()
#endif /* not HPUX */
if((i = vfork()) < 0) {
- fprintf(stderr,"fork error\n");
- abort();
+ perror("fork");
+ reset_tty();
+ Exit(1);
}
if(i == 0) { /* child */
@@ -226,6 +229,10 @@ establishShell()
dup2(slave,1);
dup2(slave,2);
close(slave);
+#ifdef USE_SERVER
+ if (skkservsock >= 0)
+ close(skkservsock);
+#endif
seteuid(getuid());
p = &ShellName[strlen(ShellName)];
|