summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--log.c12
-rw-r--r--log.h4
-rw-r--r--packet.c21
3 files changed, 22 insertions, 15 deletions
diff --git a/log.c b/log.c
index 277afda88..2b59c4274 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: log.c,v 1.47 2016/04/29 08:07:53 djm Exp $ */ 1/* $OpenBSD: log.c,v 1.48 2016/07/15 05:01:58 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
@@ -176,6 +176,16 @@ sigdie(const char *fmt,...)
176 _exit(1); 176 _exit(1);
177} 177}
178 178
179void
180logdie(const char *fmt,...)
181{
182 va_list args;
183
184 va_start(args, fmt);
185 do_log(SYSLOG_LEVEL_INFO, fmt, args);
186 va_end(args);
187 cleanup_exit(255);
188}
179 189
180/* Log this message (information that usually should go to the log). */ 190/* Log this message (information that usually should go to the log). */
181 191
diff --git a/log.h b/log.h
index ae7df25d3..434b7c81a 100644
--- a/log.h
+++ b/log.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: log.h,v 1.20 2013/04/07 02:10:33 dtucker Exp $ */ 1/* $OpenBSD: log.h,v 1.21 2016/07/15 05:01:58 dtucker Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -63,6 +63,8 @@ void fatal(const char *, ...) __attribute__((noreturn))
63void error(const char *, ...) __attribute__((format(printf, 1, 2))); 63void error(const char *, ...) __attribute__((format(printf, 1, 2)));
64void sigdie(const char *, ...) __attribute__((noreturn)) 64void sigdie(const char *, ...) __attribute__((noreturn))
65 __attribute__((format(printf, 1, 2))); 65 __attribute__((format(printf, 1, 2)));
66void logdie(const char *, ...) __attribute__((noreturn))
67 __attribute__((format(printf, 1, 2)));
66void logit(const char *, ...) __attribute__((format(printf, 1, 2))); 68void logit(const char *, ...) __attribute__((format(printf, 1, 2)));
67void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); 69void verbose(const char *, ...) __attribute__((format(printf, 1, 2)));
68void debug(const char *, ...) __attribute__((format(printf, 1, 2))); 70void debug(const char *, ...) __attribute__((format(printf, 1, 2)));
diff --git a/packet.c b/packet.c
index 9839c94dd..3810f1128 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.231 2016/07/08 03:44:42 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.232 2016/07/15 05:01:58 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
@@ -2073,24 +2073,19 @@ sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
2073{ 2073{
2074 switch (r) { 2074 switch (r) {
2075 case SSH_ERR_CONN_CLOSED: 2075 case SSH_ERR_CONN_CLOSED:
2076 logit("Connection closed by %.200s port %d", 2076 logdie("Connection closed by %.200s port %d",
2077 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); 2077 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
2078 cleanup_exit(255);
2079 case SSH_ERR_CONN_TIMEOUT: 2078 case SSH_ERR_CONN_TIMEOUT:
2080 logit("Connection %s %.200s port %d timed out", 2079 logdie("Connection %s %.200s port %d timed out",
2081 ssh->state->server_side ? "from" : "to", 2080 ssh->state->server_side ? "from" : "to",
2082 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); 2081 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
2083 cleanup_exit(255);
2084 case SSH_ERR_DISCONNECTED: 2082 case SSH_ERR_DISCONNECTED:
2085 logit("Disconnected from %.200s port %d", 2083 logdie("Disconnected from %.200s port %d",
2086 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); 2084 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
2087 cleanup_exit(255);
2088 case SSH_ERR_SYSTEM_ERROR: 2085 case SSH_ERR_SYSTEM_ERROR:
2089 if (errno == ECONNRESET) { 2086 if (errno == ECONNRESET)
2090 logit("Connection reset by %.200s port %d", 2087 logdie("Connection reset by %.200s port %d",
2091 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); 2088 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
2092 cleanup_exit(255);
2093 }
2094 /* FALLTHROUGH */ 2089 /* FALLTHROUGH */
2095 case SSH_ERR_NO_CIPHER_ALG_MATCH: 2090 case SSH_ERR_NO_CIPHER_ALG_MATCH:
2096 case SSH_ERR_NO_MAC_ALG_MATCH: 2091 case SSH_ERR_NO_MAC_ALG_MATCH:
@@ -2098,14 +2093,14 @@ sshpkt_fatal(struct ssh *ssh, const char *tag, int r)
2098 case SSH_ERR_NO_KEX_ALG_MATCH: 2093 case SSH_ERR_NO_KEX_ALG_MATCH:
2099 case SSH_ERR_NO_HOSTKEY_ALG_MATCH: 2094 case SSH_ERR_NO_HOSTKEY_ALG_MATCH:
2100 if (ssh && ssh->kex && ssh->kex->failed_choice) { 2095 if (ssh && ssh->kex && ssh->kex->failed_choice) {
2101 fatal("Unable to negotiate with %.200s port %d: %s. " 2096 logdie("Unable to negotiate with %.200s port %d: %s. "
2102 "Their offer: %s", ssh_remote_ipaddr(ssh), 2097 "Their offer: %s", ssh_remote_ipaddr(ssh),
2103 ssh_remote_port(ssh), ssh_err(r), 2098 ssh_remote_port(ssh), ssh_err(r),
2104 ssh->kex->failed_choice); 2099 ssh->kex->failed_choice);
2105 } 2100 }
2106 /* FALLTHROUGH */ 2101 /* FALLTHROUGH */
2107 default: 2102 default:
2108 fatal("%s%sConnection %s %.200s port %d: %s", 2103 logdie("%s%sConnection %s %.200s port %d: %s",
2109 tag != NULL ? tag : "", tag != NULL ? ": " : "", 2104 tag != NULL ? tag : "", tag != NULL ? ": " : "",
2110 ssh->state->server_side ? "from" : "to", 2105 ssh->state->server_side ? "from" : "to",
2111 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), ssh_err(r)); 2106 ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), ssh_err(r));