lib/popt: Fix typo in README.
[Samba/gbeck.git] / testsuite / nsswitch / nss_winbind_syms.c
blob29d1da9d4995882012b204a4676c88f173e5d98d
1 /*
2 * Test required functions are exported from the libnss_winbind.so library
3 */
5 #include <stdio.h>
6 #include <dlfcn.h>
8 /* Symbol list to check */
10 static char *symlist[] = {
11 "_nss_winbind_getgrent_r",
12 "_nss_winbind_endgrent",
13 "_nss_winbind_endpwent",
14 "_nss_winbind_getgrgid_r",
15 "_nss_winbind_getgrnam_r",
16 "_nss_winbind_getpwent_r",
17 "_nss_winbind_getpwnam_r",
18 "_nss_winbind_getpwuid_r",
19 "_nss_winbind_setgrent",
20 "_nss_winbind_setpwent",
21 "_nss_winbind_initgroups",
22 NULL
25 /* Main function */
27 int main(int argc, char **argv)
29 void *handle, *sym;
30 int i, y;
32 /* Open library */
34 if (argc != 2) {
35 printf("FAIL: usage '%s sharedlibname'\n", argv[0]);
36 return 1;
39 handle = dlopen(argv[1], RTLD_NOW);
41 if (handle == NULL) {
42 printf("FAIL: could not dlopen library: %s\n", dlerror());
43 return 1;
46 /* Read symbols */
48 for (i = 0; symlist[i] != NULL; i++) {
49 sym = dlsym(handle, symlist[i]);
50 if (sym == NULL) {
51 printf("FAIL: could not resolve symbol '%s': %s\n",
52 symlist[i], dlerror());
53 return 1;
54 } else {
55 printf("loaded symbol '%s' ok\n", symlist[i]);
59 /* Clean up */
61 dlclose(handle);
62 return 0;