mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-08 03:54:18 +01:00
allocate space for the grplist in the privs structure
as we want to save the privs structure longer than the scope of def_privs we need to allocate the space for grplist.
This commit is contained in:
parent
8cb3752293
commit
47cae946df
@ -65,7 +65,13 @@ static struct pam_modutil_privs * _privs_location(int force_init) {
|
|||||||
static struct pam_modutil_privs privs;
|
static struct pam_modutil_privs privs;
|
||||||
if (init == 0 || force_init) {
|
if (init == 0 || force_init) {
|
||||||
PAM_MODUTIL_DEF_PRIVS(def_privs);
|
PAM_MODUTIL_DEF_PRIVS(def_privs);
|
||||||
|
if(privs.grplist) {
|
||||||
|
free(privs.grplist);
|
||||||
|
}
|
||||||
privs = def_privs;
|
privs = def_privs;
|
||||||
|
/* since we want to save the information longer than the lifetime of dev_privs
|
||||||
|
* we need to allocate space for the grplist.. */
|
||||||
|
privs.grplist = malloc(def_privs.number_of_groups * sizeof(gid_t));
|
||||||
init = 1;
|
init = 1;
|
||||||
}
|
}
|
||||||
return &privs;
|
return &privs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user