Mercurial > dovecot > core-2.2
changeset 4334:23394b3a7879 HEAD
dovecot --exec-mail ext <binary path> now reads the default settings from
configuration file, puts them to environment and executes the given binary.
author | Timo Sirainen <timo.sirainen@movial.fi> |
---|---|
date | Mon, 12 Jun 2006 15:46:15 +0300 |
parents | 8bfdd3928097 |
children | 6dba897351bb |
files | src/master/mail-process.c |
diffstat | 1 files changed, 25 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/mail-process.c Mon Jun 12 15:27:29 2006 +0300 +++ b/src/master/mail-process.c Mon Jun 12 15:46:15 2006 +0300 @@ -307,23 +307,33 @@ struct server_settings *server = settings_root; const struct var_expand_table *var_expand_table; struct settings *set; + const char *executable; - if (section != NULL) { - for (; server != NULL; server = server->next) { - if (strcmp(server->name, section) == 0) - break; + if (strcmp(protocol, "ext") == 0) { + /* external binary. section contains path for it. */ + if (section == NULL) + i_fatal("External binary parameter not given"); + set = server->defaults; + executable = section; + } else { + if (section != NULL) { + for (; server != NULL; server = server->next) { + if (strcmp(server->name, section) == 0) + break; + } + if (server == NULL) + i_fatal("Section not found: '%s'", section); } - if (server == NULL) - i_fatal("Section not found: '%s'", section); + + if (strcmp(protocol, "imap") == 0) + set = server->imap; + else if (strcmp(protocol, "pop3") == 0) + set = server->pop3; + else + i_fatal("Unknown protocol: '%s'", protocol); + executable = set->mail_executable; } - if (strcmp(protocol, "imap") == 0) - set = server->imap; - else if (strcmp(protocol, "pop3") == 0) - set = server->pop3; - else - i_fatal("Unknown protocol: '%s'", protocol); - var_expand_table = get_var_expand_table(protocol, getenv("USER"), getenv("HOME"), getenv("TCPLOCALIP"), @@ -331,10 +341,9 @@ getpid(), geteuid()); mail_process_set_environment(set, getenv("MAIL"), var_expand_table); - client_process_exec(set->mail_executable, ""); + client_process_exec(executable, ""); - i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", - set->mail_executable); + i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable); } static void nfs_warn_if_found(const char *mail, const char *home)