source: trunk/server/testsuite/nsswitch/pam_winbind_syms.c

Last change on this file was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 1.0 KB
Line 
1/*
2 * Test required functions are exported from the pam_winbind.so library
3 */
4
5#include <stdio.h>
6#include <dlfcn.h>
7
8/* Symbol list to check */
9
10static char *symlist[] = {
11 "pam_sm_acct_mgmt",
12 "pam_sm_authenticate",
13 "pam_sm_setcred",
14 NULL
15};
16
17/* Main function */
18
19int main(int argc, char **argv)
20{
21 void *handle, *sym;
22 int i, y;
23
24 /* Open library */
25
26 if (argc != 2) {
27 printf("FAIL: usage '%s sharedlibname'\n", argv[0]);
28 return 1;
29 }
30
31 handle = dlopen(argv[1], RTLD_NOW);
32
33 if (handle == NULL) {
34 printf("FAIL: could not dlopen library: %s\n", dlerror());
35 return 1;
36 }
37
38 /* Read symbols */
39
40 for (i = 0; symlist[i] != NULL; i++) {
41 sym = dlsym(handle, symlist[i]);
42 if (sym == NULL) {
43 printf("FAIL: could not resolve symbol '%s': %s\n",
44 symlist[i], dlerror());
45 return 1;
46 } else {
47 printf("loaded symbol '%s' ok\n", symlist[i]);
48 }
49 }
50
51 /* Clean up */
52
53 dlclose(handle);
54 return 0;
55}
Note: See TracBrowser for help on using the repository browser.