diff --git a/core/utils.c b/core/utils.c index 56895c03..6c02d361 100644 --- a/core/utils.c +++ b/core/utils.c @@ -636,6 +636,14 @@ void uwsgi_as_root() { } + // ok try to call some special hook before finally dropping privileges + int i; + for (i = 0; i < uwsgi.gp_cnt; i++) { + if (uwsgi.gp[i]->before_privileges_drop) { + uwsgi.gp[i]->before_privileges_drop(); + } + } + if (uwsgi.gid) { if (!uwsgi.master_as_root) uwsgi_log("setgid() to %d\n", uwsgi.gid); diff --git a/uwsgi.h b/uwsgi.h index ce876bef..c5f693c0 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -690,6 +690,7 @@ struct uwsgi_plugin { uint16_t(*rpc) (void *, uint8_t, char **, uint16_t *, char *); void (*jail) (int (*)(void *), char **); + void (*before_privileges_drop)(void); int (*mule)(char *); int (*mule_msg)(char *, size_t);