13 __nss_configure_lookup ("passwd", "test1");
15 static const unsigned int pwdids
[] = { 100, 30, 200, 60, 20000 };
16 #define npwdids (sizeof (pwdids) / sizeof (pwdids[0]))
19 const unsigned int *np
= pwdids
;
20 for (struct passwd
*p
= getpwent (); p
!= NULL
; ++np
, p
= getpwent ())
21 if (p
->pw_uid
!= *np
|| strncmp (p
->pw_name
, "name", 4) != 0
22 || atol (p
->pw_name
+ 4) != *np
)
24 printf ("passwd entry %td wrong (%s, %u)\n",
25 np
- pwdids
, p
->pw_name
, p
->pw_uid
);
32 for (int i
= npwdids
- 1; i
>= 0; --i
)
35 snprintf (buf
, sizeof (buf
), "name%u", pwdids
[i
]);
37 struct passwd
*p
= getpwnam (buf
);
38 if (p
== NULL
|| p
->pw_uid
!= pwdids
[i
] || strcmp (buf
, p
->pw_name
) != 0)
40 printf ("passwd entry \"%s\" wrong\n", buf
);
44 p
= getpwuid (pwdids
[i
]);
45 if (p
== NULL
|| p
->pw_uid
!= pwdids
[i
] || strcmp (buf
, p
->pw_name
) != 0)
47 printf ("passwd entry %u wrong\n", pwdids
[i
]);
51 snprintf (buf
, sizeof (buf
), "name%u", pwdids
[i
] + 1);
56 printf ("passwd entry \"%s\" wrong\n", buf
);
60 p
= getpwuid (pwdids
[i
] + 1);
63 printf ("passwd entry %u wrong\n", pwdids
[i
] + 1);
71 #define TEST_FUNCTION do_test ()
72 #include "../test-skeleton.c"