File access vulnerability with SUID bins

Check_dhcp and check_icmp are root setuid binaries, with extra-opts enabled, file permissions are never checked before fopen is called on files. This patch uses POSIX standard functions, so they should be portable, to verify real uid should have permissions to config file and that it is also not a linked file. These changes are global and WILL effect non-suid plugins as well, however considering real and effective uid should be the same in non-suid applications, it should just properly verify file permissions before attempting to access and not cause issues provided file access is permitted. - SR

http://www.exploit-db.com/exploits/33387/

Thanks to Dawid Golunski for the submission, and emislivec for reworking the patch a bit.