Message75516
The getpwnam function in the pwd module does not correctly distinguish
between the case when the user does not exist and error
conditions. getpwnam() returns NULL in both cases, the the calling
code needs to check errno to determine if an error occured or not.
This bug is problematic in conjunction with bug
https://bugzilla.redhat.com/show_bug.cgi?id=470003, since it means
that Pythons getpwnam() will sometimes raise KeyError even for valid
users. How to reproduce:
$ python
Python 2.4.3 (#1, Jan 14 2008, 18:32:40)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pwd
>>> pwd.getpwnam("astrand")
('astrand', '*', 164, 20164, 'Peter Astrand', '/home/astrand', '/bin/bash')
>>>
>>> pwd.getpwnam("astrand")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
KeyError: 'getpwnam(): name not found: astrand'
>>>
>>> pwd.getpwnam("astrand")
('astrand', '*', 164, 20164, 'Peter Astrand', '/home/astrand', '/bin/bash')
>>>
I was restarting the OpenLDAP server between the first successful call
and the traceback one. |
|
Date |
User |
Action |
Args |
2008-11-05 08:19:23 | astrand | set | recipients:
+ astrand |
2008-11-05 08:19:22 | astrand | set | messageid: <1225873162.85.0.693443096685.issue4261@psf.upfronthosting.co.za> |
2008-11-05 08:19:21 | astrand | link | issue4261 messages |
2008-11-05 08:19:19 | astrand | create | |
|