Compare commits

...
15 Commits
18 changed files with 6615 additions and 1841 deletions

No files matched your search

+5 -8
View File
@@ -1,9 +1,6 @@
#include "src/version.h"
1 VERSIONINFO
FILEVERSION 0,8,10,0
PRODUCTVERSION 0,8,10,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.10\0"
VALUE "FileVersion", "0.8.13\0"
VALUE "InternalName", "3proxy\0"
VALUE "LegalCopyright", "Copyright (C) 2002-2017 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.10\0"
VALUE "ProductVersion", "0.8.13\0"
END
END
BLOCK "VarFileInfo"
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
+19 -18
View File
@@ -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
View File
File diff suppressed because it is too large. Load diff
+11
View File
@@ -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>
+8 -4
View File
@@ -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
View File
@@ -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"},
+1 -1
View File
@@ -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)
+11 -23
View File
@@ -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;
+1 -11
View File
@@ -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,16 +29,6 @@
#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))
@@ -47,6 +36,7 @@
#ifdef _WIN32
#include <winsock2.h>
#include <sys/timeb.h>
#ifndef _WINCE
#include <io.h>
#else
+1 -1
View File
@@ -376,7 +376,7 @@ fflush(stderr);
buf[i] = buf[i+1];
}
buf[i++] = 0;
if(!getip46(param->srv->family, buf, (struct sockaddr *) &param->sinsr)) RETURN(100);
if(!getip46(param->srv->family, buf+4, (struct sockaddr *) &param->sinsr)) RETURN(100);
break;
default:
RETURN(997);
+12
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -1,2 +1,2 @@
#define VERSION "3proxy-0.8.10"
#define BUILDDATE "170625190910"
#define VERSION "3proxy-0.8.13"
#define BUILDDATE "190801174904"
+10 -10
View File
@@ -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);