diff options
author | djm@openbsd.org <djm@openbsd.org> | 2015-01-28 21:15:47 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-01-29 09:08:07 +1100 |
commit | fae7bbe544cba7a9e5e4ab47ff6faa3d978646eb (patch) | |
tree | a27a07031b600a1925a128bc0f5258a4b3ab2e8c /opacket.c | |
parent | 1a3d14f6b44a494037c7deab485abe6496bf2c60 (diff) | |
download | openssh-git-fae7bbe544cba7a9e5e4ab47ff6faa3d978646eb.tar.gz |
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.c | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -255,8 +255,20 @@ packet_read_seqnr(u_int32_t *seqnr) u_char type; int r; - if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr))) - fatal("%s: %s", __func__, ssh_err(r)); + if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr)) != 0) { + switch (r) { + case SSH_ERR_CONN_CLOSED: + logit("Connection closed by %.200s", + ssh_remote_ipaddr(active_state)); + cleanup_exit(255); + case SSH_ERR_CONN_TIMEOUT: + logit("Connection to %.200s timed out while " + "waiting to read", ssh_remote_ipaddr(active_state)); + cleanup_exit(255); + default: + fatal("%s: %s", __func__, ssh_err(r)); + } + } return type; } @@ -277,3 +289,12 @@ packet_close(void) ssh_packet_close(active_state); active_state = NULL; } + +void +packet_process_incoming(const char *buf, u_int len) +{ + int r; + + if ((r = ssh_packet_process_incoming(active_state, buf, len)) != 0) + fatal("%s: %s", __func__, ssh_err(r)); +} |