summaryrefslogtreecommitdiff
path: root/monitor_fdpass.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-01-01 23:53:30 +0000
committerColin Watson <cjwatson@debian.org>2010-01-01 23:53:30 +0000
commitdf03186a4f9e0c2ece398b5c0571cb6263d7a752 (patch)
tree1aab079441dff9615274769b19f2d734ddf508dd /monitor_fdpass.c
parent6ad6994c288662fca6949f42bf91fec2aff00bca (diff)
parent99b402ea4c8457b0a3cafff37f5b3410a8dc6476 (diff)
* New upstream release (closes: #536182). Yes, I know 5.3p1 has been out
for a while, but there's no GSSAPI patch available for it yet. - Change the default cipher order to prefer the AES CTR modes and the revised "arcfour256" mode to CBC mode ciphers that are susceptible to CPNI-957037 "Plaintext Recovery Attack Against SSH". - Add countermeasures to mitigate CPNI-957037-style attacks against the SSH protocol's use of CBC-mode ciphers. Upon detection of an invalid packet length or Message Authentication Code, ssh/sshd will continue reading up to the maximum supported packet length rather than immediately terminating the connection. This eliminates most of the known differences in behaviour that leaked information about the plaintext of injected data which formed the basis of this attack (closes: #506115, LP: #379329). - ForceCommand directive now accepts commandline arguments for the internal-sftp server (closes: #524423, LP: #362511). - Add AllowAgentForwarding to available Match keywords list (closes: #540623). - Make ssh(1) send the correct channel number for SSH2_MSG_CHANNEL_SUCCESS and SSH2_MSG_CHANNEL_FAILURE messages to avoid triggering 'Non-public channel' error messages on sshd(8) in openssh-5.1. - Avoid printing 'Non-public channel' warnings in sshd(8), since the ssh(1) has sent incorrect channel numbers since ~2004 (this reverts a behaviour introduced in openssh-5.1; closes: #496017). * Update to GSSAPI patch from http://www.sxw.org.uk/computing/patches/openssh-5.2p1-gsskex-all-20090726.patch, including cascading credentials support (LP: #416958).
Diffstat (limited to 'monitor_fdpass.c')
-rw-r--r--monitor_fdpass.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/monitor_fdpass.c b/monitor_fdpass.c
index 28296d64b..3d3a78391 100644
--- a/monitor_fdpass.c
+++ b/monitor_fdpass.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor_fdpass.c,v 1.17 2008/03/24 16:11:07 deraadt Exp $ */ 1/* $OpenBSD: monitor_fdpass.c,v 1.18 2008/11/30 11:59:26 dtucker Exp $ */
2/* 2/*
3 * Copyright 2001 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2001 Niels Provos <provos@citi.umich.edu>
4 * All rights reserved. 4 * All rights reserved.
@@ -69,17 +69,16 @@ mm_send_fd(int sock, int fd)
69{ 69{
70#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) 70#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
71 struct msghdr msg; 71 struct msghdr msg;
72 struct iovec vec;
73 char ch = '\0';
74 ssize_t n;
75#ifndef HAVE_ACCRIGHTS_IN_MSGHDR 72#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
76 union { 73 union {
77 struct cmsghdr hdr; 74 struct cmsghdr hdr;
78 char tmp[CMSG_SPACE(sizeof(int))];
79 char buf[CMSG_SPACE(sizeof(int))]; 75 char buf[CMSG_SPACE(sizeof(int))];
80 } cmsgbuf; 76 } cmsgbuf;
81 struct cmsghdr *cmsg; 77 struct cmsghdr *cmsg;
82#endif 78#endif
79 struct iovec vec;
80 char ch = '\0';
81 ssize_t n;
83 82
84 memset(&msg, 0, sizeof(msg)); 83 memset(&msg, 0, sizeof(msg));
85#ifdef HAVE_ACCRIGHTS_IN_MSGHDR 84#ifdef HAVE_ACCRIGHTS_IN_MSGHDR
@@ -100,7 +99,10 @@ mm_send_fd(int sock, int fd)
100 msg.msg_iov = &vec; 99 msg.msg_iov = &vec;
101 msg.msg_iovlen = 1; 100 msg.msg_iovlen = 1;
102 101
103 if ((n = sendmsg(sock, &msg, 0)) == -1) { 102 while ((n = sendmsg(sock, &msg, 0)) == -1 && (errno == EAGAIN ||
103 errno == EINTR))
104 debug3("%s: sendmsg(%d): %s", __func__, fd, strerror(errno));
105 if (n == -1) {
104 error("%s: sendmsg(%d): %s", __func__, fd, 106 error("%s: sendmsg(%d): %s", __func__, fd,
105 strerror(errno)); 107 strerror(errno));
106 return -1; 108 return -1;
@@ -123,10 +125,6 @@ mm_receive_fd(int sock)
123{ 125{
124#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR)) 126#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
125 struct msghdr msg; 127 struct msghdr msg;
126 struct iovec vec;
127 ssize_t n;
128 char ch;
129 int fd;
130#ifndef HAVE_ACCRIGHTS_IN_MSGHDR 128#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
131 union { 129 union {
132 struct cmsghdr hdr; 130 struct cmsghdr hdr;
@@ -134,6 +132,10 @@ mm_receive_fd(int sock)
134 } cmsgbuf; 132 } cmsgbuf;
135 struct cmsghdr *cmsg; 133 struct cmsghdr *cmsg;
136#endif 134#endif
135 struct iovec vec;
136 ssize_t n;
137 char ch;
138 int fd;
137 139
138 memset(&msg, 0, sizeof(msg)); 140 memset(&msg, 0, sizeof(msg));
139 vec.iov_base = &ch; 141 vec.iov_base = &ch;
@@ -148,10 +150,14 @@ mm_receive_fd(int sock)
148 msg.msg_controllen = sizeof(cmsgbuf.buf); 150 msg.msg_controllen = sizeof(cmsgbuf.buf);
149#endif 151#endif
150 152
151 if ((n = recvmsg(sock, &msg, 0)) == -1) { 153 while ((n = recvmsg(sock, &msg, 0)) == -1 && (errno == EAGAIN ||
154 errno == EINTR))
155 debug3("%s: recvmsg: %s", __func__, strerror(errno));
156 if (n == -1) {
152 error("%s: recvmsg: %s", __func__, strerror(errno)); 157 error("%s: recvmsg: %s", __func__, strerror(errno));
153 return -1; 158 return -1;
154 } 159 }
160
155 if (n != 1) { 161 if (n != 1) {
156 error("%s: recvmsg: expected received 1 got %ld", 162 error("%s: recvmsg: expected received 1 got %ld",
157 __func__, (long)n); 163 __func__, (long)n);
@@ -169,6 +175,7 @@ mm_receive_fd(int sock)
169 error("%s: no message header", __func__); 175 error("%s: no message header", __func__);
170 return -1; 176 return -1;
171 } 177 }
178
172 if (!cmsg_type_is_broken() && cmsg->cmsg_type != SCM_RIGHTS) { 179 if (!cmsg_type_is_broken() && cmsg->cmsg_type != SCM_RIGHTS) {
173 error("%s: expected type %d got %d", __func__, 180 error("%s: expected type %d got %d", __func__,
174 SCM_RIGHTS, cmsg->cmsg_type); 181 SCM_RIGHTS, cmsg->cmsg_type);