From owner-svn-src-head@FreeBSD.ORG Tue Feb 17 16:35:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC0F9106566B; Tue, 17 Feb 2009 16:35:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96D9D8FC15; Tue, 17 Feb 2009 16:35:19 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1HGZJAY020974; Tue, 17 Feb 2009 16:35:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1HGZJ7g020971; Tue, 17 Feb 2009 16:35:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200902171635.n1HGZJ7g020971@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 17 Feb 2009 16:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188720 - in head: contrib/openpam contrib/openpam/include/security contrib/openpam/lib lib/libpam/modules X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2009 16:35:21 -0000 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 # include -# 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 #include #include @@ -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"