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 1 VERSIONINFO
FILEVERSION 0,8,10,0 FILEVERSION 0,8,13,0
PRODUCTVERSION 0,8,10,0 PRODUCTVERSION 0,8,13,0
FILETYPE 1 FILETYPE 1
FILESUBTYPE 0x0L FILESUBTYPE 0x0L
BEGIN BEGIN
@@ -14,12 +11,12 @@ BEGIN
VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.ru/\0" VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.ru/\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.8.10\0" VALUE "FileVersion", "0.8.13\0"
VALUE "InternalName", "3proxy\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 "OriginalFilename", "3proxy.exe\0"
VALUE "ProductName", "3proxy\0" VALUE "ProductName", "3proxy\0"
VALUE "ProductVersion", "0.8.10\0" VALUE "ProductVersion", "0.8.13\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
+2 -2
View File
@@ -10,11 +10,11 @@
BUILDDIR = BUILDDIR =
CC = gcc 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 COUT = -o
LN = gcc LN = gcc
DCFLAGS = -fpic DCFLAGS = -fpic
LDFLAGS = -O2 -pthread LDFLAGS = -O2 -fno-strict-aliasing -pthread
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .ld.so DLSUFFICS = .ld.so
# -lpthreads may be reuqired on some platforms instead of -pthreads # -lpthreads may be reuqired on some platforms instead of -pthreads
+1 -1
View File
@@ -10,7 +10,7 @@
BUILDDIR = BUILDDIR =
CC = gcc 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 ./ COUT = -o ./
LN = gcc LN = gcc
LDFLAGS = -O3 LDFLAGS = -O3
+2 -2
View File
@@ -10,10 +10,10 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = clang 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 COUT = -o
LN = clang LN = clang
LDFLAGS = -O2 -static -s LDFLAGS = -O2 -fno-strict-aliasing -static -s
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .dll DLSUFFICS = .dll
LIBS = -lws2_32 -lodbc32 -ladvapi32 LIBS = -lws2_32 -lodbc32 -ladvapi32
+2 -2
View File
@@ -11,10 +11,10 @@ BUILDDIR =
CC = gcc CC = gcc
# you may need -L/usr/pkg/lib for older NetBSD versions # you may need -L/usr/pkg/lib for older NetBSD versions
CFLAGS = -g -O2 -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o COUT = -o
LN = gcc LN = gcc
LDFLAGS = -O2 -pthread LDFLAGS = -O2 -fno-strict-aliasing -pthread
# -lpthreads may be reuqired on some platforms instead of -pthreads # -lpthreads may be reuqired on some platforms instead of -pthreads
# -ldl or -lld may be required for some platforms # -ldl or -lld may be required for some platforms
DCFLAGS = -fpic DCFLAGS = -fpic
+19 -18
View File
@@ -1,18 +1,19 @@
<html><title>3proxy documentation</title><body><h2>3proxy documentation</h2> <html><title>3proxy documentation</title><body><h2>3proxy documentation</h2>
<a href="securityen.html">Security recommendations</a><br> <a href="securityen.html">Security recommendations</a><br>
<a href="howtoe.html">How To (English, very incomplete)</a><br> <a href="highload.html">Optimizing 3proxy for high loads</a><br>
<a href="howtor.html">How To (Russian)</a><br> <a href="howtoe.html">How To (English, very incomplete)</a><br>
<a href="faqe.html">FAQ (English)</a><br> <a href="howtor.html">How To (Russian)</a><br>
<a href="faqr.html">FAQ (Russian)</a> <a href="faqe.html">FAQ (English)</a><br>
<h3>Man pages:</h> <a href="faqr.html">FAQ (Russian)</a>
<br><A HREF="man8/3proxy.8.html">3proxy.8</A> <h3>Man pages:</h>
<br><A HREF="man8/ftppr.8.html">ftppr.8</A> <br><A HREF="man8/3proxy.8.html">3proxy.8</A>
<br><A HREF="man8/icqpr.8.html">icqpr.8</A> <br><A HREF="man8/ftppr.8.html">ftppr.8</A>
<br><A HREF="man8/pop3p.8.html">pop3p.8</A> <br><A HREF="man8/icqpr.8.html">icqpr.8</A>
<br><A HREF="man8/proxy.8.html">proxy.8</A> <br><A HREF="man8/pop3p.8.html">pop3p.8</A>
<br><A HREF="man8/smtpp.8.html">smtpp.8</A> <br><A HREF="man8/proxy.8.html">proxy.8</A>
<br><A HREF="man8/socks.8.html">socks.8</A> <br><A HREF="man8/smtpp.8.html">smtpp.8</A>
<br><A HREF="man8/tcppm.8.html">tcppm.8</A> <br><A HREF="man8/socks.8.html">socks.8</A>
<br><A HREF="man8/udppm.8.html">udppm.8</A> <br><A HREF="man8/tcppm.8.html">tcppm.8</A>
<br><A HREF="man3/3proxy.cfg.3.html">3proxy.cfg.3</A> <br><A HREF="man8/udppm.8.html">udppm.8</A>
</body></html> <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 .br
Weight may be used for different purposes. 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 .br
.B bandlimin .B bandlimin
<rate> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist> <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; unsigned char * incbegin = 0;
int fd; int fd;
int res, len; int res, len;
int i = 1;
unsigned char *str1; unsigned char *str1;
for(;;str++){ for(;;str++){
@@ -1444,7 +1443,14 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
argm[argc] = 0; argm[argc] = 0;
return argc; return argc;
case '$': case '$':
if(!comment && !included){ if(comment){
if(space){
argm[argc++] = str;
if(argc >= nitems) return argc;
space = 0;
}
}
else if(!included){
incbegin = str; incbegin = str;
*str = 0; *str = 0;
} }
@@ -1456,7 +1462,6 @@ int parsestr (unsigned char *str, unsigned char **argm, int nitems, unsigned cha
if(!comment){ if(!comment){
*str = 0; *str = 0;
space = 1; space = 1;
i = 0;
if(incbegin){ if(incbegin){
argc--; argc--;
if((fd = open((char *)incbegin+1, O_RDONLY)) <= 0){ 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; break;
} }
default: default:
i++;
if(space) { if(space) {
if(comment && *str == '\"' && str[1] != '\"'){ if(comment && *str == '\"' && str[1] != '\"'){
str++; str++;
+19 -17
View File
@@ -75,7 +75,7 @@ static void pr_sa(struct node *node, CBFUNC cbf, void*cb){
char buf[64]; char buf[64];
buf[0] = '['; buf[0] = '[';
buf[1] = 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)); sprintf(buf + strlen(buf), "]:%hu", (unsigned short)*SAPORT(node->value));
if(node->value)(*cbf)(cb, buf, strlen(buf)); if(node->value)(*cbf)(cb, buf, strlen(buf));
#endif #endif
@@ -743,21 +743,23 @@ static struct property prop_server[] = {
{prop_server + 2, "target", ef_server_target, TYPE_STRING, "portmapper target ip"}, {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 + 3, "targetport", ef_server_targetport, TYPE_PORT, "portmapper target port"},
{prop_server + 4, "starttime", ef_server_starttime, TYPE_DATETIME, "service started seconds"}, {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 + 5, "auth", ef_server_auth, TYPE_STRING, "service authentication type"},
{prop_server + 6, "extsa", ef_server_extsa, TYPE_SA, "ip address of external interface"}, {prop_server + 6, "acl", ef_server_acl, TYPE_ACE, "access control list"},
{prop_server + 7, "auth", ef_server_auth, TYPE_STRING, "service authentication type"}, {prop_server + 7, "singlepacket", ef_server_singlepacket, TYPE_INTEGER, "is single packet redirection"},
{prop_server + 8, "acl", ef_server_acl, TYPE_ACE, "access control list"}, {prop_server + 8, "usentlm", ef_server_usentlm, TYPE_INTEGER, "allow NTLM authentication"},
{prop_server + 9, "singlepacket", ef_server_singlepacket, TYPE_INTEGER, "is single packet redirection"}, {prop_server + 9, "log", ef_server_log, TYPE_STRING, "type of logging"},
{prop_server + 10, "usentlm", ef_server_usentlm, TYPE_INTEGER, "allow NTLM authentication"}, {prop_server + 10, "logtarget", ef_server_logtarget, TYPE_STRING, "log target options"},
{prop_server + 11, "log", ef_server_log, TYPE_STRING, "type of logging"}, {prop_server + 11, "logformat", ef_server_logformat, TYPE_STRING, "logging format string"},
{prop_server + 12, "logtarget", ef_server_logtarget, TYPE_STRING, "log target options"}, {prop_server + 12, "nonprintable", ef_server_nonprintable, TYPE_STRING, "non printable characters"},
{prop_server + 13, "logformat", ef_server_logformat, TYPE_STRING, "logging format string"}, {prop_server + 13, "replacement", ef_server_replacement, TYPE_CHAR, "replacement character"},
{prop_server + 14, "nonprintable", ef_server_nonprintable, TYPE_STRING, "non printable characters"}, {prop_server + 14, "childcount", ef_server_childcount, TYPE_INTEGER, "number of servers connected"},
{prop_server + 15, "replacement", ef_server_replacement, TYPE_CHAR, "replacement character"}, {prop_server + 15, "intsa", ef_server_intsa, TYPE_SA, "ip address of internal interface"},
{prop_server + 16, "childcount", ef_server_childcount, TYPE_INTEGER, "number of servers connected"}, {prop_server + 16, "extsa", ef_server_extsa, TYPE_SA, "ip address of external interface"},
{prop_server + 17, "child", ef_server_child, TYPE_CLIENT, "connected clients"},
#ifndef NOIPV6 #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 #endif
{NULL, "next", ef_server_next, TYPE_SERVER, "next"} {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 + 10, "username", ef_client_username, TYPE_STRING, "client username"},
{prop_client + 11, "password", ef_client_password, TYPE_STRING, "client password"}, {prop_client + 11, "password", ef_client_password, TYPE_STRING, "client password"},
{prop_client + 12, "clisa", ef_client_clisa, TYPE_SA, "client sa"}, {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 + 13, "srvsa", ef_client_srvsa, TYPE_SA, "target server sa"},
{prop_client + 14, "reqsa", ef_client_reqsa, TYPE_IP, "requested 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 + 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 + 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"}, {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 $(CC) $(DCFLAGS) $(CFLAGS) ldapauth.c
$(BUILDDIR)ldapauth$(DLSUFFICS): ldapauth$(OBJSUFFICS) $(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 <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <time.h> #include <time.h>
#include <ldap.h>
#ifndef _WIN32 #ifndef _WIN32
#include <ctype.h> #include <ctype.h>
#endif #endif
#include "../../proxy.h"
#include "../../structures.h" #include "../../structures.h"
#define LDAP_DEPRECATED 1
struct counter_record #include <ldap.h>
{
unsigned long traf;
unsigned long trafgb;
time_t cleared;
time_t updated;
};
int already_loaded = 0; int already_loaded = 0;
@@ -62,7 +52,7 @@ void lower (char *string)
#endif #endif
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
int savecouters(void) int savecounters(void)
{ {
struct trafcount *tc=mypluginlink->conf->trafcounter; struct trafcount *tc=mypluginlink->conf->trafcounter;
struct trafcount *tcd; struct trafcount *tcd;
@@ -82,8 +72,8 @@ int savecouters(void)
sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user); sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user);
f=fopen(tmpbuf,"w+b"); f=fopen(tmpbuf,"w+b");
fseek(f,0,SEEK_SET); fseek(f,0,SEEK_SET);
fprintf(f,"%10lu %10lu %lu %lu\n",tcd->trafgb,tcd->traf, fprintf(f,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",tcd->traf64,
tcd->cleared,tcd->updated); (unsigned long)tcd->cleared,(unsigned long)tcd->updated);
fclose(f); fclose(f);
mypluginlink->myfree(tmpbuf); mypluginlink->myfree(tmpbuf);
@@ -385,8 +375,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
memset(newtrafcount, 0, sizeof(struct trafcount)); memset(newtrafcount, 0, sizeof(struct trafcount));
newtrafcount->ace = newace; newtrafcount->ace = newace;
newtrafcount->type=rtype; newtrafcount->type=rtype;
newtrafcount->traflimgb =(traflimit/(1024*4)); newtrafcount->traflim64 = traflimit;
newtrafcount->traflim = ((traflimit - (newtrafcount->traflimgb*(1024*4)))*(1024*1024));
newtrafcount->comment=(*mypluginlink->mystrdup)("ldapcounters"); newtrafcount->comment=(*mypluginlink->mystrdup)("ldapcounters");
newtrafcount->number=0; newtrafcount->number=0;
tmpbuf=(*mypluginlink->myalloc)(strlen(pat_file)+strlen(ldap_dircount)+strlen(vals[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); fseek(f,0,SEEK_SET);
fgets(buf, 256, f); 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); &rcounter.cleared, &rcounter.updated);
newtrafcount->trafgb=rcounter.trafgb; newtrafcount->traf64=rcounter.traf64;
newtrafcount->traf=rcounter.traf;
newtrafcount->cleared=rcounter.cleared; newtrafcount->cleared=rcounter.cleared;
newtrafcount->updated=rcounter.updated; newtrafcount->updated=rcounter.updated;
fclose(f); fclose(f);
@@ -565,7 +553,7 @@ PLUGINAPI int PLUGINCALL start(struct pluginlink * pluginlink,
/*create job shedule for processing reload, save counters to file */ /*create job shedule for processing reload, save counters to file */
memset(&myschedule,0,sizeof(struct schedule)); memset(&myschedule,0,sizeof(struct schedule));
myschedule.type=MINUTELY; myschedule.type=MINUTELY;
myschedule.function=savecouters; myschedule.function=savecounters;
myschedule.next = *pluginlink->schedule; myschedule.next = *pluginlink->schedule;
*pluginlink->schedule=&myschedule; *pluginlink->schedule=&myschedule;
+1 -11
View File
@@ -21,7 +21,6 @@
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/timeb.h>
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
@@ -30,16 +29,6 @@
#define _PASSWORD_LEN 256 #define _PASSWORD_LEN 256
#define MAXNSERVERS 5 #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 UDPBUFSIZE 16384
#define TCPBUFSIZE 8192 #define TCPBUFSIZE 8192
#define SRVBUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE)) #define SRVBUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
@@ -47,6 +36,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <sys/timeb.h>
#ifndef _WINCE #ifndef _WINCE
#include <io.h> #include <io.h>
#else #else
+1 -1
View File
@@ -376,7 +376,7 @@ fflush(stderr);
buf[i] = buf[i+1]; buf[i] = buf[i+1];
} }
buf[i++] = 0; 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; break;
default: default:
RETURN(997); RETURN(997);
+12
View File
@@ -76,6 +76,18 @@ int
#endif #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 CONNECT 0x00000001
#define BIND 0x00000002 #define BIND 0x00000002
#define UDPASSOC 0x00000004 #define UDPASSOC 0x00000004
+1 -1
View File
@@ -23,7 +23,7 @@ void * tcppmchild(struct clientparam* param) {
RETURN (sockmap(param, conf.timeouts[CONNECTION_L])); RETURN (sockmap(param, conf.timeouts[CONNECTION_L]));
CLEANRET: CLEANRET:
(*param->srv->logfunc)(param, NULL); (*param->srv->logfunc)(param, param->hostname);
freeparam(param); freeparam(param);
return (NULL); return (NULL);
} }
+2 -2
View File
@@ -1,2 +1,2 @@
#define VERSION "3proxy-0.8.10" #define VERSION "3proxy-0.8.13"
#define BUILDDATE "170625190910" #define BUILDDATE "190801174904"
+10 -10
View File
@@ -10,7 +10,7 @@
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; } #define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
#define LINESIZE 2048 #define LINESIZE 65536
extern FILE *writable; extern FILE *writable;
FILE * confopen(); FILE * confopen();
@@ -341,7 +341,7 @@ void * adminchild(struct clientparam* param) {
char *sb; char *sb;
char *req = NULL; char *req = NULL;
struct printparam pp; struct printparam pp;
int contentlen = 0; unsigned contentlen = 0;
int isform = 0; int isform = 0;
pp.inbuf = 0; pp.inbuf = 0;
@@ -390,7 +390,8 @@ void * adminchild(struct clientparam* param) {
else if(i > 15 && (!strncasecmp(buf, "content-length:", 15))){ else if(i > 15 && (!strncasecmp(buf, "content-length:", 15))){
sb = buf + 15; sb = buf + 15;
while(isspace(*sb))sb++; 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))){ else if(i > 13 && (!strncasecmp(buf, "content-type:", 13))){
sb = buf + 13; sb = buf + 13;
@@ -520,7 +521,7 @@ void * adminchild(struct clientparam* param) {
break; break;
} }
printstr(&pp, "<h3>Please be careful editing config file remotely</h3>"); 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)){ while(fgets(buf, 256, fp)){
printstr(&pp, buf); printstr(&pp, buf);
} }
@@ -530,24 +531,23 @@ void * adminchild(struct clientparam* param) {
} }
case 'U': case 'U':
{ {
int l=0; unsigned l=0;
int error = 0; int error = 0;
if(!writable || fseek(writable, 0, 0)){ if(!writable || !contentlen || fseek(writable, 0, 0)){
error = 1; 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); if(i > (contentlen - l)) i = (contentlen - l);
buf[i] = 0;
if(!l){ if(!l){
if(strncasecmp(buf, "conffile=", 9)) error = 1; if(i<9 || strncasecmp(buf, "conffile=", 9)) error = 1;
} }
if(!error){ if(!error){
buf[i] = 0;
decodeurl((unsigned char *)buf, 1); decodeurl((unsigned char *)buf, 1);
fprintf(writable, "%s", l? buf : buf + 9); fprintf(writable, "%s", l? buf : buf + 9);
} }
l += i; l += i;
if(l >= contentlen) break;
} }
if(writable && !error){ if(writable && !error){
fflush(writable); fflush(writable);