-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
When trying to ./configure --with-yajl YAJL can never be found. If I specify --with-yajl="/usr/include/yajl" it will find the YAJL headers, but still report that YAJL was not found. If I include multiple paths in --with-yajl="" it continues to find nothing.
I tried to uninstall libyajl-dev from my package manager and manually compile yajl from sources. I experieced the same results with any combination of /usr/local/{include,lib} in the path.
After some digging I found that ./build/yajl.m4 tries to use pkg-config to find YAJL first, and then falls back to directory scanning. However, it appears the list of directories to check is stored in YAJL_POSSIBLE_PATHS while the script is passing YAJL_POSSIBLE_LIB_NAMES to CHECK_FOR_YAJL_AT() on line 65.
# If pkg-config did not find anything useful, go over file lookup.
for x in ${YAJL_POSSIBLE_LIB_NAMES}; do
CHECK_FOR_YAJL_AT(${x})
if test -n "${YAJL_VERSION}"; then
break
fi
done
Reviewing the definition of CHECK_FOR_YAJL_AT() it expects 'path' as the first argumant, and then loops through the YAJL_POSSIBLE_EXTENSIONS and YAJL_POSSIBLE_LIB_NAMES inside the function to search that path.
AC_DEFUN([CHECK_FOR_YAJL_AT], [
path=$1
for y in ${YAJL_POSSIBLE_EXTENSIONS}; do
for z in ${YAJL_POSSIBLE_LIB_NAMES}; do
...
By modifying the loop defined on line 65 to loop over YAJL_POSSIBLE_PATHS instead of YAJL_POSSIBLE_LIB_NAMES and running ./build.sh again, YAJL is found correctly.
Additionally, if multiple directories are provided, for example --with-yajl="<dir1> <dir2>", they are not all searched. Instead they are treated as a single directory. In the yajl.m4 file on line 73 the script checks for --with-yajl with an argument and passes the argument to CHECK_FOR_YAJL_AT() as a path. Instead, it would be optimal to loop over provided paths and search each one.
Logs and dumps
There was no useful log information. The config.log simply reported that YAJL could not be found and/or that sometimes the headers were found, but that YAJL still was not found. There was no indication that paths were being checked at all.
To Reproduce
Steps to reproduce the behavior:
sudo apt install -y libyajl-dev
git clone --recursive [email protected]:owasp-modsecurity/ModSecurity.git
cd ModSecurity
./build.sh
./configure --with-yajlYou can try any combination of paths in --with-yajl and it fails to find it.
Expected behavior
Obviously the expected behaviour is that YAJL should be found if specifying --with-yajl.
Server (please complete the following information):
- ModSecurity version: 3.0.13
- OS (and distro): Debian 12.9