]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: none
authorThorsten Kukuk <kukuk@thkukuk.de>
Sun, 22 Jan 2006 07:36:54 +0000 (07:36 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Sun, 22 Jan 2006 07:36:54 +0000 (07:36 +0000)
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.

ChangeLog
NEWS
libpam/Makefile.am
libpam/pam_dynamic.c
libpam/pam_dynamic.h [deleted file]
libpam/pam_handlers.c
libpam/pam_private.h

index a5d7f3e52e376629d76195acfe4532e96555e2cc..6477d5200c2ca89d89c489cf7124101c580102ae 100644 (file)
--- a/ChangeLog
+++ b/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
diff --git a/NEWS b/NEWS
index 729906435c21ff94625bf3eea1138fb8471590e5..4dc517e9cb5e96918738300bbadc260413af28a9 100644 (file)
--- a/NEWS
+++ b/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
index 81329a3f5b69da4de7fc47471b501adcbf3ad657..4f60ad47f6525e9f2eac3d1f15e5e66d73c17542 100644 (file)
@@ -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
index 6bb3d5591b0832f9636a886865daa915d9850776..5be33c3654e75e993837f8f989018871696519e9 100644 (file)
@@ -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
diff --git a/libpam/pam_dynamic.h b/libpam/pam_dynamic.h
deleted file mode 100644 (file)
index 35c427a..0000000
+++ /dev/null
@@ -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
index 1b5b941615e2c3f0e6162fc5f69edc5c17c79249..9035fb2fae724ef46f2f425bbbda552ba13a2906 100644 (file)
@@ -4,8 +4,6 @@
  * created by Marc Ewing.
  * Currently maintained by Andrew G. Morgan <morgan@kernel.org>
  *
- * $Id$
- *
  */
 
 #include "pam_private.h"
 #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);
        }
index 3d86b8683467fb2c1e9e8744b7135c4e60cc9e7a..5ab0f8c52b008338db62eeb98bf74539cf1cfedd 100644 (file)
@@ -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. */