mirror of
https://github.com/linux-pam/linux-pam.git
synced 2024-11-30 13:13:49 +08:00
Relevant BUGIDs: none
Purpose of commit: bugfix Commit summary: --------------- Fix compiling of static version of shared libpam, libpamc and libpam_misc libraries without assuming "--enable-static-modules do not make the modules dynamically loadable". 2006-01-22 Thorsten Kukuk <kukuk@thkukuk.de> * configure.in: Don't define PAM_DYNAMIC. * libpam/pam_handlers.c: Get ride of PAM_DYNAMIC, don't include pam_dynamic.h * libpam/pam_dynamic.c: Don't include pam_dynamic.h, exclude functions if we compile with PAM_STATIC. * libpam/pam_dynamic.h: Remove. * libpam/pam_private.h: Add function prototypes from pam_dynamic.h. * libpam/Makefile.am: Bump version number of libpam, remove pam_dynamic.h.
This commit is contained in:
parent
b1b9e62160
commit
5116bebb80
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2006-01-22 Thorsten Kukuk <kukuk@thkukuk.de>
|
||||
|
||||
* configure.in: Don't define PAM_DYNAMIC.
|
||||
* libpam/pam_handlers.c: Get ride of PAM_DYNAMIC, don't
|
||||
include pam_dynamic.h
|
||||
* libpam/pam_dynamic.c: Don't include pam_dynamic.h,
|
||||
exclude functions if we compile with PAM_STATIC.
|
||||
* libpam/pam_dynamic.h: Remove.
|
||||
* libpam/pam_private.h: Add function prototypes from pam_dynamic.h.
|
||||
* libpam/Makefile.am: Bump version number of libpam, remove
|
||||
pam_dynamic.h.
|
||||
|
||||
2006-01-19 Thorsten Kukuk <kukuk@suse.de>
|
||||
|
||||
* doc/specs/Makefile.am (spec): Add padout to fix parallel
|
||||
|
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
||||
Linux-PAM NEWS -- history of user-visible changes.
|
||||
|
||||
* Fix building of static variants of libpam, libpamc and libpam_misc
|
||||
|
||||
Release 0.99.3.0
|
||||
|
||||
* Fix NULL pointer checks in libpam.so
|
||||
|
@ -13,10 +13,10 @@ EXTRA_DIST = libpam.map
|
||||
include_HEADERS = $(addprefix include/security/, _pam_compat.h _pam_macros.h _pam_types.h \
|
||||
pam_appl.h pam_malloc.h pam_modules.h pam_ext.h pam_modutil.h)
|
||||
|
||||
noinst_HEADERS = pam_dynamic.h pam_prelude.h pam_private.h pam_tokens.h \
|
||||
noinst_HEADERS = pam_prelude.h pam_private.h pam_tokens.h \
|
||||
pam_modutil_private.h
|
||||
|
||||
libpam_la_LDFLAGS = -no-undefined -version-info 81:2:81 @LIBAUDIT@
|
||||
libpam_la_LDFLAGS = -no-undefined -version-info 81:3:81 @LIBAUDIT@
|
||||
if HAVE_VERSIONING
|
||||
libpam_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libpam.map
|
||||
endif
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#include "pam_private.h"
|
||||
|
||||
#ifndef PAM_STATIC
|
||||
|
||||
#ifdef PAM_SHL
|
||||
# include <dl.h>
|
||||
#elif defined(PAM_DYLD)
|
||||
@ -41,8 +43,6 @@
|
||||
# include <dlfcn.h>
|
||||
#endif /* PAM_SHL */
|
||||
|
||||
#include "pam_dynamic.h"
|
||||
|
||||
#ifndef SHLIB_SYM_PREFIX
|
||||
#define SHLIB_SYM_PREFIX "_"
|
||||
#endif
|
||||
@ -138,3 +138,5 @@ _pam_dlerror (void)
|
||||
return dlerror ();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,11 +0,0 @@
|
||||
#ifndef _PAM_DYNAMIC_H
|
||||
#define _PAM_DYNAMIC_H
|
||||
|
||||
typedef int (*servicefn)(pam_handle_t *, int, int, char **);
|
||||
|
||||
void *_pam_dlopen (const char *mod_path);
|
||||
servicefn _pam_dlsym (void *handle, const char *symbol);
|
||||
void _pam_dlclose (void *handle);
|
||||
const char *_pam_dlerror (void);
|
||||
|
||||
#endif
|
@ -4,8 +4,6 @@
|
||||
* created by Marc Ewing.
|
||||
* Currently maintained by Andrew G. Morgan <morgan@kernel.org>
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pam_private.h"
|
||||
@ -18,10 +16,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef PAM_DYNAMIC
|
||||
#include "pam_dynamic.h"
|
||||
#endif /* PAM_DYNAMIC */
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MODULE_CHUNK 4
|
||||
#define UNKNOWN_MODULE_PATH "<*unknown module path*>"
|
||||
@ -599,7 +593,7 @@ int _pam_add_handler(pam_handle_t *pamh
|
||||
struct handlers *the_handlers;
|
||||
const char *sym, *sym2;
|
||||
char *mod_full_path=NULL;
|
||||
#ifdef PAM_DYNAMIC
|
||||
#ifndef PAM_STATIC
|
||||
char *mod_full_isa_path=NULL, *isa=NULL;
|
||||
#endif
|
||||
servicefn func, func2;
|
||||
@ -656,7 +650,26 @@ int _pam_add_handler(pam_handle_t *pamh
|
||||
/* Be pessimistic... */
|
||||
success = PAM_ABORT;
|
||||
|
||||
#ifdef PAM_DYNAMIC
|
||||
#ifdef PAM_STATIC
|
||||
/* Only load static function if function was not found dynamically.
|
||||
* This code should work even if no dynamic loading is available. */
|
||||
if (success != PAM_SUCCESS) {
|
||||
D(("_pam_add_handler: open static handler %s", mod_path));
|
||||
mod->dl_handle = _pam_open_static_handler(mod_path);
|
||||
if (mod->dl_handle == NULL) {
|
||||
D(("_pam_add_handler: unable to find static handler %s",
|
||||
mod_path));
|
||||
pam_syslog(pamh, LOG_ERR,
|
||||
"unable to open static handler %s", mod_path);
|
||||
/* Didn't find module in dynamic or static..will mark bad */
|
||||
} else {
|
||||
D(("static module added successfully"));
|
||||
success = PAM_SUCCESS;
|
||||
mod->type = PAM_MT_STATIC_MOD;
|
||||
pamh->handlers.modules_used++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
D(("_pam_add_handler: _pam_dlopen(%s)", mod_path));
|
||||
mod->dl_handle = _pam_dlopen(mod_path);
|
||||
D(("_pam_add_handler: _pam_dlopen'ed"));
|
||||
@ -693,26 +706,6 @@ int _pam_add_handler(pam_handle_t *pamh
|
||||
pamh->handlers.modules_used++;
|
||||
}
|
||||
#endif
|
||||
#ifdef PAM_STATIC
|
||||
/* Only load static function if function was not found dynamically.
|
||||
* This code should work even if no dynamic loading is available. */
|
||||
if (success != PAM_SUCCESS) {
|
||||
D(("_pam_add_handler: open static handler %s", mod_path));
|
||||
mod->dl_handle = _pam_open_static_handler(mod_path);
|
||||
if (mod->dl_handle == NULL) {
|
||||
D(("_pam_add_handler: unable to find static handler %s",
|
||||
mod_path));
|
||||
pam_syslog(pamh, LOG_ERR,
|
||||
"unable to open static handler %s", mod_path);
|
||||
/* Didn't find module in dynamic or static..will mark bad */
|
||||
} else {
|
||||
D(("static module added successfully"));
|
||||
success = PAM_SUCCESS;
|
||||
mod->type = PAM_MT_STATIC_MOD;
|
||||
pamh->handlers.modules_used++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (success != PAM_SUCCESS) { /* add a malformed module */
|
||||
mod->dl_handle = NULL;
|
||||
@ -786,14 +779,13 @@ int _pam_add_handler(pam_handle_t *pamh
|
||||
|
||||
/* are the modules reliable? */
|
||||
if (
|
||||
#ifdef PAM_DYNAMIC
|
||||
mod->type != PAM_MT_DYNAMIC_MOD
|
||||
&&
|
||||
#endif /* PAM_DYNAMIC */
|
||||
#ifdef PAM_STATIC
|
||||
mod->type != PAM_MT_STATIC_MOD
|
||||
&&
|
||||
#endif /* PAM_STATIC */
|
||||
#else
|
||||
mod->type != PAM_MT_DYNAMIC_MOD
|
||||
&&
|
||||
#endif
|
||||
mod->type != PAM_MT_FAULTY_MOD
|
||||
) {
|
||||
D(("_pam_add_handlers: illegal module library type; %d", mod->type));
|
||||
@ -805,31 +797,29 @@ int _pam_add_handler(pam_handle_t *pamh
|
||||
|
||||
/* now identify this module's functions - for non-faulty modules */
|
||||
|
||||
#ifdef PAM_DYNAMIC
|
||||
if ((mod->type == PAM_MT_DYNAMIC_MOD) &&
|
||||
!(func = _pam_dlsym(mod->dl_handle, sym)) ) {
|
||||
pam_syslog(pamh, LOG_ERR, "unable to resolve symbol: %s", sym);
|
||||
}
|
||||
#endif
|
||||
#ifdef PAM_STATIC
|
||||
if ((mod->type == PAM_MT_STATIC_MOD) &&
|
||||
(func = (servicefn)_pam_get_static_sym(mod->dl_handle, sym)) == NULL) {
|
||||
pam_syslog(pamh, LOG_ERR, "unable to resolve static symbol: %s", sym);
|
||||
}
|
||||
#else
|
||||
if ((mod->type == PAM_MT_DYNAMIC_MOD) &&
|
||||
!(func = _pam_dlsym(mod->dl_handle, sym)) ) {
|
||||
pam_syslog(pamh, LOG_ERR, "unable to resolve symbol: %s", sym);
|
||||
}
|
||||
#endif
|
||||
if (sym2) {
|
||||
#ifdef PAM_DYNAMIC
|
||||
if ((mod->type == PAM_MT_DYNAMIC_MOD) &&
|
||||
!(func2 = _pam_dlsym(mod->dl_handle, sym2)) ) {
|
||||
pam_syslog(pamh, LOG_ERR, "unable to resolve symbol: %s", sym2);
|
||||
}
|
||||
#endif
|
||||
#ifdef PAM_STATIC
|
||||
if ((mod->type == PAM_MT_STATIC_MOD) &&
|
||||
(func2 = (servicefn)_pam_get_static_sym(mod->dl_handle, sym2))
|
||||
== NULL) {
|
||||
pam_syslog(pamh, LOG_ERR, "unable to resolve symbol: %s", sym2);
|
||||
}
|
||||
#else
|
||||
if ((mod->type == PAM_MT_DYNAMIC_MOD) &&
|
||||
!(func2 = _pam_dlsym(mod->dl_handle, sym2)) ) {
|
||||
pam_syslog(pamh, LOG_ERR, "unable to resolve symbol: %s", sym2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -907,7 +897,7 @@ int _pam_free_handlers(pam_handle_t *pamh)
|
||||
while (pamh->handlers.modules_used) {
|
||||
D(("_pam_free_handlers: dlclose(%s)", mod->name));
|
||||
free(mod->name);
|
||||
#ifdef PAM_DYNAMIC
|
||||
#ifndef PAM_STATIC
|
||||
if (mod->type == PAM_MT_DYNAMIC_MOD) {
|
||||
_pam_dlclose(mod->dl_handle);
|
||||
}
|
||||
|
@ -219,8 +219,9 @@ void _pam_start_timer(pam_handle_t *pamh);
|
||||
void _pam_await_timer(pam_handle_t *pamh, int status);
|
||||
|
||||
typedef void (*voidfunc(void))(void);
|
||||
#ifdef PAM_STATIC
|
||||
typedef int (*servicefn)(pam_handle_t *, int, int, char **);
|
||||
|
||||
#ifdef PAM_STATIC
|
||||
/* The next two in ../modules/_pam_static/pam_static.c */
|
||||
|
||||
/* Return pointer to data structure used to define a static module */
|
||||
@ -229,7 +230,11 @@ struct pam_module * _pam_open_static_handler(const char *path);
|
||||
/* Return pointer to function requested from static module */
|
||||
|
||||
voidfunc *_pam_get_static_sym(struct pam_module *mod, const char *symname);
|
||||
|
||||
#else
|
||||
void *_pam_dlopen (const char *mod_path);
|
||||
servicefn _pam_dlsym (void *handle, const char *symbol);
|
||||
void _pam_dlclose (void *handle);
|
||||
const char *_pam_dlerror (void);
|
||||
#endif
|
||||
|
||||
/* For now we just use a stack and linear search for module data. */
|
||||
|
Loading…
Reference in New Issue
Block a user