no more cryptic message if the sudoers file is zero length,
now just give a parse error
*
* This function check to see that the sudoers file is readable,
* owned by SUDOERS_OWNER, and not writable by anyone else.
- * It should really check for a zero length sudoers file too. (XXX)
*/
static int check_sudoers()
set_perms(PERM_SUDOERS);
- if ((fd = open(_PATH_SUDO_SUDOERS, O_RDONLY)) < 0 || read(fd, &c, 1) != 1)
+ if ((fd = open(_PATH_SUDO_SUDOERS, O_RDONLY)) < 0 || read(fd, &c, 1) == -1)
rtn = NO_SUDOERS_FILE;
else if (lstat(_PATH_SUDO_SUDOERS, &statbuf))
rtn = NO_SUDOERS_FILE;
(void) close(fd);
+ set_perms(PERM_ROOT);
set_perms(PERM_USER);
return(rtn);