mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-05 05:01:36 +00:00
added hook_as_emperor_setns
This commit is contained in:
+15
-1
@@ -748,8 +748,22 @@ void uwsgi_hooks_setns_run(struct uwsgi_string_list *l, pid_t pid, uid_t uid, gi
|
||||
}
|
||||
|
||||
// now run the action and then exit
|
||||
exit(0);
|
||||
action++;
|
||||
char *colon = strchr(action, ':');
|
||||
if (!colon) {
|
||||
uwsgi_log("invalid hook syntax must be action:arg\n");
|
||||
exit(1);
|
||||
}
|
||||
*colon = 0;
|
||||
struct uwsgi_hook *uh = uwsgi_hook_by_name(action);
|
||||
if (!uh) {
|
||||
uwsgi_log("hook action not found: %s\n", action);
|
||||
exit(1);
|
||||
}
|
||||
*colon = ':';
|
||||
|
||||
uwsgi_log("running \"%s\" (setns)...\n", usl->value);
|
||||
exit(uh->func(colon+1));
|
||||
}
|
||||
else {
|
||||
uwsgi_error("uwsgi_hooks_setns_run()/fork()");
|
||||
|
||||
@@ -425,6 +425,8 @@ static struct uwsgi_option uwsgi_base_options[] = {
|
||||
{"hook-as-emperor-before-vassal", required_argument, 0, "run the specified hook before the new vassal is spawned", uwsgi_opt_add_string_list, &uwsgi.hook_as_emperor_before_vassal, 0},
|
||||
{"hook-as-vassal-before-drop", required_argument, 0, "run the specified hook into vassal, before dropping its privileges", uwsgi_opt_add_string_list, &uwsgi.hook_as_vassal_before_drop, 0},
|
||||
|
||||
{"hook-as-emperor-setns", required_argument, 0, "run the specified hook in the emperor entering vassal namespace", uwsgi_opt_add_string_list, &uwsgi.hook_as_emperor_setns, 0},
|
||||
|
||||
{"hook-as-mule", required_argument, 0, "run the specified hook in each mule", uwsgi_opt_add_string_list, &uwsgi.hook_as_mule, 0},
|
||||
|
||||
{"hook-as-gateway", required_argument, 0, "run the specified hook in each gateway", uwsgi_opt_add_string_list, &uwsgi.hook_as_gateway, 0},
|
||||
|
||||
Reference in New Issue
Block a user