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

Re: How comile pam modules



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 debian org                                   http://www.debian.org/

Attachment: signature.asc
Description: Digital signature


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