Mercurial > dovecot > core-2.2
changeset 1693:552514c014cc HEAD
Allow one parameter for mail_executable.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 21 Aug 2003 01:12:44 +0300 |
parents | e5e5ca4aa466 |
children | 0fae24674a9a |
files | src/master/mail-process.c src/master/master-settings.c |
diffstat | 2 files changed, 22 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/mail-process.c Wed Aug 20 06:17:25 2003 +0300 +++ b/src/master/mail-process.c Thu Aug 21 01:12:44 2003 +0300 @@ -135,9 +135,10 @@ struct ip_addr *ip, struct auth_master_reply *reply, const char *data) { - static const char *argv[] = { NULL, NULL, NULL }; + const char *argv[4]; struct settings *set = group->set; const char *addr, *mail, *user, *chroot_dir, *home_dir, *full_home_dir; + const char *executable, *p; char title[1024]; pid_t pid; int i, err, ret; @@ -285,13 +286,14 @@ addr = net_ip2addr(ip); env_put(t_strconcat("IP=", addr, NULL)); - if (set->verbose_proctitle) { + if (!set->verbose_proctitle) + title[0] = '\0'; + else { if (addr == NULL) addr = "??"; i_snprintf(title, sizeof(title), "[%s %s]", data + reply->virtual_user_idx, addr); - argv[1] = title; } /* make sure we don't leak syslog fd, but do it last so that @@ -301,14 +303,23 @@ if (set->mail_drop_priv_before_exec) restrict_access_by_env(TRUE); + /* very simple argument splitting. */ + i = 0; + argv[i++] = executable = t_strcut(group->set->mail_executable, ' '); + argv[i] = strchr(group->set->mail_executable, ' '); + if (argv[i] != NULL) { + argv[i]++; + i++; + } + if (title[0] != '\0') + argv[i++] = title; + argv[i] = NULL; + /* hide the path, it's ugly */ - argv[0] = strrchr(group->set->mail_executable, '/'); - if (argv[0] == NULL) - argv[0] = group->set->mail_executable; - else - argv[0]++; + p = strrchr(argv[0], '/'); + if (p != NULL) argv[0] = p+1; - execv(group->set->mail_executable, (char **) argv); + execv(executable, (char **) argv); err = errno; for (i = 0; i < 3; i++)
--- a/src/master/master-settings.c Wed Aug 20 06:17:25 2003 +0300 +++ b/src/master/master-settings.c Thu Aug 21 01:12:44 2003 +0300 @@ -359,9 +359,9 @@ if (!get_login_uid(set)) return FALSE; - if (access(set->mail_executable, X_OK) < 0) { + if (access(t_strcut(set->mail_executable, ' '), X_OK) < 0) { i_error("Can't use mail executable %s: %m", - set->mail_executable); + t_strcut(set->mail_executable, ' ')); return FALSE; }