summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-13 21:19:37 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-13 21:19:37 +1000
commitfe6649da0cd211efc069aa9987b00838d030ef1d (patch)
tree88a21d6391c047fbf32ed9c50b9a7594978e0599
parentc7a6fc41bfdcd73469b153437a8e75e0b1057894 (diff)
- avsm@cvs.openbsd.org 2004/08/11 21:44:32
[authfd.c scp.c ssh-keyscan.c] use atomicio instead of homegrown equivalents or read/write. markus@ ok
-rw-r--r--ChangeLog6
-rw-r--r--authfd.c19
-rw-r--r--scp.c9
-rw-r--r--ssh-keyscan.c6
4 files changed, 16 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c5722e4d..e0590dccb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
5 - avsm@cvs.openbsd.org 2004/08/11 21:43:05 5 - avsm@cvs.openbsd.org 2004/08/11 21:43:05
6 [channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c] 6 [channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c]
7 some signed/unsigned int comparison cleanups; markus@ ok 7 some signed/unsigned int comparison cleanups; markus@ ok
8 - avsm@cvs.openbsd.org 2004/08/11 21:44:32
9 [authfd.c scp.c ssh-keyscan.c]
10 use atomicio instead of homegrown equivalents or read/write.
11 markus@ ok
8 12
920040812 1320040812
10 - (dtucker) [sshd.c] Remove duplicate variable imported during sync. 14 - (dtucker) [sshd.c] Remove duplicate variable imported during sync.
@@ -1602,4 +1606,4 @@
1602 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1606 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1603 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1607 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1604 1608
1605$Id: ChangeLog,v 1.3499 2004/08/13 11:18:00 dtucker Exp $ 1609$Id: ChangeLog,v 1.3500 2004/08/13 11:19:37 dtucker Exp $
diff --git a/authfd.c b/authfd.c
index 42ca08256..662350cef 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: authfd.c,v 1.63 2003/11/21 11:57:03 djm Exp $"); 38RCSID("$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;
diff --git a/scp.c b/scp.c
index 33c5891f2..ef9eaa1a4 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
71 */ 71 */
72 72
73#include "includes.h" 73#include "includes.h"
74RCSID("$OpenBSD: scp.c,v 1.116 2004/07/08 12:47:21 dtucker Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.117 2004/08/11 21:44:32 avsm Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -898,11 +898,8 @@ bad: run_err("%s: %s", np, strerror(errno));
898 amt = size - i; 898 amt = size - i;
899 count += amt; 899 count += amt;
900 do { 900 do {
901 j = read(remin, cp, amt); 901 j = atomicio(read, remin, cp, amt);
902 if (j == -1 && (errno == EINTR || 902 if (j <= 0) {
903 errno == EAGAIN)) {
904 continue;
905 } else if (j <= 0) {
906 run_err("%s", j ? strerror(errno) : 903 run_err("%s", j ? strerror(errno) :
907 "dropped connection"); 904 "dropped connection");
908 exit(1); 905 exit(1);
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index fd3185adf..3cb52ac2e 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include "includes.h" 9#include "includes.h"
10RCSID("$OpenBSD: ssh-keyscan.c,v 1.49 2004/06/14 01:44:39 djm Exp $"); 10RCSID("$OpenBSD: ssh-keyscan.c,v 1.50 2004/08/11 21:44:32 avsm Exp $");
11 11
12#include "openbsd-compat/sys-queue.h" 12#include "openbsd-compat/sys-queue.h"
13 13
@@ -494,7 +494,7 @@ congreet(int s)
494 494
495 bufsiz = sizeof(buf); 495 bufsiz = sizeof(buf);
496 cp = buf; 496 cp = buf;
497 while (bufsiz-- && (n = read(s, cp, 1)) == 1 && *cp != '\n') { 497 while (bufsiz-- && (n = atomicio(read, s, cp, 1)) == 1 && *cp != '\n') {
498 if (*cp == '\r') 498 if (*cp == '\r')
499 *cp = '\n'; 499 *cp = '\n';
500 cp++; 500 cp++;
@@ -560,7 +560,7 @@ conread(int s)
560 congreet(s); 560 congreet(s);
561 return; 561 return;
562 } 562 }
563 n = read(s, c->c_data + c->c_off, c->c_len - c->c_off); 563 n = atomicio(read, s, c->c_data + c->c_off, c->c_len - c->c_off);
564 if (n < 0) { 564 if (n < 0) {
565 error("read (%s): %s", c->c_name, strerror(errno)); 565 error("read (%s): %s", c->c_name, strerror(errno));
566 confree(s); 566 confree(s);