summaryrefslogtreecommitdiff
path: root/contrib/openpam
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2009-02-17 16:35:19 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2009-02-17 16:35:19 +0000
commit1dde0f9745d45414960b5f60a77da3897f46594a (patch)
treea1110769d00855fec271dd4f03eca0fafbd679c8 /contrib/openpam
parentfb20e2aeac104f5f5d9568f96093b097880a1923 (diff)
parent31c6a31b9b9e0a3b6edf995b9a76c573d1c3df02 (diff)
downloadsrc-test-1dde0f9745d45414960b5f60a77da3897f46594a.tar.gz
src-test-1dde0f9745d45414960b5f60a77da3897f46594a.zip
Don't try to auto-detect dynamic linking; it fails on mips. The Makefile
part of the patch is an ugly (and hopefully temporary) hack. Discussed with: imp@
Notes
Notes: svn path=/head/; revision=188720
Diffstat (limited to 'contrib/openpam')
-rw-r--r--contrib/openpam/include/security/openpam.h15
-rw-r--r--contrib/openpam/lib/openpam_dynamic.c25
2 files changed, 23 insertions, 17 deletions
diff --git a/contrib/openpam/include/security/openpam.h b/contrib/openpam/include/security/openpam.h
index 3361d625139c5..a149feb7c501f 100644
--- a/contrib/openpam/include/security/openpam.h
+++ b/contrib/openpam/include/security/openpam.h
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2002-2003 Networks Associates Technology, Inc.
- * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * Copyright (c) 2004-2008 Dag-Erling Smørgrav
* All rights reserved.
*
* This software was developed for the FreeBSD Project by ThinkSec AS and
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: openpam.h 408 2007-12-21 11:36:24Z des $
+ * $Id: openpam.h 418 2008-12-13 22:39:24Z des $
*/
#ifndef SECURITY_OPENPAM_H_INCLUDED
@@ -309,18 +309,17 @@ struct pam_module {
* Infrastructure for static modules using GCC linker sets.
* You are not expected to understand this.
*/
-#if defined(__FreeBSD__)
+#if !defined(PAM_SOEXT)
# define PAM_SOEXT ".so"
-#else
-# undef NO_STATIC_MODULES
-# define NO_STATIC_MODULES
#endif
-#if defined(__GNUC__) && !defined(__PIC__) && !defined(NO_STATIC_MODULES)
+#if defined(OPENPAM_STATIC_MODULES)
+# if !defined(__GNUC__)
+# error "Don't know how to build static modules on non-GNU compilers"
+# endif
/* gcc, static linking */
# include <sys/cdefs.h>
# include <linker_set.h>
-# define OPENPAM_STATIC_MODULES
# define PAM_EXTERN static
# define PAM_MODULE_ENTRY(name) \
static char _pam_name[] = name PAM_SOEXT; \
diff --git a/contrib/openpam/lib/openpam_dynamic.c b/contrib/openpam/lib/openpam_dynamic.c
index 084408ec1edea..e2abcf7e841f5 100644
--- a/contrib/openpam/lib/openpam_dynamic.c
+++ b/contrib/openpam/lib/openpam_dynamic.c
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2002-2003 Networks Associates Technology, Inc.
- * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * Copyright (c) 2004-2008 Dag-Erling Smørgrav
* All rights reserved.
*
* This software was developed for the FreeBSD Project by ThinkSec AS and
@@ -32,9 +32,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: openpam_dynamic.c 408 2007-12-21 11:36:24Z des $
+ * $Id: openpam_dynamic.c 417 2008-02-14 18:36:22Z des $
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
@@ -57,6 +61,7 @@
pam_module_t *
openpam_dynamic(const char *path)
{
+ const pam_module_t *dlmodule;
pam_module_t *module;
const char *prefix;
char *vpath;
@@ -64,8 +69,6 @@ openpam_dynamic(const char *path)
int i;
dlh = NULL;
- if ((module = calloc(1, sizeof *module)) == NULL)
- goto buf_err;
/* Prepend the standard prefix if not an absolute pathname. */
if (path[0] != '/')
@@ -75,33 +78,37 @@ openpam_dynamic(const char *path)
/* try versioned module first, then unversioned module */
if (asprintf(&vpath, "%s%s.%d", prefix, path, LIB_MAJ) < 0)
- goto buf_err;
+ goto err;
if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
openpam_log(PAM_LOG_DEBUG, "%s: %s", vpath, dlerror());
*strrchr(vpath, '.') = '\0';
if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
openpam_log(PAM_LOG_DEBUG, "%s: %s", vpath, dlerror());
FREE(vpath);
- FREE(module);
return (NULL);
}
}
FREE(vpath);
+ if ((module = calloc(1, sizeof *module)) == NULL)
+ goto buf_err;
if ((module->path = strdup(path)) == NULL)
goto buf_err;
module->dlh = dlh;
+ dlmodule = dlsym(dlh, "_pam_module");
for (i = 0; i < PAM_NUM_PRIMITIVES; ++i) {
- module->func[i] = (pam_func_t)dlsym(dlh, _pam_sm_func_name[i]);
+ module->func[i] = dlmodule ? dlmodule->func[i] :
+ (pam_func_t)dlsym(dlh, _pam_sm_func_name[i]);
if (module->func[i] == NULL)
openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
path, _pam_sm_func_name[i], dlerror());
}
return (module);
- buf_err:
- openpam_log(PAM_LOG_ERROR, "%m");
+buf_err:
if (dlh != NULL)
dlclose(dlh);
FREE(module);
+err:
+ openpam_log(PAM_LOG_ERROR, "%m");
return (NULL);
}