Lawrence Greenfield schrieb am Thu, Dec 06, 2001 at 01:43:14PM -0500:
* I'm pleased to announce Cyrus IMAP 2.1.0.
[...]
* 
* We encourage people to download and test Cyrus IMAP 2.1.0.
[...]

As for 2.0.1x, when using the Cyrus IMAP in clustered environments such as
the kimberlite software provides, a situation can arise where multiple
Cyrus IMAP master processes run on the same machine with different con-
figurations and data structures.

Given this case, fixing the cyrus.conf via 

  #define CONFIG_FILENAME "/etc/cyrus.conf"

in master/masterconf.c poses a problem.  Applied is the patch for 2.1.0
derived from a similar patch for 2.0.16 that makes it possible to specify
the configuration file for the master via a -C option as it is done already
for the imapd/lmtpd processes.

Maybe the patch will finally find its way into the main distribution of
the Cyrus IMAP package...


Regards,

- Birger


diff -ru cyrus-imapd-2.1.0-orig/doc/man/master.8.html 
cyrus-imapd-2.1.0/doc/man/master.8.html
--- cyrus-imapd-2.1.0-orig/doc/man/master.8.html        Thu Dec  6 19:09:13 2001
+++ cyrus-imapd-2.1.0/doc/man/master.8.html     Sun Dec  9 13:53:02 2001
@@ -20,16 +20,17 @@
 <!-- left  margin: 100 -->
 <!-- right margin: 750 -->
 <a name="NAME"></a><h2>NAME</h2><p><font size=3>master - master Cyrus process</p>
-<a name="SYNOPSIS"></a><h2>SYNOPSIS</h2><p><font size=3><B>master</B> <font size=3>[ 
<font size=3><B>-l</B> <font size=3><I>listen queue</I> <font size=3>] [ <font 
size=3><B>-D</B> <font size=3>]</p>
+<a name="SYNOPSIS"></a><h2>SYNOPSIS</h2><p><font size=3><B>master</B> <font size=3>[ 
+<font size=3><B>-C</B> <font size=3><I>alternate configfile</I> <font size=3>] [ 
+<font size=3><B>-l</B> <font size=3><I>listen queue</I> <font size=3>] [ <font 
+size=3><B>-D</B> <font size=3>]</p>
 <a name="DESCRIPTION"></a><h2>DESCRIPTION</h2><p><font size=3><I>Master</I> <font 
size=3>is the process that controls all of the Cyrus processes. This process is 
responsible for creating all imapd, pop3d, lmtpd and sieved child processes. This 
process also initializes the Berkeley DB code and performs sched- uled 
cleanup/maintenance.</p>
 <p><font size=3>If this process dies, then no new sessions will be started.</p>
 <p><font size=3>It kills itself and all child processes when it receives a 
SIGTERM.</p>
-<a name="OPTIONS"></a><h2>OPTIONS</h2><p><font size=3><B>-l</B> <font 
size=3><I>listen queue backlog<br>
+<a name="OPTIONS"></a><h2>OPTIONS</h2><p><font size=3><B>-C</B> <font size=3>Tell  
+master to use a configuration file other than /etc/cyrus.conf.</p>
+<p><font size=3><B>-l</B> <font size=3><I>listen queue backlog<br>
 <span style=" text-indent: 1.3000in;"></span></I>Increase the listen queue backlog. 
By default, the listen queue is set to 32. On systems<br>
 <span style=" text-indent: 1.3000in;"></span>with a high connection rate, it may be 
desirable to increase this value. refer to <font size=3><B>listen(2)</B> <font 
size=3>for<br>
 <span style=" text-indent: 1.3000in;"></span>details.</p>
 <p><font size=3><B>-D</B> <font size=3>Don't close stdin/stdout/stderr. Primiarly 
useful for debugging.</p>
-<a name="CONFIGURATION"></a><h2>CONFIGURATION</h2><p><font size=3>Upon execution, 
<font size=3><I>master</I> <font size=3>reads its configuration information out of the 
<font size=3><I>cyrus.conf</I><font size=3>(5) file.</p>
+<a name="CONFIGURATION"></a><h2>CONFIGURATION</h2><p><font size=3>Upon execution, 
+<font size=3><I>master</I> <font size=3>reads its configuration information out of 
+the <font size=3><I>cyrus.conf</I><font size=3>(5) file or the file specified by the 
+-C option.</p>
 <p><font size=3><I>Master</I> <font size=3>rereads its configuration file when it 
receives a hangup signal, SIGHUP. Services and events may be added, deleted or 
modified when the configuration file is reread. Any active services removed from the 
configura- tion file will be allowed to run until completion.</p>
 <a name="NOTES"></a><h2>NOTES</h2><p><font size=3>The environment variable <font 
size=3><B>CYRUS_VERBOSE</B> <font size=3>can be set to log additional debugging 
information. Setting the value to 1 results in base level logging. Setting it higher 
results in more log messages being generated.</p>
 <a name="FILES"></a><h2>FILES</h2><a name="/etc/cyrus.conf, 
/etc/imapd.conf"></a><h2>/etc/cyrus.conf, /etc/imapd.conf</h2><a name="SEE 
ALSO"></a><h2>SEE ALSO</h2><p><font size=3><B>cyrus.conf(5)</B><font size=3>, <font 
size=3><B>imapd.conf(5)</B><font size=3>, <font size=3><B>imapd(8)</B><font size=3>, 
<font size=3><B>pop3d(8)</B><font size=3>, <font size=3><B>lmtpd(8)</B><font size=3>, 
<font size=3><B>timsieved(8)</B><font size=3>, <font size=3><B>idled(8)</B><br>
diff -ru cyrus-imapd-2.1.0-orig/man/master.8 cyrus-imapd-2.1.0/man/master.8
--- cyrus-imapd-2.1.0-orig/man/master.8 Thu May  3 20:49:47 2001
+++ cyrus-imapd-2.1.0/man/master.8      Sun Dec  9 13:48:07 2001
@@ -44,6 +44,10 @@
 .SH SYNOPSIS
 .B master
 [
+.B \-C
+.I configfile
+]
+[
 .B \-l
 .I listen queue
 ]
@@ -63,6 +67,9 @@
 when it receives a SIGTERM.
 .SH OPTIONS
 .TP
+.BI \-C " alternate configfile"
+Tell master to use a configuration file other than /etc/cyrus.conf.
+.TP
 .BI \-l " listen queue backlog"
 Increase the listen queue backlog. By default, the listen queue is set
 to 32.   On systems with a high connection rate, it may be desirable
@@ -75,7 +82,7 @@
 .I master
 reads its configuration information out of the
 .IR cyrus.conf (5)
-file.
+file or the file specified by the -C option.
 .PP
 .I Master
 rereads its configuration file when it receives a hangup signal,
diff -ru cyrus-imapd-2.1.0-orig/master/master.c cyrus-imapd-2.1.0/master/master.c
--- cyrus-imapd-2.1.0-orig/master/master.c      Tue Nov 13 21:00:06 2001
+++ cyrus-imapd-2.1.0/master/master.c   Sun Dec  9 13:41:07 2001
@@ -103,6 +103,7 @@
 
 static int verbose = 0;
 static int listen_queue_backlog = 32;
+char config_filename[255] = "/etc/cyrus.conf";
 
 struct service *Services = NULL;
 int allocservices = 0;
@@ -1047,8 +1048,11 @@
 
     p = getenv("CYRUS_VERBOSE");
     if (p) verbose = atoi(p) + 1;
-    while ((opt = getopt(argc, argv, "l:D")) != EOF) {
+    while ((opt = getopt(argc, argv, "C:l:D")) != EOF) {
        switch (opt) {
+       case 'C': /* user defined cyrus.conf */
+           strncpy(config_filename, optarg, sizeof(config_filename));
+           break;
        case 'l': /* user defined listen queue backlog */
            listen_queue_backlog = atoi(optarg);
            break;
diff -ru cyrus-imapd-2.1.0-orig/master/masterconf.c 
cyrus-imapd-2.1.0/master/masterconf.c
--- cyrus-imapd-2.1.0-orig/master/masterconf.c  Mon Sep  3 21:36:07 2001
+++ cyrus-imapd-2.1.0/master/masterconf.c       Sun Dec  9 13:41:07 2001
@@ -59,7 +59,7 @@
 
 extern int errno;
 
-#define CONFIG_FILENAME "/etc/cyrus.conf"
+extern char config_filename[255];
 
 struct configlist {
     char *key;
@@ -102,7 +102,7 @@
            }
            if (*p != '"') {
                sprintf(k, "configuration file %s: missing \" on line %d",
-                       CONFIG_FILENAME, e->lineno);
+                       config_filename, e->lineno);
                fatal(k, EX_CONFIG);
            }
        } else {
@@ -198,9 +198,9 @@
     int lineno = 0;
     char buf[4096];
 
-    infile = fopen(CONFIG_FILENAME, "r");
+    infile = fopen(config_filename, "r");
     if (!infile) {
-       sprintf(buf, "can't open configuration file %s: %s", CONFIG_FILENAME,
+       sprintf(buf, "can't open configuration file %s: %s", config_filename,
                strerror(errno));
        fatal(buf, EX_CONFIG);
     }

Reply via email to