From owner-p4-projects@FreeBSD.ORG Thu Jun 9 19:33:02 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7DE4E16A420; Thu, 9 Jun 2005 19:33:01 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3CA5416A41C for ; Thu, 9 Jun 2005 19:33:01 +0000 (GMT) (envelope-from des@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 01E4D43D53 for ; Thu, 9 Jun 2005 19:33:01 +0000 (GMT) (envelope-from des@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j59JX05G057603 for ; Thu, 9 Jun 2005 19:33:00 GMT (envelope-from des@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j59JX0gf057596 for perforce@freebsd.org; Thu, 9 Jun 2005 19:33:00 GMT (envelope-from des@freebsd.org) Date: Thu, 9 Jun 2005 19:33:00 GMT Message-Id: <200506091933.j59JX0gf057596@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to des@freebsd.org using -f From: Dag-Erling Smorgrav To: Perforce Change Reviews Cc: Subject: PERFORCE change 78271 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2005 19:33:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=78271 Change 78271 by des@des.at.des.no on 2005/06/09 19:32:00 If the module path is relative, prepend the module installation directory which was specified at configure time. Inspired by: NetBSD Affected files ... .. //depot/projects/openpam/lib/Makefile.am#4 edit .. //depot/projects/openpam/lib/openpam_dynamic.c#14 edit Differences ... ==== //depot/projects/openpam/lib/Makefile.am#4 (text+ko) ==== @@ -1,3 +1,5 @@ +# $P4: //depot/projects/openpam/lib/Makefile.am#4 $ + NULL = INCLUDES = -I$(top_srcdir)/include @@ -48,6 +50,8 @@ pam_vprompt.c \ $(NULL) +libpam_la_CFLAGS = -DOPENPAM_MODULES_DIR='"@OPENPAM_MODULES_DIR@"' + libpam_la_LDFLAGS = -no-undefined -version-info @LIB_MAJ@ @DL_LIBS@ # Not implemented yet: ==== //depot/projects/openpam/lib/openpam_dynamic.c#14 (text+ko) ==== @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#13 $ + * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#14 $ */ #include @@ -57,6 +57,7 @@ openpam_dynamic(const char *path) { pam_module_t *module; + const char *prefix; char *vpath; void *dlh; int i; @@ -65,8 +66,14 @@ if ((module = calloc(1, sizeof *module)) == NULL) goto buf_err; + /* Prepend the standard prefix if not an absolute pathname. */ + if (path[0] != '/') + prefix = OPENPAM_MODULES_DIR; + else + prefix = ""; + /* try versioned module first, then unversioned module */ - if (asprintf(&vpath, "%s.%d", path, LIB_MAJ) < 0) + if (asprintf(&vpath, "%s%s.%d", prefix, path, LIB_MAJ) < 0) goto buf_err; if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) { openpam_log(PAM_LOG_DEBUG, "%s: %s", vpath, dlerror());