]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: none
authorThorsten Kukuk <kukuk@thkukuk.de>
Sun, 22 Jan 2006 15:40:58 +0000 (15:40 +0000)
committerThorsten Kukuk <kukuk@thkukuk.de>
Sun, 22 Jan 2006 15:40:58 +0000 (15:40 +0000)
Purpose of commit: bugfix

Commit summary:
---------------

Fix infrastructure and compile errors for PAM_STATIC (static modules):

2006-01-22  Thorsten Kukuk  <kukuk@thkukuk.de>

        * modules/pam_succeed_if/pam_succeed_if.c (pam_sm_acct_mgmt):
        Add support for static modules.
        * modules/pam_xauth/pam_xauth.c: Likewise.

        * libpam/pam_handlers.c (_pam_add_handler): Add pamh to
        _pam_open_static_handler call.

        * libpam/pam_static.c (_pam_open_static_handler): Add pamh
        as argument.
        * libpam/pam_private.h: Adjust prototype.

ChangeLog
libpam/pam_handlers.c
libpam/pam_private.h
libpam/pam_static.c
modules/pam_succeed_if/pam_succeed_if.c
modules/pam_xauth/pam_xauth.c

index 6477d5200c2ca89d89c489cf7124101c580102ae..34a3d53a2a9bc3620baffad3a83255b369a6e47e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,20 @@
 2006-01-22  Thorsten Kukuk  <kukuk@thkukuk.de>
 
+       * modules/pam_succeed_if/pam_succeed_if.c (pam_sm_acct_mgmt):
+       Add support for static modules.
+       * modules/pam_xauth/pam_xauth.c: Likewise.
+
+       * libpam/pam_handlers.c (_pam_add_handler): Add pamh to
+       _pam_open_static_handler call.
+
+       * libpam/pam_static.c (_pam_open_static_handler): Add pamh
+       as argument.
+       * libpam/pam_private.h: Adjust prototype.
+
        * 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, 
+       * 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.
index 9035fb2fae724ef46f2f425bbbda552ba13a2906..62342fdacc0fc8be192dcec377fab6c846a3c35b 100644 (file)
@@ -655,7 +655,7 @@ int _pam_add_handler(pam_handle_t *pamh
         * 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);
+           mod->dl_handle = _pam_open_static_handler(pamh, mod_path);
            if (mod->dl_handle == NULL) {
                D(("_pam_add_handler: unable to find static handler %s",
                   mod_path));
index 5ab0f8c52b008338db62eeb98bf74539cf1cfedd..ad804791cb8589ad2caec87ed20bd43a1fa63abe 100644 (file)
@@ -225,7 +225,8 @@ typedef int (*servicefn)(pam_handle_t *, int, int, char **);
 /* The next two in ../modules/_pam_static/pam_static.c */
 
 /* Return pointer to data structure used to define a static module */
-struct pam_module * _pam_open_static_handler(const char *path);
+struct pam_module * _pam_open_static_handler (pam_handle_t *pamh,
+                                             const char *path);
 
 /* Return pointer to function requested from static module */
 
@@ -299,7 +300,7 @@ if ((pamh) == NULL) {                             \
 extern int _pam_auditlog(pam_handle_t *pamh, int action, int retval, int flags);
 extern int _pam_audit_end(pam_handle_t *pamh, int pam_status);
 #endif
-                                                                               
+
 /*
  * Copyright (C) 1995 by Red Hat Software, Marc Ewing
  * Copyright (c) 1996-8,2001 by Andrew G. Morgan <morgan@kernel.org>
@@ -318,13 +319,13 @@ extern int _pam_audit_end(pam_handle_t *pamh, int pam_status);
  * 3. The name of the author may not be used to endorse or promote
  *    products derived from this software without specific prior
  *    written permission.
- * 
+ *
  * ALTERNATIVELY, this product may be distributed under the terms of
  * the GNU Public License, in which case the provisions of the GPL are
  * required INSTEAD OF the above restrictions.  (This clause is
  * necessary due to a potential bad interaction between the GPL and
  * the restrictions contained in a BSD-style copyright.)
- * 
+ *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
index e2c6aac3b9e2027c6979adc35f12fcd779eec853..7ea4c81bc3b44c15f1ba05dedf8b35d056bf22b3 100644 (file)
@@ -1,8 +1,7 @@
-/* pam_static.c -- static module loading helper functions */
-
-/* created by Michael K. Johnson, johnsonm@redhat.com
+/*
+ * pam_static.c -- static module loading helper functions
  *
- * $Id$
+ * created by Michael K. Johnson, johnsonm@redhat.com
  */
 
 /* This whole file is only used for PAM_STATIC */
@@ -39,7 +38,8 @@ static struct pam_module *static_modules[] = {
  */
 
 /* Return pointer to data structure used to define a static module */
-struct pam_module * _pam_open_static_handler(const char *path)
+struct pam_module *
+_pam_open_static_handler (pam_handle_t *pamh, const char *path)
 {
     int i;
     const char *clpath = path;
index f84fdd3f0fee0d4aa2f0b769f981d63df712e7a7..d343cae83df4f9c4a96d0c90a524bf496d3f7720 100644 (file)
 #include <pwd.h>
 #include <grp.h>
 #include <netdb.h>
+
+#define PAM_SM_AUTH
+#define PAM_SM_ACCOUNT
+
 #include <security/pam_modules.h>
 #include <security/pam_modutil.h>
 #include <security/pam_ext.h>
@@ -313,21 +317,21 @@ evaluate(pam_handle_t *pamh, int debug,
        if (strcasecmp(qual, "innetgr") == 0) {
                const void *rhost;
                if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
-                       rhost = NULL;           
+                       rhost = NULL;
                return evaluate_innetgr(rhost, pwd->pw_name, right);
        }
        /* (Rhost, user) is not in this group. */
        if (strcasecmp(qual, "notinnetgr") == 0) {
                const void *rhost;
                if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
-                       rhost = NULL;           
+                       rhost = NULL;
                return evaluate_notinnetgr(rhost, pwd->pw_name, right);
        }
        /* Fail closed. */
        return PAM_SERVICE_ERR;
 }
 
-int
+PAM_EXTERN int
 pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
                     int argc, const char **argv)
 {
@@ -460,15 +464,28 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
        return ret;
 }
 
-int
+PAM_EXTERN int
 pam_sm_setcred(pam_handle_t *pamh UNUSED, int flags UNUSED,
                int argc UNUSED, const char **argv UNUSED)
 {
        return PAM_SUCCESS;
 }
 
-int
+PAM_EXTERN int
 pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc, const char **argv)
 {
        return pam_sm_authenticate(pamh, flags, argc, argv);
 }
+
+/* static module data */
+#ifdef PAM_STATIC
+struct pam_module _pam_succeed_if_modstruct = {
+    "pam_succeed_if",
+    pam_sm_authenticate,
+    pam_sm_setcred,
+    pam_sm_acct_mgmt,
+    NULL,
+    NULL,
+    NULL
+};
+#endif
index 5376bd8b18354caa31700d239cad591f8dfbd6fa..3772bd061db3739fbc7443d9e4833572d5c6bfed 100644 (file)
@@ -33,8 +33,6 @@
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* "$Id$" */
-
 #include "config.h"
 #include <sys/types.h>
 #include <sys/fsuid.h>
@@ -52,6 +50,8 @@
 #include <syslog.h>
 #include <unistd.h>
 
+#define PAM_SM_SESSION
+
 #include <security/pam_modules.h>
 #include <security/_pam_macros.h>
 #include <security/pam_modutil.h>
@@ -665,3 +665,16 @@ pam_sm_close_session (pam_handle_t *pamh, int flags UNUSED,
        }
        return PAM_SUCCESS;
 }
+
+/* static module data */
+#ifdef PAM_STATIC
+struct pam_module _pam_xauth_modstruct = {
+  "pam_xauth",
+  NULL,
+  NULL,
+  NULL,
+  pam_sm_open_session,
+  pam_sm_close_session,
+  NULL
+};
+#endif