diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-02-26 17:52:14 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-02-26 17:52:14 +0000 |
commit | 9c8edc96fcb30cb8a9b0bd87fc1903c6fb618c31 (patch) | |
tree | 6629fda33de38709acce44bd39cbd761adcb4270 | |
parent | 351e9196904bdef86d61d51b8890853b219e5d22 (diff) |
- 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@
-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 @@ | |||
20 | [auth-krb5.c] | 20 | [auth-krb5.c] |
21 | krb5_get_err_text() does not like context==NULL; he@nordu.net via google; | 21 | krb5_get_err_text() does not like context==NULL; he@nordu.net via google; |
22 | ok provos@ | 22 | ok provos@ |
23 | - markus@cvs.openbsd.org 2002/02/22 12:20:34 | ||
24 | [log.c log.h ssh-keyscan.c] | ||
25 | overwrite fatal() in ssh-keyscan.c; fixes pr 2354; ok provos@ | ||
23 | 26 | ||
24 | 20020225 | 27 | 20020225 |
25 | - (bal) Last AIX patch. Moved aix_usrinfo() outside of do_setuserconext() | 28 | - (bal) Last AIX patch. Moved aix_usrinfo() outside of do_setuserconext() |
@@ -7693,4 +7696,4 @@ | |||
7693 | - Wrote replacements for strlcpy and mkdtemp | 7696 | - Wrote replacements for strlcpy and mkdtemp |
7694 | - Released 1.0pre1 | 7697 | - Released 1.0pre1 |
7695 | 7698 | ||
7696 | $Id: ChangeLog,v 1.1878 2002/02/26 17:49:55 mouring Exp $ | 7699 | $Id: ChangeLog,v 1.1879 2002/02/26 17:52:14 mouring Exp $ |
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | RCSID("$OpenBSD: log.c,v 1.21 2002/02/04 12:15:25 markus Exp $"); | 37 | RCSID("$OpenBSD: log.c,v 1.22 2002/02/22 12:20:34 markus Exp $"); |
38 | 38 | ||
39 | #include "log.h" | 39 | #include "log.h" |
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
@@ -88,8 +88,6 @@ static struct { | |||
88 | { NULL, SYSLOG_LEVEL_NOT_SET } | 88 | { NULL, SYSLOG_LEVEL_NOT_SET } |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static void do_log(LogLevel level, const char *fmt, va_list args); | ||
92 | |||
93 | SyslogFacility | 91 | SyslogFacility |
94 | log_facility_number(char *name) | 92 | log_facility_number(char *name) |
95 | { | 93 | { |
@@ -111,17 +109,6 @@ log_level_number(char *name) | |||
111 | return log_levels[i].val; | 109 | return log_levels[i].val; |
112 | return SYSLOG_LEVEL_NOT_SET; | 110 | return SYSLOG_LEVEL_NOT_SET; |
113 | } | 111 | } |
114 | /* Fatal messages. This function never returns. */ | ||
115 | |||
116 | void | ||
117 | fatal(const char *fmt,...) | ||
118 | { | ||
119 | va_list args; | ||
120 | va_start(args, fmt); | ||
121 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); | ||
122 | va_end(args); | ||
123 | fatal_cleanup(); | ||
124 | } | ||
125 | 112 | ||
126 | /* Error messages that should be logged. */ | 113 | /* Error messages that should be logged. */ |
127 | 114 | ||
@@ -328,7 +315,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
328 | 315 | ||
329 | #define MSGBUFSIZ 1024 | 316 | #define MSGBUFSIZ 1024 |
330 | 317 | ||
331 | static void | 318 | void |
332 | do_log(LogLevel level, const char *fmt, va_list args) | 319 | do_log(LogLevel level, const char *fmt, va_list args) |
333 | { | 320 | { |
334 | char msgbuf[MSGBUFSIZ]; | 321 | char msgbuf[MSGBUFSIZ]; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: log.h,v 1.5 2002/02/04 12:15:25 markus Exp $ */ | 1 | /* $OpenBSD: log.h,v 1.6 2002/02/22 12:20:34 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -65,4 +65,6 @@ void fatal_cleanup(void); | |||
65 | void fatal_add_cleanup(void (*) (void *), void *); | 65 | void fatal_add_cleanup(void (*) (void *), void *); |
66 | void fatal_remove_cleanup(void (*) (void *), void *); | 66 | void fatal_remove_cleanup(void (*) (void *), void *); |
67 | 67 | ||
68 | void do_log(LogLevel, const char *, va_list); | ||
69 | |||
68 | #endif | 70 | #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 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "includes.h" | 9 | #include "includes.h" |
10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.33 2001/12/10 20:34:31 markus Exp $"); | 10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.34 2002/02/22 12:20:34 markus Exp $"); |
11 | 11 | ||
12 | #if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) | 12 | #if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) |
13 | #include <sys/queue.h> | 13 | #include <sys/queue.h> |
@@ -660,11 +660,17 @@ do_host(char *host) | |||
660 | } | 660 | } |
661 | } | 661 | } |
662 | 662 | ||
663 | static void | 663 | void |
664 | fatal_callback(void *arg) | 664 | fatal(const char *fmt,...) |
665 | { | 665 | { |
666 | va_list args; | ||
667 | va_start(args, fmt); | ||
668 | do_log(SYSLOG_LEVEL_FATAL, fmt, args); | ||
669 | va_end(args); | ||
666 | if (nonfatal_fatal) | 670 | if (nonfatal_fatal) |
667 | longjmp(kexjmp, -1); | 671 | longjmp(kexjmp, -1); |
672 | else | ||
673 | fatal_cleanup(); | ||
668 | } | 674 | } |
669 | 675 | ||
670 | static void | 676 | static void |
@@ -677,9 +683,9 @@ usage(void) | |||
677 | fprintf(stderr, " -p port Connect to the specified port.\n"); | 683 | fprintf(stderr, " -p port Connect to the specified port.\n"); |
678 | fprintf(stderr, " -t keytype Specify the host key type.\n"); | 684 | fprintf(stderr, " -t keytype Specify the host key type.\n"); |
679 | fprintf(stderr, " -T timeout Set connection timeout.\n"); | 685 | fprintf(stderr, " -T timeout Set connection timeout.\n"); |
680 | fprintf(stderr, " -v Verbose; display verbose debugging messages.\n"); | 686 | fprintf(stderr, " -v Verbose; display verbose debugging messages.\n"); |
681 | fprintf(stderr, " -4 Use IPv4 only.\n"); | 687 | fprintf(stderr, " -4 Use IPv4 only.\n"); |
682 | fprintf(stderr, " -6 Use IPv6 only.\n"); | 688 | fprintf(stderr, " -6 Use IPv6 only.\n"); |
683 | exit(1); | 689 | exit(1); |
684 | } | 690 | } |
685 | 691 | ||
@@ -766,7 +772,6 @@ main(int argc, char **argv) | |||
766 | usage(); | 772 | usage(); |
767 | 773 | ||
768 | log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1); | 774 | log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1); |
769 | fatal_add_cleanup(fatal_callback, NULL); | ||
770 | 775 | ||
771 | maxfd = fdlim_get(1); | 776 | maxfd = fdlim_get(1); |
772 | if (maxfd < 0) | 777 | if (maxfd < 0) |