mirror of
https://github.com/3proxy/3proxy.git
synced 2026-04-13 00:10:11 +08:00
Compare commits
22 Commits
251c6061a5
...
fd651bff70
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd651bff70 | ||
|
|
4e8ea2d7f0 | ||
|
|
82533b1a50 | ||
|
|
8c8ad7be6d | ||
|
|
d2c343fbbc | ||
|
|
ea8837e4b9 | ||
|
|
d26f27a87e | ||
|
|
b1f27b545a | ||
|
|
4747d69a62 | ||
|
|
dc1dbf2ad5 | ||
|
|
ab75695944 | ||
|
|
9e44dddfbe | ||
|
|
17112334bc | ||
|
|
5b6652ac99 | ||
|
|
05eb317337 | ||
|
|
1b64c7f8ab | ||
|
|
5fd5eb55c6 | ||
|
|
5d3d56dae1 | ||
|
|
58ab65dfdf | ||
|
|
c7318a825c | ||
|
|
1f92847a63 | ||
|
|
e3e13af922 |
30
.github/workflows/c-cpp.yml
vendored
30
.github/workflows/c-cpp.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
# run: ./configure
|
# run: ./configure
|
||||||
- name: Linux libraries
|
- name: Linux libraries
|
||||||
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
||||||
run: sudo apt install libssl-dev libpam-dev libpcre3 libpcre3-dev
|
run: sudo apt install libssl-dev libpam-dev libpcre2-dev
|
||||||
- name: make Ubuntu
|
- name: make Ubuntu
|
||||||
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
||||||
run: make -f Makefile.Linux
|
run: make -f Makefile.Linux
|
||||||
@ -40,7 +40,7 @@ jobs:
|
|||||||
run: make -f Makefile.Linux clean
|
run: make -f Makefile.Linux clean
|
||||||
- name: Mac libraries
|
- name: Mac libraries
|
||||||
if: ${{ startsWith(matrix.target, 'macos') }}
|
if: ${{ startsWith(matrix.target, 'macos') }}
|
||||||
run: brew install pcre
|
run: brew install pcre2
|
||||||
- name: make MacOS
|
- name: make MacOS
|
||||||
if: ${{ startsWith(matrix.target, 'macos') }}
|
if: ${{ startsWith(matrix.target, 'macos') }}
|
||||||
run: make -f Makefile.FreeBSD
|
run: make -f Makefile.FreeBSD
|
||||||
@ -50,12 +50,15 @@ jobs:
|
|||||||
- name: make clean MacOS
|
- name: make clean MacOS
|
||||||
if: ${{ startsWith(matrix.target, 'macos') }}
|
if: ${{ startsWith(matrix.target, 'macos') }}
|
||||||
run: make -f Makefile.FreeBSD clean
|
run: make -f Makefile.FreeBSD clean
|
||||||
|
- name: install Windows libraries
|
||||||
|
if: ${{ startsWith(matrix.target, 'windows') }}
|
||||||
|
run: vcpkg install pcre2:x64-windows && c:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-pcre2 mingw-w64-x86_64-openssl
|
||||||
- name: make Windows
|
- name: make Windows
|
||||||
if: ${{ startsWith(matrix.target, 'windows') }}
|
if: ${{ startsWith(matrix.target, 'windows') }}
|
||||||
run: make -f Makefile.win
|
run: make -f Makefile.win
|
||||||
env:
|
env:
|
||||||
LIBS: '-L "c:/program files/openssl/lib/VC/x64/MT"'
|
LDFLAGS: '-L "c:/msys64/mingw64/lib"'
|
||||||
CFLAGS: '-I "c:/program files/openssl/include"'
|
CFLAGS: '-I "c:/msys64/mingw64/include"'
|
||||||
- name: make clean Windows
|
- name: make clean Windows
|
||||||
if: ${{ startsWith(matrix.target, 'windows') }}
|
if: ${{ startsWith(matrix.target, 'windows') }}
|
||||||
run: make -f Makefile.win clean
|
run: make -f Makefile.win clean
|
||||||
@ -70,9 +73,20 @@ jobs:
|
|||||||
D:
|
D:
|
||||||
cd "D:/a/3proxy/3proxy"
|
cd "D:/a/3proxy/3proxy"
|
||||||
mkdir bin64
|
mkdir bin64
|
||||||
set "LIB=%LIB%;c:/program files/openssl/lib/VC/x64/MT"
|
set "LIB=%LIB%;c:/program files/openssl/lib/VC/x64/MT;c:/vcpkg/installed/x64-windows/lib"
|
||||||
|
set "INCLUDE=%INCLUDE%;c:/program files/openssl/include;c:/vcpkg/installed/x64-windows/include"
|
||||||
nmake /F Makefile.msvc64
|
nmake /F Makefile.msvc64
|
||||||
nmake /F Makefile.msvc64 clean
|
nmake /F Makefile.msvc64 clean
|
||||||
env:
|
- name: make with CMake POSIX
|
||||||
LIBS: '/LIBPATH:"c:/program files/openssl/lib/VC/x64/MT"'
|
if: ${{ !startsWith(matrix.target, 'windows') }}
|
||||||
CFLAGS: '-I "c:/program files/openssl/include"'
|
run: mkdir build && cd build && cmake .. && make
|
||||||
|
- name: make with CMake Win
|
||||||
|
if: ${{ startsWith(matrix.target, 'windows') }}
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
# set "LIB=%LIB%;c:/program files/openssl/lib/VC/x64/MT;c:/vcpkg/installed/x64-windows/lib"
|
||||||
|
# set "INCLUDE=%INCLUDE%;c:/program files/openssl/include;c:/vcpkg/installed/x64-windows/include"
|
||||||
|
cmake -DCMAKE_C_COMPILER=clang ..
|
||||||
|
dir
|
||||||
|
make
|
||||||
|
|||||||
550
CMakeLists.txt
Normal file
550
CMakeLists.txt
Normal file
@ -0,0 +1,550 @@
|
|||||||
|
#
|
||||||
|
# 3proxy CMake build system
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
# Read version from RELEASE file
|
||||||
|
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE" PROJECT_VERSION LIMIT_COUNT 1)
|
||||||
|
|
||||||
|
project(3proxy
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
LANGUAGES C
|
||||||
|
DESCRIPTION "3proxy - tiny free proxy server"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Include GNUInstallDirs for standard installation directories
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
# Add cmake module path
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
|
# Detect compiler
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||||
|
set(COMPILER_IS_CLANG TRUE)
|
||||||
|
if(WIN32 AND CMAKE_C_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
||||||
|
set(COMPILER_IS_CLANG_CL TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_IS_CLANG_CL FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(COMPILER_IS_CLANG FALSE)
|
||||||
|
set(COMPILER_IS_CLANG_CL FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(COMPILER_IS_GCC TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_IS_GCC FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC AND NOT COMPILER_IS_CLANG_CL)
|
||||||
|
set(COMPILER_IS_MSVC TRUE)
|
||||||
|
else()
|
||||||
|
set(COMPILER_IS_MSVC FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Options
|
||||||
|
option(3PROXY_BUILD_SHARED "Build shared libraries for plugins" ON)
|
||||||
|
option(3PROXY_USE_OPENSSL "Enable OpenSSL/SSLPlugin" ON)
|
||||||
|
option(3PROXY_USE_PCRE2 "Enable PCRE2/PCREPlugin" ON)
|
||||||
|
option(3PROXY_USE_PAM "Enable PAM/PamAuth" ON)
|
||||||
|
option(3PROXY_USE_ODBC "Enable ODBC support (Unix only, always ON on Windows)" OFF)
|
||||||
|
option(3PROXY_USE_SPLICE "Use Linux splice() for zero-copy (Linux only)" ON)
|
||||||
|
option(3PROXY_USE_POLL "Use poll() instead of select() (Unix only)" ON)
|
||||||
|
option(3PROXY_USE_WSAPOLL "Use WSAPoll instead of select() (Windows only)" ON)
|
||||||
|
option(3PROXY_USE_NETFILTER "Enable Linux netfilter support (Linux only)" ON)
|
||||||
|
|
||||||
|
# Output directory
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
|
# Find threads library (cross-platform pthread equivalent)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
# Set default build type if not specified
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Platform-independent position independent code for shared libraries
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
# Platform detection and configuration
|
||||||
|
if(WIN32)
|
||||||
|
# Windows-specific configuration
|
||||||
|
add_compile_definitions(
|
||||||
|
WIN32
|
||||||
|
_WIN32
|
||||||
|
_MBCS
|
||||||
|
_CONSOLE
|
||||||
|
PRINTF_INT64_MODIFIER="I64"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(COMPILER_IS_MSVC)
|
||||||
|
# MSVC-specific settings
|
||||||
|
add_compile_definitions(
|
||||||
|
MSVC
|
||||||
|
WITH_SSL
|
||||||
|
)
|
||||||
|
# Use static runtime library
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
# MSVC compiler options
|
||||||
|
add_compile_options(
|
||||||
|
/W3 # Warning level 3
|
||||||
|
/GS # Buffer security check
|
||||||
|
/GA # Optimize for Windows applications
|
||||||
|
/GF # Enable string pooling
|
||||||
|
)
|
||||||
|
# Optimization flags per build type
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "/O2")
|
||||||
|
|
||||||
|
elseif(COMPILER_IS_CLANG_CL)
|
||||||
|
# clang-cl (Clang with MSVC frontend)
|
||||||
|
add_compile_definitions(
|
||||||
|
MSVC
|
||||||
|
WITH_SSL
|
||||||
|
)
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
add_compile_options(
|
||||||
|
-W3
|
||||||
|
-fno-strict-aliasing
|
||||||
|
)
|
||||||
|
|
||||||
|
elseif(COMPILER_IS_CLANG OR COMPILER_IS_GCC)
|
||||||
|
# Clang or GCC on Windows (MinGW-like)
|
||||||
|
add_compile_definitions(WITH_STD_MALLOC)
|
||||||
|
add_compile_options(-fno-strict-aliasing)
|
||||||
|
|
||||||
|
elseif(WATCOM)
|
||||||
|
# OpenWatcom-specific flags
|
||||||
|
add_compile_definitions(
|
||||||
|
WATCOM
|
||||||
|
MSVC
|
||||||
|
NOIPV6
|
||||||
|
NODEBUG
|
||||||
|
NORADIUS
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Windows libraries
|
||||||
|
set(WINDOWS_LIBS ws2_32 advapi32 user32 kernel32 gdi32 crypt32)
|
||||||
|
|
||||||
|
# Windows plugins (always built)
|
||||||
|
set(DEFAULT_PLUGINS
|
||||||
|
utf8tocp1251
|
||||||
|
WindowsAuthentication
|
||||||
|
TrafficPlugin
|
||||||
|
StringsPlugin
|
||||||
|
FilePlugin
|
||||||
|
)
|
||||||
|
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
# Linux-specific configuration
|
||||||
|
add_compile_definitions(
|
||||||
|
_GNU_SOURCE
|
||||||
|
GETHOSTBYNAME_R
|
||||||
|
_THREAD_SAFE
|
||||||
|
_REENTRANT
|
||||||
|
)
|
||||||
|
|
||||||
|
if(COMPILER_IS_CLANG OR COMPILER_IS_GCC)
|
||||||
|
# Clang/GCC on Linux
|
||||||
|
add_compile_options(-fno-strict-aliasing)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(3PROXY_USE_SPLICE)
|
||||||
|
add_compile_definitions(WITHSPLICE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(3PROXY_USE_NETFILTER)
|
||||||
|
add_compile_definitions(WITH_NETFILTER)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DEFAULT_PLUGINS
|
||||||
|
StringsPlugin
|
||||||
|
TrafficPlugin
|
||||||
|
TransparentPlugin
|
||||||
|
)
|
||||||
|
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|Darwin|OpenBSD|NetBSD")
|
||||||
|
# BSD/macOS-specific configuration
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
# macOS-specific
|
||||||
|
add_compile_definitions(_DARWIN_UNLIMITED_SELECT)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COMPILER_IS_CLANG OR COMPILER_IS_GCC)
|
||||||
|
add_compile_options(-fno-strict-aliasing)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DEFAULT_PLUGINS
|
||||||
|
StringsPlugin
|
||||||
|
TrafficPlugin
|
||||||
|
TransparentPlugin
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
# Generic Unix configuration
|
||||||
|
if(COMPILER_IS_CLANG OR COMPILER_IS_GCC)
|
||||||
|
add_compile_options(-fno-strict-aliasing)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DEFAULT_PLUGINS
|
||||||
|
StringsPlugin
|
||||||
|
TrafficPlugin
|
||||||
|
TransparentPlugin
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Common definitions
|
||||||
|
if(WIN32)
|
||||||
|
# Windows: use WSAPOLL
|
||||||
|
if(3PROXY_USE_WSAPOLL)
|
||||||
|
add_compile_definitions(WITH_WSAPOLL)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(FD_SETSIZE=4096)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# Unix: use poll
|
||||||
|
if(3PROXY_USE_POLL)
|
||||||
|
add_compile_definitions(WITH_POLL)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(FD_SETSIZE=4096)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find dependencies
|
||||||
|
|
||||||
|
# OpenSSL
|
||||||
|
set(OPENSSL_FOUND FALSE)
|
||||||
|
if(3PROXY_USE_OPENSSL)
|
||||||
|
find_package(OpenSSL QUIET)
|
||||||
|
if(OpenSSL_FOUND)
|
||||||
|
set(OPENSSL_FOUND TRUE)
|
||||||
|
add_compile_definitions(WITH_SSL)
|
||||||
|
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
|
||||||
|
else()
|
||||||
|
message(STATUS "OpenSSL not found, SSLPlugin will not be built")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# PCRE2
|
||||||
|
set(PCRE2_FOUND FALSE)
|
||||||
|
if(3PROXY_USE_PCRE2)
|
||||||
|
find_package(PCRE2 QUIET)
|
||||||
|
if(PCRE2_FOUND)
|
||||||
|
message(STATUS "PCRE2 found: ${PCRE2_VERSION}")
|
||||||
|
else()
|
||||||
|
message(STATUS "PCRE2 not found, PCREPlugin will not be built")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# PAM (Unix only)
|
||||||
|
set(PAM_FOUND FALSE)
|
||||||
|
if(3PROXY_USE_PAM AND NOT WIN32)
|
||||||
|
find_package(PAM QUIET)
|
||||||
|
if(PAM_FOUND)
|
||||||
|
message(STATUS "PAM found")
|
||||||
|
else()
|
||||||
|
message(STATUS "PAM not found, PamAuth will not be built")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ODBC (always enabled on Windows)
|
||||||
|
set(ODBC_FOUND FALSE)
|
||||||
|
if(WIN32 OR 3PROXY_USE_ODBC)
|
||||||
|
find_package(ODBC QUIET)
|
||||||
|
if(ODBC_FOUND)
|
||||||
|
message(STATUS "ODBC found")
|
||||||
|
else()
|
||||||
|
message(STATUS "ODBC not found, building without ODBC support")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set NOODBC if ODBC is not found
|
||||||
|
if(NOT ODBC_FOUND)
|
||||||
|
add_compile_definitions(NOODBC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Source files for 3proxy core
|
||||||
|
set(3PROXY_CORE_SOURCES
|
||||||
|
src/3proxy.c
|
||||||
|
src/auth.c
|
||||||
|
src/authradius.c
|
||||||
|
src/conf.c
|
||||||
|
src/datatypes.c
|
||||||
|
src/plugins.c
|
||||||
|
src/stringtable.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# MD4/MD5 sources for mycrypt
|
||||||
|
set(MD_SOURCES
|
||||||
|
src/libs/md4.c
|
||||||
|
src/libs/md5.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Object libraries for common sources (shared between executables)
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Common object library (sockmap, sockgetchar, common, log)
|
||||||
|
add_library(common_obj OBJECT
|
||||||
|
src/sockmap.c
|
||||||
|
src/sockgetchar.c
|
||||||
|
src/common.c
|
||||||
|
src/log.c
|
||||||
|
)
|
||||||
|
target_include_directories(common_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# base64 object library
|
||||||
|
add_library(base64_obj OBJECT src/base64.c)
|
||||||
|
target_include_directories(base64_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Object libraries for 3proxy (compiled WITHOUT WITHMAIN)
|
||||||
|
# These are used by the main 3proxy executable
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Server modules object library (without WITHMAIN)
|
||||||
|
add_library(srv_modules OBJECT
|
||||||
|
src/proxy.c
|
||||||
|
src/pop3p.c
|
||||||
|
src/smtpp.c
|
||||||
|
src/ftppr.c
|
||||||
|
src/tcppm.c
|
||||||
|
src/tlspr.c
|
||||||
|
src/auto.c
|
||||||
|
src/socks.c
|
||||||
|
src/webadmin.c
|
||||||
|
src/udppm.c
|
||||||
|
src/dnspr.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(srv_modules PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
# mainfunc object (proxymain.c compiled with MODULEMAINFUNC=mainfunc for 3proxy)
|
||||||
|
add_library(mainfunc OBJECT src/proxymain.c)
|
||||||
|
target_include_directories(mainfunc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
target_compile_definitions(mainfunc PRIVATE MODULEMAINFUNC=mainfunc)
|
||||||
|
|
||||||
|
# ftp object (used only by 3proxy and ftppr)
|
||||||
|
add_library(ftp_obj OBJECT src/ftp.c)
|
||||||
|
target_include_directories(ftp_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# mycrypt object for 3proxy (without WITHMAIN)
|
||||||
|
add_library(mycrypt_obj OBJECT src/mycrypt.c)
|
||||||
|
target_include_directories(mycrypt_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Main 3proxy executable
|
||||||
|
# Uses srv_* object files (without WITHMAIN)
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
add_executable(3proxy
|
||||||
|
${3PROXY_CORE_SOURCES}
|
||||||
|
${MD_SOURCES}
|
||||||
|
$<TARGET_OBJECTS:srv_modules>
|
||||||
|
$<TARGET_OBJECTS:mainfunc>
|
||||||
|
$<TARGET_OBJECTS:common_obj>
|
||||||
|
$<TARGET_OBJECTS:base64_obj>
|
||||||
|
$<TARGET_OBJECTS:ftp_obj>
|
||||||
|
$<TARGET_OBJECTS:mycrypt_obj>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(3proxy PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(3proxy PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
if(ODBC_FOUND)
|
||||||
|
if(TARGET ODBC::ODBC)
|
||||||
|
target_link_libraries(3proxy PRIVATE ODBC::ODBC)
|
||||||
|
else()
|
||||||
|
target_link_libraries(3proxy PRIVATE ${ODBC_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(3proxy PRIVATE ${WINDOWS_LIBS})
|
||||||
|
if(OpenSSL_FOUND)
|
||||||
|
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
endif()
|
||||||
|
if(COMPILER_IS_MSVC AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3proxy.rc)
|
||||||
|
target_sources(3proxy PRIVATE 3proxy.rc)
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
target_link_libraries(3proxy PRIVATE dl)
|
||||||
|
if(OpenSSL_FOUND)
|
||||||
|
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Build mycrypt utility
|
||||||
|
add_executable(mycrypt
|
||||||
|
src/mycrypt.c
|
||||||
|
${MD_SOURCES}
|
||||||
|
$<TARGET_OBJECTS:base64_obj>
|
||||||
|
)
|
||||||
|
target_compile_definitions(mycrypt PRIVATE WITHMAIN)
|
||||||
|
target_include_directories(mycrypt PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
||||||
|
)
|
||||||
|
target_link_libraries(mycrypt PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
# Build standalone proxy executables
|
||||||
|
foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
||||||
|
if(PROXY_NAME STREQUAL "ftppr" OR PROXY_NAME STREQUAL "proxy")
|
||||||
|
# ftppr and proxy use ftp_obj
|
||||||
|
add_executable(${PROXY_NAME}
|
||||||
|
src/${PROXY_NAME}.c
|
||||||
|
$<TARGET_OBJECTS:common_obj>
|
||||||
|
$<TARGET_OBJECTS:ftp_obj>
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_executable(${PROXY_NAME}
|
||||||
|
src/${PROXY_NAME}.c
|
||||||
|
$<TARGET_OBJECTS:common_obj>
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(${PROXY_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(${PROXY_NAME} PRIVATE
|
||||||
|
WITHMAIN
|
||||||
|
NOPORTMAP
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROXY_NAME} PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
if(PROXY_NAME STREQUAL "proxy")
|
||||||
|
target_compile_definitions(${PROXY_NAME} PRIVATE ANONYMOUS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PROXY_NAME STREQUAL "tcppm" OR PROXY_NAME STREQUAL "udppm" OR PROXY_NAME STREQUAL "tlspr")
|
||||||
|
target_compile_definitions(${PROXY_NAME} PRIVATE PORTMAP)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(${PROXY_NAME} PRIVATE ${WINDOWS_LIBS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PROXY_NAME STREQUAL "proxy" OR PROXY_NAME STREQUAL "smtpp")
|
||||||
|
target_sources(${PROXY_NAME} PRIVATE $<TARGET_OBJECTS:base64_obj>)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Plugin output directory
|
||||||
|
set(PLUGIN_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
if(WIN32)
|
||||||
|
set(PLUGIN_SUFFIX ".dll")
|
||||||
|
else()
|
||||||
|
set(PLUGIN_SUFFIX ".ld.so")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Include plugin definitions
|
||||||
|
include(cmake/plugins.cmake)
|
||||||
|
|
||||||
|
# Build plugins
|
||||||
|
foreach(PLUGIN ${DEFAULT_PLUGINS})
|
||||||
|
add_subdirectory(src/plugins/${PLUGIN})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(OPENSSL_FOUND)
|
||||||
|
add_subdirectory(src/plugins/SSLPlugin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PCRE2_FOUND)
|
||||||
|
add_subdirectory(src/plugins/PCREPlugin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PAM_FOUND)
|
||||||
|
add_subdirectory(src/plugins/PamAuth)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Build full list of plugins to be built
|
||||||
|
set(ALL_PLUGINS ${DEFAULT_PLUGINS})
|
||||||
|
if(OPENSSL_FOUND)
|
||||||
|
list(APPEND ALL_PLUGINS SSLPlugin)
|
||||||
|
endif()
|
||||||
|
if(PCRE2_FOUND)
|
||||||
|
list(APPEND ALL_PLUGINS PCREPlugin)
|
||||||
|
endif()
|
||||||
|
if(PAM_FOUND)
|
||||||
|
list(APPEND ALL_PLUGINS PamAuth)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Installation rules
|
||||||
|
install(TARGETS 3proxy mycrypt proxy socks pop3p smtpp ftppr tcppm udppm tlspr
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install plugins
|
||||||
|
if(WIN32)
|
||||||
|
install(FILES
|
||||||
|
${PLUGIN_OUTPUT_DIR}/utf8tocp1251${PLUGIN_SUFFIX}
|
||||||
|
${PLUGIN_OUTPUT_DIR}/WindowsAuthentication${PLUGIN_SUFFIX}
|
||||||
|
${PLUGIN_OUTPUT_DIR}/TrafficPlugin${PLUGIN_SUFFIX}
|
||||||
|
${PLUGIN_OUTPUT_DIR}/StringsPlugin${PLUGIN_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
install(FILES
|
||||||
|
${PLUGIN_OUTPUT_DIR}/StringsPlugin${PLUGIN_SUFFIX}
|
||||||
|
${PLUGIN_OUTPUT_DIR}/TrafficPlugin${PLUGIN_SUFFIX}
|
||||||
|
${PLUGIN_OUTPUT_DIR}/TransparentPlugin${PLUGIN_SUFFIX}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Install configuration files
|
||||||
|
if(NOT WIN32)
|
||||||
|
install(FILES scripts/3proxy.cfg DESTINATION /etc/3proxy)
|
||||||
|
install(FILES scripts/add3proxyuser.sh DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Install man pages
|
||||||
|
if(NOT WIN32)
|
||||||
|
file(GLOB MAN3_FILES "${CMAKE_CURRENT_SOURCE_DIR}/man/*.3")
|
||||||
|
file(GLOB MAN8_FILES "${CMAKE_CURRENT_SOURCE_DIR}/man/*.8")
|
||||||
|
install(FILES ${MAN3_FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
|
||||||
|
install(FILES ${MAN8_FILES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man8)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS "3proxy configuration summary:")
|
||||||
|
message(STATUS " Version: ${PROJECT_VERSION}")
|
||||||
|
message(STATUS " Platform: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
message(STATUS " Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
|
||||||
|
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS " Options:")
|
||||||
|
message(STATUS " BUILD_SHARED: ${3PROXY_BUILD_SHARED}")
|
||||||
|
message(STATUS " USE_OPENSSL: ${3PROXY_USE_OPENSSL}")
|
||||||
|
message(STATUS " USE_PCRE2: ${3PROXY_USE_PCRE2}")
|
||||||
|
message(STATUS " USE_PAM: ${3PROXY_USE_PAM}")
|
||||||
|
message(STATUS " USE_ODBC: ${3PROXY_USE_ODBC}")
|
||||||
|
message(STATUS " USE_POLL: ${3PROXY_USE_POLL}")
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
message(STATUS " USE_SPLICE: ${3PROXY_USE_SPLICE}")
|
||||||
|
message(STATUS " USE_NETFILTER: ${3PROXY_USE_NETFILTER}")
|
||||||
|
endif()
|
||||||
|
if(WIN32)
|
||||||
|
message(STATUS " USE_WSAPOLL: ${3PROXY_USE_WSAPOLL}")
|
||||||
|
endif()
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS " Libraries found:")
|
||||||
|
message(STATUS " OpenSSL: ${OPENSSL_FOUND}")
|
||||||
|
message(STATUS " PCRE2: ${PCRE2_FOUND}")
|
||||||
|
message(STATUS " PAM: ${PAM_FOUND}")
|
||||||
|
message(STATUS " ODBC: ${ODBC_FOUND}")
|
||||||
|
message(STATUS "")
|
||||||
|
message(STATUS " Plugins to build: ${ALL_PLUGINS}")
|
||||||
|
message(STATUS "")
|
||||||
@ -1,4 +1,4 @@
|
|||||||
# 3proxy.full is fully functional 3proxy build based on busibox:glibc
|
# 3proxy.full is fully functional 3proxy build based on busybox:glibc
|
||||||
#
|
#
|
||||||
#to build:
|
#to build:
|
||||||
# docker build -f Dockerfile.full -t 3proxy.full .
|
# docker build -f Dockerfile.full -t 3proxy.full .
|
||||||
@ -13,8 +13,11 @@
|
|||||||
# docker run -p 3129:3129 -v /path/to/local/config/directory:/usr/local/3proxy/conf -name 3proxy.full 3proxy.full
|
# docker run -p 3129:3129 -v /path/to/local/config/directory:/usr/local/3proxy/conf -name 3proxy.full 3proxy.full
|
||||||
#
|
#
|
||||||
# /path/to/local/config/directory in this example must conrain 3proxy.cfg
|
# /path/to/local/config/directory in this example must conrain 3proxy.cfg
|
||||||
# if you need 3proxy to be executed without chroot with root permissions, replace /etc/3proxy/3proxy.cfg by e.g. mounting config
|
# if you need 3proxy to be executed without chroot with root permissions
|
||||||
|
# replace /etc/3proxy/3proxy.cfg by e.g. mounting config
|
||||||
# dir to /etc/3proxy ot by providing config file /etc/3proxy/3proxy.cfg
|
# dir to /etc/3proxy ot by providing config file /etc/3proxy/3proxy.cfg
|
||||||
|
# some plugins like SSLPLugin / pamauth also conflict with chroot and must
|
||||||
|
# be started prior to chroot.
|
||||||
# docker run -p 3129:3129 -v /path/to/local/config/directory:/etc/3proxy -name 3proxy.full 3proxy.full
|
# docker run -p 3129:3129 -v /path/to/local/config/directory:/etc/3proxy -name 3proxy.full 3proxy.full
|
||||||
#
|
#
|
||||||
# use "log" without pathname in config to log to stdout.
|
# use "log" without pathname in config to log to stdout.
|
||||||
@ -24,9 +27,7 @@
|
|||||||
FROM gcc AS buildenv
|
FROM gcc AS buildenv
|
||||||
COPY . 3proxy
|
COPY . 3proxy
|
||||||
RUN cd 3proxy &&\
|
RUN cd 3proxy &&\
|
||||||
echo "">> Makefile.Linux &&\
|
apt update && apt install libssl-dev libpam-dev libpcre2-dev &&\
|
||||||
echo PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin SSLPlugin>>Makefile.Linux &&\
|
|
||||||
echo LIBS = -l:libcrypto.a -l:libssl.a -ldl >>Makefile.Linux &&\
|
|
||||||
make -f Makefile.Linux &&\
|
make -f Makefile.Linux &&\
|
||||||
strip bin/3proxy &&\
|
strip bin/3proxy &&\
|
||||||
strip bin/StringsPlugin.ld.so &&\
|
strip bin/StringsPlugin.ld.so &&\
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC ?= cc
|
CC ?= cc
|
||||||
|
|
||||||
CFLAGS := -c -fno-strict-aliasing -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS)
|
CFLAGS := -c -fno-strict-aliasing -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS)
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN ?= ${CC}
|
LN ?= ${CC}
|
||||||
LDFLAGS += -pthread -fno-strict-aliasing
|
LDFLAGS += -pthread -fno-strict-aliasing
|
||||||
@ -30,16 +30,16 @@ TYPECOMMAND = cat
|
|||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.FreeBSD
|
MAKEFILE = Makefile.FreeBSD
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
||||||
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += -l crypto -l ssl
|
||||||
PLUGINS += SSLPlugin
|
PLUGINS += SSLPlugin
|
||||||
endif
|
endif
|
||||||
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "\#include <pcre.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
PLUGINS += PCREPlugin
|
PLUGINS += PCREPlugin
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,20 +1,17 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for GCC/Linux/Cygwin
|
# 3 proxy Makefile for GCC/Linux/Cygwin
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
|
||||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
|
|
||||||
CFLAGS := -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER $(CFLAGS)
|
CFLAGS := -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER $(CFLAGS)
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN ?= ${CC}
|
LN ?= ${CC}
|
||||||
DCFLAGS ?=
|
DCFLAGS ?=
|
||||||
LDFLAGS ?= -fPIC -O2 -fno-strict-aliasing -pthread
|
LDFLAGS := -fPIC -O2 -fno-strict-aliasing -pthread $(LDFLAGS)
|
||||||
DLFLAGS ?= -shared
|
DLFLAGS ?= -shared
|
||||||
DLSUFFICS = .ld.so
|
DLSUFFICS = .ld.so
|
||||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
||||||
@ -36,16 +33,16 @@ MAKEFILE = Makefile.Linux
|
|||||||
LIBS ?= -ldl
|
LIBS ?= -ldl
|
||||||
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
|
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
||||||
OPENSSL_CHECK = $(shell echo "#include <openssl/ssl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += -l crypto -l ssl
|
||||||
PLUGINS += SSLPlugin
|
PLUGINS += SSLPlugin
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "#include <pcre.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
PLUGINS += PCREPlugin
|
PLUGINS += PCREPlugin
|
||||||
endif
|
endif
|
||||||
PAM_CHECK = $(shell echo "#include <security/pam_appl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Solaris/SunCC
|
# 3 proxy Makefile for Solaris/SunCC
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
||||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cc
|
CC = cc
|
||||||
CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||||
COUT = -o ./
|
COUT = -o ./
|
||||||
LN = $(CC)
|
LN = $(CC)
|
||||||
LDFLAGS = -xO3
|
LDFLAGS = -xO3
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Solaris/gcc
|
# 3 proxy Makefile for Solaris/gcc
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
||||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
||||||
@ -10,7 +8,7 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O2 -fno-strict-aliasing -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
CFLAGS = -O2 -fno-strict-aliasing -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||||
COUT = -o ./
|
COUT = -o ./
|
||||||
LN = $(CC)
|
LN = $(CC)
|
||||||
LDFLAGS = -O3
|
LDFLAGS = -O3
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
||||||
#
|
#
|
||||||
# You can try to add /D "WITH_STD_MALLOC" to CFLAGS to use standard malloc
|
|
||||||
# libraries
|
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /FD /MDd /nologo /W3 /ZI /Wp64 /GS /Gs /RTCsu /EHs- /GA /GF /DEBUG /D "WITH_STD_MALLOC" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /c
|
CFLAGS = /FD /MDd /nologo /W3 /ZI /Wp64 /GS /Gs /RTCsu /EHs- /GA /GF /DEBUG /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /c
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /machine:I386 /DEBUG
|
LDFLAGS = /nologo /subsystem:console /machine:I386 /DEBUG
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
||||||
|
|
||||||
@ -10,7 +8,7 @@ MAKEFILE = Makefile.msvc64
|
|||||||
|
|
||||||
BUILDDIR = ../bin64/
|
BUILDDIR = ../bin64/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE) $(CFLAGS)
|
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE) $(CFLAGS)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
|
||||||
@ -31,7 +29,7 @@ TYPECOMMAND = type
|
|||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
VERFILE = 3proxy.res $(VERFILE)
|
VERFILE = 3proxy.res $(VERFILE)
|
||||||
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
||||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin SSLPlugin
|
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin SSLPlugin PCREPlugin
|
||||||
AFTERCLEAN = del src\*.res
|
AFTERCLEAN = del src\*.res
|
||||||
|
|
||||||
include Makefile.inc
|
include Makefile.inc
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
||||||
|
|
||||||
BUILDDIR = ../bin64/
|
BUILDDIR = ../bin64/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "WITH_SSL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "WITH_SSL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /DARM /D "NOODBC" /nologo /MT /W3 /Wp64 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "_WINCE" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c
|
CFLAGS = /DARM /D "NOODBC" /nologo /MT /W3 /Wp64 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "_WINCE" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no
|
LDFLAGS = /nologo /subsystem:console /incremental:no
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for GCC/Linux/Cygwin
|
# 3 proxy Makefile for GCC/Linux/Cygwin
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC
|
||||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
||||||
@ -10,7 +8,7 @@
|
|||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = mips-openwrt-linux-gcc
|
CC = mips-openwrt-linux-gcc
|
||||||
|
|
||||||
CFLAGS ?= -g -O2 -fno-strict-aliasing -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
|
CFLAGS ?= -g -O2 -fno-strict-aliasing -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN = $(CC)
|
LN = $(CC)
|
||||||
DCFLAGS = -fPIC
|
DCFLAGS = -fPIC
|
||||||
@ -36,16 +34,16 @@ MAKEFILE = Makefile.openwrt-mips
|
|||||||
LIBS ?= -ldl
|
LIBS ?= -ldl
|
||||||
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
|
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
||||||
OPENSSL_CHECK = $(shell echo "#include <openssl/ssl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += -l crypto -l ssl
|
||||||
PLUGINS += SSLPlugin
|
PLUGINS += SSLPlugin
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "#include <pcre.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
PLUGINS += PCREPlugin
|
PLUGINS += PCREPlugin
|
||||||
endif
|
endif
|
||||||
PAM_CHECK = $(shell echo "#include <security/pam_appl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for GCC/Unix
|
# 3 proxy Makefile for GCC/Unix
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
||||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
||||||
@ -11,7 +9,7 @@ BUILDDIR = ../bin/
|
|||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
|
|
||||||
# you may need -L/usr/pkg/lib for older NetBSD versions
|
# you may need -L/usr/pkg/lib for older NetBSD versions
|
||||||
CFLAGS := -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS)
|
CFLAGS := -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS)
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN ?= $(CC)
|
LN ?= $(CC)
|
||||||
LDFLAGS ?= -O2 -fno-strict-aliasing -pthread
|
LDFLAGS ?= -O2 -fno-strict-aliasing -pthread
|
||||||
@ -34,16 +32,16 @@ TYPECOMMAND = cat
|
|||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.unix
|
MAKEFILE = Makefile.unix
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin
|
||||||
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += -l crypto -l ssl
|
||||||
PLUGINS += SSLPlugin
|
PLUGINS += SSLPlugin
|
||||||
endif
|
endif
|
||||||
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "\#include <pcre.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
PLUGINS += PCREPlugin
|
PLUGINS += PCREPlugin
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for Open Watcom 2
|
# 3 proxy Makefile for Open Watcom 2
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WITH_STD_MALLOC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no
|
LDFLAGS = /nologo /subsystem:console /incremental:no
|
||||||
|
|||||||
21
Makefile.win
21
Makefile.win
@ -1,8 +1,6 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for GCC/windows
|
# 3 proxy Makefile for GCC/windows
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
||||||
# library support
|
# library support
|
||||||
@ -10,10 +8,10 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
CFLAGS := -O2 -s -c -mthreads -DWITH_STD_MALLOC -DWITH_WSAPOLL $(CFLAGS)
|
CFLAGS := -O2 -s -c -mthreads -DWITH_WSAPOLL $(CFLAGS)
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN ?= $(CC)
|
LN ?= $(CC)
|
||||||
LDFLAGS ?= -O2 -s -mthreads
|
LDFLAGS := -O2 -s -mthreads $(LDFLAGS)
|
||||||
DLFLAGS ?= -shared
|
DLFLAGS ?= -shared
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS := -lws2_32 -lodbc32 -ladvapi32 -luser32 $(LIBS)
|
LIBS := -lws2_32 -lodbc32 -ladvapi32 -luser32 $(LIBS)
|
||||||
@ -35,20 +33,21 @@ VERSIONDEP := 3proxyres.o $(VERSIONDEP)
|
|||||||
BUILDDATE := $(BUILDDATE)
|
BUILDDATE := $(BUILDDATE)
|
||||||
AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
|
AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
|
||||||
|
|
||||||
OPENSSL_CHECK = $(shell echo "#include <openssl/ssl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
ifndef OPENSSL_CHECK
|
||||||
|
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d '\\\\' | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += -l crypto -l ssl
|
||||||
PLUGINS += SSLPlugin
|
PLUGINS += SSLPlugin
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "#include <pcre.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d '\\\\' | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
|
||||||
PLUGINS += PCREPlugin
|
|
||||||
endif
|
|
||||||
PAM_CHECK = $(shell echo "#include <security/pam_appl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
|
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include <pcre2.h>\\n int main(){return 0;}" | tr -d '\\\\' | cc -x c $(CFLAGS) $(LDFLAGS) -lpcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
||||||
|
ifeq ($(PCRE_CHECK), true)
|
||||||
|
PLUGINS += PCREPlugin
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
include Makefile.inc
|
include Makefile.inc
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#
|
#
|
||||||
# 3 proxy Makefile for GCC/windows
|
# 3 proxy Makefile for GCC/windows
|
||||||
#
|
#
|
||||||
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
|
|
||||||
# libraries
|
|
||||||
#
|
#
|
||||||
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
|
||||||
# library support
|
# library support
|
||||||
@ -10,7 +8,7 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = /opt/cegcc/arm-wince-cegcc/bin/gcc
|
CC = /opt/cegcc/arm-wince-cegcc/bin/gcc
|
||||||
CFLAGS = -O2 -s -c -mthreads -DWITH_STD_MALLOC -DNOODBC -D_WINCE -D_WIN32 -DNORADIUS -D__USE_W32_SOCKETS
|
CFLAGS = -O2 -s -c -mthreads -DNOODBC -D_WINCE -D_WIN32 -DNORADIUS -D__USE_W32_SOCKETS
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN = /opt/cegcc/arm-wince-cegcc/bin/gcc
|
LN = /opt/cegcc/arm-wince-cegcc/bin/gcc
|
||||||
LDFLAGS = -O2 -s -mthreads
|
LDFLAGS = -O2 -s -mthreads
|
||||||
|
|||||||
4
README
4
README
@ -12,7 +12,7 @@ Devel branch - 3proxy 10 (don't use it)
|
|||||||
https://github.com/z3APA3A/3proxy/releases
|
https://github.com/z3APA3A/3proxy/releases
|
||||||
|
|
||||||
Docker images:
|
Docker images:
|
||||||
https://hub.docker.com/repository/docker/3proxy/3proxy
|
https://hub.docker.com/r/3proxy/3proxy
|
||||||
Archive of old versions: https://github.com/z3APA3A/3proxy-archive
|
Archive of old versions: https://github.com/z3APA3A/3proxy-archive
|
||||||
|
|
||||||
* Documentation
|
* Documentation
|
||||||
@ -141,7 +141,7 @@ make
|
|||||||
+ All access control entries now support weekday and time limitations
|
+ All access control entries now support weekday and time limitations
|
||||||
+ Hostnames and * templates are supported instead of IP address
|
+ Hostnames and * templates are supported instead of IP address
|
||||||
5. Extensions
|
5. Extensions
|
||||||
+ Regular expression filtering (with PCRE) via PCREPlugin
|
+ Regular expression filtering (with PCRE2) via PCREPlugin
|
||||||
+ Authentication with Windows username/password (cleartext only)
|
+ Authentication with Windows username/password (cleartext only)
|
||||||
+ SSL/TLS decryptions with certificate spoofing
|
+ SSL/TLS decryptions with certificate spoofing
|
||||||
+ Transparent redirection support for Linux and *BSD
|
+ Transparent redirection support for Linux and *BSD
|
||||||
|
|||||||
63
cmake/FindODBC.cmake
Normal file
63
cmake/FindODBC.cmake
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# FindODBC.cmake
|
||||||
|
#
|
||||||
|
# Find the ODBC library
|
||||||
|
#
|
||||||
|
# This module defines:
|
||||||
|
# ODBC_FOUND - whether the ODBC library was found
|
||||||
|
# ODBC_INCLUDE_DIRS - the ODBC include directories
|
||||||
|
# ODBC_LIBRARIES - the ODBC libraries
|
||||||
|
|
||||||
|
# Try pkg-config first
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PkgConfig_FOUND)
|
||||||
|
pkg_check_modules(PC_ODBC QUIET odbc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find include directory
|
||||||
|
find_path(ODBC_INCLUDE_DIR
|
||||||
|
NAMES sql.h
|
||||||
|
HINTS
|
||||||
|
${PC_ODBC_INCLUDE_DIRS}
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find library
|
||||||
|
if(WIN32)
|
||||||
|
# On Windows, ODBC is typically available as odbc32
|
||||||
|
find_library(ODBC_LIBRARY
|
||||||
|
NAMES odbc32
|
||||||
|
HINTS
|
||||||
|
${PC_ODBC_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# On Unix, look for odbc
|
||||||
|
find_library(ODBC_LIBRARY
|
||||||
|
NAMES odbc iodbc
|
||||||
|
HINTS
|
||||||
|
${PC_ODBC_LIBRARY_DIRS}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib/x86_64-linux-gnu
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(ODBC
|
||||||
|
REQUIRED_VARS ODBC_LIBRARY ODBC_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ODBC_FOUND)
|
||||||
|
set(ODBC_LIBRARIES ${ODBC_LIBRARY})
|
||||||
|
set(ODBC_INCLUDE_DIRS ${ODBC_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET ODBC::ODBC)
|
||||||
|
add_library(ODBC::ODBC UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(ODBC::ODBC PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${ODBC_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${ODBC_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(ODBC_INCLUDE_DIR ODBC_LIBRARY)
|
||||||
45
cmake/FindPAM.cmake
Normal file
45
cmake/FindPAM.cmake
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# FindPAM.cmake
|
||||||
|
#
|
||||||
|
# Find the PAM library
|
||||||
|
#
|
||||||
|
# This module defines:
|
||||||
|
# PAM_FOUND - whether the PAM library was found
|
||||||
|
# PAM_INCLUDE_DIRS - the PAM include directories
|
||||||
|
# PAM_LIBRARIES - the PAM libraries
|
||||||
|
|
||||||
|
# Find include directory
|
||||||
|
find_path(PAM_INCLUDE_DIR
|
||||||
|
NAMES security/pam_appl.h pam/pam_appl.h
|
||||||
|
HINTS
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find library
|
||||||
|
find_library(PAM_LIBRARY
|
||||||
|
NAMES pam
|
||||||
|
HINTS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib/x86_64-linux-gnu
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(PAM
|
||||||
|
REQUIRED_VARS PAM_LIBRARY PAM_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
if(PAM_FOUND)
|
||||||
|
set(PAM_LIBRARIES ${PAM_LIBRARY})
|
||||||
|
set(PAM_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET PAM::PAM)
|
||||||
|
add_library(PAM::PAM UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(PAM::PAM PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PAM_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PAM_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY)
|
||||||
69
cmake/FindPCRE2.cmake
Normal file
69
cmake/FindPCRE2.cmake
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# FindPCRE2.cmake
|
||||||
|
#
|
||||||
|
# Find the PCRE2 library
|
||||||
|
#
|
||||||
|
# This module defines:
|
||||||
|
# PCRE2_FOUND - whether the PCRE2 library was found
|
||||||
|
# PCRE2_INCLUDE_DIRS - the PCRE2 include directories
|
||||||
|
# PCRE2_LIBRARIES - the PCRE2 libraries
|
||||||
|
# PCRE2_VERSION - the PCRE2 version
|
||||||
|
|
||||||
|
# Try pkg-config first
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PkgConfig_FOUND)
|
||||||
|
pkg_check_modules(PC_PCRE2 QUIET libpcre2-8)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find include directory
|
||||||
|
find_path(PCRE2_INCLUDE_DIR
|
||||||
|
NAMES pcre2.h
|
||||||
|
HINTS
|
||||||
|
${PC_PCRE2_INCLUDE_DIRS}
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
PATH_SUFFIXES
|
||||||
|
pcre2
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find library
|
||||||
|
find_library(PCRE2_LIBRARY
|
||||||
|
NAMES pcre2-8 pcre2-8d pcre2
|
||||||
|
HINTS
|
||||||
|
${PC_PCRE2_LIBRARY_DIRS}
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
# Extract version from header
|
||||||
|
if(PCRE2_INCLUDE_DIR AND EXISTS "${PCRE2_INCLUDE_DIR}/pcre2.h")
|
||||||
|
file(STRINGS "${PCRE2_INCLUDE_DIR}/pcre2.h" PCRE2_VERSION_MAJOR_LINE
|
||||||
|
REGEX "^#define[ \t]+PCRE2_MAJOR[ \t]+[0-9]+")
|
||||||
|
file(STRINGS "${PCRE2_INCLUDE_DIR}/pcre2.h" PCRE2_VERSION_MINOR_LINE
|
||||||
|
REGEX "^#define[ \t]+PCRE2_MINOR[ \t]+[0-9]+")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+PCRE2_MAJOR[ \t]+([0-9]+)" "\\1"
|
||||||
|
PCRE2_VERSION_MAJOR "${PCRE2_VERSION_MAJOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+PCRE2_MINOR[ \t]+([0-9]+)" "\\1"
|
||||||
|
PCRE2_VERSION_MINOR "${PCRE2_VERSION_MINOR_LINE}")
|
||||||
|
set(PCRE2_VERSION "${PCRE2_VERSION_MAJOR}.${PCRE2_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(PCRE2
|
||||||
|
REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR
|
||||||
|
VERSION_VAR PCRE2_VERSION
|
||||||
|
)
|
||||||
|
|
||||||
|
if(PCRE2_FOUND)
|
||||||
|
set(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
|
||||||
|
set(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if(NOT TARGET PCRE2::PCRE2)
|
||||||
|
add_library(PCRE2::PCRE2 UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(PCRE2::PCRE2 PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${PCRE2_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(PCRE2_INCLUDE_DIR PCRE2_LIBRARY)
|
||||||
76
cmake/plugins.cmake
Normal file
76
cmake/plugins.cmake
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#
|
||||||
|
# 3proxy plugin definitions
|
||||||
|
#
|
||||||
|
# This file defines functions for building plugins
|
||||||
|
#
|
||||||
|
|
||||||
|
# Function to add a simple plugin (single source file, no dependencies)
|
||||||
|
function(add_3proxy_plugin_simple PLUGIN_NAME SOURCE_FILE)
|
||||||
|
if(WIN32)
|
||||||
|
set(PLUGIN_SUFFIX ".dll")
|
||||||
|
else()
|
||||||
|
set(PLUGIN_SUFFIX ".ld.so")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(${PLUGIN_NAME} SHARED ${SOURCE_FILE})
|
||||||
|
|
||||||
|
set_target_properties(${PLUGIN_NAME} PROPERTIES
|
||||||
|
PREFIX ""
|
||||||
|
SUFFIX ${PLUGIN_SUFFIX}
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
target_include_directories(${PLUGIN_NAME} PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Function to add a plugin with dependencies
|
||||||
|
function(add_3proxy_plugin PLUGIN_NAME)
|
||||||
|
set(options "")
|
||||||
|
set(oneValueArgs "")
|
||||||
|
set(multiValueArgs SOURCES LIBRARIES INCLUDE_DIRS COMPILE_DEFINITIONS LINK_OPTIONS)
|
||||||
|
|
||||||
|
cmake_parse_arguments(PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(PLUGIN_SUFFIX ".dll")
|
||||||
|
else()
|
||||||
|
set(PLUGIN_SUFFIX ".ld.so")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(${PLUGIN_NAME} SHARED ${PLUGIN_SOURCES})
|
||||||
|
|
||||||
|
set_target_properties(${PLUGIN_NAME} PROPERTIES
|
||||||
|
PREFIX ""
|
||||||
|
SUFFIX ${PLUGIN_SUFFIX}
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
# Always link with Threads
|
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
if(PLUGIN_LIBRARIES)
|
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE ${PLUGIN_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PLUGIN_INCLUDE_DIRS)
|
||||||
|
target_include_directories(${PLUGIN_NAME} PRIVATE ${PLUGIN_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PLUGIN_COMPILE_DEFINITIONS)
|
||||||
|
target_compile_definitions(${PLUGIN_NAME} PRIVATE ${PLUGIN_COMPILE_DEFINITIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PLUGIN_LINK_OPTIONS)
|
||||||
|
set_target_properties(${PLUGIN_NAME} PROPERTIES LINK_OPTIONS "${PLUGIN_LINK_OPTIONS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(${PLUGIN_NAME} PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
4
src/plugins/FilePlugin/CMakeLists.txt
Normal file
4
src/plugins/FilePlugin/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# FilePlugin
|
||||||
|
add_3proxy_plugin(FilePlugin
|
||||||
|
SOURCES FilePlugin.c
|
||||||
|
)
|
||||||
20
src/plugins/PCREPlugin/CMakeLists.txt
Normal file
20
src/plugins/PCREPlugin/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# PCREPlugin - requires PCRE2
|
||||||
|
|
||||||
|
if(NOT PCRE2_FOUND)
|
||||||
|
message(STATUS "PCREPlugin requires PCRE2, skipping")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_3proxy_plugin(PCREPlugin
|
||||||
|
SOURCES pcre_plugin.c
|
||||||
|
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TARGET PCRE2::PCRE2)
|
||||||
|
target_link_libraries(PCREPlugin PRIVATE PCRE2::PCRE2)
|
||||||
|
else()
|
||||||
|
target_link_libraries(PCREPlugin PRIVATE ${PCRE2_LIBRARIES})
|
||||||
|
if(PCRE2_INCLUDE_DIRS)
|
||||||
|
target_include_directories(PCREPlugin PRIVATE ${PCRE2_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
@ -1,4 +1,8 @@
|
|||||||
all: $(BUILDDIR)PCREPlugin$(DLSUFFICS)
|
all: $(BUILDDIR)PCREPlugin$(DLSUFFICS)
|
||||||
|
|
||||||
|
pcre_plugin$(OBJSUFFICS): pcre_plugin.c
|
||||||
|
$(CC) $(DCFLAGS) $(CFLAGS) pcre_plugin.c
|
||||||
|
|
||||||
$(BUILDDIR)PCREPlugin$(DLSUFFICS): pcre_plugin$(OBJSUFFICS)
|
$(BUILDDIR)PCREPlugin$(DLSUFFICS): pcre_plugin$(OBJSUFFICS)
|
||||||
$(LN) $(LNOUT)../../$(BUILDDIR)PCREPlugin$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) pcre_plugin$(OBJSUFFICS) $(LIBSPREFIX)pcre$(LIBSSUFFIX)
|
$(LN) $(LNOUT)../../$(BUILDDIR)PCREPlugin$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) pcre_plugin$(OBJSUFFICS) $(LIBSPREFIX)pcre2-8$(LIBSSUFFIX)
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
#include "../../structures.h"
|
#include "../../structures.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pcre.h>
|
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||||
|
#define PCRE2_STATIC
|
||||||
|
#include <pcre2.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -34,46 +36,76 @@ static struct filter pcre_first_filter = {
|
|||||||
|
|
||||||
static struct filter *pcre_last_filter;
|
static struct filter *pcre_last_filter;
|
||||||
static int pcre_loaded = 0;
|
static int pcre_loaded = 0;
|
||||||
static int pcre_options = 0;
|
static uint32_t pcre_options = 0;
|
||||||
|
|
||||||
static struct pcreopt {
|
static struct pcreopt {
|
||||||
char * name;
|
char * name;
|
||||||
int value;
|
uint32_t value;
|
||||||
} pcreopts[]= {
|
} pcreopts[]= {
|
||||||
|
|
||||||
{"PCRE_CASELESS", PCRE_CASELESS},
|
{"PCRE2_ALLOW_EMPTY_CLASS", PCRE2_ALLOW_EMPTY_CLASS},
|
||||||
{"PCRE_MULTILINE", PCRE_MULTILINE},
|
{"PCRE2_ALT_BSUX", PCRE2_ALT_BSUX},
|
||||||
{"PCRE_DOTALL", PCRE_DOTALL},
|
{"PCRE2_AUTO_CALLOUT", PCRE2_AUTO_CALLOUT},
|
||||||
{"PCRE_EXTENDED", PCRE_EXTENDED},
|
{"PCRE2_CASELESS", PCRE2_CASELESS},
|
||||||
{"PCRE_ANCHORED", PCRE_ANCHORED},
|
{"PCRE2_DOLLAR_ENDONLY", PCRE2_DOLLAR_ENDONLY},
|
||||||
{"PCRE_DOLLAR_ENDONLY", PCRE_DOLLAR_ENDONLY},
|
{"PCRE2_DOTALL", PCRE2_DOTALL},
|
||||||
{"PCRE_EXTRA", PCRE_EXTRA},
|
{"PCRE2_DUPNAMES", PCRE2_DUPNAMES},
|
||||||
{"PCRE_NOTBOL", PCRE_NOTBOL},
|
{"PCRE2_EXTENDED", PCRE2_EXTENDED},
|
||||||
{"PCRE_NOTEOL", PCRE_NOTEOL},
|
{"PCRE2_FIRSTLINE", PCRE2_FIRSTLINE},
|
||||||
{"PCRE_UNGREEDY", PCRE_UNGREEDY},
|
{"PCRE2_MATCH_UNSET_BACKREF", PCRE2_MATCH_UNSET_BACKREF},
|
||||||
{"PCRE_NOTEMPTY", PCRE_NOTEMPTY},
|
{"PCRE2_MULTILINE", PCRE2_MULTILINE},
|
||||||
{"PCRE_UTF8", PCRE_UTF8},
|
{"PCRE2_NEVER_UCP", PCRE2_NEVER_UCP},
|
||||||
{"PCRE_NO_AUTO_CAPTURE", PCRE_NO_AUTO_CAPTURE},
|
{"PCRE2_NEVER_UTF", PCRE2_NEVER_UTF},
|
||||||
{"PCRE_NO_UTF8_CHECK", PCRE_NO_UTF8_CHECK},
|
{"PCRE2_NO_AUTO_CAPTURE", PCRE2_NO_AUTO_CAPTURE},
|
||||||
{"PCRE_AUTO_CALLOUT", PCRE_AUTO_CALLOUT},
|
{"PCRE2_NO_AUTO_POSSESS", PCRE2_NO_AUTO_POSSESS},
|
||||||
{"PCRE_PARTIAL", PCRE_PARTIAL},
|
{"PCRE2_NO_DOTSTAR_ANCHOR", PCRE2_NO_DOTSTAR_ANCHOR},
|
||||||
{"PCRE_DFA_SHORTEST", PCRE_DFA_SHORTEST},
|
{"PCRE2_NO_START_OPTIMIZE", PCRE2_NO_START_OPTIMIZE},
|
||||||
{"PCRE_DFA_RESTART", PCRE_DFA_RESTART},
|
{"PCRE2_UCP", PCRE2_UCP},
|
||||||
{"PCRE_FIRSTLINE", PCRE_FIRSTLINE},
|
{"PCRE2_UNGREEDY", PCRE2_UNGREEDY},
|
||||||
{"PCRE_DUPNAMES", PCRE_DUPNAMES},
|
{"PCRE2_UTF", PCRE2_UTF},
|
||||||
{"PCRE_NEWLINE_CR", PCRE_NEWLINE_CR},
|
{"PCRE2_NEVER_BACKSLASH_C", PCRE2_NEVER_BACKSLASH_C},
|
||||||
{"PCRE_NEWLINE_LF", PCRE_NEWLINE_LF},
|
{"PCRE2_ALT_CIRCUMFLEX", PCRE2_ALT_CIRCUMFLEX},
|
||||||
{"PCRE_NEWLINE_CRLF", PCRE_NEWLINE_CRLF},
|
{"PCRE2_ALT_VERBNAMES", PCRE2_ALT_VERBNAMES},
|
||||||
{"PCRE_NEWLINE_ANY", PCRE_NEWLINE_ANY},
|
{"PCRE2_USE_OFFSET_LIMIT", PCRE2_USE_OFFSET_LIMIT},
|
||||||
{"PCRE_NEWLINE_ANYCRLF", PCRE_NEWLINE_ANYCRLF},
|
{"PCRE2_EXTENDED_MORE", PCRE2_EXTENDED_MORE},
|
||||||
{"PCRE_BSR_ANYCRLF", PCRE_BSR_ANYCRLF},
|
{"PCRE2_LITERAL", PCRE2_LITERAL},
|
||||||
{"PCRE_BSR_UNICODE", PCRE_BSR_UNICODE},
|
{"PCRE2_MATCH_INVALID_UTF", PCRE2_MATCH_INVALID_UTF},
|
||||||
|
|
||||||
|
{"PCRE_CASELESS", PCRE2_CASELESS},
|
||||||
|
{"PCRE_MULTILINE", PCRE2_MULTILINE},
|
||||||
|
{"PCRE_DOTALL", PCRE2_DOTALL},
|
||||||
|
{"PCRE_EXTENDED", PCRE2_EXTENDED},
|
||||||
|
{"PCRE_ANCHORED", PCRE2_ANCHORED},
|
||||||
|
{"PCRE_DOLLAR_ENDONLY", PCRE2_DOLLAR_ENDONLY},
|
||||||
|
{"PCRE_EXTRA", PCRE2_EXTENDED_MORE},
|
||||||
|
{"PCRE_NOTBOL", PCRE2_NOTBOL},
|
||||||
|
{"PCRE_NOTEOL", PCRE2_NOTEOL},
|
||||||
|
{"PCRE_UNGREEDY", PCRE2_UNGREEDY},
|
||||||
|
{"PCRE_NOTEMPTY", PCRE2_NOTEMPTY},
|
||||||
|
{"PCRE_UTF8", PCRE2_UTF},
|
||||||
|
{"PCRE_NO_AUTO_CAPTURE", PCRE2_NO_AUTO_CAPTURE},
|
||||||
|
{"PCRE_NO_UTF8_CHECK", PCRE2_MATCH_INVALID_UTF},
|
||||||
|
{"PCRE_AUTO_CALLOUT", PCRE2_AUTO_CALLOUT},
|
||||||
|
{"PCRE_PARTIAL", PCRE2_PARTIAL_SOFT},
|
||||||
|
{"PCRE_DFA_SHORTEST", PCRE2_DFA_SHORTEST},
|
||||||
|
{"PCRE_DFA_RESTART", PCRE2_DFA_RESTART},
|
||||||
|
{"PCRE_FIRSTLINE", PCRE2_FIRSTLINE},
|
||||||
|
{"PCRE_DUPNAMES", PCRE2_DUPNAMES},
|
||||||
|
{"PCRE_NEWLINE_CR", PCRE2_NEWLINE_CR},
|
||||||
|
{"PCRE_NEWLINE_LF", PCRE2_NEWLINE_LF},
|
||||||
|
{"PCRE_NEWLINE_CRLF", PCRE2_NEWLINE_CRLF},
|
||||||
|
{"PCRE_NEWLINE_ANY", PCRE2_NEWLINE_ANY},
|
||||||
|
{"PCRE_NEWLINE_ANYCRLF", PCRE2_NEWLINE_ANYCRLF},
|
||||||
|
{"PCRE_BSR_ANYCRLF", PCRE2_BSR_ANYCRLF},
|
||||||
|
{"PCRE_BSR_UNICODE", PCRE2_BSR_UNICODE},
|
||||||
|
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pcre_filter_data {
|
struct pcre_filter_data {
|
||||||
int users;
|
int users;
|
||||||
pcre * re;
|
pcre2_code * re;
|
||||||
|
pcre2_match_data * match_data;
|
||||||
int action;
|
int action;
|
||||||
char * replace;
|
char * replace;
|
||||||
struct ace *acl;
|
struct ace *acl;
|
||||||
@ -83,7 +115,8 @@ static void pcre_data_free(struct pcre_filter_data *pcrefd){
|
|||||||
pthread_mutex_lock(&pcre_mutex);
|
pthread_mutex_lock(&pcre_mutex);
|
||||||
pcrefd->users--;
|
pcrefd->users--;
|
||||||
if(!pcrefd->users){
|
if(!pcrefd->users){
|
||||||
if(pcrefd->re) pl->freefunc(pcrefd->re);
|
if(pcrefd->match_data) pcre2_match_data_free(pcrefd->match_data);
|
||||||
|
if(pcrefd->re) pcre2_code_free(pcrefd->re);
|
||||||
if(pcrefd->acl) pl->freeacl(pcrefd->acl);
|
if(pcrefd->acl) pl->freeacl(pcrefd->acl);
|
||||||
if(pcrefd->replace) pl->freefunc(pcrefd->replace);
|
if(pcrefd->replace) pl->freefunc(pcrefd->replace);
|
||||||
pl->freefunc(pcrefd);
|
pl->freefunc(pcrefd);
|
||||||
@ -123,7 +156,7 @@ static FILTER_ACTION pcre_filter_client(void *fo, struct clientparam * param, vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, unsigned char ** buf_p, int * bufsize_p, int offset, int * length_p){
|
static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, unsigned char ** buf_p, int * bufsize_p, int offset, int * length_p){
|
||||||
int ovector[48];
|
PCRE2_SIZE *ovector;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
struct ace *acl;
|
struct ace *acl;
|
||||||
int match = 0;
|
int match = 0;
|
||||||
@ -143,8 +176,9 @@ static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, uns
|
|||||||
if(!pcrefd->re) return pcrefd->action;
|
if(!pcrefd->re) return pcrefd->action;
|
||||||
for(; offset < *length_p; nreplaces++){
|
for(; offset < *length_p; nreplaces++){
|
||||||
|
|
||||||
count = pcre_exec(pcrefd->re, NULL, (char *)*buf_p, *length_p, offset, 0, ovector, 48);
|
count = pcre2_match(pcrefd->re, (PCRE2_SPTR)*buf_p, *length_p, offset, 0, pcrefd->match_data, NULL);
|
||||||
if(count <= 0) break;
|
if(count <= 0) break;
|
||||||
|
ovector = pcre2_get_ovector_pointer(pcrefd->match_data);
|
||||||
if(!(replace = pcrefd->replace) || param->nooverwritefilter) return pcrefd->action;
|
if(!(replace = pcrefd->replace) || param->nooverwritefilter) return pcrefd->action;
|
||||||
|
|
||||||
replen = *length_p - ovector[1];
|
replen = *length_p - ovector[1];
|
||||||
@ -220,10 +254,11 @@ static void pcre_filter_close(void *fo){
|
|||||||
|
|
||||||
static int h_pcre(int argc, unsigned char **argv){
|
static int h_pcre(int argc, unsigned char **argv){
|
||||||
int action = 0;
|
int action = 0;
|
||||||
pcre *re = NULL;
|
pcre2_code *re = NULL;
|
||||||
|
pcre2_match_data *match_data = NULL;
|
||||||
struct ace *acl;
|
struct ace *acl;
|
||||||
int offset = 4;
|
int errcode;
|
||||||
const char * errptr;
|
PCRE2_SIZE erroffset;
|
||||||
struct pcre_filter_data *flt;
|
struct pcre_filter_data *flt;
|
||||||
struct filter *newf;
|
struct filter *newf;
|
||||||
char *replace = NULL;
|
char *replace = NULL;
|
||||||
@ -235,7 +270,6 @@ static int h_pcre(int argc, unsigned char **argv){
|
|||||||
else return 1;
|
else return 1;
|
||||||
if(!strncmp((char *)argv[0], "pcre_rewrite", 12)) {
|
if(!strncmp((char *)argv[0], "pcre_rewrite", 12)) {
|
||||||
int i,j;
|
int i,j;
|
||||||
offset = 5;
|
|
||||||
replace = pl->strdupfunc((char *)argv[4]);
|
replace = pl->strdupfunc((char *)argv[4]);
|
||||||
if(!replace) return 9;
|
if(!replace) return 9;
|
||||||
for(i=0, j=0; replace[i]; i++, j++){
|
for(i=0, j=0; replace[i]; i++, j++){
|
||||||
@ -264,22 +298,30 @@ static int h_pcre(int argc, unsigned char **argv){
|
|||||||
}
|
}
|
||||||
replace[j] = 0;
|
replace[j] = 0;
|
||||||
}
|
}
|
||||||
if(!(acl = pl->make_ace(argc - offset, argv + offset))) return 2;
|
if(!(acl = pl->make_ace(argc - 4, argv + 4))) return 2;
|
||||||
acl->nolog = (strstr((char *)argv[2],"log") == 0);
|
acl->nolog = (strstr((char *)argv[2],"log") == 0);
|
||||||
if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){
|
if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){
|
||||||
re = pcre_compile((char *)argv[3], pcre_options, &errptr, &offset, NULL);
|
re = pcre2_compile((PCRE2_SPTR)argv[3], PCRE2_ZERO_TERMINATED, pcre_options, &errcode, &erroffset, NULL);
|
||||||
if(!re) {
|
if(!re) {
|
||||||
pl->freefunc(acl);
|
pl->freefunc(acl);
|
||||||
if(replace) pl->freefunc(replace);
|
if(replace) pl->freefunc(replace);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
match_data = pcre2_match_data_create_from_pattern(re, NULL);
|
||||||
|
if(!match_data) {
|
||||||
|
pcre2_code_free(re);
|
||||||
|
pl->freefunc(acl);
|
||||||
|
if(replace) pl->freefunc(replace);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
flt = pl->mallocfunc(sizeof(struct pcre_filter_data));
|
flt = pl->mallocfunc(sizeof(struct pcre_filter_data));
|
||||||
newf = pl->mallocfunc(sizeof(struct filter));
|
newf = pl->mallocfunc(sizeof(struct filter));
|
||||||
|
|
||||||
if(!flt || !newf) {
|
if(!flt || !newf) {
|
||||||
|
if(match_data) pcre2_match_data_free(match_data);
|
||||||
|
if(re) pcre2_code_free(re);
|
||||||
pl->freefunc(acl);
|
pl->freefunc(acl);
|
||||||
pl->freefunc(re);
|
|
||||||
if(replace) pl->freefunc(replace);
|
if(replace) pl->freefunc(replace);
|
||||||
if(flt) pl->freefunc(flt);
|
if(flt) pl->freefunc(flt);
|
||||||
return 4;
|
return 4;
|
||||||
@ -288,6 +330,114 @@ static int h_pcre(int argc, unsigned char **argv){
|
|||||||
memset(newf, 0, sizeof(struct filter));
|
memset(newf, 0, sizeof(struct filter));
|
||||||
flt->action = action;
|
flt->action = action;
|
||||||
flt->re = re;
|
flt->re = re;
|
||||||
|
flt->match_data = match_data;
|
||||||
|
flt->acl = acl;
|
||||||
|
flt->replace = replace;
|
||||||
|
flt->users = 1;
|
||||||
|
newf->instance = "pcre";
|
||||||
|
newf->data = flt;
|
||||||
|
newf->filter_open = pcre_filter_open;
|
||||||
|
newf->filter_client = pcre_filter_client;
|
||||||
|
if(strstr((char *)argv[1], "request"))newf->filter_request = pcre_filter_buffer;
|
||||||
|
if(strstr((char *)argv[1], "cliheader"))newf->filter_header_cli = pcre_filter_buffer;
|
||||||
|
if(strstr((char *)argv[1], "clidata"))newf->filter_data_cli = pcre_filter_buffer;
|
||||||
|
if(strstr((char *)argv[1], "srvheader"))newf->filter_header_srv = pcre_filter_buffer;
|
||||||
|
if(strstr((char *)argv[1], "srvdata"))newf->filter_data_srv = pcre_filter_buffer;
|
||||||
|
newf->filter_clear = pcre_filter_clear;
|
||||||
|
newf->filter_close = pcre_filter_close;
|
||||||
|
|
||||||
|
if(!pcre_last_filter){
|
||||||
|
newf->next = pcre_first_filter.next;
|
||||||
|
pcre_first_filter.next=newf;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newf->next = pcre_last_filter->next;
|
||||||
|
pcre_last_filter->next = newf;
|
||||||
|
}
|
||||||
|
pcre_last_filter=newf;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int h_pcre_rewrite(int argc, unsigned char **argv){
|
||||||
|
int action = 0;
|
||||||
|
pcre2_code *re = NULL;
|
||||||
|
pcre2_match_data *match_data = NULL;
|
||||||
|
struct ace *acl;
|
||||||
|
int errcode;
|
||||||
|
PCRE2_SIZE erroffset;
|
||||||
|
struct pcre_filter_data *flt;
|
||||||
|
struct filter *newf;
|
||||||
|
char *replace = NULL;
|
||||||
|
|
||||||
|
if(!strncmp((char *)argv[2], "allow",5)) action = PASS;
|
||||||
|
else if(!strncmp((char *)argv[2], "deny",4)) action = REJECT;
|
||||||
|
else if(!strncmp((char *)argv[2], "remove",6)) action = REMOVE;
|
||||||
|
else if(!strncmp((char *)argv[2], "dunno",5)) action = CONTINUE;
|
||||||
|
else return 1;
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
replace = pl->strdupfunc((char *)argv[4]);
|
||||||
|
if(!replace) return 9;
|
||||||
|
for(i=0, j=0; replace[i]; i++, j++){
|
||||||
|
if(replace[i] == '\\'){
|
||||||
|
switch(replace[i+1]){
|
||||||
|
case 'r':
|
||||||
|
i++;
|
||||||
|
replace[j] = '\r';
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
i++;
|
||||||
|
replace[j] = '\n';
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
i++;
|
||||||
|
replace[j] = 0;
|
||||||
|
break;
|
||||||
|
case '\\':
|
||||||
|
i++;
|
||||||
|
default:
|
||||||
|
replace[j] = '\\';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else replace[j] = replace[i];
|
||||||
|
}
|
||||||
|
replace[j] = 0;
|
||||||
|
}
|
||||||
|
if(!(acl = pl->make_ace(argc - 5, argv + 5))) return 2;
|
||||||
|
acl->nolog = (strstr((char *)argv[2],"log") == 0);
|
||||||
|
if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){
|
||||||
|
re = pcre2_compile((PCRE2_SPTR)argv[3], PCRE2_ZERO_TERMINATED, pcre_options, &errcode, &erroffset, NULL);
|
||||||
|
if(!re) {
|
||||||
|
pl->freefunc(acl);
|
||||||
|
if(replace) pl->freefunc(replace);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
match_data = pcre2_match_data_create_from_pattern(re, NULL);
|
||||||
|
if(!match_data) {
|
||||||
|
pcre2_code_free(re);
|
||||||
|
pl->freefunc(acl);
|
||||||
|
if(replace) pl->freefunc(replace);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flt = pl->mallocfunc(sizeof(struct pcre_filter_data));
|
||||||
|
newf = pl->mallocfunc(sizeof(struct filter));
|
||||||
|
|
||||||
|
if(!flt || !newf) {
|
||||||
|
if(match_data) pcre2_match_data_free(match_data);
|
||||||
|
if(re) pcre2_code_free(re);
|
||||||
|
pl->freefunc(acl);
|
||||||
|
if(replace) pl->freefunc(replace);
|
||||||
|
if(flt) pl->freefunc(flt);
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
memset(flt, 0, sizeof(struct pcre_filter_data));
|
||||||
|
memset(newf, 0, sizeof(struct filter));
|
||||||
|
flt->action = action;
|
||||||
|
flt->re = re;
|
||||||
|
flt->match_data = match_data;
|
||||||
flt->acl = acl;
|
flt->acl = acl;
|
||||||
flt->replace = replace;
|
flt->replace = replace;
|
||||||
flt->users = 1;
|
flt->users = 1;
|
||||||
@ -342,14 +492,14 @@ static int h_pcre_options(int argc, unsigned char **argv){
|
|||||||
|
|
||||||
static struct commands pcre_commandhandlers[] = {
|
static struct commands pcre_commandhandlers[] = {
|
||||||
{pcre_commandhandlers+1, "pcre", h_pcre, 4, 0},
|
{pcre_commandhandlers+1, "pcre", h_pcre, 4, 0},
|
||||||
{pcre_commandhandlers+2, "pcre_rewrite", h_pcre, 5, 0},
|
{pcre_commandhandlers+2, "pcre_rewrite", h_pcre_rewrite, 5, 0},
|
||||||
{pcre_commandhandlers+3, "pcre_extend", h_pcre_extend, 2, 0},
|
{pcre_commandhandlers+3, "pcre_extend", h_pcre_extend, 2, 0},
|
||||||
{NULL, "pcre_options", h_pcre_options, 2, 0}
|
{NULL, "pcre_options", h_pcre_options, 2, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct symbol regexp_symbols[] = {
|
static struct symbol regexp_symbols[] = {
|
||||||
{regexp_symbols+1, "pcre_compile", (void*) pcre_compile},
|
{regexp_symbols+1, "pcre2_compile", (void*) pcre2_compile},
|
||||||
{regexp_symbols+2, "pcre_exec", (void*) pcre_exec},
|
{regexp_symbols+2, "pcre2_match", (void*) pcre2_match},
|
||||||
{NULL, "pcre_options", (void *)&pcre_options},
|
{NULL, "pcre_options", (void *)&pcre_options},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -366,8 +516,6 @@ PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
|
|||||||
pl = pluginlink;
|
pl = pluginlink;
|
||||||
pcre_options = 0;
|
pcre_options = 0;
|
||||||
if(!pcre_loaded){
|
if(!pcre_loaded){
|
||||||
pcre_malloc = pl->mallocfunc;
|
|
||||||
pcre_free = pl->freefunc;
|
|
||||||
pcre_loaded = 1;
|
pcre_loaded = 1;
|
||||||
pthread_mutex_init(&pcre_mutex, NULL);
|
pthread_mutex_init(&pcre_mutex, NULL);
|
||||||
regexp_symbols[2].next = pl->symbols.next;
|
regexp_symbols[2].next = pl->symbols.next;
|
||||||
|
|||||||
19
src/plugins/PamAuth/CMakeLists.txt
Normal file
19
src/plugins/PamAuth/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# PamAuth - requires PAM
|
||||||
|
|
||||||
|
if(NOT PAM_FOUND)
|
||||||
|
message(STATUS "PamAuth requires PAM, skipping")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_3proxy_plugin(PamAuth
|
||||||
|
SOURCES pamauth.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TARGET PAM::PAM)
|
||||||
|
target_link_libraries(PamAuth PRIVATE PAM::PAM)
|
||||||
|
else()
|
||||||
|
target_link_libraries(PamAuth PRIVATE ${PAM_LIBRARIES})
|
||||||
|
if(PAM_INCLUDE_DIRS)
|
||||||
|
target_include_directories(PamAuth PRIVATE ${PAM_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
@ -5,3 +5,4 @@ pamauth$(OBJSUFFICS): pamauth.c
|
|||||||
|
|
||||||
$(BUILDDIR)pamauth$(DLSUFFICS): pamauth$(OBJSUFFICS)
|
$(BUILDDIR)pamauth$(DLSUFFICS): pamauth$(OBJSUFFICS)
|
||||||
$(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)pam$(LIBSSUFFIX) pamauth$(OBJSUFFICS)
|
$(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)pam$(LIBSSUFFIX) pamauth$(OBJSUFFICS)
|
||||||
|
|
||||||
|
|||||||
@ -92,7 +92,7 @@ static int pamfunc(struct clientparam *param)
|
|||||||
pthread_mutex_lock(&pam_mutex);
|
pthread_mutex_lock(&pam_mutex);
|
||||||
if (!pamh)
|
if (!pamh)
|
||||||
{
|
{
|
||||||
retval = pam_start ((char *)service, "3proxy@" , &conv, &pamh);
|
retval = pam_start ((char *)service, (char *)param->username, &conv, &pamh);
|
||||||
}
|
}
|
||||||
if (retval == PAM_SUCCESS)
|
if (retval == PAM_SUCCESS)
|
||||||
retval = pam_set_item (pamh, PAM_USER, param->username);
|
retval = pam_set_item (pamh, PAM_USER, param->username);
|
||||||
@ -102,6 +102,8 @@ static int pamfunc(struct clientparam *param)
|
|||||||
/*fprintf(stderr,"pam_set_item2 rc=%d\n",retval); */
|
/*fprintf(stderr,"pam_set_item2 rc=%d\n",retval); */
|
||||||
if (retval == PAM_SUCCESS)
|
if (retval == PAM_SUCCESS)
|
||||||
retval = pam_authenticate (pamh, 0);
|
retval = pam_authenticate (pamh, 0);
|
||||||
|
if (retval == PAM_SUCCESS)
|
||||||
|
retval = pam_acct_mgmt (pamh, 0);
|
||||||
/*fprintf(stderr,"pam_authenticate rc=%d\n",retval);*/
|
/*fprintf(stderr,"pam_authenticate rc=%d\n",retval);*/
|
||||||
|
|
||||||
if (retval == PAM_SUCCESS) { /*auth OK*/ rc=0; }
|
if (retval == PAM_SUCCESS) { /*auth OK*/ rc=0; }
|
||||||
|
|||||||
17
src/plugins/SSLPlugin/CMakeLists.txt
Normal file
17
src/plugins/SSLPlugin/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# SSLPlugin - requires OpenSSL
|
||||||
|
|
||||||
|
if(NOT TARGET OpenSSL::SSL)
|
||||||
|
message(STATUS "SSLPlugin requires OpenSSL, skipping")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_3proxy_plugin(SSLPlugin
|
||||||
|
SOURCES
|
||||||
|
ssl_plugin.c
|
||||||
|
my_ssl.c
|
||||||
|
LIBRARIES
|
||||||
|
OpenSSL::SSL
|
||||||
|
OpenSSL::Crypto
|
||||||
|
COMPILE_DEFINITIONS
|
||||||
|
WITH_SSL
|
||||||
|
)
|
||||||
4
src/plugins/StringsPlugin/CMakeLists.txt
Normal file
4
src/plugins/StringsPlugin/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# StringsPlugin
|
||||||
|
add_3proxy_plugin(StringsPlugin
|
||||||
|
SOURCES StringsPlugin.c
|
||||||
|
)
|
||||||
4
src/plugins/TrafficPlugin/CMakeLists.txt
Normal file
4
src/plugins/TrafficPlugin/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# TrafficPlugin
|
||||||
|
add_3proxy_plugin(TrafficPlugin
|
||||||
|
SOURCES TrafficPlugin.c
|
||||||
|
)
|
||||||
6
src/plugins/TransparentPlugin/CMakeLists.txt
Normal file
6
src/plugins/TransparentPlugin/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# TransparentPlugin
|
||||||
|
# Works on Linux (with netfilter), BSD and macOS (without netfilter support)
|
||||||
|
|
||||||
|
add_3proxy_plugin(TransparentPlugin
|
||||||
|
SOURCES transparent_plugin.c
|
||||||
|
)
|
||||||
10
src/plugins/WindowsAuthentication/CMakeLists.txt
Normal file
10
src/plugins/WindowsAuthentication/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# WindowsAuthentication
|
||||||
|
if(NOT WIN32)
|
||||||
|
message(STATUS "WindowsAuthentication requires Windows, skipping")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_3proxy_plugin(WindowsAuthentication
|
||||||
|
SOURCES WindowsAuthentication.c
|
||||||
|
LIBRARIES advapi32
|
||||||
|
)
|
||||||
4
src/plugins/utf8tocp1251/CMakeLists.txt
Normal file
4
src/plugins/utf8tocp1251/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# utf8tocp1251
|
||||||
|
add_3proxy_plugin(utf8tocp1251
|
||||||
|
SOURCES utf8tocp1251.c
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue
Block a user