summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.c23
-rw-r--r--radsecproxy.conf-example6
2 files changed, 25 insertions, 4 deletions
diff --git a/debug.c b/debug.c
index e5908e2..d7d333b 100644
--- a/debug.c
+++ b/debug.c
@@ -38,7 +38,14 @@ uint8_t debug_get_level() {
}
int debug_set_destination(char *dest) {
+ static const char *facstrings[] = { "LOG_DAEMON", "LOG_MAIL", "LOG_USER", "LOG_LOCAL0",
+ "LOG_LOCAL1", "LOG_LOCAL2", "LOG_LOCAL3", "LOG_LOCAL4",
+ "LOG_LOCAL5", "LOG_LOCAL6", "LOG_LOCAL7", NULL };
+ static const int facvals[] = { LOG_DAEMON, LOG_MAIL, LOG_USER, LOG_LOCAL0,
+ LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4,
+ LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7 };
extern int errno;
+ int i;
if (!strncasecmp(dest, "file:///", 8)) {
debug_file = fopen(dest + 7, "a");
@@ -48,12 +55,22 @@ int debug_set_destination(char *dest) {
setvbuf(debug_file, NULL, _IONBF, 0);
return 1;
}
- if (!strcasecmp(dest, "x-syslog://")) {
- debug_syslogfacility = LOG_DAEMON;
+ if (!strncasecmp(dest, "x-syslog://", 11)) {
+ dest += 11;
+ if (*dest) {
+ for (i = 0; facstrings[i]; i++)
+ if (!strcasecmp(dest, facstrings[i]))
+ break;
+ if (!facstrings[i])
+ debugx(1, DBG_ERR, "Unknown syslog facility %s", dest);
+ debug_syslogfacility = facvals[i];
+ } else
+ debug_syslogfacility = LOG_DAEMON;
openlog(debug_ident, LOG_PID, debug_syslogfacility);
return 1;
}
- return 0;
+ debug(DBG_ERR, "Unknown log destination, exiting %s", dest);
+ exit(1);
}
void debug_logit(uint8_t level, const char *format, va_list ap) {
diff --git a/radsecproxy.conf-example b/radsecproxy.conf-example
index 3a84c7b..2931cd3 100644
--- a/radsecproxy.conf-example
+++ b/radsecproxy.conf-example
@@ -21,5 +21,9 @@ TLSCertificateKeyPassword follow the white rabbit
# Optional log level. 2 is default, 1 is less, 3 is more
#LogLevel 2
#Optional LogDestinatinon, else stderr used for logging
-#LogDestination x-syslog://
+# Logging to file
#LogDestination file:///tmp/rp.log
+# Or logging with Syslog. LOG_DAEMON used if facility not specified
+#LogDestination x-syslog://
+#LogDestination x-syslog://log_local2
+