From d6be5f6435f4dc1d8c3e0dcf828f4e18da291f05 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Thu, 14 Jun 2001 01:13:30 +0000 Subject: [PATCH] Fix libpam's linker set stuff to use the new API (unbreak world), and get rid of gensetdefs from here as well. --- contrib/libpam/libpam/pam_static.c | 18 +++++++++--------- lib/libpam/libpam/Makefile | 11 +---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/contrib/libpam/libpam/pam_static.c b/contrib/libpam/libpam/pam_static.c index aac3e99ff9f..e511a7743fb 100644 --- a/contrib/libpam/libpam/pam_static.c +++ b/contrib/libpam/libpam/pam_static.c @@ -16,7 +16,7 @@ #ifdef PAM_STATIC -extern struct linker_set _pam_static_modules; +SET_DECLARE(_pam_static_modules, struct pam_module); /* Return pointer to data structure used to define a static module */ struct pam_module * _pam_open_static_handler(const char *path) @@ -24,8 +24,7 @@ struct pam_module * _pam_open_static_handler(const char *path) int i; const char *clpath = path; char *lpath, *end; - struct pam_module **static_modules = - (struct pam_module **)_pam_static_modules.ls_items; + struct pam_module **static_module; if (strchr(clpath, '/')) { /* ignore path and leading "/" */ @@ -41,16 +40,17 @@ struct pam_module * _pam_open_static_handler(const char *path) } /* now go find the module */ - for (i = 0; static_modules[i] != NULL; i++) { - D(("%s=?%s\n", lpath, static_modules[i]->name)); - if (static_modules[i]->name && - ! strcmp(static_modules[i]->name, lpath)) { - break; + SET_FOREACH(static_module, _pam_static_modules) { + D(("%s=?%s\n", lpath, (*static_module)->name)); + if ((*static_module)->name && + ! strcmp((*static_module)->name, lpath)) { + free(lpath); + return (*static_module); } } free(lpath); - return (static_modules[i]); + return (NULL); } /* Return pointer to function requested from static module diff --git a/lib/libpam/libpam/Makefile b/lib/libpam/libpam/Makefile index 3806f52e437..49186d3ed66 100644 --- a/lib/libpam/libpam/Makefile +++ b/lib/libpam/libpam/Makefile @@ -95,16 +95,7 @@ _EXTRADEPEND: pam_static.c CLEANFILES+= setdef0.o _pam_static_modules.o setdef1.o \ setdef0.c setdef1.c setdefs.h -pam_static_modules.o: setdef0.o pam_static.o _pam_static_modules.o setdef1.o - ${LD} -o ${.TARGET} -r ${.ALLSRC} - -setdef0.o: setdef0.c setdefs.h -setdef1.o: setdef1.c setdefs.h - -setdef0.c setdef1.c setdefs.h: _pam_static_modules.o - gensetdefs ${.ALLSRC} - -_pam_static_modules.o: ${STATIC_MODULES} +pam_static_modules.o: pam_static.o ${STATIC_MODULES} ${LD} -o ${.TARGET} -r --whole-archive ${.ALLSRC} .else pam_static_modules.o: pam_static.o ${STATIC_MODULES}