diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-01-14 17:26:09 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-01-14 17:26:09 +0000 |
commit | 45eeba7b56aaca8d605e428029bbf92498d2b845 (patch) | |
tree | 62c598e348b82fa8d83d0b9cc5c44e7845b51253 | |
parent | a22cd161c62c05cb299d7efcc91c8f8b7e6089b6 (diff) | |
download | mailfromd-45eeba7b56aaca8d605e428029bbf92498d2b845.tar.gz mailfromd-45eeba7b56aaca8d605e428029bbf92498d2b845.tar.bz2 |
* src/main.c, smap/smap.c, pies/pies.c, pies/progman.c,
pies/pies.h, pmult/pmult.c: Sync with MY CVS: Use mu_log_facility
and mu_log_tag.
* gacopyz/gacopyz.h (struct gacopyz_milter_descr): New member
xxfi_accept.
* gacopyz/gacopyz.c (gacopyz_handle_connection): Close connection
immediately if conn->desc.xxfi_accept return 1.
git-svn-id: file:///svnroot/mailfromd/branches/gmach@1565 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | gacopyz/gacopyz.c | 9 | ||||
-rw-r--r-- | gacopyz/gacopyz.h | 7 | ||||
-rw-r--r-- | pies/pies.c | 7 | ||||
-rw-r--r-- | pies/pies.h | 1 | ||||
-rw-r--r-- | pies/progman.c | 4 | ||||
-rw-r--r-- | pmult/pmult.c | 11 | ||||
-rw-r--r-- | smap/smap.c | 11 | ||||
-rw-r--r-- | src/main.c | 14 |
9 files changed, 33 insertions, 33 deletions
@@ -1,5 +1,7 @@ 2008-01-14 Sergey Poznyakoff <gray@gnu.org.ua> + * src/main.c, smap/smap.c, pies/pies.c, + * src/mailfromd.h, src/engine.c, src/smap.c: Use uniform startup and shutdown messages. diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c index 4e28161b..98926384 100644 --- a/gacopyz/gacopyz.c +++ b/gacopyz/gacopyz.c @@ -1460,6 +1460,15 @@ gacopyz_handle_connection(gacopyz_conn_t conn) return MI_FAILURE; } + if (conn->desc.xxfi_accept + && conn->desc.xxfi_accept(conn, fd, &addr)) { + if (GACOPYZ_CONN_LOG_MATCH(conn, SMI_LOG_DEBUG)) + gacopyz_log(SMI_LOG_DEBUG, + _("connection refused by xxfi_accept")); + close (fd); + return MI_SUCCESS; + } + if (!conn->foreground) { pid_t pid = fork(); if (pid == -1) { diff --git a/gacopyz/gacopyz.h b/gacopyz/gacopyz.h index ec20ff9b..180b5097 100644 --- a/gacopyz/gacopyz.h +++ b/gacopyz/gacopyz.h @@ -202,10 +202,11 @@ struct gacopyz_milter_descr /* Extensions: */ - int (*xxfi_start) (void); /* Child start callback */ - int (*xxfi_finish) (void); /* Child finish callback */ + int (*xxfi_start) (); /* Child start callback */ + int (*xxfi_finish) (); /* Child finish callback */ int (*xxfi_idle) (gacopyz_conn_t); /* Idle handler */ - + int (*xxfi_accept) (gacopyz_conn_t, int, const milter_sockaddr_t *); + int logmask; struct timeval ctx_timeout; }; diff --git a/pies/pies.c b/pies/pies.c index 7fcde346..52572863 100644 --- a/pies/pies.c +++ b/pies/pies.c @@ -17,7 +17,6 @@ #include "pies.h" int log_to_stderr; /* Use stderr for logging */ -char *syslog_tag; /* Tag to mark syslog entries with. */ mu_log_level_t debug_level; mu_debug_t pmult_debug; struct pies_privs_data pies_user; @@ -40,7 +39,7 @@ log_setup (int want_stderr) if (!want_stderr) { - openlog (syslog_tag, LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); mu_debug_default_printer = mu_debug_syslog_printer; } @@ -252,9 +251,6 @@ _cb_debug (mu_debug_t debug, void *data, char *arg) struct mu_cfg_param pies_cfg_param[] = { { "component", mu_cfg_section }, - /* MU-FIXME: */ - { "log-tag", mu_cfg_string, &syslog_tag, 0, NULL, - N_("Set syslog tag string.") }, { "debug", mu_cfg_callback, NULL, 0, _cb_debug, N_("Set debug verbosity level.") }, { "pidfile", mu_cfg_string, &pidfile, 0, NULL, @@ -667,7 +663,6 @@ main (int argc, char **argv) program_invocation_short_name = argv[0]; argp_program_version_hook = version; /* Set default logging */ - log_facility = DEFAULT_LOG_FACILITY; log_setup (!stderr_closed_p ()); component_cfg_init (); mu_argp_init (program_version, package_bugreport); diff --git a/pies/pies.h b/pies/pies.h index 94c8ded1..59d06372 100644 --- a/pies/pies.h +++ b/pies/pies.h @@ -36,6 +36,7 @@ #include <mailutils/mailutils.h> #include <mailutils/daemon.h> #include <mailutils/libargp.h> +#include <mailutils/syslog.h> #include "xalloc.h" #include "libmf.h" diff --git a/pies/progman.c b/pies/progman.c index 385a1258..c5be39c2 100644 --- a/pies/progman.c +++ b/pies/progman.c @@ -277,7 +277,7 @@ open_retranslator (struct prog *master, int type) if (fp == NULL) exit (1); - openlog (master->tag, LOG_PID, log_facility); + openlog (master->tag, LOG_PID, mu_log_facility); while (getline (&buf, &size, fp) > 0) syslog (master->v.p.retr[type], "%s", buf); @@ -379,7 +379,7 @@ prog_start (struct prog *prog) umask (prog->v.p.umask); execvp (prog->v.p.argv[0], prog->v.p.argv); - openlog (syslog_tag, LOG_PID, log_facility); + openlog (MU_LOG_TAG(), LOG_PID, mu_log_facility); syslog (LOG_CRIT, _("cannot start `%s': %s"), prog->tag, mu_strerror (errno)); exit (1); diff --git a/pmult/pmult.c b/pmult/pmult.c index cb746034..e28dba1b 100644 --- a/pmult/pmult.c +++ b/pmult/pmult.c @@ -22,6 +22,7 @@ #include <syslog.h> #include <mailutils/mailutils.h> #include <mailutils/daemon.h> +#include <mailutils/syslog.h> #include <mailutils/libargp.h> #include <sysexits.h> #include <pthread.h> @@ -67,7 +68,6 @@ const char *package_bugreport = "<" PACKAGE_BUGREPORT ">"; char *portspec; /* Communication socket */ int log_to_stderr; /* Use stderr for logging */ -char *syslog_tag; /* Tag to mark syslog entries with. */ mu_log_level_t debug_level; /* Debug verbosity level */ mu_debug_t pmult_debug; /* Debugging object */ char *pidfile; /* pidfile name */ @@ -121,7 +121,7 @@ log_setup (int want_stderr) if (!want_stderr) { - openlog (syslog_tag, LOG_PID, log_facility); + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); gacopyz_set_logger (gacopyz_syslog_log_printer); mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); mu_debug_default_printer = mu_debug_syslog_printer; @@ -357,9 +357,6 @@ struct mu_cfg_param pmult_cfg_param[] = { N_("Listen for milter requests on the given URL."), N_("url") }, { "client", mu_cfg_section }, - /* MU-FIXME: */ - { "log-tag", mu_cfg_string, &syslog_tag, 0, NULL, - N_("Set syslog tag string.") }, { "debug", mu_cfg_callback, NULL, 0, _cb_debug, N_("Set debug verbosity level.") }, { "pidfile", mu_cfg_string, &pidfile, 0, NULL, @@ -1485,7 +1482,6 @@ main (int argc, char **argv) program_invocation_short_name = argv[0]; argp_program_version_hook = version; /* Set default logging */ - log_facility = DEFAULT_LOG_FACILITY; log_setup (!stderr_closed_p ()); pmult_cfg_init (); @@ -1495,9 +1491,6 @@ main (int argc, char **argv) if (rc) exit (EX_CONFIG); - if (!syslog_tag) - syslog_tag = xstrdup (mu_program_name); - log_setup (log_to_stderr); if (!portspec) diff --git a/smap/smap.c b/smap/smap.c index 2afe4492..54a01e1f 100644 --- a/smap/smap.c +++ b/smap/smap.c @@ -33,6 +33,7 @@ #include <sysexits.h> /* FIXME */ #include <mailutils/mailutils.h> #include <mailutils/daemon.h> +#include <mailutils/syslog.h> #include <mailutils/server.h> #include <mailutils/libargp.h> #include <mailutils/libcfg.h> @@ -378,7 +379,9 @@ logging_setup () { mu_debug_t debug; - openlog (syslog_tag, LOG_PID, log_facility); + if (syslog_tag) + mu_log_tag = syslog_tag; + openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility); mu_diag_get_debug (&debug); mu_debug_set_print (debug, mu_diag_syslog_printer, NULL); mu_debug_default_printer = mu_debug_syslog_printer; @@ -406,12 +409,6 @@ main (int argc, char **argv) mf_init_nls (); - syslog_tag = strrchr (argv[0], '/'); - if (syslog_tag) - syslog_tag++; - else - syslog_tag = argv[0]; - MU_AUTH_REGISTER_ALL_MODULES (); mu_acl_cfg_init (); mu_m_server_cfg_init (); @@ -36,6 +36,7 @@ #include <mailutils/mailutils.h> #include <mailutils/server.h> +#include <mailutils/syslog.h> #include <mailutils/libargp.h> #include "mailfromd.h" @@ -1372,9 +1373,6 @@ parse_opt (int key, char *arg, struct argp_state *state) if (validate_options()) exit(EX_USAGE); - if (!syslog_tag) - syslog_tag = program_invocation_short_name; - if (!format_option) format_option = db_format_lookup("cache"); break; @@ -1882,17 +1880,22 @@ log_setup(int want_stderr) mu_debug_t debug; mu_diag_get_debug (&debug); + + /* Eventually override syslog tag from the command line. */ + if (syslog_tag) + mu_log_tag = syslog_tag; /* Set up logging */ if (!want_stderr) { #ifdef USE_SYSLOG_ASYNC if (use_syslog_async) { - openlog_async(syslog_tag, LOG_PID, log_facility); + openlog_async(MU_LOG_TAG(), LOG_PID, + mu_log_facility); gacopyz_set_logger(mf_gacopyz_syslog_async_log_printer); } else #endif { - openlog(syslog_tag, LOG_PID, log_facility); + openlog(MU_LOG_TAG(), LOG_PID, mu_log_facility); gacopyz_set_logger(gacopyz_syslog_log_printer); } @@ -1936,7 +1939,6 @@ main(int argc, char **argv) yy_flex_debug = 0; /* Set default logging */ - log_facility = DEFAULT_LOG_FACILITY; log_setup(!stderr_closed_p()); init_names(); |