1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-01-31 16:52:19 +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:
Klas Lindfors 2013-09-19 08:34:04 +02:00
parent 8cb3752293
commit 47cae946df

View File

@ -65,7 +65,13 @@ static struct pam_modutil_privs * _privs_location(int force_init) {
static struct pam_modutil_privs privs;
if (init == 0 || force_init) {
PAM_MODUTIL_DEF_PRIVS(def_privs);
if(privs.grplist) {
free(privs.grplist);
}
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;
}
return &privs;