mirror of
https://github.com/3proxy/3proxy.git
synced 2026-05-01 00:10:11 +08:00
Move pcre code to 3proxy
Some checks are pending
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
Some checks are pending
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
This commit is contained in:
parent
8b08f39438
commit
043f0dd8ab
@ -267,9 +267,10 @@ set(PCRE2_FOUND FALSE)
|
||||
if(3PROXY_USE_PCRE2)
|
||||
find_package(PCRE2 QUIET)
|
||||
if(PCRE2_FOUND)
|
||||
add_compile_definitions(WITH_PCRE)
|
||||
message(STATUS "PCRE2 found: ${PCRE2_VERSION}")
|
||||
else()
|
||||
message(STATUS "PCRE2 not found, PCREPlugin will not be built")
|
||||
message(STATUS "PCRE2 not found, PCRE support will not be built")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -410,6 +411,10 @@ if(OpenSSL_FOUND)
|
||||
target_sources(3proxy PRIVATE src/ssllib.c src/ssl.c)
|
||||
endif()
|
||||
|
||||
if(PCRE2_FOUND)
|
||||
target_sources(3proxy PRIVATE src/pcre.c)
|
||||
endif()
|
||||
|
||||
target_include_directories(3proxy PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
||||
@ -417,6 +422,9 @@ target_include_directories(3proxy PRIVATE
|
||||
if(OpenSSL_FOUND)
|
||||
target_include_directories(3proxy PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
if(PCRE2_FOUND)
|
||||
target_include_directories(3proxy PRIVATE ${PCRE2_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(3proxy PRIVATE Threads::Threads)
|
||||
|
||||
@ -432,6 +440,38 @@ if(OpenSSL_FOUND)
|
||||
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||
endif()
|
||||
|
||||
# PCRE2 linking (static on Linux/FreeBSD, dynamic on other platforms)
|
||||
if(PCRE2_FOUND)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
|
||||
CMAKE_SYSTEM_NAME MATCHES "FreeBSD|OpenBSD|NetBSD" OR
|
||||
CMAKE_SYSTEM_NAME STREQUAL "Unix")
|
||||
# Static linking for Linux/BSD
|
||||
find_library(PCRE2_STATIC_LIB
|
||||
NAMES pcre2-8 libpcre2-8.a pcre2-8.a
|
||||
PATHS ${PC_PCRE2_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/lib
|
||||
)
|
||||
if(PCRE2_STATIC_LIB)
|
||||
target_link_libraries(3proxy PRIVATE
|
||||
-Wl,-Bstatic
|
||||
${PCRE2_STATIC_LIB}
|
||||
-Wl,-Bdynamic
|
||||
)
|
||||
message(STATUS "Using static PCRE2: ${PCRE2_STATIC_LIB}")
|
||||
elseif(TARGET PCRE2::PCRE2)
|
||||
target_link_libraries(3proxy PRIVATE PCRE2::PCRE2)
|
||||
else()
|
||||
target_link_libraries(3proxy PRIVATE ${PCRE2_LIBRARIES})
|
||||
endif()
|
||||
elseif(TARGET PCRE2::PCRE2)
|
||||
target_link_libraries(3proxy PRIVATE PCRE2::PCRE2)
|
||||
else()
|
||||
target_link_libraries(3proxy PRIVATE ${PCRE2_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(3proxy PRIVATE ${WINDOWS_LIBS})
|
||||
if(COMPILER_IS_MSVC AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3proxy.rc)
|
||||
@ -542,19 +582,12 @@ foreach(PLUGIN ${DEFAULT_PLUGINS})
|
||||
add_subdirectory(src/plugins/${PLUGIN})
|
||||
endforeach()
|
||||
|
||||
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(PCRE2_FOUND)
|
||||
list(APPEND ALL_PLUGINS PCREPlugin)
|
||||
endif()
|
||||
if(PAM_FOUND)
|
||||
list(APPEND ALL_PLUGINS PamAuth)
|
||||
endif()
|
||||
|
||||
@ -41,7 +41,8 @@ ifeq ($(OPENSSL_CHECK), true)
|
||||
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) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||
ifeq ($(PCRE_CHECK), true)
|
||||
PLUGINS += PCREPlugin
|
||||
CFLAGS += -DWITH_PCRE
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
PCRE_LIBS = -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic
|
||||
endif
|
||||
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
||||
|
||||
@ -43,7 +43,8 @@ ifeq ($(OPENSSL_CHECK), true)
|
||||
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) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||
ifeq ($(PCRE_CHECK), true)
|
||||
PLUGINS += PCREPlugin
|
||||
CFLAGS += -DWITH_PCRE
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
PCRE_LIBS = -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic
|
||||
endif
|
||||
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
||||
|
||||
@ -37,7 +37,8 @@ ifeq ($(OPENSSL_CHECK), true)
|
||||
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) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||
ifeq ($(PCRE_CHECK), true)
|
||||
PLUGINS += PCREPlugin
|
||||
CFLAGS += -DWITH_PCRE
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
PCRE_LIBS = -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic
|
||||
endif
|
||||
|
||||
|
||||
@ -8,13 +8,13 @@ BUILDDIR = ../bin/
|
||||
CC = cl
|
||||
VERSION = $(VERSION)
|
||||
BUILDDATE = $(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" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION)
|
||||
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "WITH_PCRE" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION)
|
||||
COUT = /Fo
|
||||
LN = link
|
||||
LDFLAGS = /nologo /subsystem:console /incremental:no
|
||||
DLFLAGS = /DLL
|
||||
DLSUFFICS = .dll
|
||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib libcrypto.lib libssl.lib
|
||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib libcrypto.lib libssl.lib pcre2-8.lib
|
||||
LIBSPREFIX =
|
||||
LIBSSUFFIX = .lib
|
||||
LIBEXT = .lib
|
||||
@ -27,9 +27,9 @@ REMOVECOMMAND = del
|
||||
TYPECOMMAND = type
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.msvc
|
||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin PCREPlugin
|
||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin
|
||||
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||
PCRE_LIBS = pcre2-8.lib
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
VERFILE = 3proxy.res $(VERFILE)
|
||||
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
||||
AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err)
|
||||
|
||||
@ -43,7 +43,8 @@ ifeq ($(OPENSSL_CHECK), true)
|
||||
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) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||
ifeq ($(PCRE_CHECK), true)
|
||||
PLUGINS += PCREPlugin
|
||||
CFLAGS += -DWITH_PCRE
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
PCRE_LIBS = -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic
|
||||
endif
|
||||
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
||||
|
||||
@ -27,7 +27,8 @@ TYPECOMMAND = type
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.watcom
|
||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin
|
||||
PCRE_LIBS = pcre2-8.lib
|
||||
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
VERFILE = $(VERFILE)
|
||||
VERSION = $(VERSION)
|
||||
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
||||
|
||||
@ -46,7 +46,8 @@ ifeq ($(PAM_CHECK), true)
|
||||
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
|
||||
CFLAGS += -DWITH_PCRE
|
||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||
PCRE_LIBS = -lpcre2-8
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -10,6 +10,9 @@
|
||||
#ifdef WITH_SSL
|
||||
void ssl_install(void);
|
||||
#endif
|
||||
#ifdef WITH_PCRE
|
||||
void pcre_install(void);
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#include <sys/resource.h>
|
||||
#ifndef NOPLUGINS
|
||||
@ -529,6 +532,9 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
||||
#ifdef WITH_SSL
|
||||
ssl_install();
|
||||
#endif
|
||||
#ifdef WITH_PCRE
|
||||
pcre_install();
|
||||
#endif
|
||||
|
||||
freeconf(&conf);
|
||||
res = readconfig(fp);
|
||||
|
||||
@ -167,6 +167,9 @@ ssllib$(OBJSUFFICS): ssllib.c
|
||||
ssl$(OBJSUFFICS): ssl.c
|
||||
$(CC) $(COUT)ssl$(OBJSUFFICS) $(CFLAGS) ssl.c
|
||||
|
||||
$(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) log$(OBJSUFFICS) datatypes$(OBJSUFFICS) blake2$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(SSL_OBJS) $(COMPATLIBS) $(VERSIONDEP)
|
||||
$(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) blake2$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(SSL_OBJS) $(COMPATLIBS) $(LIBS)
|
||||
pcre$(OBJSUFFICS): pcre.c
|
||||
$(CC) $(COUT)pcre$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITH_PCRE pcre.c
|
||||
|
||||
$(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) log$(OBJSUFFICS) datatypes$(OBJSUFFICS) blake2$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(SSL_OBJS) $(PCRE_OBJS) $(COMPATLIBS) $(VERSIONDEP)
|
||||
$(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) blake2$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(SSL_OBJS) $(PCRE_OBJS) $(COMPATLIBS) $(LIBS) $(PCRE_LIBS)
|
||||
|
||||
|
||||
11
src/conf.c
11
src/conf.c
@ -10,6 +10,9 @@
|
||||
#ifdef WITH_SSL
|
||||
void ssl_install(void);
|
||||
#endif
|
||||
#ifdef WITH_PCRE
|
||||
void pcre_install(void);
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#include <sys/resource.h>
|
||||
#include <pwd.h>
|
||||
@ -1457,6 +1460,11 @@ static int h_plugin(int argc, unsigned char **argv){
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef WITH_PCRE
|
||||
if(argc >= 3 && !strcmp((char *)argv[2], "pcre_plugin")){
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef NOPLUGINS
|
||||
return 999;
|
||||
#else
|
||||
@ -1960,6 +1968,9 @@ int reload (void){
|
||||
_3proxy_mutex_lock(&config_mutex);
|
||||
#ifdef WITH_SSL
|
||||
ssl_install();
|
||||
#endif
|
||||
#ifdef WITH_PCRE
|
||||
pcre_install();
|
||||
#endif
|
||||
conf.paused++;
|
||||
freeconf(&conf);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "../../structures.h"
|
||||
#include "structures.h"
|
||||
#include <string.h>
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#define PCRE2_STATIC
|
||||
@ -261,7 +261,7 @@ static int h_pcre(int argc, unsigned char **argv){
|
||||
PCRE2_SIZE erroffset;
|
||||
struct pcre_filter_data *flt;
|
||||
struct filter *newf;
|
||||
char *replace = NULL;
|
||||
char * replace = NULL;
|
||||
|
||||
if(!strncmp((char *)argv[2], "allow",5)) action = PASS;
|
||||
else if(!strncmp((char *)argv[2], "deny",4)) action = REJECT;
|
||||
@ -368,7 +368,7 @@ static int h_pcre_rewrite(int argc, unsigned char **argv){
|
||||
PCRE2_SIZE erroffset;
|
||||
struct pcre_filter_data *flt;
|
||||
struct filter *newf;
|
||||
char *replace = NULL;
|
||||
char * replace = NULL;
|
||||
|
||||
if(!strncmp((char *)argv[2], "allow",5)) action = PASS;
|
||||
else if(!strncmp((char *)argv[2], "deny",4)) action = REJECT;
|
||||
@ -503,17 +503,11 @@ static struct symbol regexp_symbols[] = {
|
||||
{NULL, "pcre_options", (void *)&pcre_options},
|
||||
};
|
||||
|
||||
#ifdef WATCOM
|
||||
#pragma aux pcre_plugin "*" parm caller [ ] value struct float struct routine [eax] modify [eax ecx edx]
|
||||
#undef PLUGINCALL
|
||||
#define PLUGINCALL
|
||||
#endif
|
||||
|
||||
PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
|
||||
int argc, char** argv){
|
||||
void pcre_install(void){
|
||||
|
||||
struct filter *flt, *tmpflt;
|
||||
pl = pluginlink;
|
||||
pl = &pluginlink;
|
||||
pcre_options = 0;
|
||||
if(!pcre_loaded){
|
||||
pcre_loaded = 1;
|
||||
@ -537,9 +531,8 @@ PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
|
||||
}
|
||||
}
|
||||
pcre_last_filter = NULL;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
6
src/pcre.h
Normal file
6
src/pcre.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef __pcre_h__
|
||||
#define __pcre_h__
|
||||
|
||||
void pcre_install(void);
|
||||
|
||||
#endif /* __pcre_h__ */
|
||||
@ -1,56 +0,0 @@
|
||||
# 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
|
||||
)
|
||||
|
||||
# Helper function to link PCRE2 with static linking on Linux/FreeBSD
|
||||
function(link_pcre2_static TARGET_NAME)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
|
||||
CMAKE_SYSTEM_NAME MATCHES "FreeBSD|OpenBSD|NetBSD" OR
|
||||
CMAKE_SYSTEM_NAME STREQUAL "Unix")
|
||||
# Try to find static PCRE2 library
|
||||
find_library(PCRE2_STATIC_LIBRARY
|
||||
NAMES pcre2-8 libpcre2-8.a pcre2-8.a
|
||||
PATHS ${PC_PCRE2_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/lib
|
||||
)
|
||||
if(PCRE2_STATIC_LIBRARY)
|
||||
# Use static linking with GNU ld
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
-Wl,-Bstatic
|
||||
${PCRE2_STATIC_LIBRARY}
|
||||
-Wl,-Bdynamic
|
||||
)
|
||||
message(STATUS "Using static PCRE2: ${PCRE2_STATIC_LIBRARY}")
|
||||
else()
|
||||
# Fallback to dynamic linking if static library not found
|
||||
if(TARGET PCRE2::PCRE2)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE PCRE2::PCRE2)
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${PCRE2_LIBRARIES})
|
||||
endif()
|
||||
message(STATUS "Static PCRE2 not found, using dynamic linking")
|
||||
endif()
|
||||
else()
|
||||
# Other platforms (macOS, Windows) - use standard linking
|
||||
if(TARGET PCRE2::PCRE2)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE PCRE2::PCRE2)
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${PCRE2_LIBRARIES})
|
||||
if(PCRE2_INCLUDE_DIRS)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${PCRE2_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
link_pcre2_static(PCREPlugin)
|
||||
@ -1 +0,0 @@
|
||||
include Makefile.var
|
||||
@ -1,8 +0,0 @@
|
||||
all: $(BUILDDIR)PCREPlugin$(DLSUFFICS)
|
||||
|
||||
pcre_plugin$(OBJSUFFICS): pcre_plugin.c
|
||||
$(CC) $(DCFLAGS) $(CFLAGS) pcre_plugin.c
|
||||
|
||||
$(BUILDDIR)PCREPlugin$(DLSUFFICS): pcre_plugin$(OBJSUFFICS)
|
||||
$(LN) $(LNOUT)../../$(BUILDDIR)PCREPlugin$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) pcre_plugin$(OBJSUFFICS) $(PCRE_LIBS)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user