Bugzilla – Bug 38
Failure to call endspent leaves shadow file open on fd 3
Last modified: 2001-05-10 16:55:48 MDT
In getspwuid.c, getspnam is called but endspent is not called afterwards, which leaves /etc/shadow open on fd 3 for the sudo'd program to read. This is with libc.5.4.46. The patch at http://www.gistnet.com/~mike/sudo-1.6.3p7.patch fixes this by moving the estrdup inside sudo_getepw and calling endspent after estrdup but before returning.
Thanks, I wasn't aware that some implementations leave the fd open even though setspent() had not been called. I'll just bracket all the shadow varients with their respective set/end calls.