diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | log.c | 17 | ||||
-rw-r--r-- | log.h | 4 | ||||
-rw-r--r-- | ssh-keyscan.c | 19 |
4 files changed, 21 insertions, 24 deletions
@@ -20,6 +20,9 @@ [auth-krb5.c] krb5_get_err_text() does not like context==NULL; he@nordu.net via google; ok provos@ + - markus@cvs.openbsd.org 2002/02/22 12:20:34 + [log.c log.h ssh-keyscan.c] + overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@ 20020225 - (bal) Last AIX patch. Moved aix_usrinfo() outside of do_setuserconext() @@ -7693,4 +7696,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1878 2002/02/26 17:49:55 mouring Exp $ +$Id: ChangeLog,v 1.1879 2002/02/26 17:52:14 mouring Exp $ @@ -34,7 +34,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: log.c,v 1.21 2002/02/04 12:15:25 markus Exp $"); +RCSID("$OpenBSD: log.c,v 1.22 2002/02/22 12:20:34 markus Exp $"); #include "log.h" #include "xmalloc.h" @@ -88,8 +88,6 @@ static struct { { NULL, SYSLOG_LEVEL_NOT_SET } }; -static void do_log(LogLevel level, const char *fmt, va_list args); - SyslogFacility log_facility_number(char *name) { @@ -111,17 +109,6 @@ log_level_number(char *name) return log_levels[i].val; return SYSLOG_LEVEL_NOT_SET; } -/* Fatal messages. This function never returns. */ - -void -fatal(const char *fmt,...) -{ - va_list args; - va_start(args, fmt); - do_log(SYSLOG_LEVEL_FATAL, fmt, args); - va_end(args); - fatal_cleanup(); -} /* Error messages that should be logged. */ @@ -328,7 +315,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) #define MSGBUFSIZ 1024 -static void +void do_log(LogLevel level, const char *fmt, va_list args) { char msgbuf[MSGBUFSIZ]; @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.5 2002/02/04 12:15:25 markus Exp $ */ +/* $OpenBSD: log.h,v 1.6 2002/02/22 12:20:34 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -65,4 +65,6 @@ void fatal_cleanup(void); void fatal_add_cleanup(void (*) (void *), void *); void fatal_remove_cleanup(void (*) (void *), void *); +void do_log(LogLevel, const char *, va_list); + #endif diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 80eab2692..88f10ebec 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-keyscan.c,v 1.33 2001/12/10 20:34:31 markus Exp $"); +RCSID("$OpenBSD: ssh-keyscan.c,v 1.34 2002/02/22 12:20:34 markus Exp $"); #if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) #include <sys/queue.h> @@ -660,11 +660,17 @@ do_host(char *host) } } -static void -fatal_callback(void *arg) +void +fatal(const char *fmt,...) { + va_list args; + va_start(args, fmt); + do_log(SYSLOG_LEVEL_FATAL, fmt, args); + va_end(args); if (nonfatal_fatal) longjmp(kexjmp, -1); + else + fatal_cleanup(); } static void @@ -677,9 +683,9 @@ usage(void) fprintf(stderr, " -p port Connect to the specified port.\n"); fprintf(stderr, " -t keytype Specify the host key type.\n"); fprintf(stderr, " -T timeout Set connection timeout.\n"); - fprintf(stderr, " -v Verbose; display verbose debugging messages.\n"); - fprintf(stderr, " -4 Use IPv4 only.\n"); - fprintf(stderr, " -6 Use IPv6 only.\n"); + fprintf(stderr, " -v Verbose; display verbose debugging messages.\n"); + fprintf(stderr, " -4 Use IPv4 only.\n"); + fprintf(stderr, " -6 Use IPv6 only.\n"); exit(1); } @@ -766,7 +772,6 @@ main(int argc, char **argv) usage(); log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1); - fatal_add_cleanup(fatal_callback, NULL); maxfd = fdlim_get(1); if (maxfd < 0) |