diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-06 03:31:34 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-06 03:31:34 +0000 |
commit | b3144e58e74ad9cc3c07da94264c3ccbfccb5cf7 (patch) | |
tree | 9ad479c3eef78443192fc92f20a281ac45cca8ed | |
parent | be6a5a6dfe14c516b0982e57bb95f022bf19cf46 (diff) |
- deraadt@cvs.openbsd.org 2001/03/06 00:33:04
[authfd.c cli.c ssh-agent.c]
EINTR/EAGAIN handling is required in more cases
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | authfd.c | 6 | ||||
-rw-r--r-- | cli.c | 10 | ||||
-rw-r--r-- | ssh-agent.c | 24 |
4 files changed, 34 insertions, 11 deletions
@@ -30,6 +30,9 @@ | |||
30 | - stevesk@cvs.openbsd.org 2001/03/05 17:58:22 | 30 | - stevesk@cvs.openbsd.org 2001/03/05 17:58:22 |
31 | [dh.c] | 31 | [dh.c] |
32 | spelling | 32 | spelling |
33 | - deraadt@cvs.openbsd.org 2001/03/06 00:33:04 | ||
34 | [authfd.c cli.c ssh-agent.c] | ||
35 | EINTR/EAGAIN handling is required in more cases | ||
33 | 36 | ||
34 | 20010305 | 37 | 20010305 |
35 | - (bal) CVS ID touch up on sshpty.[ch] and sshlogin.[ch] | 38 | - (bal) CVS ID touch up on sshpty.[ch] and sshlogin.[ch] |
@@ -4401,4 +4404,4 @@ | |||
4401 | - Wrote replacements for strlcpy and mkdtemp | 4404 | - Wrote replacements for strlcpy and mkdtemp |
4402 | - Released 1.0pre1 | 4405 | - Released 1.0pre1 |
4403 | 4406 | ||
4404 | $Id: ChangeLog,v 1.915 2001/03/06 01:13:06 mouring Exp $ | 4407 | $Id: ChangeLog,v 1.916 2001/03/06 03:31:34 mouring Exp $ |
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: authfd.c,v 1.37 2001/03/04 17:42:27 millert Exp $"); | 38 | RCSID("$OpenBSD: authfd.c,v 1.38 2001/03/06 00:33:03 deraadt Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
41 | 41 | ||
@@ -120,6 +120,8 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply | |||
120 | len = 4; | 120 | len = 4; |
121 | while (len > 0) { | 121 | while (len > 0) { |
122 | l = read(auth->fd, buf + 4 - len, len); | 122 | l = read(auth->fd, buf + 4 - len, len); |
123 | if (l == -1 && (errno == EAGAIN || errno == EINTR)) | ||
124 | continue; | ||
123 | if (l <= 0) { | 125 | if (l <= 0) { |
124 | error("Error reading response length from authentication socket."); | 126 | error("Error reading response length from authentication socket."); |
125 | return 0; | 127 | return 0; |
@@ -139,6 +141,8 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply | |||
139 | if (l > sizeof(buf)) | 141 | if (l > sizeof(buf)) |
140 | l = sizeof(buf); | 142 | l = sizeof(buf); |
141 | l = read(auth->fd, buf, l); | 143 | l = read(auth->fd, buf, l); |
144 | if (l == -1 && (errno == EAGAIN || errno == EINTR)) | ||
145 | continue; | ||
142 | if (l <= 0) { | 146 | if (l <= 0) { |
143 | error("Error reading response from authentication socket."); | 147 | error("Error reading response from authentication socket."); |
144 | return 0; | 148 | return 0; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: cli.c,v 1.10 2001/03/01 03:38:33 deraadt Exp $ */ | 1 | /* $OpenBSD: cli.c,v 1.11 2001/03/06 00:33:04 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "includes.h" | 27 | #include "includes.h" |
28 | RCSID("$OpenBSD: cli.c,v 1.10 2001/03/01 03:38:33 deraadt Exp $"); | 28 | RCSID("$OpenBSD: cli.c,v 1.11 2001/03/06 00:33:04 deraadt Exp $"); |
29 | 29 | ||
30 | #include "xmalloc.h" | 30 | #include "xmalloc.h" |
31 | #include "log.h" | 31 | #include "log.h" |
@@ -134,12 +134,16 @@ cli_read(char* buf, int size, int echo) | |||
134 | { | 134 | { |
135 | char ch = 0; | 135 | char ch = 0; |
136 | int i = 0; | 136 | int i = 0; |
137 | int n; | ||
137 | 138 | ||
138 | if (!echo) | 139 | if (!echo) |
139 | cli_echo_disable(); | 140 | cli_echo_disable(); |
140 | 141 | ||
141 | while (ch != '\n') { | 142 | while (ch != '\n') { |
142 | if (read(cli_input, &ch, 1) != 1) | 143 | n = read(cli_input, &ch, 1); |
144 | if (n == -1 && (errno == EAGAIN || errno == EINTR)) | ||
145 | continue; | ||
146 | if (n != 1) | ||
143 | break; | 147 | break; |
144 | if (ch == '\n' || intr != 0) | 148 | if (ch == '\n' || intr != 0) |
145 | break; | 149 | break; |
diff --git a/ssh-agent.c b/ssh-agent.c index a558ecef7..5a774d570 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.51 2001/03/02 18:54:31 deraadt Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.52 2001/03/06 00:33:04 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: ssh-agent.c,v 1.51 2001/03/02 18:54:31 deraadt Exp $"); | 40 | RCSID("$OpenBSD: ssh-agent.c,v 1.52 2001/03/06 00:33:04 deraadt Exp $"); |
41 | 41 | ||
42 | #include <openssl/evp.h> | 42 | #include <openssl/evp.h> |
43 | #include <openssl/md5.h> | 43 | #include <openssl/md5.h> |
@@ -635,9 +635,15 @@ after_select(fd_set *readset, fd_set *writeset) | |||
635 | case AUTH_CONNECTION: | 635 | case AUTH_CONNECTION: |
636 | if (buffer_len(&sockets[i].output) > 0 && | 636 | if (buffer_len(&sockets[i].output) > 0 && |
637 | FD_ISSET(sockets[i].fd, writeset)) { | 637 | FD_ISSET(sockets[i].fd, writeset)) { |
638 | len = write(sockets[i].fd, | 638 | do { |
639 | buffer_ptr(&sockets[i].output), | 639 | len = write(sockets[i].fd, |
640 | buffer_len(&sockets[i].output)); | 640 | buffer_ptr(&sockets[i].output), |
641 | buffer_len(&sockets[i].output)); | ||
642 | if (len == -1 && (errno == EAGAIN || | ||
643 | errno == EINTR)) | ||
644 | continue; | ||
645 | break; | ||
646 | } while (1); | ||
641 | if (len <= 0) { | 647 | if (len <= 0) { |
642 | shutdown(sockets[i].fd, SHUT_RDWR); | 648 | shutdown(sockets[i].fd, SHUT_RDWR); |
643 | close(sockets[i].fd); | 649 | close(sockets[i].fd); |
@@ -649,7 +655,13 @@ after_select(fd_set *readset, fd_set *writeset) | |||
649 | buffer_consume(&sockets[i].output, len); | 655 | buffer_consume(&sockets[i].output, len); |
650 | } | 656 | } |
651 | if (FD_ISSET(sockets[i].fd, readset)) { | 657 | if (FD_ISSET(sockets[i].fd, readset)) { |
652 | len = read(sockets[i].fd, buf, sizeof(buf)); | 658 | do { |
659 | len = read(sockets[i].fd, buf, sizeof(buf)); | ||
660 | if (len == -1 && (errno == EAGAIN || | ||
661 | errno == EINTR)) | ||
662 | continue; | ||
663 | break; | ||
664 | } while (1); | ||
653 | if (len <= 0) { | 665 | if (len <= 0) { |
654 | shutdown(sockets[i].fd, SHUT_RDWR); | 666 | shutdown(sockets[i].fd, SHUT_RDWR); |
655 | close(sockets[i].fd); | 667 | close(sockets[i].fd); |