1 |
/* GNU mailutils - a suite of utilities for electronic mail |
/* GNU Mailutils -- a suite of utilities for electronic mail |
2 |
Copyright (C) 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
GNU Mailutils is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
7 |
any later version. |
any later version. |
8 |
|
|
9 |
This program is distributed in the hope that it will be useful, |
GNU Mailutils is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
GNU General Public License for more details. |
13 |
|
|
14 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
along with GNU Mailutils; if not, write to the Free Software |
16 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
17 |
|
|
18 |
#include "imap4d.h" |
#include "imap4d.h" |
37 |
volatile size_t children; |
volatile size_t children; |
38 |
|
|
39 |
const char *argp_program_version = "imap4d (" PACKAGE_STRING ")"; |
const char *argp_program_version = "imap4d (" PACKAGE_STRING ")"; |
40 |
static char doc[] = "GNU imap4d -- the IMAP4D daemon"; |
static char doc[] = N_("GNU imap4d -- the IMAP4D daemon"); |
41 |
|
|
42 |
static struct argp_option options[] = |
static struct argp_option options[] = |
43 |
{ |
{ |
44 |
{"other-namespace", 'O', "PATHLIST", 0, |
{"other-namespace", 'O', "PATHLIST", 0, |
45 |
"set the `other' namespace", 0}, |
N_("set the `other' namespace"), 0}, |
46 |
{"shared-namespace", 'S', "PATHLIST", 0, |
{"shared-namespace", 'S', "PATHLIST", 0, |
47 |
"set the `shared' namespace", 0}, |
N_("set the `shared' namespace"), 0}, |
48 |
{ NULL, 0, NULL, 0, NULL, 0 } |
{ NULL, 0, NULL, 0, NULL, 0 } |
49 |
}; |
}; |
50 |
|
|
102 |
{ |
{ |
103 |
struct group *gr; |
struct group *gr; |
104 |
int status = EXIT_SUCCESS; |
int status = EXIT_SUCCESS; |
105 |
|
|
106 |
|
/* Native Language Support */ |
107 |
|
mu_init_nls (); |
108 |
|
|
109 |
state = STATE_NONAUTH; /* Starting state in non-auth. */ |
state = STATE_NONAUTH; /* Starting state in non-auth. */ |
110 |
|
|
111 |
MU_AUTH_REGISTER_ALL_MODULES(); |
MU_AUTH_REGISTER_ALL_MODULES(); |
128 |
gr = getgrnam ("mail"); |
gr = getgrnam ("mail"); |
129 |
if (gr == NULL) |
if (gr == NULL) |
130 |
{ |
{ |
131 |
perror ("Error getting mail group"); |
perror (_("Error getting mail group")); |
132 |
exit (1); |
exit (1); |
133 |
} |
} |
134 |
|
|
135 |
if (setgid (gr->gr_gid) == -1) |
if (setgid (gr->gr_gid) == -1) |
136 |
{ |
{ |
137 |
perror ("Error setting mail group"); |
perror (_("Error setting mail group")); |
138 |
exit (1); |
exit (1); |
139 |
} |
} |
140 |
} |
} |
213 |
struct sockaddr_in cs; |
struct sockaddr_in cs; |
214 |
int len = sizeof cs; |
int len = sizeof cs; |
215 |
|
|
216 |
syslog (LOG_INFO, "Incoming connection opened"); |
syslog (LOG_INFO, _("Incoming connection opened")); |
217 |
if (getpeername (infile, (struct sockaddr*)&cs, &len) < 0) |
if (getpeername (infile, (struct sockaddr*)&cs, &len) < 0) |
218 |
syslog (LOG_ERR, "can't obtain IP address of client: %s", |
syslog (LOG_ERR, _("can't obtain IP address of client: %s"), |
219 |
strerror (errno)); |
strerror (errno)); |
220 |
else |
else |
221 |
syslog (LOG_INFO, "connect from %s", inet_ntoa(cs.sin_addr)); |
syslog (LOG_INFO, _("connect from %s"), inet_ntoa(cs.sin_addr)); |
222 |
text = "IMAP4rev1"; |
text = "IMAP4rev1"; |
223 |
} |
} |
224 |
else |
else |
225 |
{ |
{ |
226 |
syslog (LOG_INFO, "Started in debugging mode"); |
syslog (LOG_INFO, _("Started in debugging mode")); |
227 |
text = "IMAP4rev1 Debugging mode"; |
text = "IMAP4rev1 Debugging mode"; |
228 |
} |
} |
229 |
|
|
256 |
first three one, in, out, err */ |
first three one, in, out, err */ |
257 |
if (daemon (0, 0) < 0) |
if (daemon (0, 0) < 0) |
258 |
{ |
{ |
259 |
perror("fork failed:"); |
perror(_("fork failed:")); |
260 |
exit (1); |
exit (1); |
261 |
} |
} |
262 |
|
|
316 |
{ |
{ |
317 |
if (children > maxchildren) |
if (children > maxchildren) |
318 |
{ |
{ |
319 |
syslog (LOG_ERR, "too many children (%lu)", |
syslog (LOG_ERR, _("too many children (%lu)"), |
320 |
(unsigned long) children); |
(unsigned long) children); |
321 |
pause (); |
pause (); |
322 |
continue; |
continue; |
350 |
} |
} |
351 |
} |
} |
352 |
|
|
|
|
|
|
|
|