summaryrefslogtreecommitdiffabout
path: root/mfd/main.c
Side-by-side diff
Diffstat (limited to 'mfd/main.c') (more/less context) (ignore whitespace changes)
-rw-r--r--mfd/main.c55
1 files changed, 47 insertions, 8 deletions
diff --git a/mfd/main.c b/mfd/main.c
index 8ffff46..a69d7c0 100644
--- a/mfd/main.c
+++ b/mfd/main.c
@@ -70,9 +70,9 @@ int do_trace; /* Enable tracing configuration */
int mtasim_option; /* mtasim compatibility mode */
unsigned optimization_level = 1; /* Optimization level */
int log_to_stderr; /* Use stderr for logging */
-int force_remove = 1; /* Remove local communication socket if it already
- exists */
int foreground; /* Stay in foreground */
+int force_remove; /* Remove local communication socket if it already
+ exists */
int single_process_option; /* Run in single process mode. */
unsigned long source_address = INADDR_ANY; /* Source address for TCP
connections */
@@ -622,7 +622,8 @@ add_legacy_milter_port(const char *str, mu_debug_t dbg)
url = parse_milter_url(dbg, str);
if (url) {
mfd_server_t srv = mfd_server_new(id, url,
- milter_session_server);
+ milter_session_server,
+ 0);
if (srv)
mfd_srvman_attach_server(srv);
else
@@ -1381,7 +1382,6 @@ parse_opt(int key, char *arg, struct argp_state *state)
break;
case 'r':
- /*FIXME*/
force_remove = 1;
break;
@@ -2099,6 +2099,8 @@ struct server_config_stmt {
mu_acl_t acl;
size_t max_children;
mfd_server_func_t server;
+ int single_process;
+ int reuseaddr;
};
static struct server_config_stmt server_config_stmt;
@@ -2126,6 +2128,12 @@ struct mu_cfg_param server_section_param[] = {
&server_config_stmt.max_children, 0,
NULL,
N_("Maximum number of instances allowed for this server.") },
+ { "single-process", mu_cfg_bool,
+ &server_config_stmt.single_process, 0, NULL,
+ N_("Single-process mode.") },
+ { "reuseaddr", mu_cfg_bool,
+ &server_config_stmt.reuseaddr, 0, NULL,
+ N_("Reuse existing socket (default).") },
{ "acl", mu_cfg_section,
&server_config_stmt.acl },
{ NULL }
@@ -2141,6 +2149,7 @@ server_section_parser(enum mu_cfg_section_stage stage,
switch (stage) {
case mu_cfg_section_start:
memset(&server_config_stmt, 0, sizeof(server_config_stmt));
+ server_config_stmt.reuseaddr = 1;
if (mu_cfg_assert_value_type (node->label, MU_CFG_STRING,
tree->debug))
return 1;
@@ -2160,10 +2169,17 @@ server_section_parser(enum mu_cfg_section_stage stage,
if (!server_config_stmt.id)
server_config_stmt.id = next_server_id();
if (server_config_stmt.url && server_config_stmt.server) {
- mfd_server_t srv =
- mfd_server_new(server_config_stmt.id,
- server_config_stmt.url,
- server_config_stmt.server);
+ int flags = 0;
+ mfd_server_t srv;
+
+ if (server_config_stmt.single_process)
+ flags |= SRV_SINGLE_PROCESS;
+ if (!server_config_stmt.reuseaddr)
+ flags |= SRV_KEEP_EXISTING;
+ srv = mfd_server_new(server_config_stmt.id,
+ server_config_stmt.url,
+ server_config_stmt.server,
+ flags);
if (srv) {
mfd_server_set_max_children(srv,
server_config_stmt.max_children);
@@ -2202,6 +2218,22 @@ cb_milter_listen(mu_debug_t err, void *data, mu_config_value_t *arg)
}
+static int
+cb_callout_url(mu_debug_t err, void *data, mu_config_value_t *arg)
+{
+ mu_url_t url;
+ if (mu_cfg_assert_value_type(arg, MU_CFG_STRING, err))
+ return 1;
+ url = parse_milter_url(err, arg->v.string);
+ if (url) {
+ callout_server_sa = srvman_url_to_sockaddr(url,
+ &callout_server_sa_len);
+ mu_url_destroy(&url);
+ }
+ return 0;
+}
+
+
struct mu_cfg_param mf_cfg_param[] = {
{ "debug", mu_cfg_callback, NULL, 0, cb_debug,
N_("Set Mailfromd debug verbosity level. Argument is a comma-"
@@ -2292,6 +2324,13 @@ struct mu_cfg_param mf_cfg_param[] = {
N_("file: string") },
{ "database", mu_cfg_section, NULL },
+
+ { "callout-url", mu_cfg_callback,
+ NULL, 0,
+ cb_callout_url,
+ N_("URL of the callout server"),
+ N_("url") },
+
{ NULL }
};

Return to:

Send suggestions and report system problems to the System administrator.