diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-05 08:16:54 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-03-05 08:16:54 +0000 |
commit | 2d9bfb17be2037ad3a735d108b3ac115527732ca (patch) | |
tree | 2a8f072b5bb5d1838e26e15fbd4de9cfc151ead5 | |
parent | 0f68db4e9e3a6c41504904079448770d13700a51 (diff) |
- (bal) Fix up logging since it changed. removed log-*.c
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Makefile.in | 38 | ||||
-rw-r--r-- | log-client.c | 84 | ||||
-rw-r--r-- | log-server.c | 180 |
4 files changed, 21 insertions, 284 deletions
@@ -169,6 +169,7 @@ | |||
169 | [sshd.8] | 169 | [sshd.8] |
170 | list SSH2 ciphers | 170 | list SSH2 ciphers |
171 | - (bal) Put HAVE_PW_CLASS_IN_PASSWD back into pwcopy() | 171 | - (bal) Put HAVE_PW_CLASS_IN_PASSWD back into pwcopy() |
172 | - (bal) Fix up logging since it changed. removed log-*.c | ||
172 | 173 | ||
173 | 20010304 | 174 | 20010304 |
174 | - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid. | 175 | - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid. |
@@ -4361,4 +4362,4 @@ | |||
4361 | - Wrote replacements for strlcpy and mkdtemp | 4362 | - Wrote replacements for strlcpy and mkdtemp |
4362 | - Released 1.0pre1 | 4363 | - Released 1.0pre1 |
4363 | 4364 | ||
4364 | $Id: ChangeLog,v 1.904 2001/03/05 07:57:09 mouring Exp $ | 4365 | $Id: ChangeLog,v 1.905 2001/03/05 08:16:54 mouring Exp $ |
diff --git a/Makefile.in b/Makefile.in index 2215d78af..0f7bc5db0 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: Makefile.in,v 1.155 2001/02/18 19:13:33 mouring Exp $ | 1 | # $Id: Makefile.in,v 1.156 2001/03/05 08:16:54 mouring Exp $ |
2 | 2 | ||
3 | prefix=@prefix@ | 3 | prefix=@prefix@ |
4 | exec_prefix=@exec_prefix@ | 4 | exec_prefix=@exec_prefix@ |
@@ -46,9 +46,9 @@ TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keys | |||
46 | 46 | ||
47 | LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o cli.o compat.o compress.o crc32.o deattack.o dispatch.o mac.o hostfile.o key.o kex.o log.o match.o misc.o mpaux.o nchan.o packet.o radix.o rijndael.o entropy.o readpass.o rsa.o ssh-dss.o ssh-rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o | 47 | LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o cli.o compat.o compress.o crc32.o deattack.o dispatch.o mac.o hostfile.o key.o kex.o log.o match.o misc.o mpaux.o nchan.o packet.o radix.o rijndael.o entropy.o readpass.o rsa.o ssh-dss.o ssh-rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o |
48 | 48 | ||
49 | SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o | 49 | SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o readconf.o clientloop.o |
50 | 50 | ||
51 | SSHDOBJS= sshd.o auth.o auth1.o auth2.o auth-chall.o auth2-chall.o auth-rhosts.o auth-options.o auth-krb4.o auth-pam.o auth2-pam.o auth-passwd.o auth-rsa.o auth-rh-rsa.o auth-sia.o dh.o sshpty.o log-server.o sshlogin.o loginrec.o servconf.o serverloop.o md5crypt.o session.o groupaccess.o | 51 | SSHDOBJS= sshd.o auth.o auth1.o auth2.o auth-chall.o auth2-chall.o auth-rhosts.o auth-options.o auth-krb4.o auth-pam.o auth2-pam.o auth-passwd.o auth-rsa.o auth-rh-rsa.o auth-sia.o dh.o sshpty.o sshlogin.o loginrec.o servconf.o serverloop.o md5crypt.o session.o groupaccess.o |
52 | 52 | ||
53 | TROFFMAN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 | 53 | TROFFMAN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 |
54 | CATMAN = scp.0 ssh-add.0 ssh-agent.0 ssh-keygen.0 ssh-keyscan.0 ssh.0 sshd.0 sftp-server.0 sftp.0 | 54 | CATMAN = scp.0 ssh-add.0 ssh-agent.0 ssh-keygen.0 ssh-keyscan.0 ssh.0 sshd.0 sftp-server.0 sftp.0 |
@@ -97,30 +97,30 @@ ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS) | |||
97 | sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) | 97 | sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) |
98 | $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 98 | $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
99 | 99 | ||
100 | scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o log-client.o | 100 | scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o log.o |
101 | $(LD) -o $@ scp.o log-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 101 | $(LD) -o $@ scp.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
102 | 102 | ||
103 | ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o log-client.o | 103 | ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o log.o |
104 | $(LD) -o $@ ssh-add.o log-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 104 | $(LD) -o $@ ssh-add.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
105 | 105 | ||
106 | ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o log-client.o | 106 | ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o log.o |
107 | $(LD) -o $@ ssh-agent.o log-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 107 | $(LD) -o $@ ssh-agent.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
108 | 108 | ||
109 | ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o log-client.o | 109 | ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o log.o |
110 | $(LD) -o $@ ssh-keygen.o log-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 110 | $(LD) -o $@ ssh-keygen.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
111 | 111 | ||
112 | ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a log-client.o ssh-keyscan.o | 112 | ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a log.o ssh-keyscan.o |
113 | $(LD) -o $@ ssh-keyscan.o log-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 113 | $(LD) -o $@ ssh-keyscan.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
114 | 114 | ||
115 | sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp-server.o sftp-common.o log-server.o | 115 | sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o log.o sftp-server.o |
116 | $(LD) -o $@ sftp-server.o sftp-common.o log-server.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 116 | $(LD) -o $@ sftp-server.o sftp-common.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
117 | 117 | ||
118 | sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-int.o sftp-common.o log-client.o | 118 | sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-int.o sftp-common.o log.o |
119 | $(LD) -o $@ sftp.o sftp-client.o sftp-common.o sftp-int.o log-client.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) | 119 | $(LD) -o $@ sftp.o sftp-client.o sftp-common.o sftp-int.o log.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) |
120 | 120 | ||
121 | # test driver for the loginrec code - not built by default | 121 | # test driver for the loginrec code - not built by default |
122 | logintest: logintest.o $(LIBCOMPAT) libssh.a log-client.o loginrec.o | 122 | logintest: logintest.o $(LIBCOMPAT) libssh.a log.o loginrec.o |
123 | $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh log-client.o $(LIBS) | 123 | $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh log.o $(LIBS) |
124 | 124 | ||
125 | $(MANPAGES) $(CONFIGFILES):: | 125 | $(MANPAGES) $(CONFIGFILES):: |
126 | $(FIXPATHSCMD) $(srcdir)/$@ | 126 | $(FIXPATHSCMD) $(srcdir)/$@ |
diff --git a/log-client.c b/log-client.c deleted file mode 100644 index b35f77bc9..000000000 --- a/log-client.c +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /* | ||
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
4 | * All rights reserved | ||
5 | * Client-side versions of debug(), log(), etc. These print to stderr. | ||
6 | * This is a stripped down version of log-server.c. | ||
7 | * | ||
8 | * As far as I am concerned, the code I have written for this software | ||
9 | * can be used freely for any purpose. Any derived versions of this | ||
10 | * software must be clearly marked as such, and if the derived work is | ||
11 | * incompatible with the protocol description in the RFC file, it must be | ||
12 | * called by a name other than "ssh" or "Secure Shell". | ||
13 | * | ||
14 | * | ||
15 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | ||
16 | * | ||
17 | * Redistribution and use in source and binary forms, with or without | ||
18 | * modification, are permitted provided that the following conditions | ||
19 | * are met: | ||
20 | * 1. Redistributions of source code must retain the above copyright | ||
21 | * notice, this list of conditions and the following disclaimer. | ||
22 | * 2. Redistributions in binary form must reproduce the above copyright | ||
23 | * notice, this list of conditions and the following disclaimer in the | ||
24 | * documentation and/or other materials provided with the distribution. | ||
25 | * | ||
26 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
27 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
29 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
30 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
31 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
32 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
35 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
36 | */ | ||
37 | |||
38 | #include "includes.h" | ||
39 | RCSID("$OpenBSD: log-client.c,v 1.15 2001/01/21 19:05:50 markus Exp $"); | ||
40 | |||
41 | #include "xmalloc.h" | ||
42 | #include "log.h" | ||
43 | |||
44 | static LogLevel log_level = SYSLOG_LEVEL_INFO; | ||
45 | |||
46 | /* Initialize the log. | ||
47 | * av0 program name (should be argv[0]) | ||
48 | * level logging level | ||
49 | */ | ||
50 | |||
51 | void | ||
52 | log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2) | ||
53 | { | ||
54 | switch (level) { | ||
55 | case SYSLOG_LEVEL_QUIET: | ||
56 | case SYSLOG_LEVEL_FATAL: | ||
57 | case SYSLOG_LEVEL_ERROR: | ||
58 | case SYSLOG_LEVEL_INFO: | ||
59 | case SYSLOG_LEVEL_VERBOSE: | ||
60 | case SYSLOG_LEVEL_DEBUG1: | ||
61 | case SYSLOG_LEVEL_DEBUG2: | ||
62 | case SYSLOG_LEVEL_DEBUG3: | ||
63 | log_level = level; | ||
64 | break; | ||
65 | default: | ||
66 | /* unchanged */ | ||
67 | break; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | #define MSGBUFSIZ 1024 | ||
72 | |||
73 | void | ||
74 | do_log(LogLevel level, const char *fmt, va_list args) | ||
75 | { | ||
76 | char msgbuf[MSGBUFSIZ]; | ||
77 | |||
78 | if (level > log_level) | ||
79 | return; | ||
80 | if (level >= SYSLOG_LEVEL_DEBUG1) | ||
81 | fprintf(stderr, "debug: "); | ||
82 | vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); | ||
83 | fprintf(stderr, "%s\r\n", msgbuf); | ||
84 | } | ||
diff --git a/log-server.c b/log-server.c deleted file mode 100644 index 3c53d9c59..000000000 --- a/log-server.c +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | /* | ||
2 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | ||
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | ||
4 | * All rights reserved | ||
5 | * Server-side versions of debug(), log(), etc. These normally send the output | ||
6 | * to the system log. | ||
7 | * | ||
8 | * As far as I am concerned, the code I have written for this software | ||
9 | * can be used freely for any purpose. Any derived versions of this | ||
10 | * software must be clearly marked as such, and if the derived work is | ||
11 | * incompatible with the protocol description in the RFC file, it must be | ||
12 | * called by a name other than "ssh" or "Secure Shell". | ||
13 | * | ||
14 | * | ||
15 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | ||
16 | * | ||
17 | * Redistribution and use in source and binary forms, with or without | ||
18 | * modification, are permitted provided that the following conditions | ||
19 | * are met: | ||
20 | * 1. Redistributions of source code must retain the above copyright | ||
21 | * notice, this list of conditions and the following disclaimer. | ||
22 | * 2. Redistributions in binary form must reproduce the above copyright | ||
23 | * notice, this list of conditions and the following disclaimer in the | ||
24 | * documentation and/or other materials provided with the distribution. | ||
25 | * | ||
26 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
27 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
28 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
29 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
30 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
31 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
32 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
33 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
35 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
36 | */ | ||
37 | |||
38 | #include "includes.h" | ||
39 | RCSID("$OpenBSD: log-server.c,v 1.20 2001/01/21 19:05:50 markus Exp $"); | ||
40 | |||
41 | #include <syslog.h> | ||
42 | #include "packet.h" | ||
43 | #include "xmalloc.h" | ||
44 | #include "log.h" | ||
45 | |||
46 | static LogLevel log_level = SYSLOG_LEVEL_INFO; | ||
47 | static int log_on_stderr = 0; | ||
48 | static int log_facility = LOG_AUTH; | ||
49 | |||
50 | /* Initialize the log. | ||
51 | * av0 program name (should be argv[0]) | ||
52 | * on_stderr print also on stderr | ||
53 | * level logging level | ||
54 | */ | ||
55 | |||
56 | void | ||
57 | log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | ||
58 | { | ||
59 | switch (level) { | ||
60 | case SYSLOG_LEVEL_QUIET: | ||
61 | case SYSLOG_LEVEL_FATAL: | ||
62 | case SYSLOG_LEVEL_ERROR: | ||
63 | case SYSLOG_LEVEL_INFO: | ||
64 | case SYSLOG_LEVEL_VERBOSE: | ||
65 | case SYSLOG_LEVEL_DEBUG1: | ||
66 | case SYSLOG_LEVEL_DEBUG2: | ||
67 | case SYSLOG_LEVEL_DEBUG3: | ||
68 | log_level = level; | ||
69 | break; | ||
70 | default: | ||
71 | fprintf(stderr, "Unrecognized internal syslog level code %d\n", | ||
72 | (int) level); | ||
73 | exit(1); | ||
74 | } | ||
75 | switch (facility) { | ||
76 | case SYSLOG_FACILITY_DAEMON: | ||
77 | log_facility = LOG_DAEMON; | ||
78 | break; | ||
79 | case SYSLOG_FACILITY_USER: | ||
80 | log_facility = LOG_USER; | ||
81 | break; | ||
82 | case SYSLOG_FACILITY_AUTH: | ||
83 | log_facility = LOG_AUTH; | ||
84 | break; | ||
85 | #ifdef LOG_AUTHPRIV | ||
86 | case SYSLOG_FACILITY_AUTHPRIV: | ||
87 | log_facility = LOG_AUTHPRIV; | ||
88 | break; | ||
89 | #endif | ||
90 | case SYSLOG_FACILITY_LOCAL0: | ||
91 | log_facility = LOG_LOCAL0; | ||
92 | break; | ||
93 | case SYSLOG_FACILITY_LOCAL1: | ||
94 | log_facility = LOG_LOCAL1; | ||
95 | break; | ||
96 | case SYSLOG_FACILITY_LOCAL2: | ||
97 | log_facility = LOG_LOCAL2; | ||
98 | break; | ||
99 | case SYSLOG_FACILITY_LOCAL3: | ||
100 | log_facility = LOG_LOCAL3; | ||
101 | break; | ||
102 | case SYSLOG_FACILITY_LOCAL4: | ||
103 | log_facility = LOG_LOCAL4; | ||
104 | break; | ||
105 | case SYSLOG_FACILITY_LOCAL5: | ||
106 | log_facility = LOG_LOCAL5; | ||
107 | break; | ||
108 | case SYSLOG_FACILITY_LOCAL6: | ||
109 | log_facility = LOG_LOCAL6; | ||
110 | break; | ||
111 | case SYSLOG_FACILITY_LOCAL7: | ||
112 | log_facility = LOG_LOCAL7; | ||
113 | break; | ||
114 | default: | ||
115 | fprintf(stderr, "Unrecognized internal syslog facility code %d\n", | ||
116 | (int) facility); | ||
117 | exit(1); | ||
118 | } | ||
119 | log_on_stderr = on_stderr; | ||
120 | } | ||
121 | |||
122 | #define MSGBUFSIZ 1024 | ||
123 | |||
124 | void | ||
125 | do_log(LogLevel level, const char *fmt, va_list args) | ||
126 | { | ||
127 | char msgbuf[MSGBUFSIZ]; | ||
128 | char fmtbuf[MSGBUFSIZ]; | ||
129 | char *txt = NULL; | ||
130 | int pri = LOG_INFO; | ||
131 | extern char *__progname; | ||
132 | |||
133 | if (level > log_level) | ||
134 | return; | ||
135 | switch (level) { | ||
136 | case SYSLOG_LEVEL_FATAL: | ||
137 | txt = "fatal"; | ||
138 | pri = LOG_CRIT; | ||
139 | break; | ||
140 | case SYSLOG_LEVEL_ERROR: | ||
141 | txt = "error"; | ||
142 | pri = LOG_ERR; | ||
143 | break; | ||
144 | case SYSLOG_LEVEL_INFO: | ||
145 | pri = LOG_INFO; | ||
146 | break; | ||
147 | case SYSLOG_LEVEL_VERBOSE: | ||
148 | pri = LOG_INFO; | ||
149 | break; | ||
150 | case SYSLOG_LEVEL_DEBUG1: | ||
151 | txt = "debug1"; | ||
152 | pri = LOG_DEBUG; | ||
153 | break; | ||
154 | case SYSLOG_LEVEL_DEBUG2: | ||
155 | txt = "debug2"; | ||
156 | pri = LOG_DEBUG; | ||
157 | break; | ||
158 | case SYSLOG_LEVEL_DEBUG3: | ||
159 | txt = "debug3"; | ||
160 | pri = LOG_DEBUG; | ||
161 | break; | ||
162 | default: | ||
163 | txt = "internal error"; | ||
164 | pri = LOG_ERR; | ||
165 | break; | ||
166 | } | ||
167 | if (txt != NULL) { | ||
168 | snprintf(fmtbuf, sizeof(fmtbuf), "%s: %s", txt, fmt); | ||
169 | vsnprintf(msgbuf, sizeof(msgbuf), fmtbuf, args); | ||
170 | } else { | ||
171 | vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); | ||
172 | } | ||
173 | if (log_on_stderr) { | ||
174 | fprintf(stderr, "%s\n", msgbuf); | ||
175 | } else { | ||
176 | openlog(__progname, LOG_PID, log_facility); | ||
177 | syslog(pri, "%.500s", msgbuf); | ||
178 | closelog(); | ||
179 | } | ||
180 | } | ||