diff options
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 46 |
1 files changed, 45 insertions, 1 deletions
@@ -36,6 +36,11 @@ unsigned long shutdown_timeout = 5; pies_acl_t pies_acl; limits_record_t pies_limits; int force_option; +char *mailer_program = "/usr/sbin/sendmail"; +char *mailer_command_line = "/usr/sbin/sendmail -oi -t"; +int mailer_argc; +char **mailer_argv; + /* Logging */ @@ -1164,6 +1169,18 @@ struct grecs_keyword pies_keywords[] = { grecs_type_string, &meta1_queue_dir, 0, NULL, }, + {"mailer-program", + NULL, + N_("Full path to the mailer binary."), + grecs_type_string, &mailer_program, 0, + NULL + }, + {"mailer-command-line", + NULL, + N_("Mailer command line (without recipient addresses)."), + grecs_type_string, &mailer_command_line, 0, + NULL + }, {NULL} }; @@ -1258,6 +1275,7 @@ parse_opt (int key, char *arg, struct argp_state *state) switch (key) { case 't': + log_to_stderr = 1; lint_mode = 1; break; @@ -1274,6 +1292,7 @@ parse_opt (int key, char *arg, struct argp_state *state) exit (0); case OPT_FOREGROUND: + log_to_stderr = 1; foreground = 1; break; @@ -1670,6 +1689,28 @@ remove_pidfile (char *name) logmsg (LOG_ERR, _("cannot unlink pidfile `%s': %s"), name, strerror (errno)); } + + +static void +set_mailer_argcv () +{ + int i; + struct wordsplit ws; + + if (wordsplit (mailer_command_line, &ws, WRDSF_DEFFLAGS)) + { + logmsg (LOG_CRIT, _("cannot parse mailer command line: %s"), + strerror (errno)); + exit (EX_CONFIG); + } + mailer_argc = ws.ws_wordc; + mailer_argv = xcalloc (mailer_argc + 1, sizeof (mailer_argv[0])); + for (i = 0; i < mailer_argc; i++) + mailer_argv[i] = xstrdup (ws.ws_wordv[i]); + mailer_argv[i] = NULL; + wordsplit_free (&ws); +} + const char version_etc_copyright[] = /* Do *not* mark this string for translation. %s is a copyright @@ -1716,7 +1757,8 @@ main (int argc, char **argv) mf_proctitle_init (argc, argv, environ); /* Set default logging */ - log_setup (!stderr_closed_p ()); + log_to_stderr = !stderr_closed_p (); + log_setup (log_to_stderr); config_init (); argp_program_version_hook = version; if (argp_parse (&argp, argc, argv, 0, &index, NULL)) @@ -1728,6 +1770,8 @@ main (int argc, char **argv) if (grecs_parse (conffile)) exit (EX_CONFIG); + set_mailer_argcv (); + if (lint_mode) { progman_build_depmap (); |