mirror of
https://github.com/3proxy/3proxy.git
synced 2026-06-13 11:00:11 +08:00
Compare commits
11 Commits
f8c22d5f91
...
aaa04116a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaa04116a8 | ||
|
|
5fdd4a4d6f | ||
|
|
7871279fae | ||
|
|
ff15a8d480 | ||
|
|
95029e9e41 | ||
|
|
6286bfcd6e | ||
|
|
b1d21cbdca | ||
|
|
978f351560 | ||
|
|
41d1fa8b00 | ||
|
|
8c638fcaff | ||
|
|
6963af7614 |
@ -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)
|
||||
@ -414,9 +414,7 @@ add_executable(3proxy
|
||||
$<TARGET_OBJECTS:ftp_obj>
|
||||
$<TARGET_OBJECTS:3proxy_crypt_obj>
|
||||
)
|
||||
if(NOT OpenSSL_FOUND)
|
||||
target_sources(3proxy PRIVATE ${MD_SOURCES})
|
||||
endif()
|
||||
target_sources(3proxy PRIVATE ${MD_SOURCES})
|
||||
|
||||
if(OpenSSL_FOUND)
|
||||
target_sources(3proxy PRIVATE src/ssllib.c src/ssl.c)
|
||||
@ -523,9 +521,7 @@ add_executable(3proxy_crypt
|
||||
src/3proxy_crypt.c
|
||||
$<TARGET_OBJECTS:base64_obj>
|
||||
)
|
||||
if(NOT OpenSSL_FOUND)
|
||||
target_sources(3proxy_crypt PRIVATE ${MD_SOURCES})
|
||||
endif()
|
||||
target_sources(3proxy_crypt PRIVATE ${MD_SOURCES})
|
||||
target_compile_definitions(3proxy_crypt PRIVATE WITHMAIN)
|
||||
target_include_directories(3proxy_crypt PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 ?=
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# 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
|
||||
|
||||
|
||||
15
debian/copyright
vendored
15
debian/copyright
vendored
@ -4,17 +4,10 @@ Upstream-Contact: 3proxy@3proxy.org
|
||||
Source: https://3proxy.org/
|
||||
|
||||
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+
|
||||
|
||||
Files: src/libs/md*.*
|
||||
Copyright: 1990,1991,1992 RSA Data Security, Inc
|
||||
License: public-domain
|
||||
Files: src/libs/blake2*.*
|
||||
Copyright: 2012, Samuel Neves <sneves@dei.uc.pt>
|
||||
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+
|
||||
|
||||
@ -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
|
||||
.B 3proxy
|
||||
\- 3[APA3A] tiny proxy server, or trivial proxy server, or free proxy
|
||||
@ -144,8 +144,5 @@ Report all bugs to
|
||||
kill(1), syslogd(8),
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH TRIVIA
|
||||
3APA3A is pronounced as \`\`zaraza\'\'.
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B 3proxy.cfg
|
||||
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),
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH TRIVIA
|
||||
3APA3A is pronounced as \`\`zaraza\'\'.
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B 3proxy_crypt
|
||||
\- utility to generate encrypted passwords for 3proxy
|
||||
@ -77,5 +77,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B ftppr
|
||||
\- FTP proxy gateway service
|
||||
@ -106,5 +106,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B pop3p
|
||||
\- POP3 proxy gateway service
|
||||
@ -102,5 +102,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B proxy
|
||||
\- HTTP proxy gateway service
|
||||
@ -97,5 +97,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B smtpp
|
||||
\- SMTP proxy gateway service
|
||||
@ -103,5 +103,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B socks
|
||||
\- SOCKS 4/4.5/5 gateway service
|
||||
@ -111,5 +111,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B tcppm
|
||||
\- TCP port mapper
|
||||
@ -100,5 +100,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B tlspr
|
||||
\- SNI proxy gateway service
|
||||
@ -104,5 +104,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -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
|
||||
.B udppm
|
||||
\- UDP port mapper
|
||||
@ -93,5 +93,4 @@ Report all bugs to
|
||||
.br
|
||||
https://3proxy.org/
|
||||
.SH AUTHORS
|
||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
||||
.RI ( 3proxy@3proxy.org )
|
||||
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
/*
|
||||
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
|
||||
|
||||
*/
|
||||
#include "blake2_compat.h"
|
||||
#include "libs/blake2.h"
|
||||
#ifdef WITH_SSL
|
||||
#include <openssl/evp.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
@ -28,53 +28,11 @@ static unsigned char itoa64[] =
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
|
||||
#if defined(WITH_SSL)
|
||||
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
EVP_MD *md4_hash = NULL;
|
||||
EVP_MD *md5_hash = NULL;
|
||||
#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
|
||||
_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 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
|
||||
@ -110,7 +73,7 @@ unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPasswor
|
||||
/* Encrypt Unicode password to a 16-byte MD4 hash */
|
||||
ctx = EVP_MD_CTX_new();
|
||||
if(!ctx) return NULL;
|
||||
if(!EVP_DigestInit_ex(ctx, md4_hash, NULL)){
|
||||
if(!EVP_DigestInit_ex(ctx, md4, NULL)){
|
||||
EVP_MD_CTX_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
@ -138,12 +101,18 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
||||
unsigned long l;
|
||||
|
||||
#if defined(WITH_SSL)
|
||||
#ifndef WITHMAIN
|
||||
if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
|
||||
EVP_MD_CTX *ctx, *ctx1;
|
||||
unsigned int len;
|
||||
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;
|
||||
return NULL;
|
||||
}
|
||||
@ -157,7 +126,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
||||
*passwd = 0;
|
||||
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 */
|
||||
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;
|
||||
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,sp,sl);
|
||||
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++) {
|
||||
EVP_MD_CTX_reset(ctx1);
|
||||
EVP_DigestInit_ex(ctx1, md5_hash, NULL);
|
||||
EVP_DigestInit_ex(ctx1, md5, NULL);
|
||||
if(i & 1)
|
||||
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
|
||||
else
|
||||
@ -225,6 +194,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
||||
EVP_MD_CTX_free(ctx1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)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$";
|
||||
{
|
||||
blake2b_state S;
|
||||
if(blake2b_init_3p(&S, MD5_SIZE) != 0 ||
|
||||
blake2b_update_3p(&S, pw, strlen((char *)pw) + 1) != 0 ||
|
||||
blake2b_update_3p(&S, sp, sl) != 0 ||
|
||||
blake2b_final_3p(&S, final, MD5_SIZE) != 0) {
|
||||
if(blake2b_init(&S, MD5_SIZE) != 0 ||
|
||||
blake2b_update(&S, pw, strlen((char *)pw) + 1) != 0 ||
|
||||
blake2b_update(&S, sp, sl) != 0 ||
|
||||
blake2b_final(&S, final, MD5_SIZE) != 0) {
|
||||
*passwd = 0;
|
||||
return NULL;
|
||||
}
|
||||
@ -268,8 +238,7 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
||||
}
|
||||
|
||||
#ifdef WITHMAIN
|
||||
#ifdef WITH_SSL
|
||||
OSSL_LIB_CTX *library_ctx = NULL;
|
||||
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
#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"
|
||||
#else
|
||||
"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
|
||||
,
|
||||
#ifdef WITH_SSL
|
||||
argv[0],
|
||||
#endif
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
#ifdef WITH_SSL
|
||||
library_ctx = OSSL_LIB_CTX_new();
|
||||
OSSL_PROVIDER_load(library_ctx, "legacy");
|
||||
OSSL_PROVIDER_load(library_ctx, "default");
|
||||
md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL);
|
||||
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER_load(NULL, "legacy");
|
||||
OSSL_PROVIDER_load(NULL, "default");
|
||||
md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
|
||||
if (md4_hash == NULL) {
|
||||
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
|
||||
if(argc == 2) {
|
||||
#ifdef WITH_SSL
|
||||
|
||||
@ -128,7 +128,7 @@ redirect$(OBJSUFFICS): redirect.c proxy.h structures.h
|
||||
hash$(OBJSUFFICS): hash.c proxy.h structures.h
|
||||
$(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
|
||||
|
||||
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
|
||||
$(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
|
||||
|
||||
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
|
||||
|
||||
blake2$(OBJSUFFICS): libs/blake2b-ref.c
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
12
src/auth.c
12
src/auth.c
@ -1,13 +1,13 @@
|
||||
/*
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#include "proxy.h"
|
||||
#include "blake2_compat.h"
|
||||
#include "libs/blake2.h"
|
||||
|
||||
void initbandlims(struct clientparam *param);
|
||||
|
||||
@ -234,15 +234,15 @@ int strongauth(struct clientparam * param){
|
||||
unsigned hashsz;
|
||||
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
|
||||
memset(buf, 0, pwl_table.recsize - 1);
|
||||
blake2b_init_3p(&S, hashsz);
|
||||
blake2b_update_3p(&S, param->password, pwlen + 1);
|
||||
blake2b_final_3p(&S, buf, hashsz);
|
||||
blake2b_init(&S, hashsz);
|
||||
blake2b_update(&S, param->password, pwlen + 1);
|
||||
blake2b_final(&S, buf, hashsz);
|
||||
if(!memcmp(pass + 1, buf, pwl_table.recsize - 1)) return 0;
|
||||
}
|
||||
return 6;
|
||||
}
|
||||
case CR:
|
||||
if (mycrypt(param->password, (unsigned char *)pass, buf) &&
|
||||
if (mycrypt(param->password, (unsigned char *)pass + 1, buf) &&
|
||||
!strcmp(pass + 1, (char *)buf))
|
||||
return 0;
|
||||
else return 7;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -183,8 +183,10 @@ char *strNcpy(char *dest, const char *src, int n)
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
extern EVP_MD *md4_hash;
|
||||
extern EVP_MD *md5_hash;
|
||||
#endif
|
||||
|
||||
|
||||
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();
|
||||
unsigned int len = 0;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
EVP_DigestInit_ex(ctx, md5_hash, NULL);
|
||||
#else
|
||||
EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
|
||||
#endif
|
||||
EVP_DigestUpdate(ctx, input, inlen);
|
||||
EVP_DigestFinal_ex(ctx, output, &len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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 */
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
12
src/conf.c
12
src/conf.c
@ -1,13 +1,13 @@
|
||||
/*
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#include "proxy.h"
|
||||
#include "blake2_compat.h"
|
||||
#include "libs/blake2.h"
|
||||
#ifdef WITH_SSL
|
||||
void ssl_install(void);
|
||||
#endif
|
||||
@ -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;
|
||||
@ -561,9 +561,9 @@ static int h_users(int argc, unsigned char **argv){
|
||||
blake2b_state S;
|
||||
unsigned hashsz;
|
||||
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
|
||||
blake2b_init_3p(&S, hashsz);
|
||||
blake2b_update_3p(&S, pw[1], l + 1);
|
||||
blake2b_final_3p(&S, (uint8_t *)(pass + 1), hashsz);
|
||||
blake2b_init(&S, hashsz);
|
||||
blake2b_update(&S, pw[1], l + 1);
|
||||
blake2b_final(&S, pass+1, hashsz);
|
||||
} else {
|
||||
memcpy(pass + 1, pw[1], l);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -620,7 +620,7 @@ static void * ef_server_acl(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){
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -82,7 +82,7 @@ void * dnsprchild(struct clientparam* param) {
|
||||
*s2 = (len - (int)(s2 - buf)) - 1;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include "proxy.h"
|
||||
#include "blake2_compat.h"
|
||||
#include "libs/blake2.h"
|
||||
|
||||
|
||||
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);
|
||||
if(len <= ht->hash_size) memcpy(hash, index, len);
|
||||
else {
|
||||
blake2b_init_3p(&S, ht->hash_size);
|
||||
blake2b_update_3p(&S, index, strlen((const char*)index) + 1);
|
||||
blake2b_final_3p(&S, hash, ht->hash_size);
|
||||
blake2b_init(&S, ht->hash_size);
|
||||
blake2b_update(&S, index, strlen((const char*)index) + 1);
|
||||
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(¶m->srv->intsa), p2len); offset += 2; }
|
||||
}
|
||||
else {
|
||||
blake2b_init_3p(&S, ht->hash_size);
|
||||
if((type & 2) && param->username)blake2b_update_3p(&S, param->username, ulen);
|
||||
if((type & 4) && param->password)blake2b_update_3p(&S, param->password, plen);
|
||||
if((type & 1) && !(type & 8))blake2b_update_3p(&S, SAADDR(¶m->sincr), a1len);
|
||||
if((type & 16))blake2b_update_3p(&S, ¶m->srv->acl, acllen);
|
||||
if((type & 64))blake2b_update_3p(&S, SAADDR(¶m->req), a2len);
|
||||
if((type & 128))blake2b_update_3p(&S, SAPORT(¶m->req), 2);
|
||||
if((type & 256) && param->hostname)blake2b_update_3p(&S, param->hostname, hlen);
|
||||
if((type & 512))blake2b_update_3p(&S, ¶m->operation, sizeof(param->operation));
|
||||
if((type & 1024))blake2b_update_3p(&S, SAADDR(¶m->srv->intsa), a3len);
|
||||
if((type & 2048))blake2b_update_3p(&S, SAPORT(¶m->srv->intsa), 2);
|
||||
blake2b_final_3p(&S, hash, ht->hash_size);
|
||||
blake2b_init(&S, ht->hash_size);
|
||||
if((type & 2) && param->username)blake2b_update(&S, param->username, ulen);
|
||||
if((type & 4) && param->password)blake2b_update(&S, param->password, plen);
|
||||
if((type & 1) && !(type & 8))blake2b_update(&S, SAADDR(¶m->sincr), a1len);
|
||||
if((type & 16))blake2b_update(&S, ¶m->srv->acl, acllen);
|
||||
if((type & 64))blake2b_update(&S, SAADDR(¶m->req), a2len);
|
||||
if((type & 128))blake2b_update(&S, SAPORT(¶m->req), 2);
|
||||
if((type & 256) && param->hostname)blake2b_update(&S, param->hostname, hlen);
|
||||
if((type & 512))blake2b_update(&S, ¶m->operation, sizeof(param->operation));
|
||||
if((type & 1024))blake2b_update(&S, SAADDR(¶m->srv->intsa), a3len);
|
||||
if((type & 2048))blake2b_update(&S, SAPORT(¶m->srv->intsa), 2);
|
||||
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){
|
||||
@ -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){
|
||||
struct clientparam *param = (struct clientparam *)index;
|
||||
blake2b_state S;
|
||||
blake2b_init_3p(&S, ht->hash_size);
|
||||
blake2b_update_3p(&S, SAADDR(¶m->srv->intsa), SAADDRLEN(¶m->srv->intsa));
|
||||
blake2b_update_3p(&S, SAPORT(¶m->srv->intsa), 2);
|
||||
blake2b_update_3p(&S, SAADDR(¶m->sincr), SAADDRLEN(¶m->sincr));
|
||||
blake2b_update_3p(&S, SAPORT(¶m->sincr), 2);
|
||||
blake2b_final_3p(&S, hash, ht->hash_size);
|
||||
blake2b_init(&S, ht->hash_size);
|
||||
blake2b_update(&S, SAADDR(¶m->srv->intsa), SAADDRLEN(¶m->srv->intsa));
|
||||
blake2b_update(&S, SAPORT(¶m->srv->intsa), 2);
|
||||
blake2b_update(&S, SAADDR(¶m->sincr), SAADDRLEN(¶m->sincr));
|
||||
blake2b_update(&S, SAPORT(¶m->sincr), 2);
|
||||
blake2b_final(&S, hash, ht->hash_size);
|
||||
}
|
||||
|
||||
struct hashtable dns_table = {char_index2hash, char_index2hash, 4, 32};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* plugin for 3proxy with PAM auth only for *NIX (linux,*bsd)
|
||||
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"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -112,7 +112,7 @@ void daemonize(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NOODBC
|
||||
#ifdef WITH_ODBC
|
||||
#ifndef _WIN32
|
||||
#include <sqltypes.h>
|
||||
#endif
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -531,7 +531,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
#ifdef WITHSPLICE
|
||||
if(isudp || srv.service == S_ADMIN)
|
||||
#endif
|
||||
srv.singlepacket = 1 + atoi(argv[i]+2);
|
||||
srv.s_option = 1 + atoi(argv[i]+2);
|
||||
#ifdef WITHSPLICE
|
||||
else
|
||||
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);
|
||||
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
|
||||
if (!iscbc) {
|
||||
@ -805,27 +807,42 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
if(saved_nsfd != -1) {
|
||||
if(setns(saved_nsfd, CLONE_NEWNET)) {
|
||||
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);
|
||||
freesrvstrings(&srv, cbc_string, cbl_string);
|
||||
return -14;
|
||||
}
|
||||
if(srv.service != S_SOCKS) {
|
||||
close(saved_nsfd);
|
||||
saved_nsfd = -1;
|
||||
}
|
||||
}
|
||||
if(srv.onetns) {
|
||||
int nsfd = open(srv.onetns, O_RDONLY);
|
||||
if(nsfd == -1) {
|
||||
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);
|
||||
return -14;
|
||||
}
|
||||
if(setns(nsfd, CLONE_NEWNET)) {
|
||||
dolog(&defparam, (unsigned char *)"failed to setns onetns");
|
||||
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);
|
||||
return -14;
|
||||
}
|
||||
close(nsfd);
|
||||
if(srv.service == S_SOCKS) srv.o_nsfd = nsfd;
|
||||
else close(nsfd);
|
||||
}
|
||||
#endif
|
||||
if(iscbl){
|
||||
@ -1151,6 +1168,9 @@ void srvinit(struct srvparam * srv, struct clientparam *param){
|
||||
srv->logdumpcli = conf.logdumpcli;
|
||||
srv->cbsock = INVALID_SOCKET;
|
||||
srv->needuser = 1;
|
||||
#ifdef __linux__
|
||||
srv->saved_nsfd = srv->i_nsfd = srv->o_nsfd = -1;
|
||||
#endif
|
||||
#ifdef WITHSPLICE
|
||||
srv->usesplice = 1;
|
||||
#endif
|
||||
@ -1247,6 +1267,9 @@ void srvfree(struct srvparam * srv){
|
||||
#ifdef __linux__
|
||||
if(srv->inetns) free(srv->inetns);
|
||||
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
|
||||
if(srv->so.freefunc) srv->so.freefunc(srv->so.state);
|
||||
#ifndef NOUDPMAIN
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -279,7 +279,6 @@ log("done send to client from buf");
|
||||
if(param->srvoffset == param->srvinbuf)param->srvoffset = param->srvinbuf =0;
|
||||
if(param->srvinbuf < param->srvbufsize) TOSERVERBUF = 1;
|
||||
needaction = 0;
|
||||
if(param->srv->singlepacket) RETURN(0);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
17
src/socks.c
17
src/socks.c
@ -1,12 +1,15 @@
|
||||
/*
|
||||
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
|
||||
|
||||
*/
|
||||
|
||||
#include "proxy.h"
|
||||
#ifdef __linux__
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
|
||||
|
||||
@ -188,6 +191,12 @@ void * sockschild(struct clientparam* param) {
|
||||
param->sinsl = *SAFAMILY(¶m->req)==AF_INET6? param->srv->extsa6 : param->srv->extsa;
|
||||
#else
|
||||
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
|
||||
if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(¶m->req), command == 2? SOCK_STREAM:SOCK_DGRAM, command == 2?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {RETURN (11);}
|
||||
param->operation = command == 2?BIND:UDPASSOC;
|
||||
@ -242,6 +251,12 @@ fflush(stderr);
|
||||
param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)¶m->sinsl, &sasize);
|
||||
if(command == 3) {
|
||||
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(¶m->sincr), SOCK_DGRAM, IPPROTO_UDP);
|
||||
if(param->clisock == INVALID_SOCKET) {RETURN(11);}
|
||||
sin = param->sincl;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include "proxy.h"
|
||||
#ifndef NOODBC
|
||||
#ifdef WITH_ODBC
|
||||
|
||||
SQLHENV henv = NULL;
|
||||
SQLHSTMT hstmt = NULL;
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
19
src/ssllib.c
19
src/ssllib.c
@ -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
|
||||
|
||||
@ -20,7 +20,9 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#include <openssl/provider.h>
|
||||
#endif
|
||||
|
||||
#include "proxy.h"
|
||||
#include "ssl.h"
|
||||
@ -278,9 +280,10 @@ int ssl_file_init = 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 *md5_hash;
|
||||
#endif
|
||||
|
||||
|
||||
void ssl_init()
|
||||
@ -293,17 +296,17 @@ void ssl_init()
|
||||
SSL_load_error_strings();
|
||||
_3proxy_mutex_init(&ssl_file_mutex);
|
||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||
library_ctx = OSSL_LIB_CTX_new();
|
||||
OSSL_PROVIDER_load(library_ctx, "legacy");
|
||||
OSSL_PROVIDER_load(library_ctx, "default");
|
||||
md4_hash = EVP_MD_fetch(library_ctx, "MD4", NULL);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
OSSL_PROVIDER_load(NULL, "legacy");
|
||||
OSSL_PROVIDER_load(NULL, "default");
|
||||
md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
|
||||
if (md4_hash == NULL) {
|
||||
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) {
|
||||
fprintf(stderr, "Error fetching MD5\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -522,7 +522,7 @@ struct srvparam {
|
||||
int maxchild;
|
||||
int backlog;
|
||||
int paused, version;
|
||||
int singlepacket;
|
||||
int s_option;
|
||||
int needuser;
|
||||
int silent;
|
||||
int transparent;
|
||||
@ -557,6 +557,9 @@ struct srvparam {
|
||||
#ifdef __linux__
|
||||
char * inetns;
|
||||
char * onetns;
|
||||
int saved_nsfd;
|
||||
int i_nsfd;
|
||||
int o_nsfd;
|
||||
#endif
|
||||
struct auth *authenticate;
|
||||
struct pollfd * srvfds;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -191,7 +191,7 @@ void * tlsprchild(struct clientparam* param) {
|
||||
}
|
||||
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->srv->singlepacket && snipos && res > 1){
|
||||
if(param->srv->s_option && snipos && res > 1){
|
||||
int len;
|
||||
|
||||
len = socksend(param, param->remsock, param->clibuf+param->clioffset,snipos + (res/2), conf.timeouts[STRING_S]);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -56,7 +56,7 @@ void * udppmchild(struct clientparam* param) {
|
||||
param->operation = UDPASSOC;
|
||||
authres = (*param->srv->authfunc)(param);
|
||||
if(authres) { RETURN(authres); }
|
||||
if(!param->srv->singlepacket)hashadd(&udp_table, param, ¶m, MAX_COUNTER_TIME);
|
||||
if(!param->srv->s_option)hashadd(&udp_table, param, ¶m, MAX_COUNTER_TIME);
|
||||
if(!param->srvbuf){
|
||||
if(!(param->srvbuf = malloc(UDPBUFSIZE)))RETURN(11);
|
||||
param->srvbufsize = UDPBUFSIZE;
|
||||
@ -78,7 +78,7 @@ void * udppmchild(struct clientparam* param) {
|
||||
param->waitserver64 = 0x7fffffffffffffff;
|
||||
param->res = udpsockmap(param, conf.timeouts[STRING_L]);
|
||||
_3proxy_sem_lock(udpinit);
|
||||
if(!param->srv->singlepacket)hashdelete(&udp_table, param);
|
||||
if(!param->srv->s_option)hashdelete(&udp_table, param);
|
||||
|
||||
CLEANRET:
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -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)
|
||||
*
|
||||
* param->waitserver64 non-zero: skip client socket polling (server→client 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.
|
||||
*/
|
||||
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,
|
||||
(char *)param->srvbuf + sendoff, sendlen, 0,
|
||||
(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) ||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
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
|
||||
|
||||
@ -379,7 +379,7 @@ void * adminchild(struct clientparam* param) {
|
||||
int limited = 0;
|
||||
|
||||
|
||||
limited =param->srv->singlepacket;
|
||||
limited =param->srv->s_option;
|
||||
pp.inbuf = 0;
|
||||
pp.cp = param;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user