From 5cbe7ca18df76241a3772cef49e1f6e80709420d Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 17 Sep 2007 16:05:50 +1000 Subject: - sobrado@cvs.openbsd.org 2007/09/09 11:38:01 [ssh-add.c ssh-agent.1 ssh-agent.c ssh-keygen.c] sort synopsis and options in ssh-agent(1); usage is lowercase ok jmc@ --- ssh-agent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ssh-agent.c') diff --git a/ssh-agent.c b/ssh-agent.c index c3d5e5a75..fb12545b0 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-agent.c,v 1.155 2007/03/19 12:16:42 dtucker Exp $ */ +/* $OpenBSD: ssh-agent.c,v 1.156 2007/09/09 11:38:01 sobrado Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1016,7 +1016,7 @@ check_parent_exists(void) static void usage(void) { - fprintf(stderr, "Usage: %s [options] [command [args ...]]\n", + fprintf(stderr, "usage: %s [options] [command [arg ...]]\n", __progname); fprintf(stderr, "Options:\n"); fprintf(stderr, " -c Generate C-shell commands on stdout.\n"); -- cgit v1.2.3 From 4c7728c651254eb05a8c3ffbcc25632b7c80e722 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 26 Oct 2007 14:25:31 +1000 Subject: - canacar@cvs.openbsd.org 2007/09/25 23:48:57 [ssh-agent.c] When adding a key that already exists, update the properties (time, confirm, comment) instead of discarding them. ok djm@ markus@ --- ChangeLog | 6 +++++- ssh-agent.c | 15 ++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'ssh-agent.c') diff --git a/ChangeLog b/ChangeLog index 46729e70a..8345586e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,10 @@ These options have been in use for some years; ok markus@ "no objection" millert@ (NB. RCD ID sync only for portable) + - canacar@cvs.openbsd.org 2007/09/25 23:48:57 + [ssh-agent.c] + When adding a key that already exists, update the properties + (time, confirm, comment) instead of discarding them. ok djm@ markus@ 20070927 - (dtucker) [configure.ac atomicio.c] Fall back to including if @@ -3287,4 +3291,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4763 2007/10/26 04:25:12 djm Exp $ +$Id: ChangeLog,v 1.4764 2007/10/26 04:25:31 djm Exp $ diff --git a/ssh-agent.c b/ssh-agent.c index fb12545b0..f17948349 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-agent.c,v 1.156 2007/09/09 11:38:01 sobrado Exp $ */ +/* $OpenBSD: ssh-agent.c,v 1.157 2007/09/25 23:48:57 canacar Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -457,6 +457,7 @@ static void process_add_identity(SocketEntry *e, int version) { Idtab *tab = idtab_lookup(version); + Identity *id; int type, success = 0, death = 0, confirm = 0; char *type_name, *comment; Key *k = NULL; @@ -539,19 +540,19 @@ process_add_identity(SocketEntry *e, int version) } if (lifetime && !death) death = time(NULL) + lifetime; - if (lookup_identity(k, version) == NULL) { - Identity *id = xmalloc(sizeof(Identity)); + if ((id = lookup_identity(k, version)) == NULL) { + id = xmalloc(sizeof(Identity)); id->key = k; - id->comment = comment; - id->death = death; - id->confirm = confirm; TAILQ_INSERT_TAIL(&tab->idlist, id, next); /* Increment the number of identities. */ tab->nentries++; } else { key_free(k); - xfree(comment); + xfree(id->comment); } + id->comment = comment; + id->death = death; + id->confirm = confirm; send: buffer_put_int(&e->output, 1); buffer_put_char(&e->output, -- cgit v1.2.3 From bfaaf960a0204d5ee8ed75af05104737a54b4a52 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 28 Feb 2008 19:13:52 +1100 Subject: - (dtucker) [includes.h ssh-add.c ssh-agent.c ssh-keygen.c ssh.c sshd.c openbsd-compat/openssl-compat.{c,h}] Bug #1437 Move the OpenSSL compat header to after OpenSSL headers, since some versions of OpenSSL have SSLeay_add_all_algorithms as a macro already. --- ChangeLog | 6 +++++- includes.h | 1 - openbsd-compat/openssl-compat.c | 6 ++++-- openbsd-compat/openssl-compat.h | 6 +++--- ssh-add.c | 1 + ssh-agent.c | 1 + ssh-keygen.c | 1 + ssh.c | 1 + sshd.c | 2 ++ 9 files changed, 18 insertions(+), 7 deletions(-) (limited to 'ssh-agent.c') diff --git a/ChangeLog b/ChangeLog index 0bd8d901a..72261d650 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ 20080228 - (dtucker) [configure.ac] Add -fstack-protector to LDFLAGS too, fixes linking problems on AIX with gcc 4.1.x. + - (dtucker) [includes.h ssh-add.c ssh-agent.c ssh-keygen.c ssh.c sshd.c + openbsd-compat/openssl-compat.{c,h}] Bug #1437 Move the OpenSSL compat + header to after OpenSSL headers, since some versions of OpenSSL have + SSLeay_add_all_algorithms as a macro already. 20080225 - (dtucker) [openbsd-compat/fake-rfc2553.h] rename ssh_gai_strerror hack @@ -3631,4 +3635,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4842 2008/02/28 04:01:13 dtucker Exp $ +$Id: ChangeLog,v 1.4843 2008/02/28 08:13:52 dtucker Exp $ diff --git a/includes.h b/includes.h index af231a9b3..9fcf1b023 100644 --- a/includes.h +++ b/includes.h @@ -166,7 +166,6 @@ #include "platform.h" #include "openbsd-compat/openbsd-compat.h" #include "openbsd-compat/bsd-nextstep.h" -#include "openbsd-compat/openssl-compat.h" #include "entropy.h" diff --git a/openbsd-compat/openssl-compat.c b/openbsd-compat/openssl-compat.c index 9c9cdb98e..49238ba80 100644 --- a/openbsd-compat/openssl-compat.c +++ b/openbsd-compat/openssl-compat.c @@ -1,4 +1,4 @@ -/* $Id: openssl-compat.c,v 1.5 2008/02/25 10:13:47 dtucker Exp $ */ +/* $Id: openssl-compat.c,v 1.6 2008/02/28 08:13:52 dtucker Exp $ */ /* * Copyright (c) 2005 Darren Tucker @@ -16,13 +16,15 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define SSH_DONT_OVERLOAD_OPENSSL_FUNCS #include "includes.h" #ifdef USE_OPENSSL_ENGINE # include #endif +#define SSH_DONT_OVERLOAD_OPENSSL_FUNCS +#include "openssl-compat.h" + #ifdef SSH_OLD_EVP int ssh_EVP_CipherInit(EVP_CIPHER_CTX *evp, const EVP_CIPHER *type, diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h index f1d2f19fc..f53695aa8 100644 --- a/openbsd-compat/openssl-compat.h +++ b/openbsd-compat/openssl-compat.h @@ -1,4 +1,4 @@ -/* $Id: openssl-compat.h,v 1.10 2007/06/14 13:47:31 dtucker Exp $ */ +/* $Id: openssl-compat.h,v 1.11 2008/02/28 08:13:52 dtucker Exp $ */ /* * Copyright (c) 2005 Darren Tucker @@ -79,8 +79,8 @@ extern const EVP_CIPHER *evp_acss(void); # ifdef SSLeay_add_all_algorithms # undef SSLeay_add_all_algorithms # endif -# define SSLeay_add_all_algorithms() ssh_SSLeay_add_all_algorithms() -#endif +# define SSLeay_add_all_algorithms() ssh_SSLeay_add_all_algorithms() +# endif int ssh_EVP_CipherInit(EVP_CIPHER_CTX *, const EVP_CIPHER *, unsigned char *, unsigned char *, int); diff --git a/ssh-add.c b/ssh-add.c index 7f654a97e..7a43282f2 100644 --- a/ssh-add.c +++ b/ssh-add.c @@ -42,6 +42,7 @@ #include #include +#include "openbsd-compat/openssl-compat.h" #include #include diff --git a/ssh-agent.c b/ssh-agent.c index f17948349..6f8727b33 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -51,6 +51,7 @@ #include #include +#include "openbsd-compat/openssl-compat.h" #include #include diff --git a/ssh-keygen.c b/ssh-keygen.c index adacbff0b..69b16e6f5 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c @@ -21,6 +21,7 @@ #include #include +#include "openbsd-compat/openssl-compat.h" #include #include diff --git a/ssh.c b/ssh.c index fe2f1adfb..2ed76c9a1 100644 --- a/ssh.c +++ b/ssh.c @@ -72,6 +72,7 @@ #include #include +#include "openbsd-compat/openssl-compat.h" #include "xmalloc.h" #include "ssh.h" diff --git a/sshd.c b/sshd.c index 27c38ba53..9144bbaea 100644 --- a/sshd.c +++ b/sshd.c @@ -75,6 +75,8 @@ #include #include #include +#include "openbsd-compat/openssl-compat.h" + #ifdef HAVE_SECUREWARE #include #include -- cgit v1.2.3 From 1cfadabc0e84551a3caa87c24cba6a0f2db43945 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 30 Jun 2008 00:05:21 +1000 Subject: - djm@cvs.openbsd.org 2008/06/28 13:58:23 [ssh-agent.c] refuse to add a key that has unknown constraints specified; ok markus --- ChangeLog | 6 +++++- ssh-agent.c | 24 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'ssh-agent.c') diff --git a/ChangeLog b/ChangeLog index 722310539..ffb2fe587 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,10 @@ - djm@cvs.openbsd.org 2008/06/28 07:25:07 [PROTOCOL] spelling fixes + - djm@cvs.openbsd.org 2008/06/28 13:58:23 + [ssh-agent.c] + refuse to add a key that has unknown constraints specified; + ok markus 20080628 - (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec] @@ -4454,4 +4458,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5031 2008/06/29 14:04:57 djm Exp $ +$Id: ChangeLog,v 1.5032 2008/06/29 14:05:21 djm Exp $ diff --git a/ssh-agent.c b/ssh-agent.c index 6f8727b33..8f9e2e8ce 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-agent.c,v 1.157 2007/09/25 23:48:57 canacar Exp $ */ +/* $OpenBSD: ssh-agent.c,v 1.158 2008/06/28 13:58:23 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -526,9 +526,8 @@ process_add_identity(SocketEntry *e, int version) xfree(comment); goto send; } - success = 1; while (buffer_len(&e->request)) { - switch (buffer_get_char(&e->request)) { + switch ((type = buffer_get_char(&e->request))) { case SSH_AGENT_CONSTRAIN_LIFETIME: death = time(NULL) + buffer_get_int(&e->request); break; @@ -536,9 +535,14 @@ process_add_identity(SocketEntry *e, int version) confirm = 1; break; default: - break; + error("process_add_identity: " + "Unknown constraint type %d", type); + xfree(comment); + key_free(k); + goto send; } } + success = 1; if (lifetime && !death) death = time(NULL) + lifetime; if ((id = lookup_identity(k, version)) == NULL) { @@ -604,10 +608,10 @@ no_identities(SocketEntry *e, u_int type) #ifdef SMARTCARD static void -process_add_smartcard_key (SocketEntry *e) +process_add_smartcard_key(SocketEntry *e) { char *sc_reader_id = NULL, *pin; - int i, version, success = 0, death = 0, confirm = 0; + int i, type, version, success = 0, death = 0, confirm = 0; Key **keys, *k; Identity *id; Idtab *tab; @@ -616,7 +620,7 @@ process_add_smartcard_key (SocketEntry *e) pin = buffer_get_string(&e->request, NULL); while (buffer_len(&e->request)) { - switch (buffer_get_char(&e->request)) { + switch ((type = buffer_get_char(&e->request))) { case SSH_AGENT_CONSTRAIN_LIFETIME: death = time(NULL) + buffer_get_int(&e->request); break; @@ -624,7 +628,11 @@ process_add_smartcard_key (SocketEntry *e) confirm = 1; break; default: - break; + error("process_add_smartcard_key: " + "Unknown constraint type %d", type); + xfree(sc_reader_id); + xfree(pin); + goto send; } } if (lifetime && !death) -- cgit v1.2.3 From 471db5c2eb4c25b9e7c9257e811b07067ef731a4 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 30 Jun 2008 00:05:48 +1000 Subject: - djm@cvs.openbsd.org 2008/06/28 14:05:15 [ssh-agent.c] reset global compat flag after processing a protocol 2 signature request with the legacy DSA encoding flag set; ok markus --- ChangeLog | 6 +++++- ssh-agent.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'ssh-agent.c') diff --git a/ChangeLog b/ChangeLog index ffb2fe587..aaf9cefdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,10 @@ [ssh-agent.c] refuse to add a key that has unknown constraints specified; ok markus + - djm@cvs.openbsd.org 2008/06/28 14:05:15 + [ssh-agent.c] + reset global compat flag after processing a protocol 2 signature + request with the legacy DSA encoding flag set; ok markus 20080628 - (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec] @@ -4458,4 +4462,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5032 2008/06/29 14:05:21 djm Exp $ +$Id: ChangeLog,v 1.5033 2008/06/29 14:05:48 djm Exp $ diff --git a/ssh-agent.c b/ssh-agent.c index 8f9e2e8ce..b1c65fab6 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-agent.c,v 1.158 2008/06/28 13:58:23 djm Exp $ */ +/* $OpenBSD: ssh-agent.c,v 1.159 2008/06/28 14:05:15 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -312,6 +312,7 @@ process_sign_request2(SocketEntry *e) u_char *blob, *data, *signature = NULL; u_int blen, dlen, slen = 0; extern int datafellows; + int odatafellows; int ok = -1, flags; Buffer msg; Key *key; @@ -322,6 +323,7 @@ process_sign_request2(SocketEntry *e) data = buffer_get_string(&e->request, &dlen); flags = buffer_get_int(&e->request); + odatafellows = datafellows; if (flags & SSH_AGENT_OLD_SIGNATURE) datafellows = SSH_BUG_SIGBLOB; @@ -347,6 +349,7 @@ process_sign_request2(SocketEntry *e) xfree(blob); if (signature != NULL) xfree(signature); + datafellows = odatafellows; } /* shared */ -- cgit v1.2.3 From d8968adb5faef58508bb5e7dab7cdbaf5b0e90d5 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 4 Jul 2008 23:10:49 +1000 Subject: - (djm) [atomicio.c channels.c clientloop.c defines.h includes.h] [packet.c scp.c serverloop.c sftp-client.c ssh-agent.c ssh-keyscan.c] [sshd.c] Explicitly handle EWOULDBLOCK wherever we handle EAGAIN, on some platforms (HP nonstop) it is a distinct errno; bz#1467 reported by sconeu AT yahoo.com; ok dtucker@ --- ChangeLog | 9 +++++++-- atomicio.c | 8 -------- channels.c | 19 ++++++++++++------- clientloop.c | 12 ++++++++---- defines.h | 6 +++++- includes.h | 2 ++ packet.c | 8 +++++--- scp.c | 2 +- serverloop.c | 14 ++++++++------ sftp-client.c | 3 ++- ssh-agent.c | 6 ++++-- ssh-keyscan.c | 2 +- sshd.c | 3 ++- 13 files changed, 57 insertions(+), 37 deletions(-) (limited to 'ssh-agent.c') diff --git a/ChangeLog b/ChangeLog index c985a7ba5..984c17008 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,7 +30,12 @@ explicitly disable conch options that could interfere with the test - (dtucker) [sftp-server.c] Bug #1447: fall back to racy rename if link returns EXDEV. Patch from Mike Garrison, ok djm@ -h + - (djm) [atomicio.c channels.c clientloop.c defines.h includes.h] + [packet.c scp.c serverloop.c sftp-client.c ssh-agent.c ssh-keyscan.c] + [sshd.c] Explicitly handle EWOULDBLOCK wherever we handle EAGAIN, on + some platforms (HP nonstop) it is a distinct errno; + bz#1467 reported by sconeu AT yahoo.com; ok dtucker@ + 20080702 - (dtucker) OpenBSD CVS Sync - djm@cvs.openbsd.org 2008/06/30 08:05:59 @@ -4565,4 +4570,4 @@ h OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5057 2008/07/04 07:11:30 dtucker Exp $ +$Id: ChangeLog,v 1.5058 2008/07/04 13:10:49 djm Exp $ diff --git a/atomicio.c b/atomicio.c index 575bf8900..bb44c3230 100644 --- a/atomicio.c +++ b/atomicio.c @@ -63,11 +63,7 @@ atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n) case -1: if (errno == EINTR) continue; -#ifdef EWOULDBLOCK if (errno == EAGAIN || errno == EWOULDBLOCK) { -#else - if (errno == EAGAIN) { -#endif (void)poll(&pfd, 1, -1); continue; } @@ -109,11 +105,7 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd, case -1: if (errno == EINTR) continue; -#ifdef EWOULDBLOCK if (errno == EAGAIN || errno == EWOULDBLOCK) { -#else - if (errno == EAGAIN) { -#endif (void)poll(&pfd, 1, -1); continue; } diff --git a/channels.c b/channels.c index 7f0aaadf6..ac5134b5b 100644 --- a/channels.c +++ b/channels.c @@ -1494,7 +1494,8 @@ channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) if (c->rfd != -1 && (force || FD_ISSET(c->rfd, readset))) { errno = 0; len = read(c->rfd, buf, sizeof(buf)); - if (len < 0 && (errno == EINTR || (errno == EAGAIN && !force))) + if (len < 0 && (errno == EINTR || + ((errno == EAGAIN || errno == EWOULDBLOCK) && !force))) return 1; #ifndef PTY_ZEROREAD if (len <= 0) { @@ -1565,7 +1566,8 @@ channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) c->local_consumed += dlen + 4; len = write(c->wfd, buf, dlen); xfree(data); - if (len < 0 && (errno == EINTR || errno == EAGAIN)) + if (len < 0 && (errno == EINTR || errno == EAGAIN || + errno == EWOULDBLOCK)) return 1; if (len <= 0) { if (c->type != SSH_CHANNEL_OPEN) @@ -1583,7 +1585,8 @@ channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset) #endif len = write(c->wfd, buf, dlen); - if (len < 0 && (errno == EINTR || errno == EAGAIN)) + if (len < 0 && + (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) return 1; if (len <= 0) { if (c->type != SSH_CHANNEL_OPEN) { @@ -1635,7 +1638,8 @@ channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset) buffer_len(&c->extended)); debug2("channel %d: written %d to efd %d", c->self, len, c->efd); - if (len < 0 && (errno == EINTR || errno == EAGAIN)) + if (len < 0 && (errno == EINTR || errno == EAGAIN || + errno == EWOULDBLOCK)) return 1; if (len <= 0) { debug2("channel %d: closing write-efd %d", @@ -1650,8 +1654,8 @@ channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset) len = read(c->efd, buf, sizeof(buf)); debug2("channel %d: read %d from efd %d", c->self, len, c->efd); - if (len < 0 && (errno == EINTR || - (errno == EAGAIN && !c->detach_close))) + if (len < 0 && (errno == EINTR || ((errno == EAGAIN || + errno == EWOULDBLOCK) && !c->detach_close))) return 1; if (len <= 0) { debug2("channel %d: closing read-efd %d", @@ -1675,7 +1679,8 @@ channel_handle_ctl(Channel *c, fd_set *readset, fd_set *writeset) /* Monitor control fd to detect if the slave client exits */ if (c->ctl_fd != -1 && FD_ISSET(c->ctl_fd, readset)) { len = read(c->ctl_fd, buf, sizeof(buf)); - if (len < 0 && (errno == EINTR || errno == EAGAIN)) + if (len < 0 && + (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) return 1; if (len <= 0) { debug2("channel %d: ctl read<=0", c->self); diff --git a/clientloop.c b/clientloop.c index 6dc870881..ba2f0b79e 100644 --- a/clientloop.c +++ b/clientloop.c @@ -663,7 +663,8 @@ client_process_net_input(fd_set *readset) * There is a kernel bug on Solaris that causes select to * sometimes wake up even though there is no data available. */ - if (len < 0 && (errno == EAGAIN || errno == EINTR)) + if (len < 0 && + (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) len = 0; if (len < 0) { @@ -1129,7 +1130,8 @@ client_process_input(fd_set *readset) if (FD_ISSET(fileno(stdin), readset)) { /* Read as much as possible. */ len = read(fileno(stdin), buf, sizeof(buf)); - if (len < 0 && (errno == EAGAIN || errno == EINTR)) + if (len < 0 && + (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) return; /* we'll try again later */ if (len <= 0) { /* @@ -1186,7 +1188,8 @@ client_process_output(fd_set *writeset) len = write(fileno(stdout), buffer_ptr(&stdout_buffer), buffer_len(&stdout_buffer)); if (len <= 0) { - if (errno == EINTR || errno == EAGAIN) + if (errno == EINTR || errno == EAGAIN || + errno == EWOULDBLOCK) len = 0; else { /* @@ -1210,7 +1213,8 @@ client_process_output(fd_set *writeset) len = write(fileno(stderr), buffer_ptr(&stderr_buffer), buffer_len(&stderr_buffer)); if (len <= 0) { - if (errno == EINTR || errno == EAGAIN) + if (errno == EINTR || errno == EAGAIN || + errno == EWOULDBLOCK) len = 0; else { /* diff --git a/defines.h b/defines.h index a2fda9969..a8203ebbb 100644 --- a/defines.h +++ b/defines.h @@ -25,7 +25,7 @@ #ifndef _DEFINES_H #define _DEFINES_H -/* $Id: defines.h,v 1.150 2008/06/13 00:28:57 dtucker Exp $ */ +/* $Id: defines.h,v 1.151 2008/07/04 13:10:49 djm Exp $ */ /* Constants */ @@ -734,4 +734,8 @@ struct winsize { # endif #endif +#ifndef EWOULDBLOCK +# define EWOULDBLOCK EAGAIN +#endif + #endif /* _DEFINES_H */ diff --git a/includes.h b/includes.h index 9fcf1b023..f1b47f666 100644 --- a/includes.h +++ b/includes.h @@ -149,6 +149,8 @@ # include #endif +#include + /* * On HP-UX 11.11, shadow.h and prot.h provide conflicting declarations * of getspnam when _INCLUDE__STDC__ is defined, so we unset it here. diff --git a/packet.c b/packet.c index 90ad5ff67..ff22be68f 100644 --- a/packet.c +++ b/packet.c @@ -956,7 +956,8 @@ packet_read_seqnr(u_int32_t *seqnr_p) if ((ret = select(connection_in + 1, setp, NULL, NULL, timeoutp)) >= 0) break; - if (errno != EAGAIN && errno != EINTR) + if (errno != EAGAIN && errno != EINTR && + errno != EWOULDBLOCK) break; if (packet_timeout_ms == -1) continue; @@ -1475,7 +1476,7 @@ packet_write_poll(void) if (len > 0) { len = write(connection_out, buffer_ptr(&output), len); if (len <= 0) { - if (errno == EAGAIN) + if (errno == EAGAIN || errno == EWOULDBLOCK) return; else fatal("Write failed: %.100s", strerror(errno)); @@ -1516,7 +1517,8 @@ packet_write_wait(void) if ((ret = select(connection_out + 1, NULL, setp, NULL, timeoutp)) >= 0) break; - if (errno != EAGAIN && errno != EINTR) + if (errno != EAGAIN && errno != EINTR && + errno != EWOULDBLOCK) break; if (packet_timeout_ms == -1) continue; diff --git a/scp.c b/scp.c index 46433a638..9f8b7a192 100644 --- a/scp.c +++ b/scp.c @@ -474,7 +474,7 @@ scpio(ssize_t (*f)(int, void *, size_t), int fd, void *_p, size_t l, off_t *c) if (r < 0) { if (errno == EINTR) continue; - if (errno == EAGAIN) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { (void)poll(&pfd, 1, -1); /* Ignore errors */ continue; } diff --git a/serverloop.c b/serverloop.c index bd6f82dc1..77d9dee75 100644 --- a/serverloop.c +++ b/serverloop.c @@ -400,7 +400,8 @@ process_input(fd_set *readset) return; cleanup_exit(255); } else if (len < 0) { - if (errno != EINTR && errno != EAGAIN) { + if (errno != EINTR && errno != EAGAIN && + errno != EWOULDBLOCK) { verbose("Read error from remote host " "%.100s: %.100s", get_remote_ipaddr(), strerror(errno)); @@ -418,8 +419,8 @@ process_input(fd_set *readset) if (!fdout_eof && FD_ISSET(fdout, readset)) { errno = 0; len = read(fdout, buf, sizeof(buf)); - if (len < 0 && (errno == EINTR || - (errno == EAGAIN && !child_terminated))) { + if (len < 0 && (errno == EINTR || ((errno == EAGAIN || + errno == EWOULDBLOCK) && !child_terminated))) { /* do nothing */ #ifndef PTY_ZEROREAD } else if (len <= 0) { @@ -437,8 +438,8 @@ process_input(fd_set *readset) if (!fderr_eof && FD_ISSET(fderr, readset)) { errno = 0; len = read(fderr, buf, sizeof(buf)); - if (len < 0 && (errno == EINTR || - (errno == EAGAIN && !child_terminated))) { + if (len < 0 && (errno == EINTR || ((errno == EAGAIN || + errno == EWOULDBLOCK) && !child_terminated))) { /* do nothing */ #ifndef PTY_ZEROREAD } else if (len <= 0) { @@ -469,7 +470,8 @@ process_output(fd_set *writeset) data = buffer_ptr(&stdin_buffer); dlen = buffer_len(&stdin_buffer); len = write(fdin, data, dlen); - if (len < 0 && (errno == EINTR || errno == EAGAIN)) { + if (len < 0 && + (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) { /* do nothing */ } else if (len <= 0) { if (fdin != fdout) diff --git a/sftp-client.c b/sftp-client.c index 42bf0c813..5e39aa7d2 100644 --- a/sftp-client.c +++ b/sftp-client.c @@ -1223,7 +1223,8 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path, len = 0; else do len = read(local_fd, data, conn->transfer_buflen); - while ((len == -1) && (errno == EINTR || errno == EAGAIN)); + while ((len == -1) && + (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)); if (len == -1) fatal("Couldn't read from \"%s\": %s", local_path, diff --git a/ssh-agent.c b/ssh-agent.c index b1c65fab6..9123cfe6b 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -961,7 +961,8 @@ after_select(fd_set *readset, fd_set *writeset) buffer_ptr(&sockets[i].output), buffer_len(&sockets[i].output)); if (len == -1 && (errno == EAGAIN || - errno == EINTR)) + errno == EINTR || + errno == EWOULDBLOCK)) continue; break; } while (1); @@ -975,7 +976,8 @@ after_select(fd_set *readset, fd_set *writeset) do { len = read(sockets[i].fd, buf, sizeof(buf)); if (len == -1 && (errno == EAGAIN || - errno == EINTR)) + errno == EINTR || + errno == EWOULDBLOCK)) continue; break; } while (1); diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 304fcfde8..d81077764 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -656,7 +656,7 @@ conloop(void) memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); while (select(maxfd, r, NULL, e, &seltime) == -1 && - (errno == EAGAIN || errno == EINTR)) + (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) ; for (i = 0; i < maxfd; i++) { diff --git a/sshd.c b/sshd.c index c952f7ad2..a6620a05a 100644 --- a/sshd.c +++ b/sshd.c @@ -1096,7 +1096,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 != EAGAIN && + errno != EWOULDBLOCK) error("accept: %.100s", strerror(errno)); continue; } -- cgit v1.2.3