| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * Test required functions are exported from the libnss_winbind.so library
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #include <stdio.h>
|
|---|
| 6 | #include <dlfcn.h>
|
|---|
| 7 |
|
|---|
| 8 | /* Symbol list to check */
|
|---|
| 9 |
|
|---|
| 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
|
|---|
| 23 | };
|
|---|
| 24 |
|
|---|
| 25 | /* Main function */
|
|---|
| 26 |
|
|---|
| 27 | int main(int argc, char **argv)
|
|---|
| 28 | {
|
|---|
| 29 | void *handle, *sym;
|
|---|
| 30 | int i, y;
|
|---|
| 31 |
|
|---|
| 32 | /* Open library */
|
|---|
| 33 |
|
|---|
| 34 | if (argc != 2) {
|
|---|
| 35 | printf("FAIL: usage '%s sharedlibname'\n", argv[0]);
|
|---|
| 36 | return 1;
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | handle = dlopen(argv[1], RTLD_NOW);
|
|---|
| 40 |
|
|---|
| 41 | if (handle == NULL) {
|
|---|
| 42 | printf("FAIL: could not dlopen library: %s\n", dlerror());
|
|---|
| 43 | return 1;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | /* Read symbols */
|
|---|
| 47 |
|
|---|
| 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]);
|
|---|
| 56 | }
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | /* Clean up */
|
|---|
| 60 |
|
|---|
| 61 | dlclose(handle);
|
|---|
| 62 | return 0;
|
|---|
| 63 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.