mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Compare commits
31
Commits
3proxy-0.8.8
...
0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e85b064b52 | ||
|
|
9f6c0b5b8d | ||
|
|
3b67dc8447 | ||
|
|
d07500687c | ||
|
|
439373abd3 | ||
|
|
8afad700f8 | ||
|
|
a8b79d5df5 | ||
|
|
10a8febb0d | ||
|
|
747828d3ab | ||
|
|
9b8e6b33c7 | ||
|
|
05b23a840e | ||
|
|
5c9bb58a81 | ||
|
|
f8557187cd | ||
|
|
23623a22ff | ||
|
|
215171ad46 | ||
|
|
c20a04b752 | ||
|
|
3f859fdb11 | ||
|
|
556681a829 | ||
|
|
ee0bb55c06 | ||
|
|
2c0bc19f75 | ||
|
|
286aa51e78 | ||
|
|
145eb580e4 | ||
|
|
46211c26d2 | ||
|
|
e0262c23b0 | ||
|
|
7f80f4f958 | ||
|
|
6a54b37181 | ||
|
|
c0bb608acc | ||
|
|
4631335aca | ||
|
|
94c58b3db4 | ||
|
|
d75dcf0b54 | ||
|
|
28581b1738 |
No files matched your search
@@ -1,9 +1,6 @@
|
||||
#include "src/version.h"
|
||||
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,8,8,0
|
||||
PRODUCTVERSION 0,8,8,0
|
||||
FILEVERSION 0,8,13,0
|
||||
PRODUCTVERSION 0,8,13,0
|
||||
FILETYPE 1
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
@@ -14,12 +11,12 @@ BEGIN
|
||||
VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.ru/\0"
|
||||
VALUE "CompanyName", "Vladimir Dubrovin\0"
|
||||
VALUE "FileDescription", "3proxy - tiny proxy server\0"
|
||||
VALUE "FileVersion", "0.8.8\0"
|
||||
VALUE "FileVersion", "0.8.13\0"
|
||||
VALUE "InternalName", "3proxy\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2002-2016 Vladimir Dubrovin\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2002-2019 Vladimir Dubrovin\0"
|
||||
VALUE "OriginalFilename", "3proxy.exe\0"
|
||||
VALUE "ProductName", "3proxy\0"
|
||||
VALUE "ProductVersion", "0.8.8\0"
|
||||
VALUE "ProductVersion", "0.8.13\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
+2
-2
@@ -10,11 +10,11 @@
|
||||
BUILDDIR =
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -g -O2 -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
COUT = -o
|
||||
LN = gcc
|
||||
DCFLAGS = -fpic
|
||||
LDFLAGS = -O2 -pthread
|
||||
LDFLAGS = -O2 -fno-strict-aliasing -pthread
|
||||
DLFLAGS = -shared
|
||||
DLSUFFICS = .ld.so
|
||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
BUILDDIR =
|
||||
CC = gcc
|
||||
CFLAGS = -O3 -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
CFLAGS = -O2 -fno-strict-aliasing -c -D_SOLARIS -D_THREAD_SAFE -DGETHOSTBYNAME_R -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
COUT = -o ./
|
||||
LN = gcc
|
||||
LDFLAGS = -O3
|
||||
|
||||
+2
-2
@@ -10,10 +10,10 @@
|
||||
|
||||
BUILDDIR = ../bin/
|
||||
CC = clang
|
||||
CFLAGS = -O2 -c -pthread -static -DWITH_STD_MALLOC -DNOIPV6
|
||||
CFLAGS = -O2 -fno-strict-aliasing -c -pthread -static -DWITH_STD_MALLOC -DNOIPV6
|
||||
COUT = -o
|
||||
LN = clang
|
||||
LDFLAGS = -O2 -static -s
|
||||
LDFLAGS = -O2 -fno-strict-aliasing -static -s
|
||||
DLFLAGS = -shared
|
||||
DLSUFFICS = .dll
|
||||
LIBS = -lws2_32 -lodbc32 -ladvapi32
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ BUILDDIR =
|
||||
CC = gcc
|
||||
|
||||
# you may need -L/usr/pkg/lib for older NetBSD versions
|
||||
CFLAGS = -g -O2 -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
|
||||
COUT = -o
|
||||
LN = gcc
|
||||
LDFLAGS = -O2 -pthread
|
||||
LDFLAGS = -O2 -fno-strict-aliasing -pthread
|
||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
||||
# -ldl or -lld may be required for some platforms
|
||||
DCFLAGS = -fpic
|
||||
|
||||
@@ -37,7 +37,7 @@ users 3APA3A:CL:3apa3a "test:CR:$1$qwer$CHFTUFGqkjue9HyhcMHEe1"
|
||||
service
|
||||
# service is required under NT if you want 3proxy to start as service
|
||||
|
||||
#log /usr/local/etc/3proxy/logs/3proxy.log D
|
||||
#log /var/log/3proxy/log D
|
||||
log c:\3proxy\logs\3proxy.log D
|
||||
# log allows to specify log file location and rotation, D means logfile
|
||||
# is created daily
|
||||
|
||||
+19
-18
@@ -1,18 +1,19 @@
|
||||
<html><title>3proxy documentation</title><body><h2>3proxy documentation</h2>
|
||||
<a href="securityen.html">Security recommendations</a><br>
|
||||
<a href="howtoe.html">How To (English, very incomplete)</a><br>
|
||||
<a href="howtor.html">How To (Russian)</a><br>
|
||||
<a href="faqe.html">FAQ (English)</a><br>
|
||||
<a href="faqr.html">FAQ (Russian)</a>
|
||||
<h3>Man pages:</h>
|
||||
<br><A HREF="man8/3proxy.8.html">3proxy.8</A>
|
||||
<br><A HREF="man8/ftppr.8.html">ftppr.8</A>
|
||||
<br><A HREF="man8/icqpr.8.html">icqpr.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/smtpp.8.html">smtpp.8</A>
|
||||
<br><A HREF="man8/socks.8.html">socks.8</A>
|
||||
<br><A HREF="man8/tcppm.8.html">tcppm.8</A>
|
||||
<br><A HREF="man8/udppm.8.html">udppm.8</A>
|
||||
<br><A HREF="man3/3proxy.cfg.3.html">3proxy.cfg.3</A>
|
||||
</body></html>
|
||||
<html><title>3proxy documentation</title><body><h2>3proxy documentation</h2>
|
||||
<a href="securityen.html">Security recommendations</a><br>
|
||||
<a href="highload.html">Optimizing 3proxy for high loads</a><br>
|
||||
<a href="howtoe.html">How To (English, very incomplete)</a><br>
|
||||
<a href="howtor.html">How To (Russian)</a><br>
|
||||
<a href="faqe.html">FAQ (English)</a><br>
|
||||
<a href="faqr.html">FAQ (Russian)</a>
|
||||
<h3>Man pages:</h>
|
||||
<br><A HREF="man8/3proxy.8.html">3proxy.8</A>
|
||||
<br><A HREF="man8/ftppr.8.html">ftppr.8</A>
|
||||
<br><A HREF="man8/icqpr.8.html">icqpr.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/smtpp.8.html">smtpp.8</A>
|
||||
<br><A HREF="man8/socks.8.html">socks.8</A>
|
||||
<br><A HREF="man8/tcppm.8.html">tcppm.8</A>
|
||||
<br><A HREF="man8/udppm.8.html">udppm.8</A>
|
||||
<br><A HREF="man3/3proxy.cfg.3.html">3proxy.cfg.3</A>
|
||||
</body></html>
|
||||
+6507
-1738
File diff suppressed because it is too large.
Load diff
@@ -736,6 +736,17 @@ nolog
|
||||
.br
|
||||
Weight may be used for different purposes.
|
||||
|
||||
|
||||
.br
|
||||
.B force
|
||||
.br
|
||||
.B noforce
|
||||
.br
|
||||
If force is specified for service, configuration reload will require all current
|
||||
sessions of this service to be re-authenticated. If ACL is changed or user account
|
||||
is removed, old connections which do not match current are closed.
|
||||
noforce allows to keep previously authenticated connections.
|
||||
|
||||
.br
|
||||
.B bandlimin
|
||||
<rate> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ monitor /usr/local/etc/3proxy/counters
|
||||
monitor /usr/local/etc/3proxy/passwd
|
||||
monitor /usr/local/etc/3proxy/bandlimiters
|
||||
|
||||
log /usr/local/etc/3proxy/log/log D
|
||||
log /var/log/3proxy/log D
|
||||
rotate 60
|
||||
counter /usr/local/etc/3proxy/3proxy.3cf
|
||||
|
||||
|
||||
+18
-9
@@ -19,10 +19,9 @@ int clientnegotiate(struct chain * redir, struct clientparam * param, struct soc
|
||||
|
||||
user = redir->extuser;
|
||||
pass = redir->extpass;
|
||||
if (param->srvinbuf < 4096){
|
||||
if(param->srvbuf)myfree(param->srvbuf);
|
||||
param->srvbuf = myalloc(4096);
|
||||
param->srvbufsize = 4096;
|
||||
if (!param->srvbufsize){
|
||||
param->srvbufsize = SRVBUFSIZE;
|
||||
param->srvbuf = myalloc(param->srvbufsize);
|
||||
}
|
||||
buf = param->srvbuf;
|
||||
username = buf + 2048;
|
||||
@@ -486,8 +485,14 @@ unsigned bandlimitfunc(struct clientparam *param, unsigned nbytesin, unsigned nb
|
||||
|
||||
if(!nbytesin && !nbytesout) return 0;
|
||||
pthread_mutex_lock(&bandlim_mutex);
|
||||
if(param->paused != conf.paused){
|
||||
return (1);
|
||||
if(param->paused != conf.paused && param->bandlimver != conf.paused){
|
||||
if(!conf.bandlimfunc){
|
||||
param->bandlimfunc = NULL;
|
||||
pthread_mutex_unlock(&bandlim_mutex);
|
||||
return 0;
|
||||
}
|
||||
initbandlims(param);
|
||||
param->bandlimver = conf.paused;
|
||||
}
|
||||
for(i=0; nbytesin&& i<MAXBANDLIMS && param->bandlims[i]; i++){
|
||||
if( !param->bandlims[i]->basetime ||
|
||||
@@ -784,10 +789,14 @@ int dnsauth(struct clientparam * param){
|
||||
((u&0xFF000000)>>24));
|
||||
|
||||
}
|
||||
if(!udpresolve(*SAFAMILY(¶m->sincr), (unsigned char *)buf, (unsigned char *)addr, NULL, param, 1)) return 6;
|
||||
if(!memcmp(SAADDR(¶m->sincr), addr, SAADDRLEN(¶m->sincr))) return 6;
|
||||
if(!udpresolve(*SAFAMILY(¶m->sincr), (unsigned char *)buf, (unsigned char *)addr, NULL, param, 1)) {
|
||||
return 3;
|
||||
}
|
||||
if(memcmp(SAADDR(¶m->sincr), addr, SAADDRLEN(¶m->sincr))) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return param->username? 0:4;
|
||||
return param->username? 0:3;
|
||||
}
|
||||
|
||||
int strongauth(struct clientparam * param){
|
||||
|
||||
+3
-4
@@ -468,7 +468,7 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
|
||||
break;
|
||||
case 'n':
|
||||
len = param->hostname? (int)strlen((char *)param->hostname) : 0;
|
||||
if (len > 0 && !strchr((char *)param->hostname, ':')) for(len = 0; param->hostname[len] && i < 4000; len++, i++){
|
||||
if (len > 0 && !strchr((char *)param->hostname, ':')) for(len = 0; param->hostname[len] && i < 256; len++, i++){
|
||||
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(doublec && strchr((char *)doublec, buf[i])) {
|
||||
@@ -480,7 +480,6 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
|
||||
buf[i++] = '[';
|
||||
i += myinet_ntop(*SAFAMILY(¶m->req), SAADDR(¶m->req), (char *)buf + i, 64);
|
||||
buf[i++] = ']';
|
||||
buf[i++] = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -651,8 +650,8 @@ int doconnect(struct clientparam * param){
|
||||
SASIZETYPE size;
|
||||
|
||||
|
||||
if (*SAFAMILY(¶m->sincr) == *SAFAMILY(¶m->req) && !memcmp(SAADDR(¶m->sincr), SAADDR(¶m->req), SAADDRLEN(¶m->req)) &&
|
||||
*SAPORT(¶m->sincr) == *SAPORT(¶m->req)) return 519;
|
||||
if (*SAFAMILY(¶m->sincl) == *SAFAMILY(¶m->req) && !memcmp(SAADDR(¶m->sincl), SAADDR(¶m->req), SAADDRLEN(¶m->req)) &&
|
||||
*SAPORT(¶m->sincl) == *SAPORT(¶m->req)) return 519;
|
||||
|
||||
if (param->operation == ADMIN || param->operation == DNSRESOLVE || param->operation == BIND || param->operation == UDPASSOC)
|
||||
return 0;
|
||||
|
||||
+9
-5
@@ -153,6 +153,7 @@ int start_proxy_thread(struct child * chp){
|
||||
pthread_attr_setstacksize(&pa,PTHREAD_STACK_MIN + (16384+conf.stacksize));
|
||||
pthread_attr_setdetachstate(&pa,PTHREAD_CREATE_DETACHED);
|
||||
pthread_create(&thread, &pa, startsrv, (void *)chp);
|
||||
pthread_attr_destroy(&pa);
|
||||
#endif
|
||||
while(conf.threadinit)usleep(SLEEPTIME);
|
||||
if(haveerror) {
|
||||
@@ -279,7 +280,6 @@ static int h_external(int argc, unsigned char ** argv){
|
||||
else conf.extsa6 = sa6;
|
||||
#else
|
||||
res = getip46(46, argv[1], (struct sockaddr *)&conf.extsa);
|
||||
if(!res) return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -1425,7 +1425,6 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
|
||||
unsigned char * incbegin = 0;
|
||||
int fd;
|
||||
int res, len;
|
||||
int i = 1;
|
||||
unsigned char *str1;
|
||||
|
||||
for(;;str++){
|
||||
@@ -1444,7 +1443,14 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
|
||||
argm[argc] = 0;
|
||||
return argc;
|
||||
case '$':
|
||||
if(!comment && !included){
|
||||
if(comment){
|
||||
if(space){
|
||||
argm[argc++] = str;
|
||||
if(argc >= nitems) return argc;
|
||||
space = 0;
|
||||
}
|
||||
}
|
||||
else if(!included){
|
||||
incbegin = str;
|
||||
*str = 0;
|
||||
}
|
||||
@@ -1456,7 +1462,6 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
|
||||
if(!comment){
|
||||
*str = 0;
|
||||
space = 1;
|
||||
i = 0;
|
||||
if(incbegin){
|
||||
argc--;
|
||||
if((fd = open((char *)incbegin+1, O_RDONLY)) <= 0){
|
||||
@@ -1494,7 +1499,6 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
|
||||
break;
|
||||
}
|
||||
default:
|
||||
i++;
|
||||
if(space) {
|
||||
if(comment && *str == '\"' && str[1] != '\"'){
|
||||
str++;
|
||||
|
||||
+19
-17
@@ -75,7 +75,7 @@ static void pr_sa(struct node *node, CBFUNC cbf, void*cb){
|
||||
char buf[64];
|
||||
buf[0] = '[';
|
||||
buf[1] = 0;
|
||||
inet_ntop(*SAFAMILY(node->value), node->value, buf+1, sizeof(buf)-10);
|
||||
inet_ntop(*SAFAMILY(node->value), SAADDR(node->value), buf+1, sizeof(buf)-10);
|
||||
sprintf(buf + strlen(buf), "]:%hu", (unsigned short)*SAPORT(node->value));
|
||||
if(node->value)(*cbf)(cb, buf, strlen(buf));
|
||||
#endif
|
||||
@@ -743,21 +743,23 @@ static struct property prop_server[] = {
|
||||
{prop_server + 2, "target", ef_server_target, TYPE_STRING, "portmapper target ip"},
|
||||
{prop_server + 3, "targetport", ef_server_targetport, TYPE_PORT, "portmapper target port"},
|
||||
{prop_server + 4, "starttime", ef_server_starttime, TYPE_DATETIME, "service started seconds"},
|
||||
{prop_server + 5, "intsa", ef_server_intsa, TYPE_SA, "ip address of internal interface"},
|
||||
{prop_server + 6, "extsa", ef_server_extsa, TYPE_SA, "ip address of external interface"},
|
||||
{prop_server + 7, "auth", ef_server_auth, TYPE_STRING, "service authentication type"},
|
||||
{prop_server + 8, "acl", ef_server_acl, TYPE_ACE, "access control list"},
|
||||
{prop_server + 9, "singlepacket", ef_server_singlepacket, TYPE_INTEGER, "is single packet redirection"},
|
||||
{prop_server + 10, "usentlm", ef_server_usentlm, TYPE_INTEGER, "allow NTLM authentication"},
|
||||
{prop_server + 11, "log", ef_server_log, TYPE_STRING, "type of logging"},
|
||||
{prop_server + 12, "logtarget", ef_server_logtarget, TYPE_STRING, "log target options"},
|
||||
{prop_server + 13, "logformat", ef_server_logformat, TYPE_STRING, "logging format string"},
|
||||
{prop_server + 14, "nonprintable", ef_server_nonprintable, TYPE_STRING, "non printable characters"},
|
||||
{prop_server + 15, "replacement", ef_server_replacement, TYPE_CHAR, "replacement character"},
|
||||
{prop_server + 16, "childcount", ef_server_childcount, TYPE_INTEGER, "number of servers connected"},
|
||||
{prop_server + 17, "child", ef_server_child, TYPE_CLIENT, "connected clients"},
|
||||
{prop_server + 5, "auth", ef_server_auth, TYPE_STRING, "service authentication type"},
|
||||
{prop_server + 6, "acl", ef_server_acl, TYPE_ACE, "access control list"},
|
||||
{prop_server + 7, "singlepacket", ef_server_singlepacket, TYPE_INTEGER, "is single packet redirection"},
|
||||
{prop_server + 8, "usentlm", ef_server_usentlm, TYPE_INTEGER, "allow NTLM authentication"},
|
||||
{prop_server + 9, "log", ef_server_log, TYPE_STRING, "type of logging"},
|
||||
{prop_server + 10, "logtarget", ef_server_logtarget, TYPE_STRING, "log target options"},
|
||||
{prop_server + 11, "logformat", ef_server_logformat, TYPE_STRING, "logging format string"},
|
||||
{prop_server + 12, "nonprintable", ef_server_nonprintable, TYPE_STRING, "non printable characters"},
|
||||
{prop_server + 13, "replacement", ef_server_replacement, TYPE_CHAR, "replacement character"},
|
||||
{prop_server + 14, "childcount", ef_server_childcount, TYPE_INTEGER, "number of servers connected"},
|
||||
{prop_server + 15, "intsa", ef_server_intsa, TYPE_SA, "ip address of internal interface"},
|
||||
{prop_server + 16, "extsa", ef_server_extsa, TYPE_SA, "ip address of external interface"},
|
||||
#ifndef NOIPV6
|
||||
{prop_server + 18, "extsa6", ef_server_extsa6, TYPE_SA, "ipv6 address of external interface"},
|
||||
{prop_server + 17, "extsa6", ef_server_extsa6, TYPE_SA, "ipv6 address of external interface"},
|
||||
{prop_server + 18, "child", ef_server_child, TYPE_CLIENT, "connected clients"},
|
||||
#else
|
||||
{prop_server + 17, "child", ef_server_child, TYPE_CLIENT, "connected clients"},
|
||||
#endif
|
||||
{NULL, "next", ef_server_next, TYPE_SERVER, "next"}
|
||||
};
|
||||
@@ -776,8 +778,8 @@ static struct property prop_client[] = {
|
||||
{prop_client + 10, "username", ef_client_username, TYPE_STRING, "client username"},
|
||||
{prop_client + 11, "password", ef_client_password, TYPE_STRING, "client password"},
|
||||
{prop_client + 12, "clisa", ef_client_clisa, TYPE_SA, "client sa"},
|
||||
{prop_client + 13, "srvsa", ef_client_srvsa, TYPE_IP, "target server sa"},
|
||||
{prop_client + 14, "reqsa", ef_client_reqsa, TYPE_IP, "requested server sa"},
|
||||
{prop_client + 13, "srvsa", ef_client_srvsa, TYPE_SA, "target server sa"},
|
||||
{prop_client + 14, "reqsa", ef_client_reqsa, TYPE_SA, "requested server sa"},
|
||||
{prop_client + 15, "bytesin", ef_client_bytesin64, TYPE_UNSIGNED64, "bytes from server to client"},
|
||||
{prop_client + 16, "bytesout", ef_client_bytesout64, TYPE_UNSIGNED64, "bytes from client to server"},
|
||||
{prop_client + 17, "maxtrafin", ef_client_maxtrafin64, TYPE_UNSIGNED64, "maximum traffic allowed for download"},
|
||||
|
||||
+12
-4
@@ -88,6 +88,7 @@ void * ftpprchild(struct clientparam* param) {
|
||||
}
|
||||
else if (status >= 3 && (
|
||||
(!strncasecmp((char *)buf, "PASV", 4) && (pasv = 1)) ||
|
||||
(!strncasecmp((char *)buf, "EPSV", 4) && (pasv = 2)) ||
|
||||
(!strncasecmp((char *)buf, "PORT ", 5) && !(pasv = 0))
|
||||
)){
|
||||
#ifndef WITHMAIN
|
||||
@@ -125,8 +126,9 @@ void * ftpprchild(struct clientparam* param) {
|
||||
if(so._listen(clidatasock, 1)) {RETURN(823);}
|
||||
sasize = sizeof(param->sincl);
|
||||
if(so._getsockname(clidatasock, (struct sockaddr *)¶m->sincl, &sasize)){RETURN(824);}
|
||||
if(*SAFAMILY(¶m->sincl) == AF_INET)
|
||||
sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n",
|
||||
if(pasv == 1){
|
||||
if(*SAFAMILY(¶m->sincl) == AF_INET)
|
||||
sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n",
|
||||
(unsigned)(((unsigned char *)(SAADDR(¶m->sincl)))[0]),
|
||||
(unsigned)(((unsigned char *)(SAADDR(¶m->sincl)))[1]),
|
||||
(unsigned)(((unsigned char *)(SAADDR(¶m->sincl)))[2]),
|
||||
@@ -134,10 +136,16 @@ void * ftpprchild(struct clientparam* param) {
|
||||
(unsigned)(((unsigned char *)(SAPORT(¶m->sincl)))[0]),
|
||||
(unsigned)(((unsigned char *)(SAPORT(¶m->sincl)))[1])
|
||||
);
|
||||
else sprintf((char *)buf, "227 OK (127,0,0,1,%u,%u)\r\n",
|
||||
else sprintf((char *)buf, "227 OK (127,0,0,1,%u,%u)\r\n",
|
||||
(unsigned)(((unsigned char *)(SAPORT(¶m->sincl)))[0]),
|
||||
(unsigned)(((unsigned char *)(SAPORT(¶m->sincl)))[1])
|
||||
);
|
||||
);
|
||||
}
|
||||
else {
|
||||
sprintf((char *)buf, "229 OK (|||%u|)\r\n",
|
||||
(unsigned)ntohs(*SAPORT(¶m->sincl))
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unsigned long b1, b2, b3, b4;
|
||||
|
||||
@@ -4,4 +4,4 @@ ldapauth$(OBJSUFFICS): ldapauth.c
|
||||
$(CC) $(DCFLAGS) $(CFLAGS) ldapauth.c
|
||||
|
||||
$(BUILDDIR)ldapauth$(DLSUFFICS): ldapauth$(OBJSUFFICS)
|
||||
$(LN) $(LNOUT)../../$(BUILDDIR)ldapauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)ladp$(LIBSSUFFIX) ldapauth$(OBJSUFFICS)
|
||||
$(LN) $(LNOUT)../../$(BUILDDIR)ldapauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)ldap$(LIBSSUFFIX) ldapauth$(OBJSUFFICS)
|
||||
@@ -1,25 +1,15 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <ldap.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include "../../proxy.h"
|
||||
#include "../../structures.h"
|
||||
|
||||
struct counter_record
|
||||
{
|
||||
unsigned long traf;
|
||||
unsigned long trafgb;
|
||||
time_t cleared;
|
||||
time_t updated;
|
||||
};
|
||||
|
||||
#define LDAP_DEPRECATED 1
|
||||
#include <ldap.h>
|
||||
|
||||
int already_loaded = 0;
|
||||
|
||||
@@ -62,7 +52,7 @@ void lower (char *string)
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int savecouters(void)
|
||||
int savecounters(void)
|
||||
{
|
||||
struct trafcount *tc=mypluginlink->conf->trafcounter;
|
||||
struct trafcount *tcd;
|
||||
@@ -82,8 +72,8 @@ int savecouters(void)
|
||||
sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user);
|
||||
f=fopen(tmpbuf,"w+b");
|
||||
fseek(f,0,SEEK_SET);
|
||||
fprintf(f,"%10lu %10lu %lu %lu\n",tcd->trafgb,tcd->traf,
|
||||
tcd->cleared,tcd->updated);
|
||||
fprintf(f,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",tcd->traf64,
|
||||
(unsigned long)tcd->cleared,(unsigned long)tcd->updated);
|
||||
|
||||
fclose(f);
|
||||
mypluginlink->myfree(tmpbuf);
|
||||
@@ -385,8 +375,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
|
||||
memset(newtrafcount, 0, sizeof(struct trafcount));
|
||||
newtrafcount->ace = newace;
|
||||
newtrafcount->type=rtype;
|
||||
newtrafcount->traflimgb =(traflimit/(1024*4));
|
||||
newtrafcount->traflim = ((traflimit - (newtrafcount->traflimgb*(1024*4)))*(1024*1024));
|
||||
newtrafcount->traflim64 = traflimit;
|
||||
newtrafcount->comment=(*mypluginlink->mystrdup)("ldapcounters");
|
||||
newtrafcount->number=0;
|
||||
tmpbuf=(*mypluginlink->myalloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[0]));
|
||||
@@ -398,12 +387,11 @@ int h_trafgroup(int argc, unsigned char ** argv)
|
||||
|
||||
fseek(f,0,SEEK_SET);
|
||||
fgets(buf, 256, f);
|
||||
sscanf(buf,"%10lu %10lu %lu %lu\n",&rcounter.trafgb, &rcounter.traf,
|
||||
sscanf(buf,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",&rcounter.traf64,
|
||||
&rcounter.cleared, &rcounter.updated);
|
||||
|
||||
|
||||
newtrafcount->trafgb=rcounter.trafgb;
|
||||
newtrafcount->traf=rcounter.traf;
|
||||
newtrafcount->traf64=rcounter.traf64;
|
||||
newtrafcount->cleared=rcounter.cleared;
|
||||
newtrafcount->updated=rcounter.updated;
|
||||
fclose(f);
|
||||
@@ -565,7 +553,7 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink,
|
||||
/*create job shedule for processing reload, save counters to file */
|
||||
memset(&myschedule,0,sizeof(struct schedule));
|
||||
myschedule.type=MINUTELY;
|
||||
myschedule.function=savecouters;
|
||||
myschedule.function=savecounters;
|
||||
myschedule.next = *pluginlink->schedule;
|
||||
*pluginlink->schedule=&myschedule;
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
|
||||
unsigned char p2[] = "3proxy";
|
||||
unsigned char p3[] = "3proxy CA";
|
||||
|
||||
static char hash_name[sizeof(src_cert->sha1_hash)*2 + 1];
|
||||
static char cache_name[200];
|
||||
char hash_name[sizeof(src_cert->sha1_hash)*2 + 1];
|
||||
char cache_name[200];
|
||||
|
||||
bin2hex(src_cert->sha1_hash, sizeof(src_cert->sha1_hash), hash_name, sizeof(hash_name));
|
||||
sprintf(cache_name, "%s%s.pem", cert_path, hash_name);
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@ for(;;){
|
||||
buf[i] = 0;
|
||||
|
||||
if(req) {
|
||||
if(!param->transparent && !param->srv->transparent && param->redirtype != R_HTTP && (i<=prefix || strncasecmp((char *)buf, (char *)req, prefix))){
|
||||
if(!param->transparent && !param->srv->transparent && (i<=prefix || strncasecmp((char *)buf, (char *)req, prefix))){
|
||||
ckeepalive = 0;
|
||||
if(param->remsock != INVALID_SOCKET){
|
||||
so._shutdown(param->remsock, SHUT_RDWR);
|
||||
|
||||
+2
-11
@@ -21,7 +21,6 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -30,22 +29,14 @@
|
||||
#define _PASSWORD_LEN 256
|
||||
#define MAXNSERVERS 5
|
||||
|
||||
#define ALLOW 0
|
||||
#define DENY 1
|
||||
#define REDIRECT 2
|
||||
#define BANDLIM 3
|
||||
#define NOBANDLIM 4
|
||||
#define COUNTIN 5
|
||||
#define NOCOUNTIN 6
|
||||
#define COUNTOUT 7
|
||||
#define NOCOUNTOUT 8
|
||||
|
||||
#define UDPBUFSIZE 16384
|
||||
#define TCPBUFSIZE 8192
|
||||
#define SRVBUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <sys/timeb.h>
|
||||
#ifndef _WINCE
|
||||
#include <io.h>
|
||||
#else
|
||||
|
||||
+8
-3
@@ -633,7 +633,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
continue;
|
||||
};
|
||||
*newparam = defparam;
|
||||
if(defparam.hostname)newparam->hostname=(unsigned char *)strdup((char *)defparam.hostname);
|
||||
if(defparam.hostname)newparam->hostname=(unsigned char *)mystrdup((char *)defparam.hostname);
|
||||
clearstat(newparam);
|
||||
if(!isudp) newparam->clisock = new_sock;
|
||||
#ifndef STDMAIN
|
||||
@@ -643,6 +643,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
}
|
||||
#endif
|
||||
newparam->prev = newparam->next = NULL;
|
||||
error = 0;
|
||||
pthread_mutex_lock(&srv.counter_mutex);
|
||||
if(!srv.child){
|
||||
srv.child = newparam;
|
||||
@@ -665,7 +666,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
else {
|
||||
sprintf((char *)buf, "_beginthreadex(): %s", _strerror(NULL));
|
||||
if(!srv.silent)(*srv.logfunc)(&defparam, buf);
|
||||
freeparam(newparam);
|
||||
error = 1;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -674,13 +675,14 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
if(error){
|
||||
sprintf((char *)buf, "pthread_create(): %s", strerror(error));
|
||||
if(!srv.silent)(*srv.logfunc)(&defparam, buf);
|
||||
freeparam(newparam);
|
||||
}
|
||||
else {
|
||||
newparam->threadid = (unsigned)thread;
|
||||
}
|
||||
#endif
|
||||
pthread_mutex_unlock(&srv.counter_mutex);
|
||||
if(error) freeparam(newparam);
|
||||
|
||||
memset(&defparam.sincl, 0, sizeof(defparam.sincl));
|
||||
memset(&defparam.sincr, 0, sizeof(defparam.sincr));
|
||||
if(isudp) while(!srv.fds.events)usleep(SLEEPTIME);
|
||||
@@ -699,6 +701,9 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
pthread_mutex_unlock(&config_mutex);
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
pthread_attr_destroy(&pa);
|
||||
#endif
|
||||
if(defparam.hostname)myfree(defparam.hostname);
|
||||
if(cbc_string)myfree(cbc_string);
|
||||
if(cbl_string)myfree(cbl_string);
|
||||
|
||||
+3
-6
@@ -7,9 +7,6 @@
|
||||
|
||||
#include "proxy.h"
|
||||
|
||||
#define BUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
|
||||
|
||||
|
||||
int socksend(SOCKET sock, unsigned char * buf, int bufsize, int to){
|
||||
int sent = 0;
|
||||
int res;
|
||||
@@ -75,8 +72,8 @@ int sockgetcharcli(struct clientparam * param, int timeosec, int timeousec){
|
||||
int len;
|
||||
|
||||
if(!param->clibuf){
|
||||
if(!(param->clibuf = myalloc(BUFSIZE))) return 0;
|
||||
param->clibufsize = BUFSIZE;
|
||||
if(!(param->clibuf = myalloc(SRVBUFSIZE))) return 0;
|
||||
param->clibufsize = SRVBUFSIZE;
|
||||
param->clioffset = param->cliinbuf = 0;
|
||||
}
|
||||
if(param->cliinbuf && param->clioffset < param->cliinbuf){
|
||||
@@ -137,7 +134,7 @@ int sockgetcharsrv(struct clientparam * param, int timeosec, int timeousec){
|
||||
int bufsize;
|
||||
|
||||
if(!param->srvbuf){
|
||||
bufsize = BUFSIZE;
|
||||
bufsize = SRVBUFSIZE;
|
||||
if(param->ndatfilterssrv > 0 && bufsize < 32768) bufsize = 32768;
|
||||
if(!(param->srvbuf = myalloc(bufsize))) return 0;
|
||||
param->srvbufsize = bufsize;
|
||||
|
||||
+4
-3
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "proxy.h"
|
||||
|
||||
#define BUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
|
||||
|
||||
int sockmap(struct clientparam * param, int timeo){
|
||||
int res=0;
|
||||
uint64_t sent=0, received=0;
|
||||
@@ -21,13 +19,16 @@ int sockmap(struct clientparam * param, int timeo){
|
||||
FILTER_ACTION action;
|
||||
int retcode = 0;
|
||||
|
||||
bufsize = BUFSIZE;
|
||||
bufsize = SRVBUFSIZE;
|
||||
|
||||
minsize = (param->service == S_UDPPM || param->service == S_TCPPM)? bufsize - 1 : (bufsize>>2);
|
||||
|
||||
fds[0].fd = param->clisock;
|
||||
fds[1].fd = param->remsock;
|
||||
|
||||
|
||||
if(param->cliinbuf == param->clioffset) param->cliinbuf = param->clioffset = 0;
|
||||
if(param->srvinbuf == param->srvoffset) param->srvinbuf = param->srvoffset = 0;
|
||||
#if DEBUGLEVEL > 2
|
||||
(*param->srv->logfunc)(param, "Starting sockets mapping");
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -376,7 +376,7 @@ fflush(stderr);
|
||||
buf[i] = buf[i+1];
|
||||
}
|
||||
buf[i++] = 0;
|
||||
if(!getip46(param->srv->family, buf, (struct sockaddr *) ¶m->sinsr)) RETURN(100);
|
||||
if(!getip46(param->srv->family, buf+4, (struct sockaddr *) ¶m->sinsr)) RETURN(100);
|
||||
break;
|
||||
default:
|
||||
RETURN(997);
|
||||
|
||||
+14
-1
@@ -76,6 +76,18 @@ int
|
||||
#endif
|
||||
|
||||
|
||||
#define ALLOW 0
|
||||
#define DENY 1
|
||||
#define REDIRECT 2
|
||||
#define BANDLIM 3
|
||||
#define NOBANDLIM 4
|
||||
#define COUNTIN 5
|
||||
#define NOCOUNTIN 6
|
||||
#define COUNTOUT 7
|
||||
#define NOCOUNTOUT 8
|
||||
#define CONNLIM 9
|
||||
#define NOCONNLIM 10
|
||||
|
||||
#define CONNECT 0x00000001
|
||||
#define BIND 0x00000002
|
||||
#define UDPASSOC 0x00000004
|
||||
@@ -444,7 +456,8 @@ struct clientparam {
|
||||
int redirected,
|
||||
operation,
|
||||
nfilters, nreqfilters, nhdrfilterscli, nhdrfilterssrv, npredatfilters, ndatfilterscli, ndatfilterssrv,
|
||||
unsafefilter;
|
||||
unsafefilter,
|
||||
bandlimver;
|
||||
|
||||
int res,
|
||||
status;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ void * tcppmchild(struct clientparam* param) {
|
||||
RETURN (sockmap(param, conf.timeouts[CONNECTION_L]));
|
||||
CLEANRET:
|
||||
|
||||
(*param->srv->logfunc)(param, NULL);
|
||||
(*param->srv->logfunc)(param, param->hostname);
|
||||
freeparam(param);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
#define VERSION "3proxy-0.8.8"
|
||||
#define BUILDDATE "161213011647"
|
||||
#define VERSION "3proxy-0.8.13"
|
||||
#define BUILDDATE "190801174904"
|
||||
+10
-10
@@ -10,7 +10,7 @@
|
||||
|
||||
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
|
||||
|
||||
#define LINESIZE 2048
|
||||
#define LINESIZE 65536
|
||||
|
||||
extern FILE *writable;
|
||||
FILE * confopen();
|
||||
@@ -341,7 +341,7 @@ void * adminchild(struct clientparam* param) {
|
||||
char *sb;
|
||||
char *req = NULL;
|
||||
struct printparam pp;
|
||||
int contentlen = 0;
|
||||
unsigned contentlen = 0;
|
||||
int isform = 0;
|
||||
|
||||
pp.inbuf = 0;
|
||||
@@ -390,7 +390,8 @@ void * adminchild(struct clientparam* param) {
|
||||
else if(i > 15 && (!strncasecmp(buf, "content-length:", 15))){
|
||||
sb = buf + 15;
|
||||
while(isspace(*sb))sb++;
|
||||
contentlen = atoi(sb);
|
||||
sscanf(sb, "%u", &contentlen);
|
||||
if(contentlen > LINESIZE*1024) contentlen = 0;
|
||||
}
|
||||
else if(i > 13 && (!strncasecmp(buf, "content-type:", 13))){
|
||||
sb = buf + 13;
|
||||
@@ -520,7 +521,7 @@ void * adminchild(struct clientparam* param) {
|
||||
break;
|
||||
}
|
||||
printstr(&pp, "<h3>Please be careful editing config file remotely</h3>");
|
||||
printstr(&pp, "<form method=\"POST\" action=\"/U\"><textarea cols=\"80\" rows=\"30\" name=\"conffile\">");
|
||||
printstr(&pp, "<form method=\"POST\" action=\"/U\" enctype=\"application/x-www-form-urlencoded\"><textarea cols=\"80\" rows=\"30\" name=\"conffile\">");
|
||||
while(fgets(buf, 256, fp)){
|
||||
printstr(&pp, buf);
|
||||
}
|
||||
@@ -530,24 +531,23 @@ void * adminchild(struct clientparam* param) {
|
||||
}
|
||||
case 'U':
|
||||
{
|
||||
int l=0;
|
||||
unsigned l=0;
|
||||
int error = 0;
|
||||
|
||||
if(!writable || fseek(writable, 0, 0)){
|
||||
if(!writable || !contentlen || fseek(writable, 0, 0)){
|
||||
error = 1;
|
||||
}
|
||||
while((i = sockgetlinebuf(param, CLIENT, (unsigned char *)buf, LINESIZE - 1, '+', 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);
|
||||
buf[i] = 0;
|
||||
if(!l){
|
||||
if(strncasecmp(buf, "conffile=", 9)) error = 1;
|
||||
if(i<9 || strncasecmp(buf, "conffile=", 9)) error = 1;
|
||||
}
|
||||
if(!error){
|
||||
buf[i] = 0;
|
||||
decodeurl((unsigned char *)buf, 1);
|
||||
fprintf(writable, "%s", l? buf : buf + 9);
|
||||
}
|
||||
l += i;
|
||||
if(l >= contentlen) break;
|
||||
}
|
||||
if(writable && !error){
|
||||
fflush(writable);
|
||||
|
||||
Reference in new issue
Block a user