Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-distro / recipes-security / gssproxy / files / Conditionally-reload-kernel-interface-on-SIGHUP.patch
1 From 8a5ba5feb98ecc3c57ee865604799fc4e4a90c61 Mon Sep 17 00:00:00 2001
2 From: Alexander Scheel <ascheel@redhat.com>
3 Date: Mon, 26 Jun 2017 17:04:16 -0400
4 Subject: [PATCH] Conditionally reload kernel interface on SIGHUP
5
6 Signed-off-by: Alexander Scheel <ascheel@redhat.com>
7 [rharwood@redhat.com: Simplified logic, rewrote commit message]
8 Reviewed-by: Robbie Harwood <rharwood@redhat.com>
9 Resolves: #193
10 Merges: #201
11 (cherry picked from commit 938af94b8f33c227dcdd6a53ed42de418578d29d)
12 ---
13  proxy/src/gp_init.c  | 4 +++-
14  proxy/src/gssproxy.c | 3 +++
15  2 files changed, 6 insertions(+), 1 deletion(-)
16
17 diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c
18 index e69934d..6a2b047 100644
19 --- a/proxy/src/gp_init.c
20 +++ b/proxy/src/gp_init.c
21 @@ -145,6 +145,7 @@ void init_proc_nfsd(struct gp_config *cfg)
22      char buf[] = "1";
23      bool enabled = false;
24      int fd, ret;
25 +    static int poked = 0;
26  
27      /* check first if any service enabled kernel support */
28      for (int i = 0; i < cfg->num_svcs; i++) {
29 @@ -154,7 +155,7 @@ void init_proc_nfsd(struct gp_config *cfg)
30          }
31      }
32  
33 -    if (!enabled) {
34 +    if (!enabled || poked) {
35          return;
36      }
37  
38 @@ -173,6 +174,7 @@ void init_proc_nfsd(struct gp_config *cfg)
39                  LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret));
40      }
41  
42 +    poked = 1;
43      close(fd);
44      if (ret != 0) {
45          goto fail;
46 diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c
47 index 94a6a61..5fc4f8d 100644
48 --- a/proxy/src/gssproxy.c
49 +++ b/proxy/src/gssproxy.c
50 @@ -140,6 +140,9 @@ static void hup_handler(verto_ctx *vctx, verto_ev *ev UNUSED)
51          exit(ret);
52      }
53  
54 +    /* conditionally reload kernel interface */
55 +    init_proc_nfsd(gpctx->config);
56 +
57      free_config(&old_config);
58  
59      GPDEBUG("New config loaded successfully.\n");