5 from getpass import getpass
7 def pam_conv(auth, query_list):
11 for i in range(len(query_list)):
12 query, type = query_list[i]
13 if type == PAM.PAM_PROMPT_ECHO_ON:
14 val = raw_input(query)
16 elif type == PAM.PAM_PROMPT_ECHO_OFF:
19 elif type == PAM.PAM_PROMPT_ERROR_MSG or type == PAM.PAM_PROMPT_TEXT_INFO:
29 if len(sys.argv) == 2:
40 auth.set_item(PAM.PAM_USER, user)
42 auth.set_item(PAM.PAM_CONV, pam_conv)
44 auth.set_userdata("testing user data")
49 except PAM.error, (resp, code):
50 print 'Go away! (%s)' % resp
52 print 'Internal error'