Bug 375

Summary: includedir results in parse errors
Product: Sudo Reporter: seph <seph>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.7.2   
Hardware: PC   
OS: Linux   

Description seph 2009-11-20 11:19:28 MST
I seem to be running into the same problem described in http://www.sudo.ws/pipermail/sudo-users/2009-October/004206.html It doesn't seem very well described there, so I'm expanding on it here.

On an ubuntu hardy 8.04 machine, I built sudo versions 1.7.2 and 1.7.2p1. I configured as "./configure --prefix=/tmp/sudo-test-$version", all default options. 

seph@test$ cat /tmp/sudoers.include
#include /tmp/sudoers.d/test.sudoers

seph@test$ cat /tmp/sudoers.includedir 
#includedir /tmp/sudoers.d

seph@test$ ls /tmp/sudoers.d/
test.sudoers

seph@test$ cat /tmp/sudoers.d/test.sudoers 
seph ALL = NOPASSWD:  /bin/ls

seph@test$ /tmp/sudo-test-1.7.2p1/sbin/visudo -c -f /tmp/sudoers.d/test.sudoers 
/tmp/sudoers.d/test.sudoers: parsed OK

seph@test$ /tmp/sudo-test-1.7.2p1/sbin/visudo -c -f /tmp/sudoers.include        
/tmp/sudoers.include: parsed OK

seph@test$ /tmp/sudo-test-1.7.2p1/sbin/visudo -c -f /tmp/sudoers.includedir 
parse error in /tmp/sudoers.includedir near line 0


Though this example is with visudo, I have the same problems with sudo. It's just a little more cumbersome to test. I also get the same errors with 1.7.2
Comment 1 seph 2009-11-20 14:29:09 MST
Just following up here, this would be a user error. As documented, sudo ignores files with a dot in them, and fails if the directory is empty. Changing to files without a dot in them, fixes this.
Comment 2 Todd C. Miller 2009-11-20 19:13:49 MST
The rational for skipping files with a dot in them is to avoid parsing potential backup or temporary files created by package managers.

I've fixed the problem of sudo producing a parse error when #includedir cannot find any files to include in cvs.