Re: Do we need to symbolically linking /lib/security/pam_pwdb.so to create library for use with JNI, Java?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think you'll find you need to link -lpwdb with it.

(Is it imperative you use pam_pwdb?, couldn't you use pam_unix?)

Cheers

Andrew

"Tran, Canh" wrote:
> 
>         I wrote a file called pamcode.c where
> 
>         Pamcode.c
>         #include <security/pam_appl.h>
>         #include <security/pam_misc.h>
> 
>         .............................
>         int retval;
>         struct pam_conv conv = {
>               misc_conv,
>               NULL
>         }
> 
>         retval = pam_start("check_user", username, &conv, &pamh);
>         retval = pam_authenticate(pamh, 0);
>         .............................
> 
>         On command line, if I create binary with command
>         >> cc pam_code.c -lpam -lpam_misc -ldl
> 
>         Then, a.out is created and I can run it by ./a.out with no errors
> reported.
> 
>         However, if I try to build a library by having following line in
> makefile:
> 
>         Makefile
>         ..................
>         ld -G -dy -o   libauthentication.so    pam_code.o    -lpam
> -lpam_misc -ldl
>         ..................
> 
>         and then, having this library loaded into Java code as:
> 
>         javacode.java
>         ......................................
>         System.LoadLibrary("authentication");
>         ......................................
> 
>         Then, at runtime, I get an error 28 "Module is unknown" (static
>          libs) from somewhere inside pam_pwdb.so
> 
>             I've discovered that the dlopen() call in pam_pwdb.so is
>          failing with this error "/lib/security/pam_pwdb.so: undefined
>          symbol: pam_get_item".
> 
>          /lib/security/pam_pwdb.so exists.  The /etc/pam.d/check_user file
> is
>          a symbolic link to /etc/pam.d/passwd, and passwd works fine
>         ++++++++++++++++++++++++
>         However, if I change the makefile above to following:
>         Makefile
>         ..................
>         ld -G -dy -o   libauthentication.so    pam_code.o
> /lib/security/pam_pwdb.so  -lpam -lpam_misc -ldl
>         ..................
> 
>         Essentially, symbolically linking the /lib/security/pam_pwdb.so to
> the libpam and libpammisc library,
>         Then, everything's fine afterward (i.e: no runtime errors are
> reported, and I can make call from
>         Java code.
> 
>         Any suggestion? Ideally, I prefer not to have
> /lib/security/pam_pwdb.so symbolically linked with the 2 pam libraries, but
> for now, that's the only way to make it work.
> 
>         Thanks.
> 
>         Canh.
> 
> 
> _______________________________________________
> 
> Pam-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/pam-list





[Index of Archives]     [Fedora Users]     [Kernel]     [Red Hat Install]     [Linux for the blind]     [Gimp]

  Powered by Linux