ctypes wrapping libpam.so on FreeBSD 6.1 - Python Bus Error

Martin P. Hellwig mhellwig at xs4all.nl
Thu Jul 13 08:15:50 EDT 2006


Hey all,

I'd like to wrap libpam so that I can use that for authentication and 
password management. I build ctypes (0.9.9.6) on my platform via ports.

Now according to OpenPAM documentation all sessions start with pam_start().
According to the man page it should contain this:
pam_start(const char *service, const char *user,
	 const struct pam_conv *pam_conv, pam_handle_t **pamh)

Where service in my case should be 'auth' and user 'martin' with 
pam_conv being 'PAM_PROMPT_ECHO_ON' for testing purposes (at least I 
assumed it works this way, but probably I'm doing something wrong, 
though I don't know what the correct way should be like).

When I tried it, python dumps the core with a Bus Error, I also tried 
other combinations but it all ends in a Bus Error, any suggestion how I 
should proceed? I don't know much about PAM or C so any help is much 
appreciated.

This (and other things) is what I've done:

[martin at xinag /usr/home/martin]$ su
Password:
xinag# python
Python 2.4.3 (#2, May 24 2006, 00:05:56)
[GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
 >>> from ctypes import *
 >>> libpam = cdll.LoadLibrary('/usr/lib/libpam.so')
 >>> libpam.pam_start('auth','martin','PAM_PROMPT_ECHO_ON')
Bus error (core dumped)


Thanks in advance,

Martin



More information about the Python-list mailing list