lcl_gr.c revision 1.1.1.1.2.2 1 1.1.1.1.2.2 jym /* $NetBSD: lcl_gr.c,v 1.1.1.1.2.2 2009/05/13 18:52:11 jym Exp $ */
2 1.1.1.1.2.2 jym
3 1.1.1.1.2.2 jym /*
4 1.1.1.1.2.2 jym * Copyright (c) 1989, 1993, 1995
5 1.1.1.1.2.2 jym * The Regents of the University of California. All rights reserved.
6 1.1.1.1.2.2 jym *
7 1.1.1.1.2.2 jym * Redistribution and use in source and binary forms, with or without
8 1.1.1.1.2.2 jym * modification, are permitted provided that the following conditions
9 1.1.1.1.2.2 jym * are met:
10 1.1.1.1.2.2 jym * 1. Redistributions of source code must retain the above copyright
11 1.1.1.1.2.2 jym * notice, this list of conditions and the following disclaimer.
12 1.1.1.1.2.2 jym * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.1.1.2.2 jym * notice, this list of conditions and the following disclaimer in the
14 1.1.1.1.2.2 jym * documentation and/or other materials provided with the distribution.
15 1.1.1.1.2.2 jym * 3. All advertising materials mentioning features or use of this software
16 1.1.1.1.2.2 jym * must display the following acknowledgement:
17 1.1.1.1.2.2 jym * This product includes software developed by the University of
18 1.1.1.1.2.2 jym * California, Berkeley and its contributors.
19 1.1.1.1.2.2 jym * 4. Neither the name of the University nor the names of its contributors
20 1.1.1.1.2.2 jym * may be used to endorse or promote products derived from this software
21 1.1.1.1.2.2 jym * without specific prior written permission.
22 1.1.1.1.2.2 jym *
23 1.1.1.1.2.2 jym * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1.1.1.2.2 jym * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1.1.1.2.2 jym * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1.1.1.2.2 jym * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1.1.1.2.2 jym * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1.1.1.2.2 jym * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1.1.1.2.2 jym * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1.1.1.2.2 jym * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1.1.1.2.2 jym * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1.1.1.2.2 jym * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1.1.1.2.2 jym * SUCH DAMAGE.
34 1.1.1.1.2.2 jym */
35 1.1.1.1.2.2 jym
36 1.1.1.1.2.2 jym /*
37 1.1.1.1.2.2 jym * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
38 1.1.1.1.2.2 jym * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
39 1.1.1.1.2.2 jym *
40 1.1.1.1.2.2 jym * Permission to use, copy, modify, and distribute this software for any
41 1.1.1.1.2.2 jym * purpose with or without fee is hereby granted, provided that the above
42 1.1.1.1.2.2 jym * copyright notice and this permission notice appear in all copies.
43 1.1.1.1.2.2 jym *
44 1.1.1.1.2.2 jym * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
45 1.1.1.1.2.2 jym * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
46 1.1.1.1.2.2 jym * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
47 1.1.1.1.2.2 jym * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
48 1.1.1.1.2.2 jym * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
49 1.1.1.1.2.2 jym * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
50 1.1.1.1.2.2 jym * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 1.1.1.1.2.2 jym */
52 1.1.1.1.2.2 jym
53 1.1.1.1.2.2 jym #if defined(LIBC_SCCS) && !defined(lint)
54 1.1.1.1.2.2 jym static const char rcsid[] = "Id: lcl_gr.c,v 1.3 2005/04/27 04:56:30 sra Exp";
55 1.1.1.1.2.2 jym /* from getgrent.c 8.2 (Berkeley) 3/21/94"; */
56 1.1.1.1.2.2 jym /* from BSDI Id: getgrent.c,v 2.8 1996/05/28 18:15:14 bostic Exp $ */
57 1.1.1.1.2.2 jym #endif /* LIBC_SCCS and not lint */
58 1.1.1.1.2.2 jym
59 1.1.1.1.2.2 jym /* extern */
60 1.1.1.1.2.2 jym
61 1.1.1.1.2.2 jym #include "port_before.h"
62 1.1.1.1.2.2 jym
63 1.1.1.1.2.2 jym #ifndef WANT_IRS_PW
64 1.1.1.1.2.2 jym static int __bind_irs_gr_unneeded;
65 1.1.1.1.2.2 jym #else
66 1.1.1.1.2.2 jym
67 1.1.1.1.2.2 jym #include <sys/param.h>
68 1.1.1.1.2.2 jym #include <sys/types.h>
69 1.1.1.1.2.2 jym #include <netinet/in.h>
70 1.1.1.1.2.2 jym #include <arpa/nameser.h>
71 1.1.1.1.2.2 jym #include <resolv.h>
72 1.1.1.1.2.2 jym
73 1.1.1.1.2.2 jym #include <errno.h>
74 1.1.1.1.2.2 jym #include <fcntl.h>
75 1.1.1.1.2.2 jym #include <grp.h>
76 1.1.1.1.2.2 jym #include <stdio.h>
77 1.1.1.1.2.2 jym #include <stdlib.h>
78 1.1.1.1.2.2 jym #include <string.h>
79 1.1.1.1.2.2 jym #include <unistd.h>
80 1.1.1.1.2.2 jym
81 1.1.1.1.2.2 jym #include <irs.h>
82 1.1.1.1.2.2 jym #include <isc/memcluster.h>
83 1.1.1.1.2.2 jym
84 1.1.1.1.2.2 jym #include "irs_p.h"
85 1.1.1.1.2.2 jym #include "lcl_p.h"
86 1.1.1.1.2.2 jym #include "irp_p.h"
87 1.1.1.1.2.2 jym
88 1.1.1.1.2.2 jym #include "port_after.h"
89 1.1.1.1.2.2 jym
90 1.1.1.1.2.2 jym
91 1.1.1.1.2.2 jym /* Types. */
92 1.1.1.1.2.2 jym
93 1.1.1.1.2.2 jym struct pvt {
94 1.1.1.1.2.2 jym FILE * fp;
95 1.1.1.1.2.2 jym /*%<
96 1.1.1.1.2.2 jym * Need space to store the entries read from the group file.
97 1.1.1.1.2.2 jym * The members list also needs space per member, and the
98 1.1.1.1.2.2 jym * strings making up the user names must be allocated
99 1.1.1.1.2.2 jym * somewhere. Rather than doing lots of small allocations,
100 1.1.1.1.2.2 jym * we keep one buffer and resize it as needed.
101 1.1.1.1.2.2 jym */
102 1.1.1.1.2.2 jym struct group group;
103 1.1.1.1.2.2 jym size_t nmemb; /*%< Malloc'd max index of gr_mem[]. */
104 1.1.1.1.2.2 jym char * membuf;
105 1.1.1.1.2.2 jym size_t membufsize;
106 1.1.1.1.2.2 jym };
107 1.1.1.1.2.2 jym
108 1.1.1.1.2.2 jym /* Forward. */
109 1.1.1.1.2.2 jym
110 1.1.1.1.2.2 jym static void gr_close(struct irs_gr *);
111 1.1.1.1.2.2 jym static struct group * gr_next(struct irs_gr *);
112 1.1.1.1.2.2 jym static struct group * gr_byname(struct irs_gr *, const char *);
113 1.1.1.1.2.2 jym static struct group * gr_bygid(struct irs_gr *, gid_t);
114 1.1.1.1.2.2 jym static void gr_rewind(struct irs_gr *);
115 1.1.1.1.2.2 jym static void gr_minimize(struct irs_gr *);
116 1.1.1.1.2.2 jym
117 1.1.1.1.2.2 jym static int grstart(struct pvt *);
118 1.1.1.1.2.2 jym static char * grnext(struct pvt *);
119 1.1.1.1.2.2 jym static struct group * grscan(struct irs_gr *, int, gid_t, const char *);
120 1.1.1.1.2.2 jym
121 1.1.1.1.2.2 jym /* Portability. */
122 1.1.1.1.2.2 jym
123 1.1.1.1.2.2 jym #ifndef SEEK_SET
124 1.1.1.1.2.2 jym # define SEEK_SET 0
125 1.1.1.1.2.2 jym #endif
126 1.1.1.1.2.2 jym
127 1.1.1.1.2.2 jym /* Public. */
128 1.1.1.1.2.2 jym
129 1.1.1.1.2.2 jym struct irs_gr *
130 1.1.1.1.2.2 jym irs_lcl_gr(struct irs_acc *this) {
131 1.1.1.1.2.2 jym struct irs_gr *gr;
132 1.1.1.1.2.2 jym struct pvt *pvt;
133 1.1.1.1.2.2 jym
134 1.1.1.1.2.2 jym UNUSED(this);
135 1.1.1.1.2.2 jym
136 1.1.1.1.2.2 jym if (!(gr = memget(sizeof *gr))) {
137 1.1.1.1.2.2 jym errno = ENOMEM;
138 1.1.1.1.2.2 jym return (NULL);
139 1.1.1.1.2.2 jym }
140 1.1.1.1.2.2 jym memset(gr, 0x5e, sizeof *gr);
141 1.1.1.1.2.2 jym if (!(pvt = memget(sizeof *pvt))) {
142 1.1.1.1.2.2 jym memput(gr, sizeof *gr);
143 1.1.1.1.2.2 jym errno = ENOMEM;
144 1.1.1.1.2.2 jym return (NULL);
145 1.1.1.1.2.2 jym }
146 1.1.1.1.2.2 jym memset(pvt, 0, sizeof *pvt);
147 1.1.1.1.2.2 jym gr->private = pvt;
148 1.1.1.1.2.2 jym gr->close = gr_close;
149 1.1.1.1.2.2 jym gr->next = gr_next;
150 1.1.1.1.2.2 jym gr->byname = gr_byname;
151 1.1.1.1.2.2 jym gr->bygid = gr_bygid;
152 1.1.1.1.2.2 jym gr->rewind = gr_rewind;
153 1.1.1.1.2.2 jym gr->list = make_group_list;
154 1.1.1.1.2.2 jym gr->minimize = gr_minimize;
155 1.1.1.1.2.2 jym gr->res_get = NULL;
156 1.1.1.1.2.2 jym gr->res_set = NULL;
157 1.1.1.1.2.2 jym return (gr);
158 1.1.1.1.2.2 jym }
159 1.1.1.1.2.2 jym
160 1.1.1.1.2.2 jym /* Methods. */
161 1.1.1.1.2.2 jym
162 1.1.1.1.2.2 jym static void
163 1.1.1.1.2.2 jym gr_close(struct irs_gr *this) {
164 1.1.1.1.2.2 jym struct pvt *pvt = (struct pvt *)this->private;
165 1.1.1.1.2.2 jym
166 1.1.1.1.2.2 jym if (pvt->fp)
167 1.1.1.1.2.2 jym (void)fclose(pvt->fp);
168 1.1.1.1.2.2 jym if (pvt->group.gr_mem)
169 1.1.1.1.2.2 jym free(pvt->group.gr_mem);
170 1.1.1.1.2.2 jym if (pvt->membuf)
171 1.1.1.1.2.2 jym free(pvt->membuf);
172 1.1.1.1.2.2 jym memput(pvt, sizeof *pvt);
173 1.1.1.1.2.2 jym memput(this, sizeof *this);
174 1.1.1.1.2.2 jym }
175 1.1.1.1.2.2 jym
176 1.1.1.1.2.2 jym static struct group *
177 1.1.1.1.2.2 jym gr_next(struct irs_gr *this) {
178 1.1.1.1.2.2 jym struct pvt *pvt = (struct pvt *)this->private;
179 1.1.1.1.2.2 jym
180 1.1.1.1.2.2 jym if (!pvt->fp && !grstart(pvt))
181 1.1.1.1.2.2 jym return (NULL);
182 1.1.1.1.2.2 jym return (grscan(this, 0, 0, NULL));
183 1.1.1.1.2.2 jym }
184 1.1.1.1.2.2 jym
185 1.1.1.1.2.2 jym static struct group *
186 1.1.1.1.2.2 jym gr_byname(struct irs_gr *this, const char *name) {
187 1.1.1.1.2.2 jym if (!grstart((struct pvt *)this->private))
188 1.1.1.1.2.2 jym return (NULL);
189 1.1.1.1.2.2 jym return (grscan(this, 1, 0, name));
190 1.1.1.1.2.2 jym }
191 1.1.1.1.2.2 jym
192 1.1.1.1.2.2 jym static struct group *
193 1.1.1.1.2.2 jym gr_bygid(struct irs_gr *this, gid_t gid) {
194 1.1.1.1.2.2 jym if (!grstart((struct pvt *)this->private))
195 1.1.1.1.2.2 jym return (NULL);
196 1.1.1.1.2.2 jym return (grscan(this, 1, gid, NULL));
197 1.1.1.1.2.2 jym }
198 1.1.1.1.2.2 jym
199 1.1.1.1.2.2 jym static void
200 1.1.1.1.2.2 jym gr_rewind(struct irs_gr *this) {
201 1.1.1.1.2.2 jym (void) grstart((struct pvt *)this->private);
202 1.1.1.1.2.2 jym }
203 1.1.1.1.2.2 jym
204 1.1.1.1.2.2 jym static void
205 1.1.1.1.2.2 jym gr_minimize(struct irs_gr *this) {
206 1.1.1.1.2.2 jym struct pvt *pvt = (struct pvt *)this->private;
207 1.1.1.1.2.2 jym
208 1.1.1.1.2.2 jym if (pvt->fp != NULL) {
209 1.1.1.1.2.2 jym (void)fclose(pvt->fp);
210 1.1.1.1.2.2 jym pvt->fp = NULL;
211 1.1.1.1.2.2 jym }
212 1.1.1.1.2.2 jym }
213 1.1.1.1.2.2 jym
214 1.1.1.1.2.2 jym /* Private. */
215 1.1.1.1.2.2 jym
216 1.1.1.1.2.2 jym static int
217 1.1.1.1.2.2 jym grstart(struct pvt *pvt) {
218 1.1.1.1.2.2 jym if (pvt->fp) {
219 1.1.1.1.2.2 jym if (fseek(pvt->fp, 0L, SEEK_SET) == 0)
220 1.1.1.1.2.2 jym return (1);
221 1.1.1.1.2.2 jym (void)fclose(pvt->fp);
222 1.1.1.1.2.2 jym }
223 1.1.1.1.2.2 jym if (!(pvt->fp = fopen(_PATH_GROUP, "r")))
224 1.1.1.1.2.2 jym return (0);
225 1.1.1.1.2.2 jym if (fcntl(fileno(pvt->fp), F_SETFD, 1) < 0) {
226 1.1.1.1.2.2 jym fclose(pvt->fp);
227 1.1.1.1.2.2 jym return (0);
228 1.1.1.1.2.2 jym }
229 1.1.1.1.2.2 jym return (1);
230 1.1.1.1.2.2 jym }
231 1.1.1.1.2.2 jym
232 1.1.1.1.2.2 jym #define INITIAL_NMEMB 30 /*%< about 120 bytes */
233 1.1.1.1.2.2 jym #define INITIAL_BUFSIZ (INITIAL_NMEMB * 8) /*%< about 240 bytes */
234 1.1.1.1.2.2 jym static char *
235 1.1.1.1.2.2 jym grnext(struct pvt *pvt) {
236 1.1.1.1.2.2 jym char *w, *e;
237 1.1.1.1.2.2 jym int ch;
238 1.1.1.1.2.2 jym
239 1.1.1.1.2.2 jym /* Make sure we have a buffer. */
240 1.1.1.1.2.2 jym if (pvt->membuf == NULL) {
241 1.1.1.1.2.2 jym pvt->membuf = malloc(INITIAL_BUFSIZ);
242 1.1.1.1.2.2 jym if (pvt->membuf == NULL) {
243 1.1.1.1.2.2 jym enomem:
244 1.1.1.1.2.2 jym errno = ENOMEM;
245 1.1.1.1.2.2 jym return (NULL);
246 1.1.1.1.2.2 jym }
247 1.1.1.1.2.2 jym pvt->membufsize = INITIAL_BUFSIZ;
248 1.1.1.1.2.2 jym }
249 1.1.1.1.2.2 jym
250 1.1.1.1.2.2 jym /* Read until EOF or EOL. */
251 1.1.1.1.2.2 jym w = pvt->membuf;
252 1.1.1.1.2.2 jym e = pvt->membuf + pvt->membufsize;
253 1.1.1.1.2.2 jym while ((ch = fgetc(pvt->fp)) != EOF && ch != '\n') {
254 1.1.1.1.2.2 jym /* Make sure we have room for this character and a \0. */
255 1.1.1.1.2.2 jym if (w + 1 == e) {
256 1.1.1.1.2.2 jym size_t o = w - pvt->membuf;
257 1.1.1.1.2.2 jym size_t n = pvt->membufsize * 2;
258 1.1.1.1.2.2 jym char *t = realloc(pvt->membuf, n);
259 1.1.1.1.2.2 jym
260 1.1.1.1.2.2 jym if (t == NULL)
261 1.1.1.1.2.2 jym goto enomem;
262 1.1.1.1.2.2 jym pvt->membuf = t;
263 1.1.1.1.2.2 jym pvt->membufsize = n;
264 1.1.1.1.2.2 jym w = pvt->membuf + o;
265 1.1.1.1.2.2 jym e = pvt->membuf + pvt->membufsize;
266 1.1.1.1.2.2 jym }
267 1.1.1.1.2.2 jym /* Store it. */
268 1.1.1.1.2.2 jym *w++ = (char)ch;
269 1.1.1.1.2.2 jym }
270 1.1.1.1.2.2 jym
271 1.1.1.1.2.2 jym /* Hitting EOF on the first character really does mean EOF. */
272 1.1.1.1.2.2 jym if (w == pvt->membuf && ch == EOF) {
273 1.1.1.1.2.2 jym errno = ENOENT;
274 1.1.1.1.2.2 jym return (NULL);
275 1.1.1.1.2.2 jym }
276 1.1.1.1.2.2 jym
277 1.1.1.1.2.2 jym /* Last line of /etc/group need not end with \n; we don't care. */
278 1.1.1.1.2.2 jym *w = '\0';
279 1.1.1.1.2.2 jym return (pvt->membuf);
280 1.1.1.1.2.2 jym }
281 1.1.1.1.2.2 jym
282 1.1.1.1.2.2 jym static struct group *
283 1.1.1.1.2.2 jym grscan(struct irs_gr *this, int search, gid_t gid, const char *name) {
284 1.1.1.1.2.2 jym struct pvt *pvt = (struct pvt *)this->private;
285 1.1.1.1.2.2 jym size_t n;
286 1.1.1.1.2.2 jym char *bp, **m, *p;
287 1.1.1.1.2.2 jym
288 1.1.1.1.2.2 jym /* Read lines until we find one that matches our search criteria. */
289 1.1.1.1.2.2 jym for (;;) {
290 1.1.1.1.2.2 jym if ((bp = grnext(pvt)) == NULL)
291 1.1.1.1.2.2 jym return (NULL);
292 1.1.1.1.2.2 jym
293 1.1.1.1.2.2 jym /* Optimize the usual case of searching for a name. */
294 1.1.1.1.2.2 jym pvt->group.gr_name = strsep(&bp, ":");
295 1.1.1.1.2.2 jym if (search && name != NULL &&
296 1.1.1.1.2.2 jym strcmp(pvt->group.gr_name, name) != 0)
297 1.1.1.1.2.2 jym continue;
298 1.1.1.1.2.2 jym if (bp == NULL || *bp == '\0')
299 1.1.1.1.2.2 jym goto corrupt;
300 1.1.1.1.2.2 jym
301 1.1.1.1.2.2 jym /* Skip past the password field. */
302 1.1.1.1.2.2 jym pvt->group.gr_passwd = strsep(&bp, ":");
303 1.1.1.1.2.2 jym if (bp == NULL || *bp == '\0')
304 1.1.1.1.2.2 jym goto corrupt;
305 1.1.1.1.2.2 jym
306 1.1.1.1.2.2 jym /* Checking for a gid. */
307 1.1.1.1.2.2 jym if ((p = strsep(&bp, ":")) == NULL)
308 1.1.1.1.2.2 jym continue;
309 1.1.1.1.2.2 jym /*
310 1.1.1.1.2.2 jym * Unlike the tests above, the test below is supposed to be
311 1.1.1.1.2.2 jym * testing 'p' and not 'bp', in case you think it's a typo.
312 1.1.1.1.2.2 jym */
313 1.1.1.1.2.2 jym if (p == NULL || *p == '\0') {
314 1.1.1.1.2.2 jym corrupt:
315 1.1.1.1.2.2 jym /* warning: corrupted %s file!", _PATH_GROUP */
316 1.1.1.1.2.2 jym continue;
317 1.1.1.1.2.2 jym }
318 1.1.1.1.2.2 jym pvt->group.gr_gid = atoi(p);
319 1.1.1.1.2.2 jym if (search && name == NULL && (gid_t)pvt->group.gr_gid != gid)
320 1.1.1.1.2.2 jym continue;
321 1.1.1.1.2.2 jym
322 1.1.1.1.2.2 jym /* We want this record. */
323 1.1.1.1.2.2 jym break;
324 1.1.1.1.2.2 jym }
325 1.1.1.1.2.2 jym
326 1.1.1.1.2.2 jym /*
327 1.1.1.1.2.2 jym * Count commas to find out how many members there might be.
328 1.1.1.1.2.2 jym * Note that commas separate, so if there is one comma there
329 1.1.1.1.2.2 jym * can be two members (group:*:id:user1,user2). Add another
330 1.1.1.1.2.2 jym * to account for the NULL terminator. As above, allocate
331 1.1.1.1.2.2 jym * largest of INITIAL_NMEMB, or 2*n.
332 1.1.1.1.2.2 jym */
333 1.1.1.1.2.2 jym n = 1;
334 1.1.1.1.2.2 jym if (bp != NULL)
335 1.1.1.1.2.2 jym for (n = 2, p = bp; (p = strpbrk(p, ", ")) != NULL; ++n)
336 1.1.1.1.2.2 jym p += strspn(p, ", ");
337 1.1.1.1.2.2 jym if (n > pvt->nmemb || pvt->group.gr_mem == NULL) {
338 1.1.1.1.2.2 jym if ((n *= 2) < INITIAL_NMEMB)
339 1.1.1.1.2.2 jym n = INITIAL_NMEMB;
340 1.1.1.1.2.2 jym if ((m = realloc(pvt->group.gr_mem, n * sizeof *m)) == NULL)
341 1.1.1.1.2.2 jym return (NULL);
342 1.1.1.1.2.2 jym pvt->group.gr_mem = m;
343 1.1.1.1.2.2 jym pvt->nmemb = n;
344 1.1.1.1.2.2 jym }
345 1.1.1.1.2.2 jym
346 1.1.1.1.2.2 jym /* Set the name pointers. */
347 1.1.1.1.2.2 jym for (m = pvt->group.gr_mem; (p = strsep(&bp, ", ")) != NULL;)
348 1.1.1.1.2.2 jym if (p[0] != '\0')
349 1.1.1.1.2.2 jym *m++ = p;
350 1.1.1.1.2.2 jym *m = NULL;
351 1.1.1.1.2.2 jym
352 1.1.1.1.2.2 jym return (&pvt->group);
353 1.1.1.1.2.2 jym }
354 1.1.1.1.2.2 jym
355 1.1.1.1.2.2 jym #endif /* WANT_IRS_GR */
356 1.1.1.1.2.2 jym /*! \file */
357