Bug 32

Summary: visudo always fails to lock sudoers (NEXTSTEP3.3 m68k)
Product: Sudo Reporter: twetzel
Component: VisudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.6.3   
Hardware: Other   
OS: NEXTSTEP   
Attachments: Patch for file locking on NS3.3/m68k

Description twetzel 2001-04-04 07:10:50 MDT
With NS3.3 (m68k), sudo-1.6.3p7 compiles cleanly. sudo works, but visudo always
complains about the sudoers file being already locked.

Reason:
sudo finds and uses lockf(), but for some reason the lockf() call in lock_file()
always return -1, errno=EINVAL for my system (note that EINVAL isn't even a
documented return for my lockf(), and that AFAIK lockf() is generally working on
NS.)

Workaround:
Use flock() instead of lockf() by enabling HAVE_FLOCK instead of HAVE_LOCKF in
config.h. (I haven't tried to automate this with configure, so at least a notice
in the docs seems useful.)
The appended patch also includes the header file for flock() and fixes a
possible typo for SUDO_UNLOCK. (This seems to also affect sudo with logging to
file and flock() locking.)
Comment 1 twetzel 2001-04-04 07:12:59 MDT
Created attachment 4 [details]
Patch for file locking on NS3.3/m68k
Comment 2 Todd C. Miller 2001-04-04 11:19:59 MDT
Thanks for the patch.  I've added a special case for NeXTSTEP to avoid lockf()
so this should be automatic in 1.6.4.