[dovecot-cvs] dovecot/src/master Makefile.am, 1.15, 1.16 main.c, 1.66, 1.67 master-settings.c, 1.93, 1.94 master-settings.h, 1.61, 1.62

cras at dovecot.org cras at dovecot.org
Fri Dec 2 14:53:30 EET 2005


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv7925/src/master

Modified Files:
	Makefile.am main.c master-settings.c master-settings.h 
Log Message:
Added syslog_facility setting to config file.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Makefile.am	23 Apr 2005 17:07:12 -0000	1.15
+++ Makefile.am	2 Dec 2005 12:53:27 -0000	1.16
@@ -23,6 +23,7 @@
 	mail-process.c \
 	main.c \
 	master-settings.c \
+	syslog-util.c \
 	ssl-init.c \
 	ssl-init-gnutls.c \
 	ssl-init-openssl.c
@@ -35,4 +36,5 @@
 	mail-process.h \
 	master-login-interface.h \
 	master-settings.h \
+	syslog-util.h \
 	ssl-init.h

Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- main.c	25 Sep 2005 11:07:40 -0000	1.66
+++ main.c	2 Dec 2005 12:53:28 -0000	1.67
@@ -11,6 +11,7 @@
 #include "auth-process.h"
 #include "login-process.h"
 #include "mail-process.h"
+#include "syslog-util.h"
 #include "ssl-init.h"
 #include "log.h"
 
@@ -61,6 +62,8 @@
 
 void child_process_init_env(void)
 {
+	int facility;
+
 	/* remove all environment, we don't need them */
 	env_clean();
 
@@ -69,6 +72,11 @@
 	if (env_tz != NULL)
 		env_put(t_strconcat("TZ=", env_tz, NULL));
 
+	if (!syslog_facility_find(settings_root->defaults->syslog_facility,
+				  &facility))
+		facility = LOG_MAIL;
+	env_put(t_strdup_printf("SYSLOG_FACILITY=%d", facility));
+
 #ifdef DEBUG
 	if (gdb) env_put("GDB=1");
 #endif
@@ -95,9 +103,14 @@
 
 static void set_logfile(struct settings *set)
 {
-	if (set->log_path == NULL)
-		i_set_failure_syslog("dovecot", LOG_NDELAY, LOG_MAIL);
-	else {
+	int facility;
+
+	if (set->log_path == NULL) {
+		if (!syslog_facility_find(set->syslog_facility, &facility))
+			facility = LOG_MAIL;
+
+		i_set_failure_syslog("dovecot", LOG_NDELAY, facility);
+	} else {
 		/* log to file or stderr */
 		i_set_failure_file(set->log_path, "dovecot");
 	}

Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- master-settings.c	27 Oct 2005 14:58:12 -0000	1.93
+++ master-settings.c	2 Dec 2005 12:53:28 -0000	1.94
@@ -4,6 +4,7 @@
 #include "istream.h"
 #include "safe-mkdir.h"
 #include "unlink-directory.h"
+#include "syslog-util.h"
 #include "settings.h"
 
 #include <stdio.h>
@@ -47,6 +48,7 @@
 	DEF(SET_STR, log_path),
 	DEF(SET_STR, info_log_path),
 	DEF(SET_STR, log_timestamp),
+	DEF(SET_STR, syslog_facility),
 
 	/* general */
 	DEF(SET_STR, protocols),
@@ -239,6 +241,7 @@
 	MEMBER(log_path) NULL,
 	MEMBER(info_log_path) NULL,
 	MEMBER(log_timestamp) DEFAULT_FAILURE_STAMP_FORMAT,
+	MEMBER(syslog_facility) "mail",
 
 	/* general */
 	MEMBER(protocols) "imap imaps",
@@ -511,6 +514,7 @@
 static int settings_verify(struct settings *set)
 {
 	const char *dir;
+	int facility;
 
 	if (!get_login_uid(set))
 		return FALSE;
@@ -553,6 +557,11 @@
 		}
 	}
 
+	if (!syslog_facility_find(set->syslog_facility, &facility)) {
+		i_error("Unknown syslog_facility '%s'", set->syslog_facility);
+		return FALSE;
+	}
+
 #ifdef HAVE_SSL
 	if (!set->ssl_disable) {
 		if (set->ssl_ca_file != NULL &&

Index: master-settings.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- master-settings.h	27 Oct 2005 14:58:12 -0000	1.61
+++ master-settings.h	2 Dec 2005 12:53:28 -0000	1.62
@@ -18,6 +18,7 @@
 	const char *log_path;
 	const char *info_log_path;
 	const char *log_timestamp;
+	const char *syslog_facility;
 
 	/* general */
 	const char *protocols;



More information about the dovecot-cvs mailing list