diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-08-18 09:13:27 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-08-18 09:13:27 +0000 |
commit | f3844d4b1ca1b63f603efbe4be5265dc8e340603 (patch) | |
tree | e8bb91defdee7806b309b345339f22aa72bec9fb /usr.bin | |
parent | 8524fe5ab3680d0c5e67654b5c0ba7666b428c86 (diff) |
make signal handler termination path shorter; risky code pointed out by
mark dowd; ok djm markus
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/log.c | 14 | ||||
-rw-r--r-- | usr.bin/ssh/log.h | 3 | ||||
-rw-r--r-- | usr.bin/ssh/sshd.c | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/usr.bin/ssh/log.c b/usr.bin/ssh/log.c index 7f0988da3f5..653875ddc25 100644 --- a/usr.bin/ssh/log.c +++ b/usr.bin/ssh/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.38 2006/08/03 03:34:42 deraadt Exp $ */ +/* $OpenBSD: log.c,v 1.39 2006/08/18 09:13:25 deraadt Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -127,6 +127,18 @@ error(const char *fmt,...) va_end(args); } +void +sigdie(const char *fmt,...) +{ + va_list args; + + va_start(args, fmt); + do_log(SYSLOG_LEVEL_FATAL, fmt, args); + va_end(args); + _exit(1); +} + + /* Log this message (information that usually should go to the log). */ void diff --git a/usr.bin/ssh/log.h b/usr.bin/ssh/log.h index c72da8ece85..f9491d1793c 100644 --- a/usr.bin/ssh/log.h +++ b/usr.bin/ssh/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.14 2006/08/03 03:34:42 deraadt Exp $ */ +/* $OpenBSD: log.h,v 1.15 2006/08/18 09:13:25 deraadt Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -50,6 +50,7 @@ LogLevel log_level_number(char *); void fatal(const char *, ...) __dead __attribute__((format(printf, 1, 2))); void error(const char *, ...) __attribute__((format(printf, 1, 2))); +void sigdie(const char *, ...) __attribute__((format(printf, 1, 2))); void logit(const char *, ...) __attribute__((format(printf, 1, 2))); void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); void debug(const char *, ...) __attribute__((format(printf, 1, 2))); diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index a8aa13ea582..043b502381e 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshd.c,v 1.345 2006/08/16 11:47:15 djm Exp $ */ +/* $OpenBSD: sshd.c,v 1.346 2006/08/18 09:13:26 deraadt Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -331,13 +331,11 @@ main_sigchld_handler(int sig) static void grace_alarm_handler(int sig) { - /* XXX no idea how fix this signal handler */ - if (use_privsep && pmonitor != NULL && pmonitor->m_pid > 0) kill(pmonitor->m_pid, SIGALRM); /* Log error and exit. */ - fatal("Timeout before authentication for %s", get_remote_ipaddr()); + sigdie("Timeout before authentication for %s", get_remote_ipaddr()); } /* |