blob: 0b8e3b87e90ea542ebdaca894f4d8eb6e24c6461 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* ISC license. */
#include <string.h>
#include <skalibs/genalloc.h>
#include <nsss/grp-def.h>
#include <nsss/nsss-unix.h>
int nsss_unix_grp_getbyname (nsss_unix_t *a, struct group *gr, stralloc *sa, genalloc *ga, char const *name)
{
struct group gr2 ;
for (;;)
{
size_t sabase = sa->len ;
size_t gabase = genalloc_len(char *, ga) ;
if (!nsss_unix_grp_get(a, &gr2, sa, ga)) return 0 ;
if (!strcmp(name, gr2.gr_name)) break ;
sa->len = sabase ;
genalloc_setlen(char *, ga, gabase) ;
}
*gr = gr2 ;
return 1 ;
}
|