mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
346880eb2e | ||
|
|
e607c8b5d0 | ||
|
|
1fca6ada82 | ||
|
|
d7eb9fb82f | ||
|
|
1bd6eff0e6 | ||
|
|
e642100271 | ||
|
|
aac5c9fff9 | ||
|
|
e235ada0de | ||
|
|
7335bc2fb6 | ||
|
|
3f4c267a25 | ||
|
|
6279e86086 | ||
|
|
cc2979ee5b | ||
|
|
bad85a3d51 | ||
|
|
36f16fb899 | ||
|
|
5f550c9107 | ||
|
|
47c1640223 | ||
|
|
681182b1e5 | ||
|
|
9fae0082a3 | ||
|
|
c30065256f | ||
|
|
cbe0c2f511 | ||
|
|
1f2bdd7b80 | ||
|
|
0c902525e5 | ||
|
|
129d26475e | ||
|
|
29f8867a9e | ||
|
|
252c4cb36b | ||
|
|
07603ceea7 | ||
|
|
8ec14c131d | ||
|
|
1225dbced7 | ||
|
|
3cd9bdffcb | ||
|
|
336a4acd46 | ||
|
|
c5abe51e26 | ||
|
|
31062bdc3c | ||
|
|
8943099dfb | ||
|
|
09f007e741 | ||
|
|
4487fd4a73 | ||
|
|
5498a79115 | ||
|
|
9c7fc9fddc | ||
|
|
4d63f957c2 | ||
|
|
828e00e668 | ||
|
|
3ba16310c5 | ||
|
|
7aaa9c18dd | ||
|
|
72923879a3 |
No files matched your search
+10
@@ -11,6 +11,16 @@
|
|||||||
*.lib
|
*.lib
|
||||||
*.key
|
*.key
|
||||||
*.pem
|
*.pem
|
||||||
|
*.so
|
||||||
|
bin/3proxy
|
||||||
|
bin/proxy
|
||||||
|
bin/socks
|
||||||
|
bin/tcppm
|
||||||
|
bin/udppm
|
||||||
|
bin/pop3p
|
||||||
|
bin/smtpp
|
||||||
|
bin/ftppr
|
||||||
|
bin/mycrypt
|
||||||
bin64/
|
bin64/
|
||||||
dll/
|
dll/
|
||||||
tmp/
|
tmp/
|
||||||
|
|||||||
@@ -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"]
|
||||||
@@ -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
-1
@@ -28,7 +28,7 @@ OBJSUFFICS = .o
|
|||||||
DEFINEOPTION = -D
|
DEFINEOPTION = -D
|
||||||
COMPFILES = *~
|
COMPFILES = *~
|
||||||
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
|
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -perm +111 -delete) || true
|
||||||
TYPECOMMAND = cat
|
TYPECOMMAND = cat
|
||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.FreeBSD
|
MAKEFILE = Makefile.FreeBSD
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ OBJSUFFICS = .o
|
|||||||
DEFINEOPTION = -D
|
DEFINEOPTION = -D
|
||||||
COMPFILES = *~
|
COMPFILES = *~
|
||||||
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
|
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
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ OBJSUFFICS = .o
|
|||||||
DEFINEOPTION = -D
|
DEFINEOPTION = -D
|
||||||
COMPFILES = *~
|
COMPFILES = *~
|
||||||
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
|
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
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ OBJSUFFICS = .o
|
|||||||
DEFINEOPTION = -D
|
DEFINEOPTION = -D
|
||||||
COMPFILES = *~
|
COMPFILES = *~
|
||||||
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
|
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
|
||||||
|
|||||||
+2
-4
@@ -3,13 +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
|
|
||||||
cd ..
|
|
||||||
@$(AFTERCLEAN)
|
@$(AFTERCLEAN)
|
||||||
|
|
||||||
|
|
||||||
+8
-10
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
|
||||||
DLFLAGS = /DLL
|
DLFLAGS = /DLL
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32.lib ssleay32.lib
|
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libcrypto_static.lib libssl_static.lib
|
||||||
LIBSOLD = libeay32MT.lib ssleay32MT.lib
|
LIBSOLD = libeay32MT.lib ssleay32MT.lib
|
||||||
LIBSPREFIX =
|
LIBSPREFIX =
|
||||||
LIBSSUFFIX = .lib
|
LIBSSUFFIX = .lib
|
||||||
@@ -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 ..\..)
|
||||||
|
|||||||
+7
-12
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin64/
|
BUILDDIR = ../bin64/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
|
||||||
DLFLAGS = /DLL
|
DLFLAGS = /DLL
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32.lib ssleay32.lib
|
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libcrypto_static.lib libssl_static.lib
|
||||||
LIBSOLD = libeay32.lib ssleay32.lib
|
LIBSOLD = libeay32.lib ssleay32.lib
|
||||||
LIBSPREFIX =
|
LIBSPREFIX =
|
||||||
LIBSSUFFIX = .lib
|
LIBSSUFFIX = .lib
|
||||||
@@ -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
|
||||||
|
|||||||
+8
-11
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
BUILDDIR = ../bin64/
|
BUILDDIR = ../bin64/
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "WITH_SSL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64
|
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64
|
||||||
DLFLAGS = /DLL
|
DLFLAGS = /DLL
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib
|
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libcrypto_static.lib libssl_static.lib
|
||||||
LIBSOLD =
|
LIBSOLD =
|
||||||
LIBSPREFIX =
|
LIBSPREFIX =
|
||||||
LIBSSUFFIX = .lib
|
LIBSSUFFIX = .lib
|
||||||
@@ -28,19 +28,16 @@ REMOVECOMMAND = del 2>NUL >NUL
|
|||||||
TYPECOMMAND = type
|
TYPECOMMAND = type
|
||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.msvcARM64
|
MAKEFILE = Makefile.msvcARM64
|
||||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin
|
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin
|
||||||
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
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ OBJSUFFICS = .o
|
|||||||
DEFINEOPTION = -D
|
DEFINEOPTION = -D
|
||||||
COMPFILES = *~
|
COMPFILES = *~
|
||||||
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
|
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
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ OBJSUFFICS = .o
|
|||||||
DEFINEOPTION = -D
|
DEFINEOPTION = -D
|
||||||
COMPFILES = *~
|
COMPFILES = *~
|
||||||
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
|
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
@@ -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 ../../
|
||||||
@@ -12,6 +12,8 @@ Download:
|
|||||||
https://github.com/z3APA3A/3proxy/releases
|
https://github.com/z3APA3A/3proxy/releases
|
||||||
Binaries for devel version (Windows, Linux):
|
Binaries for devel version (Windows, Linux):
|
||||||
https://3proxy.org/download/devel/
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
man/3proxy.8
|
||||||
|
man/3proxy.cfg.3
|
||||||
|
man/ftppr.8
|
||||||
|
man/icqpr.8
|
||||||
|
man/pop3p.8
|
||||||
|
man/proxy.8
|
||||||
|
man/smtpp.8
|
||||||
|
man/socks.8
|
||||||
|
man/tcppm.8
|
||||||
|
man/udppm.8
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
3proxy (0.9.3-210629140419) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 0.9.3 build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Thu, 01 Jul 2021 19:48:44 +0300
|
||||||
|
|
||||||
|
3proxy (0.9.3-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 0.9.3 initial build
|
||||||
|
|
||||||
|
-- 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
|
||||||
|
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
9
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
/usr/local/3proxy/conf/3proxy.cfg
|
||||||
|
/usr/local/3proxy/conf/add3proxyuser.sh
|
||||||
|
/usr/local/3proxy/conf/bandlimiters
|
||||||
|
/usr/local/3proxy/conf/counters
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
Source: 3proxy
|
||||||
|
Maintainer: z3APA3A <3apa3a@3proxy.org>
|
||||||
|
Section: net
|
||||||
|
Priority: optional
|
||||||
|
Standards-Version: 4.0.0
|
||||||
|
Build-Depends: debhelper (>=10)
|
||||||
|
Homepage: https://3proxy.org/
|
||||||
|
Vcs-Git: https://github.com/z3APA3A/3proxy
|
||||||
|
Vcs-Browser: https://github.com/z3APA3A/3proxy
|
||||||
|
|
||||||
|
Package: 3proxy
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
|
Description: tiny free proxy server
|
||||||
|
3Proxy tiny free proxy server is really tiny freeware proxy servers set.
|
||||||
|
It includes HTTP proxy with HTTPS and FTP support, SOCKSv4/SOCKSv4.5/SOCKSv5 proxy (socks/socks.exe), POP3 proxy, SMTP proxy, FTP proxy, caching DNS proxy, TCP and UDP portmappers.
|
||||||
|
You can use every proxy as a standalone program (socks, proxy, tcppm, udppm, pop3p) or use combined program (3proxy). Combined proxy additionally supports features like access control, bandwidth limiting, limiting daily/weekly/monthly traffic amount, proxy chaining, log rotation, syslog and ODBC logging, etc.
|
||||||
|
It's created to be small, simple and yet very functional.
|
||||||
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: 3proxy
|
||||||
|
Upstream-Contact: 3proxy@3proxy.org
|
||||||
|
Source: https://3proxy.org/
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2000-2020 3APA3A, Vladimir Dubrovin, 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/regex.*
|
||||||
|
Copyright: Henry Spencer
|
||||||
|
License: public-domain
|
||||||
|
|
||||||
|
Files: src/libs/smbdes.c
|
||||||
|
Copyright: Andrew Tridgell 1998
|
||||||
|
License: GPL-2+
|
||||||
Vendored
+43
@@ -0,0 +1,43 @@
|
|||||||
|
if [ ! -f /usr/local/3proxy/conf/passwd ]; then \
|
||||||
|
touch /usr/local/3proxy/conf/passwd;\
|
||||||
|
fi
|
||||||
|
chown -R proxy:proxy /usr/local/3proxy
|
||||||
|
chmod 550 /usr/local/3proxy/
|
||||||
|
chmod 550 /usr/local/3proxy/conf/
|
||||||
|
chmod 440 /usr/local/3proxy/conf/*
|
||||||
|
if /bin/systemctl >/dev/null 2>&1; then \
|
||||||
|
/usr/sbin/update-rc.d 3proxy disable || true; \
|
||||||
|
/usr/sbin/chkconfig 3proxy off || true; \
|
||||||
|
/bin/systemctl enable 3proxy.service; \
|
||||||
|
elif [ -x /usr/sbin/update-rc.d ]; then \
|
||||||
|
/usr/sbin/update-rc.d 3proxy defaults; \
|
||||||
|
/usr/sbin/update-rc.d 3proxy enable; \
|
||||||
|
elif [ -x /usr/sbin/chkconfig ]; then \
|
||||||
|
/usr/sbin/chkconfig 3proxy on; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo 3proxy installed.
|
||||||
|
if /bin/systemctl >/dev/null 2>&1; then \
|
||||||
|
/bin/systemctl stop 3proxy.service \
|
||||||
|
/bin/systemctl start 3proxy.service \
|
||||||
|
echo use ;\
|
||||||
|
echo " "systemctl start 3proxy.service ;\
|
||||||
|
echo to start proxy ;\
|
||||||
|
echo " "systemctl stop 3proxy.service ;\
|
||||||
|
echo to stop proxy ;\
|
||||||
|
elif [ -x /usr/sbin/service ]; then \
|
||||||
|
/usr/sbin/service 3proxy stop || true;\
|
||||||
|
/usr/sbin/service 3proxy start || true;\
|
||||||
|
echo " "service 3proxy start ;\
|
||||||
|
echo to start proxy ;\
|
||||||
|
echo " "service 3proxy stop ;\
|
||||||
|
echo to stop proxy ;\
|
||||||
|
fi
|
||||||
|
echo " "/usr/local/3proxy/conf/add3proxyuser.sh
|
||||||
|
echo to add users
|
||||||
|
echo ""
|
||||||
|
echo Default config uses Google\'s DNS.
|
||||||
|
echo It\'s recommended to use provider supplied DNS or install local recursor, e.g. pdns-recursor.
|
||||||
|
echo Configure preferred DNS in /usr/local/3proxy/conf/3proxy.cfg.
|
||||||
|
echo run \'/usr/local/3proxy/conf/add3proxyuser.sh admin password\' to configure \'admin\' user
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
if [ -x /usr/sbin/useradd ]; then \
|
||||||
|
/usr/bin/getent group proxy >/dev/null || (/usr/sbin/groupadd -f -r proxy || true); \
|
||||||
|
/usr/bin/getent passwd proxy >/dev/null || (/usr/sbin/useradd -Mr -s /bin/false -g proxy -c 3proxy proxy || true); \
|
||||||
|
fi
|
||||||
Vendored
+16
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
ln -s Makefile.Linux Makefile || true
|
||||||
|
dh_auto_build
|
||||||
|
|
||||||
|
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:
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
3.0 (quilt)
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
<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>
|
||||||
<br><A HREF="man8/icqpr.8.html">icqpr.8</A>
|
|
||||||
<br><A HREF="man8/pop3p.8.html">pop3p.8</A>
|
<br><A HREF="man8/pop3p.8.html">pop3p.8</A>
|
||||||
<br><A HREF="man8/proxy.8.html">proxy.8</A>
|
<br><A HREF="man8/proxy.8.html">proxy.8</A>
|
||||||
<br><A HREF="man8/smtpp.8.html">smtpp.8</A>
|
<br><A HREF="man8/smtpp.8.html">smtpp.8</A>
|
||||||
|
|||||||
+4
-2
@@ -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)
|
||||||
|
|||||||
-80
@@ -1,80 +0,0 @@
|
|||||||
.TH icqpr "8" "January 2019" "3proxy 0.9" "Universal proxy server"
|
|
||||||
.SH NAME
|
|
||||||
.B icqpr
|
|
||||||
\- ICQ (AOL OSCAR) proxy
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.BR "icqpr " [ -d ]
|
|
||||||
.IB \fR[ -l \fR[ \fR[ @ \fR] logfile \fR]]
|
|
||||||
.IB \fR[ -i internal_ip\fR]
|
|
||||||
.IB \fR[ -e external_ip\fR]
|
|
||||||
.I local_port remote_host remote_port
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.B icqpr
|
|
||||||
forwards ICQ connections from local to remote ICQ host. Most usual is
|
|
||||||
.B icqpr 5190 login.icq.com 5190
|
|
||||||
Also, icqpr adds UIN / AOL screen name as a username. It makes it possible
|
|
||||||
to control user's access to ICQ/AOL by UIN/screen name (use
|
|
||||||
.B auth useronly
|
|
||||||
in 3proxy).
|
|
||||||
.SH OPTIONS
|
|
||||||
.TP
|
|
||||||
.B -I
|
|
||||||
Inetd mode. Standalone service only.
|
|
||||||
.TP
|
|
||||||
.B -d
|
|
||||||
Daemonise. Detach service from console and run in the background.
|
|
||||||
.TP
|
|
||||||
.B -t
|
|
||||||
Be silenT. Do not log start/stop/accept error records.
|
|
||||||
.TP
|
|
||||||
.B -e
|
|
||||||
External address. IP address of interface proxy should initiate connections
|
|
||||||
from.
|
|
||||||
By default system will deside which address to use in accordance
|
|
||||||
with routing table.
|
|
||||||
.TP
|
|
||||||
.B -i
|
|
||||||
Internal address. IP address proxy accepts connections to.
|
|
||||||
By default connection to any interface is accepted. It\'s usually unsafe.
|
|
||||||
.TP
|
|
||||||
.B -l
|
|
||||||
Log. By default logging is to stdout. If
|
|
||||||
.I logfile
|
|
||||||
is specified logging is to file. Under Unix, if
|
|
||||||
.RI \' @ \'
|
|
||||||
preceeds
|
|
||||||
.IR logfile ,
|
|
||||||
syslog is used for logging.
|
|
||||||
.TP
|
|
||||||
.B -S
|
|
||||||
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
|
|
||||||
crashes.
|
|
||||||
.SH ARGUMENTS
|
|
||||||
.TP
|
|
||||||
.I local_port
|
|
||||||
- port icqpr accepts connection
|
|
||||||
.TP
|
|
||||||
.I remote_host
|
|
||||||
- IP address of the host connection is forwarded to
|
|
||||||
.TP
|
|
||||||
.I remote_port
|
|
||||||
- remote port connection is forwarded to
|
|
||||||
.SH CLIENTS
|
|
||||||
You can use any ICQ/AOL client where server address configuration is supported
|
|
||||||
or spoof login server name (e.g. login.icq.com) with IP address of proxy server
|
|
||||||
via DNS record or hosts file. Transparent redirection is also possible. Use
|
|
||||||
.I internal_ip
|
|
||||||
and
|
|
||||||
.I local_port
|
|
||||||
as a destination in client application. Connection is forwarded to
|
|
||||||
.IR remote_host : remote_port
|
|
||||||
.SH BUGS
|
|
||||||
Report all bugs to
|
|
||||||
.BR 3proxy@3proxy.ru
|
|
||||||
.SH SEE ALSO
|
|
||||||
3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8),
|
|
||||||
.br
|
|
||||||
https://3proxy.org/
|
|
||||||
.SH AUTHORS
|
|
||||||
3proxy is designed by Vladimir 3APA3A Dubrovin
|
|
||||||
.RI ( 3proxy@3proxy.ru )
|
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
man/3proxy.8
|
man/3proxy.8
|
||||||
man/3proxy.cfg.3
|
man/3proxy.cfg.3
|
||||||
man/ftppr.8
|
man/ftppr.8
|
||||||
man/icqpr.8
|
|
||||||
man/pop3p.8
|
man/pop3p.8
|
||||||
man/proxy.8
|
man/proxy.8
|
||||||
man/smtpp.8
|
man/smtpp.8
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
3proxy (0.9.3-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 0.9.3 initial build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Thu, 03 Dec 2020 21:13:58 +0300
|
||||||
|
|
||||||
3proxy (0.9.2-1) buster; urgency=medium
|
3proxy (0.9.2-1) buster; urgency=medium
|
||||||
|
|
||||||
*3proxy 0.9.2 initial build
|
*3proxy 0.9.2 initial build
|
||||||
|
|||||||
@@ -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,6 +1,6 @@
|
|||||||
Name: 3proxy
|
Name: 3proxy
|
||||||
Version: 0.9.2
|
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/
|
||||||
@@ -51,7 +51,6 @@ make clean
|
|||||||
/usr/share/man/man3/3proxy.cfg.3
|
/usr/share/man/man3/3proxy.cfg.3
|
||||||
/usr/share/man/man8/3proxy.8
|
/usr/share/man/man8/3proxy.8
|
||||||
/usr/share/man/man8/ftppr.8
|
/usr/share/man/man8/ftppr.8
|
||||||
/usr/share/man/man8/icqpr.8
|
|
||||||
/usr/share/man/man8/pop3p.8
|
/usr/share/man/man8/pop3p.8
|
||||||
/usr/share/man/man8/proxy.8
|
/usr/share/man/man8/proxy.8
|
||||||
/usr/share/man/man8/smtpp.8
|
/usr/share/man/man8/smtpp.8
|
||||||
@@ -62,7 +61,6 @@ make clean
|
|||||||
/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
|
||||||
/usr/share/man/man8/icqpr.8.gz
|
|
||||||
/usr/share/man/man8/pop3p.8.gz
|
/usr/share/man/man8/pop3p.8.gz
|
||||||
/usr/share/man/man8/proxy.8.gz
|
/usr/share/man/man8/proxy.8.gz
|
||||||
/usr/share/man/man8/smtpp.8.gz
|
/usr/share/man/man8/smtpp.8.gz
|
||||||
@@ -77,7 +75,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
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
#ifndef NOPLUGINS
|
#ifndef NOPLUGINS
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#ifdef WITH_SSL
|
||||||
|
#include <openssl/applink.c>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULTCONFIG
|
#ifndef DEFAULTCONFIG
|
||||||
|
|||||||
File renamed without changes.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
@@ -1,9 +1,8 @@
|
|||||||
#include "src/version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION 0,9,2,201122
|
FILEVERSION MAJOR3PROXY,SUBMAJOR3PROXY,MINOR3PROXY,SUBMINOR3PROXY
|
||||||
PRODUCTVERSION 0,9,2,201122
|
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.2\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.2\0"
|
VALUE "ProductVersion", RELEASE3PROXY
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
+1
-3
@@ -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)
|
|
||||||
+47
-16
@@ -253,6 +253,25 @@ int handleredirect(struct clientparam * param, struct ace * acentry){
|
|||||||
if(cur->type == R_EXTIP){
|
if(cur->type == R_EXTIP){
|
||||||
param->sinsl = cur->addr;
|
param->sinsl = cur->addr;
|
||||||
if(SAISNULL(¶m->sinsl))param->sinsl = param->sincr;
|
if(SAISNULL(¶m->sinsl))param->sinsl = param->sincr;
|
||||||
|
#ifndef NOIPV6
|
||||||
|
else if(cur->cidr && *SAFAMILY(¶m->sinsl) == AF_INET6){
|
||||||
|
uint16_t c;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < 8; i++){
|
||||||
|
if(i==4)myrand(¶m->sincr, sizeof(param->sincr));
|
||||||
|
else if(i==6) myrand(¶m->req, sizeof(param->req));
|
||||||
|
|
||||||
|
if(i*16 >= cur->cidr) ((uint16_t *)SAADDR(¶m->sinsl))[i] |= rand();
|
||||||
|
else if ((i+1)*16 > cur->cidr){
|
||||||
|
c = rand();
|
||||||
|
c >>= (cur->cidr - (i*16));
|
||||||
|
c |= ntohs(((uint16_t *)SAADDR(¶m->sinsl))[i]);
|
||||||
|
((uint16_t *)SAADDR(¶m->sinsl))[i] = htons(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if(cur->next)continue;
|
if(cur->next)continue;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -298,7 +317,7 @@ int handleredirect(struct clientparam * param, struct ace * acentry){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((res = alwaysauth(param))){
|
if((res = alwaysauth(param))){
|
||||||
return (res == 10)? res : 60+res;
|
return (res >= 10)? res : 60+res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -605,30 +624,28 @@ void trafcountfunc(struct clientparam *param){
|
|||||||
pthread_mutex_lock(&tc_mutex);
|
pthread_mutex_lock(&tc_mutex);
|
||||||
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;
|
|
||||||
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) {
|
||||||
if(ACLmatches(tc->ace, param)){
|
if(ACLmatches(tc->ace, param)){
|
||||||
time_t t;
|
|
||||||
if(tc->ace->action == NOCOUNTOUT || tc->ace->action == NOCOUNTALL) break;
|
if(tc->ace->action == NOCOUNTOUT || tc->ace->action == NOCOUNTALL) break;
|
||||||
if(tc->ace->action != COUNTOUT && tc->ace->action != COUNTALL ) {
|
if(tc->ace->action != COUNTOUT && tc->ace->action != COUNTALL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tc->traf64 += param->statscli64;
|
tc->traf64 += param->statscli64;
|
||||||
time(&t);
|
tc->updated = conf.time;
|
||||||
tc->updated = t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,10 +672,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 +689,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;
|
||||||
@@ -695,6 +716,7 @@ int checkACL(struct clientparam * param){
|
|||||||
param->weight = acentry->weight;
|
param->weight = acentry->weight;
|
||||||
if(acentry->action == 2) {
|
if(acentry->action == 2) {
|
||||||
struct ace dup;
|
struct ace dup;
|
||||||
|
int res=60,i=0;
|
||||||
|
|
||||||
if(param->operation < 256 && !(param->operation & CONNECT)){
|
if(param->operation < 256 && !(param->operation & CONNECT)){
|
||||||
continue;
|
continue;
|
||||||
@@ -702,8 +724,17 @@ int checkACL(struct clientparam * param){
|
|||||||
if(param->redirected && acentry->chains && SAISNULL(&acentry->chains->addr) && !*SAPORT(&acentry->chains->addr)) {
|
if(param->redirected && acentry->chains && SAISNULL(&acentry->chains->addr) && !*SAPORT(&acentry->chains->addr)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dup = *acentry;
|
if(param->remsock != INVALID_SOCKET) {
|
||||||
return handleredirect(param, &dup);
|
return 0;
|
||||||
|
}
|
||||||
|
for(; i < conf.parentretries; i++){
|
||||||
|
dup = *acentry;
|
||||||
|
res = handleredirect(param, &dup);
|
||||||
|
if(!res) break;
|
||||||
|
if(param->remsock != INVALID_SOCKET) so._closesocket(param->remsock);
|
||||||
|
param->remsock = INVALID_SOCKET;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return acentry->action;
|
return acentry->action;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -102,7 +102,7 @@ struct extparam conf = {
|
|||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
0, -1, 0, 0, 0, 0,
|
0, -1, 0, 0, 0, 0,
|
||||||
0, 500, 0, 0, 0, 0, 0,
|
0, 500, 0, 0, 0, 0, 0, 2,
|
||||||
6, 600,
|
6, 600,
|
||||||
1048576,
|
1048576,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
@@ -137,13 +137,13 @@ char* NULLADDR="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
|
|||||||
|
|
||||||
int myrand(void * entropy, int len){
|
int myrand(void * entropy, int len){
|
||||||
int i;
|
int i;
|
||||||
unsigned short init;
|
uint16_t init;
|
||||||
|
|
||||||
init = randomizer;
|
init = randomizer;
|
||||||
for(i=0; i < len/2; i++){
|
for(i=0; i < len/2; i++){
|
||||||
init ^= ((unsigned short *)entropy)[i];
|
init ^= ((uint16_t *)entropy)[i];
|
||||||
}
|
}
|
||||||
srand(init);
|
srand(rand()+init);
|
||||||
randomizer = rand();
|
randomizer = rand();
|
||||||
return rand();
|
return rand();
|
||||||
|
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -398,7 +398,7 @@ int doconnect(struct clientparam * param){
|
|||||||
return 0;
|
return 0;
|
||||||
if (param->remsock != INVALID_SOCKET){
|
if (param->remsock != INVALID_SOCKET){
|
||||||
size = sizeof(param->sinsr);
|
size = sizeof(param->sinsr);
|
||||||
if(so._getpeername(param->remsock, (struct sockaddr *)¶m->sinsr, &size)==-1) {return (15);}
|
if(so._getpeername(param->remsock, (struct sockaddr *)¶m->sinsr, &size)==-1) {return (14);}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct linger lg = {1,conf.timeouts[SINGLEBYTE_S]};
|
struct linger lg = {1,conf.timeouts[SINGLEBYTE_S]};
|
||||||
|
|||||||
+38
-8
@@ -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);
|
||||||
@@ -625,6 +624,15 @@ static int h_nscache(int argc, unsigned char **argv){
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int h_parentretries(int argc, unsigned char **argv){
|
||||||
|
int res;
|
||||||
|
|
||||||
|
res = atoi((char *)argv[1]);
|
||||||
|
if(res > 0) conf.parentretries = res;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int h_nscache6(int argc, unsigned char **argv){
|
static int h_nscache6(int argc, unsigned char **argv){
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@@ -702,6 +710,7 @@ static int h_monitor(int argc, unsigned char **argv){
|
|||||||
static int h_parent(int argc, unsigned char **argv){
|
static int h_parent(int argc, unsigned char **argv){
|
||||||
struct ace *acl = NULL;
|
struct ace *acl = NULL;
|
||||||
struct chain *chains;
|
struct chain *chains;
|
||||||
|
char * cidr;
|
||||||
|
|
||||||
acl = conf.acl;
|
acl = conf.acl;
|
||||||
while(acl && acl->next) acl = acl->next;
|
while(acl && acl->next) acl = acl->next;
|
||||||
@@ -740,13 +749,15 @@ static int h_parent(int argc, unsigned char **argv){
|
|||||||
fprintf(stderr, "Chaining error: bad chain type (%s)\n", argv[2]);
|
fprintf(stderr, "Chaining error: bad chain type (%s)\n", argv[2]);
|
||||||
return(4);
|
return(4);
|
||||||
}
|
}
|
||||||
#ifndef NOIPV6
|
cidr = strchr(argv[3], '/');
|
||||||
if(!getip46(46, argv[3], (struct sockaddr *)&chains->addr)) return 5;
|
if(cidr) *cidr = 0;
|
||||||
#else
|
|
||||||
getip46(46, argv[3], (struct sockaddr *)&chains->addr);
|
getip46(46, argv[3], (struct sockaddr *)&chains->addr);
|
||||||
#endif
|
|
||||||
chains->exthost = (unsigned char *)mystrdup((char *)argv[3]);
|
chains->exthost = (unsigned char *)mystrdup((char *)argv[3]);
|
||||||
if(!chains->exthost) return 21;
|
if(!chains->exthost) return 21;
|
||||||
|
if(cidr){
|
||||||
|
*cidr = '/';
|
||||||
|
chains->cidr = atoi(cidr + 1);
|
||||||
|
}
|
||||||
*SAPORT(&chains->addr) = htons((unsigned short)atoi((char *)argv[4]));
|
*SAPORT(&chains->addr) = htons((unsigned short)atoi((char *)argv[4]));
|
||||||
if(argc > 5) chains->extuser = (unsigned char *)mystrdup((char *)argv[5]);
|
if(argc > 5) chains->extuser = (unsigned char *)mystrdup((char *)argv[5]);
|
||||||
if(argc > 6) chains->extpass = (unsigned char *)mystrdup((char *)argv[6]);
|
if(argc > 6) chains->extpass = (unsigned char *)mystrdup((char *)argv[6]);
|
||||||
@@ -785,12 +796,19 @@ int scanipl(unsigned char *arg, struct iplist *dst){
|
|||||||
#endif
|
#endif
|
||||||
char * slash, *dash;
|
char * slash, *dash;
|
||||||
int masklen, addrlen;
|
int masklen, addrlen;
|
||||||
|
int res;
|
||||||
|
|
||||||
if((slash = strchr((char *)arg, '/'))) *slash = 0;
|
if((slash = strchr((char *)arg, '/'))) *slash = 0;
|
||||||
if((dash = strchr((char *)arg,'-'))) *dash = 0;
|
if((dash = strchr((char *)arg,'-'))) *dash = 0;
|
||||||
|
|
||||||
if(afdetect(arg) == -1) return 1;
|
if(afdetect(arg) == -1) {
|
||||||
if(!getip46(46, arg, (struct sockaddr *)&sa)) return 1;
|
if(slash)*slash = '/';
|
||||||
|
if(dash)*dash = '-';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
res = getip46(46, arg, (struct sockaddr *)&sa);
|
||||||
|
if(dash)*dash = '-';
|
||||||
|
if(!res) return 1;
|
||||||
memcpy(&dst->ip_from, SAADDR(&sa), SAADDRLEN(&sa));
|
memcpy(&dst->ip_from, SAADDR(&sa), SAADDRLEN(&sa));
|
||||||
dst->family = *SAFAMILY(&sa);
|
dst->family = *SAFAMILY(&sa);
|
||||||
if(dash){
|
if(dash){
|
||||||
@@ -802,6 +820,7 @@ int scanipl(unsigned char *arg, struct iplist *dst){
|
|||||||
}
|
}
|
||||||
memcpy(&dst->ip_to, &dst->ip_from, SAADDRLEN(&sa));
|
memcpy(&dst->ip_to, &dst->ip_from, SAADDRLEN(&sa));
|
||||||
if(slash){
|
if(slash){
|
||||||
|
*slash = '/';
|
||||||
addrlen = SAADDRLEN(&sa);
|
addrlen = SAADDRLEN(&sa);
|
||||||
masklen = atoi(slash+1);
|
masklen = atoi(slash+1);
|
||||||
if(masklen < 0 || masklen > (addrlen*8)) return 4;
|
if(masklen < 0 || masklen > (addrlen*8)) return 4;
|
||||||
@@ -1146,6 +1165,7 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
case REDIRECT:
|
case REDIRECT:
|
||||||
acl->chains = myalloc(sizeof(struct chain));
|
acl->chains = myalloc(sizeof(struct chain));
|
||||||
if(!acl->chains) {
|
if(!acl->chains) {
|
||||||
|
freeacl(acl);
|
||||||
return(21);
|
return(21);
|
||||||
}
|
}
|
||||||
memset(acl->chains, 0, sizeof(struct chain));
|
memset(acl->chains, 0, sizeof(struct chain));
|
||||||
@@ -1169,6 +1189,7 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
case NOCONNLIM:
|
case NOCONNLIM:
|
||||||
ncl = myalloc(sizeof(struct connlim));
|
ncl = myalloc(sizeof(struct connlim));
|
||||||
if(!ncl) {
|
if(!ncl) {
|
||||||
|
freeacl(acl);
|
||||||
return(21);
|
return(21);
|
||||||
}
|
}
|
||||||
memset(ncl, 0, sizeof(struct connlim));
|
memset(ncl, 0, sizeof(struct connlim));
|
||||||
@@ -1195,6 +1216,7 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
|
|
||||||
nbl = myalloc(sizeof(struct bandlim));
|
nbl = myalloc(sizeof(struct bandlim));
|
||||||
if(!nbl) {
|
if(!nbl) {
|
||||||
|
freeacl(acl);
|
||||||
return(21);
|
return(21);
|
||||||
}
|
}
|
||||||
memset(nbl, 0, sizeof(struct bandlim));
|
memset(nbl, 0, sizeof(struct bandlim));
|
||||||
@@ -1202,6 +1224,8 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
if(acl->action == BANDLIM) {
|
if(acl->action == BANDLIM) {
|
||||||
sscanf((char *)argv[1], "%u", &nbl->rate);
|
sscanf((char *)argv[1], "%u", &nbl->rate);
|
||||||
if(nbl->rate < 300) {
|
if(nbl->rate < 300) {
|
||||||
|
myfree(nbl);
|
||||||
|
freeacl(acl);
|
||||||
fprintf(stderr, "Wrong bandwidth specified, line %d\n", linenum);
|
fprintf(stderr, "Wrong bandwidth specified, line %d\n", linenum);
|
||||||
return(4);
|
return(4);
|
||||||
}
|
}
|
||||||
@@ -1239,8 +1263,10 @@ 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) {
|
||||||
|
freeacl(acl);
|
||||||
return(21);
|
return(21);
|
||||||
}
|
}
|
||||||
memset(tl, 0, sizeof(struct trafcount));
|
memset(tl, 0, sizeof(struct trafcount));
|
||||||
@@ -1259,6 +1285,8 @@ static int h_ace(int argc, unsigned char **argv){
|
|||||||
tl->type = getrotate(*argv[2]);
|
tl->type = getrotate(*argv[2]);
|
||||||
tl->traflim64 = ((uint64_t)lim)*(1024*1024);
|
tl->traflim64 = ((uint64_t)lim)*(1024*1024);
|
||||||
if(!tl->traflim64) {
|
if(!tl->traflim64) {
|
||||||
|
myfree(tl);
|
||||||
|
freeacl(acl);
|
||||||
fprintf(stderr, "Wrong traffic limit specified, line %d\n", linenum);
|
fprintf(stderr, "Wrong traffic limit specified, line %d\n", linenum);
|
||||||
return(6);
|
return(6);
|
||||||
}
|
}
|
||||||
@@ -1572,8 +1600,9 @@ struct commands commandhandlers[]={
|
|||||||
{commandhandlers+60, "stacksize", h_stacksize, 2, 2},
|
{commandhandlers+60, "stacksize", h_stacksize, 2, 2},
|
||||||
{commandhandlers+61, "force", h_force, 1, 1},
|
{commandhandlers+61, "force", h_force, 1, 1},
|
||||||
{commandhandlers+62, "noforce", h_noforce, 1, 1},
|
{commandhandlers+62, "noforce", h_noforce, 1, 1},
|
||||||
|
{commandhandlers+63, "parentretries", h_parentretries, 2, 2},
|
||||||
#ifndef NORADIUS
|
#ifndef NORADIUS
|
||||||
{commandhandlers+63, "radius", h_radius, 3, 0},
|
{commandhandlers+64, "radius", h_radius, 3, 0},
|
||||||
#endif
|
#endif
|
||||||
{specificcommands, "", h_noop, 1, 0}
|
{specificcommands, "", h_noop, 1, 0}
|
||||||
};
|
};
|
||||||
@@ -1776,6 +1805,7 @@ void freeconf(struct extparam *confp){
|
|||||||
confp->bandlimiter = NULL;
|
confp->bandlimiter = NULL;
|
||||||
confp->bandlimiterout = NULL;
|
confp->bandlimiterout = NULL;
|
||||||
confp->bandlimfunc = NULL;
|
confp->bandlimfunc = NULL;
|
||||||
|
confp->bandlimver++;
|
||||||
pthread_mutex_unlock(&bandlim_mutex);
|
pthread_mutex_unlock(&bandlim_mutex);
|
||||||
pthread_mutex_lock(&connlim_mutex);
|
pthread_mutex_lock(&connlim_mutex);
|
||||||
cl = confp->connlimiter;
|
cl = confp->connlimiter;
|
||||||
|
|||||||
+4
-25
@@ -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";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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])) {
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#ifdef WIN32
|
|
||||||
#include <openssl/applink.c>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../../proxy.h"
|
#include "../../proxy.h"
|
||||||
#include "my_ssl.h"
|
#include "my_ssl.h"
|
||||||
@@ -104,7 +101,7 @@ void del_ext(X509 *dst_cert, int nid, int where){
|
|||||||
SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
||||||
{
|
{
|
||||||
int err = -1;
|
int err = -1;
|
||||||
FILE *fcache;
|
BIO *fcache;
|
||||||
X509 *src_cert = (X509 *) cert;
|
X509 *src_cert = (X509 *) cert;
|
||||||
X509 *dst_cert = NULL;
|
X509 *dst_cert = NULL;
|
||||||
|
|
||||||
@@ -129,16 +126,16 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
|||||||
bin2hex(hash_sha1, 20, hash_name_sha1, sizeof(hash_name_sha1));
|
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 = BIO_new_file(cache_name, "rb");
|
||||||
if ( fcache != NULL ) {
|
if ( fcache != NULL ) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
flock(fileno(fcache), LOCK_SH);
|
flock(BIO_get_fd(fcache, NULL), LOCK_SH);
|
||||||
#endif
|
#endif
|
||||||
dst_cert = PEM_read_X509(fcache, &dst_cert, NULL, NULL);
|
dst_cert = PEM_read_bio_X509(fcache, &dst_cert, NULL, NULL);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
flock(fileno(fcache), LOCK_UN);
|
flock(BIO_get_fd(fcache, NULL), LOCK_UN);
|
||||||
#endif
|
#endif
|
||||||
fclose(fcache);
|
BIO_free(fcache);
|
||||||
if ( dst_cert != NULL ){
|
if ( dst_cert != NULL ){
|
||||||
return dst_cert;
|
return dst_cert;
|
||||||
}
|
}
|
||||||
@@ -174,16 +171,16 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
|||||||
|
|
||||||
/* write to cache */
|
/* write to cache */
|
||||||
|
|
||||||
fcache = fopen(cache_name, "wb");
|
fcache = BIO_new_file(cache_name, "wb");
|
||||||
if ( fcache != NULL ) {
|
if ( fcache != NULL ) {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
flock(fileno(fcache), LOCK_EX);
|
flock(BIO_get_fd(fcache, NULL), LOCK_EX);
|
||||||
#endif
|
#endif
|
||||||
PEM_write_X509(fcache, dst_cert);
|
PEM_write_bio_X509(fcache, dst_cert);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
flock(fileno(fcache), LOCK_UN);
|
flock(BIO_get_fd(fcache, NULL), LOCK_UN);
|
||||||
#endif
|
#endif
|
||||||
fclose(fcache);
|
BIO_free(fcache);
|
||||||
}
|
}
|
||||||
return dst_cert;
|
return dst_cert;
|
||||||
}
|
}
|
||||||
@@ -414,50 +411,64 @@ int ssl_file_init = 0;
|
|||||||
|
|
||||||
void ssl_init(void)
|
void ssl_init(void)
|
||||||
{
|
{
|
||||||
FILE *f;
|
BIO *f;
|
||||||
static char fname[200];
|
static char fname[200];
|
||||||
|
|
||||||
if(!ssl_file_init++)pthread_mutex_init(&ssl_file_mutex, NULL);
|
if(!ssl_file_init++)pthread_mutex_init(&ssl_file_mutex, NULL);
|
||||||
|
|
||||||
pthread_mutex_lock(&ssl_file_mutex);
|
pthread_mutex_lock(&ssl_file_mutex);
|
||||||
thread_setup();
|
thread_setup();
|
||||||
|
|
||||||
SSLeay_add_ssl_algorithms();
|
SSLeay_add_ssl_algorithms();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
|
|
||||||
sprintf(fname, "%.128s3proxy.pem", cert_path);
|
sprintf(fname, "%.128s3proxy.pem", cert_path);
|
||||||
f = fopen(fname, "r");
|
f = BIO_new_file(fname, "r");
|
||||||
if ( f != NULL ) {
|
if ( f != NULL ) {
|
||||||
PEM_read_X509(f, &CA_cert, NULL, NULL);
|
if(!(CA_cert=PEM_read_bio_X509(f, NULL, NULL, NULL))){
|
||||||
fclose(f);
|
unsigned long err;
|
||||||
|
err=ERR_get_error();
|
||||||
|
fprintf(stderr, "failed to read: %s: [%lu] %s\n", fname, err, ERR_error_string(err, NULL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BIO_free(f);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "failed to open: %s\n", fname);
|
fprintf(stderr, "failed to open: %s\n", fname);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
name = X509_get_subject_name(CA_cert);
|
name = X509_get_subject_name(CA_cert);
|
||||||
|
|
||||||
sprintf(fname, "%.128s3proxy.key", cert_path);
|
sprintf(fname, "%.128s3proxy.key", cert_path);
|
||||||
f = fopen(fname, "rb");
|
f = BIO_new_file(fname, "rb");
|
||||||
if ( f != NULL ) {
|
if ( f != NULL ) {
|
||||||
CA_key = PEM_read_PrivateKey(f, &CA_key, NULL, NULL);
|
CA_key = PEM_read_bio_PrivateKey(f, NULL, NULL, NULL);
|
||||||
fclose(f);
|
if(!CA_key){
|
||||||
|
unsigned long err;
|
||||||
|
err=ERR_get_error();
|
||||||
|
fprintf(stderr, "failed to read: %s: [%lu] %s\n", fname, err, ERR_error_string(err, NULL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BIO_free(f);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "failed to open: %s\n", fname);
|
fprintf(stderr, "failed to open: %s\n", fname);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(fname, "%.128sserver.key", cert_path);
|
sprintf(fname, "%.128sserver.key", cert_path);
|
||||||
f = fopen(fname, "rb");
|
f = BIO_new_file(fname, "rb");
|
||||||
if ( f != NULL ) {
|
if ( f != NULL ) {
|
||||||
server_key = PEM_read_PrivateKey(f, &server_key, NULL, NULL);
|
server_key = PEM_read_bio_PrivateKey(f, &server_key, NULL, NULL);
|
||||||
fclose(f);
|
if(!server_key){
|
||||||
|
unsigned long err;
|
||||||
|
err=ERR_get_error();
|
||||||
|
fprintf(stderr, "failed to read: %s: [%lu] %s\n", fname, err, ERR_error_string(err, NULL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BIO_free(f);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "failed to open: %s\n", fname);
|
fprintf(stderr, "failed to open: %s\n", fname);
|
||||||
}
|
}
|
||||||
if(!CA_cert || !CA_key || !server_key){
|
|
||||||
fprintf(stderr, "failed to init SSL certificate / keys\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
|
||||||
pthread_mutex_unlock(&ssl_file_mutex);
|
pthread_mutex_unlock(&ssl_file_mutex);
|
||||||
|
|||||||
@@ -120,10 +120,10 @@ static int ssl_send(SOCKET s, const void *msg, size_t len, int flags){
|
|||||||
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){
|
if (err == SSL_ERROR_WANT_WRITE){
|
||||||
_set_errno(EAGAIN);
|
seterrno3(EAGAIN);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else _set_errno(err);
|
else seterrno3(err);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -144,10 +144,10 @@ static int ssl_sendto(SOCKET s, const void *msg, size_t len, int flags, const st
|
|||||||
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){
|
if (err == SSL_ERROR_WANT_WRITE){
|
||||||
_set_errno(EAGAIN);
|
seterrno3(EAGAIN);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else _set_errno(err);
|
else seterrno3(err);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -167,10 +167,10 @@ static int ssl_recvfrom(SOCKET s, void *msg, size_t len, int flags, struct socka
|
|||||||
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) {
|
if (err == SSL_ERROR_WANT_READ) {
|
||||||
_set_errno(EAGAIN);
|
seterrno3(EAGAIN);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else _set_errno(err);
|
else seterrno3(err);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -189,10 +189,10 @@ static int WINAPI ssl_recv(SOCKET s, void *msg, size_t len, int flags){
|
|||||||
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) {
|
if (err == SSL_ERROR_WANT_READ) {
|
||||||
_set_errno(EAGAIN);
|
seterrno3(EAGAIN);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else _set_errno(err);
|
else seterrno3(err);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
|
|||||||
newitem->port = atoi((char *)argv[3]);
|
newitem->port = atoi((char *)argv[3]);
|
||||||
newitem->coeff = atof((char *)argv[4]);
|
newitem->coeff = atof((char *)argv[4]);
|
||||||
/* ďđîâĺđęŕ íŕ ęîđđĺęňíîńňü ââîäŕ */
|
/* ďđîâĺđęŕ íŕ ęîđđĺęňíîńňü ââîäŕ */
|
||||||
if ((newitem->port>65535) | (newitem->coeff<=0) | (newitem->coeff>100)) {
|
if ((newitem->port>65535) || (newitem->coeff<=0) || (newitem->coeff>100)) {
|
||||||
free(newitem);
|
free(newitem);
|
||||||
if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535 and coefficient must be 0<c<100.\n");
|
if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535 and coefficient must be 0<c<100.\n");
|
||||||
return 2;
|
return 2;
|
||||||
@@ -146,7 +146,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
|
|||||||
|
|
||||||
newitem->con_type = TCP;
|
newitem->con_type = TCP;
|
||||||
newitem->psize = 52;
|
newitem->psize = 52;
|
||||||
if ((!strcmp((char *)argv[3], "udp")) & (newitem->p_service != S_PROXY) & (newitem->p_service != S_TCPPM) & (newitem->p_service != S_POP3P)) {
|
if ((!strcmp((char *)argv[3], "udp")) && (newitem->p_service != S_PROXY) && (newitem->p_service != S_TCPPM) && (newitem->p_service != S_POP3P)) {
|
||||||
newitem->con_type = UDP;
|
newitem->con_type = UDP;
|
||||||
newitem->psize = 48;
|
newitem->psize = 48;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ int h_trafcorrect(int argc, unsigned char ** argv) {
|
|||||||
newitem->psize = atoi((char *)argv[5]);
|
newitem->psize = atoi((char *)argv[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((newitem->port>65535) | (newitem->psize<=0)) {
|
if ((newitem->port>65535) || (newitem->psize<=0)) {
|
||||||
free(newitem);
|
free(newitem);
|
||||||
if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535.\n");
|
if(DBGLEVEL == 1)fprintf(stdout, "Port must be 0<p<65535.\n");
|
||||||
return 2;
|
return 2;
|
||||||
|
|||||||
+12
-2
@@ -231,13 +231,14 @@ void * proxychild(struct clientparam* param) {
|
|||||||
SOCKET ftps;
|
SOCKET ftps;
|
||||||
char ftpbuf[FTPBUFSIZE];
|
char ftpbuf[FTPBUFSIZE];
|
||||||
int inftpbuf = 0;
|
int inftpbuf = 0;
|
||||||
|
int haveconnection = 0;
|
||||||
#ifndef WITHMAIN
|
#ifndef WITHMAIN
|
||||||
FILTER_ACTION action;
|
FILTER_ACTION action;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(param->remsock != INVALID_SOCKET) haveconnection = 1;
|
||||||
if(!(buf = myalloc(BUFSIZE))) {RETURN(21);}
|
if(!(buf = myalloc(BUFSIZE))) {RETURN(21);}
|
||||||
bufsize = BUFSIZE;
|
bufsize = BUFSIZE;
|
||||||
anonymous = param->srv->anonymous;
|
anonymous = param->srv->anonymous;
|
||||||
@@ -566,7 +567,16 @@ for(;;){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(param->srv->needuser > 1 && !param->username) {RETURN(4);}
|
if(param->srv->needuser > 1 && !param->username) {RETURN(4);}
|
||||||
if((res = (*param->srv->authfunc)(param))) {RETURN(res);}
|
if((res = (*param->srv->authfunc)(param))) {
|
||||||
|
if (res <= 10 || haveconnection || param->transparent) RETURN(res);
|
||||||
|
so._closesocket(param->remsock);
|
||||||
|
param->remsock = INVALID_SOCKET;
|
||||||
|
param->redirected = 0;
|
||||||
|
param->redirtype = 0;
|
||||||
|
memset(¶m->sinsl, 0, sizeof(param->sinsl));
|
||||||
|
memset(¶m->sinsr, 0, sizeof(param->sinsr));
|
||||||
|
if((res = (*param->srv->authfunc)(param))) RETURN(res);
|
||||||
|
}
|
||||||
|
|
||||||
if(ftp && param->redirtype != R_HTTP){
|
if(ftp && param->redirtype != R_HTTP){
|
||||||
SOCKET s;
|
SOCKET s;
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ void daemonize(void);
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
|
#define seterrno3(x) _set_errno(x)
|
||||||
|
#else
|
||||||
|
#define seterrno3(x) (errno = x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SOCKET_ERROR
|
#ifndef SOCKET_ERROR
|
||||||
|
|||||||
+12
-3
@@ -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*)¶m->sinsr, (unsigned char *)"C", 1, CONNBACK_TO) != 1){
|
if(socksendto(param->remsock, (struct sockaddr*)¶m->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;
|
||||||
@@ -705,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);
|
||||||
@@ -763,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));
|
||||||
|
|||||||
+66
-25
@@ -202,7 +202,13 @@ log("send to server from buf");
|
|||||||
}
|
}
|
||||||
sasize = sizeof(param->sinsr);
|
sasize = sizeof(param->sinsr);
|
||||||
res = so._sendto(param->remsock, (char *)param->clibuf + param->clioffset, (int)MIN(inclientbuf, fromclient), 0, (struct sockaddr*)¶m->sinsr, sasize);
|
res = so._sendto(param->remsock, (char *)param->clibuf + param->clioffset, (int)MIN(inclientbuf, fromclient), 0, (struct sockaddr*)¶m->sinsr, sasize);
|
||||||
if(res <= 0) TOSERVER = 0;
|
if(res <= 0) {
|
||||||
|
TOSERVER = 0;
|
||||||
|
if(errno && errno != EAGAIN && errno != EINTR){
|
||||||
|
SERVERTERM = 1;
|
||||||
|
HASERROR |= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("done send to server from buf");
|
log("done send to server from buf");
|
||||||
@@ -241,7 +247,14 @@ log("send to client from buf");
|
|||||||
}
|
}
|
||||||
sasize = sizeof(param->sincr);
|
sasize = sizeof(param->sincr);
|
||||||
res = so._sendto(param->clisock, (char *)param->srvbuf + param->srvoffset, (int)MIN(inserverbuf,fromserver), 0, (struct sockaddr*)¶m->sincr, sasize);
|
res = so._sendto(param->clisock, (char *)param->srvbuf + param->srvoffset, (int)MIN(inserverbuf,fromserver), 0, (struct sockaddr*)¶m->sincr, sasize);
|
||||||
if(res <= 0) TOCLIENT = 0;
|
if(res <= 0) {
|
||||||
|
TOCLIENT = 0;
|
||||||
|
if(errno && errno != EAGAIN && errno != EINTR){
|
||||||
|
CLIENTTERM = 1;
|
||||||
|
HASERROR |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("done send to client from buf");
|
log("done send to client from buf");
|
||||||
@@ -262,10 +275,16 @@ log("done send to client from buf");
|
|||||||
log("send to server from pipe");
|
log("send to server from pipe");
|
||||||
#endif
|
#endif
|
||||||
res = splice(pipecli[0], NULL, param->remsock, NULL, MIN(MAXSPLICE, inclientpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
res = splice(pipecli[0], NULL, param->remsock, NULL, MIN(MAXSPLICE, inclientpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
||||||
if(res >0) {
|
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("done send to server from pipe");
|
log("server from pipe splice finished\n");
|
||||||
|
#if WITHLOG > 1
|
||||||
|
#ifdef WITHSPLICE
|
||||||
|
sprintf(logbuf, "res: %d, errno: %d", (int)res, (int)errno);
|
||||||
|
log(logbuf);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
if(res >0) {
|
||||||
param->nwrites++;
|
param->nwrites++;
|
||||||
param->statscli64 += res;
|
param->statscli64 += res;
|
||||||
inclientpipe -= res;
|
inclientpipe -= res;
|
||||||
@@ -287,10 +306,16 @@ log("done send to server from pipe");
|
|||||||
log("send to client from pipe");
|
log("send to client from pipe");
|
||||||
#endif
|
#endif
|
||||||
res = splice(pipesrv[0], NULL, param->clisock, NULL, MIN(MAXSPLICE, inserverpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
res = splice(pipesrv[0], NULL, param->clisock, NULL, MIN(MAXSPLICE, inserverpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
||||||
if(res > 0) {
|
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("done send to client from pipe");
|
log("client from pipe splice finished\n");
|
||||||
|
#if WITHLOG > 1
|
||||||
|
#ifdef WITHSPLICE
|
||||||
|
sprintf(logbuf, "res: %d, errno: %d", (int)res, (int)errno);
|
||||||
|
log(logbuf);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
if(res > 0) {
|
||||||
inserverpipe -= res;
|
inserverpipe -= res;
|
||||||
fromserver -= res;
|
fromserver -= res;
|
||||||
if(fromserver)TOSERVERPIPE = 1;
|
if(fromserver)TOSERVERPIPE = 1;
|
||||||
@@ -307,13 +332,20 @@ log("done send to client from pipe");
|
|||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("read from client to pipe");
|
log("read from client to pipe");
|
||||||
#endif
|
#endif
|
||||||
|
errno = 0;
|
||||||
res = splice(param->clisock, NULL, pipecli[1], NULL, (int)MIN((uint64_t)MAXSPLICE - inclientpipe, (uint64_t)fromclient-inclientpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
res = splice(param->clisock, NULL, pipecli[1], NULL, (int)MIN((uint64_t)MAXSPLICE - inclientpipe, (uint64_t)fromclient-inclientpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
||||||
if(res <= 0) {
|
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("read failed");
|
log("client to pipe splice finished\n");
|
||||||
|
#if WITHLOG > 1
|
||||||
|
#ifdef WITHSPLICE
|
||||||
|
sprintf(logbuf, "res: %d, errno: %d", (int)res, (int)errno);
|
||||||
|
log(logbuf);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
if(res <= 0) {
|
||||||
FROMCLIENT = TOCLIENTPIPE = 0;
|
FROMCLIENT = TOCLIENTPIPE = 0;
|
||||||
if(res == 0) {
|
if(res == 0 && !errno) {
|
||||||
CLIENTTERM = 1;
|
CLIENTTERM = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -331,16 +363,23 @@ log("done read from client to pipe");
|
|||||||
if(fromserver > inserverpipe && FROMSERVER && TOSERVERPIPE){
|
if(fromserver > inserverpipe && FROMSERVER && TOSERVERPIPE){
|
||||||
int error;
|
int error;
|
||||||
socklen_t len=sizeof(error);
|
socklen_t len=sizeof(error);
|
||||||
|
errno = 0;
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("read from server to pipe\n");
|
log("read from server to pipe\n");
|
||||||
#endif
|
#endif
|
||||||
res = splice(param->remsock, NULL, pipesrv[1], NULL, MIN(MAXSPLICE - inclientpipe, fromserver - inserverpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
res = splice(param->remsock, NULL, pipesrv[1], NULL, MIN(MAXSPLICE - inclientpipe, fromserver - inserverpipe), SPLICE_F_NONBLOCK|SPLICE_F_MOVE);
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("splice finished\n");
|
log("server to pipe splice finished\n");
|
||||||
|
#if WITHLOG > 1
|
||||||
|
#ifdef WITHSPLICE
|
||||||
|
sprintf(logbuf, "res: %d, errno: %d", (int)res, (int)errno);
|
||||||
|
log(logbuf);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(res <= 0) {
|
if(res <= 0) {
|
||||||
FROMSERVER = TOSERVERPIPE = 0;
|
FROMSERVER = TOSERVERPIPE = 0;
|
||||||
if(res == 0 || !errno) {
|
if(res == 0 && !errno) {
|
||||||
SERVERTERM = 1;
|
SERVERTERM = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -378,7 +417,7 @@ log("read from client to buf");
|
|||||||
res = so._recvfrom(param->clisock, (char *)param->clibuf + param->cliinbuf, (int)MIN((uint64_t)param->clibufsize - param->cliinbuf, fromclient-inclientbuf), 0, (struct sockaddr *)¶m->sincr, &sasize);
|
res = so._recvfrom(param->clisock, (char *)param->clibuf + param->cliinbuf, (int)MIN((uint64_t)param->clibufsize - param->cliinbuf, fromclient-inclientbuf), 0, (struct sockaddr *)¶m->sincr, &sasize);
|
||||||
if(res <= 0) {
|
if(res <= 0) {
|
||||||
FROMCLIENT = 0;
|
FROMCLIENT = 0;
|
||||||
if(res == 0){
|
if(res == 0 || (errno && errno != EINTR && errno !=EAGAIN)){
|
||||||
CLIENTTERM = 1;
|
CLIENTTERM = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -403,7 +442,7 @@ log("read from server to buf");
|
|||||||
res = so._recvfrom(param->remsock, (char *)param->srvbuf + param->srvinbuf, (int)MIN((uint64_t)param->srvbufsize - param->srvinbuf, fromserver-inserverbuf), 0, (struct sockaddr *)¶m->sinsr, &sasize);
|
res = so._recvfrom(param->remsock, (char *)param->srvbuf + param->srvinbuf, (int)MIN((uint64_t)param->srvbufsize - param->srvinbuf, fromserver-inserverbuf), 0, (struct sockaddr *)¶m->sinsr, &sasize);
|
||||||
if(res <= 0) {
|
if(res <= 0) {
|
||||||
FROMSERVER = 0;
|
FROMSERVER = 0;
|
||||||
if(res == 0) {
|
if(res == 0 || (errno && errno != EINTR && errno !=EAGAIN)) {
|
||||||
SERVERTERM = 1;
|
SERVERTERM = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -469,9 +508,6 @@ log("wait writing to client");
|
|||||||
CLIENTTERM = 1;
|
CLIENTTERM = 1;
|
||||||
HASERROR |= 1;
|
HASERROR |= 1;
|
||||||
}
|
}
|
||||||
else if(fds[fdsc].revents & (POLLHUP)) {
|
|
||||||
CLIENTTERM = 1;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if(fds[fdsc].revents & POLLIN) {
|
if(fds[fdsc].revents & POLLIN) {
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
@@ -485,6 +521,10 @@ log("ready to write to client");
|
|||||||
#endif
|
#endif
|
||||||
TOCLIENT = 1;
|
TOCLIENT = 1;
|
||||||
}
|
}
|
||||||
|
if(fds[fdsc].revents & (POLLHUP)) {
|
||||||
|
if(fds[fdsc].events & POLLIN) FROMCLIENT = 1;
|
||||||
|
if(fds[fdsc].events & POLLOUT) CLIENTTERM = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fdsc++;
|
fdsc++;
|
||||||
@@ -526,12 +566,6 @@ log("poll from server failed");
|
|||||||
SERVERTERM = 1;
|
SERVERTERM = 1;
|
||||||
HASERROR |=2;
|
HASERROR |=2;
|
||||||
}
|
}
|
||||||
if(fds[fdsc].revents & (POLLHUP)) {
|
|
||||||
#ifdef WITHLOG
|
|
||||||
log("server terminated connection");
|
|
||||||
#endif
|
|
||||||
SERVERTERM = 1;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if(fds[fdsc].revents & POLLIN) {
|
if(fds[fdsc].revents & POLLIN) {
|
||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
@@ -545,6 +579,13 @@ log("ready to write to server");
|
|||||||
#endif
|
#endif
|
||||||
TOSERVER = 1;
|
TOSERVER = 1;
|
||||||
}
|
}
|
||||||
|
if(fds[fdsc].revents & (POLLHUP)) {
|
||||||
|
#ifdef WITHLOG
|
||||||
|
log("server terminated connection");
|
||||||
|
#endif
|
||||||
|
if(fds[fdsc].events & POLLIN) FROMSERVER = 1;
|
||||||
|
if(fds[fdsc].events & POLLOUT) SERVERTERM = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fdsc++;
|
fdsc++;
|
||||||
@@ -587,7 +628,7 @@ log("wait reading from client pipe");
|
|||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("ready reading from client pipe");
|
log("ready reading from client pipe");
|
||||||
#endif
|
#endif
|
||||||
if(fds[fdsc].revents & POLLIN) FROMCLIENTPIPE = 1;
|
if(fds[fdsc].revents & (POLLIN)) FROMCLIENTPIPE = 1;
|
||||||
}
|
}
|
||||||
fdsc++;
|
fdsc++;
|
||||||
}
|
}
|
||||||
@@ -625,7 +666,7 @@ log("wait reading from server pipe");
|
|||||||
#ifdef WITHLOG
|
#ifdef WITHLOG
|
||||||
log("ready reading from server pipe");
|
log("ready reading from server pipe");
|
||||||
#endif
|
#endif
|
||||||
if(fds[fdsc].revents & POLLIN) FROMSERVERPIPE = 1;
|
if(fds[fdsc].revents & (POLLIN)) FROMSERVERPIPE = 1;
|
||||||
}
|
}
|
||||||
fdsc++;
|
fdsc++;
|
||||||
}
|
}
|
||||||
@@ -665,11 +706,11 @@ log("timeout");
|
|||||||
res = 0;
|
res = 0;
|
||||||
if(!fromserver && param->waitserver64) res = 98;
|
if(!fromserver && param->waitserver64) res = 98;
|
||||||
else if(!fromclient && param->waitclient64) res = 99;
|
else if(!fromclient && param->waitclient64) res = 99;
|
||||||
|
else if(HASERROR) res = 94+HASERROR;
|
||||||
else if((inclientbuf || inserverbuf)) res = 94;
|
else if((inclientbuf || inserverbuf)) res = 94;
|
||||||
#ifdef WITHSPLICE
|
#ifdef WITHSPLICE
|
||||||
else if(inclientpipe || inserverpipe) res = 94;
|
else if(inclientpipe || inserverpipe) res = 94;
|
||||||
#endif
|
#endif
|
||||||
else if(HASERROR) res = 94+HASERROR;
|
|
||||||
|
|
||||||
CLEANRET:
|
CLEANRET:
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -286,10 +286,11 @@ struct chain {
|
|||||||
#else
|
#else
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
#endif
|
#endif
|
||||||
unsigned short weight;
|
|
||||||
unsigned char * exthost;
|
unsigned char * exthost;
|
||||||
unsigned char * extuser;
|
unsigned char * extuser;
|
||||||
unsigned char * extpass;
|
unsigned char * extpass;
|
||||||
|
unsigned short weight;
|
||||||
|
unsigned short cidr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct period {
|
struct period {
|
||||||
@@ -572,7 +573,7 @@ struct extparam {
|
|||||||
struct srvparam *services;
|
struct srvparam *services;
|
||||||
int stacksize,
|
int stacksize,
|
||||||
threadinit, counterd, haveerror, rotate, paused, archiverc,
|
threadinit, counterd, haveerror, rotate, paused, archiverc,
|
||||||
demon, maxchild, needreload, timetoexit, version, noforce, bandlimver;
|
demon, maxchild, needreload, timetoexit, version, noforce, bandlimver, parentretries;
|
||||||
int authcachetype, authcachetime;
|
int authcachetype, authcachetime;
|
||||||
int filtermaxsize;
|
int filtermaxsize;
|
||||||
unsigned char *logname, **archiver;
|
unsigned char *logname, **archiver;
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,12 @@
|
|||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION "3proxy-0.9.2"
|
#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 "2021"
|
||||||
+43
-7
@@ -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:" ",
|
inbuf += sprintf(buf+inbuf, "%d/%s</td>" , cp->number,
|
||||||
|
(cp->comment)?cp->comment:" ");
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user