PAM and Python2.2

Janek Neubert janek.n at gmx.de
Thu Aug 28 17:49:13 CEST 2003


Hi,


I'm using pyPAM (0.4.2) to authenticate users via PAM. With Debian sarge all
works fine. Unfortunally, I've problems with the same tool on Redhat 7.3.
pyPAM is unable to execute a conversation function and reports:
PAM.error: ('Conversation error', 19)

In /var/log/messages you read:
Aug 27 18:53:51 minipc3 wwwproject(pam_unix)[21675]: auth could not identify
password for [janek]

On my debian, all forks fine. Very strange.
Is this a redhat problem or a problem with pyPAM?

cu & thx janek

The test script:

import sys
import PAM
from getpass import getpass

def pam_conv(auth, query_list, userData):

        resp = []

        for i in range(len(query_list)):
                query, type = query_list[i]
                if type == PAM.PAM_PROMPT_ECHO_ON:
                        val = raw_input(query)
                        resp.append((val, 0))
                elif type == PAM.PAM_PROMPT_ECHO_OFF:
                        val = getpass(query)
                        resp.append((val, 0))
                elif type == PAM.PAM_PROMPT_ERROR_MSG or type ==
PAM.PAM_PROMPT_TEXT_INFO:
                        print query
                        resp.append(('', 0))
                else:
                        return None

        return resp

service = 'wwwproject'

if len(sys.argv) == 2:
        user = sys.argv[1]
else:
        user = None

auth = PAM.pam()
auth.start(service)
if user != None:
        auth.set_item(PAM.PAM_USER, user)
auth.set_item(PAM.PAM_CONV, pam_conv)

print auth.authenticate()
#print auth.acct_mgmt()
sys.exit(0)

-- 
"Macht korrumpiert. Absolute Macht korrumpiert absolut."
 - Stefan Heym -




More information about the Python-list mailing list