diff options
author | Simo Sorce <simo@redhat.com> | 2013-04-12 17:09:06 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2013-04-23 12:02:50 -0700 |
commit | edf939632c9a1dbab4e769f0c23fe393d7fc8a6a (patch) | |
tree | b6fabfe341663ee072ef6cbe5be7f62e956991fd /proxy/src/gssproxy.c | |
parent | 7f8078e906b138dcd34f84e0260cba87b63ca62f (diff) | |
download | gss-proxy-edf939632c9a1dbab4e769f0c23fe393d7fc8a6a.tar.gz gss-proxy-edf939632c9a1dbab4e769f0c23fe393d7fc8a6a.tar.xz gss-proxy-edf939632c9a1dbab4e769f0c23fe393d7fc8a6a.zip |
Add support for per-service sockets
This way different processes running as the same user can be configured as
different servervices
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Günther Deschner <gdeschner@redhat.com>
Diffstat (limited to 'proxy/src/gssproxy.c')
-rw-r--r-- | proxy/src/gssproxy.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index 8c143e5..0936407 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -40,9 +40,10 @@ int main(int argc, const char *argv[]) verto_ctx *vctx; verto_ev *ev; int vflags; - int fd; struct gssproxy_ctx *gpctx; + struct gp_sock_ctx *sock_ctx; int ret; + int i; struct poptOption long_options[] = { POPT_AUTOHELP @@ -98,14 +99,6 @@ int main(int argc, const char *argv[]) init_server(gpctx->config->daemonize); - fd = init_unix_socket(gpctx->config->socket_name); - if (fd == -1) { - return 1; - } - - /* special call to tell the Linux kernel gss-proxy is available */ - init_proc_nfsd(gpctx->config); - write_pid(); vctx = init_event_loop(); @@ -114,12 +107,38 @@ int main(int argc, const char *argv[]) } gpctx->vctx = vctx; + /* init main socket */ + sock_ctx = init_unix_socket(gpctx, gpctx->config->socket_name); + if (!sock_ctx) { + return 1; + } + vflags = VERTO_EV_FLAG_PERSIST | VERTO_EV_FLAG_IO_READ; - ev = verto_add_io(vctx, vflags, accept_sock_conn, fd); + ev = verto_add_io(vctx, vflags, accept_sock_conn, sock_ctx->fd); if (!ev) { return 1; } - verto_set_private(ev, gpctx, NULL); + verto_set_private(ev, sock_ctx, NULL); + + /* init secondary sockets */ + for (i = 0; i < gpctx->config->num_svcs; i++) { + if (gpctx->config->svcs[i]->socket != NULL) { + sock_ctx = init_unix_socket(gpctx, gpctx->config->svcs[i]->socket); + if (!sock_ctx) { + return 1; + } + + vflags = VERTO_EV_FLAG_PERSIST | VERTO_EV_FLAG_IO_READ; + ev = verto_add_io(vctx, vflags, accept_sock_conn, sock_ctx->fd); + if (!ev) { + return 1; + } + verto_set_private(ev, sock_ctx, NULL); + } + } + + /* special call to tell the Linux kernel gss-proxy is available */ + init_proc_nfsd(gpctx->config); ret = gp_workers_init(gpctx); if (ret) { |