summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--atomicio.c4
-rw-r--r--atomicio.h8
-rw-r--r--authfd.c6
-rw-r--r--clientloop.c6
-rw-r--r--monitor_wrap.c6
-rw-r--r--msg.c6
-rw-r--r--progressmeter.c6
-rw-r--r--scp.c36
-rw-r--r--sftp-client.c8
-rw-r--r--ssh-keyscan.c4
-rw-r--r--ssh.h3
-rw-r--r--sshconnect.c4
-rw-r--r--sshd.c8
14 files changed, 60 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 130989988..8fdfce197 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@
4 [sshd.c] 4 [sshd.c]
5 report pidfile creation errors, based on patch from Roumen Petrov; 5 report pidfile creation errors, based on patch from Roumen Petrov;
6 ok markus@ 6 ok markus@
7 - deraadt@cvs.openbsd.org 2003/06/28 16:23:06
8 [atomicio.c atomicio.h authfd.c clientloop.c monitor_wrap.c msg.c
9 progressmeter.c scp.c sftp-client.c ssh-keyscan.c ssh.h sshconnect.c
10 sshd.c]
11 deal with typing of write vs read in atomicio
7 12
820030630 1320030630
9 - (djm) Search for support functions necessary to build our 14 - (djm) Search for support functions necessary to build our
@@ -624,4 +629,4 @@
624 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 629 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
625 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 630 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
626 631
627$Id: ChangeLog,v 1.2836 2003/07/03 03:40:44 dtucker Exp $ 632$Id: ChangeLog,v 1.2837 2003/07/03 03:46:56 dtucker Exp $
diff --git a/atomicio.c b/atomicio.c
index 47161eb3a..dfc1553c5 100644
--- a/atomicio.c
+++ b/atomicio.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: atomicio.c,v 1.10 2001/05/08 22:48:07 markus Exp $"); 27RCSID("$OpenBSD: atomicio.c,v 1.11 2003/06/28 16:23:06 deraadt Exp $");
28 28
29#include "atomicio.h" 29#include "atomicio.h"
30 30
@@ -33,7 +33,7 @@ RCSID("$OpenBSD: atomicio.c,v 1.10 2001/05/08 22:48:07 markus Exp $");
33 */ 33 */
34ssize_t 34ssize_t
35atomicio(f, fd, _s, n) 35atomicio(f, fd, _s, n)
36 ssize_t (*f) (); 36 ssize_t (*f) (int, void *, size_t);
37 int fd; 37 int fd;
38 void *_s; 38 void *_s;
39 size_t n; 39 size_t n;
diff --git a/atomicio.h b/atomicio.h
index e569d38c6..5c0f392ef 100644
--- a/atomicio.h
+++ b/atomicio.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: atomicio.h,v 1.4 2001/06/26 06:32:46 itojun Exp $ */ 1/* $OpenBSD: atomicio.h,v 1.5 2003/06/28 16:23:06 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. 4 * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved.
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28/* 28/*
29 * Ensure all of data on socket comes through. f==read || f==write 29 * Ensure all of data on socket comes through. f==read || f==vwrite
30 */ 30 */
31ssize_t atomicio(ssize_t (*)(), int, void *, size_t); 31ssize_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t);
32
33#define vwrite (ssize_t (*)(int, void *, size_t))write
diff --git a/authfd.c b/authfd.c
index 368544b17..c78db6d94 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.60 2003/06/11 11:18:38 djm Exp $"); 38RCSID("$OpenBSD: authfd.c,v 1.61 2003/06/28 16:23:06 deraadt Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41 41
@@ -122,8 +122,8 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
122 PUT_32BIT(buf, len); 122 PUT_32BIT(buf, len);
123 123
124 /* Send the length and then the packet to the agent. */ 124 /* Send the length and then the packet to the agent. */
125 if (atomicio(write, auth->fd, buf, 4) != 4 || 125 if (atomicio(vwrite, auth->fd, buf, 4) != 4 ||
126 atomicio(write, auth->fd, buffer_ptr(request), 126 atomicio(vwrite, auth->fd, buffer_ptr(request),
127 buffer_len(request)) != buffer_len(request)) { 127 buffer_len(request)) != buffer_len(request)) {
128 error("Error writing to authentication socket."); 128 error("Error writing to authentication socket.");
129 return 0; 129 return 0;
diff --git a/clientloop.c b/clientloop.c
index 1c1acf481..d8def78bd 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.111 2003/05/14 22:24:42 markus Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.112 2003/06/28 16:23:06 deraadt Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -395,9 +395,9 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
395 395
396 /* Flush stdout and stderr buffers. */ 396 /* Flush stdout and stderr buffers. */
397 if (buffer_len(bout) > 0) 397 if (buffer_len(bout) > 0)
398 atomicio(write, fileno(stdout), buffer_ptr(bout), buffer_len(bout)); 398 atomicio(vwrite, fileno(stdout), buffer_ptr(bout), buffer_len(bout));
399 if (buffer_len(berr) > 0) 399 if (buffer_len(berr) > 0)
400 atomicio(write, fileno(stderr), buffer_ptr(berr), buffer_len(berr)); 400 atomicio(vwrite, fileno(stderr), buffer_ptr(berr), buffer_len(berr));
401 401
402 leave_raw_mode(); 402 leave_raw_mode();
403 403
diff --git a/monitor_wrap.c b/monitor_wrap.c
index bd3a01a2b..10a79c035 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: monitor_wrap.c,v 1.26 2003/04/07 08:29:57 markus Exp $"); 28RCSID("$OpenBSD: monitor_wrap.c,v 1.27 2003/06/28 16:23:06 deraadt Exp $");
29 29
30#include <openssl/bn.h> 30#include <openssl/bn.h>
31#include <openssl/dh.h> 31#include <openssl/dh.h>
@@ -72,9 +72,9 @@ mm_request_send(int socket, enum monitor_reqtype type, Buffer *m)
72 72
73 PUT_32BIT(buf, mlen + 1); 73 PUT_32BIT(buf, mlen + 1);
74 buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ 74 buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
75 if (atomicio(write, socket, buf, sizeof(buf)) != sizeof(buf)) 75 if (atomicio(vwrite, socket, buf, sizeof(buf)) != sizeof(buf))
76 fatal("%s: write", __func__); 76 fatal("%s: write", __func__);
77 if (atomicio(write, socket, buffer_ptr(m), mlen) != mlen) 77 if (atomicio(vwrite, socket, buffer_ptr(m), mlen) != mlen)
78 fatal("%s: write", __func__); 78 fatal("%s: write", __func__);
79} 79}
80 80
diff --git a/msg.c b/msg.c
index 5d266c207..6a806c3f5 100644
--- a/msg.c
+++ b/msg.c
@@ -22,7 +22,7 @@
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24#include "includes.h" 24#include "includes.h"
25RCSID("$OpenBSD: msg.c,v 1.5 2002/12/19 00:07:02 djm Exp $"); 25RCSID("$OpenBSD: msg.c,v 1.6 2003/06/28 16:23:06 deraadt Exp $");
26 26
27#include "buffer.h" 27#include "buffer.h"
28#include "getput.h" 28#include "getput.h"
@@ -40,9 +40,9 @@ ssh_msg_send(int fd, u_char type, Buffer *m)
40 40
41 PUT_32BIT(buf, mlen + 1); 41 PUT_32BIT(buf, mlen + 1);
42 buf[4] = type; /* 1st byte of payload is mesg-type */ 42 buf[4] = type; /* 1st byte of payload is mesg-type */
43 if (atomicio(write, fd, buf, sizeof(buf)) != sizeof(buf)) 43 if (atomicio(vwrite, fd, buf, sizeof(buf)) != sizeof(buf))
44 fatal("ssh_msg_send: write"); 44 fatal("ssh_msg_send: write");
45 if (atomicio(write, fd, buffer_ptr(m), mlen) != mlen) 45 if (atomicio(vwrite, fd, buffer_ptr(m), mlen) != mlen)
46 fatal("ssh_msg_send: write"); 46 fatal("ssh_msg_send: write");
47} 47}
48 48
diff --git a/progressmeter.c b/progressmeter.c
index a3f14c929..6aa225adf 100644
--- a/progressmeter.c
+++ b/progressmeter.c
@@ -64,7 +64,7 @@
64 */ 64 */
65 65
66#include "includes.h" 66#include "includes.h"
67RCSID("$OpenBSD: progressmeter.c,v 1.7 2003/06/10 22:20:52 deraadt Exp $"); 67RCSID("$OpenBSD: progressmeter.c,v 1.8 2003/06/28 16:23:06 deraadt Exp $");
68 68
69#ifdef HAVE_LIBGEN_H 69#ifdef HAVE_LIBGEN_H
70#include <libgen.h> 70#include <libgen.h>
@@ -132,7 +132,7 @@ stop_progress_meter(void)
132 alarm(0); 132 alarm(0);
133 draw_progress_meter(); 133 draw_progress_meter();
134 if (foregroundproc() != 0) 134 if (foregroundproc() != 0)
135 atomicio(write, fileno(stdout), "\n", 1); 135 atomicio(vwrite, fileno(stdout), "\n", 1);
136} 136}
137 137
138static void 138static void
@@ -255,7 +255,7 @@ draw_progress_meter(void)
255 "%02d:%02d%s", i / 60, i % 60, 255 "%02d:%02d%s", i / 60, i % 60,
256 (cursize != totalbytes) ? " ETA" : " "); 256 (cursize != totalbytes) ? " ETA" : " ");
257 } 257 }
258 atomicio(write, fileno(stdout), buf, strlen(buf)); 258 atomicio(vwrite, fileno(stdout), buf, strlen(buf));
259} 259}
260 260
261static int 261static int
diff --git a/scp.c b/scp.c
index 1cd0c55a4..81690609d 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.106 2003/06/12 15:34:09 nino Exp $"); 74RCSID("$OpenBSD: scp.c,v 1.107 2003/06/28 16:23:06 deraadt Exp $");
75 75
76#include "xmalloc.h" 76#include "xmalloc.h"
77#include "atomicio.h" 77#include "atomicio.h"
@@ -549,7 +549,7 @@ syserr: run_err("%s: %s", name, strerror(errno));
549 (void) snprintf(buf, sizeof buf, "T%lu 0 %lu 0\n", 549 (void) snprintf(buf, sizeof buf, "T%lu 0 %lu 0\n",
550 (u_long) stb.st_mtime, 550 (u_long) stb.st_mtime,
551 (u_long) stb.st_atime); 551 (u_long) stb.st_atime);
552 (void) atomicio(write, remout, buf, strlen(buf)); 552 (void) atomicio(vwrite, remout, buf, strlen(buf));
553 if (response() < 0) 553 if (response() < 0)
554 goto next; 554 goto next;
555 } 555 }
@@ -560,7 +560,7 @@ syserr: run_err("%s: %s", name, strerror(errno));
560 if (verbose_mode) { 560 if (verbose_mode) {
561 fprintf(stderr, "Sending file modes: %s", buf); 561 fprintf(stderr, "Sending file modes: %s", buf);
562 } 562 }
563 (void) atomicio(write, remout, buf, strlen(buf)); 563 (void) atomicio(vwrite, remout, buf, strlen(buf));
564 if (response() < 0) 564 if (response() < 0)
565 goto next; 565 goto next;
566 if ((bp = allocbuf(&buffer, fd, 2048)) == NULL) { 566 if ((bp = allocbuf(&buffer, fd, 2048)) == NULL) {
@@ -580,9 +580,9 @@ next: (void) close(fd);
580 haderr = result >= 0 ? EIO : errno; 580 haderr = result >= 0 ? EIO : errno;
581 } 581 }
582 if (haderr) 582 if (haderr)
583 (void) atomicio(write, remout, bp->buf, amt); 583 (void) atomicio(vwrite, remout, bp->buf, amt);
584 else { 584 else {
585 result = atomicio(write, remout, bp->buf, amt); 585 result = atomicio(vwrite, remout, bp->buf, amt);
586 if (result != amt) 586 if (result != amt)
587 haderr = result >= 0 ? EIO : errno; 587 haderr = result >= 0 ? EIO : errno;
588 statbytes += result; 588 statbytes += result;
@@ -596,7 +596,7 @@ next: (void) close(fd);
596 if (close(fd) < 0 && !haderr) 596 if (close(fd) < 0 && !haderr)
597 haderr = errno; 597 haderr = errno;
598 if (!haderr) 598 if (!haderr)
599 (void) atomicio(write, remout, "", 1); 599 (void) atomicio(vwrite, remout, "", 1);
600 else 600 else
601 run_err("%s: %s", name, strerror(haderr)); 601 run_err("%s: %s", name, strerror(haderr));
602 (void) response(); 602 (void) response();
@@ -623,7 +623,7 @@ rsource(char *name, struct stat *statp)
623 (void) snprintf(path, sizeof(path), "T%lu 0 %lu 0\n", 623 (void) snprintf(path, sizeof(path), "T%lu 0 %lu 0\n",
624 (u_long) statp->st_mtime, 624 (u_long) statp->st_mtime,
625 (u_long) statp->st_atime); 625 (u_long) statp->st_atime);
626 (void) atomicio(write, remout, path, strlen(path)); 626 (void) atomicio(vwrite, remout, path, strlen(path));
627 if (response() < 0) { 627 if (response() < 0) {
628 closedir(dirp); 628 closedir(dirp);
629 return; 629 return;
@@ -633,7 +633,7 @@ rsource(char *name, struct stat *statp)
633 (u_int) (statp->st_mode & FILEMODEMASK), 0, last); 633 (u_int) (statp->st_mode & FILEMODEMASK), 0, last);
634 if (verbose_mode) 634 if (verbose_mode)
635 fprintf(stderr, "Entering directory: %s", path); 635 fprintf(stderr, "Entering directory: %s", path);
636 (void) atomicio(write, remout, path, strlen(path)); 636 (void) atomicio(vwrite, remout, path, strlen(path));
637 if (response() < 0) { 637 if (response() < 0) {
638 closedir(dirp); 638 closedir(dirp);
639 return; 639 return;
@@ -652,7 +652,7 @@ rsource(char *name, struct stat *statp)
652 source(1, vect); 652 source(1, vect);
653 } 653 }
654 (void) closedir(dirp); 654 (void) closedir(dirp);
655 (void) atomicio(write, remout, "E\n", 2); 655 (void) atomicio(vwrite, remout, "E\n", 2);
656 (void) response(); 656 (void) response();
657} 657}
658 658
@@ -742,7 +742,7 @@ sink(int argc, char **argv)
742 if (targetshouldbedirectory) 742 if (targetshouldbedirectory)
743 verifydir(targ); 743 verifydir(targ);
744 744
745 (void) atomicio(write, remout, "", 1); 745 (void) atomicio(vwrite, remout, "", 1);
746 if (stat(targ, &stb) == 0 && S_ISDIR(stb.st_mode)) 746 if (stat(targ, &stb) == 0 && S_ISDIR(stb.st_mode))
747 targisdir = 1; 747 targisdir = 1;
748 for (first = 1;; first = 0) { 748 for (first = 1;; first = 0) {
@@ -760,7 +760,7 @@ sink(int argc, char **argv)
760 760
761 if (buf[0] == '\01' || buf[0] == '\02') { 761 if (buf[0] == '\01' || buf[0] == '\02') {
762 if (iamremote == 0) 762 if (iamremote == 0)
763 (void) atomicio(write, STDERR_FILENO, 763 (void) atomicio(vwrite, STDERR_FILENO,
764 buf + 1, strlen(buf + 1)); 764 buf + 1, strlen(buf + 1));
765 if (buf[0] == '\02') 765 if (buf[0] == '\02')
766 exit(1); 766 exit(1);
@@ -768,7 +768,7 @@ sink(int argc, char **argv)
768 continue; 768 continue;
769 } 769 }
770 if (buf[0] == 'E') { 770 if (buf[0] == 'E') {
771 (void) atomicio(write, remout, "", 1); 771 (void) atomicio(vwrite, remout, "", 1);
772 return; 772 return;
773 } 773 }
774 if (ch == '\n') 774 if (ch == '\n')
@@ -790,7 +790,7 @@ sink(int argc, char **argv)
790 atime.tv_usec = strtol(cp, &cp, 10); 790 atime.tv_usec = strtol(cp, &cp, 10);
791 if (!cp || *cp++ != '\0') 791 if (!cp || *cp++ != '\0')
792 SCREWUP("atime.usec not delimited"); 792 SCREWUP("atime.usec not delimited");
793 (void) atomicio(write, remout, "", 1); 793 (void) atomicio(vwrite, remout, "", 1);
794 continue; 794 continue;
795 } 795 }
796 if (*cp != 'C' && *cp != 'D') { 796 if (*cp != 'C' && *cp != 'D') {
@@ -875,7 +875,7 @@ sink(int argc, char **argv)
875bad: run_err("%s: %s", np, strerror(errno)); 875bad: run_err("%s: %s", np, strerror(errno));
876 continue; 876 continue;
877 } 877 }
878 (void) atomicio(write, remout, "", 1); 878 (void) atomicio(vwrite, remout, "", 1);
879 if ((bp = allocbuf(&buffer, ofd, 4096)) == NULL) { 879 if ((bp = allocbuf(&buffer, ofd, 4096)) == NULL) {
880 (void) close(ofd); 880 (void) close(ofd);
881 continue; 881 continue;
@@ -912,7 +912,7 @@ bad: run_err("%s: %s", np, strerror(errno));
912 if (count == bp->cnt) { 912 if (count == bp->cnt) {
913 /* Keep reading so we stay sync'd up. */ 913 /* Keep reading so we stay sync'd up. */
914 if (wrerr == NO) { 914 if (wrerr == NO) {
915 j = atomicio(write, ofd, bp->buf, count); 915 j = atomicio(vwrite, ofd, bp->buf, count);
916 if (j != count) { 916 if (j != count) {
917 wrerr = YES; 917 wrerr = YES;
918 wrerrno = j >= 0 ? EIO : errno; 918 wrerrno = j >= 0 ? EIO : errno;
@@ -925,7 +925,7 @@ bad: run_err("%s: %s", np, strerror(errno));
925 if (showprogress) 925 if (showprogress)
926 stop_progress_meter(); 926 stop_progress_meter();
927 if (count != 0 && wrerr == NO && 927 if (count != 0 && wrerr == NO &&
928 (j = atomicio(write, ofd, bp->buf, count)) != count) { 928 (j = atomicio(vwrite, ofd, bp->buf, count)) != count) {
929 wrerr = YES; 929 wrerr = YES;
930 wrerrno = j >= 0 ? EIO : errno; 930 wrerrno = j >= 0 ? EIO : errno;
931 } 931 }
@@ -970,7 +970,7 @@ bad: run_err("%s: %s", np, strerror(errno));
970 run_err("%s: %s", np, strerror(wrerrno)); 970 run_err("%s: %s", np, strerror(wrerrno));
971 break; 971 break;
972 case NO: 972 case NO:
973 (void) atomicio(write, remout, "", 1); 973 (void) atomicio(vwrite, remout, "", 1);
974 break; 974 break;
975 case DISPLAYED: 975 case DISPLAYED:
976 break; 976 break;
@@ -1005,7 +1005,7 @@ response(void)
1005 } while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n'); 1005 } while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n');
1006 1006
1007 if (!iamremote) 1007 if (!iamremote)
1008 (void) atomicio(write, STDERR_FILENO, rbuf, cp - rbuf); 1008 (void) atomicio(vwrite, STDERR_FILENO, rbuf, cp - rbuf);
1009 ++errs; 1009 ++errs;
1010 if (resp == 1) 1010 if (resp == 1)
1011 return (-1); 1011 return (-1);
diff --git a/sftp-client.c b/sftp-client.c
index a48d56e69..ffff0fe5a 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
28/* XXX: copy between two remote sites */ 28/* XXX: copy between two remote sites */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-client.c,v 1.43 2003/04/08 20:21:29 itojun Exp $"); 31RCSID("$OpenBSD: sftp-client.c,v 1.44 2003/06/28 16:23:06 deraadt Exp $");
32 32
33#include "openbsd-compat/sys-queue.h" 33#include "openbsd-compat/sys-queue.h"
34 34
@@ -71,10 +71,10 @@ send_msg(int fd, Buffer *m)
71 71
72 /* Send length first */ 72 /* Send length first */
73 PUT_32BIT(mlen, buffer_len(m)); 73 PUT_32BIT(mlen, buffer_len(m));
74 if (atomicio(write, fd, mlen, sizeof(mlen)) <= 0) 74 if (atomicio(vwrite, fd, mlen, sizeof(mlen)) <= 0)
75 fatal("Couldn't send packet: %s", strerror(errno)); 75 fatal("Couldn't send packet: %s", strerror(errno));
76 76
77 if (atomicio(write, fd, buffer_ptr(m), buffer_len(m)) <= 0) 77 if (atomicio(vwrite, fd, buffer_ptr(m), buffer_len(m)) <= 0)
78 fatal("Couldn't send packet: %s", strerror(errno)); 78 fatal("Couldn't send packet: %s", strerror(errno));
79 79
80 buffer_clear(m); 80 buffer_clear(m);
@@ -875,7 +875,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
875 fatal("Received more data than asked for " 875 fatal("Received more data than asked for "
876 "%u > %u", len, req->len); 876 "%u > %u", len, req->len);
877 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || 877 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 ||
878 atomicio(write, local_fd, data, len) != len) && 878 atomicio(vwrite, local_fd, data, len) != len) &&
879 !write_error) { 879 !write_error) {
880 write_errno = errno; 880 write_errno = errno;
881 write_error = 1; 881 write_error = 1;
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index e2cd789b5..358a1e353 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.43 2003/04/26 04:29:49 deraadt Exp $"); 10RCSID("$OpenBSD: ssh-keyscan.c,v 1.44 2003/06/28 16:23:06 deraadt Exp $");
11 11
12#include "openbsd-compat/sys-queue.h" 12#include "openbsd-compat/sys-queue.h"
13 13
@@ -541,7 +541,7 @@ congreet(int s)
541 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n", 541 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",
542 c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2, 542 c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2,
543 c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2); 543 c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2);
544 if (atomicio(write, s, buf, n) != n) { 544 if (atomicio(vwrite, s, buf, n) != n) {
545 error("write (%s): %s", c->c_name, strerror(errno)); 545 error("write (%s): %s", c->c_name, strerror(errno));
546 confree(s); 546 confree(s);
547 return; 547 return;
diff --git a/ssh.h b/ssh.h
index a2d47e1ef..25a9213f3 100644
--- a/ssh.h
+++ b/ssh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.h,v 1.71 2002/06/22 02:00:29 stevesk Exp $ */ 1/* $OpenBSD: ssh.h,v 1.72 2003/06/28 16:23:06 deraadt Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -107,3 +107,4 @@
107#define SSH_RSA_MINIMUM_MODULUS_SIZE 768 107#define SSH_RSA_MINIMUM_MODULUS_SIZE 768
108 108
109#endif /* SSH_H */ 109#endif /* SSH_H */
110
diff --git a/sshconnect.c b/sshconnect.c
index 82f5539c1..364a62281 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.145 2003/06/11 10:16:16 jakob Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.146 2003/06/28 16:23:06 deraadt Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -523,7 +523,7 @@ ssh_exchange_identification(void)
523 compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1, 523 compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,
524 compat20 ? PROTOCOL_MINOR_2 : minor1, 524 compat20 ? PROTOCOL_MINOR_2 : minor1,
525 SSH_VERSION); 525 SSH_VERSION);
526 if (atomicio(write, connection_out, buf, strlen(buf)) != strlen(buf)) 526 if (atomicio(vwrite, connection_out, buf, strlen(buf)) != strlen(buf))
527 fatal("write: %.100s", strerror(errno)); 527 fatal("write: %.100s", strerror(errno));
528 client_version_string = xstrdup(buf); 528 client_version_string = xstrdup(buf);
529 chop(client_version_string); 529 chop(client_version_string);
diff --git a/sshd.c b/sshd.c
index b4cdc724a..fafe0c66d 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.270 2003/06/28 07:48:10 djm Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.271 2003/06/28 16:23:06 deraadt Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -369,7 +369,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
369 369
370 if (client_version_string == NULL) { 370 if (client_version_string == NULL) {
371 /* Send our protocol version identification. */ 371 /* Send our protocol version identification. */
372 if (atomicio(write, sock_out, server_version_string, 372 if (atomicio(vwrite, sock_out, server_version_string,
373 strlen(server_version_string)) 373 strlen(server_version_string))
374 != strlen(server_version_string)) { 374 != strlen(server_version_string)) {
375 logit("Could not write ident string to %s", get_remote_ipaddr()); 375 logit("Could not write ident string to %s", get_remote_ipaddr());
@@ -408,7 +408,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
408 if (sscanf(client_version_string, "SSH-%d.%d-%[^\n]\n", 408 if (sscanf(client_version_string, "SSH-%d.%d-%[^\n]\n",
409 &remote_major, &remote_minor, remote_version) != 3) { 409 &remote_major, &remote_minor, remote_version) != 3) {
410 s = "Protocol mismatch.\n"; 410 s = "Protocol mismatch.\n";
411 (void) atomicio(write, sock_out, s, strlen(s)); 411 (void) atomicio(vwrite, sock_out, s, strlen(s));
412 close(sock_in); 412 close(sock_in);
413 close(sock_out); 413 close(sock_out);
414 logit("Bad protocol version identification '%.100s' from %s", 414 logit("Bad protocol version identification '%.100s' from %s",
@@ -469,7 +469,7 @@ sshd_exchange_identification(int sock_in, int sock_out)
469 469
470 if (mismatch) { 470 if (mismatch) {
471 s = "Protocol major versions differ.\n"; 471 s = "Protocol major versions differ.\n";
472 (void) atomicio(write, sock_out, s, strlen(s)); 472 (void) atomicio(vwrite, sock_out, s, strlen(s));
473 close(sock_in); 473 close(sock_in);
474 close(sock_out); 474 close(sock_out);
475 logit("Protocol major versions differ for %s: %.200s vs. %.200s", 475 logit("Protocol major versions differ for %s: %.200s vs. %.200s",