Compare commits

...
39 Commits
Author SHA1 Message Date
z3APA3A 0c902525e5 commit as 0.9.3 2020-12-03 21:14:59 +03:00
z3APA3A 129d26475e Fixed: counters incorectly shown in webadmin, contall/nocountall are not applied 2020-12-02 20:08:03 +03:00
z3APA3A 29f8867a9e fix the compilation warning 2020-12-02 11:13:55 +03:00
z3APA3A 252c4cb36b set 1 for release in specs 2020-12-01 18:20:13 +03:00
z3APA3A 07603ceea7 & is not required for systemd 2020-12-01 11:19:43 +03:00
z3APA3A 8ec14c131d Do not fail on clean 2020-11-29 14:00:19 +03:00
z3APA3A 1225dbced7 hostname (%n) may by incomlete in log on long record 2020-11-29 12:47:58 +03:00
z3APA3A 3cd9bdffcb Update README for docker images 2020-11-28 03:18:11 +03:00
z3APA3A 336a4acd46 Update dockerfiles 2020-11-28 02:45:36 +03:00
z3APA3A c5abe51e26 fix adding proxy account 2020-11-27 19:36:21 +03:00
z3APA3A 31062bdc3c Create Dockerfile.minimal 2020-11-27 15:49:13 +03:00
z3APA3A 8943099dfb extip parent type documented 2020-11-27 15:48:59 +03:00
z3APA3A 09f007e741 http supported in parent name resolution 2020-11-25 17:09:54 +03:00
z3APA3A 4487fd4a73 typo corrected 2020-11-25 17:06:06 +03:00
z3APA3A 5498a79115 add builddate (if defined) to rc 2020-11-24 20:43:30 +03:00
z3APA3A 9c7fc9fddc correct clean 2020-11-24 20:05:49 +03:00
z3APA3A 4d63f957c2 Fix for connect back 2020-11-23 18:58:33 +03:00
z3APA3A 828e00e668 correct afterclean 2020-11-22 02:15:42 +03:00
z3APA3A 3ba16310c5 del res files in afterclean 2020-11-22 02:15:24 +03:00
z3APA3A 7aaa9c18dd build rc file from res 2020-11-22 02:14:53 +03:00
z3APA3A 72923879a3 Make rc file non-version specific 2020-11-21 18:36:39 +03:00
z3APA3A b1cc2c7c70 Label as 0.9.2 2020-11-21 11:27:43 +03:00
z3APA3A d88c927ba9 allow overwrite CC for linking 2020-11-20 14:19:47 +03:00
z3APA3A cf58e62baa rm makefile on clean 2020-11-20 13:49:17 +03:00
z3APA3A daf4a56665 Remove .o and binaries after clean 2020-11-20 13:30:38 +03:00
z3APA3A 05bc297ea7 Fixed SSLPlugin handling 2020-11-19 23:22:15 +03:00
z3APA3A 7ea9ec89be update changelog and spec for 0.9.2 2020-11-19 10:39:37 +03:00
z3APA3A f23b6b0d96 export pcre_options 2020-11-19 02:52:47 +03:00
z3APA3A d2dcf4bb69 better dat filters handling 2020-11-19 02:30:19 +03:00
z3APA3A 1ff0fabf15 switching version to 0.9.2 2020-11-18 18:45:32 +03:00
z3APA3A e013cc2ab8 remove unneeded fseek 2020-11-18 17:55:23 +03:00
z3APA3A 99a744abda Few bugfixes 2020-11-18 16:10:07 +03:00
z3APA3A 062d60e9d6 README updated 2020-11-17 12:45:44 +03:00
z3APA3A b777ffec66 RH man handling is arch dependant 2020-11-13 21:00:28 +03:00
z3APA3A 8a2050e7fa remove FAQ from index 2020-11-13 19:58:55 +03:00
z3APA3A 9fbb88238e support cross building 2020-11-13 19:50:39 +03:00
z3APA3A 36f8cde2fb remove unused float variable 2020-11-13 11:39:13 +03:00
z3APA3A f64cd475af Do not set sigmask for thread in standalone service 2020-11-13 11:01:14 +03:00
z3APA3A a29d2ab66b readme update 2020-11-13 03:20:37 +03:00
42 changed files with 399 additions and 178 deletions

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
# 3proxy.full is fully functional 3proxy build based on busibox:glibc
#
#to build:
# docker build -f Dockerfile.full -t 3proxy.full .
#to run:
# by default 3proxy uses safe chroot environment with chroot to /usr/local/3proxy with uid/gid 65535/65535 and expects
# configuration file to be placed in /usr/local/etc/3proxy.
# Paths in configuration file must be relative to /usr/local/3proxy, that is use /logs instead of
# /usr/local/3proxy/logs. nserver in chroot is required for DNS resolution. An example:
#
# echo nserver 8.8.8.8 >/path/to/local/config/directory/3proxy.cfg
# echo proxy -p3129 >>/path/to/local/config/directory/3proxy.cfg
# docker run -p 3129:3129 -v /path/to/local/config/directory:/usr/local/3proxy/conf -name 3proxy.full 3proxy.full
#
# /path/to/local/config/directory in this example must conrain 3proxy.cfg
# if you need 3proxy to be executed without chroot with root permissions, replace /etc/3proxy/3proxy.cfg by e.g. mounting config
# dir to /etc/3proxy ot by providing config file /etc/3proxy/3proxy.cfg
# docker run -p 3129:3129 -v /path/to/local/config/directory:/etc/3proxy -name 3proxy.full 3proxy.full
#
# use "log" without pathname in config to log to stdout.
# plugins are located in /usr/local/3proxy/libexec (/libexec for chroot config).
FROM gcc AS buildenv
COPY . 3proxy
RUN cd 3proxy &&\
echo "">> Makefile.Linux &&\
echo PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin SSLPlugin>>Makefile.Linux &&\
echo LIBS = -l:libcrypto.a -l:libssl.a -ldl >>Makefile.Linux &&\
make -f Makefile.Linux &&\
strip bin/3proxy &&\
strip bin/StringsPlugin.ld.so &&\
strip bin/TrafficPlugin.ld.so &&\
strip bin/PCREPlugin.ld.so &&\
strip bin/TransparentPlugin.ld.so &&\
strip bin/SSLPlugin.ld.so
FROM busybox:glibc
COPY --from=buildenv /lib/x86_64-linux-gnu/libdl.so.* /lib/
COPY --from=buildenv 3proxy/bin/3proxy /bin/
COPY --from=buildenv 3proxy/bin/*.ld.so /usr/local/3proxy/libexec/
RUN mkdir /usr/local/3proxy/logs &&\
mkdir /usr/local/3proxy/conf &&\
chown -R 65535:65535 /usr/local/3proxy &&\
chmod -R 550 /usr/local/3proxy &&\
chmod 750 /usr/local/3proxy/logs &&\
chmod -R 555 /usr/local/3proxy/libexec &&\
chown -R root /usr/local/3proxy/libexec &&\
mkdir /etc/3proxy/ &&\
echo chroot /usr/local/3proxy 65535 65535 >/etc/3proxy/3proxy.cfg &&\
echo include /conf/3proxy.cfg >>/etc/3proxy/3proxy.cfg &&\
chmod 440 /etc/3proxy/3proxy.cfg
CMD ["/bin/3proxy", "/etc/3proxy/3proxy.cfg"]
+42
View File
@@ -0,0 +1,42 @@
# dockerfile for "interactive" minimal 3proxy execution, no configuration mounting is required, configuration
# is accepted from stdin. Use "end" command to indicate the end of configuration. Use "log" for stdout logging.
#
# This is busybox based docker with only 3proxy static executable and empty non-writable "run" directory.
#
# "plugin" is not supported
#
# Build:
#
# docker build -f Dockerfile.minimal -t 3proxy.minimal .
#
# Run example:
#
# docker run -i -p 3129:3129 --name 3proxy 3proxy.minimal
#or
# docker start -i 3proxy
#<chroot run 65535 65535
#<nserver 8.8.8.8
#<nscache 65535
#<log
#<proxy -p3129
#<end
#
# use "chroot run 65536 65536" in config for safe chroot environment. nserver is required for DNS resolutions in chroot.
FROM gcc AS buildenv
COPY . /3proxy
RUN cd /3proxy &&\
echo "">>Makefile.Linux&&\
echo LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread >>Makefile.Linux&&\
echo PLUGINS = >>Makefile.Linux&&\
echo LIBS = >>Makefile.Linux&&\
echo 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 -DNOPLUGINS >>Makefile.Linux&&\
make -f Makefile.Linux&&\
strip bin/3proxy
FROM busybox:glibc
COPY --from=buildenv /3proxy/bin/3proxy /bin/3proxy
RUN mkdir /run && chmod 555 /run
CMD ["/bin/3proxy"]
+1
View File
@@ -28,6 +28,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *~ COMPFILES = *~
REMOVECOMMAND = rm -f REMOVECOMMAND = rm -f
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.FreeBSD MAKEFILE = Makefile.FreeBSD
+2 -1
View File
@@ -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 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 COUT = -o
LN = gcc LN = $(CC)
DCFLAGS = DCFLAGS =
LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread LDFLAGS = -fPIE -O2 -fno-strict-aliasing -pthread
DLFLAGS = -shared DLFLAGS = -shared
@@ -26,6 +26,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *~ COMPFILES = *~
REMOVECOMMAND = rm -f REMOVECOMMAND = rm -f
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.Linux MAKEFILE = Makefile.Linux
+2 -1
View File
@@ -11,7 +11,7 @@ BUILDDIR = ../bin/
CC = cc CC = cc
CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL CFLAGS = -xO3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o ./ COUT = -o ./
LN = cc LN = $(CC)
LDFLAGS = -xO3 LDFLAGS = -xO3
DCFLAGS = -fPIC DCFLAGS = -fPIC
DLFLAGS = -shared DLFLAGS = -shared
@@ -25,6 +25,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *~ COMPFILES = *~
REMOVECOMMAND = rm -f REMOVECOMMAND = rm -f
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.Solaris MAKEFILE = Makefile.Solaris
+2 -1
View File
@@ -12,7 +12,7 @@ BUILDDIR = ../bin/
CC = gcc 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 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 ./ COUT = -o ./
LN = gcc LN = $(CC)
LDFLAGS = -O3 LDFLAGS = -O3
DCFLAGS = -fPIC DCFLAGS = -fPIC
DLFLAGS = -shared DLFLAGS = -shared
@@ -26,6 +26,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *~ COMPFILES = *~
REMOVECOMMAND = rm -f REMOVECOMMAND = rm -f
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.Solaris-gcc MAKEFILE = Makefile.Solaris-gcc
+4 -3
View File
@@ -3,10 +3,11 @@
# #
all: all:
$(TYPECOMMAND) $(MAKEFILE) > src/Makefile.var @$(TYPECOMMAND) $(MAKEFILE) > src/Makefile.var
@cd src && $(MAKE) @cd src && $(MAKE)
clean: clean:
@$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES) @cd src && $(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES) && cd ..
@cd src && $(MAKE) clean @$(AFTERCLEAN)
+2 -1
View File
@@ -12,7 +12,7 @@ BUILDDIR = ../bin/
CC = clang CC = clang
CFLAGS = -O2 -fno-strict-aliasing -c -pthread -static -DWITH_STD_MALLOC -DNOIPV6 CFLAGS = -O2 -fno-strict-aliasing -c -pthread -static -DWITH_STD_MALLOC -DNOIPV6
COUT = -o COUT = -o
LN = clang LN = $(CC)
LDFLAGS = -O2 -fno-strict-aliasing -static -s LDFLAGS = -O2 -fno-strict-aliasing -static -s
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .dll DLSUFFICS = .dll
@@ -25,6 +25,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *.tmp COMPFILES = *.tmp
REMOVECOMMAND = rm -f 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 TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.win MAKEFILE = Makefile.win
+6 -8
View File
@@ -24,23 +24,21 @@ EXESUFFICS = .exe
OBJSUFFICS = .obj OBJSUFFICS = .obj
DEFINEOPTION = /D DEFINEOPTION = /D
COMPFILES = *.pch *.idb COMPFILES = *.pch *.idb
REMOVECOMMAND = del 2>NUL >NUL REMOVECOMMAND = del
TYPECOMMAND = type TYPECOMMAND = type
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.msvc MAKEFILE = Makefile.msvc
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin
VERFILE = $(VERFILE) VERFILE = 3proxy.res $(VERFILE)
VERSION = $(VERSION) VERSION = $(VERSION)
VERSIONDEP = 3proxy.res $(VERSIONDEP)
BUILDDATE = $(BUILDDATE) BUILDDATE = $(BUILDDATE)
AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err)
include Makefile.inc include Makefile.inc
../3proxy.res: 3proxy.res:
rc /fo../3proxy.res ../3proxy.rc $(VERSION) $(BUILDDATE) rc 3proxy.rc
3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /MACHINE:I386 ../3proxy.res
allplugins: allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..) for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
+5 -10
View File
@@ -27,20 +27,15 @@ COMPFILES = *.pch *.idb
REMOVECOMMAND = del 2>NUL >NUL REMOVECOMMAND = del 2>NUL >NUL
TYPECOMMAND = type TYPECOMMAND = type
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.msvc64 VERFILE = 3proxy.res $(VERFILE)
VERSIONDEP = 3proxy.res $(VERSIONDEP)
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin
VERFILE = $(VERFILE) AFTERCLEAN = del src\*.res
#../3proxy.res:
# rc /fo../3proxy.res ../3proxy.rc
#3proxyres.obj: ../3proxy.res
# cvtres /out:3proxyres.obj /MACHINE:X64 ../3proxy.res
include Makefile.inc include Makefile.inc
../3proxy.res: 3proxy.res:
rc /fo../3proxy.res ../3proxy.rc $(VERSION) $(BUILDDATE) rc 3proxy.rc
3proxyres.obj: ../3proxy.res 3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /machine:x64 ../3proxy.res cvtres /out:3proxyres.obj /machine:x64 ../3proxy.res
+5 -8
View File
@@ -29,18 +29,15 @@ TYPECOMMAND = type
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.msvcARM64 MAKEFILE = Makefile.msvcARM64
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin
VERFILE = $(VERFILE) VERFILE = 3proxy.res $(VERFILE)
VERSIONDEP = 3proxy.res $(VERSIONDEP)
AFTERCLEAN = del src\*.res
#../3proxy.res:
# rc /fo../3proxy.res ../3proxy.rc
#3proxyres.obj: ../3proxy.res
# cvtres /out:3proxyres.obj /MACHINE:X64 ../3proxy.res
include Makefile.inc include Makefile.inc
../3proxy.res: 3proxy.res:
rc /fo../3proxy.res ../3proxy.rc $(VERSION) $(BUILDDATE) rc 3proxy.rc
3proxyres.obj: ../3proxy.res 3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /machine:x64 ../3proxy.res cvtres /out:3proxyres.obj /machine:x64 ../3proxy.res
+2 -1
View File
@@ -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 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 COUT = -o
LN = mips-openwrt-linux-gcc LN = $(CC)
DCFLAGS = -fPIC DCFLAGS = -fPIC
LDFLAGS = -O2 -fno-strict-aliasing -pthread -s LDFLAGS = -O2 -fno-strict-aliasing -pthread -s
DLFLAGS = -shared DLFLAGS = -shared
@@ -26,6 +26,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *~ COMPFILES = *~
REMOVECOMMAND = rm -f REMOVECOMMAND = rm -f
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.openwrt-mips MAKEFILE = Makefile.openwrt-mips
+2 -1
View File
@@ -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 = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o COUT = -o
LN = gcc LN = $(CC)
LDFLAGS = -O2 -fno-strict-aliasing -pthread LDFLAGS = -O2 -fno-strict-aliasing -pthread
# -lpthreads may be reuqired on some platforms instead of -pthreads # -lpthreads may be reuqired on some platforms instead of -pthreads
# -ldl or -lld may be required for some platforms # -ldl or -lld may be required for some platforms
@@ -29,6 +29,7 @@ OBJSUFFICS = .o
DEFINEOPTION = -D DEFINEOPTION = -D
COMPFILES = *~ COMPFILES = *~
REMOVECOMMAND = rm -f REMOVECOMMAND = rm -f
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.unix MAKEFILE = Makefile.unix
+35 -6
View File
@@ -30,14 +30,43 @@ COMPATLIBS =
MAKEFILE = Makefile.watcom MAKEFILE = Makefile.watcom
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin
VERFILE = $(VERFILE) VERFILE = $(VERFILE)
VERSION = $(VERSION)
VERSIONDEP = 3proxy.res $(VERSIONDEP)
BUILDDATE = $(BUILDDATE)
include Makefile.inc include Makefile.inc
../3proxy.res: 3proxy.res:
rc /fo../3proxy.res ../3proxy.rc $(VERSION) $(BUILDDATE) rc 3proxy.rc
3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj ../3proxy.res
allplugins: allplugins:
call ../makeplugins.bat copy Makefile plugins\utf8tocp1251
copy Makefile.var plugins\utf8tocp1251
cd plugins\utf8tocp1251
nmake
del *.obj *.idb
cd ../../
copy Makefile plugins\WindowsAuthentication
copy Makefile.var plugins\WindowsAuthentication
cd plugins\WindowsAuthentication
nmake
del *.obj *.idb
cd ../../
copy Makefile plugins\TrafficPlugin
copy Makefile.var plugins\TrafficPlugin
cd plugins\TrafficPlugin
nmake
del *.obj *.idb
cd ../../
copy Makefile plugins\StringsPlugin
copy Makefile.var plugins\StringsPlugin
cd plugins\StringsPlugin
nmake
del *.obj *.idb
cd ../../
copy Makefile plugins\PCREPlugin
copy Makefile.var plugins\PCREPlugin
cd plugins\PCREPlugin
nmake
del *.obj *.idb
cd ../../
+23 -5
View File
@@ -8,12 +8,17 @@ Devel branch - 3proxy 10
Download: Download:
Binaries for released (master) versions (Windows, Linux):
https://github.com/z3APA3A/3proxy/releases https://github.com/z3APA3A/3proxy/releases
or Binaries for devel version (Windows, Linux):
https://3proxy.org/download/ https://3proxy.org/download/devel/
Docker images:
https://hub.docker.com/repository/docker/3proxy/3proxy
Archive of old versions: https://github.com/z3APA3A/3proxy-archive Archive of old versions: https://github.com/z3APA3A/3proxy-archive
Windows installation:
3proxy --install 3proxy --install
installs and starts proxy as Windows service installs and starts proxy as Windows service
@@ -24,7 +29,7 @@ Archive of old versions: https://github.com/z3APA3A/3proxy-archive
removes the service (should be stopped before via removes the service (should be stopped before via
'net stop 3proxy'). '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 git clone https://github.com/z3apa3a/3proxy
cd 3proxy cd 3proxy
@@ -32,8 +37,22 @@ ln -s Makefile.Linux Makefile
make make
sudo make install 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. Please read doc/html/index.html and man pages.
@@ -189,7 +208,6 @@ mycrypt Program to obtain crypted password fro cleartext. Supports
produces NT password produces NT password
mycrypt salt password mycrypt salt password
produces MD5/crypt password with salt "salt". 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. Run utility with --help option for command line reference.
+1
View File
@@ -0,0 +1 @@
0.9.3
+1 -1
View File
@@ -465,7 +465,7 @@ proxy -p8080 -i192.168.2.1
</p> </p>
<li><a name="NAMES">How to resolve names through a parent proxy</a></li> <li><a name="NAMES">How to resolve names through a parent proxy</a></li>
<p> <p>
<i>A:</i> Use one of connect+, socks4+ ¨ socks5+ as a parent type. 3proxy <i>A:</i> Use one of proxy, connect+, socks4+ or socks5+ as a parent type. 3proxy
itself still performs a name resolution, it's required e.g. to ACLs matching. itself still performs a name resolution, it's required e.g. to ACLs matching.
So, if no name resolution must be performed by 3proxy itself add a command So, if no name resolution must be performed by 3proxy itself add a command
<pre> <pre>
-2
View File
@@ -3,8 +3,6 @@
<a href="highload.html">Optimizing 3proxy for high loads</a><br> <a href="highload.html">Optimizing 3proxy for high loads</a><br>
<a href="howtoe.html">How To (English, very incomplete)</a><br> <a href="howtoe.html">How To (English, very incomplete)</a><br>
<a href="howtor.html">How To (Russian)</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> <h3>Man pages:</h>
<br><A HREF="man8/3proxy.8.html">3proxy.8</A> <br><A HREF="man8/3proxy.8.html">3proxy.8</A>
<br><A HREF="man8/ftppr.8.html">ftppr.8</A> <br><A HREF="man8/ftppr.8.html">ftppr.8</A>
+4 -2
View File
@@ -682,14 +682,16 @@ connections. These 2 proxies form 1 group (summarized weight is 1000).
.br .br
creates chain of 3 proxies: 192.168.10.1, 192.168.20.1 and third creates chain of 3 proxies: 192.168.10.1, 192.168.20.1 and third
is (192.168.30.1 with probability of 0.3 or 192.168.40.1 is (192.168.30.1 with probability of 0.3 or 192.168.40.1
with probability of 0.7) for outgoing web connections. with probability of 0.7) for outgoing web connections. Chains are only applied to new connections, pipelined (keep-alive) requests in the same connection use the same chain.
.br .br
type is one of: type is one of:
.br
extip does not actully redirect request, it sets external address for this request to <ip>. It can be chained with another parent types. It's usefaul to set external IP based on ACL or make it random.
.br .br
tcp simply redirect connection. TCP is always last in chain. This type of proxy is a simple TCP redirection, it does not support parent authentication. tcp simply redirect connection. TCP is always last in chain. This type of proxy is a simple TCP redirection, it does not support parent authentication.
.br .br
http redirect to HTTP proxy. HTTP is always last chain. It should only be used with http (proxy) service, http redirect to HTTP proxy. HTTP is always the last chain. It should only be used with http (proxy) service,
if used with different service, it works as tcp redirection. if used with different service, it works as tcp redirection.
.br .br
pop3 redirect to POP3 proxy (only local redirection is supported, can only be used as a first hop in chaining) pop3 redirect to POP3 proxy (only local redirection is supported, can only be used as a first hop in chaining)
+1 -1
View File
@@ -5,7 +5,7 @@ After=network.target
[Service] [Service]
Environment=CONFIGFILE=/etc/3proxy/3proxy.cfg Environment=CONFIGFILE=/etc/3proxy/3proxy.cfg
ExecStart=/bin/3proxy ${CONFIGFILE} & ExecStart=/bin/3proxy ${CONFIGFILE}
ExecReload=/bin/kill -SIGUSR1 $MAINPID ExecReload=/bin/kill -SIGUSR1 $MAINPID
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
+9 -3
View File
@@ -1,6 +1,12 @@
3proxy (0.9.1-1) buster; urgency=medium 3proxy (0.9.3-1) buster; urgency=medium
*3proxy 0.9.1 initial build *3proxy 0.9.3 initial build
-- z3APA3A <3apa3a@3proxy.org> Thu, 12 Nov 2020 12:12:12 +0300 -- z3APA3A <3apa3a@3proxy.org> Thu, 03 Dec 2020 21:13:58 +0300
3proxy (0.9.2-1) buster; urgency=medium
*3proxy 0.9.2 initial build
-- z3APA3A <3apa3a@3proxy.org> Thu, 19 Nov 2020 19:19:19 +0300
+1 -1
View File
@@ -1,4 +1,4 @@
if [ -x /usr/sbin/useradd ]; then \ if [ -x /usr/sbin/useradd ]; then \
/usr/bin/getent group proxy >/dev/null || (/usr/sbin/groupadd -f -r proxy || true); \ /usr/bin/getent group proxy >/dev/null || (/usr/sbin/groupadd -f -r proxy || true); \
/usr/bin/getent passwd proxy >/dev/null || (/usr/sbin/useradd -UMr -s /bin/false -c 3proxy proxy || true); \ /usr/bin/getent passwd proxy >/dev/null || (/usr/sbin/useradd -Mr -s /bin/false -g proxy -c 3proxy proxy || true); \
fi fi
+1
View File
@@ -11,5 +11,6 @@ override_dh_auto_clean:
find src/ -type f -name "*.o" -delete find src/ -type f -name "*.o" -delete
find src/ -type f -name "Makefile.var" -delete find src/ -type f -name "Makefile.var" -delete
find bin/ -type f -executable -delete find bin/ -type f -executable -delete
rm -f Makefile
override_dh_usrlocal: override_dh_usrlocal:
+17 -4
View File
@@ -1,6 +1,6 @@
Name: 3proxy Name: 3proxy
Version: 0.9.1 Version: 0.9.3
Release: 0 Release: 1
Summary: 3proxy tiny proxy server Summary: 3proxy tiny proxy server
License: GPL/LGPL/Apache/BSD License: GPL/LGPL/Apache/BSD
URL: https://3proxy.org/ URL: https://3proxy.org/
@@ -20,7 +20,7 @@ ln -s Makefile.Linux Makefile
make make
%install %install
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=%buildroot install
%clean %clean
make clean make clean
@@ -47,6 +47,18 @@ make clean
/usr/local/3proxy/libexec/StringsPlugin.ld.so /usr/local/3proxy/libexec/StringsPlugin.ld.so
/usr/local/3proxy/libexec/TrafficPlugin.ld.so /usr/local/3proxy/libexec/TrafficPlugin.ld.so
/usr/local/3proxy/libexec/TransparentPlugin.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/man3/3proxy.cfg.3.gz
/usr/share/man/man8/3proxy.8.gz /usr/share/man/man8/3proxy.8.gz
/usr/share/man/man8/ftppr.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/socks.8.gz
/usr/share/man/man8/tcppm.8.gz /usr/share/man/man8/tcppm.8.gz
/usr/share/man/man8/udppm.8.gz /usr/share/man/man8/udppm.8.gz
%endif
/var/log/3proxy /var/log/3proxy
%doc doc/* %doc doc/*
@@ -64,7 +77,7 @@ make clean
%pre %pre
if [ -x /usr/sbin/useradd ]; then \ if [ -x /usr/sbin/useradd ]; then \
/usr/bin/getent group proxy >/dev/null || (/usr/sbin/groupadd -f -r proxy || true); \ /usr/bin/getent group proxy >/dev/null || (/usr/sbin/groupadd -f -r proxy || true); \
/usr/bin/getent passwd proxy >/dev/null || (/usr/sbin/useradd -UMr -s /bin/false -c 3proxy proxy || true); \ /usr/bin/getent passwd proxy >/dev/null || (/usr/sbin/useradd -Mr -s /bin/false -g proxy -c 3proxy proxy || true); \
fi fi
%post %post
View File
File renamed without changes.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

+6 -7
View File
@@ -1,9 +1,8 @@
#include "src/version.h" #include "version.h"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION 0,9,1,201113 FILEVERSION MAJOR3PROXY,SUBMAJOR3PROXY,MINOR3PROXY,SUBMINOR3PROXY
PRODUCTVERSION 0,9,1,201113 PRODUCTVERSION MAJOR3PROXY,SUBMAJOR3PROXY,MINOR3PROXY,SUBMINOR3PROXY
FILETYPE 1 FILETYPE 1
FILESUBTYPE 0x0L FILESUBTYPE 0x0L
BEGIN BEGIN
@@ -14,12 +13,12 @@ BEGIN
VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.org/\0" VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.org/\0"
VALUE "CompanyName", "Vladimir Dubrovin\0" VALUE "CompanyName", "Vladimir Dubrovin\0"
VALUE "FileDescription", "3proxy - tiny proxy server\0" VALUE "FileDescription", "3proxy - tiny proxy server\0"
VALUE "FileVersion", "0.9.1\0" VALUE "FileVersion", RELEASE3PROXY
VALUE "InternalName", "3proxy\0" VALUE "InternalName", "3proxy\0"
VALUE "LegalCopyright", "Copyright (C) 2002-2020 Vladimir Dubrovin\0" VALUE "LegalCopyright", "Copyright (C) 2002-" YEAR3PROXY " Vladimir Dubrovin\0"
VALUE "OriginalFilename", "3proxy.exe\0" VALUE "OriginalFilename", "3proxy.exe\0"
VALUE "ProductName", "3proxy\0" VALUE "ProductName", "3proxy\0"
VALUE "ProductVersion", "0.9.1\0" VALUE "ProductVersion", RELEASE3PROXY
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
+1 -3
View File
@@ -143,8 +143,6 @@ ntlm$(OBJSUFFICS): ntlm.c
stringtable$(OBJSUFFICS): stringtable.c stringtable$(OBJSUFFICS): stringtable.c
$(CC) $(COUT)stringtable$(OBJSUFFICS) $(CFLAGS) stringtable.c $(CC) $(COUT)stringtable$(OBJSUFFICS) $(CFLAGS) stringtable.c
$(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) authradius$(OBJSUFFICS) conf$(OBJSUFFICS) log$(OBJSUFFICS) datatypes$(OBJSUFFICS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) mycrypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) authradius$(OBJSUFFICS) conf$(OBJSUFFICS) log$(OBJSUFFICS) datatypes$(OBJSUFFICS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) mycrypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(VERSIONDEP)
$(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) authradius$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) mycrypt$(OBJSUFFICS) md5$(OBJSUFFICS) md4$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) authradius$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) mycrypt$(OBJSUFFICS) md5$(OBJSUFFICS) md4$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
clean:
@$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES)
+16 -12
View File
@@ -509,7 +509,7 @@ static void initbandlims (struct clientparam *param){
param->bandlimfunc = NULL; param->bandlimfunc = NULL;
param->bandlims[0] = NULL; param->bandlims[0] = NULL;
param->bandlimsout[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) { for(i=0, be = conf.bandlimiter; be && i<MAXBANDLIMS; be = be->next) {
if(ACLmatches(be->ace, param)){ if(ACLmatches(be->ace, param)){
if(be->ace->action == NOBANDLIM) { if(be->ace->action == NOBANDLIM) {
@@ -606,17 +606,18 @@ void trafcountfunc(struct clientparam *param){
for(tc = conf.trafcounter; tc; tc = tc->next) { for(tc = conf.trafcounter; tc; tc = tc->next) {
if(ACLmatches(tc->ace, param)){ if(ACLmatches(tc->ace, param)){
time_t t; time_t t;
if(tc->ace->action == NOCOUNTIN || tc->ace->action == NOCOUNTALL) {
if(tc->ace->action == NOCOUNTIN) {
countout = 1; countout = 1;
break; break;
} }
if(tc->ace->action != COUNTIN) { if(tc->ace->action == NOCOUNTALL) break;
if(tc->ace->action != COUNTIN && tc->ace->action != COUNTALL) {
countout = 1; countout = 1;
if(tc->ace->action != COUNTALL)continue; continue;
} }
tc->traf64 += param->statssrv64; tc->traf64 += param->statssrv64;
time(&t); tc->updated = conf.time;
tc->updated = t;
} }
} }
if(countout) for(tc = conf.trafcounter; tc; tc = tc->next) { if(countout) for(tc = conf.trafcounter; tc; tc = tc->next) {
@@ -627,8 +628,7 @@ void trafcountfunc(struct clientparam *param){
continue; continue;
} }
tc->traf64 += param->statscli64; tc->traf64 += param->statscli64;
time(&t); tc->updated = conf.time;
tc->updated = t;
} }
} }
@@ -655,10 +655,14 @@ int alwaysauth(struct clientparam * param){
for(tc = conf.trafcounter; tc; tc = tc->next) { for(tc = conf.trafcounter; tc; tc = tc->next) {
if(tc->disabled) continue; if(tc->disabled) continue;
if(ACLmatches(tc->ace, param)){ if(ACLmatches(tc->ace, param)){
if(tc->ace->action == NOCOUNTIN) break; if(tc->ace->action == NOCOUNTIN) {
countout = 1;
break;
}
if(tc->ace->action == NOCOUNTALL) break;
if(tc->ace->action != COUNTIN) { if(tc->ace->action != COUNTIN) {
countout = 1; countout = 1;
continue; if(tc->ace->action != COUNTALL) continue;
} }
if(tc->traflim64 <= tc->traf64) return 10; if(tc->traflim64 <= tc->traf64) return 10;
param->trafcountfunc = conf.trafcountfunc; param->trafcountfunc = conf.trafcountfunc;
@@ -668,8 +672,8 @@ int alwaysauth(struct clientparam * param){
if(countout)for(tc = conf.trafcounter; tc; tc = tc->next) { if(countout)for(tc = conf.trafcounter; tc; tc = tc->next) {
if(tc->disabled) continue; if(tc->disabled) continue;
if(ACLmatches(tc->ace, param)){ if(ACLmatches(tc->ace, param)){
if(tc->ace->action == NOCOUNTOUT) break; if(tc->ace->action == NOCOUNTOUT || tc->ace->action == NOCOUNTALL) break;
if(tc->ace->action != COUNTOUT) { if(tc->ace->action != COUNTOUT && tc->ace->action != COUNTALL) {
continue; continue;
} }
if(tc->traflim64 <= tc->traf64) return 10; if(tc->traflim64 <= tc->traf64) return 10;
-2
View File
@@ -286,8 +286,6 @@ void random_vector(uint8_t *vector, struct clientparam *param)
} }
static float timeout = 5;
typedef struct radius_packet_t { typedef struct radius_packet_t {
uint8_t code; uint8_t code;
uint8_t id; uint8_t id;
+1 -1
View File
@@ -293,7 +293,7 @@ int parsehostname(char *hostname, struct clientparam *param, unsigned short port
if(!hostname || !*hostname)return 2; if(!hostname || !*hostname)return 2;
if(*hostname == '[') se=strchr(hostname, ']'); if(*hostname == '[') se=strchr(hostname, ']');
if (sp = strchr(se?se:hostname, ':')) { if ((sp = strchr(se?se:hostname, ':'))) {
if(strchr(sp+1, ':'))sp = NULL; if(strchr(sp+1, ':'))sp = NULL;
else *sp = 0; else *sp = 0;
} }
+3 -3
View File
@@ -404,7 +404,6 @@ static int h_archiver(int argc, unsigned char **argv){
static int h_counter(int argc, unsigned char **argv){ static int h_counter(int argc, unsigned char **argv){
struct counter_header ch1; struct counter_header ch1;
if(conf.counterd >=0)close(conf.counterd); if(conf.counterd >=0)close(conf.counterd);
if(!conf.trafcountfunc) conf.trafcountfunc = trafcountfunc;
conf.counterd = open((char *)argv[1], O_BINARY|O_RDWR|O_CREAT, 0660); conf.counterd = open((char *)argv[1], O_BINARY|O_RDWR|O_CREAT, 0660);
if(conf.counterd<0){ if(conf.counterd<0){
fprintf(stderr, "Unable to open counter file %s, line %d\n", argv[1], linenum); fprintf(stderr, "Unable to open counter file %s, line %d\n", argv[1], linenum);
@@ -1239,6 +1238,7 @@ static int h_ace(int argc, unsigned char **argv){
case NOCOUNTOUT: case NOCOUNTOUT:
case COUNTALL: case COUNTALL:
case NOCOUNTALL: case NOCOUNTALL:
if(!conf.trafcountfunc) conf.trafcountfunc = trafcountfunc;
tl = myalloc(sizeof(struct trafcount)); tl = myalloc(sizeof(struct trafcount));
if(!tl) { if(!tl) {
return(21); return(21);
@@ -1335,12 +1335,12 @@ static int h_radius(int argc, unsigned char **argv){
strcpy(radiussecret, argv[1]); strcpy(radiussecret, argv[1]);
for( nradservers=0; nradservers < MAXRADIUS && nradservers < argc -2; nradservers++){ for( nradservers=0; nradservers < MAXRADIUS && nradservers < argc -2; nradservers++){
char *s = 0; char *s = 0;
if(strchr(argv[nradservers + 2], '/')){ if((s=strchr(argv[nradservers + 2], '/'))){
*s = 0; *s = 0;
s++; s++;
} }
if( !getip46(46, argv[nradservers + 2], (struct sockaddr *)&radiuslist[nradservers].authaddr)) return 1; 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); if(!*SAPORT(&radiuslist[nradservers].authaddr))*SAPORT(&radiuslist[nradservers].authaddr) = htons(1812);
port = ntohs(*SAPORT(&radiuslist[nradservers].authaddr)); port = ntohs(*SAPORT(&radiuslist[nradservers].authaddr));
radiuslist[nradservers].logaddr = radiuslist[nradservers].authaddr; radiuslist[nradservers].logaddr = radiuslist[nradservers].authaddr;
+4 -25
View File
@@ -365,32 +365,11 @@ static void * ef_ace_next(struct node * node){
return ((struct ace *)node->value) -> next; return ((struct ace *)node->value) -> next;
} }
char * aceaction (int action);
static void * ef_ace_type(struct node * node){ static void * ef_ace_type(struct node * node){
switch (((struct ace *)node->value) -> action) { return aceaction(((struct ace *)node->value) -> action);
case ALLOW:
case REDIRECT:
return "allow";
case DENY:
return "deny";
case BANDLIM:
return "bandlim";
case NOBANDLIM:
return "nobandlim";
case COUNTIN:
return "countin";
case NOCOUNTIN:
return "nocountin";
case COUNTOUT:
return "countout";
case NOCOUNTOUT:
return "nocountout";
case COUNTALL:
return "countall";
case NOCOUNTALL:
return "nocountall";
default:
return "unknown";
}
} }
+1 -1
View File
@@ -174,7 +174,7 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
break; break;
case 'n': case 'n':
len = param->hostname? (int)strlen((char *)param->hostname) : 0; len = param->hostname? (int)strlen((char *)param->hostname) : 0;
if (len > 0 && !strchr((char *)param->hostname, ':')) for(len = 0; param->hostname[len] && i < 256; len++, i++){ if (len > 0 && !strchr((char *)param->hostname, ':')) for(len = 0; param->hostname[len] && i < 4000; len++, i++){
buf[i] = param->hostname[len]; buf[i] = param->hostname[len];
if(param->srv->nonprintable && (buf[i] < 0x20 || strchr((char *)param->srv->nonprintable, buf[i]))) buf[i] = param->srv->replace; if(param->srv->nonprintable && (buf[i] < 0x20 || strchr((char *)param->srv->nonprintable, buf[i]))) buf[i] = param->srv->replace;
if(doublec && strchr((char *)doublec, buf[i])) { if(doublec && strchr((char *)doublec, buf[i])) {
+1 -1
View File
@@ -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_CLIDATA:
case GOT_FTP_SRVDATA: case GOT_FTP_SRVDATA:
case GOT_HTTP_CLIDATA: case GOT_HTTP_CLIDATA:
if((!fps->what & FP_CLIDATA)) break; if(!(fps->what & FP_CLIDATA)) break;
#ifdef _WIN32 #ifdef _WIN32
if(SetFilePointer(fps->fpd.h_cli, fps->clientwritten + fps->clihdrwritten, 0, FILE_BEGIN) != (fps->clientwritten + fps->clihdrwritten)){ if(SetFilePointer(fps->fpd.h_cli, fps->clientwritten + fps->clihdrwritten, 0, FILE_BEGIN) != (fps->clientwritten + fps->clihdrwritten)){
return -1; return -1;
+2 -3
View File
@@ -351,7 +351,7 @@ static struct commands pcre_commandhandlers[] = {
static struct symbol regexp_symbols[] = { static struct symbol regexp_symbols[] = {
{regexp_symbols+1, "pcre_compile", (void*) pcre_compile}, {regexp_symbols+1, "pcre_compile", (void*) pcre_compile},
{regexp_symbols+2, "pcre_exec", (void*) pcre_exec}, {regexp_symbols+2, "pcre_exec", (void*) pcre_exec},
{NULL, "pcre_free", NULL}, {NULL, "pcre_options", (void *)&pcre_options},
}; };
#ifdef WATCOM #ifdef WATCOM
@@ -371,8 +371,7 @@ PLUGINAPI int PLUGINCALL pcre_plugin (struct pluginlink * pluginlink,
pcre_free = pl->freefunc; pcre_free = pl->freefunc;
pcre_loaded = 1; pcre_loaded = 1;
pthread_mutex_init(&pcre_mutex, NULL); pthread_mutex_init(&pcre_mutex, NULL);
regexp_symbols[6].value = pl->freefunc; regexp_symbols[2].next = pl->symbols.next;
regexp_symbols[6].next = pl->symbols.next;
pl->symbols.next = regexp_symbols; pl->symbols.next = regexp_symbols;
pcre_commandhandlers[3].next = pl->commandhandlers->next; pcre_commandhandlers[3].next = pl->commandhandlers->next;
pl->commandhandlers->next = pcre_commandhandlers; pl->commandhandlers->next = pcre_commandhandlers;
+14 -14
View File
@@ -52,14 +52,14 @@ static size_t bin2hex (const unsigned char* bin, size_t bin_length, char* str, s
char *p; char *p;
size_t i; size_t i;
if ( str_length < ( bin_length+1) ) if ( str_length < ( (bin_length*2)+1) )
return 0; return 0;
p = str; p = str;
for ( i=0; i < bin_length; ++i ) for ( i=0; i < bin_length; ++i )
{ {
*p++ = hexMap[*bin >> 4]; *p++ = hexMap[(*(unsigned char *)bin) >> 4];
*p++ = hexMap[*bin & 0xf]; *p++ = hexMap[(*(unsigned char *)bin) & 0xf];
++bin; ++bin;
} }
@@ -115,10 +115,18 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
unsigned char p2[] = "3proxy"; unsigned char p2[] = "3proxy";
unsigned char p3[] = "3proxy CA"; unsigned char p3[] = "3proxy CA";
char hash_name_sha1[sizeof(src_cert->sha1_hash)*2 + 1]; int hash_size = 20;
char cache_name[200]; 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); sprintf(cache_name, "%s%s.pem", cert_path, hash_name_sha1);
/* check if certificate is already cached */ /* check if certificate is already cached */
fcache = fopen(cache_name, "rb"); 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); err = X509_set_issuer_name(dst_cert, name);
if(!err){ if(!err){
X509_free(dst_cert); X509_free(dst_cert);
return NULL; 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()); err = X509_sign(dst_cert, CA_key, EVP_sha256());
if(!err){ if(!err){
X509_free(dst_cert); X509_free(dst_cert);
+36 -26
View File
@@ -56,6 +56,7 @@ struct SSLqueue {
*/ */
static struct SSLqueue *searchSSL(SOCKET s){ static struct SSLqueue *searchSSL(SOCKET s){
struct SSLqueue *sslq = NULL; struct SSLqueue *sslq = NULL;
pthread_mutex_lock(&ssl_mutex); pthread_mutex_lock(&ssl_mutex);
for(sslq = SSLq; sslq; sslq = sslq->next) for(sslq = SSLq; sslq; sslq = sslq->next)
if(sslq->s == s) break; 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){ static void addSSL(SOCKET s, SSL_CERT cert, SSL_CONN conn, struct clientparam* param){
struct SSLqueue *sslq; struct SSLqueue *sslq;
sslq = (struct SSLqueue *) malloc(sizeof(struct SSLqueue)); sslq = (struct SSLqueue *) malloc(sizeof(struct SSLqueue));
sslq->s = s; sslq->s = s;
sslq->cert = cert; sslq->cert = cert;
sslq->conn = conn; sslq->conn = conn;
sslq->param = param;
pthread_mutex_lock(&ssl_mutex); pthread_mutex_lock(&ssl_mutex);
sslq->next = SSLq; sslq->next = SSLq;
sslq->param = param;
SSLq = sslq; SSLq = sslq;
pthread_mutex_unlock(&ssl_mutex); pthread_mutex_unlock(&ssl_mutex);
} }
int delSSL(SOCKET s){ int delSSL(SOCKET s){
struct SSLqueue *sqi, *sqt = NULL; struct SSLqueue *sqi, *sqt = NULL;
if(!SSLq) return 0; if(!SSLq) return 0;
pthread_mutex_lock(&ssl_mutex); pthread_mutex_lock(&ssl_mutex);
if(SSLq){ if(SSLq){
@@ -113,13 +116,15 @@ static int ssl_send(SOCKET s, const void *msg, size_t len, int flags){
struct SSLqueue *sslq; struct SSLqueue *sslq;
if ((sslq = searchSSL(s))){ if ((sslq = searchSSL(s))){
int i=0, res, err; int res, err;
do { if((res = ssl_write(sslq->conn, (void *)msg, len)) <= 0){
if((res = ssl_write(sslq->conn, (void *)msg, len)) < 0) { err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res); if (err == SSL_ERROR_WANT_WRITE){
usleep(10*SLEEPTIME); _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 res;
} }
@@ -135,13 +140,15 @@ static int ssl_sendto(SOCKET s, const void *msg, size_t len, int flags, const st
struct SSLqueue *sslq; struct SSLqueue *sslq;
if ((sslq = searchSSL(s))){ if ((sslq = searchSSL(s))){
int i=0, res, err; int res, err;
do { if((res = ssl_write(sslq->conn, (void *)msg, len)) <= 0) {
if((res = ssl_write(sslq->conn, (void *)msg, len)) < 0) { err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res); if (err == SSL_ERROR_WANT_WRITE){
usleep(10*SLEEPTIME); _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 res;
} }
@@ -156,16 +163,17 @@ static int ssl_recvfrom(SOCKET s, void *msg, size_t len, int flags, struct socka
struct SSLqueue *sslq; struct SSLqueue *sslq;
if ((sslq = searchSSL(s))){ if ((sslq = searchSSL(s))){
int i=0, res, err; int res, err;
do { if((res = ssl_read(sslq->conn, (void *)msg, len)) <= 0) {
if((res = ssl_read(sslq->conn, (void *)msg, len)) < 0) { err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res); if (err == SSL_ERROR_WANT_READ) {
usleep(10*SLEEPTIME); _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 res;
} }
return sso._recvfrom(s, msg, len, flags, from, fromlen); 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; struct SSLqueue *sslq;
if ((sslq = searchSSL(s))){ if ((sslq = searchSSL(s))){
int i=0, res, err; int res, err;
do { if((res = ssl_read(sslq->conn, (void *)msg, len)) <= 0) {
if((res = ssl_read(sslq->conn, (void *)msg, len)) < 0) { err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res);
err = SSL_get_error((SSL *)((ssl_conn*)sslq->conn)->ssl, res); if (err == SSL_ERROR_WANT_READ) {
usleep(10*SLEEPTIME); _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 res;
} }
+26 -7
View File
@@ -537,17 +537,28 @@ for(;;){
RETURN(0); RETURN(0);
} }
if(action != PASS) RETURN(517); 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; uint64_t newlen64;
newlen64 = sockfillbuffcli(param, (unsigned long)contentlength64, CONNECTION_S); newlen64 = sockfillbuffcli(param, (unsigned long)contentlength64, CONNECTION_S);
if(newlen64 == contentlength64) { if(newlen64 == contentlength64) {
action = handlepredatflt(param);
if(action == HANDLED){
RETURN(0);
}
if(action != PASS) RETURN(19);
action = handledatfltcli(param, &param->clibuf, (int *)&param->clibufsize, 0, (int *)&param->cliinbuf); action = handledatfltcli(param, &param->clibuf, (int *)&param->clibufsize, 0, (int *)&param->cliinbuf);
if(action == HANDLED){ if(action == HANDLED){
RETURN(0); RETURN(0);
} }
if(action != PASS) RETURN(517); if(action != PASS) RETURN(517);
contentlength64 = param->cliinbuf; contentlength64 = param->cliinbuf;
param->ndatfilterscli = 0; param->nolongdatfilter = 1;
} }
sprintf((char*)buf+strlen((char *)buf), "Content-Length: %"PRINTF_INT64_MODIFIER"u\r\n", contentlength64); 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) { if(isconnect && param->redirtype != R_HTTP) {
socksend(param->clisock, (unsigned char *)proxy_stringtable[8], (int)strlen(proxy_stringtable[8]), conf.timeouts[STRING_S]); socksend(param->clisock, (unsigned char *)proxy_stringtable[8], (int)strlen(proxy_stringtable[8]), conf.timeouts[STRING_S]);
if(param->redirectfunc) { if(param->redirectfunc) {
if(req)myfree(req); if(req)myfree(req);
if(buf)myfree(buf); if(buf)myfree(buf);
return (*param->redirectfunc)(param); return (*param->redirectfunc)(param);
} }
param->res = mapsocket(param, conf.timeouts[CONNECTION_L]); 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); RETURN(param->res);
} }
@@ -882,7 +897,6 @@ for(;;){
sleeptime = param->bandlimfunc(param, 0, (int)strlen((char *)buf)); sleeptime = param->bandlimfunc(param, 0, (int)strlen((char *)buf));
} }
if(contentlength64 > 0){ if(contentlength64 > 0){
param->nolongdatfilter = 0;
param->waitclient64 = contentlength64; param->waitclient64 = contentlength64;
res = mapsocket(param, conf.timeouts[CONNECTION_S]); res = mapsocket(param, conf.timeouts[CONNECTION_S]);
param->waitclient64 = 0; param->waitclient64 = 0;
@@ -985,10 +999,15 @@ for(;;){
if (conf.filtermaxsize && contentlength64 > (uint64_t)conf.filtermaxsize) { if (conf.filtermaxsize && contentlength64 > (uint64_t)conf.filtermaxsize) {
param->nolongdatfilter = 1; 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; uint64_t newlen;
newlen = (uint64_t)sockfillbuffsrv(param, (unsigned long) contentlength64, CONNECTION_S); newlen = (uint64_t)sockfillbuffsrv(param, (unsigned long) contentlength64, CONNECTION_S);
if(newlen == contentlength64) { if(newlen == contentlength64) {
action = handlepredatflt(param);
if(action == HANDLED){
RETURN(0);
}
if(action != PASS) RETURN(19);
action = handledatfltsrv(param, &param->srvbuf, (int *)&param->srvbufsize, 0, (int *)&param->srvinbuf); action = handledatfltsrv(param, &param->srvbuf, (int *)&param->srvbufsize, 0, (int *)&param->srvinbuf);
param->nolongdatfilter = 1; param->nolongdatfilter = 1;
if(action == HANDLED){ if(action == HANDLED){
+14 -4
View File
@@ -32,6 +32,14 @@ void * threadfunc (void *p) {
dolog(param, (unsigned char *)"Connect back accept() failed"); dolog(param, (unsigned char *)"Connect back accept() failed");
continue; continue;
} }
{
#ifdef _WIN32
unsigned long ul=1;
ioctlsocket(param->remsock, FIONBIO, &ul);
#else
fcntl(param->remsock,F_SETFL,O_NONBLOCK | fcntl(param->remsock,F_GETFL));
#endif
}
#ifndef WITHMAIN #ifndef WITHMAIN
param->req = param->sinsr; param->req = param->sinsr;
if(param->srv->acl) param->res = checkACL(param); if(param->srv->acl) param->res = checkACL(param);
@@ -42,7 +50,7 @@ void * threadfunc (void *p) {
continue; continue;
} }
#endif #endif
if(socksendto(param->remsock, (struct sockaddr*)&param->sinsr, (unsigned char *)"C", 1, CONNBACK_TO) != 1){ if(socksendto(param->remsock, (struct sockaddr*)&param->sinsr, (unsigned char *)"C", 1, CONNBACK_TO*1000) != 1){
dolog(param, (unsigned char *)"Connect back sending command failed"); dolog(param, (unsigned char *)"Connect back sending command failed");
so._closesocket(param->remsock); so._closesocket(param->remsock);
param->remsock = INVALID_SOCKET; param->remsock = INVALID_SOCKET;
@@ -58,10 +66,12 @@ void * threadfunc (void *p) {
} }
else { else {
#ifndef WITHMAIN
#ifndef _WIN32 #ifndef _WIN32
sigset_t mask; sigset_t mask;
sigfillset(&mask); sigfillset(&mask);
if(param->srv->service != S_UDPPM)pthread_sigmask(SIG_SETMASK, &mask, NULL); if(param->srv->service != S_UDPPM)pthread_sigmask(SIG_SETMASK, &mask, NULL);
#endif
#endif #endif
((struct clientparam *) p)->srv->pf((struct clientparam *)p); ((struct clientparam *) p)->srv->pf((struct clientparam *)p);
@@ -337,7 +347,6 @@ int MODULEMAINFUNC (int argc, char** argv){
fp = fopen(argv[i] + 2, "a"); fp = fopen(argv[i] + 2, "a");
if (fp) { if (fp) {
srv.stdlog = fp; srv.stdlog = fp;
fseek(fp, 0L, SEEK_END);
} }
} }
@@ -704,7 +713,8 @@ int MODULEMAINFUNC (int argc, char** argv){
usleep(SLEEPTIME); usleep(SLEEPTIME);
continue; continue;
} }
if(sockrecvfrom(new_sock,(struct sockaddr*)&defparam.sincr,buf,1,60) != 1 || *buf!='C') {
if(sockrecvfrom(new_sock,(struct sockaddr*)&defparam.sincr,buf,1,60*1000) != 1 || *buf!='C') {
so._closesocket(new_sock); so._closesocket(new_sock);
new_sock = INVALID_SOCKET; new_sock = INVALID_SOCKET;
usleep(SLEEPTIME); usleep(SLEEPTIME);
@@ -762,8 +772,8 @@ int MODULEMAINFUNC (int argc, char** argv){
} }
continue; continue;
} }
setopts(new_sock, srv.clisockopts);
} }
setopts(new_sock, srv.clisockopts);
size = sizeof(defparam.sincl); size = sizeof(defparam.sincl);
if(so._getsockname(new_sock, (struct sockaddr *)&defparam.sincl, &size)){ if(so._getsockname(new_sock, (struct sockaddr *)&defparam.sincl, &size)){
sprintf((char *)buf, "getsockname(): %s", strerror(errno)); sprintf((char *)buf, "getsockname(): %s", strerror(errno));
+1 -1
View File
@@ -67,7 +67,7 @@ int sockmap(struct clientparam * param, int timeo, int usesplice){
int pipesrv[2] = {-1,-1}; int pipesrv[2] = {-1,-1};
int pipecli[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){ if(usesplice){
TOCLIENTPIPE = FROMCLIENTPIPE = TOSERVERPIPE = FROMSERVERPIPE = 1; TOCLIENTPIPE = FROMCLIENTPIPE = TOSERVERPIPE = FROMSERVERPIPE = 1;
TOCLIENTBUF = TOSERVERBUF = 0; TOCLIENTBUF = TOSERVERBUF = 0;
+7 -1
View File
@@ -1,6 +1,12 @@
#ifndef VERSION #ifndef VERSION
#define VERSION "3proxy-0.9.1" #define VERSION "3proxy-0.9.3"
#endif #endif
#ifndef BUILDDATE #ifndef BUILDDATE
#define BUILDDATE "" #define BUILDDATE ""
#endif #endif
#define MAJOR3PROXY 0
#define SUBMAJOR3PROXY 9
#define MINOR3PROXY 3
#define SUBMINOR3PROXY 0
#define RELEASE3PROXY "3proxy-0.9.3(" BUILDDATE ")\0"
#define YEAR3PROXY "2020"
+43 -7
View File
@@ -16,12 +16,43 @@ extern FILE *writable;
FILE * confopen(); FILE * confopen();
extern void decodeurl(unsigned char *s, int filter); extern void decodeurl(unsigned char *s, int filter);
struct printparam { struct printparam {
char buf[1024]; char buf[1024];
int inbuf; int inbuf;
struct clientparam *cp; struct clientparam *cp;
}; };
char * aceaction (int action){
switch (action) {
case ALLOW:
case REDIRECT:
return "allow";
case DENY:
return "deny";
case BANDLIM:
return "bandlim";
case NOBANDLIM:
return "nobandlim";
case COUNTIN:
return "countin";
case NOCOUNTIN:
return "nocountin";
case COUNTOUT:
return "countout";
case NOCOUNTOUT:
return "nocountout";
case COUNTALL:
return "countall";
case NOCOUNTALL:
return "nocountall";
default:
return "unknown";
}
}
static void stdpr(struct printparam* pp, char *buf, int inbuf){ static void stdpr(struct printparam* pp, char *buf, int inbuf){
if((pp->inbuf + inbuf > 1024) || !buf) { if((pp->inbuf + inbuf > 1024) || !buf) {
socksend(pp->cp->clisock, (unsigned char *)pp->buf, pp->inbuf, conf.timeouts[STRING_S]); socksend(pp->cp->clisock, (unsigned char *)pp->buf, pp->inbuf, conf.timeouts[STRING_S]);
@@ -260,11 +291,11 @@ char * admin_stringtable[]={
"<h3>Counters</h3>\r\n" "<h3>Counters</h3>\r\n"
"<table border = \'1\'>\r\n" "<table border = \'1\'>\r\n"
"<tr align=\'center\'><td>Description</td><td>Active</td>" "<tr align=\'center\'><td>Action</td><td>#/Desc</td><td>Active</td>"
"<td>Users</td><td>Source Address</td><td>Destination Address</td>" "<td>Users</td><td>Source Address</td><td>Destination Address</td>"
"<td>Port</td>" "<td>Port</td>"
"<td>Limit</td><td>Units</td><td>Value</td>" "<td>Limit</td><td>Units</td><td>Value</td>"
"<td>Reset</td><td>Updated</td><td>Num</td></tr>\r\n", "<td>Reset</td><td>Updated</td><td>Position</td></tr>\r\n",
"</table>\r\n", "</table>\r\n",
@@ -433,9 +464,14 @@ void * adminchild(struct clientparam* param) {
} }
if(req[1] == 'S' && atoi(req+2) == num) cp->disabled=0; if(req[1] == 'S' && atoi(req+2) == num) cp->disabled=0;
if(req[1] == 'D' && atoi(req+2) == num) cp->disabled=1; if(req[1] == 'D' && atoi(req+2) == num) cp->disabled=1;
inbuf += sprintf(buf, "<tr>" inbuf += sprintf(buf, "<tr><td>%s</td><td>", cp->ace?aceaction(cp->ace->action):"-");
"<td>%s</td><td><A HREF=\'/C%c%d\'>%s</A></td><td>", if(cp->number || cp->comment)
(cp->comment)?cp->comment:"&nbsp;", inbuf += sprintf(buf+inbuf, "%d/%s</td>" , cp->number,
(cp->comment)?cp->comment:"&nbsp;");
else
inbuf += sprintf(buf+inbuf, " - </td>");
inbuf += sprintf(buf+inbuf, "<td><A HREF=\'/C%c%d\'>%s</A></td><td>",
(cp->disabled)?'S':'D', (cp->disabled)?'S':'D',
num, num,
(cp->disabled)?"NO":"YES" (cp->disabled)?"NO":"YES"
@@ -467,7 +503,7 @@ void * adminchild(struct clientparam* param) {
else { else {
inbuf += printportlist(buf+inbuf, LINESIZE-128, cp->ace->ports, ",<br />\r\n"); inbuf += printportlist(buf+inbuf, LINESIZE-128, cp->ace->ports, ",<br />\r\n");
} }
if(cp->type == NONE) { if(cp->ace && (cp->ace->action == NOCOUNTIN || cp->ace->action == NOCOUNTOUT || cp->ace->action == NOCOUNTALL)) {
inbuf += sprintf(buf+inbuf, inbuf += sprintf(buf+inbuf,
"</td><td colspan=\'6\' align=\'center\'>exclude from limitation</td></tr>\r\n" "</td><td colspan=\'6\' align=\'center\'>exclude from limitation</td></tr>\r\n"
); );
@@ -543,7 +579,7 @@ void * adminchild(struct clientparam* param) {
error = 1; error = 1;
} }
while(l < contentlen && (i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, (contentlen - l) > LINESIZE - 1?LINESIZE - 1:contentlen - l, '+', conf.timeouts[STRING_S])) > 0){ while(l < contentlen && (i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, (contentlen - l) > LINESIZE - 1?LINESIZE - 1:contentlen - l, '+', conf.timeouts[STRING_S])) > 0){
if(i > (contentlen - l)) i = (contentlen - l); if((unsigned)i > (contentlen - l)) i = (contentlen - l);
if(!l){ if(!l){
if(i<9 || strncasecmp(buf, "conffile=", 9)) error = 1; if(i<9 || strncasecmp(buf, "conffile=", 9)) error = 1;
} }