Beispiel #1
0
static void nss_test_groups(void)
{
	struct group *grp;

	nss_setgrent();
	/* loop over all groups */
	while ((grp = nss_getgrent())) {
		printf("Testing group %s\n", grp->gr_name);
		printf("getgrent: "); print_group(grp);
		grp = nss_getgrnam(grp->gr_name);
		if (!grp) {
			total_errors++;
			printf("ERROR: can't getgrnam\n");
			continue;
		}
		printf("getgrnam: "); print_group(grp);
		grp = nss_getgrgid(grp->gr_gid);
		if (!grp) {
			total_errors++;
			printf("ERROR: can't getgrgid\n");
			continue;
		}
		printf("getgrgid: "); print_group(grp);
		printf("\n");
	}
	nss_endgrent();
}
Beispiel #2
0
static enum nss_status
internal_endgrent (ent_t *ent)
{
  if (ent->stream != NULL)
    {
      fclose (ent->stream);
      ent->stream = NULL;
    }

  if (ent->blacklist.data != NULL)
    {
      ent->blacklist.current = 1;
      ent->blacklist.data[0] = '|';
      ent->blacklist.data[1] = '\0';
    }
  else
    ent->blacklist.current = 0;

  if (ent->need_endgrent && nss_endgrent != NULL)
    nss_endgrent ();

  return NSS_STATUS_SUCCESS;
}