summaryrefslogtreecommitdiffabout
path: root/src/main.c
authorSergey Poznyakoff <gray@gnu.org.ua>2010-08-23 20:19:53 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2010-08-23 20:19:53 (GMT)
commit50d046dac9846cb7fc11af82eb1a1daedd66b6c3 (patch) (side-by-side diff)
treeac49ede2076f9bd673b5b10d1037abcaf52ad50d /src/main.c
parent4d488a2f7a8128b7d75eecb060065f9bffa8df86 (diff)
downloadmailfromd-50d046dac9846cb7fc11af82eb1a1daedd66b6c3.tar.gz
mailfromd-50d046dac9846cb7fc11af82eb1a1daedd66b6c3.tar.bz2
Bugfixes.
* lib/filenames.h (DEFAULT_PIDFILE): Remove. * lib/logger.c (loggertab): Add syslog_async_fdset method for syslog:async. * src/Makefile.am (mfd-dbgmod.h): Kik off libcallout_a_SOURCES. * src/calloutd.c (_log_setup, mf_server_log_setup): Remove. (main): Call mf_srvcfg_log_setup. Update call to mf_srvcfg_init. * src/engine.c (setprocid): New static function. (mfd_callout_session_server): New function. * src/lex.l (lex_new_source_0): Bugfux. * src/mailfromd.h (mfd_callout_session_server): New proto. * src/main.c (mf_diag_syslog_printer, _log_setup) (mf_server_log_setup): Remove. (main): Call mf_srvcfg_log_setup. Update call to mf_srvcfg_init. * src/savsrv.c: Include signal.h (vrfy_state): New enum. (vrfy_queue)<state>: New member. (verify): Use rc and qp->state to decide whether to process the entry. This still needs some more work, though. (addq): Initialize qp->state. (cmd_run): Update qp->state. (callout_session_server): Ignore SIGPIPE and SIGALRM. * src/srvcfg.c (srv_options): Remove 's' option. (srv_parse_opt): Logger options update optcache. (setdefpidfilename): New static function. (mf_srvcfg_init): Take program invocation name as the first argument. Construct pidfile name based on it, unless pidfile has already been initialized. Done update srvman_param.keepfds (see mf_srvcfg_log_setup). Initialize syslog_tag. (mf_diag_syslog_printer, mf_debug_syslog_printer): New functions. (mf_srvcfg_log_setup): New function. * src/srvcfg.h (mf_srvcfg_init): Change signature.
Diffstat (limited to 'src/main.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/main.c55
1 files changed, 5 insertions, 50 deletions
diff --git a/src/main.c b/src/main.c
index 1620fa2..c779406 100644
--- a/src/main.c
+++ b/src/main.c
@@ -133,19 +133,6 @@ mfd_gacopyz_log_printer(int level, char *fmt, va_list ap)
vlogmsg(level, fmt, ap);
}
-int
-mf_diag_syslog_printer (void *data, mu_log_level_t level, const char *buf)
-{
- int len = strlen (buf);
- if (len > 0 && buf[len-1] == '\n') {
- len--;
- if (len > 0 && buf[len-1] == '\r')
- len--;
- }
- logmsg(mu_diag_level_to_syslog(level), "%-.*s", len, buf);
- return 0;
-}
-
void
trace(const char *fmt, ...)
{
@@ -1034,35 +1021,6 @@ mailfromd_show_defaults()
}
static void
-_log_setup(const char *tag, char *stream)
-{
- mu_debug_t debug;
-
- mu_diag_get_debug (&debug);
-
- if (logger_select(stream)) {
- mu_error(_("unsupported logger stream: %s"), stream);
- exit(EX_USAGE);
- }
- logger_open(tag, LOG_PID, mu_log_facility);
- gacopyz_set_logger(mfd_gacopyz_log_printer);
-
- /* FIXME */
- if (strcmp(stream, "stderr") == 0) {
- mu_debug_default_printer = mu_debug_stderr_printer;
- } else {
- mu_debug_set_print (debug, mf_diag_syslog_printer, NULL);
- mu_debug_default_printer = mu_debug_syslog_printer;
- }
-}
-
-void
-mf_server_log_setup(void)
-{
- _log_setup(syslog_tag, log_stream);
-}
-
-static void
version(FILE *stream, struct argp_state *state)
{
mailfromd_version("mailfromd", stream);
@@ -1126,7 +1084,7 @@ mf_server_function(const char *key, struct mf_srvcfg *cfg)
if (!key || strcmp(key, "default") == 0 || strcmp(key, "milter") == 0)
cfg->server = milter_session_server;
else if (strcmp(key, "callout") == 0) {
- cfg->server = callout_session_server;
+ cfg->server = mfd_callout_session_server;
if (cfg->defopt ||
mu_list_locate(cfg->options, "default", NULL) == 0)
callout_server_url =
@@ -1160,7 +1118,9 @@ main(int argc, char **argv)
/* Set default logging */
mu_log_facility = DEFAULT_LOG_FACILITY;
- _log_setup(MU_LOG_TAG(), stderr_closed_p() ? "syslog" : "stderr");
+ gacopyz_set_logger(mfd_gacopyz_log_printer);
+ mf_srvcfg_log_setup(MU_LOG_TAG(),
+ stderr_closed_p() ? "syslog" : "stderr");
debug_init(modnames);
libcallout_init();
@@ -1178,7 +1138,7 @@ main(int argc, char **argv)
mu_acl_cfg_init();
database_cfg_init();
srvman_init();
- mf_srvcfg_init(N_("(milter | callout)"));
+ mf_srvcfg_init(argv[0], N_("(milter | callout)"));
mu_argp_init(program_version, "<" PACKAGE_BUGREPORT ">");
mu_app_rcfile = DEFAULT_CONFIG_FILE;
@@ -1236,11 +1196,6 @@ main(int argc, char **argv)
fixup_create_script();
- /* Make sure syslog_tag is properly set */
- /* FIXME: Move this to logger.c? */
- if (!syslog_tag)
- syslog_tag = (char*) MU_LOG_TAG();
-
if (script_dump_tree)
print_syntax_tree();
if (script_dump_code)

Return to:

Send suggestions and report system problems to the System administrator.