25 |
unsigned int timeout = 1800; /* RFC2060: 30 minutes, if enable. */ |
unsigned int timeout = 1800; /* RFC2060: 30 minutes, if enable. */ |
26 |
mailbox_t mbox; |
mailbox_t mbox; |
27 |
char *homedir; |
char *homedir; |
28 |
|
char *maildir = _PATH_MAILDIR; |
29 |
int state = STATE_NONAUTH; |
int state = STATE_NONAUTH; |
30 |
|
|
31 |
/* Number of child processes. */ |
/* Number of child processes. */ |
36 |
{"daemon", optional_argument, 0, 'd'}, |
{"daemon", optional_argument, 0, 'd'}, |
37 |
{"help", no_argument, 0, 'h'}, |
{"help", no_argument, 0, 'h'}, |
38 |
{"inetd", no_argument, 0, 'i'}, |
{"inetd", no_argument, 0, 'i'}, |
39 |
|
{"maildir", required_argument, 0, 'm'}, |
40 |
{"port", required_argument, 0, 'p'}, |
{"port", required_argument, 0, 'p'}, |
41 |
{"other-namespace", required_argument, 0, 'O'}, |
{"other-namespace", required_argument, 0, 'O'}, |
42 |
{"shared-namespace", required_argument, 0, 'S'}, |
{"shared-namespace", required_argument, 0, 'S'}, |
45 |
{0, 0, 0, 0} |
{0, 0, 0, 0} |
46 |
}; |
}; |
47 |
|
|
48 |
const char *short_options ="d::hip:t:vO:P:S:"; |
const char *short_options ="d::him:p:t:vO:P:S:"; |
49 |
|
|
50 |
static int imap4d_mainloop __P ((int, int)); |
static int imap4d_mainloop __P ((int, int)); |
51 |
static void imap4d_daemon_init __P ((void)); |
static void imap4d_daemon_init __P ((void)); |
92 |
mode = INTERACTIVE; |
mode = INTERACTIVE; |
93 |
break; |
break; |
94 |
|
|
95 |
|
case 'm': |
96 |
|
maildir = optarg; |
97 |
|
break; |
98 |
|
|
99 |
case 'p': |
case 'p': |
100 |
mode = DAEMON; |
mode = DAEMON; |
101 |
port = strtoul (optarg, NULL, 10); |
port = strtoul (optarg, NULL, 10); |
123 |
} |
} |
124 |
} |
} |
125 |
|
|
126 |
|
maildir = mu_normalize_maildir (maildir); |
127 |
|
if (!maildir) |
128 |
|
{ |
129 |
|
mu_error ("Badly formed maildir: %s", maildir); |
130 |
|
exit (1); |
131 |
|
} |
132 |
|
|
133 |
/* First we want our group to be mail so we can access the spool. */ |
/* First we want our group to be mail so we can access the spool. */ |
134 |
gr = getgrnam ("mail"); |
gr = getgrnam ("mail"); |
135 |
if (gr == NULL) |
if (gr == NULL) |
148 |
{ |
{ |
149 |
list_t bookie; |
list_t bookie; |
150 |
registrar_get_list (&bookie); |
registrar_get_list (&bookie); |
151 |
/* list_append (bookie, mbox_record); */ |
list_append (bookie, mbox_record); |
152 |
list_append (bookie, path_record); |
list_append (bookie, path_record); |
153 |
} |
} |
154 |
|
|
360 |
{ |
{ |
361 |
printf ("Usage: %s [OPTIONS]\n", argv0); |
printf ("Usage: %s [OPTIONS]\n", argv0); |
362 |
printf ("Runs the GNU IMAP4 daemon.\n\n"); |
printf ("Runs the GNU IMAP4 daemon.\n\n"); |
363 |
printf (" -d, --daemon=MAXCHILDREN runs in daemon mode with a maximum\n"); |
printf (" -d, --daemon[=MAXCHILDREN] runs in daemon mode with a maximum\n"); |
364 |
printf (" of MAXCHILDREN child processes\n"); |
printf (" of MAXCHILDREN child processes\n"); |
365 |
|
printf (" MAXCHILDREN defaults to %d\n", |
366 |
|
DEFMAXCHILDREN); |
367 |
printf (" -h, --help display this help and exit\n"); |
printf (" -h, --help display this help and exit\n"); |
368 |
printf (" -i, --inetd runs in inetd mode (default)\n"); |
printf (" -i, --inetd runs in inetd mode (default)\n"); |
369 |
printf (" -p, --port=PORT specifies port to listen on, implies -d\n" |
printf (" -p, --port=PORT specifies port to listen on, implies -d\n" |
370 |
); |
); |
371 |
printf (" defaults to 143, which need not be specified\n"); |
printf (" defaults to 143, which need not be specified\n"); |
372 |
|
printf (" -m, --maildir=PATH set path to the mailspool directory\n"); |
373 |
|
printf (" -O, --other-namespace=PATHLIST sets the `other' namespace\n"); |
374 |
|
printf (" -S, --shared-namespace=PATHLIST sets the `shared' namespace\n"); |
375 |
printf (" -t, --timeout=TIMEOUT sets idle timeout to TIMEOUT seconds\n"); |
printf (" -t, --timeout=TIMEOUT sets idle timeout to TIMEOUT seconds\n"); |
376 |
printf (" TIMEOUT default is 1800 (30 minutes)\n"); |
printf (" TIMEOUT default is 1800 (30 minutes)\n"); |
377 |
printf (" -v, --version display version information and exit\n"); |
printf (" -v, --version display version information and exit\n"); |