Description of problem: getgrouplist does not return groups whose lines in /etc/group are longer than 1024 characters. It appears that _nss_files_parse_grent decides to return 0 after the input buffer has been resized to be large enough. Version-Release number of selected component (if applicable): glibc-2.14-5.x86_64 How reproducible: Add a root to a group with a line in /etc/groups that is longer than 1024 characters. Observer the group is not listed with: #define _BSD_SOURCE 1 #include <stdio.h> #include <sys/types.h> #include <grp.h> #include <stdlib.h> #include <string.h> #include <errno.h> void *xmalloc(size_t size) { void *ptr; ptr = malloc(size); if (!ptr) { fprintf(stderr, "malloc failed:%s\n", strerror(errno)); exit(1); } memset(ptr, '\0', size); return ptr; } int main(int argc, char **argv) { { char *user_name = "root"; gid_t user_gid = 0; gid_t *grouplist, grouptmp; int n_groups, i; n_groups = 1; if (getgrouplist(user_name, user_gid, &grouptmp, &n_groups) == -1) { grouplist = (gid_t *)xmalloc(sizeof(gid_t) * (n_groups + 1)); if (getgrouplist(user_name, user_gid, grouplist, &n_groups) > 0) { for (i = 0; i < n_groups; i++) { printf("%u\n", grouplist[i]); } } free(grouplist); } } return 0; }
I cannot reproduce that.
glibc-2.14.1-1 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/glibc-2.14.1-1
Package glibc-2.14.1-1: * should fix your issue, * was pushed to the Fedora 15 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing glibc-2.14.1-1' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2011-14053 then log in and leave karma (feedback).
glibc-2.14.90-12.999 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/FEDORA-2011-14504
glibc-2.14.90-12.999 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.
glibc-2.14.1-4 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/glibc-2.14.1-4
glibc-2.14.1-5 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/glibc-2.14.1-5
glibc-2.14.1-5 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.