summaryrefslogtreecommitdiff
path: root/security/ssh/patches/patch-aq
blob: 19dc4951b8917a537fe9dd7cf4b419bd35e59b9b (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$NetBSD: patch-aq,v 1.6 2000/03/20 02:25:52 itojun Exp $

--- newchannels.c-	Wed May 12 20:19:27 1999
+++ newchannels.c	Mon Mar 20 09:47:24 2000
@@ -274,7 +274,7 @@
 #include "authfd.h"
 #include "emulate.h"
 #include "servconf.h"
-#ifdef LIBWRAP
+#if defined(LIBWRAP) && defined(LIBWRAP_FWD)
 #include <tcpd.h>
 #include <syslog.h>
 #ifdef NEED_SYS_SYSLOG_H
@@ -922,6 +922,7 @@
           /* This is our fake X11 server socket. */
           if (FD_ISSET(ch->sock, readset))
             {
+              int on = 1;
               debug("X11 connection requested.");
               addrlen = sizeof(addr);
               newsock = accept(ch->sock, &addr, &addrlen);
@@ -930,11 +931,12 @@
                   error("accept: %.100s", strerror(errno));
                   break;
                 }
+              setsockopt(newsock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
               remote_hostname = get_remote_hostname(newsock);
               snprintf(buf, sizeof(buf), "X11 connection from %.200s port %d",
                       remote_hostname, get_peer_port(newsock));
               xfree(remote_hostname);
-#ifdef LIBWRAP
+#if defined(LIBWRAP) && defined(LIBWRAP_FWD)
               {
                 struct request_info req;
                 struct servent *serv;
@@ -986,7 +988,7 @@
                        ch->listening_port, remote_hostname,
                        get_peer_port(newsock));
               xfree(remote_hostname);
-#ifdef LIBWRAP
+#if defined(LIBWRAP) && defined(LIBWRAP_FWD)
               {
                 struct request_info req;
                 struct servent *serv;
@@ -2110,7 +2112,11 @@
 
  success:
   /* We have successfully obtained a connection to the real X display. */
-
+  {
+    int on = 1;
+    setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+  }
+  
 #if defined(O_NONBLOCK) && !defined(O_NONBLOCK_BROKEN)
       (void)fcntl(sock, F_SETFL, O_NONBLOCK);
 #else /* O_NONBLOCK && !O_NONBLOCK_BROKEN */
@@ -2412,6 +2418,10 @@
      ssh-agent connections on your system */
   old_umask = umask(S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
   
+  /* Make sure the socket doesn't already exist, left over from a system
+     crash perhaps. */
+  unlink(channel_forwarded_auth_socket_name);
+
   if (bind(sock, (struct sockaddr *)&sunaddr, AF_UNIX_SIZE(sunaddr)) < 0)
     packet_disconnect("Agent socket bind failed: %.100s", strerror(errno));