summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-03-29 11:31:40 +0000
committerDamien Miller <djm@mindrot.org>2019-04-03 09:34:03 +1100
commit9d7b2882b0c9a5e9bf8312ce4075bf178e2b98be (patch)
tree1095b46b0ed66c8100e4867863b9c85bc34e2e88
parent79a87d32783d6c9db40af8f35e091d9d30365ae7 (diff)
upstream: when logging/fataling on error, include a bit more detail
than just the function name and the error message OpenBSD-Commit-ID: dd72d7eba2215fcb89be516c378f633ea5bcca9f
-rw-r--r--clientloop.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/clientloop.c b/clientloop.c
index 521467bd2..086c0dfe8 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.321 2019/01/19 21:39:12 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.322 2019/03/29 11:31:40 djm 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
@@ -364,7 +364,7 @@ client_x11_get_proto(struct ssh *ssh, const char *display,
364 SSH_X11_PROTO, x11_timeout_real, 364 SSH_X11_PROTO, x11_timeout_real,
365 _PATH_DEVNULL); 365 _PATH_DEVNULL);
366 } 366 }
367 debug2("%s: %s", __func__, cmd); 367 debug2("%s: xauth command: %s", __func__, cmd);
368 368
369 if (timeout != 0 && x11_refuse_time == 0) { 369 if (timeout != 0 && x11_refuse_time == 0) {
370 now = monotime() + 1; 370 now = monotime() + 1;
@@ -492,7 +492,7 @@ server_alive_check(struct ssh *ssh)
492 (r = sshpkt_put_cstring(ssh, "keepalive@openssh.com")) != 0 || 492 (r = sshpkt_put_cstring(ssh, "keepalive@openssh.com")) != 0 ||
493 (r = sshpkt_put_u8(ssh, 1)) != 0 || /* boolean: want reply */ 493 (r = sshpkt_put_u8(ssh, 1)) != 0 || /* boolean: want reply */
494 (r = sshpkt_send(ssh)) != 0) 494 (r = sshpkt_send(ssh)) != 0)
495 fatal("%s: %s", __func__, ssh_err(r)); 495 fatal("%s: send packet: %s", __func__, ssh_err(r));
496 /* Insert an empty placeholder to maintain ordering */ 496 /* Insert an empty placeholder to maintain ordering */
497 client_register_global_confirm(NULL, NULL); 497 client_register_global_confirm(NULL, NULL);
498} 498}
@@ -1035,7 +1035,7 @@ process_escapes(struct ssh *ssh, Channel *c,
1035 channel_request_start(ssh, c->self, "break", 0); 1035 channel_request_start(ssh, c->self, "break", 0);
1036 if ((r = sshpkt_put_u32(ssh, 1000)) != 0 || 1036 if ((r = sshpkt_put_u32(ssh, 1000)) != 0 ||
1037 (r = sshpkt_send(ssh)) != 0) 1037 (r = sshpkt_send(ssh)) != 0)
1038 fatal("%s: %s", __func__, 1038 fatal("%s: send packet: %s", __func__,
1039 ssh_err(r)); 1039 ssh_err(r));
1040 continue; 1040 continue;
1041 1041
@@ -1416,7 +1416,7 @@ client_loop(struct ssh *ssh, int have_pty, int escape_char_arg,
1416 (r = sshpkt_put_cstring(ssh, "")) != 0 || /* language tag */ 1416 (r = sshpkt_put_cstring(ssh, "")) != 0 || /* language tag */
1417 (r = sshpkt_send(ssh)) != 0 || 1417 (r = sshpkt_send(ssh)) != 0 ||
1418 (r = ssh_packet_write_wait(ssh)) != 0) 1418 (r = ssh_packet_write_wait(ssh)) != 0)
1419 fatal("%s: %s", __func__, ssh_err(r)); 1419 fatal("%s: send disconnect: %s", __func__, ssh_err(r));
1420 1420
1421 channel_free_all(ssh); 1421 channel_free_all(ssh);
1422 1422
@@ -1502,7 +1502,7 @@ client_request_forwarded_tcpip(struct ssh *ssh, const char *request_type,
1502 (r = sshpkt_get_cstring(ssh, &originator_address, NULL)) != 0 || 1502 (r = sshpkt_get_cstring(ssh, &originator_address, NULL)) != 0 ||
1503 (r = sshpkt_get_u32(ssh, &originator_port)) != 0 || 1503 (r = sshpkt_get_u32(ssh, &originator_port)) != 0 ||
1504 (r = sshpkt_get_end(ssh)) != 0) 1504 (r = sshpkt_get_end(ssh)) != 0)
1505 fatal("%s: %s", __func__, ssh_err(r)); 1505 fatal("%s: parse packet: %s", __func__, ssh_err(r));
1506 1506
1507 debug("%s: listen %s port %d, originator %s port %d", __func__, 1507 debug("%s: listen %s port %d, originator %s port %d", __func__,
1508 listen_address, listen_port, originator_address, originator_port); 1508 listen_address, listen_port, originator_address, originator_port);
@@ -1559,9 +1559,9 @@ client_request_forwarded_streamlocal(struct ssh *ssh,
1559 if ((r = sshpkt_get_cstring(ssh, &listen_path, NULL)) != 0 || 1559 if ((r = sshpkt_get_cstring(ssh, &listen_path, NULL)) != 0 ||
1560 (r = sshpkt_get_string(ssh, NULL, NULL)) != 0 || /* reserved */ 1560 (r = sshpkt_get_string(ssh, NULL, NULL)) != 0 || /* reserved */
1561 (r = sshpkt_get_end(ssh)) != 0) 1561 (r = sshpkt_get_end(ssh)) != 0)
1562 fatal("%s: %s", __func__, ssh_err(r)); 1562 fatal("%s: parse packet: %s", __func__, ssh_err(r));
1563 1563
1564 debug("%s: %s", __func__, listen_path); 1564 debug("%s: request: %s", __func__, listen_path);
1565 1565
1566 c = channel_connect_by_listen_path(ssh, listen_path, 1566 c = channel_connect_by_listen_path(ssh, listen_path,
1567 "forwarded-streamlocal@openssh.com", "forwarded-streamlocal"); 1567 "forwarded-streamlocal@openssh.com", "forwarded-streamlocal");
@@ -1591,7 +1591,7 @@ client_request_x11(struct ssh *ssh, const char *request_type, int rchan)
1591 if ((r = sshpkt_get_cstring(ssh, &originator, NULL)) != 0 || 1591 if ((r = sshpkt_get_cstring(ssh, &originator, NULL)) != 0 ||
1592 (r = sshpkt_get_u32(ssh, &originator_port)) != 0 || 1592 (r = sshpkt_get_u32(ssh, &originator_port)) != 0 ||
1593 (r = sshpkt_get_end(ssh)) != 0) 1593 (r = sshpkt_get_end(ssh)) != 0)
1594 fatal("%s: %s", __func__, ssh_err(r)); 1594 fatal("%s: parse packet: %s", __func__, ssh_err(r));
1595 /* XXX check permission */ 1595 /* XXX check permission */
1596 /* XXX range check originator port? */ 1596 /* XXX range check originator port? */
1597 debug("client_request_x11: request from %s %u", originator, 1597 debug("client_request_x11: request from %s %u", originator,
@@ -2260,12 +2260,12 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
2260 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_row)) != 0 || 2260 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_row)) != 0 ||
2261 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_xpixel)) != 0 || 2261 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_xpixel)) != 0 ||
2262 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_ypixel)) != 0) 2262 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_ypixel)) != 0)
2263 fatal("%s: %s", __func__, ssh_err(r)); 2263 fatal("%s: build packet: %s", __func__, ssh_err(r));
2264 if (tiop == NULL) 2264 if (tiop == NULL)
2265 tiop = get_saved_tio(); 2265 tiop = get_saved_tio();
2266 ssh_tty_make_modes(ssh, -1, tiop); 2266 ssh_tty_make_modes(ssh, -1, tiop);
2267 if ((r = sshpkt_send(ssh)) != 0) 2267 if ((r = sshpkt_send(ssh)) != 0)
2268 fatal("%s: %s", __func__, ssh_err(r)); 2268 fatal("%s: send packet: %s", __func__, ssh_err(r));
2269 /* XXX wait for reply */ 2269 /* XXX wait for reply */
2270 c->client_tty = 1; 2270 c->client_tty = 1;
2271 } 2271 }
@@ -2299,8 +2299,10 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
2299 channel_request_start(ssh, id, "env", 0); 2299 channel_request_start(ssh, id, "env", 0);
2300 if ((r = sshpkt_put_cstring(ssh, name)) != 0 || 2300 if ((r = sshpkt_put_cstring(ssh, name)) != 0 ||
2301 (r = sshpkt_put_cstring(ssh, val)) != 0 || 2301 (r = sshpkt_put_cstring(ssh, val)) != 0 ||
2302 (r = sshpkt_send(ssh)) != 0) 2302 (r = sshpkt_send(ssh)) != 0) {
2303 fatal("%s: %s", __func__, ssh_err(r)); 2303 fatal("%s: send packet: %s",
2304 __func__, ssh_err(r));
2305 }
2304 free(name); 2306 free(name);
2305 } 2307 }
2306 } 2308 }
@@ -2318,7 +2320,7 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
2318 if ((r = sshpkt_put_cstring(ssh, name)) != 0 || 2320 if ((r = sshpkt_put_cstring(ssh, name)) != 0 ||
2319 (r = sshpkt_put_cstring(ssh, val)) != 0 || 2321 (r = sshpkt_put_cstring(ssh, val)) != 0 ||
2320 (r = sshpkt_send(ssh)) != 0) 2322 (r = sshpkt_send(ssh)) != 0)
2321 fatal("%s: %s", __func__, ssh_err(r)); 2323 fatal("%s: send packet: %s", __func__, ssh_err(r));
2322 free(name); 2324 free(name);
2323 } 2325 }
2324 2326
@@ -2340,12 +2342,14 @@ client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem,
2340 } 2342 }
2341 if ((r = sshpkt_put_stringb(ssh, cmd)) != 0 || 2343 if ((r = sshpkt_put_stringb(ssh, cmd)) != 0 ||
2342 (r = sshpkt_send(ssh)) != 0) 2344 (r = sshpkt_send(ssh)) != 0)
2343 fatal("%s: %s", __func__, ssh_err(r)); 2345 fatal("%s: send command: %s", __func__, ssh_err(r));
2344 } else { 2346 } else {
2345 channel_request_start(ssh, id, "shell", 1); 2347 channel_request_start(ssh, id, "shell", 1);
2346 client_expect_confirm(ssh, id, "shell", CONFIRM_CLOSE); 2348 client_expect_confirm(ssh, id, "shell", CONFIRM_CLOSE);
2347 if ((r = sshpkt_send(ssh)) != 0) 2349 if ((r = sshpkt_send(ssh)) != 0) {
2348 fatal("%s: %s", __func__, ssh_err(r)); 2350 fatal("%s: send shell request: %s",
2351 __func__, ssh_err(r));
2352 }
2349 } 2353 }
2350} 2354}
2351 2355