summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2017-12-10 05:55:29 +0000
committerDamien Miller <djm@mindrot.org>2017-12-12 10:32:04 +1100
commit48c23a39a8f1069a57264dd826f6c90aa12778d5 (patch)
tree5c2c1bbd5f66c821f7f62b65a53e0d2a9c325fd3
parentaabd75ec76575c1b17232e6526a644097cd798e5 (diff)
upstream commit
Put remote client info back into the ClientAlive connection termination message. Based in part on diff from lars.nooden at gmail, ok djm OpenBSD-Commit-ID: 80a0f619a29bbf2f32eb5297a69978a0e05d0ee0
-rw-r--r--packet.c10
-rw-r--r--packet.h3
-rw-r--r--serverloop.c6
3 files changed, 11 insertions, 8 deletions
diff --git a/packet.c b/packet.c
index 832019492..3c1c23d3a 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.267 2017/11/25 06:46:22 dtucker Exp $ */ 1/* $OpenBSD: packet.c,v 1.268 2017/12/10 05:55:29 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1797,8 +1797,8 @@ ssh_packet_send_debug(struct ssh *ssh, const char *fmt,...)
1797 fatal("%s: %s", __func__, ssh_err(r)); 1797 fatal("%s: %s", __func__, ssh_err(r));
1798} 1798}
1799 1799
1800static void 1800void
1801fmt_connection_id(struct ssh *ssh, char *s, size_t l) 1801sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l)
1802{ 1802{
1803 snprintf(s, l, "%.200s%s%s port %d", 1803 snprintf(s, l, "%.200s%s%s port %d",
1804 ssh->log_preamble ? ssh->log_preamble : "", 1804 ssh->log_preamble ? ssh->log_preamble : "",
@@ -1814,7 +1814,7 @@ sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
1814{ 1814{
1815 char remote_id[512]; 1815 char remote_id[512];
1816 1816
1817 fmt_connection_id(ssh, remote_id, sizeof(remote_id)); 1817 sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
1818 1818
1819 switch (r) { 1819 switch (r) {
1820 case SSH_ERR_CONN_CLOSED: 1820 case SSH_ERR_CONN_CLOSED:
@@ -1876,7 +1876,7 @@ ssh_packet_disconnect(struct ssh *ssh, const char *fmt,...)
1876 * Format the message. Note that the caller must make sure the 1876 * Format the message. Note that the caller must make sure the
1877 * message is of limited size. 1877 * message is of limited size.
1878 */ 1878 */
1879 fmt_connection_id(ssh, remote_id, sizeof(remote_id)); 1879 sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
1880 va_start(args, fmt); 1880 va_start(args, fmt);
1881 vsnprintf(buf, sizeof(buf), fmt, args); 1881 vsnprintf(buf, sizeof(buf), fmt, args);
1882 va_end(args); 1882 va_end(args);
diff --git a/packet.h b/packet.h
index 55f07fc90..a2ece6786 100644
--- a/packet.h
+++ b/packet.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.h,v 1.83 2017/10/25 00:17:08 djm Exp $ */ 1/* $OpenBSD: packet.h,v 1.84 2017/12/10 05:55:29 dtucker Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -202,6 +202,7 @@ int sshpkt_get_cstring(struct ssh *ssh, char **valp, size_t *lenp);
202int sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g); 202int sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g);
203int sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v); 203int sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v);
204int sshpkt_get_end(struct ssh *ssh); 204int sshpkt_get_end(struct ssh *ssh);
205void sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l);
205const u_char *sshpkt_ptr(struct ssh *, size_t *lenp); 206const u_char *sshpkt_ptr(struct ssh *, size_t *lenp);
206 207
207/* OLD API */ 208/* OLD API */
diff --git a/serverloop.c b/serverloop.c
index a3cb8e782..464c07d2f 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: serverloop.c,v 1.199 2017/10/23 05:08:00 djm Exp $ */ 1/* $OpenBSD: serverloop.c,v 1.200 2017/12/10 05:55:29 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -171,10 +171,12 @@ static void
171client_alive_check(struct ssh *ssh) 171client_alive_check(struct ssh *ssh)
172{ 172{
173 int channel_id; 173 int channel_id;
174 char remote_id[512];
174 175
175 /* timeout, check to see how many we have had */ 176 /* timeout, check to see how many we have had */
176 if (packet_inc_alive_timeouts() > options.client_alive_count_max) { 177 if (packet_inc_alive_timeouts() > options.client_alive_count_max) {
177 logit("Timeout, client not responding."); 178 sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
179 logit("Timeout, client not responding from %s", remote_id);
178 cleanup_exit(255); 180 cleanup_exit(255);
179 } 181 }
180 182