diff options
Diffstat (limited to 'authfd.c')
-rw-r--r-- | authfd.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: authfd.c,v 1.63 2003/11/21 11:57:03 djm Exp $"); | 38 | RCSID("$OpenBSD: authfd.c,v 1.64 2004/08/11 21:44:31 avsm Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
41 | 41 | ||
@@ -133,16 +133,9 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply | |||
133 | * Wait for response from the agent. First read the length of the | 133 | * Wait for response from the agent. First read the length of the |
134 | * response packet. | 134 | * response packet. |
135 | */ | 135 | */ |
136 | len = 4; | 136 | if (atomicio(read, auth->fd, buf, 4) != 4) { |
137 | while (len > 0) { | 137 | error("Error reading response length from authentication socket."); |
138 | l = read(auth->fd, buf + 4 - len, len); | 138 | return 0; |
139 | if (l == -1 && (errno == EAGAIN || errno == EINTR)) | ||
140 | continue; | ||
141 | if (l <= 0) { | ||
142 | error("Error reading response length from authentication socket."); | ||
143 | return 0; | ||
144 | } | ||
145 | len -= l; | ||
146 | } | 139 | } |
147 | 140 | ||
148 | /* Extract the length, and check it for sanity. */ | 141 | /* Extract the length, and check it for sanity. */ |
@@ -156,9 +149,7 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply | |||
156 | l = len; | 149 | l = len; |
157 | if (l > sizeof(buf)) | 150 | if (l > sizeof(buf)) |
158 | l = sizeof(buf); | 151 | l = sizeof(buf); |
159 | l = read(auth->fd, buf, l); | 152 | l = atomicio(read, auth->fd, buf, l); |
160 | if (l == -1 && (errno == EAGAIN || errno == EINTR)) | ||
161 | continue; | ||
162 | if (l <= 0) { | 153 | if (l <= 0) { |
163 | error("Error reading response from authentication socket."); | 154 | error("Error reading response from authentication socket."); |
164 | return 0; | 155 | return 0; |