diff options
author | Damien Miller <djm@mindrot.org> | 1999-11-21 13:23:52 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-11-21 13:23:52 +1100 |
commit | 6162d1215bbff30cf0c4c19368dc85ae570d44ca (patch) | |
tree | f82956b4429cad04a2296a1ede65e147bafb92f4 /log.c | |
parent | f58db38f8d396ee5ea42975d9409a644e01cede8 (diff) |
- OpenBSD CVS Changes
- [channels.c]
make this compile, bad markus
- [log.c readconf.c servconf.c ssh.h]
bugfix: loglevels are per host in clientconfig,
factor out common log-level parsing code.
- [servconf.c]
remove unused index (-Wall)
- [ssh-agent.c]
only one 'extern char *__progname'
- [sshd.8]
document SIGHUP, -Q to synopsis
- [sshconnect.c serverloop.c sshd.c packet.c packet.h]
[channels.c clientloop.c]
SSH_CMSG_MAX_PACKET_SIZE, some clients use this, some need this, niels@
[hope this time my ISP stays alive during commit]
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 62 |
1 files changed, 61 insertions, 1 deletions
@@ -5,7 +5,7 @@ Shared versions of debug(), log(), etc. | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "includes.h" | 7 | #include "includes.h" |
8 | RCSID("$OpenBSD: log.c,v 1.1 1999/11/10 23:36:44 markus Exp $"); | 8 | RCSID("$OpenBSD: log.c,v 1.2 1999/11/19 16:04:17 markus Exp $"); |
9 | 9 | ||
10 | #include "ssh.h" | 10 | #include "ssh.h" |
11 | #include "xmalloc.h" | 11 | #include "xmalloc.h" |
@@ -133,3 +133,63 @@ fatal_cleanup(void) | |||
133 | 133 | ||
134 | exit(255); | 134 | exit(255); |
135 | } | 135 | } |
136 | |||
137 | /* textual representation of log-facilities/levels */ | ||
138 | |||
139 | |||
140 | static struct | ||
141 | { | ||
142 | const char *name; | ||
143 | SyslogFacility val; | ||
144 | } log_facilities[] = | ||
145 | { | ||
146 | { "DAEMON", SYSLOG_FACILITY_DAEMON }, | ||
147 | { "USER", SYSLOG_FACILITY_USER }, | ||
148 | { "AUTH", SYSLOG_FACILITY_AUTH }, | ||
149 | { "LOCAL0", SYSLOG_FACILITY_LOCAL0 }, | ||
150 | { "LOCAL1", SYSLOG_FACILITY_LOCAL1 }, | ||
151 | { "LOCAL2", SYSLOG_FACILITY_LOCAL2 }, | ||
152 | { "LOCAL3", SYSLOG_FACILITY_LOCAL3 }, | ||
153 | { "LOCAL4", SYSLOG_FACILITY_LOCAL4 }, | ||
154 | { "LOCAL5", SYSLOG_FACILITY_LOCAL5 }, | ||
155 | { "LOCAL6", SYSLOG_FACILITY_LOCAL6 }, | ||
156 | { "LOCAL7", SYSLOG_FACILITY_LOCAL7 }, | ||
157 | { NULL, 0 } | ||
158 | }; | ||
159 | |||
160 | static struct | ||
161 | { | ||
162 | const char *name; | ||
163 | LogLevel val; | ||
164 | } log_levels[] = | ||
165 | { | ||
166 | { "QUIET", SYSLOG_LEVEL_QUIET }, | ||
167 | { "FATAL", SYSLOG_LEVEL_FATAL }, | ||
168 | { "ERROR", SYSLOG_LEVEL_ERROR }, | ||
169 | { "INFO", SYSLOG_LEVEL_INFO }, | ||
170 | { "CHAT", SYSLOG_LEVEL_CHAT }, | ||
171 | { "DEBUG", SYSLOG_LEVEL_DEBUG }, | ||
172 | { NULL, 0 } | ||
173 | }; | ||
174 | |||
175 | SyslogFacility | ||
176 | log_facility_number(char *name) | ||
177 | { | ||
178 | int i; | ||
179 | if (name != NULL) | ||
180 | for (i = 0; log_facilities[i].name; i++) | ||
181 | if (strcasecmp(log_facilities[i].name, name) == 0) | ||
182 | return log_facilities[i].val; | ||
183 | return (SyslogFacility)-1; | ||
184 | } | ||
185 | |||
186 | LogLevel | ||
187 | log_level_number(char *name) | ||
188 | { | ||
189 | int i; | ||
190 | if (name != NULL) | ||
191 | for (i = 0; log_levels[i].name; i++) | ||
192 | if (strcasecmp(log_levels[i].name, name) == 0) | ||
193 | return log_levels[i].val; | ||
194 | return (LogLevel)-1; | ||
195 | } | ||