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

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