Blame SOURCES/cyrus-imapd-2.4.12-debugopt.patch

3123eb
diff -up cyrus-imapd-2.4.12/imap/global.c.debugopt cyrus-imapd-2.4.12/imap/global.c
3123eb
--- cyrus-imapd-2.4.12/imap/global.c.debugopt	2011-10-04 21:53:03.000000000 +0200
3123eb
+++ cyrus-imapd-2.4.12/imap/global.c	2011-11-22 14:24:28.272416643 +0100
3123eb
@@ -157,6 +157,10 @@ int cyrus_init(const char *alt_config, c
3123eb
 	/* don't free the openlog() string! */
3123eb
     }
3123eb
 
3123eb
+    /* allow debug logging */
3123eb
+    if (!config_debug)
3123eb
+	setlogmask(~LOG_MASK(LOG_DEBUG));
3123eb
+
3123eb
     /* Look up default partition */
3123eb
     config_defpartition = config_getstring(IMAPOPT_DEFAULTPARTITION);
3123eb
     for (p = (char *)config_defpartition; p && *p; p++) {
3123eb
diff -up cyrus-imapd-2.4.12/imap/tls.c.debugopt cyrus-imapd-2.4.12/imap/tls.c
3123eb
--- cyrus-imapd-2.4.12/imap/tls.c.debugopt	2011-10-04 21:53:03.000000000 +0200
3123eb
+++ cyrus-imapd-2.4.12/imap/tls.c	2011-11-22 14:24:28.272416643 +0100
3123eb
@@ -255,9 +255,9 @@ static DH *load_dh_param(const char *key
3123eb
 
3123eb
     if (ret == NULL) {
3123eb
 	ret = get_dh1024();
3123eb
-	syslog(LOG_NOTICE, "imapd:Loading hard-coded DH parameters");
3123eb
+	syslog(LOG_DEBUG, "imapd:Loading hard-coded DH parameters");
3123eb
     } else {
3123eb
-	syslog(LOG_NOTICE, "imapd:Loading DH parameters from file");
3123eb
+	syslog(LOG_DEBUG, "imapd:Loading DH parameters from file");
3123eb
     }
3123eb
 
3123eb
     if (bio != NULL) BIO_free(bio);
3123eb
diff -up cyrus-imapd-2.4.12/lib/imapoptions.debugopt cyrus-imapd-2.4.12/lib/imapoptions
3123eb
--- cyrus-imapd-2.4.12/lib/imapoptions.debugopt	2011-11-22 14:24:28.265416615 +0100
3123eb
+++ cyrus-imapd-2.4.12/lib/imapoptions	2011-11-22 14:24:28.273416647 +0100
3123eb
@@ -388,6 +388,9 @@ Blank lines and lines beginning with ``#
3123eb
    hashing done on configuration directories.  This is recommended if
3123eb
    one partition has a very bushy mailbox tree. */
3123eb
 
3123eb
+{ "debug", 0, SWITCH }
3123eb
+/* If enabled, allow syslog() to pass LOG_DEBUG messages. */
3123eb
+
3123eb
 # Commented out - there's no such thing as "hostname_mechs", but we need
3123eb
 # this for the man page
3123eb
 # { "hostname_mechs", NULL, STRING }
3123eb
diff -up cyrus-imapd-2.4.12/lib/libconfig.c.debugopt cyrus-imapd-2.4.12/lib/libconfig.c
3123eb
--- cyrus-imapd-2.4.12/lib/libconfig.c.debugopt	2011-10-04 21:53:03.000000000 +0200
3123eb
+++ cyrus-imapd-2.4.12/lib/libconfig.c	2011-11-22 14:24:28.274416650 +0100
3123eb
@@ -84,6 +84,7 @@ int config_auditlog;
3123eb
 unsigned config_maxword;
3123eb
 unsigned config_maxquoted;
3123eb
 int config_qosmarking;
3123eb
+int config_debug;
3123eb
 
3123eb
 /* declared in each binary that uses libconfig */
3123eb
 extern const int config_need_data;
3123eb
@@ -350,6 +351,9 @@ void config_read(const char *alt_config)
3123eb
 
3123eb
     ival = config_getenum(IMAPOPT_QOSMARKING);
3123eb
     config_qosmarking = qos[ival];
3123eb
+
3123eb
+    /* allow debug logging */
3123eb
+    config_debug = config_getswitch(IMAPOPT_DEBUG);
3123eb
 }
3123eb
 
3123eb
 #define GROWSIZE 4096
3123eb
diff -up cyrus-imapd-2.4.12/lib/libconfig.h.debugopt cyrus-imapd-2.4.12/lib/libconfig.h
3123eb
--- cyrus-imapd-2.4.12/lib/libconfig.h.debugopt	2011-10-04 21:53:03.000000000 +0200
3123eb
+++ cyrus-imapd-2.4.12/lib/libconfig.h	2011-11-22 14:24:28.274416650 +0100
3123eb
@@ -82,6 +82,7 @@ extern int config_auditlog;
3123eb
 extern unsigned config_maxquoted;
3123eb
 extern unsigned config_maxword;
3123eb
 extern int config_qosmarking;
3123eb
+extern int config_debug;
3123eb
 
3123eb
 /* config requirement flags */
3123eb
 #define CONFIG_NEED_PARTITION_DATA (1<<0)
3123eb
diff -up cyrus-imapd-2.4.12/master/master.c.debugopt cyrus-imapd-2.4.12/master/master.c
3123eb
--- cyrus-imapd-2.4.12/master/master.c.debugopt	2011-10-04 21:53:03.000000000 +0200
3123eb
+++ cyrus-imapd-2.4.12/master/master.c	2011-11-22 14:30:47.243975974 +0100
3123eb
@@ -1984,7 +1984,7 @@ int main(int argc, char **argv)
3123eb
 	if(pidlock_fd != -1) close(pidlock_fd);
3123eb
     }
3123eb
 
3123eb
-    syslog(LOG_NOTICE, "process started");
3123eb
+    syslog(LOG_DEBUG, "process started");
3123eb
 
3123eb
 #if defined(HAVE_UCDSNMP) || defined(HAVE_NETSNMP)
3123eb
     /* initialize SNMP agent */
3123eb
@@ -2041,7 +2041,7 @@ int main(int argc, char **argv)
3123eb
     init_janitor();
3123eb
     
3123eb
     /* ok, we're going to start spawning like mad now */
3123eb
-    syslog(LOG_NOTICE, "ready for work");
3123eb
+    syslog(LOG_DEBUG, "ready for work");
3123eb
 
3123eb
     now = time(NULL);
3123eb
     for (;;) {
3123eb
diff -up cyrus-imapd-2.4.12/master/masterconf.c.debugopt cyrus-imapd-2.4.12/master/masterconf.c
3123eb
--- cyrus-imapd-2.4.12/master/masterconf.c.debugopt	2011-10-04 21:53:03.000000000 +0200
3123eb
+++ cyrus-imapd-2.4.12/master/masterconf.c	2011-11-22 14:24:28.276416658 +0100
3123eb
@@ -99,6 +99,10 @@ int masterconf_init(const char *ident, c
3123eb
         /* don't free the openlog() string! */
3123eb
     }
3123eb
 
3123eb
+    /* drop debug messages locally */
3123eb
+    if (!config_debug)
3123eb
+	setlogmask(~LOG_MASK(LOG_DEBUG));
3123eb
+
3123eb
     return 0;
3123eb
 }
3123eb