summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2009-02-17 16:35:19 +0000
committerdes <des@FreeBSD.org>2009-02-17 16:35:19 +0000
commit123e930ac3491af20bf5ab2ea6055ade5d53ded8 (patch)
treea1110769d00855fec271dd4f03eca0fafbd679c8 /contrib
parentd55c3e067263b9e865a8d4ef0385de3aa13f3b8e (diff)
downloadFreeBSD-src-123e930ac3491af20bf5ab2ea6055ade5d53ded8.zip
FreeBSD-src-123e930ac3491af20bf5ab2ea6055ade5d53ded8.tar.gz
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@
Diffstat (limited to 'contrib')
-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 3361d62..a149feb 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 084408e..e2abcf7 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);
}
OpenPOWER on IntegriCloud