mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1cc2c7c70 | ||
|
|
d88c927ba9 | ||
|
|
cf58e62baa | ||
|
|
daf4a56665 | ||
|
|
05bc297ea7 | ||
|
|
7ea9ec89be | ||
|
|
f23b6b0d96 | ||
|
|
d2dcf4bb69 | ||
|
|
1ff0fabf15 | ||
|
|
e013cc2ab8 | ||
|
|
99a744abda | ||
|
|
062d60e9d6 | ||
|
|
b777ffec66 | ||
|
|
8a2050e7fa | ||
|
|
9fbb88238e | ||
|
|
36f8cde2fb | ||
|
|
f64cd475af | ||
|
|
a29d2ab66b |
No files matched your search
@@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,9,1,201113
|
||||
PRODUCTVERSION 0,9,1,201113
|
||||
FILEVERSION 0,9,2,201122
|
||||
PRODUCTVERSION 0,9,2,201122
|
||||
FILETYPE 1
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
@@ -14,12 +14,12 @@ BEGIN
|
||||
VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.org/\0"
|
||||
VALUE "CompanyName", "Vladimir Dubrovin\0"
|
||||
VALUE "FileDescription", "3proxy - tiny proxy server\0"
|
||||
VALUE "FileVersion", "0.9.1\0"
|
||||
VALUE "FileVersion", "0.9.2\0"
|
||||
VALUE "InternalName", "3proxy\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2002-2020 Vladimir Dubrovin\0"
|
||||
VALUE "OriginalFilename", "3proxy.exe\0"
|
||||
VALUE "ProductName", "3proxy\0"
|
||||
VALUE "ProductVersion", "0.9.1\0"
|
||||
VALUE "ProductVersion", "0.9.2\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -28,6 +28,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *~
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.FreeBSD
|
||||
|
||||
+2
-1
@@ -12,7 +12,7 @@ CC = gcc
|
||||
|
||||
CFLAGS = -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
|
||||
COUT = -o
|
||||
LN = gcc
|
||||
LN = $(CC)
|
||||
DCFLAGS =
|
||||
LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread
|
||||
DLFLAGS = -shared
|
||||
@@ -26,6 +26,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *~
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.Linux
|
||||
|
||||
+2
-1
@@ -11,7 +11,7 @@ BUILDDIR = ../bin/
|
||||
CC = cc
|
||||
CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
COUT = -o ./
|
||||
LN = cc
|
||||
LN = $(CC)
|
||||
LDFLAGS = -xO3
|
||||
DCFLAGS = -fPIC
|
||||
DLFLAGS = -shared
|
||||
@@ -25,6 +25,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *~
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.Solaris
|
||||
|
||||
@@ -12,7 +12,7 @@ BUILDDIR = ../bin/
|
||||
CC = gcc
|
||||
CFLAGS = -O2 -fno-strict-aliasing -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
COUT = -o ./
|
||||
LN = gcc
|
||||
LN = $(CC)
|
||||
LDFLAGS = -O3
|
||||
DCFLAGS = -fPIC
|
||||
DLFLAGS = -shared
|
||||
@@ -26,6 +26,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *~
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.Solaris-gcc
|
||||
|
||||
@@ -9,4 +9,7 @@ all:
|
||||
clean:
|
||||
@$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES)
|
||||
@cd src && $(MAKE) clean
|
||||
cd ..
|
||||
@$(AFTERCLEAN)
|
||||
|
||||
|
||||
+2
-1
@@ -12,7 +12,7 @@ BUILDDIR = ../bin/
|
||||
CC = clang
|
||||
CFLAGS = -O2 -fno-strict-aliasing -c -pthread -static -DWITH_STD_MALLOC -DNOIPV6
|
||||
COUT = -o
|
||||
LN = clang
|
||||
LN = $(CC)
|
||||
LDFLAGS = -O2 -fno-strict-aliasing -static -s
|
||||
DLFLAGS = -shared
|
||||
DLSUFFICS = .dll
|
||||
@@ -25,6 +25,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *.tmp
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.win
|
||||
|
||||
@@ -12,7 +12,7 @@ CC = mips-openwrt-linux-gcc
|
||||
|
||||
CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
|
||||
COUT = -o
|
||||
LN = mips-openwrt-linux-gcc
|
||||
LN = $(CC)
|
||||
DCFLAGS = -fPIC
|
||||
LDFLAGS = -O2 -fno-strict-aliasing -pthread -s
|
||||
DLFLAGS = -shared
|
||||
@@ -26,6 +26,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *~
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.openwrt-mips
|
||||
|
||||
+2
-1
@@ -13,7 +13,7 @@ CC = gcc
|
||||
# you may need -L/usr/pkg/lib for older NetBSD versions
|
||||
CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
COUT = -o
|
||||
LN = gcc
|
||||
LN = $(CC)
|
||||
LDFLAGS = -O2 -fno-strict-aliasing -pthread
|
||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
||||
# -ldl or -lld may be required for some platforms
|
||||
@@ -29,6 +29,7 @@ OBJSUFFICS = .o
|
||||
DEFINEOPTION = -D
|
||||
COMPFILES = *~
|
||||
REMOVECOMMAND = rm -f
|
||||
AFTERCLEAN = find src/ -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete
|
||||
TYPECOMMAND = cat
|
||||
COMPATLIBS =
|
||||
MAKEFILE = Makefile.unix
|
||||
|
||||
@@ -8,12 +8,15 @@ Devel branch - 3proxy 10
|
||||
|
||||
|
||||
Download:
|
||||
Binaries for released (master) versions (Windows, Linux):
|
||||
https://github.com/z3APA3A/3proxy/releases
|
||||
or
|
||||
https://3proxy.org/download/
|
||||
Binaries for devel version (Windows, Linux):
|
||||
https://3proxy.org/download/devel/
|
||||
Archive of old versions: https://github.com/z3APA3A/3proxy-archive
|
||||
|
||||
|
||||
Windows installation:
|
||||
|
||||
3proxy --install
|
||||
|
||||
installs and starts proxy as Windows service
|
||||
@@ -24,7 +27,7 @@ Archive of old versions: https://github.com/z3APA3A/3proxy-archive
|
||||
removes the service (should be stopped before via
|
||||
'net stop 3proxy').
|
||||
|
||||
To build in Linux install git and build-essential packages, use
|
||||
To build in Linux install git and build-essential packages, use
|
||||
|
||||
git clone https://github.com/z3apa3a/3proxy
|
||||
cd 3proxy
|
||||
@@ -32,8 +35,22 @@ ln -s Makefile.Linux Makefile
|
||||
make
|
||||
sudo make install
|
||||
|
||||
use /etc/3proxy/add3proxyuser.sh script to add users.
|
||||
Default configuration (for Linux/Unix):
|
||||
3proxy uses 2 configuration files:
|
||||
/etc/3proxy/3proxy.cfg (before-chroot). This configuration file is executed before chroot and should not be modified.
|
||||
/usr/local/3proxy/conf/3proxy.cfg symlinked from /etc/3proxy/conf/3proxy.cfg (after-chroot) is a main configuration file. Modify this file, if required.
|
||||
All paths in /usr/local/3proxy/conf/3proxy.cfg are relative to chroot directory (/usr/local/3proxy). For future versions it's planned to move
|
||||
3proxy chroot direcory to /var.
|
||||
Log files are created in /usr/local/3proxy/logs symlinked from /var/log/3proxy.
|
||||
By default, socks is started on 0.0.0.0:1080 and proxy on 0.0.0.0:3128 with basic auth, no users are added by default.
|
||||
|
||||
use /etc/3proxy/conf/add3proxyuser.sh script to add users.
|
||||
|
||||
usage: /etc/3proxy/conf/add3proxyuser.sh username password [day_limit] [bandwidth]
|
||||
day_limit - traffic limit in MB per day
|
||||
bandwidth - bandwith in bits per second 1048576 = 1Mbps
|
||||
|
||||
or modify /etc/3proxy/conf/ files directly.
|
||||
|
||||
Please read doc/html/index.html and man pages.
|
||||
|
||||
@@ -189,7 +206,6 @@ mycrypt Program to obtain crypted password fro cleartext. Supports
|
||||
produces NT password
|
||||
mycrypt salt password
|
||||
produces MD5/crypt password with salt "salt".
|
||||
dighosts Utility for building networks list from web page.
|
||||
|
||||
|
||||
Run utility with --help option for command line reference.
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
<a href="highload.html">Optimizing 3proxy for high loads</a><br>
|
||||
<a href="howtoe.html">How To (English, very incomplete)</a><br>
|
||||
<a href="howtor.html">How To (Russian)</a><br>
|
||||
<a href="faqe.html">FAQ (English)</a><br>
|
||||
<a href="faqr.html">FAQ (Russian)</a>
|
||||
<h3>Man pages:</h>
|
||||
<br><A HREF="man8/3proxy.8.html">3proxy.8</A>
|
||||
<br><A HREF="man8/ftppr.8.html">ftppr.8</A>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
3proxy (0.9.1-1) buster; urgency=medium
|
||||
3proxy (0.9.2-1) buster; urgency=medium
|
||||
|
||||
*3proxy 0.9.1 initial build
|
||||
*3proxy 0.9.2 initial build
|
||||
|
||||
-- z3APA3A <3apa3a@3proxy.org> Thu, 12 Nov 2020 12:12:12 +0300
|
||||
-- z3APA3A <3apa3a@3proxy.org> Thu, 19 Nov 2020 19:19:19 +0300
|
||||
|
||||
@@ -11,5 +11,6 @@ override_dh_auto_clean:
|
||||
find src/ -type f -name "*.o" -delete
|
||||
find src/ -type f -name "Makefile.var" -delete
|
||||
find bin/ -type f -executable -delete
|
||||
rm -f Makefile
|
||||
|
||||
override_dh_usrlocal:
|
||||
+15
-2
@@ -1,5 +1,5 @@
|
||||
Name: 3proxy
|
||||
Version: 0.9.1
|
||||
Version: 0.9.2
|
||||
Release: 0
|
||||
Summary: 3proxy tiny proxy server
|
||||
License: GPL/LGPL/Apache/BSD
|
||||
@@ -20,7 +20,7 @@ ln -s Makefile.Linux Makefile
|
||||
make
|
||||
|
||||
%install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
make DESTDIR=%buildroot install
|
||||
|
||||
%clean
|
||||
make clean
|
||||
@@ -47,6 +47,18 @@ make clean
|
||||
/usr/local/3proxy/libexec/StringsPlugin.ld.so
|
||||
/usr/local/3proxy/libexec/TrafficPlugin.ld.so
|
||||
/usr/local/3proxy/libexec/TransparentPlugin.ld.so
|
||||
%if "%{_arch}" == "arm"
|
||||
/usr/share/man/man3/3proxy.cfg.3
|
||||
/usr/share/man/man8/3proxy.8
|
||||
/usr/share/man/man8/ftppr.8
|
||||
/usr/share/man/man8/icqpr.8
|
||||
/usr/share/man/man8/pop3p.8
|
||||
/usr/share/man/man8/proxy.8
|
||||
/usr/share/man/man8/smtpp.8
|
||||
/usr/share/man/man8/socks.8
|
||||
/usr/share/man/man8/tcppm.8
|
||||
/usr/share/man/man8/udppm.8
|
||||
%else
|
||||
/usr/share/man/man3/3proxy.cfg.3.gz
|
||||
/usr/share/man/man8/3proxy.8.gz
|
||||
/usr/share/man/man8/ftppr.8.gz
|
||||
@@ -57,6 +69,7 @@ make clean
|
||||
/usr/share/man/man8/socks.8.gz
|
||||
/usr/share/man/man8/tcppm.8.gz
|
||||
/usr/share/man/man8/udppm.8.gz
|
||||
%endif
|
||||
/var/log/3proxy
|
||||
|
||||
%doc doc/*
|
||||
|
||||
+1
-1
@@ -509,7 +509,7 @@ static void initbandlims (struct clientparam *param){
|
||||
param->bandlimfunc = NULL;
|
||||
param->bandlims[0] = NULL;
|
||||
param->bandlimsout[0] = NULL;
|
||||
if(!param->bandlimfunc || (!conf.bandlimiter && !conf.bandlimiterout)) return;
|
||||
if(!conf.bandlimfunc || (!conf.bandlimiter && !conf.bandlimiterout)) return;
|
||||
for(i=0, be = conf.bandlimiter; be && i<MAXBANDLIMS; be = be->next) {
|
||||
if(ACLmatches(be->ace, param)){
|
||||
if(be->ace->action == NOBANDLIM) {
|
||||
|
||||
@@ -286,8 +286,6 @@ void random_vector(uint8_t *vector, struct clientparam *param)
|
||||
}
|
||||
|
||||
|
||||
static float timeout = 5;
|
||||
|
||||
typedef struct radius_packet_t {
|
||||
uint8_t code;
|
||||
uint8_t id;
|
||||
|
||||
+2
-2
@@ -1335,12 +1335,12 @@ static int h_radius(int argc, unsigned char **argv){
|
||||
strcpy(radiussecret, argv[1]);
|
||||
for( nradservers=0; nradservers < MAXRADIUS && nradservers < argc -2; nradservers++){
|
||||
char *s = 0;
|
||||
if(strchr(argv[nradservers + 2], '/')){
|
||||
if((s=strchr(argv[nradservers + 2], '/'))){
|
||||
*s = 0;
|
||||
s++;
|
||||
}
|
||||
if( !getip46(46, argv[nradservers + 2], (struct sockaddr *)&radiuslist[nradservers].authaddr)) return 1;
|
||||
if( s && !getip46(46, s, (struct sockaddr *)&radiuslist[nradservers].localaddr)) return 2;
|
||||
if( s && !getip46(46, s+1, (struct sockaddr *)&radiuslist[nradservers].localaddr)) return 2;
|
||||
if(!*SAPORT(&radiuslist[nradservers].authaddr))*SAPORT(&radiuslist[nradservers].authaddr) = htons(1812);
|
||||
port = ntohs(*SAPORT(&radiuslist[nradservers].authaddr));
|
||||
radiuslist[nradservers].logaddr = radiuslist[nradservers].authaddr;
|
||||
|
||||
@@ -577,7 +577,7 @@ static int WINAPI fp_sendto(SOCKET s, const void *msg, int len, int flags, const
|
||||
case GOT_FTP_CLIDATA:
|
||||
case GOT_FTP_SRVDATA:
|
||||
case GOT_HTTP_CLIDATA:
|
||||
if((!fps->what & FP_CLIDATA)) break;
|
||||
if(!(fps->what & FP_CLIDATA)) break;
|
||||
#ifdef _WIN32
|
||||
if(SetFilePointer(fps->fpd.h_cli, fps->clientwritten + fps->clihdrwritten, 0, FILE_BEGIN) != (fps->clientwritten + fps->clihdrwritten)){
|
||||
return -1;
|
||||
|
||||
@@ -351,7 +351,7 @@ static struct commands pcre_commandhandlers[] = {
|
||||
static struct symbol regexp_symbols[] = {
|
||||
{regexp_symbols+1, "pcre_compile", (void*) pcre_compile},
|
||||
{regexp_symbols+2, "pcre_exec", (void*) pcre_exec},
|
||||
{NULL, "pcre_free", NULL},
|
||||
{NULL, "pcre_options", (void *)&pcre_options},
|
||||
};
|
||||
|
||||
#ifdef WATCOM
|
||||
@@ -371,8 +371,7 @@ PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
|
||||
pcre_free = pl->freefunc;
|
||||
pcre_loaded = 1;
|
||||
pthread_mutex_init(&pcre_mutex, NULL);
|
||||
regexp_symbols[6].value = pl->freefunc;
|
||||
regexp_symbols[6].next = pl->symbols.next;
|
||||
regexp_symbols[2].next = pl->symbols.next;
|
||||
pl->symbols.next = regexp_symbols;
|
||||
pcre_commandhandlers[3].next = pl->commandhandlers->next;
|
||||
pl->commandhandlers->next = pcre_commandhandlers;
|
||||
|
||||
@@ -52,14 +52,14 @@ static size_t bin2hex (const unsigned char* bin, size_t bin_length, char* str, s
|
||||
char *p;
|
||||
size_t i;
|
||||
|
||||
if ( str_length < ( bin_length+1) )
|
||||
if ( str_length < ( (bin_length*2)+1) )
|
||||
return 0;
|
||||
|
||||
p = str;
|
||||
for ( i=0; i < bin_length; ++i )
|
||||
{
|
||||
*p++ = hexMap[*bin >> 4];
|
||||
*p++ = hexMap[*bin & 0xf];
|
||||
*p++ = hexMap[(*(unsigned char *)bin) >> 4];
|
||||
*p++ = hexMap[(*(unsigned char *)bin) & 0xf];
|
||||
++bin;
|
||||
}
|
||||
|
||||
@@ -115,10 +115,18 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
||||
unsigned char p2[] = "3proxy";
|
||||
unsigned char p3[] = "3proxy CA";
|
||||
|
||||
char hash_name_sha1[sizeof(src_cert->sha1_hash)*2 + 1];
|
||||
char cache_name[200];
|
||||
int hash_size = 20;
|
||||
char hash_sha1[20];
|
||||
char hash_name_sha1[(20*2) + 1];
|
||||
char cache_name[256];
|
||||
|
||||
bin2hex(src_cert->sha1_hash, sizeof(src_cert->sha1_hash), hash_name_sha1, sizeof(hash_name_sha1));
|
||||
err = X509_digest(src_cert, EVP_sha1(), hash_sha1, NULL);
|
||||
if(!err){
|
||||
X509_free(dst_cert);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bin2hex(hash_sha1, 20, hash_name_sha1, sizeof(hash_name_sha1));
|
||||
sprintf(cache_name, "%s%s.pem", cert_path, hash_name_sha1);
|
||||
/* check if certificate is already cached */
|
||||
fcache = fopen(cache_name, "rb");
|
||||
@@ -153,19 +161,11 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
||||
}
|
||||
|
||||
|
||||
/* Its self signed so set the issuer name to be the same as the
|
||||
* subject.
|
||||
*/
|
||||
err = X509_set_issuer_name(dst_cert, name);
|
||||
if(!err){
|
||||
X509_free(dst_cert);
|
||||
return NULL;
|
||||
}
|
||||
err = X509_digest(dst_cert, EVP_sha1(), dst_cert->sha1_hash, NULL);
|
||||
if(!err){
|
||||
X509_free(dst_cert);
|
||||
return NULL;
|
||||
}
|
||||
err = X509_sign(dst_cert, CA_key, EVP_sha256());
|
||||
if(!err){
|
||||
X509_free(dst_cert);
|
||||
|
||||
@@ -56,6 +56,7 @@ struct SSLqueue {
|
||||
*/
|
||||
static struct SSLqueue *searchSSL(SOCKET s){
|
||||
struct SSLqueue *sslq = NULL;
|
||||
|
||||
pthread_mutex_lock(&ssl_mutex);
|
||||
for(sslq = SSLq; sslq; sslq = sslq->next)
|
||||
if(sslq->s == s) break;
|
||||
@@ -65,19 +66,21 @@ static struct SSLqueue *searchSSL(SOCKET s){
|
||||
|
||||
static void addSSL(SOCKET s, SSL_CERT cert, SSL_CONN conn, struct clientparam* param){
|
||||
struct SSLqueue *sslq;
|
||||
|
||||
sslq = (struct SSLqueue *) malloc(sizeof(struct SSLqueue));
|
||||
sslq->s = s;
|
||||
sslq->cert = cert;
|
||||
sslq->conn = conn;
|
||||
sslq->param = param;
|
||||
pthread_mutex_lock(&ssl_mutex);
|
||||
sslq->next = SSLq;
|
||||
sslq->param = param;
|
||||
SSLq = sslq;
|
||||
pthread_mutex_unlock(&ssl_mutex);
|
||||
}
|
||||
|
||||
int delSSL(SOCKET s){
|
||||
struct SSLqueue *sqi, *sqt = NULL;
|
||||
|
||||
if(!SSLq) return 0;
|
||||
pthread_mutex_lock(&ssl_mutex);
|
||||
if(SSLq){
|
||||
@@ -113,13 +116,15 @@ static int ssl_send(SOCKET s, const void *msg, size_t len, int flags){
|
||||
struct SSLqueue *sslq;
|
||||
|
||||
if ((sslq = searchSSL(s))){
|
||||
int i=0, res, err;
|
||||
do {
|
||||
if((res = ssl_write(sslq->conn, (void *)msg, len)) < 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
usleep(10*SLEEPTIME);
|
||||
int res, err;
|
||||
if((res = ssl_write(sslq->conn, (void *)msg, len)) <= 0){
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
if (err == SSL_ERROR_WANT_WRITE){
|
||||
_set_errno(EAGAIN);
|
||||
return -1;
|
||||
}
|
||||
} while (res < 0 && (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) && ++i < 100);
|
||||
else _set_errno(err);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -135,13 +140,15 @@ static int ssl_sendto(SOCKET s, const void *msg, size_t len, int flags, const st
|
||||
struct SSLqueue *sslq;
|
||||
|
||||
if ((sslq = searchSSL(s))){
|
||||
int i=0, res, err;
|
||||
do {
|
||||
if((res = ssl_write(sslq->conn, (void *)msg, len)) < 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
usleep(10*SLEEPTIME);
|
||||
int res, err;
|
||||
if((res = ssl_write(sslq->conn, (void *)msg, len)) <= 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
if (err == SSL_ERROR_WANT_WRITE){
|
||||
_set_errno(EAGAIN);
|
||||
return -1;
|
||||
}
|
||||
} while (res < 0 && (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) && ++i < 100);
|
||||
else _set_errno(err);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -156,16 +163,17 @@ static int ssl_recvfrom(SOCKET s, void *msg, size_t len, int flags, struct socka
|
||||
struct SSLqueue *sslq;
|
||||
|
||||
if ((sslq = searchSSL(s))){
|
||||
int i=0, res, err;
|
||||
do {
|
||||
if((res = ssl_read(sslq->conn, (void *)msg, len)) < 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
usleep(10*SLEEPTIME);
|
||||
int res, err;
|
||||
if((res = ssl_read(sslq->conn, (void *)msg, len)) <= 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
if (err == SSL_ERROR_WANT_READ) {
|
||||
_set_errno(EAGAIN);
|
||||
return -1;
|
||||
}
|
||||
} while (res < 0 && (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) && ++i < 100);
|
||||
else _set_errno(err);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return sso._recvfrom(s, msg, len, flags, from, fromlen);
|
||||
}
|
||||
|
||||
@@ -177,13 +185,15 @@ static int WINAPI ssl_recv(SOCKET s, void *msg, size_t len, int flags){
|
||||
struct SSLqueue *sslq;
|
||||
|
||||
if ((sslq = searchSSL(s))){
|
||||
int i=0, res, err;
|
||||
do {
|
||||
if((res = ssl_read(sslq->conn, (void *)msg, len)) < 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
usleep(10*SLEEPTIME);
|
||||
int res, err;
|
||||
if((res = ssl_read(sslq->conn, (void *)msg, len)) <= 0) {
|
||||
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
|
||||
if (err == SSL_ERROR_WANT_READ) {
|
||||
_set_errno(EAGAIN);
|
||||
return -1;
|
||||
}
|
||||
} while (res < 0 && (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) && ++i < 100);
|
||||
else _set_errno(err);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
+26
-7
@@ -537,17 +537,28 @@ for(;;){
|
||||
RETURN(0);
|
||||
}
|
||||
if(action != PASS) RETURN(517);
|
||||
if(param->ndatfilterscli > 0 && contentlength64 > 0){
|
||||
param->nolongdatfilter = 0;
|
||||
|
||||
|
||||
if (conf.filtermaxsize && contentlength64 > (uint64_t)conf.filtermaxsize) {
|
||||
param->nolongdatfilter = 1;
|
||||
}
|
||||
else if(param->ndatfilterscli > 0 && contentlength64 > 0){
|
||||
uint64_t newlen64;
|
||||
newlen64 = sockfillbuffcli(param, (unsigned long)contentlength64, CONNECTION_S);
|
||||
if(newlen64 == contentlength64) {
|
||||
action = handlepredatflt(param);
|
||||
if(action == HANDLED){
|
||||
RETURN(0);
|
||||
}
|
||||
if(action != PASS) RETURN(19);
|
||||
action = handledatfltcli(param, ¶m->clibuf, (int *)¶m->clibufsize, 0, (int *)¶m->cliinbuf);
|
||||
if(action == HANDLED){
|
||||
RETURN(0);
|
||||
}
|
||||
if(action != PASS) RETURN(517);
|
||||
contentlength64 = param->cliinbuf;
|
||||
param->ndatfilterscli = 0;
|
||||
param->nolongdatfilter = 1;
|
||||
}
|
||||
sprintf((char*)buf+strlen((char *)buf), "Content-Length: %"PRINTF_INT64_MODIFIER"u\r\n", contentlength64);
|
||||
}
|
||||
@@ -805,12 +816,16 @@ for(;;){
|
||||
if(isconnect && param->redirtype != R_HTTP) {
|
||||
socksend(param->clisock, (unsigned char *)proxy_stringtable[8], (int)strlen(proxy_stringtable[8]), conf.timeouts[STRING_S]);
|
||||
if(param->redirectfunc) {
|
||||
if(req)myfree(req);
|
||||
if(buf)myfree(buf);
|
||||
|
||||
if(req)myfree(req);
|
||||
if(buf)myfree(buf);
|
||||
return (*param->redirectfunc)(param);
|
||||
}
|
||||
param->res = mapsocket(param, conf.timeouts[CONNECTION_L]);
|
||||
if(param->redirectfunc) {
|
||||
if(req)myfree(req);
|
||||
if(buf)myfree(buf);
|
||||
return (*param->redirectfunc)(param);
|
||||
}
|
||||
RETURN(param->res);
|
||||
}
|
||||
|
||||
@@ -882,7 +897,6 @@ for(;;){
|
||||
sleeptime = param->bandlimfunc(param, 0, (int)strlen((char *)buf));
|
||||
}
|
||||
if(contentlength64 > 0){
|
||||
param->nolongdatfilter = 0;
|
||||
param->waitclient64 = contentlength64;
|
||||
res = mapsocket(param, conf.timeouts[CONNECTION_S]);
|
||||
param->waitclient64 = 0;
|
||||
@@ -985,10 +999,15 @@ for(;;){
|
||||
if (conf.filtermaxsize && contentlength64 > (uint64_t)conf.filtermaxsize) {
|
||||
param->nolongdatfilter = 1;
|
||||
}
|
||||
else if(param->unsafefilter && param->ndatfilterssrv > 0 && contentlength64 > 0 && param->operation != HTTP_HEAD && res != 204 && res != 304){
|
||||
else if(param->ndatfilterssrv > 0 && contentlength64 > 0 && param->operation != HTTP_HEAD && res != 204 && res != 304){
|
||||
uint64_t newlen;
|
||||
newlen = (uint64_t)sockfillbuffsrv(param, (unsigned long) contentlength64, CONNECTION_S);
|
||||
if(newlen == contentlength64) {
|
||||
action = handlepredatflt(param);
|
||||
if(action == HANDLED){
|
||||
RETURN(0);
|
||||
}
|
||||
if(action != PASS) RETURN(19);
|
||||
action = handledatfltsrv(param, ¶m->srvbuf, (int *)¶m->srvbufsize, 0, (int *)¶m->srvinbuf);
|
||||
param->nolongdatfilter = 1;
|
||||
if(action == HANDLED){
|
||||
|
||||
+2
-1
@@ -58,10 +58,12 @@ void * threadfunc (void *p) {
|
||||
}
|
||||
else {
|
||||
|
||||
#ifndef WITHMAIN
|
||||
#ifndef _WIN32
|
||||
sigset_t mask;
|
||||
sigfillset(&mask);
|
||||
if(param->srv->service != S_UDPPM)pthread_sigmask(SIG_SETMASK, &mask, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
((struct clientparam *) p)->srv->pf((struct clientparam *)p);
|
||||
@@ -337,7 +339,6 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
fp = fopen(argv[i] + 2, "a");
|
||||
if (fp) {
|
||||
srv.stdlog = fp;
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ int sockmap(struct clientparam * param, int timeo, int usesplice){
|
||||
int pipesrv[2] = {-1,-1};
|
||||
int pipecli[2] = {-1,-1};
|
||||
|
||||
if(param->operation == UDPASSOC) usesplice = 0;
|
||||
if(param->operation == UDPASSOC || (!param->nolongdatfilter && (param->ndatfilterscli > 0 || param->ndatfilterssrv))) usesplice = 0;
|
||||
if(usesplice){
|
||||
TOCLIENTPIPE = FROMCLIENTPIPE = TOSERVERPIPE = FROMSERVERPIPE = 1;
|
||||
TOCLIENTBUF = TOSERVERBUF = 0;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#ifndef VERSION
|
||||
#define VERSION "3proxy-0.9.1"
|
||||
#define VERSION "3proxy-0.9.2"
|
||||
#endif
|
||||
#ifndef BUILDDATE
|
||||
#define BUILDDATE ""
|
||||
|
||||
Reference in new issue
Block a user