Compare commits

...
12 Commits
Author SHA1 Message Date
z3APA3A 20997d759d publishing as 0.7.1 2014-06-28 18:03:52 +04:00
z3APA3A 1ce4a496f6 Do not ignore version.h
version.h is required to build from sources
2014-06-28 17:29:26 +04:00
Vladimir Dubrovin b41d6590cb Moving icons compilation to Makefiles 2014-06-28 17:15:44 +04:00
Vladimir Dubrovin eb8522bb8f ldapauth memory leak fixed
Привет !
Исправил старую багу по утечки памяти в плагине .. теперь вообще не
течет ,
глупая ошибка.. Вот так 3,5  года не попрограммируеш , срузу ошибку
найдеш :)

--
Kirill Lopuchov
2014-06-28 17:12:21 +04:00
Vladimir Dubrovin 1a27fd88a9 FTP proxy debugging output removed, bind to same IP with control connection for active FTP
FTP proxy debugging output removed, bind to same IP with control
connection for active FTP
2014-06-28 17:09:27 +04:00
z3APA3A 443a4c02d0 better EINTR handling 2014-06-28 17:04:43 +04:00
z3APA3A 40d03b8a4a minor fixes + overlapping memcpy replaced with memmove 2014-06-11 00:54:58 +04:00
Vladimir Dubrovin 53098814f0 Removing Changelog 2014-04-21 01:26:33 +04:00
Vladimir Dubrovin 8f4243ffe1 ftppr NLSD command added 2014-04-21 01:17:23 +04:00
Vladimir Dubrovin 618673c335 Ignore NTLM handshake unless NTLM is configured 2014-04-15 02:10:41 +04:00
z3APA3A f452009079 Some useful warnings added
Checks for most common misconfigurations
2014-04-14 01:50:17 +04:00
Vladimir Dubrovin 2b0f8bbcfc Add icon, resolve MinGW compilation issues 2014-04-13 18:26:32 +04:00
21 changed files with 89 additions and 2292 deletions

No files matched your search

+2 -2
View File
@@ -14,17 +14,17 @@ tmp/
*.bat
*.swp
*.o
3proxy.res
*.idb
src/version.h
src/res
version.c
3proxy.res
doc/html/man3/
doc/html/man8/
doc/html/index.html
*.var
verfile.sh
Makefile
Changelog
copytgz.sh
*~.nib
local.properties
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+4 -5
View File
@@ -1,7 +1,6 @@
#include "src/version.h"
#include "afxres.h"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
LANGUAGE 0x09, 0x01
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,7,0,0
@@ -18,9 +17,9 @@ BEGIN
VALUE "FileDescription", "3proxy - tiny proxy server"
VALUE "FileVersion", VERSION "-" BUILDDATE
VALUE "InternalName", "3proxy"
VALUE "LegalCopyright", "Copyright (C) 2002-2009 Vladimir Dubrovin"
VALUE "LegalCopyright", "Copyright (C) 2002-2014 Vladimir Dubrovin"
VALUE "OriginalFilename", "3proxy.exe"
VALUE "ProductName", "3proxy"
VALUE "ProductName", "3proxy - tiny proxy server"
VALUE "ProductVersion", VERSION
END
END
@@ -29,4 +28,4 @@ BEGIN
VALUE "Translation", 0x0, 1200
END
END
0 ICON DISCARDABLE "3proxy.ico"
-2215
View File
File diff suppressed because it is too large. Load diff
+9 -2
View File
@@ -15,7 +15,8 @@ LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
DLFLAGS = /DLL
DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib
LIBSOLD = libeay32MT.lib ssleay32MT.lib
LIBEXT = .lib
LNOUT = /out:
EXESUFFICS = .exe
@@ -27,10 +28,16 @@ TYPECOMMAND = type
COMPATLIBS =
MAKEFILE = Makefile.msvc
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin lastFripper FilePlugin
VERFILE = 3proxyres.obj $(VERFILE)
include Makefile.inc
../3proxy.res:
rc /fo../3proxy.res ../3proxy.rc
3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /MACHINE:X86 ../3proxy.res
allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
+9 -1
View File
@@ -15,7 +15,8 @@ LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
DLFLAGS = /DLL
DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib
LIBSOLD = libeay32MT.lib ssleay32MT.lib
LIBEXT = .lib
LNOUT = /out:
EXESUFFICS = .exe
@@ -27,9 +28,16 @@ TYPECOMMAND = type
COMPATLIBS =
MAKEFILE = Makefile.msvc64
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin
VERFILE = 3proxyres.obj $(VERFILE)
include Makefile.inc
../3proxy.res:
rc /fo../3proxy.res ../3proxy.rc
3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /MACHINE:X64 ../3proxy.res
allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
+21
View File
@@ -647,6 +647,9 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.isudp = 0;
childdef.service = S_PROXY;
childdef.helpmessage = " -n - no NTLM support\n";
if(!resolvfunc || (resolvfunc == myresolver && !dns_table.hashsize)){
fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, proxy may run very slow\n", linenum);
}
}
else if(!strcmp((char *)argv[0], "pop3p")) {
childdef.pf = pop3pchild;
@@ -675,6 +678,9 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.isudp = 0;
childdef.service = S_SOCKS;
childdef.helpmessage = " -n - no NTLM support\n";
if(!resolvfunc || (resolvfunc == myresolver && !dns_table.hashsize)){
fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, socks may run very slow\n", linenum);
}
}
else if(!strcmp((char *)argv[0], "tcppm")) {
childdef.pf = tcppmchild;
@@ -715,6 +721,9 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.port = 53;
childdef.isudp = 1;
childdef.service = S_DNSPR;
if(!resolvfunc || (resolvfunc == myresolver && !dns_table.hashsize) || resolvfunc == fakeresolver){
fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, dnspr will not work as expected\n", linenum);
}
}
return start_proxy_thread(&ch);
}
@@ -954,6 +963,18 @@ static int h_maxconn(int argc, unsigned char **argv){
if(!conf.maxchild) {
return(1);
}
#ifndef _WIN32
{
struct rlimit rl;
if(!getrlimit(RLIMIT_NOFILE, &rl)){
if((conf.maxchild<<1) > rl.rlim_cur)
fprintf(stderr, "[line %d] Warning: current open file ulimits are too low (cur: %d/max: %d),"
" maxconn requires at least %d for every running service."
" Configure ulimits according to system documentation\n",
linenum, (int)rl.rlim_cur, (int)rl.rlim_max, (conf.maxchild<<1));
}
}
#endif
return 0;
}
+1 -1
View File
@@ -3,7 +3,7 @@
# 3 proxy common Makefile
#
all: pre $(BUILDDIR)3proxy$(EXESUFFICS) $(BUILDDIR)mycrypt$(EXESUFFICS) $(BUILDDIR)dighosts$(EXESUFFICS) $(BUILDDIR)pop3p$(EXESUFFICS) $(BUILDDIR)smtpp$(EXESUFFICS) $(BUILDDIR)ftppr$(EXESUFFICS) $(BUILDDIR)tcppm$(EXESUFFICS) $(BUILDDIR)icqpr$(EXESUFFICS) $(BUILDDIR)msnpr$(EXESUFFICS) $(BUILDDIR)udppm$(EXESUFFICS) $(BUILDDIR)socks$(EXESUFFICS) $(BUILDDIR)proxy$(EXESUFFICS) $(BUILDDIR)countersutil$(EXESUFFICS) allplugins
all: pre $(VERFILE) $(BUILDDIR)3proxy$(EXESUFFICS) $(BUILDDIR)mycrypt$(EXESUFFICS) $(BUILDDIR)dighosts$(EXESUFFICS) $(BUILDDIR)pop3p$(EXESUFFICS) $(BUILDDIR)smtpp$(EXESUFFICS) $(BUILDDIR)ftppr$(EXESUFFICS) $(BUILDDIR)tcppm$(EXESUFFICS) $(BUILDDIR)icqpr$(EXESUFFICS) $(BUILDDIR)msnpr$(EXESUFFICS) $(BUILDDIR)udppm$(EXESUFFICS) $(BUILDDIR)socks$(EXESUFFICS) $(BUILDDIR)proxy$(EXESUFFICS) $(BUILDDIR)countersutil$(EXESUFFICS) allplugins
pre:
-14
View File
@@ -882,20 +882,6 @@ struct auth authfuncs[] = {
};
struct hashentry {
unsigned char hash[sizeof(unsigned)*4];
unsigned long value;
time_t expires;
struct hashentry *next;
};
struct hashtable {
unsigned hashsize;
struct hashentry ** hashtable;
struct hashentry * hashvalues;
struct hashentry * hashempty;
};
struct hashtable dns_table = {0, NULL, NULL, NULL};
+4 -6
View File
@@ -42,8 +42,6 @@ void * ftpprchild(struct clientparam* param) {
if (req) myfree (req);
req = NULL;
(*param->srv->logfunc)(param, buf);
if (!strncasecmp((char *)buf, "OPEN ", 5)){
if(parsehostname((char *)buf+5, param, 21)){RETURN(803);}
if(param->remsock != INVALID_SOCKET) {
@@ -123,10 +121,10 @@ void * ftpprchild(struct clientparam* param) {
}
if ((clidatasock=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);}
sasize = sizeof(struct sockaddr_in);
if(so._getsockname(param->ctrlsock, (struct sockaddr *)&param->sinc, &sasize)){RETURN(824);}
param->sinc.sin_port = 0;
if(so._bind(clidatasock, (struct sockaddr *)&param->sinc, sasize)){RETURN(822);}
if (pasv) {
if(so._getsockname(param->ctrlsock, (struct sockaddr *)&param->sinc, &sasize)){RETURN(824);}
param->sinc.sin_port = 0;
if(so._bind(clidatasock, (struct sockaddr *)&param->sinc, sasize)){RETURN(822);}
if(so._listen(clidatasock, 1)) {RETURN(823);}
if(so._getsockname(clidatasock, (struct sockaddr *)&param->sinc, &sasize)){RETURN(824);}
sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n",
@@ -137,7 +135,6 @@ void * ftpprchild(struct clientparam* param) {
(unsigned)(((unsigned char *)(&param->sinc.sin_port))[0]),
(unsigned)(((unsigned char *)(&param->sinc.sin_port))[1])
);
param->srv->logfunc(param,buf);
}
else {
unsigned long b1, b2, b3, b4;
@@ -174,6 +171,7 @@ param->srv->logfunc(param,buf);
!(strncasecmp((char *)buf, "RETR ", 5) && (param->operation = FTP_GET)) ||
!(strncasecmp((char *)buf, "LIST", 4) && (param->operation = FTP_LIST))||
!(strncasecmp((char *)buf, "NLST ", 5) && (param->operation = FTP_LIST)) ||
!(strncasecmp((char *)buf, "MLSD", 4) && (param->operation = FTP_LIST)) ||
!(strncasecmp((char *)buf, "APPE ", 5) && (param->operation = FTP_PUT)) ||
!(strncasecmp((char *)buf, "STOR ", 5) && (param->operation = FTP_PUT))
)){
+11 -10
View File
@@ -105,13 +105,6 @@ int savecouters(void)
#ifdef _WIN32
__declspec(dllexport) int start(struct pluginlink * pluginlink,
int argc, char** argv);
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#else
int start(struct pluginlink * pluginlink,
@@ -128,6 +121,9 @@ static int ldapfunc(struct clientparam *param)
int rc = -1;
char tmpbuf[1024];
/* test proxy user auth ------------------------*/
if(!param->username || !param->password) return 4;
if(strlen(param->password)==0) return 4;
/* init ldap ---------------------- */
ld = ldap_init( ldap_serv, 389 );
@@ -138,9 +134,6 @@ static int ldapfunc(struct clientparam *param)
return 7;
}
/* test proxy user auth ------------------------*/
if(!param->username || !param->password) return 4;
if(strlen(param->password)==0) return 4;
/* this code for Active Directory LDAP catalog :(
detail see documentation for plugin */
@@ -168,6 +161,14 @@ static int ldapfunc(struct clientparam *param)
ldap_unbind_s(ld);
ld = ldap_init( ldap_serv, 389 );
if ( ld == NULL )
{
param->srv->logfunc(param,"Error ldap_init: No init lib ldap");
/*ldap_perror( ld, "Error ldap_init" ); */
return 7;
}
rc = ldap_bind_s( ld, ldap_user, ldap_pass, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS )
-10
View File
@@ -27,11 +27,6 @@ http://lucas.bergmans.us/hacks/openldap/
под unix подобной ОС (Freebsd) использовался стандартный gcc.
и библиотеки openldap-client.
!!!! Внимание при работе плагина возможна утечка памяти !!!!
У меня на Win 2000 Serv и окола 600 пользователях при канале 500 кбит/сек .
процесс 3proxy за сутки выростает до 40 мб . Лечится рестартом сервиса.
Если кто то знает хорошо Open Ldap api и может указать на ошибку в плагине
с радостью выслушаю :) .
2. Настройка плагина.
@@ -328,11 +323,6 @@ http://lucas.bergmans.us/hacks/openldap/
РПД unix РПДПВОПК пу (Freebsd) ЙУРПМШЪПЧБМУС УФБОДБТФОЩК gcc.
Й ВЙВМЙПФЕЛЙ openldap-client.
!!!! чОЙНБОЙЕ РТЙ ТБВПФЕ РМБЗЙОБ ЧПЪНПЦОБ ХФЕЮЛБ РБНСФЙ !!!!
х НЕОС ОБ Win 2000 Serv Й ПЛПМБ 600 РПМШЪПЧБФЕМСИ РТЙ ЛБОБМЕ 500 ЛВЙФ/УЕЛ .
РТПГЕУУ 3proxy ЪБ УХФЛЙ ЧЩТПУФБЕФ ДП 40 НВ . мЕЮЙФУС ТЕУФБТФПН УЕТЧЙУБ.
еУМЙ ЛФП ФП ЪОБЕФ ИПТПЫП Open Ldap api Й НПЦЕФ ХЛБЪБФШ ОБ ПЫЙВЛХ Ч РМБЗЙОЕ
У ТБДПУФША ЧЩУМХЫБА :) .
2. оБУФТПКЛБ РМБЗЙОБ.
+1 -1
View File
@@ -153,7 +153,7 @@ static int restore_old_table(void * v)
#ifdef _WIN32
__declspec(dllexport) int start(struct pluginlink * pluginlink,
int argc, char** argv);
BOOL APIENTRY DllMain( HMODULE hModule,
BOOL WINAPI DllMain( HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
+1 -1
View File
@@ -229,7 +229,7 @@ void mylogfunc(struct clientparam * param, const unsigned char * pz) {
#ifdef _WIN32
BOOL APIENTRY DllMain( HANDLE hModule,
BOOL WINAPI DllMain( HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
@@ -20,14 +20,6 @@ extern "C" {
int argc, char** argv);
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
static struct auth alwaysauth;
static char sidbuf[4096];
-9
View File
@@ -18,15 +18,6 @@ extern "C" {
__declspec(dllexport) int utf8tocp1251(struct pluginlink * pluginlink,
int argc, char** argv);
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
static struct auth alwaysauth;
+2 -2
View File
@@ -339,7 +339,7 @@ for(;;){
if(!isconnect){
if(se==sg)*se-- = ' ';
*se = '/';
memcpy(ss, se, i - (se - sb) + 1);
memmove(ss, se, i - (se - sb) + 1);
}
}
reqlen = i = (int)strlen((char *)buf);
@@ -377,7 +377,7 @@ for(;;){
continue;
}
#ifndef NOCRYPT
if(!strncasecmp((char *)sb, "ntlm", 4)){
if(param->srv->usentlm && !strncasecmp((char *)sb, "ntlm", 4)){
sb+=4;
while(isspace(*sb))sb++;
i = de64(sb, username, 1023);
+1 -1
View File
@@ -47,7 +47,7 @@ int socksendto(SOCKET sock, struct sockaddr_in * sin, unsigned char * buf, int b
if(res < 1) break;
res = so._sendto(sock, buf + sent, bufsize - sent, 0, (struct sockaddr *)sin, sizeof(struct sockaddr_in));
if(res < 0) {
if(errno != EAGAIN) break;
if(errno != EAGAIN && errno != EINTR) break;
continue;
}
sent += res;
+8 -4
View File
@@ -130,7 +130,8 @@ int sockmap(struct clientparam * param, int timeo){
}
res = so._sendto(param->clisock, param->srvbuf + param->srvoffset,(!param->waitserver || ((unsigned)param->waitserver - received) > (param->srvinbuf - param->srvoffset))? param->srvinbuf - param->srvoffset : param->waitserver - received, 0, (struct sockaddr*)&param->sinc, sasize);
if(res < 0) {
if(errno != EAGAIN) return 96;
if(errno != EAGAIN && errno != EINTR) return 96;
if(errno == EINTR) usleep(SLEEPTIME);
continue;
}
param->srvoffset += res;
@@ -155,7 +156,8 @@ int sockmap(struct clientparam * param, int timeo){
}
res = so._sendto(param->remsock, param->clibuf + param->clioffset, (!param->waitclient || ((unsigned)param->waitclient - sent) > (param->cliinbuf - param->clioffset))? param->cliinbuf - param->clioffset : param->waitclient - sent, 0, (struct sockaddr*)&param->sins, sasize);
if(res < 0) {
if(errno != EAGAIN) return 97;
if(errno != EAGAIN && errno != EINTR) return 97;
if(errno == EINTR) usleep(SLEEPTIME);
continue;
}
param->clioffset += res;
@@ -180,7 +182,8 @@ int sockmap(struct clientparam * param, int timeo){
}
else {
if (res < 0){
if( errno != EAGAIN) return (94);
if(errno != EAGAIN && errno != EINTR) return 94;
if(errno == EINTR) usleep(SLEEPTIME);
continue;
}
param->cliinbuf += res;
@@ -210,7 +213,8 @@ int sockmap(struct clientparam * param, int timeo){
}
else {
if (res < 0){
if( errno != EAGAIN) return (93);
if(errno != EAGAIN && errno != EINTR) return 93;
if(errno == EINTR) usleep(SLEEPTIME);
continue;
}
param->srvinbuf += res;
+13
View File
@@ -657,6 +657,19 @@ typedef enum {
TYPE_SERVER
}DATA_TYPE;
struct hashentry {
unsigned char hash[sizeof(unsigned)*4];
unsigned long value;
time_t expires;
struct hashentry *next;
};
struct hashtable {
unsigned hashsize;
struct hashentry ** hashtable;
struct hashentry * hashvalues;
struct hashentry * hashempty;
};
#ifdef __cplusplus
}
+2
View File
@@ -0,0 +1,2 @@
#define VERSION "3proxy-0.7.1"
#define BUILDDATE "140628175321"