disable file paranoia checks on read files by default

This commit is contained in:
Duncan Laurie 2006-03-19 18:22:39 +00:00
parent fa8c8116e1
commit 271c681609
2 changed files with 21 additions and 1 deletions

View File

@ -3,7 +3,7 @@ dnl autoconf for ipmitool
dnl
AC_INIT([src/ipmitool.c])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([ipmitool], [1.8.6])
AM_INIT_AUTOMAKE([ipmitool], [1.8.7])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([src/ipmitool.c])
AC_PREREQ(2.50)
@ -291,6 +291,14 @@ AC_ARG_ENABLE([buildcheck],
AC_SUBST(CFLAGS)
dnl Enable extra file security paranoia
AC_ARG_ENABLE([file-security],
[AC_HELP_STRING([--enable-file-security],
[enable extra security checks on files opened for read [default=no]])],
[if test "x$enable_file_security" != "xno"; then
AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for extra file security.])
fi], [])
dnl Generate files for build
AC_CONFIG_FILES([Makefile
doc/Makefile

View File

@ -275,6 +275,18 @@ ipmi_open_file(const char * file, int rw)
}
}
#ifndef ENABLE_FILE_SECURITY
if (!rw) {
/* on read skip the extra checks */
fp = fopen(file, "r");
if (fp == NULL) {
lperror(LOG_ERR, "Unable to open file %s", file);
return NULL;
}
return fp;
}
#endif
/* it exists - only regular files, not links */
if (S_ISREG(st1.st_mode) == 0) {
lprintf(LOG_ERR, "File %s has invalid mode: %d",