X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=meta-stx%2Frecipes-security%2Fgssproxy%2Ffiles%2FMake-proc-file-failure-loud-but-nonfatal.patch;fp=meta-stx%2Frecipes-security%2Fgssproxy%2Ffiles%2FMake-proc-file-failure-loud-but-nonfatal.patch;h=18a58df015d06efd38ed8fbaf4045310467ba1f9;hb=57fdea704bd62af847872c40508f00aa1d7cac60;hp=0000000000000000000000000000000000000000;hpb=f23f21bccfb750b9e30141fd9676515215ffbc4e;p=pti%2Frtp.git diff --git a/meta-stx/recipes-security/gssproxy/files/Make-proc-file-failure-loud-but-nonfatal.patch b/meta-stx/recipes-security/gssproxy/files/Make-proc-file-failure-loud-but-nonfatal.patch new file mode 100644 index 0000000..18a58df --- /dev/null +++ b/meta-stx/recipes-security/gssproxy/files/Make-proc-file-failure-loud-but-nonfatal.patch @@ -0,0 +1,75 @@ +From 938bd1adc15342e8ebed3d4e135d862e362a619e Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Thu, 25 May 2017 13:06:17 -0400 +Subject: [PATCH] Make proc file failure loud but nonfatal + +Signed-off-by: Robbie Harwood +Reviewed-by: Simo Sorce +Resolves: #190 +(cherry picked from commit 4f60bf02a1a68cbb26251e764357b753f80790f3) +--- + proxy/src/gp_init.c | 34 +++++++++++++++------------------- + 1 file changed, 15 insertions(+), 19 deletions(-) + +diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c +index bb7ba6b..d367f92 100644 +--- a/proxy/src/gp_init.c ++++ b/proxy/src/gp_init.c +@@ -144,11 +144,11 @@ void init_proc_nfsd(struct gp_config *cfg) + { + char buf[] = "1"; + bool enabled = false; +- int fd, i, ret; ++ int fd, ret; + + /* check first if any service enabled kernel support */ +- for (i = 0; i < cfg->num_svcs; i++) { +- if (cfg->svcs[i]->kernel_nfsd == true) { ++ for (int i = 0; i < cfg->num_svcs; i++) { ++ if (cfg->svcs[i]->kernel_nfsd) { + enabled = true; + break; + } +@@ -161,30 +161,26 @@ void init_proc_nfsd(struct gp_config *cfg) + fd = open(LINUX_PROC_USE_GSS_PROXY_FILE, O_RDWR); + if (fd == -1) { + ret = errno; +- fprintf(stderr, "GSS-Proxy is not supported by this kernel since " +- "file %s could not be found: %d (%s)\n", +- LINUX_PROC_USE_GSS_PROXY_FILE, +- ret, gp_strerror(ret)); +- exit(1); ++ GPDEBUG("Kernel doesn't support GSS-Proxy (can't open %s: %d (%s))\n", ++ LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret)); ++ goto fail; + } + + ret = write(fd, buf, 1); + if (ret != 1) { + ret = errno; +- fprintf(stderr, "Failed to write to %s: %d (%s)\n", +- LINUX_PROC_USE_GSS_PROXY_FILE, +- ret, gp_strerror(ret)); +- exit(1); ++ GPDEBUG("Failed to write to %s: %d (%s)\n", ++ LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret)); + } + +- ret = close(fd); +- if (ret == -1) { +- ret = errno; +- fprintf(stderr, "Failed to close %s: %d (%s)\n", +- LINUX_PROC_USE_GSS_PROXY_FILE, +- ret, gp_strerror(ret)); +- exit(1); ++ close(fd); ++ if (ret != 0) { ++ goto fail; + } ++ ++ return; ++fail: ++ GPDEBUG("Problem with kernel communication! NFS server will not work\n"); + } + + void write_pid(void)