summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--clientloop.c26
-rw-r--r--sshtty.c12
-rw-r--r--sshtty.h3
4 files changed, 23 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 472cd7c41..fd8abf04b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,9 @@
68 [scp.c] 68 [scp.c]
69 error handling for remote-remote copy; #638; report Harald Koenig; 69 error handling for remote-remote copy; #638; report Harald Koenig;
70 ok millert, fgs, henning, deraadt 70 ok millert, fgs, henning, deraadt
71 - markus@cvs.openbsd.org 2003/09/19 17:43:35
72 [clientloop.c sshtty.c sshtty.h]
73 remove fatal callbacks from client code; ok deraadt
71 74
7220030919 7520030919
73 - (djm) Bug #683: Remove reference to --with-ipv4-default from INSTALL; 76 - (djm) Bug #683: Remove reference to --with-ipv4-default from INSTALL;
@@ -1204,4 +1207,4 @@
1204 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 1207 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
1205 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 1208 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
1206 1209
1207$Id: ChangeLog,v 1.3035 2003/09/22 11:14:55 dtucker Exp $ 1210$Id: ChangeLog,v 1.3036 2003/09/22 11:16:05 dtucker Exp $
diff --git a/clientloop.c b/clientloop.c
index d8def78bd..bc50f0bca 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.112 2003/06/28 16:23:06 deraadt Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.113 2003/09/19 17:43:35 markus Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -139,7 +139,6 @@ leave_non_blocking(void)
139 if (in_non_blocking_mode) { 139 if (in_non_blocking_mode) {
140 (void) fcntl(fileno(stdin), F_SETFL, 0); 140 (void) fcntl(fileno(stdin), F_SETFL, 0);
141 in_non_blocking_mode = 0; 141 in_non_blocking_mode = 0;
142 fatal_remove_cleanup((void (*) (void *)) leave_non_blocking, NULL);
143 } 142 }
144} 143}
145 144
@@ -150,7 +149,6 @@ enter_non_blocking(void)
150{ 149{
151 in_non_blocking_mode = 1; 150 in_non_blocking_mode = 1;
152 (void) fcntl(fileno(stdin), F_SETFL, O_NONBLOCK); 151 (void) fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
153 fatal_add_cleanup((void (*) (void *)) leave_non_blocking, NULL);
154} 152}
155 153
156/* 154/*
@@ -844,8 +842,7 @@ client_channel_closed(int id, void *arg)
844 id, session_ident); 842 id, session_ident);
845 channel_cancel_cleanup(id); 843 channel_cancel_cleanup(id);
846 session_closed = 1; 844 session_closed = 1;
847 if (in_raw_mode()) 845 leave_raw_mode();
848 leave_raw_mode();
849} 846}
850 847
851/* 848/*
@@ -1034,11 +1031,8 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1034 if (!isatty(fileno(stderr))) 1031 if (!isatty(fileno(stderr)))
1035 unset_nonblock(fileno(stderr)); 1032 unset_nonblock(fileno(stderr));
1036 1033
1037 if (received_signal) { 1034 if (received_signal)
1038 if (in_non_blocking_mode) /* XXX */
1039 leave_non_blocking();
1040 fatal("Killed by signal %d.", (int) received_signal); 1035 fatal("Killed by signal %d.", (int) received_signal);
1041 }
1042 1036
1043 /* 1037 /*
1044 * In interactive mode (with pseudo tty) display a message indicating 1038 * In interactive mode (with pseudo tty) display a message indicating
@@ -1387,3 +1381,17 @@ client_init_dispatch(void)
1387 else 1381 else
1388 client_init_dispatch_15(); 1382 client_init_dispatch_15();
1389} 1383}
1384
1385/* client specific fatal cleanup */
1386void
1387fatal(const char *fmt,...)
1388{
1389 va_list args;
1390
1391 va_start(args, fmt);
1392 do_log(SYSLOG_LEVEL_FATAL, fmt, args);
1393 va_end(args);
1394 leave_raw_mode();
1395 leave_non_blocking();
1396 _exit(255);
1397}
diff --git a/sshtty.c b/sshtty.c
index 2f47b06d1..4fb2d3dae 100644
--- a/sshtty.c
+++ b/sshtty.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: sshtty.c,v 1.4 2003/07/16 10:36:28 markus Exp $"); 38RCSID("$OpenBSD: sshtty.c,v 1.5 2003/09/19 17:43:35 markus Exp $");
39 39
40#include "sshtty.h" 40#include "sshtty.h"
41#include "log.h" 41#include "log.h"
@@ -43,12 +43,6 @@ RCSID("$OpenBSD: sshtty.c,v 1.4 2003/07/16 10:36:28 markus Exp $");
43static struct termios _saved_tio; 43static struct termios _saved_tio;
44static int _in_raw_mode = 0; 44static int _in_raw_mode = 0;
45 45
46int
47in_raw_mode(void)
48{
49 return _in_raw_mode;
50}
51
52struct termios 46struct termios
53get_saved_tio(void) 47get_saved_tio(void)
54{ 48{
@@ -64,8 +58,6 @@ leave_raw_mode(void)
64 perror("tcsetattr"); 58 perror("tcsetattr");
65 else 59 else
66 _in_raw_mode = 0; 60 _in_raw_mode = 0;
67
68 fatal_remove_cleanup((void (*) (void *)) leave_raw_mode, NULL);
69} 61}
70 62
71void 63void
@@ -94,6 +86,4 @@ enter_raw_mode(void)
94 perror("tcsetattr"); 86 perror("tcsetattr");
95 else 87 else
96 _in_raw_mode = 1; 88 _in_raw_mode = 1;
97
98 fatal_add_cleanup((void (*) (void *)) leave_raw_mode, NULL);
99} 89}
diff --git a/sshtty.h b/sshtty.h
index 7ba4a2627..723b27846 100644
--- a/sshtty.h
+++ b/sshtty.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshtty.h,v 1.2 2001/06/26 17:27:25 markus Exp $ */ 1/* $OpenBSD: sshtty.h,v 1.3 2003/09/19 17:43:35 markus 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
@@ -40,7 +40,6 @@
40 40
41#include <termios.h> 41#include <termios.h>
42 42
43int in_raw_mode(void);
44struct termios get_saved_tio(void); 43struct termios get_saved_tio(void);
45void leave_raw_mode(void); 44void leave_raw_mode(void);
46void enter_raw_mode(void); 45void enter_raw_mode(void);