svn commit: r188720 - in head: contrib/openpam
contrib/openpam/include/security contrib/openpam/lib
lib/libpam/modules
Dag-Erling Smorgrav
des at FreeBSD.org
Tue Feb 17 08:35:21 PST 2009
Author: des
Date: Tue Feb 17 16:35:19 2009
New Revision: 188720
URL: http://svn.freebsd.org/changeset/base/188720
Log:
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@
Modified:
head/contrib/openpam/ (props changed)
head/contrib/openpam/include/security/openpam.h
head/contrib/openpam/lib/openpam_dynamic.c
head/lib/libpam/modules/Makefile.inc
Modified: head/contrib/openpam/include/security/openpam.h
==============================================================================
--- head/contrib/openpam/include/security/openpam.h Tue Feb 17 16:02:45 2009 (r188719)
+++ head/contrib/openpam/include/security/openpam.h Tue Feb 17 16:35:19 2009 (r188720)
@@ -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; \
Modified: head/contrib/openpam/lib/openpam_dynamic.c
==============================================================================
--- head/contrib/openpam/lib/openpam_dynamic.c Tue Feb 17 16:02:45 2009 (r188719)
+++ head/contrib/openpam/lib/openpam_dynamic.c Tue Feb 17 16:35:19 2009 (r188720)
@@ -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);
}
Modified: head/lib/libpam/modules/Makefile.inc
==============================================================================
--- head/lib/libpam/modules/Makefile.inc Tue Feb 17 16:02:45 2009 (r188719)
+++ head/lib/libpam/modules/Makefile.inc Tue Feb 17 16:35:19 2009 (r188720)
@@ -19,4 +19,7 @@ DPADD+= ${LIBPAM}
LDADD+= -lpam
.endif
+.c.o:
+ ${CC} ${CFLAGS} -DOPENPAM_STATIC_MODULES -c ${.IMPSRC}
+
.include "../Makefile.inc"
More information about the svn-src-head
mailing list