mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-13 04:51:21 +00:00
lib: have a lib_privs for ... lib privs
Logging code might want to raise privs for file operations. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
6e3253b979
commit
877057b67a
@ -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__);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user