diff --git a/.github/workflows/test-ci-windows.yml b/.github/workflows/test-ci-windows.yml index 1ad2a3f3..3f792e08 100644 --- a/.github/workflows/test-ci-windows.yml +++ b/.github/workflows/test-ci-windows.yml @@ -9,73 +9,54 @@ on: - v2/test-ci-windows jobs: - inspect-apache: + build: runs-on: windows-latest - + steps: - - name: Check Apache24 bin directory + - name: Create test files (MSYS2) + uses: msys2/setup-msys2@v2 + shell: msys2 {0} run: | - $binPath = "C:\tools\Apache24\bin" - Write-Host "=== Apache24 bin Directory Contents ===" - if (Test-Path $binPath) { - Write-Host "Directory exists at: $binPath" - Write-Host "Files and subdirectories:" - Get-ChildItem -Path $binPath -Recurse | ForEach-Object { - if ($_.PSIsContainer) { - Write-Host " [DIR] $($_.FullName)" - } else { - Write-Host " [FILE] $($_.FullName) ($($_.Length) bytes)" - } - } - } else { - Write-Host "Bin directory does not exist at: $binPath" - } - shell: pwsh - - - name: Check Apache24 include directory + # 创建测试目录和文件 + mkdir -p test-files + echo "This is a test file" > test-files/test.txt + echo "fuzzy definition file" > test-files/fuzzy.def + + # 复制到工作区目录 + mkdir -p ${{ github.workspace }}/artifacts + cp -r test-files/* ${{ github.workspace }}/artifacts/ + + # 验证文件已复制 + echo "Files in artifacts directory:" + ls -la ${{ github.workspace }}/artifacts/ + + - name: Verify file transfer (PowerShell) + shell: powershell run: | - $includePath = "C:\tools\Apache24\include" - Write-Host "=== Apache24 include Directory Contents ===" - if (Test-Path $includePath) { - Write-Host "Directory exists at: $includePath" - Write-Host "Files and subdirectories:" - Get-ChildItem -Path $includePath -Recurse | ForEach-Object { - if ($_.PSIsContainer) { - Write-Host " [DIR] $($_.FullName)" - } else { - Write-Host " [FILE] $($_.FullName) ($($_.Length) bytes)" - } - } - - # 特别检查 APR 头文件 - Write-Host "`n=== APR Header Files ===" - Get-ChildItem -Path $includePath -Filter "apr*.h" -Recurse | ForEach-Object { - Write-Host " $($_.FullName)" - } - - # 检查是否存在 apr_perms_set.h - $permsSetPath = Join-Path $includePath "apr_perms_set.h" - if (Test-Path $permsSetPath) { - Write-Host "`nFOUND: apr_perms_set.h exists at $permsSetPath" - } else { - Write-Host "`nMISSING: apr_perms_set.h not found in $includePath" - } + Write-Host "Checking transferred files in PowerShell:" + Get-ChildItem -Path "${{ github.workspace }}\artifacts" -Recurse + + # 验证文件内容 + Write-Host "Content of test.txt:" + Get-Content "${{ github.workspace }}\artifacts\test.txt" + + Write-Host "Content of fuzzy.def:" + Get-Content "${{ github.workspace }}\artifacts\fuzzy.def" + + # 检查文件是否存在 + $testFile = "${{ github.workspace }}\artifacts\test.txt" + $fuzzyFile = "${{ github.workspace }}\artifacts\fuzzy.def" + + if (Test-Path $testFile -PathType Leaf) { + Write-Host "✓ test.txt successfully transferred" } else { - Write-Host "Include directory does not exist at: $includePath" + Write-Host "✗ test.txt not found" + exit 1 } - shell: pwsh - - - name: Check Apache24 directory structure - run: | - $apachePath = "C:\tools\Apache24" - Write-Host "=== Apache24 Overall Structure ===" - if (Test-Path $apachePath) { - Write-Host "Apache24 directory exists at: $apachePath" - Write-Host "Top-level directories:" - Get-ChildItem -Path $apachePath -Directory | ForEach-Object { - Write-Host " - $($_.Name)" - } + + if (Test-Path $fuzzyFile -PathType Leaf) { + Write-Host "✓ fuzzy.def successfully transferred" } else { - Write-Host "Apache24 directory does not exist at: $apachePath" - } - shell: pwsh \ No newline at end of file + Write-Host "✗ fuzzy.def not found" + exit 1 + } \ No newline at end of file diff --git a/iis/CMakeLists.txt b/iis/CMakeLists.txt index 11ebd1f9..a5c6d82b 100644 --- a/iis/CMakeLists.txt +++ b/iis/CMakeLists.txt @@ -4,6 +4,7 @@ project(ModSecurityIIS C CXX) find_package(LibXml2 CONFIG REQUIRED) find_package(PCRE2 CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED) +find_package(APR CONFIG REQUIRED) # iis/CMakeLists.txt set(IIS_MODULE_NAME "modsecurityiis") # Name should match the original output @@ -125,9 +126,10 @@ target_include_directories(${IIS_MODULE_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../apache2 ${CMAKE_CURRENT_SOURCE_DIR}/../apache2/libinjection ${LIBXML2_INCLUDE_DIR}/libxml - ${PCRE_INCLUDE_DIRS} + ${PCRE2_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} # 添加构建目录以访问生成的头文件 + ${APR_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} ) # Include standalone directory if it exists @@ -139,6 +141,12 @@ endif() # Apache-specific includes if(APACHE_ROOT) + if(NOT EXISTS "${APACHE_ROOT}") + message(FATAL_ERROR "APACHE_ROOT is defined but the directory '${APACHE_ROOT}' does not exist. Please set APACHE_ROOT to a valid Apache installation directory.") + endif() + if(NOT EXISTS "${APACHE_ROOT}/lib") + message(FATAL_ERROR "APACHE_ROOT/lib directory does not exist. Expected: '${APACHE_ROOT}/lib'. Please ensure Apache libraries are available.") + endif() target_include_directories(${IIS_MODULE_NAME} PRIVATE ${APACHE_ROOT}/include ) @@ -166,24 +174,15 @@ if(WITH_LUA) target_include_directories(${IIS_MODULE_NAME} PRIVATE ${LUA_INCLUDE_DIR}) endif() -# Default Apache root based on architecture -if(NOT APACHE_ROOT) - if(ARCHITECTURE STREQUAL "x64") - set(APACHE_ROOT "C:/Apache24_x64" CACHE PATH "Path to Apache x64 installation") - else() - set(APACHE_ROOT "C:/Apache24_x86" CACHE PATH "Path to Apache x86 installation") - endif() -endif() - option(WITH_YAJL "Enable YAJL support" OFF) if(WITH_YAJL) # Manually find YAJL if config.cmake is not available (e.g., from vcpkg) find_path(YAJL_INCLUDE_DIR yajl/yajl_common.h - PATHS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/${ARCHITECTURE}-windows/include" + PATHS "${CMAKE_CURRENT_SOURCE_DIR}/build/vcpkg_installed/${ARCHITECTURE}-windows/include" NO_DEFAULT_PATH ) find_library(YAJL_LIBRARY NAMES yajl - PATHS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg_installed/${ARCHITECTURE}-windows/lib" + PATHS "${CMAKE_CURRENT_SOURCE_DIR}/build/vcpkg_installed/${ARCHITECTURE}-windows/lib" NO_DEFAULT_PATH ) @@ -193,7 +192,7 @@ if(WITH_YAJL) target_compile_definitions(${IIS_MODULE_NAME} PRIVATE WITH_YAJL) target_include_directories(${IIS_MODULE_NAME} PRIVATE ${YAJL_INCLUDE_DIRS}) else() - message(WARNING "YAJL not found. Please ensure yajl is installed via vcpkg in the iis/vcpkg_installed directory. Disabling YAJL support.") + message(WARNING "YAJL not found. YAJL_INCLUDE_DIR: '${YAJL_INCLUDE_DIR}', YAJL_LIBRARY: '${YAJL_LIBRARY}'. Please ensure yajl is installed via vcpkg in the vcpkg_installed directory. Disabling YAJL support.") option(WITH_YAJL "Enable YAJL support" OFF) # Disable if not found endif() endif() @@ -203,7 +202,7 @@ if(WITH_SSDEEP) set(SSDEEP_ROOT "" CACHE PATH "Path to manually built ssdeep") if(NOT SSDEEP_ROOT OR NOT EXISTS "${SSDEEP_ROOT}") - message(WARNING "SSDEEP_ROOT is not defined or path does not exist. Please set SSDEEP_ROOT to the ssdeep installation directory. Disabling SSDEEP support.") + message(WARNING "SSDEEP_ROOT is not defined or path does not exist. Current SSDEEP_ROOT: '${SSDEEP_ROOT}'. Please set SSDEEP_ROOT to the ssdeep installation directory. Disabling SSDEEP support.") set(WITH_SSDEEP OFF CACHE BOOL "Enable SSDEEP support" FORCE) else() message(STATUS "SSDEEP_ROOT: ${SSDEEP_ROOT}")