[dovecot-cvs]
dovecot/src/master auth-process.c, 1.68, 1.69 common.h,
1.20, 1.21 login-process.c, 1.61, 1.62 mail-process.c, 1.62,
1.63 main.c, 1.57, 1.58 master-settings.c, 1.75, 1.76
cras at dovecot.org
cras at dovecot.org
Wed Nov 24 18:44:14 EET 2004
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.36,
1.37 mail-index-sync.c, 1.39, 1.40 mail-index-view-sync.c,
1.29, 1.30 mail-index.c, 1.166,
1.167 mail-transaction-log-view.c, 1.34, 1.35
- Next message: [dovecot-cvs] dovecot/src/login-common master.c,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv5806
Modified Files:
auth-process.c common.h login-process.c mail-process.c main.c
master-settings.c
Log Message:
Allow running all executables with parameters.
Index: auth-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- auth-process.c 22 Oct 2004 13:42:55 -0000 1.68
+++ auth-process.c 24 Nov 2004 16:44:11 -0000 1.69
@@ -349,7 +349,6 @@
static int create_auth_process(struct auth_process_group *group)
{
- static char *argv[] = { NULL, NULL };
struct auth_socket_settings *as;
const char *prefix, *str;
struct log_io *log;
@@ -468,15 +467,7 @@
any errors above will be logged */
closelog();
- /* hide the path, it's ugly */
- argv[0] = strrchr(group->set->executable, '/');
- if (argv[0] == NULL)
- argv[0] = i_strdup(group->set->executable);
- else
- argv[0]++;
-
- execv(group->set->executable, argv);
-
+ client_process_exec(group->set->executable, "");
i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m",
group->set->executable);
return -1;
Index: common.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/common.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- common.h 13 Oct 2004 16:38:35 -0000 1.20
+++ common.h 24 Nov 2004 16:44:11 -0000 1.21
@@ -38,6 +38,7 @@
hash_remove(pids, POINTER_CAST(pid))
void child_process_init_env(void);
+void client_process_exec(const char *cmd, const char *title);
/* misc */
#define VALIDATE_STR(str) \
Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- login-process.c 19 Oct 2004 01:17:39 -0000 1.61
+++ login-process.c 24 Nov 2004 16:44:11 -0000 1.62
@@ -445,7 +445,6 @@
static pid_t create_login_process(struct login_group *group)
{
- static const char *argv[] = { NULL, NULL };
struct log_io *log;
const char *prefix;
pid_t pid;
@@ -539,15 +538,7 @@
any errors above will be logged */
closelog();
- /* hide the path, it's ugly */
- argv[0] = strrchr(group->set->login_executable, '/');
- if (argv[0] == NULL)
- argv[0] = group->set->login_executable;
- else
- argv[0]++;
-
- execv(group->set->login_executable, (char **) argv);
-
+ client_process_exec(group->set->login_executable, "");
i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m",
group->set->login_executable);
return -1;
Index: mail-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- mail-process.c 20 Oct 2004 23:34:34 -0000 1.62
+++ mail-process.c 24 Nov 2004 16:44:11 -0000 1.63
@@ -251,30 +251,6 @@
}
}
-static void mail_process_exec_set(struct settings *set, const char *title)
-{
- const char *executable, *p, *argv[4];
- int i;
-
- /* very simple argument splitting. */
- i = 0;
- argv[i++] = executable = t_strcut(set->mail_executable, ' ');
- argv[i] = strchr(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 */
- p = strrchr(argv[0], '/');
- if (p != NULL) argv[0] = p+1;
-
- execv(executable, (char **) argv);
-}
-
void mail_process_exec(const char *protocol, const char *section)
{
struct server_settings *server = settings_root;
@@ -303,7 +279,7 @@
getenv("TCPREMOTEIP"), getpid());
mail_process_set_environment(set, getenv("MAIL"), var_expand_table);
- mail_process_exec_set(set, "");
+ client_process_exec(set->mail_executable, "");
i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m",
set->mail_executable);
@@ -469,7 +445,7 @@
if (set->mail_drop_priv_before_exec)
restrict_access_by_env(TRUE);
- mail_process_exec_set(set, title);
+ client_process_exec(set->mail_executable, title);
err = errno;
for (i = 0; i < 3; i++)
Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- main.c 12 Nov 2004 14:35:49 -0000 1.57
+++ main.c 24 Nov 2004 16:44:11 -0000 1.58
@@ -72,6 +72,25 @@
#endif
}
+void client_process_exec(const char *cmd, const char *title)
+{
+ const char *executable, *p, **argv;
+
+ /* very simple argument splitting. */
+ if (*title == '\0')
+ argv = t_strsplit(cmd, " ");
+ else
+ argv = t_strsplit(t_strconcat(cmd, " ", title), " ");
+
+ executable = argv[0];
+
+ /* hide the path, it's ugly */
+ p = strrchr(argv[0], '/');
+ if (p != NULL) argv[0] = p+1;
+
+ execv(executable, (char **)argv);
+}
+
static void sig_quit(int signo __attr_unused__)
{
io_loop_stop(ioloop);
Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- master-settings.c 21 Oct 2004 20:47:36 -0000 1.75
+++ master-settings.c 24 Nov 2004 16:44:11 -0000 1.76
@@ -385,8 +385,9 @@
auth->uid = pw->pw_uid;
auth->gid = pw->pw_gid;
- if (access(auth->executable, X_OK) < 0) {
- i_error("Can't use auth executable %s: %m", auth->executable);
+ if (access(t_strcut(auth->executable, ' '), X_OK) < 0) {
+ i_error("Can't use auth executable %s: %m",
+ t_strcut(auth->executable, ' '));
return FALSE;
}
@@ -579,9 +580,9 @@
return FALSE;
}
- if (access(set->login_executable, X_OK) < 0) {
+ if (access(t_strcut(set->login_executable, ' '), X_OK) < 0) {
i_error("Can't use login executable %s: %m",
- set->login_executable);
+ t_strcut(set->login_executable, ' '));
return FALSE;
}
- Previous message: [dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.36,
1.37 mail-index-sync.c, 1.39, 1.40 mail-index-view-sync.c,
1.29, 1.30 mail-index.c, 1.166,
1.167 mail-transaction-log-view.c, 1.34, 1.35
- Next message: [dovecot-cvs] dovecot/src/login-common master.c,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list