How comile pam modules

Steve Langasek vorlon at debian.org
Thu Dec 8 23:09:59 UTC 2005


On Thu, Dec 08, 2005 at 03:26:08PM -0500, Nalin Dahyabhai wrote:
> On Thu, Dec 08, 2005 at 02:20:03PM -0600, Matt Sellers wrote:
> > no luck, still getting same errors....

> > Dec  8 14:14:06 linuxlab2 su: PAM unable to 
> > dlopen(/lib/security/$ISA/pam_permit.so)
> > Dec  8 14:14:06 linuxlab2 su: PAM [dlerror: 
> > /lib/security/../../lib/security/pam_permit.so: undefined symbol: 
> > _Z12pam_get_userP10pam_handlePPKcS2_]
> > Dec  8 14:14:06 linuxlab2 su: PAM adding faulty module: 
> > /lib/security/$ISA/pam_permit.so
> > Dec  8 14:14:06 linuxlab2 su: PAM unable to 
> > dlopen(/lib/security/$ISA/pam_permit.so)
> > Dec  8 14:14:06 linuxlab2 su: PAM [dlerror: 
> > /lib/security/../../lib/security/pam_permit.so: undefined symbol: 
> > _Z12pam_get_userP10pam_handlePPKcS2_]

> That looks as though the compiler is reading the prototype for
> pam_get_user() as if it were a C++ function and emitting a mangled
> reference to it.

> Try using "gcc" instead of "g++" and you should be fine.  Otherwise,
> arrange for the declaration to be wrapped up in an 'extern "C"' block.

Yeah, if this is Linux-PAM, this is a known bug in the pam_modules.h header
that was recently fixed in CVS.  I don't think it ever occurred to anyone to
write "simple" PAM modules in C++ (and obviously, if not written in C++, g++
is the wrong compiler).

BTW, to turn these undefined symbols into a build-time error instead of a
runtime one, try:

   gcc -shared -Wl,-z,defs -o pam_permit.so pam_permit.c -lpam

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon at debian.org                                   http://www.debian.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/pam-list/attachments/20051208/f7d34b78/attachment.sig>


More information about the Pam-list mailing list