Bug 302 - visudo does not check for zero length files (include)
visudo does not check for zero length files (include)
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Visudo
1.7.0
PC Linux
: normal normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-01 12:38 MDT by Edgar Olvera
Modified: 2008-10-26 16:46 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edgar Olvera 2008-10-01 12:38:32 MDT
I would like visudo to verify if an "included file" is empty before quitting.

When sudoers has "include" statements and you edit the "included file" visudo does not verify if you left the file empty. So, whenever try to use "sudo" you get 

'sudo ls
sudo: /etc/sudo.file is zero length
>>> /etc/sudoers: /etc/sudo.file near line 48 <<<
sudo: parse error in /etc/sudoers near line 48
sudo: no valid sudoers sources found, quitting'

and

'sudo visudo
sudo: /etc/sudo.file is zero length
>>> /etc/sudoers: /etc/sudo.file near line 48 <<<
sudo: parse error in /etc/sudoers near line 48
sudo: no valid sudoers sources found, quitting'

At that moment sudo is useless.
Comment 1 Todd C. Miller 2008-10-03 10:05:08 MDT
It is probably simplest to just make sudo handle a zero-length sudoers file more gracefully and perhaps warn about it in visudo.
Comment 2 Todd C. Miller 2008-10-26 16:46:20 MDT
Fixed in cvs.  This will be part of sudo 1.7.0rc3.