diff options
author | Simo Sorce <simo@redhat.com> | 2013-03-19 18:53:20 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2013-03-22 11:34:32 -0400 |
commit | 97102f1e7e19f3ea869335afbdbeba619042d694 (patch) | |
tree | 8f414af9010beb52d5584c8755a0789a48eaeddc /proxy/src/gp_init.c | |
parent | 6c3b7b20306894d4719df967e708fe9316eeeb89 (diff) | |
download | gss-proxy-97102f1e7e19f3ea869335afbdbeba619042d694.tar.gz gss-proxy-97102f1e7e19f3ea869335afbdbeba619042d694.tar.xz gss-proxy-97102f1e7e19f3ea869335afbdbeba619042d694.zip |
Enable kernel support.
The Linux kernel now requires the gss-proxy to signal when it is available.
This is done by writing 1 to the file /proc/net/rpc/use-gss-proxy
Once this happens the kernel will try to attach to the gss-proxy socket
and use it instead of the classic rpc.svcgssd daemon.
Diffstat (limited to 'proxy/src/gp_init.c')
-rw-r--r-- | proxy/src/gp_init.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c index c0cdb92..8d0ebd8 100644 --- a/proxy/src/gp_init.c +++ b/proxy/src/gp_init.c @@ -28,6 +28,9 @@ #include <sys/stat.h> #include <locale.h> #include <signal.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> #include "gp_proxy.h" void init_server(bool daemonize) @@ -130,3 +133,46 @@ verto_ctx *init_event_loop(void) return vctx; } +void init_proc_nfsd(struct gp_config *cfg) +{ + char buf[] = "1"; + bool enabled = false; + int fd, i, ret; + + /* check first if any service enabled kernel support */ + for (i = 0; i < cfg->num_svcs; i++) { + if (cfg->svcs[i]->kernel_nfsd == true) { + enabled = true; + break; + } + } + + if (!enabled) { + return; + } + + fd = open(LINUX_PROC_USE_GSS_PROXY_FILE, O_RDWR); + if (fd == -1) { + ret = errno; + GPDEBUG("Failed to open %s: %d (%s)\n", + LINUX_PROC_USE_GSS_PROXY_FILE, + ret, strerror(ret)); + return; + } + + ret = write(fd, buf, 1); + if (ret != 1) { + GPDEBUG("Failed to write to %s: %d (%s)\n", + LINUX_PROC_USE_GSS_PROXY_FILE, + ret, strerror(ret)); + return; + } + + ret = close(fd); + if (ret == -1) { + GPDEBUG("Failed to close %s: %d (%s)\n", + LINUX_PROC_USE_GSS_PROXY_FILE, + ret, strerror(ret)); + return; + } +} |