Compare commits

...

11 Commits

Author SHA1 Message Date
Vladimir Dubrovin
aaa04116a8 Fix issues with -s
Some checks failed
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
2026-05-08 20:43:02 +03:00
Vladimir Dubrovin
5fdd4a4d6f NOODBC inverted to WITH_ODBC 2026-05-08 20:30:14 +03:00
Vladimir Dubrovin
7871279fae Support namespaces for UDP in socks 2026-05-08 20:21:04 +03:00
Vladimir Dubrovin
ff15a8d480 Update copyright 2026-05-08 19:25:33 +03:00
Vladimir Dubrovin
95029e9e41 Use blake2 hashsize 2026-05-08 19:14:28 +03:00
Vladimir Dubrovin
6286bfcd6e Fix crypt passwords 2026-05-08 19:00:14 +03:00
Vladimir Dubrovin
b1d21cbdca Copyright update 2026-05-08 18:07:08 +03:00
Vladimir Dubrovin
978f351560 Add compatiblity with older SSL versions 2026-05-08 17:16:47 +03:00
Vladimir Dubrovin
41d1fa8b00 Do not use OSSL_LIB_CTX 2026-05-08 17:03:00 +03:00
Vladimir Dubrovin
8c638fcaff Revert usage of OpenSSL blake2 implementation 2026-05-08 16:45:44 +03:00
Vladimir Dubrovin
6963af7614 Do not use OSSL_PARAM_DIGEST_SIZE for blake2 in openssl 2026-05-08 16:14:09 +03:00
65 changed files with 228 additions and 274 deletions

View File

@ -300,9 +300,9 @@ if(WIN32 OR 3PROXY_USE_ODBC)
endif() endif()
endif() endif()
# Set NOODBC if ODBC is not found # Define WITH_ODBC when ODBC is available
if(NOT ODBC_FOUND) if(ODBC_FOUND)
add_compile_definitions(NOODBC) add_compile_definitions(WITH_ODBC)
endif() endif()
# Set NORADIUS if OpenSSL is not available (RADIUS requires MD5 from OpenSSL) # Set NORADIUS if OpenSSL is not available (RADIUS requires MD5 from OpenSSL)
@ -414,9 +414,7 @@ add_executable(3proxy
$<TARGET_OBJECTS:ftp_obj> $<TARGET_OBJECTS:ftp_obj>
$<TARGET_OBJECTS:3proxy_crypt_obj> $<TARGET_OBJECTS:3proxy_crypt_obj>
) )
if(NOT OpenSSL_FOUND) target_sources(3proxy PRIVATE ${MD_SOURCES})
target_sources(3proxy PRIVATE ${MD_SOURCES})
endif()
if(OpenSSL_FOUND) if(OpenSSL_FOUND)
target_sources(3proxy PRIVATE src/ssllib.c src/ssl.c) target_sources(3proxy PRIVATE src/ssllib.c src/ssl.c)
@ -523,9 +521,7 @@ add_executable(3proxy_crypt
src/3proxy_crypt.c src/3proxy_crypt.c
$<TARGET_OBJECTS:base64_obj> $<TARGET_OBJECTS:base64_obj>
) )
if(NOT OpenSSL_FOUND) target_sources(3proxy_crypt PRIVATE ${MD_SOURCES})
target_sources(3proxy_crypt PRIVATE ${MD_SOURCES})
endif()
target_compile_definitions(3proxy_crypt PRIVATE WITHMAIN) target_compile_definitions(3proxy_crypt PRIVATE WITHMAIN)
target_include_directories(3proxy_crypt PRIVATE target_include_directories(3proxy_crypt PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src

View File

@ -1,7 +1,7 @@
# #
# 3 proxy Makefile for GCC/Unix # 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. # library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR = ../bin/ BUILDDIR = ../bin/
@ -11,7 +11,7 @@ MANDIR ?= /usr/share/man
CC ?= cc CC ?= cc
CFLAGS ?= -O3 -flto 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 COUT = -o
LN ?= ${CC} LN ?= ${CC}
LDFLAGS ?= -flto LDFLAGS ?= -flto

View File

@ -1,7 +1,7 @@
# #
# 3 proxy Makefile for GCC/Linux/Cygwin # 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. # library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR = ../bin/ BUILDDIR = ../bin/
@ -10,7 +10,7 @@ CRYPT_PREFIX ?= $(PREFIX)
CC ?= gcc CC ?= gcc
CFLAGS ?= -O3 -flto 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 COUT = -o
LN ?= ${CC} LN ?= ${CC}
DCFLAGS ?= DCFLAGS ?=

View File

@ -2,12 +2,12 @@
# 3 proxy Makefile for Solaris/SunCC # 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. # 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 -DFD_SETSIZE=4096 -DWITH_POLL CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o ./ COUT = -o ./
LN = $(CC) LN = $(CC)
LDFLAGS = -xO3 LDFLAGS = -xO3

View File

@ -2,13 +2,14 @@
# 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)
# #
# #
# 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 # Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = cl CC = cl
VERSION = $(VERSION) VERSION = $(VERSION)
BUILDDATE = $(BUILDDATE) 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 COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no LDFLAGS = /nologo /subsystem:console /incremental:no

View File

@ -2,7 +2,7 @@
# 3 proxy Makefile for GCC/Unix # 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. # library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR = ../bin/ BUILDDIR = ../bin/
@ -13,7 +13,7 @@ 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 ?= -O3 -flto 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 COUT = -o
LN ?= $(CC) LN ?= $(CC)
LDFLAGS ?= -flto LDFLAGS ?= -flto

View File

@ -6,7 +6,7 @@
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 "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 COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no LDFLAGS = /nologo /subsystem:console /incremental:no

View File

@ -2,14 +2,13 @@
# 3 proxy Makefile for GCC/windows # 3 proxy Makefile for GCC/windows
# #
# #
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC # ODBC support is enabled by default on Windows (-DWITH_ODBC, -lodbc32)
# library support
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC ?= gcc CC ?= gcc
CFLAGS ?= -O3 -flto -fno-strict-aliasing CFLAGS ?= -O3 -flto -fno-strict-aliasing
CFLAGS += -c -mthreads -DWITH_WSAPOLL CFLAGS += -c -mthreads -DWITH_WSAPOLL -DWITH_ODBC
COUT = -o COUT = -o
LN ?= $(CC) LN ?= $(CC)
LDFLAGS ?= -flto -fno-strict-aliasing LDFLAGS ?= -flto -fno-strict-aliasing

View File

@ -1,6 +1,6 @@
# 3APA3A 3proxy tiny proxy server # 3APA3A 3proxy tiny proxy server
(c) 2002-2025 by Vladimir '3APA3A' Dubrovin <3APA3A@security.nnov.ru> (c) 2002-2026 by Vladimir '3APA3A' Dubrovin <vlad@3proxy.org>
## Branches ## Branches

15
debian/copyright vendored
View File

@ -4,17 +4,10 @@ Upstream-Contact: 3proxy@3proxy.org
Source: https://3proxy.org/ Source: https://3proxy.org/
Files: * Files: *
Copyright: 2000-2020 3APA3A, Vladimir Dubrovin, 3proxy.org Copyright: 2000-2026 Vladimir Dubrovin <vlad@3proxy.org>
License: BSD-3-clause or Apache or GPL-2+ or LGPL-2+ License: BSD-3-clause or Apache or GPL-2+ or LGPL-2+
Files: src/libs/md*.* Files: src/libs/blake2*.*
Copyright: 1990,1991,1992 RSA Data Security, Inc Copyright: 2012, Samuel Neves <sneves@dei.uc.pt>
License: public-domain License: public-domain (CC0 1.0 Universal) or OpenSSL license or Apache 2.0
Files: src/libs/regex.*
Copyright: Henry Spencer
License: public-domain
Files: src/libs/smbdes.c
Copyright: Andrew Tridgell 1998
License: GPL-2+

View File

@ -1,4 +1,4 @@
.TH 3proxy "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH 3proxy "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B 3proxy .B 3proxy
\- 3[APA3A] tiny proxy server, or trivial proxy server, or free proxy \- 3[APA3A] tiny proxy server, or trivial proxy server, or free proxy
@ -144,8 +144,5 @@ Report all bugs to
kill(1), syslogd(8), kill(1), syslogd(8),
.br .br
https://3proxy.org/ https://3proxy.org/
.SH TRIVIA
3APA3A is pronounced as \`\`zaraza\'\'.
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH 3proxy.cfg "5" "January 2019" "3proxy 0.9" "Universal proxy server" .TH 3proxy.cfg "5" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B 3proxy.cfg .B 3proxy.cfg
3proxy configuration file 3proxy configuration file
@ -1359,8 +1359,5 @@ Report all bugs to
3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8),
.br .br
https://3proxy.org/ https://3proxy.org/
.SH TRIVIA
3APA3A is pronounced as \`\`zaraza\'\'.
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH 3proxy_crypt "8" "April 2026" "3proxy 0.9" "Universal proxy server" .TH 3proxy_crypt "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B 3proxy_crypt .B 3proxy_crypt
\- utility to generate encrypted passwords for 3proxy \- utility to generate encrypted passwords for 3proxy
@ -77,5 +77,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH ftppr "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH ftppr "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B ftppr .B ftppr
\- FTP proxy gateway service \- FTP proxy gateway service
@ -106,5 +106,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH pop3p "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH pop3p "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B pop3p .B pop3p
\- POP3 proxy gateway service \- POP3 proxy gateway service
@ -102,5 +102,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH proxy "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH proxy "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B proxy .B proxy
\- HTTP proxy gateway service \- HTTP proxy gateway service
@ -97,5 +97,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH smtpp "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH smtpp "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B smtpp .B smtpp
\- SMTP proxy gateway service \- SMTP proxy gateway service
@ -103,5 +103,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH socks "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH socks "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B socks .B socks
\- SOCKS 4/4.5/5 gateway service \- SOCKS 4/4.5/5 gateway service
@ -111,5 +111,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH tcppm "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH tcppm "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B tcppm .B tcppm
\- TCP port mapper \- TCP port mapper
@ -100,5 +100,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH tlspr "8" "May 2024" "3proxy 0.9" "Universal proxy server" .TH tlspr "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B tlspr .B tlspr
\- SNI proxy gateway service \- SNI proxy gateway service
@ -104,5 +104,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,4 +1,4 @@
.TH udppm "8" "January 2019" "3proxy 0.9" "Universal proxy server" .TH udppm "8" "May 2026" "3proxy 0.9" "Universal proxy server"
.SH NAME .SH NAME
.B udppm .B udppm
\- UDP port mapper \- UDP port mapper
@ -93,5 +93,4 @@ Report all bugs to
.br .br
https://3proxy.org/ https://3proxy.org/
.SH AUTHORS .SH AUTHORS
3proxy is designed by Vladimir 3APA3A Dubrovin 3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
.RI ( 3proxy@3proxy.org )

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -71,7 +71,7 @@ void __stdcall CommandHandler( DWORD dwCommand )
conf.paused++; conf.paused++;
Sleep(2000); Sleep(2000);
SetStatus( SERVICE_STOPPED, 0, 0 ); SetStatus( SERVICE_STOPPED, 0, 0 );
#ifndef NOODBC #ifdef WITH_ODBC
_3proxy_mutex_lock(&log_mutex); _3proxy_mutex_lock(&log_mutex);
close_sql(); close_sql();
_3proxy_mutex_unlock(&log_mutex); _3proxy_mutex_unlock(&log_mutex);

View File

@ -1,11 +1,11 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
*/ */
#include "blake2_compat.h" #include "libs/blake2.h"
#ifdef WITH_SSL #ifdef WITH_SSL
#include <openssl/evp.h> #include <openssl/evp.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L #if OPENSSL_VERSION_NUMBER >= 0x30000000L
@ -28,53 +28,11 @@ static unsigned char itoa64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
#if defined(WITH_SSL) #if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_MD *md4_hash = NULL; EVP_MD *md4_hash = NULL;
EVP_MD *md5_hash = NULL; EVP_MD *md5_hash = NULL;
#endif #endif
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x10100000L
int blake2b_init_3p(blake2b_state *S, size_t outlen) {
*S = EVP_MD_CTX_new();
if (!*S) return -1;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
size_t sz = outlen;
OSSL_PARAM params[2];
params[0] = OSSL_PARAM_construct_size_t(OSSL_DIGEST_PARAM_SIZE, &sz);
params[1] = OSSL_PARAM_construct_end();
if (!EVP_DigestInit_ex2(*S, EVP_blake2b512(), params)) {
#else
(void)outlen;
if (!EVP_DigestInit_ex(*S, EVP_blake2b512(), NULL)) {
#endif
EVP_MD_CTX_free(*S);
*S = NULL;
return -1;
}
return 0;
}
int blake2b_update_3p(blake2b_state *S, const void *in, size_t inlen) {
if (inlen == 0) return 0;
return EVP_DigestUpdate(*S, in, inlen) ? 0 : -1;
}
int blake2b_final_3p(blake2b_state *S, void *out, size_t outlen) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
unsigned int len = 0;
int ret = EVP_DigestFinal_ex(*S, out, &len) ? 0 : -1;
#else
unsigned char tmp[64];
unsigned int len = 0;
int ret = EVP_DigestFinal_ex(*S, tmp, &len) ? 0 : -1;
if (ret == 0) memcpy(out, tmp, outlen);
#endif
EVP_MD_CTX_free(*S);
*S = NULL;
return ret;
}
#endif /* WITH_SSL && OPENSSL >= 1.1 */
void void
_crypt_to64(unsigned char *s, unsigned long v, int n) _crypt_to64(unsigned char *s, unsigned long v, int n)
{ {
@ -94,7 +52,12 @@ unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPasswor
unsigned int len=sizeof(szUnicodePass); unsigned int len=sizeof(szUnicodePass);
unsigned int i; unsigned int i;
if(md4_hash == NULL) return NULL; #if OPENSSL_VERSION_NUMBER >= 0x30000000L
const EVP_MD *md4 = md4_hash;
#else
const EVP_MD *md4 = EVP_md4();
#endif
if(md4 == NULL) return NULL;
/* /*
* NT passwords are unicode. Convert plain text password * NT passwords are unicode. Convert plain text password
@ -110,7 +73,7 @@ unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPasswor
/* Encrypt Unicode password to a 16-byte MD4 hash */ /* Encrypt Unicode password to a 16-byte MD4 hash */
ctx = EVP_MD_CTX_new(); ctx = EVP_MD_CTX_new();
if(!ctx) return NULL; if(!ctx) return NULL;
if(!EVP_DigestInit_ex(ctx, md4_hash, NULL)){ if(!EVP_DigestInit_ex(ctx, md4, NULL)){
EVP_MD_CTX_free(ctx); EVP_MD_CTX_free(ctx);
return NULL; return NULL;
} }
@ -138,12 +101,18 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
unsigned long l; unsigned long l;
#if defined(WITH_SSL) #if defined(WITH_SSL)
#ifndef WITHMAIN
if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) { if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
EVP_MD_CTX *ctx, *ctx1; EVP_MD_CTX *ctx, *ctx1;
unsigned int len; unsigned int len;
int pl, i; int pl, i;
if(md5_hash == NULL) { #if OPENSSL_VERSION_NUMBER >= 0x30000000L
const EVP_MD *md5 = md5_hash;
#else
const EVP_MD *md5 = EVP_md5();
#endif
if(md5 == NULL) {
*passwd = 0; *passwd = 0;
return NULL; return NULL;
} }
@ -157,7 +126,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
*passwd = 0; *passwd = 0;
return NULL; return NULL;
} }
EVP_DigestInit_ex(ctx, md5_hash, NULL); EVP_DigestInit_ex(ctx, md5, NULL);
/* The password first, since that is what is most unknown */ /* The password first, since that is what is most unknown */
EVP_DigestUpdate(ctx,pw,strlen((char *)pw)); EVP_DigestUpdate(ctx,pw,strlen((char *)pw));
@ -175,7 +144,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
*passwd = 0; *passwd = 0;
return NULL; return NULL;
} }
EVP_DigestInit_ex(ctx1, EVP_md5(), NULL); EVP_DigestInit_ex(ctx1, md5, NULL);
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw)); EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
EVP_DigestUpdate(ctx1,sp,sl); EVP_DigestUpdate(ctx1,sp,sl);
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw)); EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
@ -204,7 +173,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
*/ */
for(i=0;i<1000;i++) { for(i=0;i<1000;i++) {
EVP_MD_CTX_reset(ctx1); EVP_MD_CTX_reset(ctx1);
EVP_DigestInit_ex(ctx1, md5_hash, NULL); EVP_DigestInit_ex(ctx1, md5, NULL);
if(i & 1) if(i & 1)
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw)); EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
else else
@ -225,6 +194,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
EVP_MD_CTX_free(ctx1); EVP_MD_CTX_free(ctx1);
} }
else else
#endif
#endif #endif
if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) { if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
sp = salt +3; sp = salt +3;
@ -232,10 +202,10 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
magic = (unsigned char *)"$3$"; magic = (unsigned char *)"$3$";
{ {
blake2b_state S; blake2b_state S;
if(blake2b_init_3p(&S, MD5_SIZE) != 0 || if(blake2b_init(&S, MD5_SIZE) != 0 ||
blake2b_update_3p(&S, pw, strlen((char *)pw) + 1) != 0 || blake2b_update(&S, pw, strlen((char *)pw) + 1) != 0 ||
blake2b_update_3p(&S, sp, sl) != 0 || blake2b_update(&S, sp, sl) != 0 ||
blake2b_final_3p(&S, final, MD5_SIZE) != 0) { blake2b_final(&S, final, MD5_SIZE) != 0) {
*passwd = 0; *passwd = 0;
return NULL; return NULL;
} }
@ -268,8 +238,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
} }
#ifdef WITHMAIN #ifdef WITHMAIN
#ifdef WITH_SSL #if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
OSSL_LIB_CTX *library_ctx = NULL;
#include <openssl/provider.h> #include <openssl/provider.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -287,30 +256,21 @@ int main(int argc, char* argv[]){
"Performs NT crypt if no salt specified, BLAKE2 crypt with salt\n" "Performs NT crypt if no salt specified, BLAKE2 crypt with salt\n"
#else #else
"Performs BLAKE2 crypt with salt\n" "Performs BLAKE2 crypt with salt\n"
#endif
"This software uses:\n"
#ifdef WITH_SSL
" OpenSSL EVP (MD4, MD5, BLAKE2b)\n"
#else
" BLAKE2 reference implementation\n"
#endif #endif
, ,
#ifdef WITH_SSL
argv[0], argv[0],
#endif
argv[0]); argv[0]);
return 1; return 1;
} }
#ifdef WITH_SSL #if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
library_ctx = OSSL_LIB_CTX_new(); OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(library_ctx, "legacy"); OSSL_PROVIDER_load(NULL, "default");
OSSL_PROVIDER_load(library_ctx, "default"); md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL);
if (md4_hash == NULL) { if (md4_hash == NULL) {
fprintf(stderr, "Error fetching MD4\n"); fprintf(stderr, "Error fetching MD4\n");
} }
md5_hash = EVP_MD_fetch(library_ctx, "MD5", NULL);
if (md5_hash == NULL) {
fprintf(stderr, "Error fetching MD5\n");
}
#endif #endif
if(argc == 2) { if(argc == 2) {
#ifdef WITH_SSL #ifdef WITH_SSL

View File

@ -128,7 +128,7 @@ redirect$(OBJSUFFICS): redirect.c proxy.h structures.h
hash$(OBJSUFFICS): hash.c proxy.h structures.h hash$(OBJSUFFICS): hash.c proxy.h structures.h
$(CC) $(COUT)hash$(OBJSUFFICS) $(CFLAGS) hash.c $(CC) $(COUT)hash$(OBJSUFFICS) $(CFLAGS) hash.c
hashtables$(OBJSUFFICS): hashtables.c proxy.h structures.h blake2_compat.h hashtables$(OBJSUFFICS): hashtables.c proxy.h structures.h libs/blake2.h
$(CC) $(COUT)hashtables$(OBJSUFFICS) $(CFLAGS) hashtables.c $(CC) $(COUT)hashtables$(OBJSUFFICS) $(CFLAGS) hashtables.c
resolve$(OBJSUFFICS): resolve.c proxy.h structures.h resolve$(OBJSUFFICS): resolve.c proxy.h structures.h
@ -146,10 +146,10 @@ log$(OBJSUFFICS): log.c proxy.h structures.h
datatypes$(OBJSUFFICS): datatypes.c proxy.h structures.h datatypes$(OBJSUFFICS): datatypes.c proxy.h structures.h
$(CC) $(COUT)datatypes$(OBJSUFFICS) $(CFLAGS) datatypes.c $(CC) $(COUT)datatypes$(OBJSUFFICS) $(CFLAGS) datatypes.c
3proxy_crypt$(OBJSUFFICS): 3proxy_crypt.c blake2_compat.h 3proxy_crypt$(OBJSUFFICS): 3proxy_crypt.c libs/blake2.h
$(CC) $(COUT)3proxy_crypt$(OBJSUFFICS) $(CFLAGS) 3proxy_crypt.c $(CC) $(COUT)3proxy_crypt$(OBJSUFFICS) $(CFLAGS) 3proxy_crypt.c
3proxy_cryptmain$(OBJSUFFICS): 3proxy_crypt.c blake2_compat.h 3proxy_cryptmain$(OBJSUFFICS): 3proxy_crypt.c libs/blake2.h
$(CC) $(COUT)3proxy_cryptmain$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITHMAIN 3proxy_crypt.c $(CC) $(COUT)3proxy_cryptmain$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITHMAIN 3proxy_crypt.c
blake2$(OBJSUFFICS): libs/blake2b-ref.c blake2$(OBJSUFFICS): libs/blake2b-ref.c

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,13 +1,13 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
*/ */
#include "proxy.h" #include "proxy.h"
#include "blake2_compat.h" #include "libs/blake2.h"
void initbandlims(struct clientparam *param); void initbandlims(struct clientparam *param);
@ -234,17 +234,17 @@ int strongauth(struct clientparam * param){
unsigned hashsz; unsigned hashsz;
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64; hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
memset(buf, 0, pwl_table.recsize - 1); memset(buf, 0, pwl_table.recsize - 1);
blake2b_init_3p(&S, hashsz); blake2b_init(&S, hashsz);
blake2b_update_3p(&S, param->password, pwlen + 1); blake2b_update(&S, param->password, pwlen + 1);
blake2b_final_3p(&S, buf, hashsz); blake2b_final(&S, buf, hashsz);
if(!memcmp(pass + 1, buf, pwl_table.recsize - 1)) return 0; if(!memcmp(pass + 1, buf, pwl_table.recsize - 1)) return 0;
} }
return 6; return 6;
} }
case CR: case CR:
if (mycrypt(param->password, (unsigned char *)pass, buf) && if (mycrypt(param->password, (unsigned char *)pass + 1, buf) &&
!strcmp(pass + 1, (char *)buf)) !strcmp(pass + 1, (char *)buf))
return 0; return 0;
else return 7; else return 7;
#ifdef WITH_SSL #ifdef WITH_SSL
case NT: case NT:

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2000-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2000-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -183,8 +183,10 @@ char *strNcpy(char *dest, const char *src, int n)
return dest; return dest;
} }
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
extern EVP_MD *md4_hash; extern EVP_MD *md4_hash;
extern EVP_MD *md5_hash; extern EVP_MD *md5_hash;
#endif
void md5_calc(unsigned char *output, unsigned char *input, void md5_calc(unsigned char *output, unsigned char *input,
@ -192,7 +194,11 @@ void md5_calc(unsigned char *output, unsigned char *input,
{ {
EVP_MD_CTX *ctx = EVP_MD_CTX_new(); EVP_MD_CTX *ctx = EVP_MD_CTX_new();
unsigned int len = 0; unsigned int len = 0;
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_DigestInit_ex(ctx, md5_hash, NULL); EVP_DigestInit_ex(ctx, md5_hash, NULL);
#else
EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
#endif
EVP_DigestUpdate(ctx, input, inlen); EVP_DigestUpdate(ctx, input, inlen);
EVP_DigestFinal_ex(ctx, output, &len); EVP_DigestFinal_ex(ctx, output, &len);
EVP_MD_CTX_free(ctx); EVP_MD_CTX_free(ctx);

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
/* /*
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,28 +0,0 @@
#ifndef BLAKE2_COMPAT_H
#define BLAKE2_COMPAT_H
#if defined(WITH_SSL)
#include <openssl/opensslv.h>
#endif
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x10100000L
#include <openssl/evp.h>
typedef EVP_MD_CTX *blake2b_state;
int blake2b_init_3p(blake2b_state *S, size_t outlen);
int blake2b_update_3p(blake2b_state *S, const void *in, size_t inlen);
int blake2b_final_3p(blake2b_state *S, void *out, size_t outlen);
#else
#include "libs/blake2.h"
#define blake2b_init_3p blake2b_init
#define blake2b_update_3p blake2b_update
#define blake2b_final_3p blake2b_final
#endif
#endif /* BLAKE2_COMPAT_H */

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,13 +1,13 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
*/ */
#include "proxy.h" #include "proxy.h"
#include "blake2_compat.h" #include "libs/blake2.h"
#ifdef WITH_SSL #ifdef WITH_SSL
void ssl_install(void); void ssl_install(void);
#endif #endif
@ -334,7 +334,7 @@ static int h_log(int argc, unsigned char ** argv){
openlog((char *)conf.logtarget+1, LOG_PID, LOG_DAEMON); openlog((char *)conf.logtarget+1, LOG_PID, LOG_DAEMON);
#endif #endif
} }
#ifndef NOODBC #ifdef WITH_ODBC
else if(*argv[1]=='&'){ else if(*argv[1]=='&'){
conf.logfunc = logsql; conf.logfunc = logsql;
if(notchanged) return 0; if(notchanged) return 0;
@ -561,9 +561,9 @@ static int h_users(int argc, unsigned char **argv){
blake2b_state S; blake2b_state S;
unsigned hashsz; unsigned hashsz;
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64; hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
blake2b_init_3p(&S, hashsz); blake2b_init(&S, hashsz);
blake2b_update_3p(&S, pw[1], l + 1); blake2b_update(&S, pw[1], l + 1);
blake2b_final_3p(&S, (uint8_t *)(pass + 1), hashsz); blake2b_final(&S, pass+1, hashsz);
} else { } else {
memcpy(pass + 1, pw[1], l); memcpy(pass + 1, pw[1], l);
} }

View File

@ -1,5 +1,5 @@
/* /*
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -561,7 +561,7 @@ static void * ef_server_log(struct node * node){
#ifndef _WIN32 #ifndef _WIN32
else if(((struct srvparam *)node->value) -> logfunc == logsyslog) return "syslog"; else if(((struct srvparam *)node->value) -> logfunc == logsyslog) return "syslog";
#endif #endif
#ifndef NOODBC #ifdef WITH_ODBC
else if(((struct srvparam *)node->value) -> logfunc == logsql) return "odbc"; else if(((struct srvparam *)node->value) -> logfunc == logsql) return "odbc";
#endif #endif
return NULL; return NULL;
@ -620,7 +620,7 @@ static void * ef_server_acl(struct node * node){
} }
static void * ef_server_singlepacket(struct node * node){ static void * ef_server_singlepacket(struct node * node){
return &((struct srvparam *)node->value) -> singlepacket; return &((struct srvparam *)node->value) -> s_option;
} }
static void * ef_server_needuser(struct node * node){ static void * ef_server_needuser(struct node * node){

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -82,7 +82,7 @@ void * dnsprchild(struct clientparam* param) {
*s2 = (len - (int)(s2 - buf)) - 1; *s2 = (len - (int)(s2 - buf)) - 1;
type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2]; type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2];
if((type==0x01 || type==0x1c) && !param->srv->singlepacket){ if((type==0x01 || type==0x1c) && !param->srv->s_option){
ip = udpresolve((type==0x1c)?AF_INET6:AF_INET, (unsigned char *)host, addr, &ttl, param, 0); ip = udpresolve((type==0x1c)?AF_INET6:AF_INET, (unsigned char *)host, addr, &ttl, param, 0);
} }

View File

@ -1,5 +1,5 @@
/* /*
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
#include "proxy.h" #include "proxy.h"
#include "blake2_compat.h" #include "libs/blake2.h"
static void char_index2hash(const struct hashtable *ht, void *index, uint8_t *hash){ static void char_index2hash(const struct hashtable *ht, void *index, uint8_t *hash){
@ -10,9 +10,9 @@ static void char_index2hash(const struct hashtable *ht, void *index, uint8_t *ha
memset(hash, 0, ht->hash_size); memset(hash, 0, ht->hash_size);
if(len <= ht->hash_size) memcpy(hash, index, len); if(len <= ht->hash_size) memcpy(hash, index, len);
else { else {
blake2b_init_3p(&S, ht->hash_size); blake2b_init(&S, ht->hash_size);
blake2b_update_3p(&S, index, strlen((const char*)index) + 1); blake2b_update(&S, index, strlen((const char*)index) + 1);
blake2b_final_3p(&S, hash, ht->hash_size); blake2b_final(&S, hash, ht->hash_size);
} }
} }
@ -49,20 +49,19 @@ static void param2hash_add(const struct hashtable *ht, void *index, uint8_t *has
if((type & 2048)){ memcpy(hash + offset, SAPORT(&param->srv->intsa), p2len); offset += 2; } if((type & 2048)){ memcpy(hash + offset, SAPORT(&param->srv->intsa), p2len); offset += 2; }
} }
else { else {
blake2b_init_3p(&S, ht->hash_size); blake2b_init(&S, ht->hash_size);
if((type & 2) && param->username)blake2b_update_3p(&S, param->username, ulen); if((type & 2) && param->username)blake2b_update(&S, param->username, ulen);
if((type & 4) && param->password)blake2b_update_3p(&S, param->password, plen); if((type & 4) && param->password)blake2b_update(&S, param->password, plen);
if((type & 1) && !(type & 8))blake2b_update_3p(&S, SAADDR(&param->sincr), a1len); if((type & 1) && !(type & 8))blake2b_update(&S, SAADDR(&param->sincr), a1len);
if((type & 16))blake2b_update_3p(&S, &param->srv->acl, acllen); if((type & 16))blake2b_update(&S, &param->srv->acl, acllen);
if((type & 64))blake2b_update_3p(&S, SAADDR(&param->req), a2len); if((type & 64))blake2b_update(&S, SAADDR(&param->req), a2len);
if((type & 128))blake2b_update_3p(&S, SAPORT(&param->req), 2); if((type & 128))blake2b_update(&S, SAPORT(&param->req), 2);
if((type & 256) && param->hostname)blake2b_update_3p(&S, param->hostname, hlen); if((type & 256) && param->hostname)blake2b_update(&S, param->hostname, hlen);
if((type & 512))blake2b_update_3p(&S, &param->operation, sizeof(param->operation)); if((type & 512))blake2b_update(&S, &param->operation, sizeof(param->operation));
if((type & 1024))blake2b_update_3p(&S, SAADDR(&param->srv->intsa), a3len); if((type & 1024))blake2b_update(&S, SAADDR(&param->srv->intsa), a3len);
if((type & 2048))blake2b_update_3p(&S, SAPORT(&param->srv->intsa), 2); if((type & 2048))blake2b_update(&S, SAPORT(&param->srv->intsa), 2);
blake2b_final_3p(&S, hash, ht->hash_size); blake2b_final(&S, hash, ht->hash_size);
} }
memcpy(param->hash, hash, ht->hash_size);
} }
void param2hash_search(const struct hashtable *ht, void *index, uint8_t *hash){ void param2hash_search(const struct hashtable *ht, void *index, uint8_t *hash){
@ -74,12 +73,12 @@ void param2hash_search(const struct hashtable *ht, void *index, uint8_t *hash){
static void udpparam2hash(const struct hashtable *ht, void *index, uint8_t *hash){ static void udpparam2hash(const struct hashtable *ht, void *index, uint8_t *hash){
struct clientparam *param = (struct clientparam *)index; struct clientparam *param = (struct clientparam *)index;
blake2b_state S; blake2b_state S;
blake2b_init_3p(&S, ht->hash_size); blake2b_init(&S, ht->hash_size);
blake2b_update_3p(&S, SAADDR(&param->srv->intsa), SAADDRLEN(&param->srv->intsa)); blake2b_update(&S, SAADDR(&param->srv->intsa), SAADDRLEN(&param->srv->intsa));
blake2b_update_3p(&S, SAPORT(&param->srv->intsa), 2); blake2b_update(&S, SAPORT(&param->srv->intsa), 2);
blake2b_update_3p(&S, SAADDR(&param->sincr), SAADDRLEN(&param->sincr)); blake2b_update(&S, SAADDR(&param->sincr), SAADDRLEN(&param->sincr));
blake2b_update_3p(&S, SAPORT(&param->sincr), 2); blake2b_update(&S, SAPORT(&param->sincr), 2);
blake2b_final_3p(&S, hash, ht->hash_size); blake2b_final(&S, hash, ht->hash_size);
} }
struct hashtable dns_table = {char_index2hash, char_index2hash, 4, 32}; struct hashtable dns_table = {char_index2hash, char_index2hash, 4, 32};

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
/* /*
(c) 2007-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2007-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
/* /*
(c) 2007-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2007-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,7 +1,7 @@
/* plugin for 3proxy with PAM auth only for *NIX (linux,*bsd) /* plugin for 3proxy with PAM auth only for *NIX (linux,*bsd)
Kirill Lopuchov <lopuchov@mail.ru> Kirill Lopuchov <lopuchov@mail.ru>
Compile with: gcc -shared -o pamauth.so pamauth.c -lpam -DNOODBC Compile with: gcc -shared -o pamauth.so pamauth.c -lpam
*/ */
#include "../../structures.h" #include "../../structures.h"

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
/* /*
(c) 2007-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2007-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
/* /*
(c) 2007-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2007-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -112,7 +112,7 @@ void daemonize(void);
#endif #endif
#endif #endif
#ifndef NOODBC #ifdef WITH_ODBC
#ifndef _WIN32 #ifndef _WIN32
#include <sqltypes.h> #include <sqltypes.h>
#endif #endif

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -531,7 +531,7 @@ int MODULEMAINFUNC (int argc, char** argv){
#ifdef WITHSPLICE #ifdef WITHSPLICE
if(isudp || srv.service == S_ADMIN) if(isudp || srv.service == S_ADMIN)
#endif #endif
srv.singlepacket = 1 + atoi(argv[i]+2); srv.s_option = 1 + atoi(argv[i]+2);
#ifdef WITHSPLICE #ifdef WITHSPLICE
else else
if(*(argv[i]+2)) srv.usesplice = atoi(argv[i]+2); if(*(argv[i]+2)) srv.usesplice = atoi(argv[i]+2);
@ -702,8 +702,10 @@ int MODULEMAINFUNC (int argc, char** argv){
freesrvstrings(&srv, cbc_string, cbl_string); freesrvstrings(&srv, cbc_string, cbl_string);
return -13; return -13;
} }
close(nsfd); if(srv.service == S_SOCKS) srv.i_nsfd = nsfd;
else close(nsfd);
} }
if(srv.service == S_SOCKS) srv.saved_nsfd = saved_nsfd;
} }
#endif #endif
if (!iscbc) { if (!iscbc) {
@ -805,27 +807,42 @@ int MODULEMAINFUNC (int argc, char** argv){
if(saved_nsfd != -1) { if(saved_nsfd != -1) {
if(setns(saved_nsfd, CLONE_NEWNET)) { if(setns(saved_nsfd, CLONE_NEWNET)) {
dolog(&defparam, (unsigned char *)"failed to restore netns"); dolog(&defparam, (unsigned char *)"failed to restore netns");
if(srv.service == S_SOCKS) {
if(srv.i_nsfd >= 0) { close(srv.i_nsfd); srv.i_nsfd = -1; }
srv.saved_nsfd = -1;
}
close(saved_nsfd); close(saved_nsfd);
freesrvstrings(&srv, cbc_string, cbl_string); freesrvstrings(&srv, cbc_string, cbl_string);
return -14; return -14;
} }
close(saved_nsfd); if(srv.service != S_SOCKS) {
saved_nsfd = -1; close(saved_nsfd);
saved_nsfd = -1;
}
} }
if(srv.onetns) { if(srv.onetns) {
int nsfd = open(srv.onetns, O_RDONLY); int nsfd = open(srv.onetns, O_RDONLY);
if(nsfd == -1) { if(nsfd == -1) {
dolog(&defparam, (unsigned char *)"failed to open onetns"); dolog(&defparam, (unsigned char *)"failed to open onetns");
if(srv.service == S_SOCKS) {
if(srv.saved_nsfd >= 0) { close(srv.saved_nsfd); srv.saved_nsfd = -1; }
if(srv.i_nsfd >= 0) { close(srv.i_nsfd); srv.i_nsfd = -1; }
}
freesrvstrings(&srv, cbc_string, cbl_string); freesrvstrings(&srv, cbc_string, cbl_string);
return -14; return -14;
} }
if(setns(nsfd, CLONE_NEWNET)) { if(setns(nsfd, CLONE_NEWNET)) {
dolog(&defparam, (unsigned char *)"failed to setns onetns"); dolog(&defparam, (unsigned char *)"failed to setns onetns");
close(nsfd); close(nsfd);
if(srv.service == S_SOCKS) {
if(srv.saved_nsfd >= 0) { close(srv.saved_nsfd); srv.saved_nsfd = -1; }
if(srv.i_nsfd >= 0) { close(srv.i_nsfd); srv.i_nsfd = -1; }
}
freesrvstrings(&srv, cbc_string, cbl_string); freesrvstrings(&srv, cbc_string, cbl_string);
return -14; return -14;
} }
close(nsfd); if(srv.service == S_SOCKS) srv.o_nsfd = nsfd;
else close(nsfd);
} }
#endif #endif
if(iscbl){ if(iscbl){
@ -1149,8 +1166,11 @@ void srvinit(struct srvparam * srv, struct clientparam *param){
srv->srvsock = INVALID_SOCKET; srv->srvsock = INVALID_SOCKET;
srv->logdumpsrv = conf.logdumpsrv; srv->logdumpsrv = conf.logdumpsrv;
srv->logdumpcli = conf.logdumpcli; srv->logdumpcli = conf.logdumpcli;
srv->cbsock = INVALID_SOCKET; srv->cbsock = INVALID_SOCKET;
srv->needuser = 1; srv->needuser = 1;
#ifdef __linux__
srv->saved_nsfd = srv->i_nsfd = srv->o_nsfd = -1;
#endif
#ifdef WITHSPLICE #ifdef WITHSPLICE
srv->usesplice = 1; srv->usesplice = 1;
#endif #endif
@ -1247,6 +1267,9 @@ void srvfree(struct srvparam * srv){
#ifdef __linux__ #ifdef __linux__
if(srv->inetns) free(srv->inetns); if(srv->inetns) free(srv->inetns);
if(srv->onetns) free(srv->onetns); if(srv->onetns) free(srv->onetns);
if(srv->saved_nsfd >= 0) { close(srv->saved_nsfd); srv->saved_nsfd = -1; }
if(srv->i_nsfd >= 0) { close(srv->i_nsfd); srv->i_nsfd = -1; }
if(srv->o_nsfd >= 0) { close(srv->o_nsfd); srv->o_nsfd = -1; }
#endif #endif
if(srv->so.freefunc) srv->so.freefunc(srv->so.state); if(srv->so.freefunc) srv->so.freefunc(srv->so.state);
#ifndef NOUDPMAIN #ifndef NOUDPMAIN

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
*/ */

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -279,7 +279,6 @@ log("done send to client from buf");
if(param->srvoffset == param->srvinbuf)param->srvoffset = param->srvinbuf =0; if(param->srvoffset == param->srvinbuf)param->srvoffset = param->srvinbuf =0;
if(param->srvinbuf < param->srvbufsize) TOSERVERBUF = 1; if(param->srvinbuf < param->srvbufsize) TOSERVERBUF = 1;
needaction = 0; needaction = 0;
if(param->srv->singlepacket) RETURN(0);
continue; continue;
} }
} }

View File

@ -1,12 +1,15 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
*/ */
#include "proxy.h" #include "proxy.h"
#ifdef __linux__
#include <sched.h>
#endif
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; } #define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
@ -188,6 +191,12 @@ void * sockschild(struct clientparam* param) {
param->sinsl = *SAFAMILY(&param->req)==AF_INET6? param->srv->extsa6 : param->srv->extsa; param->sinsl = *SAFAMILY(&param->req)==AF_INET6? param->srv->extsa6 : param->srv->extsa;
#else #else
param->sinsl = param->srv->extsa; param->sinsl = param->srv->extsa;
#endif
#ifdef __linux__
if(command == 3 && param->srv->o_nsfd >= 0) {
if(param->srv->saved_nsfd >= 0 && setns(param->srv->saved_nsfd, CLONE_NEWNET)) {RETURN(11);}
if(setns(param->srv->o_nsfd, CLONE_NEWNET)) {RETURN(11);}
}
#endif #endif
if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&param->req), command == 2? SOCK_STREAM:SOCK_DGRAM, command == 2?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {RETURN (11);} if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&param->req), command == 2? SOCK_STREAM:SOCK_DGRAM, command == 2?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {RETURN (11);}
param->operation = command == 2?BIND:UDPASSOC; param->operation = command == 2?BIND:UDPASSOC;
@ -242,6 +251,12 @@ fflush(stderr);
param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)&param->sinsl, &sasize); param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)&param->sinsl, &sasize);
if(command == 3) { if(command == 3) {
param->ctrlsock = param->clisock; param->ctrlsock = param->clisock;
#ifdef __linux__
if(param->srv->i_nsfd >= 0) {
if(param->srv->saved_nsfd >= 0 && setns(param->srv->saved_nsfd, CLONE_NEWNET)) {RETURN(11);}
if(setns(param->srv->i_nsfd, CLONE_NEWNET)) {RETURN(11);}
}
#endif
param->clisock = param->srv->so._socket(param->sostate, SASOCK(&param->sincr), SOCK_DGRAM, IPPROTO_UDP); param->clisock = param->srv->so._socket(param->sostate, SASOCK(&param->sincr), SOCK_DGRAM, IPPROTO_UDP);
if(param->clisock == INVALID_SOCKET) {RETURN(11);} if(param->clisock == INVALID_SOCKET) {RETURN(11);}
sin = param->sincl; sin = param->sincl;

View File

@ -1,5 +1,5 @@
#include "proxy.h" #include "proxy.h"
#ifndef NOODBC #ifdef WITH_ODBC
SQLHENV henv = NULL; SQLHENV henv = NULL;
SQLHSTMT hstmt = NULL; SQLHSTMT hstmt = NULL;

View File

@ -1,5 +1,5 @@
/* /*
(c) 2007-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2007-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,5 +1,5 @@
/* /*
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -20,7 +20,9 @@
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h> #include <openssl/provider.h>
#endif
#include "proxy.h" #include "proxy.h"
#include "ssl.h" #include "ssl.h"
@ -278,9 +280,10 @@ int ssl_file_init = 0;
int ssl_init_done = 0; int ssl_init_done = 0;
OSSL_LIB_CTX *library_ctx = NULL; #if OPENSSL_VERSION_NUMBER >= 0x30000000L
extern EVP_MD *md4_hash; extern EVP_MD *md4_hash;
extern EVP_MD *md5_hash; extern EVP_MD *md5_hash;
#endif
void ssl_init() void ssl_init()
@ -293,17 +296,17 @@ void ssl_init()
SSL_load_error_strings(); SSL_load_error_strings();
_3proxy_mutex_init(&ssl_file_mutex); _3proxy_mutex_init(&ssl_file_mutex);
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
library_ctx = OSSL_LIB_CTX_new(); #if OPENSSL_VERSION_NUMBER >= 0x30000000L
OSSL_PROVIDER_load(library_ctx, "legacy"); OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(library_ctx, "default"); OSSL_PROVIDER_load(NULL, "default");
md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL); md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
if (md4_hash == NULL) { if (md4_hash == NULL) {
fprintf(stderr, "Error fetching MD4\n"); fprintf(stderr, "Error fetching MD4\n");
} }
md5_hash = EVP_MD_fetch(library_ctx, "MD5", NULL); md5_hash = EVP_MD_fetch(NULL, "MD5", NULL);
if (md5_hash == NULL) { if (md5_hash == NULL) {
fprintf(stderr, "Error fetching MD5\n"); fprintf(stderr, "Error fetching MD5\n");
} }
#endif
} }
} }

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -522,7 +522,7 @@ struct srvparam {
int maxchild; int maxchild;
int backlog; int backlog;
int paused, version; int paused, version;
int singlepacket; int s_option;
int needuser; int needuser;
int silent; int silent;
int transparent; int transparent;
@ -557,6 +557,9 @@ struct srvparam {
#ifdef __linux__ #ifdef __linux__
char * inetns; char * inetns;
char * onetns; char * onetns;
int saved_nsfd;
int i_nsfd;
int o_nsfd;
#endif #endif
struct auth *authenticate; struct auth *authenticate;
struct pollfd * srvfds; struct pollfd * srvfds;

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -191,7 +191,7 @@ void * tlsprchild(struct clientparam* param) {
} }
else if (parsehostname(sni, param, param->srv->targetport? ntohs(param->srv->targetport):443)) RETURN (100); else if (parsehostname(sni, param, param->srv->targetport? ntohs(param->srv->targetport):443)) RETURN (100);
if (!param->hostname)param->hostname = (unsigned char *)strdup(sni); if (!param->hostname)param->hostname = (unsigned char *)strdup(sni);
if(param->srv->singlepacket && snipos && res > 1){ if(param->srv->s_option && snipos && res > 1){
int len; int len;
len = socksend(param, param->remsock, param->clibuf+param->clioffset,snipos + (res/2), conf.timeouts[STRING_S]); len = socksend(param, param->remsock, param->clibuf+param->clioffset,snipos + (res/2), conf.timeouts[STRING_S]);

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -56,7 +56,7 @@ void * udppmchild(struct clientparam* param) {
param->operation = UDPASSOC; param->operation = UDPASSOC;
authres = (*param->srv->authfunc)(param); authres = (*param->srv->authfunc)(param);
if(authres) { RETURN(authres); } if(authres) { RETURN(authres); }
if(!param->srv->singlepacket)hashadd(&udp_table, param, &param, MAX_COUNTER_TIME); if(!param->srv->s_option)hashadd(&udp_table, param, &param, MAX_COUNTER_TIME);
if(!param->srvbuf){ if(!param->srvbuf){
if(!(param->srvbuf = malloc(UDPBUFSIZE)))RETURN(11); if(!(param->srvbuf = malloc(UDPBUFSIZE)))RETURN(11);
param->srvbufsize = UDPBUFSIZE; param->srvbufsize = UDPBUFSIZE;
@ -78,7 +78,7 @@ void * udppmchild(struct clientparam* param) {
param->waitserver64 = 0x7fffffffffffffff; param->waitserver64 = 0x7fffffffffffffff;
param->res = udpsockmap(param, conf.timeouts[STRING_L]); param->res = udpsockmap(param, conf.timeouts[STRING_L]);
_3proxy_sem_lock(udpinit); _3proxy_sem_lock(udpinit);
if(!param->srv->singlepacket)hashdelete(&udp_table, param); if(!param->srv->s_option)hashdelete(&udp_table, param);
CLEANRET: CLEANRET:

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -44,7 +44,7 @@ static int socks5_udp_skip_hdr(unsigned char *buf, int len)
* 3 three parent proxies (prepend 2 headers / strip 2 headers) * 3 three parent proxies (prepend 2 headers / strip 2 headers)
* *
* param->waitserver64 non-zero: skip client socket polling (serverclient only) * param->waitserver64 non-zero: skip client socket polling (serverclient only)
* param->srv->singlepacket non-zero: return after first datagram sent to client * param->srv->s_option non-zero: return after first datagram sent to client
* param->ctrlsock TCP control socket from the client; INVALID_SOCKET if none. * param->ctrlsock TCP control socket from the client; INVALID_SOCKET if none.
*/ */
int udpsockmap(struct clientparam *param, int timeo) int udpsockmap(struct clientparam *param, int timeo)
@ -213,7 +213,7 @@ int udpsockmap(struct clientparam *param, int timeo)
param->srv->so._sendto(param->sostate, param->clisock, param->srv->so._sendto(param->sostate, param->clisock,
(char *)param->srvbuf + sendoff, sendlen, 0, (char *)param->srvbuf + sendoff, sendlen, 0,
(struct sockaddr *)&sin, SASIZE(&sin)); (struct sockaddr *)&sin, SASIZE(&sin));
if (param->srv->singlepacket) return 0; if (param->srv->s_option && param->srv->service == S_UDPPM) return 0;
} }
if ((ctrlsock_idx >= 0 && fds[ctrlsock_idx].revents) || if ((ctrlsock_idx >= 0 && fds[ctrlsock_idx].revents) ||

View File

@ -1,6 +1,6 @@
/* /*
3APA3A simplest proxy server 3APA3A simplest proxy server
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org> (c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
please read License Agreement please read License Agreement
@ -379,7 +379,7 @@ void * adminchild(struct clientparam* param) {
int limited = 0; int limited = 0;
limited =param->srv->singlepacket; limited =param->srv->s_option;
pp.inbuf = 0; pp.inbuf = 0;
pp.cp = param; pp.cp = param;