summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2018-11-08 21:15:09 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-11-08 21:15:09 (GMT)
commit90c1c828099d2703fe0eb44b09d5cd3fd67a97fe (patch) (side-by-side diff)
treec825a296693dd7c737afc3ba8cb27fcdf97f8b5e
parent40f3d1c9374c8f2330655acb856b8ecf9bde0767 (diff)
downloadmailfromd-90c1c828099d2703fe0eb44b09d5cd3fd67a97fe.tar.gz
mailfromd-90c1c828099d2703fe0eb44b09d5cd3fd67a97fe.tar.bz2
mtasim: don't clobber existing callout socket when used with -Xauto
* doc/mailfromd.texi: Document the --callout-socket option. * mtasim/mtasim.c (start_mailfromd): Supply the --callout-socket option. * src/main.c: New option --callout-socket
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--doc/mailfromd.texi7
-rw-r--r--mtasim/mtasim.c12
-rw-r--r--src/main.c21
3 files changed, 32 insertions, 8 deletions
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index 704cd03..74dedfd 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -9785,6 +9785,11 @@ Run in test mode. @xref{Testing Filter Scripts}. Default @var{state} is
@subsection General Settings
@table @option
+@opsummary{callout-socket, mailfromd}
+@item --callout-socket=@var{string}
+Set socket for the default callout server.
+This is mainly useful together with the @option{--mtasim} option.
+
@opsummary{foreground, mailfromd}
@item --foreground
Stay in foreground. When given this option, @command{mailfromd} will
@@ -9826,8 +9831,10 @@ implemented: @samp{0}, meaning no optimization, and @samp{1}, meaning
full optimization.
@opsummary{port, mailfromd}
+@opsummary{milter-socket, mailfromd}
@item -p @var{string}
@itemx --port=@var{string}
+@itemx --milter-socket=@var{string}
Set communication socket. Overrides the @code{listen} configuration
statement, which you are advised to use instead (@pxref{conf-milter, listen}).
diff --git a/mtasim/mtasim.c b/mtasim/mtasim.c
index c7b09ad..ee910e7 100644
--- a/mtasim/mtasim.c
+++ b/mtasim/mtasim.c
@@ -874,9 +874,8 @@ start_mailfromd (int argc, char **argv)
exit (EX_OSERR);
}
atexit (stop_mailfromd);
-
- milter_port = mu_strdup ("unix:/tmp/mtasim-XXXXXX/socket");
- memcpy (milter_port + 5, tmpdir, strlen (tmpdir));
+
+ mu_asprintf (&milter_port, "unix://%s/milter", tmpdir);
signal (SIGCHLD, sig_child);
@@ -890,9 +889,12 @@ start_mailfromd (int argc, char **argv)
if (child_pid == 0)
{
- int xargc = argc + 5 + (statedir_option ? 2 : 0);
+ int xargc = argc + 7 + (statedir_option ? 2 : 0);
char **xargv = mu_alloc ((xargc + 1) * sizeof xargv[0]);
int i;
+ char *callout_port = NULL;
+
+ mu_asprintf (&callout_port, "unix://%s/callout", tmpdir);
xargv[0] = "mailfromd";
for (i = 1; i <= argc; i++)
@@ -900,6 +902,8 @@ start_mailfromd (int argc, char **argv)
xargv[i++] = "--mtasim";
xargv[i++] = "--port";
xargv[i++] = milter_port;
+ xargv[i++] = "--callout-socket";
+ xargv[i++] = callout_port;
if (statedir_option)
{
xargv[i++] = "--state-directory";
diff --git a/src/main.c b/src/main.c
index 15113a6..6aa8acf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -341,13 +341,22 @@ opt_include_dir(struct mu_parseopt *po, struct mu_option *op,
}
static void
-opt_port(struct mu_parseopt *po, struct mu_option *op,
- char const *arg)
+opt_milter_socket(struct mu_parseopt *po, struct mu_option *op,
+ char const *arg)
{
mf_srvcfg_add("default", arg);
}
static void
+opt_callout_socket(struct mu_parseopt *po, struct mu_option *op,
+ char const *arg)
+{
+ mf_srvcfg_add("callout", arg);
+ free(callout_server_url);
+ callout_server_url = mu_strdup(arg);
+}
+
+static void
opt_mtasim(struct mu_parseopt *po, struct mu_option *op,
char const *arg)
{
@@ -552,7 +561,11 @@ static struct mu_option mailfromd_options[] = {
mu_c_string, NULL, opt_include_dir },
{ "port", 'p', N_("STRING"), MU_OPTION_DEFAULT,
N_("set communication socket"),
- mu_c_string, NULL, opt_port },
+ mu_c_string, NULL, opt_milter_socket },
+ { "milter-socket", 0, NULL, MU_OPTION_ALIAS },
+ { "callout-socket", 0, N_("STRING"), MU_OPTION_DEFAULT,
+ N_("set callout socket"),
+ mu_c_string, NULL, opt_callout_socket },
{ "mtasim", 0, NULL, MU_OPTION_IMMEDIATE,
N_("run in mtasim compatibility mode"),
mu_c_string, NULL, opt_mtasim },
@@ -1127,7 +1140,7 @@ provide_default_milter_server(void)
}
static void
-provide_default_callout_server()
+provide_default_callout_server(void)
{
struct variable *var;

Return to:

Send suggestions and report system problems to the System administrator.