1 /* vi: set sw=4 ts=4: */
2 /* Copyright (C) 2003 Manuel Novoa III
4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 /* Nov 6, 2003 Initial version.
9 * NOTE: This implementation is quite strict about requiring all
10 * field seperators. It also does not allow leading whitespace
11 * except when processing the numeric fields. glibc is more
12 * lenient. See the various glibc difference comments below.
15 * Move to dynamic allocation of (currently statically allocated)
16 * buffers; especially for the group-related functions since
17 * large group member lists will cause error returns.
23 /**********************************************************************/
24 /* Sizes for statically allocated buffers. */
26 /* If you change these values, also change _SC_GETPW_R_SIZE_MAX and
27 * _SC_GETGR_R_SIZE_MAX in libc/unistd/sysconf.c to match */
28 #define PWD_BUFFER_SIZE 256
29 #define GRP_BUFFER_SIZE 256
31 /**********************************************************************/
32 /* Prototypes for internal functions. */
34 static int bb__pgsreader(
35 int FAST_FUNC (*parserfunc)(void *d, char *line),
37 char *__restrict line_buff,
41 static int FAST_FUNC bb__parsepwent(void *pw, char *line);
42 static int FAST_FUNC bb__parsegrent(void *gr, char *line);
43 #if ENABLE_USE_BB_SHADOW
44 static int FAST_FUNC bb__parsespent(void *sp, char *line);
47 /**********************************************************************/
48 /* We avoid having big global data. */
51 /* Smaller things first */
52 struct passwd getpwuid_resultbuf;
53 struct group getgrgid_resultbuf;
54 struct passwd getpwnam_resultbuf;
55 struct group getgrnam_resultbuf;
57 char getpwuid_buffer[PWD_BUFFER_SIZE];
58 char getgrgid_buffer[GRP_BUFFER_SIZE];
59 char getpwnam_buffer[PWD_BUFFER_SIZE];
60 char getgrnam_buffer[GRP_BUFFER_SIZE];
62 struct passwd fgetpwent_resultbuf;
63 struct group fgetgrent_resultbuf;
64 struct spwd fgetspent_resultbuf;
65 char fgetpwent_buffer[PWD_BUFFER_SIZE];
66 char fgetgrent_buffer[GRP_BUFFER_SIZE];
67 char fgetspent_buffer[PWD_BUFFER_SIZE];
69 #if 0 //ENABLE_USE_BB_SHADOW
70 struct spwd getspuid_resultbuf;
71 struct spwd getspnam_resultbuf;
72 char getspuid_buffer[PWD_BUFFER_SIZE];
73 char getspnam_buffer[PWD_BUFFER_SIZE];
75 // Not converted - too small to bother
76 //pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
77 //FILE *pwf /*= NULL*/;
78 //FILE *grf /*= NULL*/;
79 //FILE *spf /*= NULL*/;
81 struct passwd getpwent_pwd;
82 struct group getgrent_gr;
83 char getpwent_line_buff[PWD_BUFFER_SIZE];
84 char getgrent_line_buff[GRP_BUFFER_SIZE];
86 #if 0 //ENABLE_USE_BB_SHADOW
87 struct spwd getspent_spwd;
88 struct spwd sgetspent_spwd;
89 char getspent_line_buff[PWD_BUFFER_SIZE];
90 char sgetspent_line_buff[PWD_BUFFER_SIZE];
94 static struct statics *ptr_to_statics;
96 static struct statics *get_S(void)
99 ptr_to_statics = xzalloc(sizeof(*ptr_to_statics));
100 return ptr_to_statics;
103 /* Always use in this order, get_S() must be called first */
104 #define RESULTBUF(name) &((S = get_S())->name##_resultbuf)
105 #define BUFFER(name) (S->name##_buffer)
107 /**********************************************************************/
108 /* For the various fget??ent_r funcs, return
111 * ENOENT: end-of-file encountered
112 * ERANGE: buflen too small
113 * other error values possible. See bb__pgsreader.
115 * Also, *result == resultbuf on success and NULL on failure.
117 * NOTE: glibc difference - For the ENOENT case, glibc also sets errno.
118 * We do not, as it really isn't an error if we reach the end-of-file.
119 * Doing so is analogous to having fgetc() set errno on EOF.
121 /**********************************************************************/
123 int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf,
124 char *__restrict buffer, size_t buflen,
125 struct passwd **__restrict result)
131 rv = bb__pgsreader(bb__parsepwent, resultbuf, buffer, buflen, stream);
139 int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf,
140 char *__restrict buffer, size_t buflen,
141 struct group **__restrict result)
147 rv = bb__pgsreader(bb__parsegrent, resultbuf, buffer, buflen, stream);
155 #if ENABLE_USE_BB_SHADOW
156 #ifdef UNUSED_FOR_NOW
157 int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
158 char *__restrict buffer, size_t buflen,
159 struct spwd **__restrict result)
165 rv = bb__pgsreader(bb__parsespent, resultbuf, buffer, buflen, stream);
175 /**********************************************************************/
176 /* For the various fget??ent funcs, return NULL on failure and a
177 * pointer to the appropriate struct (statically allocated) on success.
178 * TODO: audit & stop using these in bbox, they pull in static buffers */
179 /**********************************************************************/
181 #ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
182 struct passwd *fgetpwent(FILE *stream)
185 struct passwd *resultbuf = RESULTBUF(fgetpwent);
186 char *buffer = BUFFER(fgetpwent);
187 struct passwd *result;
189 fgetpwent_r(stream, resultbuf, buffer, sizeof(BUFFER(fgetpwent)), &result);
193 struct group *fgetgrent(FILE *stream)
196 struct group *resultbuf = RESULTBUF(fgetgrent);
197 char *buffer = BUFFER(fgetgrent);
198 struct group *result;
200 fgetgrent_r(stream, resultbuf, buffer, sizeof(BUFFER(fgetgrent)), &result);
205 #if ENABLE_USE_BB_SHADOW
206 #ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
207 struct spwd *fgetspent(FILE *stream)
210 struct spwd *resultbuf = RESULTBUF(fgetspent);
211 char *buffer = BUFFER(fgetspent);
214 fgetspent_r(stream, resultbuf, buffer, sizeof(BUFFER(fgetspent)), &result);
219 #ifdef UNUSED_FOR_NOW
220 int sgetspent_r(const char *string, struct spwd *result_buf,
221 char *buffer, size_t buflen, struct spwd **result)
227 if (buflen < PWD_BUFFER_SIZE) {
233 if (string != buffer) {
234 if (strlen(string) >= buflen) {
237 strcpy(buffer, string);
240 rv = bb__parsespent(result_buf, buffer);
242 *result = result_buf;
249 #endif /* ENABLE_USE_BB_SHADOW */
251 /**********************************************************************/
253 #define GETXXKEY_R_FUNC getpwnam_r
254 #define GETXXKEY_R_PARSER bb__parsepwent
255 #define GETXXKEY_R_ENTTYPE struct passwd
256 #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key))
257 #define GETXXKEY_R_KEYTYPE const char *__restrict
258 #define GETXXKEY_R_PATHNAME _PATH_PASSWD
259 #include "pwd_grp_internal.c"
261 #define GETXXKEY_R_FUNC getgrnam_r
262 #define GETXXKEY_R_PARSER bb__parsegrent
263 #define GETXXKEY_R_ENTTYPE struct group
264 #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key))
265 #define GETXXKEY_R_KEYTYPE const char *__restrict
266 #define GETXXKEY_R_PATHNAME _PATH_GROUP
267 #include "pwd_grp_internal.c"
269 #if ENABLE_USE_BB_SHADOW
270 #define GETXXKEY_R_FUNC getspnam_r
271 #define GETXXKEY_R_PARSER bb__parsespent
272 #define GETXXKEY_R_ENTTYPE struct spwd
273 #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key))
274 #define GETXXKEY_R_KEYTYPE const char *__restrict
275 #define GETXXKEY_R_PATHNAME _PATH_SHADOW
276 #include "pwd_grp_internal.c"
279 #define GETXXKEY_R_FUNC getpwuid_r
280 #define GETXXKEY_R_PARSER bb__parsepwent
281 #define GETXXKEY_R_ENTTYPE struct passwd
282 #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key)
283 #define GETXXKEY_R_KEYTYPE uid_t
284 #define GETXXKEY_R_PATHNAME _PATH_PASSWD
285 #include "pwd_grp_internal.c"
287 #define GETXXKEY_R_FUNC getgrgid_r
288 #define GETXXKEY_R_PARSER bb__parsegrent
289 #define GETXXKEY_R_ENTTYPE struct group
290 #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key)
291 #define GETXXKEY_R_KEYTYPE gid_t
292 #define GETXXKEY_R_PATHNAME _PATH_GROUP
293 #include "pwd_grp_internal.c"
295 /**********************************************************************/
296 /* TODO: audit & stop using these in bbox, they pull in static buffers */
298 /* This one has many users */
299 struct passwd *getpwuid(uid_t uid)
302 struct passwd *resultbuf = RESULTBUF(getpwuid);
303 char *buffer = BUFFER(getpwuid);
304 struct passwd *result;
306 getpwuid_r(uid, resultbuf, buffer, sizeof(BUFFER(getpwuid)), &result);
310 /* This one has many users */
311 struct group *getgrgid(gid_t gid)
314 struct group *resultbuf = RESULTBUF(getgrgid);
315 char *buffer = BUFFER(getgrgid);
316 struct group *result;
318 getgrgid_r(gid, resultbuf, buffer, sizeof(BUFFER(getgrgid)), &result);
322 #if 0 //ENABLE_USE_BB_SHADOW
323 /* This function is non-standard and is currently not built. It seems
324 * to have been created as a reentrant version of the non-standard
325 * functions getspuid. Why getspuid was added, I do not know. */
326 int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf,
327 char *__restrict buffer, size_t buflen,
328 struct spwd **__restrict result)
332 struct passwd password;
333 char pwd_buff[PWD_BUFFER_SIZE];
336 rv = getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp);
338 rv = getspnam_r(password.pw_name, resultbuf, buffer, buflen, result);
344 /* This function is non-standard and is currently not built.
345 * Why it was added, I do not know. */
346 struct spwd *getspuid(uid_t uid)
349 struct spwd *resultbuf = RESULTBUF(getspuid);
350 char *buffer = BUFFER(getspuid);
353 getspuid_r(uid, resultbuf, buffer, sizeof(BUFFER(getspuid)), &result);
358 /* This one has many users */
359 struct passwd *getpwnam(const char *name)
362 struct passwd *resultbuf = RESULTBUF(getpwnam);
363 char *buffer = BUFFER(getpwnam);
364 struct passwd *result;
366 getpwnam_r(name, resultbuf, buffer, sizeof(BUFFER(getpwnam)), &result);
370 /* This one has many users */
371 struct group *getgrnam(const char *name)
374 struct group *resultbuf = RESULTBUF(getgrnam);
375 char *buffer = BUFFER(getgrnam);
376 struct group *result;
378 getgrnam_r(name, resultbuf, buffer, sizeof(BUFFER(getgrnam)), &result);
382 #if 0 //ENABLE_USE_BB_SHADOW
383 struct spwd *getspnam(const char *name)
386 struct spwd *resultbuf = RESULTBUF(getspnam);
387 char *buffer = BUFFER(getspnam);
390 getspnam_r(name, resultbuf, buffer, sizeof(BUFFER(getspnam)), &result);
395 /**********************************************************************/
397 /* FIXME: we don't have such CONFIG_xx - ?! */
399 #if defined CONFIG_USE_BB_THREADSAFE_SHADOW && defined PTHREAD_MUTEX_INITIALIZER
400 static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
401 # define LOCK pthread_mutex_lock(&mylock)
402 # define UNLOCK pthread_mutex_unlock(&mylock);
404 # define LOCK ((void) 0)
405 # define UNLOCK ((void) 0)
408 static FILE *pwf /*= NULL*/;
429 int getpwent_r(struct passwd *__restrict resultbuf,
430 char *__restrict buffer, size_t buflen,
431 struct passwd **__restrict result)
436 *result = NULL; /* In case of error... */
439 pwf = fopen_for_read(_PATH_PASSWD);
446 rv = bb__pgsreader(bb__parsepwent, resultbuf, buffer, buflen, pwf);
456 static FILE *grf /*= NULL*/;
476 int getgrent_r(struct group *__restrict resultbuf,
477 char *__restrict buffer, size_t buflen,
478 struct group **__restrict result)
483 *result = NULL; /* In case of error... */
486 grf = fopen_for_read(_PATH_GROUP);
493 rv = bb__pgsreader(bb__parsegrent, resultbuf, buffer, buflen, grf);
503 #ifdef UNUSED_FOR_NOW
504 #if ENABLE_USE_BB_SHADOW
505 static FILE *spf /*= NULL*/;
525 int getspent_r(struct spwd *resultbuf, char *buffer,
526 size_t buflen, struct spwd **result)
531 *result = NULL; /* In case of error... */
534 spf = fopen_for_read(_PATH_SHADOW);
541 rv = bb__pgsreader(bb__parsespent, resultbuf, buffer, buflen, spf);
551 #endif /* UNUSED_FOR_NOW */
553 #ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
554 struct passwd *getpwent(void)
556 static char line_buff[PWD_BUFFER_SIZE];
557 static struct passwd pwd;
558 struct passwd *result;
560 getpwent_r(&pwd, line_buff, sizeof(line_buff), &result);
564 struct group *getgrent(void)
566 static char line_buff[GRP_BUFFER_SIZE];
567 static struct group gr;
568 struct group *result;
570 getgrent_r(&gr, line_buff, sizeof(line_buff), &result);
574 #if ENABLE_USE_BB_SHADOW
575 struct spwd *getspent(void)
577 static char line_buff[PWD_BUFFER_SIZE];
578 static struct spwd spwd;
581 getspent_r(&spwd, line_buff, sizeof(line_buff), &result);
585 struct spwd *sgetspent(const char *string)
587 static char line_buff[PWD_BUFFER_SIZE];
588 static struct spwd spwd;
591 sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result);
595 #endif /* UNUSED_SINCE_WE_AVOID_STATIC_BUFS */
597 static gid_t *getgrouplist_internal(int *ngroups_ptr, const char *user, gid_t gid)
603 char buff[PWD_BUFFER_SIZE];
605 /* We alloc space for 8 gids at a time. */
606 group_list = xmalloc(8 * sizeof(group_list[0]));
610 grfile = fopen_for_read(_PATH_GROUP);
612 while (!bb__pgsreader(bb__parsegrent, &group, buff, sizeof(buff), grfile)) {
614 assert(group.gr_mem); /* Must have at least a NULL terminator. */
615 if (group.gr_gid == gid)
617 for (m = group.gr_mem; *m; m++) {
618 if (strcmp(*m, user) != 0)
620 group_list = xrealloc_vector(group_list, /*8=2^3:*/ 3, ngroups);
621 group_list[ngroups++] = group.gr_gid;
627 *ngroups_ptr = ngroups;
631 int initgroups(const char *user, gid_t gid)
634 gid_t *group_list = getgrouplist_internal(&ngroups, user, gid);
636 ngroups = setgroups(ngroups, group_list);
641 int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
643 int ngroups_old = *ngroups;
644 gid_t *group_list = getgrouplist_internal(ngroups, user, gid);
646 if (*ngroups <= ngroups_old) {
647 ngroups_old = *ngroups;
648 memcpy(groups, group_list, ngroups_old * sizeof(groups[0]));
656 #ifdef UNUSED_SINCE_WE_AVOID_STATIC_BUFS
657 int putpwent(const struct passwd *__restrict p, FILE *__restrict f)
662 /* glibc does this check */
669 /* No extra thread locking is needed above what fprintf does. */
670 if (fprintf(f, "%s:%s:%lu:%lu:%s:%s:%s\n",
671 p->pw_name, p->pw_passwd,
672 (unsigned long)(p->pw_uid),
673 (unsigned long)(p->pw_gid),
674 p->pw_gecos, p->pw_dir, p->pw_shell) >= 0
682 int putgrent(const struct group *__restrict p, FILE *__restrict f)
687 /* glibc does this check */
694 if (fprintf(f, "%s:%s:%lu:",
695 p->gr_name, p->gr_passwd,
696 (unsigned long)(p->gr_gid)) >= 0
698 static const char format[] ALIGN1 = ",%s";
710 if (fputc('\n', f) >= 0) {
715 if (fprintf(f, fmt, *m) < 0) {
727 #if ENABLE_USE_BB_SHADOW
728 #ifdef UNUSED_FOR_NOW
729 static const unsigned char put_sp_off[] ALIGN1 = {
730 offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */
731 offsetof(struct spwd, sp_min), /* 3 - not a char ptr */
732 offsetof(struct spwd, sp_max), /* 4 - not a char ptr */
733 offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */
734 offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */
735 offsetof(struct spwd, sp_expire) /* 7 - not a char ptr */
738 int putspent(const struct spwd *p, FILE *stream)
745 /* Unlike putpwent and putgrent, glibc does not check the args. */
746 if (fprintf(stream, "%s:%s:", p->sp_namp,
747 (p->sp_pwdp ? p->sp_pwdp : "")) < 0
752 for (i = 0; i < sizeof(put_sp_off); i++) {
754 x = *(long *)((char *)p + put_sp_off[i]);
758 if (fprintf(stream, fmt, x) < 0) {
763 if ((p->sp_flag != ~0UL) && (fprintf(stream, "%lu", p->sp_flag) < 0)) {
767 if (fputc('\n', stream) > 0) {
775 #endif /* USE_BB_SHADOW */
777 /**********************************************************************/
778 /* Internal functions */
779 /**********************************************************************/
781 static const unsigned char pw_off[] ALIGN1 = {
782 offsetof(struct passwd, pw_name), /* 0 */
783 offsetof(struct passwd, pw_passwd), /* 1 */
784 offsetof(struct passwd, pw_uid), /* 2 - not a char ptr */
785 offsetof(struct passwd, pw_gid), /* 3 - not a char ptr */
786 offsetof(struct passwd, pw_gecos), /* 4 */
787 offsetof(struct passwd, pw_dir), /* 5 */
788 offsetof(struct passwd, pw_shell) /* 6 */
791 static int FAST_FUNC bb__parsepwent(void *data, char *line)
799 p = (char *) data + pw_off[i];
801 if (i < 2 || i > 3) {
802 *((char **) p) = line;
806 /* NOTE: glibc difference - glibc allows omission of
807 * ':' seperators after the gid field if all remaining
808 * entries are empty. We require all separators. */
809 line = strchr(line, ':');
814 unsigned long t = strtoul(line, &endptr, 10);
815 /* Make sure we had at least one digit, and that the
816 * failing char is the next field seperator ':'. See
817 * glibc difference note above. */
818 /* TODO: Also check for leading whitespace? */
819 if ((endptr == line) || (*endptr != ':')) {
823 if (i & 1) { /* i == 3 -- gid */
825 } else { /* i == 2 -- uid */
837 /**********************************************************************/
839 static const unsigned char gr_off[] ALIGN1 = {
840 offsetof(struct group, gr_name), /* 0 */
841 offsetof(struct group, gr_passwd), /* 1 */
842 offsetof(struct group, gr_gid) /* 2 - not a char ptr */
845 static int FAST_FUNC bb__parsegrent(void *data, char *line)
853 end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
856 p = (char *) data + gr_off[i];
859 *((char **) p) = line;
860 line = strchr(line, ':');
867 *((gid_t *) p) = strtoul(line, &endptr, 10);
869 /* NOTE: glibc difference - glibc allows omission of the
870 * trailing colon when there is no member list. We treat
871 * this as an error. */
873 /* Make sure we had at least one digit, and that the
874 * failing char is the next field seperator ':'. See
875 * glibc difference note above. */
876 if ((endptr == line) || (*endptr != ':')) {
880 i = 1; /* Count terminating NULL ptr. */
883 if (p[1]) { /* We have a member list to process. */
884 /* Overwrite the last ':' with a ',' before counting.
885 * This allows us to (1) test for initial ','
886 * and (2) adds one ',' so that the number of commas
887 * equals the member count. */
890 /* NOTE: glibc difference - glibc allows and trims leading
891 * (but not trailing) space. We treat this as an error. */
892 /* NOTE: glibc difference - glibc allows consecutive and
893 * trailing commas, and ignores "empty string" users. We
894 * treat this as an error. */
897 *p = 0; /* nul-terminate each member string. */
898 if (!*++p || (*p == ',') || isspace(*p)) {
905 /* Now align (p+1), rounding up. */
906 /* Assumes sizeof(char **) is a power of 2. */
907 members = (char **)( (((intptr_t) p) + sizeof(char **))
908 & ~((intptr_t)(sizeof(char **) - 1)) );
910 if (((char *)(members + i)) > end_of_buf) { /* No space. */
914 ((struct group *) data)->gr_mem = members;
917 p = endptr; /* Pointing to char prior to first member. */
936 /**********************************************************************/
938 #if ENABLE_USE_BB_SHADOW
939 static const unsigned char sp_off[] ALIGN1 = {
940 offsetof(struct spwd, sp_namp), /* 0: char* */
941 offsetof(struct spwd, sp_pwdp), /* 1: char* */
942 offsetof(struct spwd, sp_lstchg), /* 2: long */
943 offsetof(struct spwd, sp_min), /* 3: long */
944 offsetof(struct spwd, sp_max), /* 4: long */
945 offsetof(struct spwd, sp_warn), /* 5: long */
946 offsetof(struct spwd, sp_inact), /* 6: long */
947 offsetof(struct spwd, sp_expire), /* 7: long */
948 offsetof(struct spwd, sp_flag) /* 8: unsigned long */
951 static int FAST_FUNC bb__parsespent(void *data, char *line)
959 p = (char *) data + sp_off[i];
961 *((char **) p) = line;
962 line = strchr(line, ':');
967 *((long *) p) = strtoul(line, &endptr, 10);
968 if (endptr == line) {
976 return 0; /* all ok */
990 /**********************************************************************/
992 /* Reads until EOF, or until it finds a line which fits in the buffer
993 * and for which the parser function succeeds.
995 * Returns 0 on success and ENOENT for end-of-file (glibc convention).
997 static int bb__pgsreader(
998 int FAST_FUNC (*parserfunc)(void *d, char *line),
1000 char *__restrict line_buff,
1007 if (buflen < PWD_BUFFER_SIZE) {
1014 if (!fgets(line_buff, buflen, f)) {
1022 int line_len = strlen(line_buff) - 1;
1023 if (line_len >= 0 && line_buff[line_len] == '\n') {
1024 line_buff[line_len] = '\0';
1026 if (line_len + 2 == buflen) {
1027 /* A start (or continuation) of overlong line */
1030 } /* else: a last line in the file, and it has no '\n' */
1034 /* This "line" is a remainder of overlong line, ignore */
1039 /* NOTE: glibc difference - glibc strips leading whitespace from
1040 * records. We do not allow leading whitespace. */
1042 /* Skip empty lines, comment lines, and lines with leading
1044 if (line_buff[0] != '\0' && line_buff[0] != '#' && !isspace(line_buff[0])) {
1045 if (parserfunc == bb__parsegrent) {
1046 /* Do evil group hack:
1047 * The group entry parsing function needs to know where
1048 * the end of the buffer is so that it can construct the
1049 * group member ptr table. */
1050 ((struct group *) data)->gr_name = line_buff + buflen;
1052 if (parserfunc(data, line_buff) == 0) {