summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/privs.c6
-rw-r--r--lib/privs.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/privs.c b/lib/privs.c
index 1bb5d059c8..5ca3c0d886 100644
--- a/lib/privs.c
+++ b/lib/privs.c
@@ -587,6 +587,8 @@ void zprivs_preinit(struct zebra_privs_t *zprivs)
}
}
+struct zebra_privs_t *lib_privs;
+
void zprivs_init(struct zebra_privs_t *zprivs)
{
gid_t groups[NGROUPS_MAX] = {};
@@ -598,6 +600,8 @@ void zprivs_init(struct zebra_privs_t *zprivs)
|| zprivs->cap_num_i))
return;
+ lib_privs = zprivs;
+
if (zprivs->user) {
ngroups = array_size(groups);
if (getgrouplist(zprivs->user, zprivs_state.zgid, groups,
@@ -701,6 +705,8 @@ void zprivs_terminate(struct zebra_privs_t *zprivs)
{
struct zebra_privs_refs_t *refs;
+ lib_privs = NULL;
+
if (!zprivs) {
fprintf(stderr, "%s: no privs struct given, terminating",
__func__);
diff --git a/lib/privs.h b/lib/privs.h
index 18ba8e8888..2dcdbe2e6c 100644
--- a/lib/privs.h
+++ b/lib/privs.h
@@ -100,6 +100,8 @@ struct zprivs_ids_t {
gid_t gid_vty; /* vty gid */
};
+extern struct zebra_privs_t *lib_privs;
+
/* initialise zebra privileges */
extern void zprivs_preinit(struct zebra_privs_t *zprivs);
extern void zprivs_init(struct zebra_privs_t *zprivs);