summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <Jafaral@users.noreply.github.com>2018-06-22 21:19:13 +0200
committerGitHub <noreply@github.com>2018-06-22 21:19:13 +0200
commit3a743cb7ec5fd1e91e0803487c606cf63e54c22b (patch)
treeb3291b5c500560e474f7248b23c5b8cf5c156bd5 /lib
parentMerge pull request #2512 from pacovn/Coverity_1399200_Unchecked_return_value_... (diff)
parentsharpd: Does not need any special priv's (diff)
downloadfrr-3a743cb7ec5fd1e91e0803487c606cf63e54c22b.tar.xz
frr-3a743cb7ec5fd1e91e0803487c606cf63e54c22b.zip
Merge pull request #2520 from donaldsharp/privs_smivs
lib: Fix privs when using HAVE_CAPABILITIES
Diffstat (limited to 'lib')
-rw-r--r--lib/privs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/privs.c b/lib/privs.c
index cfe7d6d6f..7c99742d3 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -824,6 +824,19 @@ void zprivs_init(struct zebra_privs_t *zprivs)
#ifdef HAVE_CAPABILITIES
zprivs_caps_init(zprivs);
+
+ /*
+ * If we have initialized the system with no requested
+ * capabilities, change will not have been set
+ * to anything by zprivs_caps_init, As such
+ * we should make sure that when we attempt
+ * to raize privileges that we actually have
+ * a do nothing function to call instead of a
+ * crash :).
+ */
+ if (!zprivs->change)
+ zprivs->change = zprivs_change_null;
+
#else /* !HAVE_CAPABILITIES */
/* we dont have caps. we'll need to maintain rid and saved uid
* and change euid back to saved uid (who we presume has all neccessary