[dovecot-cvs] dovecot/src/master mail-process.c,1.30,1.31
master-settings.c,1.24,1.25
cras at procontrol.fi
cras at procontrol.fi
Thu Aug 21 02:12:47 EEST 2003
Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv15520
Modified Files:
mail-process.c master-settings.c
Log Message:
Allow one parameter for mail_executable.
Index: mail-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- mail-process.c 3 Aug 2003 18:54:56 -0000 1.30
+++ mail-process.c 20 Aug 2003 22:12:44 -0000 1.31
@@ -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++)
Index: master-settings.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- master-settings.c 27 Jul 2003 05:37:58 -0000 1.24
+++ master-settings.c 20 Aug 2003 22:12:44 -0000 1.25
@@ -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;
}
More information about the dovecot-cvs
mailing list