Re: dlopen not able to open shared object file, even though it is existing

Steve Langasek <[email protected]> Sat, 8 Dec 2012 11:35:24 -0800
Newsgroups gmane.linux.pam
Message-ID <[email protected]>
On Sat, Dec 08, 2012 at 06:01:06AM +0000, [email protected] wrote:
> Hello pam-list members,

> We had written a customized PAM authentication module (in C) named
> vauth.so to be used for sshd.  We had changed the sshd file in /etc/pam.d
> to include the following line

> authenticate sufficient vauth.so

> We were able to have ssh session using PuTTY successfully. vauth.so gets
> called and authentication gets completed.

> After this, we wanted to use some java components for our authentication
> through vauth.so.  So, we used some JNI calls from the c code, and created
> vauth.so.

> These were the commands used to create vauth.so (which is finally placed
> in /lib64/security)

> gcc -fPIC -fno-stack-protector -I/usr/java/jdk1.7.0_07/include -I/usr/java/jdk1.7.0_07/include/linux -c vauth.c -L/usr/java/jdk1.7.0_07/jre/lib/amd64/server

> ld -x --shared -o /lib64/security/vauth.so vauth.o /usr/java/jdk1.7.0_07/jre/lib/amd64/server/libjvm.so

> We had also copied "libjvm.so" to /lib64/security.

> Now, when we do an authentication using PuTTY, we see the following error.

> Dec  6 11:23:10 localhost sshd[8605]: PAM unable to dlopen(/lib64/security/vauth.so): libjvm.so: cannot open shared object file: No such file or directory
> Dec  6 11:23:10 localhost sshd[8605]: PAM adding faulty module: /lib64/security/vauth.so

> We are not sure, why this problem occurs as libjvm.so in present in
> /lib64/security.

Run 'ldd -d -r /lib64/security/vauth.so' to see what's wrong.

But as a general rule, /lib64/security is not going to be on the library
search path; so either you need libjvm.so to be installed to a system path,
or you need to use an rpath setting on your module to tell the runtime
linker where to find libjvm.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[email protected]                                     [email protected]

_______________________________________________
Pam-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pam-list
signature.asc (application/pgp-signature, 836 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJQw5Z8AAoJEFaNMPMhshM9SngQAJRszvqh6TDdaMwWx/3TaJFM
YZGiqJJwMO7PjU9XAtxRMkPfKXcv/UTz55Q61AuZeCuqRHvKnsCt8VnQFtFUXgEe
4FTy5BZVlE0UzEiSKfolRIj5p5CurDtpYH8IqRBmrI5iTlr20yOLTGzQFwT0EwcE
6UYwlDB5ZgZti/rHyWWbhyPS3H6HhNEZ9zGoyCrPgsecFne4be6bDDRU+kJwZb3n
xAARCrRqE/mHcaVnjdyciofsCp+Q6O8VU3kr4E5oRoHkLBX/q0aKLLuU1w5ktkfX
DVTSBDBx6nyiNOS1hbeWqIx/sTQ3VX81JNsHs23NyWGBZbULDlF3K5LoQmGaLNch
YoI6lcmei8uGJ9KiTA2qoGkgicFSEega/fW2ik22yBtJm9ggOEb1ZV5j05OnVd3n
iaIvmA97fYjyz4LmyLRqM71qCgaXLR+/nMqcks0asavosQgyI780oT+TkdghRdxi
LkoNGPqXp0i/C0bssUc7PkR/h80iYsnJnJ/AYEJn8joROb1g2jaB4+dv0bnNCKj6
H8PlS9V+7vhF4VsJlYNmV+aL9M+EnoLq+yRy8MjNaGhQjbbvDtJrhfeL4Gyu9/Zx
UgEkyBPYnzGRM17cnE5GdDvyeJNwdHciOZYDPOuocE2guuONueZl9DqZNmNpbyJT
GinQd7f1kO5oPOdoNoGg
=ztXM
-----END PGP SIGNATURE-----