changeset 5050:167c602ef8b4 HEAD

If config file contained quoted "value", the quotes weren't stripped. syslog_facility wasn't converted from name to numeric value.
author Timo Sirainen <tss@iki.fi>
date Mon, 22 Jan 2007 12:57:13 +0200
parents 1acb3b558c3f
children eef4cdd5df99
files src/deliver/deliver.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Sun Jan 21 17:50:13 2007 +0200
+++ b/src/deliver/deliver.c	Mon Jan 22 12:57:13 2007 +0200
@@ -13,6 +13,7 @@
 #include "module-dir.h"
 #include "str.h"
 #include "str-sanitize.h"
+#include "strescape.h"
 #include "var-expand.h"
 #include "message-address.h"
 #include "dict-client.h"
@@ -20,6 +21,8 @@
 #include "auth-client.h"
 #include "mail-send.h"
 #include "duplicate.h"
+#include "../master/syslog-util.h"
+#include "../master/syslog-util.c" /* ugly, ugly.. */
 #include "deliver.h"
 
 #include <stdio.h>
@@ -246,6 +249,13 @@
 			value++;
 		} while (*value == ' ');
 
+		len = strlen(value);
+		if (len > 0 &&
+		    ((*value == '"' && value[len-1] == '"') ||
+		     (*value == '\'' && value[len-1] == '\''))) {
+			value = str_unescape(p_strndup(unsafe_data_stack_pool,
+						       value+1, len - 2));
+		}
 		if (setting_is_bool(key) && strcasecmp(value, "yes") != 0)
 			continue;
 
@@ -373,8 +383,11 @@
 	log_path = getenv("LOG_PATH");
 	if (log_path == NULL || *log_path == '\0') {
 		const char *env = getenv("SYSLOG_FACILITY");
-		i_set_failure_syslog(prefix, LOG_NDELAY,
-				     env == NULL ? LOG_MAIL : atoi(env));
+		int facility;
+
+		if (env == NULL || !syslog_facility_find(env, &facility))
+			facility = LOG_MAIL;
+		i_set_failure_syslog(prefix, LOG_NDELAY, facility);
 	} else {
 		/* log to file or stderr */
 		i_set_failure_file(log_path, prefix);