Package: python-pam
Version: 0.4.2-10.4
Severity: normal
Tags: patch
The example code examples/pamtest.py is incorrect, it references the
non-existent constants PAM.PAM_PROMPT_ERROR_MSG and PAM.PAM_PROMPT_TEXT_INFO.
The correct names are PAM_ERROR_MSG and PAM_TEXT_INFO, respectively (without
"PROMPT").
While this does not affect the example itself (the if-branch in question never
runs), it causes hard to detect errors in application code that relies on this
wrong example. This "conversation function" seems to somehow run in a plain-C
context, so the usual Python error, "'module' object has no attribute 'foo'"
will not propagate to the user -- who is left scratching his head about
inscrutable "PAM conversation errors".
Since this example file effectively is the only documentation available on the
python-pam module, it would be nice if it were correct. ;-)
The attached patch to fix the documentation is of course trivial, but
might potentially save a lot of bug-hunting.
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.9-023stab044.16-enterprise
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages python-pam depends on:
ii python 2.4.4-2 An interactive high-level object-o
python-pam recommends no packages.
-- no debconf information
--- examples/pamtest.py~ 23:08:48.000000000 +0100
+++ examples/pamtest.py 2008-06-22 12:09:03.000000000 +0200
@@ -16,7 +16,7 @@
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:
+ elif type == PAM.PAM_ERROR_MSG or type == PAM.PAM_TEXT_INFO:
print query
resp.append(('', 0))
else: