Bugzilla – Attachment 3359 Details for
Bug 3129
Add IP address to error kex_exchange_identification error message
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add peer info to kex_exchange_identification error messages
ssh-kex-log.patch (text/plain), 2.99 KB, created by
Darren Tucker
on 2020-03-04 00:38:27 AEDT
(
hide
)
Description:
Add peer info to kex_exchange_identification error messages
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2020-03-04 00:38:27 AEDT
Size:
2.99 KB
patch
obsolete
>diff --git a/kex.c b/kex.c >index 899036e6..92b62628 100644 >--- a/kex.c >+++ b/kex.c >@@ -1177,6 +1177,9 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, > ssh->kex->client_version : ssh->kex->server_version; > char *our_version_string = NULL, *peer_version_string = NULL; > char *cp, *remote_version = NULL; >+ char remote_id[512]; >+ >+ sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id)); > > /* Prepare and send our banner */ > sshbuf_reset(our_version); >@@ -1215,7 +1218,8 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, > send_error(ssh, "No SSH identification string " > "received."); > error("%s: No SSH version received in first %u lines " >- "from server", __func__, SSH_MAX_PRE_BANNER_LINES); >+ "from server %s", __func__, >+ SSH_MAX_PRE_BANNER_LINES, remote_id); > r = SSH_ERR_INVALID_FORMAT; > goto out; > } >@@ -1229,12 +1233,13 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, > send_error(ssh, "Timed out waiting " > "for SSH identification string."); > error("Connection timed out during " >- "banner exchange"); >+ "banner exchange with peer %s", >+ remote_id); > r = SSH_ERR_CONN_TIMEOUT; > goto out; > } else if (r == -1) { >- error("%s: %s", >- __func__, strerror(errno)); >+ error("%s: %s with peer %s", __func__, >+ strerror(errno), remote_id); > r = SSH_ERR_SYSTEM_ERROR; > goto out; > } >@@ -1243,13 +1248,13 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, > len = atomicio(read, ssh_packet_get_connection_in(ssh), > &c, 1); > if (len != 1 && errno == EPIPE) { >- error("%s: Connection closed by remote host", >- __func__); >+ error("%s: Connection closed by remote host %s", >+ __func__, remote_id); > r = SSH_ERR_CONN_CLOSED; > goto out; > } else if (len != 1) { >- error("%s: read: %.100s", >- __func__, strerror(errno)); >+ error("%s: peer %s read: %.100s", >+ __func__, remote_id, strerror(errno)); > r = SSH_ERR_SYSTEM_ERROR; > goto out; > } >@@ -1310,8 +1315,8 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, > */ > if (sscanf(peer_version_string, "SSH-%d.%d-%[^\n]\n", > &remote_major, &remote_minor, remote_version) != 3) { >- error("Bad remote protocol version identification: '%.100s'", >- peer_version_string); >+ error("Bad remote protocol version identification from peer " >+ "%s: '%.100s'", remote_id, peer_version_string); > invalid: > send_error(ssh, "Invalid SSH identification string."); > r = SSH_ERR_INVALID_FORMAT; >@@ -1334,8 +1339,8 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, > break; > } > if (mismatch) { >- error("Protocol major versions differ: %d vs. %d", >- PROTOCOL_MAJOR_2, remote_major); >+ error("Protocol major versions differ with peer %s: %d vs. %d", >+ remote_id, PROTOCOL_MAJOR_2, remote_major); > send_error(ssh, "Protocol major versions differ."); > r = SSH_ERR_NO_PROTOCOL_VERSION; > goto out;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3129
: 3359 |
3365