Bugzilla – Bug 375
includedir results in parse errors
Last modified: 2009-11-20 19:13:49 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
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.
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.