Changeset 308 in openpam for trunk/lib


Ignore:
Timestamp:
Jun 9, 2005, 9:32:00 PM (15 years ago)
Author:
Dag-Erling Smørgrav
Message:

If the module path is relative, prepend the module installation
directory which was specified at configure time.

Inspired by: NetBSD

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Makefile.am

    r294 r308  
     1# $P4: //depot/projects/openpam/lib/Makefile.am#4 $
     2
    13NULL =
    24
     
    4951        $(NULL)
    5052
     53libpam_la_CFLAGS = -DOPENPAM_MODULES_DIR='"@OPENPAM_MODULES_DIR@"'
     54
    5155libpam_la_LDFLAGS = -no-undefined -version-info @LIB_MAJ@ @DL_LIBS@
    5256
  • trunk/lib/openpam_dynamic.c

    r245 r308  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#13 $
     34 * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#14 $
    3535 */
    3636
     
    5858{
    5959        pam_module_t *module;
     60        const char *prefix;
    6061        char *vpath;
    6162        void *dlh;
     
    6667                goto buf_err;
    6768
     69        /* Prepend the standard prefix if not an absolute pathname. */
     70        if (path[0] != '/')
     71                prefix = OPENPAM_MODULES_DIR;
     72        else
     73                prefix = "";
     74
    6875        /* try versioned module first, then unversioned module */
    69         if (asprintf(&vpath, "%s.%d", path, LIB_MAJ) < 0)
     76        if (asprintf(&vpath, "%s%s.%d", prefix, path, LIB_MAJ) < 0)
    7077                goto buf_err;
    7178        if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
Note: See TracChangeset for help on using the changeset viewer.