This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix nscd lookup for innetgr when netgroup has wildcards (BZ #16758)


On Wed, Mar 26, 2014 at 05:59:13PM -0400, Carlos O'Donell wrote:
> > OK to checkin as long as for the sake of completeness tested the
> > other two missing combinations of NULLs in calls to innetgr with
> > and without nscd and it worked.
> 
> You would also make me very happy to see the testing permutations
> include permuting the triplet in /etc/netgroups so the null moves
> to all possible spaces and is tested that way to flush out any
> other corner cases.

ack, this is the program I used:

#include <stdio.h>
#include <netdb.h>

int
main (int argc, char **argv)
{
  int ret = 0;
  if (argc != 5)
    {
      printf ("Usage: %s netgroup host user domain\n", argv[0]);
      return 1;
    }
  const char *netgr = argv[1];
  const char *host = argv[2][0] ? argv[2] : NULL;
  const char *user = argv[3][0] ? argv[3] : NULL;
  const char *domain = argv[4][0] ? argv[4] : NULL;

  ret = innetgr (netgr, host, user, domain);
  if (ret)
    printf ("Found it\n");
  else
    printf ("Not found\n");

  return 0;
}

and the outputs:

[root@localhost ~]# cat /etc/netgroup
bbb (defhost,,)
ccc (,defuser,)
ddd (,,defdom)


[root@localhost ~]# ./a.out bbb defhost "" ""
Found it
[root@localhost ~]# ./a.out bbb defhost "a" ""
Found it
[root@localhost ~]# ./a.out bbb defhost "a" "a"
Found it
[root@localhost ~]# ./a.out bbb defhost "" ""
Found it
[root@localhost ~]# ./a.out bbb defhost "a" ""
Found it
[root@localhost ~]# ./a.out bbb defhost "" "a"
Found it
[root@localhost ~]# ./a.out bbb defhost "a" "a"
Found it
[root@localhost ~]# ./a.out ccc "" defuser ""
Found it
[root@localhost ~]# ./a.out ccc "a" defuser ""
Found it
[root@localhost ~]# ./a.out ccc "" defuser "a"
Found it
[root@localhost ~]# ./a.out ccc "a" defuser "a"
Found it
[root@localhost ~]# ./a.out ddd "" "" defdom
Found it
[root@localhost ~]# ./a.out ddd "a" "" defdom
Found it
[root@localhost ~]# ./a.out ddd "a" "a" defdom
Found it
[root@localhost ~]# ./a.out ddd "" "a" defdom
Found it


Siddhesh

Attachment: pgpqH9FFgFvol.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]