mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-07 06:06:08 +00:00
added --privileged-binary-patch-arg and --unprivileged-binary-patch-arg
This commit is contained in:
@@ -737,6 +737,10 @@ void uwsgi_as_root() {
|
||||
uwsgi_error("execvp()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (uwsgi.unprivileged_binary_patch_arg) {
|
||||
uwsgi_exec_command_with_args(uwsgi.unprivileged_binary_patch_arg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (uwsgi.chroot && !uwsgi.is_a_reload) {
|
||||
@@ -3375,6 +3379,17 @@ void uwsgi_sig_pause() {
|
||||
sigsuspend(&mask);
|
||||
}
|
||||
|
||||
void uwsgi_exec_command_with_args(char *cmdline) {
|
||||
char *argv[4];
|
||||
argv[0] = "/bin/sh";
|
||||
argv[1] = "-c";
|
||||
argv[2] = cmdline;
|
||||
argv[3] = NULL;
|
||||
execvp(argv[0], argv);
|
||||
uwsgi_error("execvp()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int uwsgi_run_command_and_wait(char *command, char *arg) {
|
||||
|
||||
char *argv[4];
|
||||
|
||||
+10
-6
@@ -2013,12 +2013,16 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
}
|
||||
|
||||
// we could now patch the binary
|
||||
if (uwsgi.privileged_binary_patch) {
|
||||
uwsgi.argv[0] = uwsgi.privileged_binary_patch;
|
||||
execvp(uwsgi.privileged_binary_patch, uwsgi.argv);
|
||||
uwsgi_error("execvp()");
|
||||
exit(1);
|
||||
}
|
||||
if (uwsgi.privileged_binary_patch) {
|
||||
uwsgi.argv[0] = uwsgi.privileged_binary_patch;
|
||||
execvp(uwsgi.privileged_binary_patch, uwsgi.argv);
|
||||
uwsgi_error("execvp()");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (uwsgi.privileged_binary_patch_arg) {
|
||||
uwsgi_exec_command_with_args(uwsgi.privileged_binary_patch_arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1351,6 +1351,8 @@ struct uwsgi_server {
|
||||
|
||||
char *privileged_binary_patch;
|
||||
char *unprivileged_binary_patch;
|
||||
char *privileged_binary_patch_arg;
|
||||
char *unprivileged_binary_patch_arg;
|
||||
|
||||
struct uwsgi_logger *loggers;
|
||||
struct uwsgi_logger *choosen_logger;
|
||||
@@ -3141,6 +3143,8 @@ void emperor_stop(struct uwsgi_instance *);
|
||||
void emperor_respawn(struct uwsgi_instance *, time_t);
|
||||
void emperor_add(struct uwsgi_emperor_scanner *, char *, time_t, char *, uint32_t, uid_t, gid_t);
|
||||
|
||||
void uwsgi_exec_command_with_args(char *);
|
||||
|
||||
#ifdef UWSGI_AS_SHARED_LIBRARY
|
||||
int uwsgi_init(int, char **, char **);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user