summaryrefslogtreecommitdiff
path: root/opacket.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-01-28 21:15:47 +0000
committerDamien Miller <djm@mindrot.org>2015-01-29 09:08:07 +1100
commitfae7bbe544cba7a9e5e4ab47ff6faa3d978646eb (patch)
treea27a07031b600a1925a128bc0f5258a4b3ab2e8c /opacket.c
parent1a3d14f6b44a494037c7deab485abe6496bf2c60 (diff)
upstream commit
avoid fatal() calls in packet code makes ssh-keyscan more reliable against server failures ok dtucker@ markus@
Diffstat (limited to 'opacket.c')
-rw-r--r--opacket.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/opacket.c b/opacket.c
index 63b419d5c..a137b5a8a 100644
--- a/opacket.c
+++ b/opacket.c
@@ -255,8 +255,20 @@ packet_read_seqnr(u_int32_t *seqnr)
255 u_char type; 255 u_char type;
256 int r; 256 int r;
257 257
258 if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr))) 258 if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr)) != 0) {
259 fatal("%s: %s", __func__, ssh_err(r)); 259 switch (r) {
260 case SSH_ERR_CONN_CLOSED:
261 logit("Connection closed by %.200s",
262 ssh_remote_ipaddr(active_state));
263 cleanup_exit(255);
264 case SSH_ERR_CONN_TIMEOUT:
265 logit("Connection to %.200s timed out while "
266 "waiting to read", ssh_remote_ipaddr(active_state));
267 cleanup_exit(255);
268 default:
269 fatal("%s: %s", __func__, ssh_err(r));
270 }
271 }
260 return type; 272 return type;
261} 273}
262 274
@@ -277,3 +289,12 @@ packet_close(void)
277 ssh_packet_close(active_state); 289 ssh_packet_close(active_state);
278 active_state = NULL; 290 active_state = NULL;
279} 291}
292
293void
294packet_process_incoming(const char *buf, u_int len)
295{
296 int r;
297
298 if ((r = ssh_packet_process_incoming(active_state, buf, len)) != 0)
299 fatal("%s: %s", __func__, ssh_err(r));
300}