From bd8ffcf67be8fdbe14bc49a65a8eafe904119d88 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 3 Jan 2014 12:10:36 -0500 Subject: Block parent process until child is initialized. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way the init system will not proceed starting dependencies until gssproxy is actually ready to serve requests. In particular this is used to make sure the nfsd proc file has been touched before the nfsd server is started. Resolves: https://fedorahosted.org/gss-proxy/ticket/114 Signed-off-by: Simo Sorce Reviewed-by: Günther Deschner --- proxy/src/gssproxy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'proxy/src/gssproxy.c') diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index 1bf0a0b..80430d6 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -42,6 +42,7 @@ int main(int argc, const char *argv[]) int vflags; struct gssproxy_ctx *gpctx; struct gp_sock_ctx *sock_ctx; + int wait_fd; int ret; int i; @@ -97,7 +98,7 @@ int main(int argc, const char *argv[]) exit(EXIT_FAILURE); } - init_server(gpctx->config->daemonize); + init_server(gpctx->config->daemonize, &wait_fd); write_pid(); @@ -139,9 +140,15 @@ int main(int argc, const char *argv[]) } } - /* special call to tell the Linux kernel gss-proxy is available */ + /* We need to tell nfsd that GSS-Proxy is available before it starts, + * as nfsd needs to know GSS-Proxy is in use before the first time it + * needs to call accept_sec_context. */ init_proc_nfsd(gpctx->config); + /* Now it is safe to tell the init system that we're done starting up, + * so it can continue with dependencies and start nfsd */ + init_done(wait_fd); + ret = drop_privs(gpctx->config); if (ret) { exit(EXIT_FAILURE); -- cgit