1 /* vi: set sw=4 ts=4: */
2 /* Copyright (C) 2003 Manuel Novoa III
4 * Licensed under GPL v2, or later. See file LICENSE in this tarball.
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.
25 #define _PATH_SHADOW "/etc/shadow"
28 #define _PATH_PASSWD "/etc/passwd"
31 #define _PATH_GROUP "/etc/group"
34 /**********************************************************************/
35 /* Sizes for statically allocated buffers. */
37 /* If you change these values, also change _SC_GETPW_R_SIZE_MAX and
38 * _SC_GETGR_R_SIZE_MAX in libc/unistd/sysconf.c to match */
39 #define PWD_BUFFER_SIZE 256
40 #define GRP_BUFFER_SIZE 256
42 /**********************************************************************/
43 /* Prototypes for internal functions. */
45 static int bb__pgsreader(int (*parserfunc)(void *d, char *line), void *data,
46 char *__restrict line_buff, size_t buflen, FILE *f);
48 static int bb__parsepwent(void *pw, char *line);
49 static int bb__parsegrent(void *gr, char *line);
50 #if ENABLE_USE_BB_SHADOW
51 static int bb__parsespent(void *sp, char *line);
54 /**********************************************************************/
55 /* We avoid having big global data. */
58 /* Smaller things first */
59 struct passwd getpwuid_resultbuf;
60 struct group getgrgid_resultbuf;
61 struct passwd getpwnam_resultbuf;
62 struct group getgrnam_resultbuf;
64 char getpwuid_buffer[PWD_BUFFER_SIZE];
65 char getgrgid_buffer[GRP_BUFFER_SIZE];
66 char getpwnam_buffer[PWD_BUFFER_SIZE];
67 char getgrnam_buffer[GRP_BUFFER_SIZE];
69 struct passwd fgetpwent_resultbuf;
70 struct group fgetgrent_resultbuf;
71 struct spwd fgetspent_resultbuf;
72 char fgetpwent_buffer[PWD_BUFFER_SIZE];
73 char fgetgrent_buffer[GRP_BUFFER_SIZE];
74 char fgetspent_buffer[PWD_BUFFER_SIZE];
76 #if 0 //ENABLE_USE_BB_SHADOW
77 struct spwd getspuid_resultbuf;
78 struct spwd getspnam_resultbuf;
79 char getspuid_buffer[PWD_BUFFER_SIZE];
80 char getspnam_buffer[PWD_BUFFER_SIZE];
82 // Not converted - too small to bother
83 //pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
84 //FILE *pwf /*= NULL*/;
85 //FILE *grf /*= NULL*/;
86 //FILE *spf /*= NULL*/;
88 struct passwd getpwent_pwd;
89 struct group getgrent_gr;
90 char getpwent_line_buff[PWD_BUFFER_SIZE];
91 char getgrent_line_buff[GRP_BUFFER_SIZE];
93 #if 0 //ENABLE_USE_BB_SHADOW
94 struct spwd getspent_spwd;
95 struct spwd sgetspent_spwd;
96 char getspent_line_buff[PWD_BUFFER_SIZE];
97 char sgetspent_line_buff[PWD_BUFFER_SIZE];
101 static struct statics *ptr_to_statics;
103 static struct statics *get_S(void)
106 ptr_to_statics = xzalloc(sizeof(*ptr_to_statics));
107 return ptr_to_statics;
110 /* Always use in this order, get_S() must be called first */
111 #define RESULTBUF(name) &((S = get_S())->name##_resultbuf)
112 #define BUFFER(name) (S->name##_buffer)
114 /**********************************************************************/
115 /* For the various fget??ent_r funcs, return
118 * ENOENT: end-of-file encountered
119 * ERANGE: buflen too small
120 * other error values possible. See bb__pgsreader.
122 * Also, *result == resultbuf on success and NULL on failure.
124 * NOTE: glibc difference - For the ENOENT case, glibc also sets errno.
125 * We do not, as it really isn't an error if we reach the end-of-file.
126 * Doing so is analogous to having fgetc() set errno on EOF.
128 /**********************************************************************/
130 int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf,
131 char *__restrict buffer, size_t buflen,
132 struct passwd **__restrict result)
138 rv = bb__pgsreader(bb__parsepwent, resultbuf, buffer, buflen, stream);
146 int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf,
147 char *__restrict buffer, size_t buflen,
148 struct group **__restrict result)
154 rv = bb__pgsreader(bb__parsegrent, resultbuf, buffer, buflen, stream);
162 #if ENABLE_USE_BB_SHADOW
163 int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
164 char *__restrict buffer, size_t buflen,
165 struct spwd **__restrict result)
171 rv = bb__pgsreader(bb__parsespent, resultbuf, buffer, buflen, stream);
180 /**********************************************************************/
181 /* For the various fget??ent funcs, return NULL on failure and a
182 * pointer to the appropriate struct (statically allocated) on success.
183 * TODO: audit & stop using these in bbox, they pull in static buffers */
184 /**********************************************************************/
187 struct passwd *fgetpwent(FILE *stream)
190 struct passwd *resultbuf = RESULTBUF(fgetpwent);
191 char *buffer = BUFFER(fgetpwent);
192 struct passwd *result;
194 fgetpwent_r(stream, resultbuf, buffer, sizeof(BUFFER(fgetpwent)), &result);
198 struct group *fgetgrent(FILE *stream)
201 struct group *resultbuf = RESULTBUF(fgetgrent);
202 char *buffer = BUFFER(fgetgrent);
203 struct group *result;
205 fgetgrent_r(stream, resultbuf, buffer, sizeof(BUFFER(fgetgrent)), &result);
210 #if ENABLE_USE_BB_SHADOW
212 struct spwd *fgetspent(FILE *stream)
215 struct spwd *resultbuf = RESULTBUF(fgetspent);
216 char *buffer = BUFFER(fgetspent);
219 fgetspent_r(stream, resultbuf, buffer, sizeof(BUFFER(fgetspent)), &result);
224 int sgetspent_r(const char *string, struct spwd *result_buf,
225 char *buffer, size_t buflen, struct spwd **result)
231 if (buflen < PWD_BUFFER_SIZE) {
237 if (string != buffer) {
238 if (strlen(string) >= buflen) {
241 strcpy(buffer, string);
244 rv = bb__parsespent(result_buf, buffer);
246 *result = result_buf;
254 /**********************************************************************/
256 #define GETXXKEY_R_FUNC getpwnam_r
257 #define GETXXKEY_R_PARSER bb__parsepwent
258 #define GETXXKEY_R_ENTTYPE struct passwd
259 #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key))
260 #define GETXXKEY_R_KEYTYPE const char *__restrict
261 #define GETXXKEY_R_PATHNAME _PATH_PASSWD
262 #include "pwd_grp_internal.c"
264 #define GETXXKEY_R_FUNC getgrnam_r
265 #define GETXXKEY_R_PARSER bb__parsegrent
266 #define GETXXKEY_R_ENTTYPE struct group
267 #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key))
268 #define GETXXKEY_R_KEYTYPE const char *__restrict
269 #define GETXXKEY_R_PATHNAME _PATH_GROUP
270 #include "pwd_grp_internal.c"
272 #if ENABLE_USE_BB_SHADOW
273 #define GETXXKEY_R_FUNC getspnam_r
274 #define GETXXKEY_R_PARSER bb__parsespent
275 #define GETXXKEY_R_ENTTYPE struct spwd
276 #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key))
277 #define GETXXKEY_R_KEYTYPE const char *__restrict
278 #define GETXXKEY_R_PATHNAME _PATH_SHADOW
279 #include "pwd_grp_internal.c"
282 #define GETXXKEY_R_FUNC getpwuid_r
283 #define GETXXKEY_R_PARSER bb__parsepwent
284 #define GETXXKEY_R_ENTTYPE struct passwd
285 #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key)
286 #define GETXXKEY_R_KEYTYPE uid_t
287 #define GETXXKEY_R_PATHNAME _PATH_PASSWD
288 #include "pwd_grp_internal.c"
290 #define GETXXKEY_R_FUNC getgrgid_r
291 #define GETXXKEY_R_PARSER bb__parsegrent
292 #define GETXXKEY_R_ENTTYPE struct group
293 #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key)
294 #define GETXXKEY_R_KEYTYPE gid_t
295 #define GETXXKEY_R_PATHNAME _PATH_GROUP
296 #include "pwd_grp_internal.c"
298 /**********************************************************************/
299 /* TODO: audit & stop using these in bbox, they pull in static buffers */
301 /* This one has many users */
302 struct passwd *getpwuid(uid_t uid)
305 struct passwd *resultbuf = RESULTBUF(getpwuid);
306 char *buffer = BUFFER(getpwuid);
307 struct passwd *result;
309 getpwuid_r(uid, resultbuf, buffer, sizeof(BUFFER(getpwuid)), &result);
313 /* This one has many users */
314 struct group *getgrgid(gid_t gid)
317 struct group *resultbuf = RESULTBUF(getgrgid);
318 char *buffer = BUFFER(getgrgid);
319 struct group *result;
321 getgrgid_r(gid, resultbuf, buffer, sizeof(BUFFER(getgrgid)), &result);
325 #if 0 //ENABLE_USE_BB_SHADOW
326 /* This function is non-standard and is currently not built. It seems
327 * to have been created as a reentrant version of the non-standard
328 * functions getspuid. Why getspuid was added, I do not know. */
329 int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf,
330 char *__restrict buffer, size_t buflen,
331 struct spwd **__restrict result)
335 struct passwd password;
336 char pwd_buff[PWD_BUFFER_SIZE];
339 rv = getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp);
341 rv = getspnam_r(password.pw_name, resultbuf, buffer, buflen, result);
347 /* This function is non-standard and is currently not built.
348 * Why it was added, I do not know. */
349 struct spwd *getspuid(uid_t uid)
352 struct spwd *resultbuf = RESULTBUF(getspuid);
353 char *buffer = BUFFER(getspuid);
356 getspuid_r(uid, resultbuf, buffer, sizeof(BUFFER(getspuid)), &result);
361 /* This one has many users */
362 struct passwd *getpwnam(const char *name)
365 struct passwd *resultbuf = RESULTBUF(getpwnam);
366 char *buffer = BUFFER(getpwnam);
367 struct passwd *result;
369 getpwnam_r(name, resultbuf, buffer, sizeof(BUFFER(getpwnam)), &result);
373 /* This one has many users */
374 struct group *getgrnam(const char *name)
377 struct group *resultbuf = RESULTBUF(getgrnam);
378 char *buffer = BUFFER(getgrnam);
379 struct group *result;
381 getgrnam_r(name, resultbuf, buffer, sizeof(BUFFER(getgrnam)), &result);
385 #if 0 //ENABLE_USE_BB_SHADOW
386 struct spwd *getspnam(const char *name)
389 struct spwd *resultbuf = RESULTBUF(getspnam);
390 char *buffer = BUFFER(getspnam);
393 getspnam_r(name, resultbuf, buffer, sizeof(BUFFER(getspnam)), &result);
398 #ifdef THIS_ONE_IS_UNUSED
399 /* This one doesn't use static buffers */
400 int getpw(uid_t uid, char *buf)
402 struct passwd resultbuf;
403 struct passwd *result;
404 char buffer[PWD_BUFFER_SIZE];
408 } else if (!getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) {
409 if (sprintf(buf, "%s:%s:%lu:%lu:%s:%s:%s\n",
410 resultbuf.pw_name, resultbuf.pw_passwd,
411 (unsigned long)(resultbuf.pw_uid),
412 (unsigned long)(resultbuf.pw_gid),
413 resultbuf.pw_gecos, resultbuf.pw_dir,
414 resultbuf.pw_shell) >= 0
424 /**********************************************************************/
426 /* FIXME: we don't have such CONFIG_xx - ?! */
428 #if defined CONFIG_USE_BB_THREADSAFE_SHADOW && defined PTHREAD_MUTEX_INITIALIZER
429 static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
430 # define LOCK pthread_mutex_lock(&mylock)
431 # define UNLOCK pthread_mutex_unlock(&mylock);
433 # define LOCK ((void) 0)
434 # define UNLOCK ((void) 0)
437 static FILE *pwf /*= NULL*/;
458 int getpwent_r(struct passwd *__restrict resultbuf,
459 char *__restrict buffer, size_t buflen,
460 struct passwd **__restrict result)
465 *result = NULL; /* In case of error... */
468 pwf = fopen_for_read(_PATH_PASSWD);
475 rv = bb__pgsreader(bb__parsepwent, resultbuf, buffer, buflen, pwf);
485 static FILE *grf /*= NULL*/;
505 int getgrent_r(struct group *__restrict resultbuf,
506 char *__restrict buffer, size_t buflen,
507 struct group **__restrict result)
512 *result = NULL; /* In case of error... */
515 grf = fopen_for_read(_PATH_GROUP);
522 rv = bb__pgsreader(bb__parsegrent, resultbuf, buffer, buflen, grf);
532 #if ENABLE_USE_BB_SHADOW
533 static FILE *spf /*= NULL*/;
553 int getspent_r(struct spwd *resultbuf, char *buffer,
554 size_t buflen, struct spwd **result)
559 *result = NULL; /* In case of error... */
562 spf = fopen_for_read(_PATH_SHADOW);
569 rv = bb__pgsreader(bb__parsespent, resultbuf, buffer, buflen, spf);
581 struct passwd *getpwent(void)
583 static char line_buff[PWD_BUFFER_SIZE];
584 static struct passwd pwd;
585 struct passwd *result;
587 getpwent_r(&pwd, line_buff, sizeof(line_buff), &result);
591 struct group *getgrent(void)
593 static char line_buff[GRP_BUFFER_SIZE];
594 static struct group gr;
595 struct group *result;
597 getgrent_r(&gr, line_buff, sizeof(line_buff), &result);
602 #if 0 //ENABLE_USE_BB_SHADOW
603 struct spwd *getspent(void)
605 static char line_buff[PWD_BUFFER_SIZE];
606 static struct spwd spwd;
609 getspent_r(&spwd, line_buff, sizeof(line_buff), &result);
613 struct spwd *sgetspent(const char *string)
615 static char line_buff[PWD_BUFFER_SIZE];
616 static struct spwd spwd;
619 sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result);
624 static gid_t *getgrouplist_internal(int *ngroups_ptr, const char *user, gid_t gid)
630 char buff[PWD_BUFFER_SIZE];
632 /* We alloc space for 8 gids at a time. */
633 group_list = xmalloc(8 * sizeof(group_list[0]));
637 grfile = fopen_for_read(_PATH_GROUP);
639 while (!bb__pgsreader(bb__parsegrent, &group, buff, sizeof(buff), grfile)) {
641 assert(group.gr_mem); /* Must have at least a NULL terminator. */
642 if (group.gr_gid == gid)
644 for (m = group.gr_mem; *m; m++) {
645 if (strcmp(*m, user) != 0)
647 group_list = xrealloc_vector(group_list, 3, ngroups);
648 group_list[ngroups++] = group.gr_gid;
654 *ngroups_ptr = ngroups;
658 int initgroups(const char *user, gid_t gid)
661 gid_t *group_list = getgrouplist_internal(&ngroups, user, gid);
663 ngroups = setgroups(ngroups, group_list);
668 int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
670 int ngroups_old = *ngroups;
671 gid_t *group_list = getgrouplist_internal(ngroups, user, gid);
673 if (*ngroups <= ngroups_old) {
674 ngroups_old = *ngroups;
675 memcpy(groups, group_list, ngroups_old * sizeof(groups[0]));
683 int putpwent(const struct passwd *__restrict p, FILE *__restrict f)
690 /* No extra thread locking is needed above what fprintf does. */
691 if (fprintf(f, "%s:%s:%lu:%lu:%s:%s:%s\n",
692 p->pw_name, p->pw_passwd,
693 (unsigned long)(p->pw_uid),
694 (unsigned long)(p->pw_gid),
695 p->pw_gecos, p->pw_dir, p->pw_shell) >= 0
704 int putgrent(const struct group *__restrict p, FILE *__restrict f)
706 static const char format[] ALIGN1 = ",%s";
712 if (!p || !f) { /* Sigh... glibc checks. */
715 if (fprintf(f, "%s:%s:%lu:",
716 p->gr_name, p->gr_passwd,
717 (unsigned long)(p->gr_gid)) >= 0
727 if (fputc('\n', f) >= 0) {
732 if (fprintf(f, fmt, *m) < 0) {
744 #if ENABLE_USE_BB_SHADOW
745 static const unsigned char _sp_off[] ALIGN1 = {
746 offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */
747 offsetof(struct spwd, sp_min), /* 3 - not a char ptr */
748 offsetof(struct spwd, sp_max), /* 4 - not a char ptr */
749 offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */
750 offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */
751 offsetof(struct spwd, sp_expire) /* 7 - not a char ptr */
754 int putspent(const struct spwd *p, FILE *stream)
756 static const char ld_format[] ALIGN1 = "%ld:";
763 /* Unlike putpwent and putgrent, glibc does not check the args. */
764 if (fprintf(stream, "%s:%s:", p->sp_namp,
765 (p->sp_pwdp ? p->sp_pwdp : "")) < 0
770 for (i = 0; i < sizeof(_sp_off); i++) {
772 x = *(const long *)(((const char *) p) + _sp_off[i]);
776 if (fprintf(stream, f, x) < 0) {
781 if ((p->sp_flag != ~0UL) && (fprintf(stream, "%lu", p->sp_flag) < 0)) {
785 if (fputc('\n', stream) > 0) {
794 /**********************************************************************/
795 /* Internal uClibc functions. */
796 /**********************************************************************/
798 static const unsigned char pw_off[] ALIGN1 = {
799 offsetof(struct passwd, pw_name), /* 0 */
800 offsetof(struct passwd, pw_passwd), /* 1 */
801 offsetof(struct passwd, pw_uid), /* 2 - not a char ptr */
802 offsetof(struct passwd, pw_gid), /* 3 - not a char ptr */
803 offsetof(struct passwd, pw_gecos), /* 4 */
804 offsetof(struct passwd, pw_dir), /* 5 */
805 offsetof(struct passwd, pw_shell) /* 6 */
808 static int bb__parsepwent(void *data, char *line)
816 p = (char *) data + pw_off[i];
818 if ((i & 6) ^ 2) { /* i!=2 and i!=3 */
819 *((char **) p) = line;
823 /* NOTE: glibc difference - glibc allows omission of
824 * ':' seperators after the gid field if all remaining
825 * entries are empty. We require all separators. */
826 line = strchr(line, ':');
831 unsigned long t = strtoul(line, &endptr, 10);
832 /* Make sure we had at least one digit, and that the
833 * failing char is the next field seperator ':'. See
834 * glibc difference note above. */
835 /* TODO: Also check for leading whitespace? */
836 if ((endptr == line) || (*endptr != ':')) {
840 if (i & 1) { /* i == 3 -- gid */
842 } else { /* i == 2 -- uid */
854 /**********************************************************************/
856 static const unsigned char gr_off[] ALIGN1 = {
857 offsetof(struct group, gr_name), /* 0 */
858 offsetof(struct group, gr_passwd), /* 1 */
859 offsetof(struct group, gr_gid) /* 2 - not a char ptr */
862 static int bb__parsegrent(void *data, char *line)
870 end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
873 p = (char *) data + gr_off[i];
876 *((char **) p) = line;
877 line = strchr(line, ':');
884 *((gid_t *) p) = strtoul(line, &endptr, 10);
886 /* NOTE: glibc difference - glibc allows omission of the
887 * trailing colon when there is no member list. We treat
888 * this as an error. */
890 /* Make sure we had at least one digit, and that the
891 * failing char is the next field seperator ':'. See
892 * glibc difference note above. */
893 if ((endptr == line) || (*endptr != ':')) {
897 i = 1; /* Count terminating NULL ptr. */
900 if (p[1]) { /* We have a member list to process. */
901 /* Overwrite the last ':' with a ',' before counting.
902 * This allows us to test for initial ',' and adds
903 * one ',' so that the ',' count equals the member
907 /* NOTE: glibc difference - glibc allows and trims leading
908 * (but not trailing) space. We treat this as an error. */
909 /* NOTE: glibc difference - glibc allows consecutive and
910 * trailing commas, and ignores "empty string" users. We
911 * treat this as an error. */
914 *p = 0; /* nul-terminate each member string. */
915 if (!*++p || (*p == ',') || isspace(*p)) {
922 /* Now align (p+1), rounding up. */
923 /* Assumes sizeof(char **) is a power of 2. */
924 members = (char **)( (((intptr_t) p) + sizeof(char **))
925 & ~((intptr_t)(sizeof(char **) - 1)) );
927 if (((char *)(members + i)) > end_of_buf) { /* No space. */
931 ((struct group *) data)->gr_mem = members;
934 p = endptr; /* Pointing to char prior to first member. */
953 /**********************************************************************/
955 #if ENABLE_USE_BB_SHADOW
956 static const unsigned char sp_off[] ALIGN1 = {
957 offsetof(struct spwd, sp_namp), /* 0 */
958 offsetof(struct spwd, sp_pwdp), /* 1 */
959 offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */
960 offsetof(struct spwd, sp_min), /* 3 - not a char ptr */
961 offsetof(struct spwd, sp_max), /* 4 - not a char ptr */
962 offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */
963 offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */
964 offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */
965 offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */
968 static int bb__parsespent(void *data, char *line)
976 p = (char *) data + sp_off[i];
978 *((char **) p) = line;
979 line = strchr(line, ':');
984 *((long *) p) = strtoul(line, &endptr, 10);
986 if (endptr == line) {
987 *((long *) p) = (i != 8) ? -1L : (long)(~0UL);
999 if (*endptr != ':') {
1012 /**********************************************************************/
1014 /* Reads until if EOF, or until if finds a line which fits in the buffer
1015 * and for which the parser function succeeds.
1017 * Returns 0 on success and ENOENT for end-of-file (glibc concession).
1020 static int bb__pgsreader(int (*parserfunc)(void *d, char *line), void *data,
1021 char *__restrict line_buff, size_t buflen, FILE *f)
1026 if (buflen < PWD_BUFFER_SIZE) {
1033 if (!fgets(line_buff, buflen, f)) {
1041 int line_len = strlen(line_buff) - 1;
1042 if (line_len >= 0 && line_buff[line_len] == '\n') {
1043 line_buff[line_len] = '\0';
1045 if (line_len + 2 == buflen) {
1046 /* A start (or continuation) of overlong line */
1049 } /* else: a last line in the file, and it has no '\n' */
1053 /* This "line" is a remainder of overlong line, ignore */
1058 /* NOTE: glibc difference - glibc strips leading whitespace from
1059 * records. We do not allow leading whitespace. */
1061 /* Skip empty lines, comment lines, and lines with leading
1063 if (line_buff[0] != '\0' && line_buff[0] != '#' && !isspace(line_buff[0])) {
1064 if (parserfunc == bb__parsegrent) {
1065 /* Do evil group hack:
1066 * The group entry parsing function needs to know where
1067 * the end of the buffer is so that it can construct the
1068 * group member ptr table. */
1069 ((struct group *) data)->gr_name = line_buff + buflen;
1071 if (parserfunc(data, line_buff) == 0) {