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
This commit is contained in:
dtucker@openbsd.org 2017-12-10 05:55:29 +00:00 committed by Damien Miller
parent aabd75ec76
commit 48c23a39a8
3 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: packet.c,v 1.267 2017/11/25 06:46:22 dtucker Exp $ */ /* $OpenBSD: packet.c,v 1.268 2017/12/10 05:55:29 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * 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,...)
fatal("%s: %s", __func__, ssh_err(r)); fatal("%s: %s", __func__, ssh_err(r));
} }
static void void
fmt_connection_id(struct ssh *ssh, char *s, size_t l) sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l)
{ {
snprintf(s, l, "%.200s%s%s port %d", snprintf(s, l, "%.200s%s%s port %d",
ssh->log_preamble ? ssh->log_preamble : "", ssh->log_preamble ? ssh->log_preamble : "",
@ -1814,7 +1814,7 @@ sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
{ {
char remote_id[512]; char remote_id[512];
fmt_connection_id(ssh, remote_id, sizeof(remote_id)); sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
switch (r) { switch (r) {
case SSH_ERR_CONN_CLOSED: case SSH_ERR_CONN_CLOSED:
@ -1876,7 +1876,7 @@ ssh_packet_disconnect(struct ssh *ssh, const char *fmt,...)
* Format the message. Note that the caller must make sure the * Format the message. Note that the caller must make sure the
* message is of limited size. * message is of limited size.
*/ */
fmt_connection_id(ssh, remote_id, sizeof(remote_id)); sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: packet.h,v 1.83 2017/10/25 00:17:08 djm Exp $ */ /* $OpenBSD: packet.h,v 1.84 2017/12/10 05:55:29 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -202,6 +202,7 @@ int sshpkt_get_cstring(struct ssh *ssh, char **valp, size_t *lenp);
int sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g); int sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g);
int sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v); int sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v);
int sshpkt_get_end(struct ssh *ssh); int sshpkt_get_end(struct ssh *ssh);
void sshpkt_fmt_connection_id(struct ssh *ssh, char *s, size_t l);
const u_char *sshpkt_ptr(struct ssh *, size_t *lenp); const u_char *sshpkt_ptr(struct ssh *, size_t *lenp);
/* OLD API */ /* OLD API */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: serverloop.c,v 1.199 2017/10/23 05:08:00 djm Exp $ */ /* $OpenBSD: serverloop.c,v 1.200 2017/12/10 05:55:29 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -171,10 +171,12 @@ static void
client_alive_check(struct ssh *ssh) client_alive_check(struct ssh *ssh)
{ {
int channel_id; int channel_id;
char remote_id[512];
/* timeout, check to see how many we have had */ /* timeout, check to see how many we have had */
if (packet_inc_alive_timeouts() > options.client_alive_count_max) { if (packet_inc_alive_timeouts() > options.client_alive_count_max) {
logit("Timeout, client not responding."); sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
logit("Timeout, client not responding from %s", remote_id);
cleanup_exit(255); cleanup_exit(255);
} }