diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2013-04-06 16:07:01 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2013-04-06 16:07:01 +0000 |
commit | d55d3360bf329ed99a3f4bf44249f9a06240f600 (patch) | |
tree | 8960ade44bd914a4ef3bf8799ec80e77dacdeded | |
parent | 57b497a13902ec9216974141b6ba8128dd75bcf8 (diff) |
handle ECONNABORTED for accept(); ok deraadt some time ago...
-rw-r--r-- | usr.bin/ssh/channels.c | 14 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.c | 5 |
2 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index b277d5fd2ec..7ae54b9f3b6 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.319 2012/12/02 20:46:11 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.320 2013/04/06 16:07:00 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1319,7 +1319,7 @@ channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset) { Channel *nc; struct sockaddr_storage addr; - int newsock; + int newsock, oerrno; socklen_t addrlen; char buf[16384], *remote_ipaddr; int remote_port; @@ -1329,12 +1329,16 @@ channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset) addrlen = sizeof(addr); newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); if (c->single_connection) { + oerrno = errno; debug2("single_connection: closing X11 listener."); channel_close_fd(&c->sock); chan_mark_dead(c); + errno = oerrno; } if (newsock < 0) { - error("accept: %.100s", strerror(errno)); + if (errno != EINTR && errno != EWOULDBLOCK && + errno != ECONNABORTED) + error("accept: %.100s", strerror(errno)); if (errno == EMFILE || errno == ENFILE) c->notbefore = time(NULL) + 1; return; @@ -1479,7 +1483,9 @@ channel_post_port_listener(Channel *c, fd_set *readset, fd_set *writeset) addrlen = sizeof(addr); newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen); if (newsock < 0) { - error("accept: %.100s", strerror(errno)); + if (errno != EINTR && errno != EWOULDBLOCK && + errno != ECONNABORTED) + error("accept: %.100s", strerror(errno)); if (errno == EMFILE || errno == ENFILE) c->notbefore = time(NULL) + 1; return; diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index b01785c9b08..52c8ef457a5 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshd.c,v 1.397 2013/02/11 21:21:58 dtucker Exp $ */ +/* $OpenBSD: sshd.c,v 1.398 2013/04/06 16:07:00 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1152,7 +1152,8 @@ server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) *newsock = accept(listen_socks[i], (struct sockaddr *)&from, &fromlen); if (*newsock < 0) { - if (errno != EINTR && errno != EWOULDBLOCK) + if (errno != EINTR && errno != EWOULDBLOCK && + errno != ECONNABORTED) error("accept: %.100s", strerror(errno)); if (errno == EMFILE || errno == ENFILE) |