From 5fdd4a4d6f60b771d5742d58e1d6fcd516302c12 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Fri, 8 May 2026 20:30:14 +0300 Subject: [PATCH] NOODBC inverted to WITH_ODBC --- CMakeLists.txt | 6 +++--- Makefile.FreeBSD | 4 ++-- Makefile.Linux | 4 ++-- Makefile.Solaris | 4 ++-- Makefile.msvc | 3 ++- Makefile.unix | 4 ++-- Makefile.watcom | 2 +- Makefile.win | 5 ++--- src/3proxy.c | 2 +- src/conf.c | 2 +- src/datatypes.c | 2 +- src/plugins/PamAuth/pamauth.c | 2 +- src/proxy.h | 2 +- src/sql.c | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3677933..193f147 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,9 +300,9 @@ if(WIN32 OR 3PROXY_USE_ODBC) endif() endif() -# Set NOODBC if ODBC is not found -if(NOT ODBC_FOUND) - add_compile_definitions(NOODBC) +# Define WITH_ODBC when ODBC is available +if(ODBC_FOUND) + add_compile_definitions(WITH_ODBC) endif() # Set NORADIUS if OpenSSL is not available (RADIUS requires MD5 from OpenSSL) diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index 4468d38..034286e 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -1,7 +1,7 @@ # # 3 proxy Makefile for GCC/Unix # -# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC +# add -DWITH_ODBC to CFLAGS and -lodbc to LDFLAGS to compile with ODBC # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ @@ -11,7 +11,7 @@ MANDIR ?= /usr/share/man CC ?= cc CFLAGS ?= -O3 -flto -CFLAGS += -c -fno-strict-aliasing -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_UN +CFLAGS += -c -fno-strict-aliasing -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_UN COUT = -o LN ?= ${CC} LDFLAGS ?= -flto diff --git a/Makefile.Linux b/Makefile.Linux index 08bc41f..f4d6cd0 100644 --- a/Makefile.Linux +++ b/Makefile.Linux @@ -1,7 +1,7 @@ # # 3 proxy Makefile for GCC/Linux/Cygwin # -# remove -DNOODBC from CFLAGS and add -lodbc to LIBS to compile with ODBC +# add -DWITH_ODBC to CFLAGS and -lodbc to LIBS to compile with ODBC # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ @@ -10,7 +10,7 @@ CRYPT_PREFIX ?= $(PREFIX) CC ?= gcc CFLAGS ?= -O3 -flto -CFLAGS += -fPIC -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -D WITH_UN +CFLAGS += -fPIC -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -D WITH_UN COUT = -o LN ?= ${CC} DCFLAGS ?= diff --git a/Makefile.Solaris b/Makefile.Solaris index c58b072..1b73953 100644 --- a/Makefile.Solaris +++ b/Makefile.Solaris @@ -2,12 +2,12 @@ # 3 proxy Makefile for Solaris/SunCC # # -# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC +# add -DWITH_ODBC to CFLAGS and -lodbc to LDFLAGS to compile with ODBC # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ CC ?= cc -CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL +CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL COUT = -o ./ LN = $(CC) LDFLAGS = -xO3 diff --git a/Makefile.msvc b/Makefile.msvc index 031af74..aad015b 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -2,13 +2,14 @@ # 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake) # # +# ODBC support is enabled by default on Windows (/D WITH_ODBC, odbc32.lib) # Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver 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 "WITH_PCRE" /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 "WITH_ODBC" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION) COUT = /Fo LN = link LDFLAGS = /nologo /subsystem:console /incremental:no diff --git a/Makefile.unix b/Makefile.unix index b86f1aa..0cdf976 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -2,7 +2,7 @@ # 3 proxy Makefile for GCC/Unix # # -# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC +# add -DWITH_ODBC to CFLAGS and -lodbc to LDFLAGS to compile with ODBC # library support. Add -DSAFESQL for poorely written ODBC library / drivers. BUILDDIR = ../bin/ @@ -13,7 +13,7 @@ CC ?= gcc # you may need -L/usr/pkg/lib for older NetBSD versions CFLAGS ?= -O3 -flto -CFLAGS += -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_UN +CFLAGS += -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_UN COUT = -o LN ?= $(CC) LDFLAGS ?= -flto diff --git a/Makefile.watcom b/Makefile.watcom index ee6908c..1a6cb62 100644 --- a/Makefile.watcom +++ b/Makefile.watcom @@ -6,7 +6,7 @@ BUILDDIR = ../bin/ CC = cl -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 "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "SCNx64=\"I64x\"" /D "SCNd64=\"I64d\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE) +CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "SCNx64=\"I64x\"" /D "SCNd64=\"I64d\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE) COUT = /Fo LN = link LDFLAGS = /nologo /subsystem:console /incremental:no diff --git a/Makefile.win b/Makefile.win index 6376c80..46e2938 100644 --- a/Makefile.win +++ b/Makefile.win @@ -2,14 +2,13 @@ # 3 proxy Makefile for GCC/windows # # -# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC -# library support +# ODBC support is enabled by default on Windows (-DWITH_ODBC, -lodbc32) BUILDDIR = ../bin/ CC ?= gcc CFLAGS ?= -O3 -flto -fno-strict-aliasing -CFLAGS += -c -mthreads -DWITH_WSAPOLL +CFLAGS += -c -mthreads -DWITH_WSAPOLL -DWITH_ODBC COUT = -o LN ?= $(CC) LDFLAGS ?= -flto -fno-strict-aliasing diff --git a/src/3proxy.c b/src/3proxy.c index b594254..1e4544f 100644 --- a/src/3proxy.c +++ b/src/3proxy.c @@ -71,7 +71,7 @@ void __stdcall CommandHandler( DWORD dwCommand ) conf.paused++; Sleep(2000); SetStatus( SERVICE_STOPPED, 0, 0 ); -#ifndef NOODBC +#ifdef WITH_ODBC _3proxy_mutex_lock(&log_mutex); close_sql(); _3proxy_mutex_unlock(&log_mutex); diff --git a/src/conf.c b/src/conf.c index 7a8359d..7c88530 100644 --- a/src/conf.c +++ b/src/conf.c @@ -334,7 +334,7 @@ static int h_log(int argc, unsigned char ** argv){ openlog((char *)conf.logtarget+1, LOG_PID, LOG_DAEMON); #endif } -#ifndef NOODBC +#ifdef WITH_ODBC else if(*argv[1]=='&'){ conf.logfunc = logsql; if(notchanged) return 0; diff --git a/src/datatypes.c b/src/datatypes.c index ae112c8..da5ef7c 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -561,7 +561,7 @@ static void * ef_server_log(struct node * node){ #ifndef _WIN32 else if(((struct srvparam *)node->value) -> logfunc == logsyslog) return "syslog"; #endif -#ifndef NOODBC +#ifdef WITH_ODBC else if(((struct srvparam *)node->value) -> logfunc == logsql) return "odbc"; #endif return NULL; diff --git a/src/plugins/PamAuth/pamauth.c b/src/plugins/PamAuth/pamauth.c index 160ae3a..d4f3791 100644 --- a/src/plugins/PamAuth/pamauth.c +++ b/src/plugins/PamAuth/pamauth.c @@ -1,7 +1,7 @@ /* plugin for 3proxy with PAM auth only for *NIX (linux,*bsd) Kirill Lopuchov - Compile with: gcc -shared -o pamauth.so pamauth.c -lpam -DNOODBC + Compile with: gcc -shared -o pamauth.so pamauth.c -lpam */ #include "../../structures.h" diff --git a/src/proxy.h b/src/proxy.h index 4974156..2afbaa9 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -112,7 +112,7 @@ void daemonize(void); #endif #endif -#ifndef NOODBC +#ifdef WITH_ODBC #ifndef _WIN32 #include #endif diff --git a/src/sql.c b/src/sql.c index f3816a6..9862fa8 100644 --- a/src/sql.c +++ b/src/sql.c @@ -1,5 +1,5 @@ #include "proxy.h" -#ifndef NOODBC +#ifdef WITH_ODBC SQLHENV henv = NULL; SQLHSTMT hstmt = NULL;