diff options
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r-- | monitor_wrap.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c index e005a4505..d8814682a 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" |
28 | RCSID("$OpenBSD: monitor_wrap.c,v 1.39 2004/07/17 05:31:41 dtucker Exp $"); | 28 | RCSID("$OpenBSD: monitor_wrap.c,v 1.40 2005/05/24 17:32:43 avsm Exp $"); |
29 | 29 | ||
30 | #include <openssl/bn.h> | 30 | #include <openssl/bn.h> |
31 | #include <openssl/dh.h> | 31 | #include <openssl/dh.h> |
@@ -95,9 +95,9 @@ mm_request_send(int sock, enum monitor_reqtype type, Buffer *m) | |||
95 | PUT_32BIT(buf, mlen + 1); | 95 | PUT_32BIT(buf, mlen + 1); |
96 | buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ | 96 | buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ |
97 | if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf)) | 97 | if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf)) |
98 | fatal("%s: write", __func__); | 98 | fatal("%s: write: %s", __func__, strerror(errno)); |
99 | if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen) | 99 | if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen) |
100 | fatal("%s: write", __func__); | 100 | fatal("%s: write: %s", __func__, strerror(errno)); |
101 | } | 101 | } |
102 | 102 | ||
103 | void | 103 | void |
@@ -105,24 +105,21 @@ mm_request_receive(int sock, Buffer *m) | |||
105 | { | 105 | { |
106 | u_char buf[4]; | 106 | u_char buf[4]; |
107 | u_int msg_len; | 107 | u_int msg_len; |
108 | ssize_t res; | ||
109 | 108 | ||
110 | debug3("%s entering", __func__); | 109 | debug3("%s entering", __func__); |
111 | 110 | ||
112 | res = atomicio(read, sock, buf, sizeof(buf)); | 111 | if (atomicio(read, sock, buf, sizeof(buf)) != sizeof(buf)) { |
113 | if (res != sizeof(buf)) { | 112 | if (errno == EPIPE) |
114 | if (res == 0) | ||
115 | cleanup_exit(255); | 113 | cleanup_exit(255); |
116 | fatal("%s: read: %ld", __func__, (long)res); | 114 | fatal("%s: read: %s", __func__, strerror(errno)); |
117 | } | 115 | } |
118 | msg_len = GET_32BIT(buf); | 116 | msg_len = GET_32BIT(buf); |
119 | if (msg_len > 256 * 1024) | 117 | if (msg_len > 256 * 1024) |
120 | fatal("%s: read: bad msg_len %d", __func__, msg_len); | 118 | fatal("%s: read: bad msg_len %d", __func__, msg_len); |
121 | buffer_clear(m); | 119 | buffer_clear(m); |
122 | buffer_append_space(m, msg_len); | 120 | buffer_append_space(m, msg_len); |
123 | res = atomicio(read, sock, buffer_ptr(m), msg_len); | 121 | if (atomicio(read, sock, buffer_ptr(m), msg_len) != msg_len) |
124 | if (res != msg_len) | 122 | fatal("%s: read: %s", __func__, strerror(errno)); |
125 | fatal("%s: read: %ld != msg_len", __func__, (long)res); | ||
126 | } | 123 | } |
127 | 124 | ||
128 | void | 125 | void |
@@ -768,7 +765,8 @@ mm_sshpam_query(void *ctx, char **name, char **info, | |||
768 | u_int *num, char ***prompts, u_int **echo_on) | 765 | u_int *num, char ***prompts, u_int **echo_on) |
769 | { | 766 | { |
770 | Buffer m; | 767 | Buffer m; |
771 | int i, ret; | 768 | u_int i; |
769 | int ret; | ||
772 | 770 | ||
773 | debug3("%s", __func__); | 771 | debug3("%s", __func__); |
774 | buffer_init(&m); | 772 | buffer_init(&m); |
@@ -794,7 +792,8 @@ int | |||
794 | mm_sshpam_respond(void *ctx, u_int num, char **resp) | 792 | mm_sshpam_respond(void *ctx, u_int num, char **resp) |
795 | { | 793 | { |
796 | Buffer m; | 794 | Buffer m; |
797 | int i, ret; | 795 | u_int i; |
796 | int ret; | ||
798 | 797 | ||
799 | debug3("%s", __func__); | 798 | debug3("%s", __func__); |
800 | buffer_init(&m); | 799 | buffer_init(&m); |