Bug 302

Summary: visudo does not check for zero length files (include)
Product: Sudo Reporter: Edgar Olvera <edgar.olvera>
Component: VisudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.7.0   
Hardware: PC   
OS: Linux   

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.