Package: libnss-ldap
Version: 261.2.1

when using LDAP, calling getgrent returns both local and LDAP groups.
if you then reset the list with setgrent (with or without a preceeding
endgrent), then you just get the local list back.

I've tried changing to libnss-ldapd and this fixed the problem. 

Test code attached.

With libnss-ldap:
# ./a.out 
found group audio
found group skypeclient
found group audio
round two
found group audio

With libnss-ldapd:
found group audio
errno a : 34  (not sure what that's about! will be filing a separate
bug for that)
found group skypeclient
found group audio
round two
found group audio
found group skypeclient
found group audio


Adrian
-- 
bitcube.co.uk - Linux infrastructure consultancy
Puppet, Debian, Red Hat, Ubuntu, CentOS, ...
#include <sys/types.h>
#include <grp.h>
#include <stdio.h>
#include <errno.h>

main()
{
  struct group * group;
  errno=0;
  while(group=getgrent())
  {
     if (errno != 0) {
       printf("errno a : %d (%s)\n",errno, strerror(errno));
     }
     //printf("group: %s\n",group->gr_name);
     if (strcmp(group->gr_name,"audio")==0 ||
         strcmp(group->gr_name,"skypeclient")==0) {
       printf ("found group %s\n",group->gr_name);
     }
     errno=0;
  }
  endgrent();
     if (errno != 0) {
       printf("errno b : %d\n",errno);
     }
  setgrent();
     if (errno != 0) {
       printf("errno c : %d\n",errno);
     }
  printf("round two\n");
  while(group=getgrent())
  {
     if (errno != 0) {
       printf("errno d : %d\n",errno);
     }
     if (strcmp(group->gr_name,"audio")==0 ||
         strcmp(group->gr_name,"skypeclient")==0) {
       printf ("found group %s\n",group->gr_name);
     }
  }
}

Reply via email to