#include "str.h"
#include "buffer.h"
#include "base64.h"
+#include "execv-const.h"
#include "istream.h"
#include "ostream.h"
args[0] = set->winbind_helper_path;
args[1] = winbind->param;
args[2] = NULL;
- execv(args[0], (void *)args);
- i_fatal("execv(%s) failed: %m", args[0]);
+ execv_const(args[0], args);
}
/* parent */
/* Copyright (c) 2004-2010 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
+#include "execv-const.h"
#include "passdb.h"
#ifdef PASSDB_CHECKPASSWORD
"execute: %s", cmd);
args = t_strsplit(cmd, " ");
- execv(args[0], (char **)args);
- auth_request_log_error(request, "checkpassword",
- "execv(%s) failed: %m", args[0]);
+ execv_const(args[0], args);
}
exit(2);
}
/* Copyright (c) 2004-2010 Dovecot authors, see the included COPYING file */
#include "auth-common.h"
+#include "execv-const.h"
#include "userdb.h"
#ifdef USERDB_CHECKPASSWORD
"execute: %s", cmd);
args = t_strsplit(cmd, " ");
- execv(args[0], (char **)args);
- auth_request_log_error(request, "userdb-checkpassword",
- "execv(%s) failed: %m", args[0]);
+ execv_const(args[0], args);
}
exit(2);
}
/* Copyright (c) 2009-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
+#include "execv-const.h"
#include "settings-parser.h"
#include "master-service.h"
#include "master-service-settings.h"
static void run_cmd(const char *cmd, int *fd_in_r, int *fd_out_r)
{
- char **args;
+ const char *const *args;
int fd_in[2], fd_out[2];
if (pipe(fd_in) < 0 || pipe(fd_out) < 0)
(void)close(fd_out[0]);
(void)close(fd_out[1]);
- args = p_strsplit(pool_datastack_create(), cmd, " ");
- (void)execvp(args[0], args);
- i_fatal("execve(%s) failed: %m", args[0]);
+ args = t_strsplit(cmd, " ");
+ execvp_const(args[0], args);
break;
default:
/* parent */
/* Copyright (c) 2006-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
+#include "execv-const.h"
#include "master-service.h"
#include "lda-settings.h"
#include "mail-deliver.h"
master_service_env_clean(TRUE);
- (void)execv(sendmail_path, (void *)argv);
- i_fatal("execv(%s) failed: %m", sendmail_path);
+ execv_const(sendmail_path, argv);
}
struct smtp_client *
#include "istream.h"
#include "write-full.h"
#include "str.h"
+#include "execv-const.h"
#include "settings-parser.h"
#include "master-service-private.h"
#include "master-service-settings.h"
conf_argv[8] = binary_path;
memcpy(conf_argv+9, service->argv + 1,
(service->argc) * sizeof(conf_argv[0]));
- execv(conf_argv[0], (char **)conf_argv);
- i_fatal("execv(%s) failed: %m", conf_argv[0]);
+ execv_const(conf_argv[0], conf_argv);
}
static void
#include "hash.h"
#include "network.h"
#include "istream.h"
+#include "execv-const.h"
#include "str.h"
#include "strescape.h"
#include "var-expand.h"
if (dup2(fd[1], STDOUT_FILENO) < 0)
i_fatal("dup2() failed: %m");
- execv(argv[0], (void *)argv);
- i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", bin_path);
- return -1;
+ execv_const(argv[0], argv);
}
(void)close(fd[1]);
#include "env-util.h"
#include "hostpid.h"
#include "abspath.h"
+#include "execv-const.h"
#include "restrict-process-size.h"
#include "master-service.h"
#include "master-service-settings.h"
/* prefix with dovecot/ */
argv[0] = t_strconcat(PACKAGE"/", argv[0], NULL);
-
- (void)execv(executable, (char **)argv);
- i_fatal_status(errno == ENOMEM ? FATAL_OUTOFMEM : FATAL_EXEC,
- "execv(%s) failed: %m", executable);
+ (void)execv_const(executable, argv);
}
int get_uidgid(const char *user, uid_t *uid_r, gid_t *gid_r,
args[2] = "-c";
args[3] = master_service_get_config_path(master_service);
args[4] = NULL;
- execv(args[0], (char **)args);
- i_fatal("execv(%s) failed: %m", args[0]);
+ execv_const(args[0], args);
}
while (optind < argc) {
#include "lib.h"
#include "env-util.h"
+#include "execv-const.h"
#include "fdpass.h"
#include "restrict-access.h"
#include "str.h"
#define ENV_USERDB_KEYS "USERDB_KEYS"
#define SCRIPT_COMM_FD 3
-static char **exec_args;
+static const char **exec_args;
static bool drop_privileges = FALSE;
static void client_connected(const struct master_service_connection *conn)
if (close(MASTER_STATUS_FD) < 0)
i_error("close(status) failed: %m");
- (void)execvp(exec_args[0], exec_args);
- i_fatal("execvp(%s) failed: %m", exec_args[0]);
+ execvp_const(exec_args[0], exec_args);
}
static void script_execute_finish(void)
int main(int argc, char *argv[])
{
enum master_service_flags flags = 0;
- const char *path;
int i, c;
if (getenv(MASTER_UID_ENV) == NULL)
else {
if (argv[0] == NULL)
i_fatal("Missing script path");
- exec_args = i_new(char *, argc + 2);
+ exec_args = i_new(const char *, argc + 2);
for (i = 0; i < argc; i++)
exec_args[i] = argv[i];
exec_args[i] = PKG_LIBEXECDIR"/script";
exec_args[i+1] = NULL;
if (exec_args[0][0] != '/') {
- path = t_strconcat(PKG_LIBEXECDIR"/",
- exec_args[0], NULL);
- exec_args[0] = t_strdup_noconst(path);
+ exec_args[0] = t_strconcat(PKG_LIBEXECDIR"/",
+ exec_args[0], NULL);
}
master_service_run(master_service, client_connected);