mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
disable file paranoia checks on read files by default
This commit is contained in:
parent
fa8c8116e1
commit
271c681609
@ -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
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user