summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-04-23 15:20:43 +1000
committerDamien Miller <djm@mindrot.org>2013-04-23 15:20:43 +1000
commit37f1c08473b1ef2a188ee178ce2e11e841f88563 (patch)
treed3445d85e0750d751d7de4d19f5bd73016bbe80b
parent172859cff7df9fd8a29a1f0a4de568f644bbda50 (diff)
- markus@cvs.openbsd.org 2013/04/06 16:07:00
[channels.c sshd.c] handle ECONNABORTED for accept(); ok deraadt some time ago...
-rw-r--r--ChangeLog3
-rw-r--r--channels.c14
-rw-r--r--sshd.c6
3 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bd623b1b..47c7ce01c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,9 @@
36 [mux.c] 36 [mux.c]
37 cleanup mux-created channels that are in SSH_CHANNEL_OPENING state too 37 cleanup mux-created channels that are in SSH_CHANNEL_OPENING state too
38 (in addition to ones already in OPEN); bz#2079, ok dtucker@ 38 (in addition to ones already in OPEN); bz#2079, ok dtucker@
39 - markus@cvs.openbsd.org 2013/04/06 16:07:00
40 [channels.c sshd.c]
41 handle ECONNABORTED for accept(); ok deraadt some time ago...
39 42
4020130418 4320130418
41 - (djm) [config.guess config.sub] Update to last versions before they switch 44 - (djm) [config.guess config.sub] Update to last versions before they switch
diff --git a/channels.c b/channels.c
index 9cf85a38d..12db962de 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.319 2012/12/02 20:46:11 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.320 2013/04/06 16:07:00 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1324,7 +1324,7 @@ channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset)
1324{ 1324{
1325 Channel *nc; 1325 Channel *nc;
1326 struct sockaddr_storage addr; 1326 struct sockaddr_storage addr;
1327 int newsock; 1327 int newsock, oerrno;
1328 socklen_t addrlen; 1328 socklen_t addrlen;
1329 char buf[16384], *remote_ipaddr; 1329 char buf[16384], *remote_ipaddr;
1330 int remote_port; 1330 int remote_port;
@@ -1334,12 +1334,16 @@ channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset)
1334 addrlen = sizeof(addr); 1334 addrlen = sizeof(addr);
1335 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); 1335 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
1336 if (c->single_connection) { 1336 if (c->single_connection) {
1337 oerrno = errno;
1337 debug2("single_connection: closing X11 listener."); 1338 debug2("single_connection: closing X11 listener.");
1338 channel_close_fd(&c->sock); 1339 channel_close_fd(&c->sock);
1339 chan_mark_dead(c); 1340 chan_mark_dead(c);
1341 errno = oerrno;
1340 } 1342 }
1341 if (newsock < 0) { 1343 if (newsock < 0) {
1342 error("accept: %.100s", strerror(errno)); 1344 if (errno != EINTR && errno != EWOULDBLOCK &&
1345 errno != ECONNABORTED)
1346 error("accept: %.100s", strerror(errno));
1343 if (errno == EMFILE || errno == ENFILE) 1347 if (errno == EMFILE || errno == ENFILE)
1344 c->notbefore = time(NULL) + 1; 1348 c->notbefore = time(NULL) + 1;
1345 return; 1349 return;
@@ -1484,7 +1488,9 @@ channel_post_port_listener(Channel *c, fd_set *readset, fd_set *writeset)
1484 addrlen = sizeof(addr); 1488 addrlen = sizeof(addr);
1485 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); 1489 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
1486 if (newsock < 0) { 1490 if (newsock < 0) {
1487 error("accept: %.100s", strerror(errno)); 1491 if (errno != EINTR && errno != EWOULDBLOCK &&
1492 errno != ECONNABORTED)
1493 error("accept: %.100s", strerror(errno));
1488 if (errno == EMFILE || errno == ENFILE) 1494 if (errno == EMFILE || errno == ENFILE)
1489 c->notbefore = time(NULL) + 1; 1495 c->notbefore = time(NULL) + 1;
1490 return; 1496 return;
diff --git a/sshd.c b/sshd.c
index 3e9d17640..5fb2897fa 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshd.c,v 1.397 2013/02/11 21:21:58 dtucker Exp $ */ 1/* $OpenBSD: sshd.c,v 1.398 2013/04/06 16:07:00 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1183,8 +1183,8 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s)
1183 *newsock = accept(listen_socks[i], 1183 *newsock = accept(listen_socks[i],
1184 (struct sockaddr *)&from, &fromlen); 1184 (struct sockaddr *)&from, &fromlen);
1185 if (*newsock < 0) { 1185 if (*newsock < 0) {
1186 if (errno != EINTR && errno != EAGAIN && 1186 if (errno != EINTR && errno != EWOULDBLOCK &&
1187 errno != EWOULDBLOCK) 1187 errno != ECONNABORTED && errno != EAGAIN)
1188 error("accept: %.100s", 1188 error("accept: %.100s",
1189 strerror(errno)); 1189 strerror(errno));
1190 if (errno == EMFILE || errno == ENFILE) 1190 if (errno == EMFILE || errno == ENFILE)