Compare commits

...
13 Commits
Author SHA1 Message Date
z3APA3A cc9bd25c5a Publish as 0.7.1.4 2016-01-23 19:03:56 +03:00
z3APA3A 87fa9cca55 Reset transparent flag after keep-alive request 2016-01-23 19:03:30 +03:00
z3APA3A db169c48c3 commit as 3proxy-0.7.1.3 2015-09-16 00:55:00 +03:00
z3APA3A 206e00c933 avoid potential race condition on configuration reload 2015-09-16 00:54:34 +03:00
z3APA3A 98961ced0d Fix FTP over HTTP authentication request parsing
Conflicts:
	src/version.h
2015-09-11 23:10:40 +03:00
z3APA3A de8de757f6 Fix FTP over HTTP authentication
Send WWW-Authenticate instead of Proxy-Authenticate

Conflicts:
	src/version.h
2015-09-11 23:08:57 +03:00
z3APA3A e935d1f6d1 fix static memory free() attempt
Conflicts:
	src/version.h
2015-09-11 23:06:30 +03:00
z3APA3A 1be182c65f Fix potential inithashtable() race condition
potential race condition on configuration reload.
2015-09-11 22:59:40 +03:00
z3APA3A 5ef18c48f1 bugfix: archiver doesn't add suffix if logname contains macro 2015-06-05 15:55:43 +03:00
z3APA3A c3871caf2a traffic displayed incorrectly 2015-06-03 15:35:33 +03:00
z3APA3A f649c7d4de publish as 0.7.1.2 2015-02-27 16:52:46 +03:00
z3APA3A 0a14a3bcdb Increase maximum request / header length limit 2015-02-17 16:09:13 +03:00
z3APA3A 17665e1f8e Correct error handling for thread creation
Error handling corrected for thread creation in case of e.g.
insufficient system resources.
2014-08-15 18:48:06 +04:00
7 changed files with 34 additions and 21 deletions

No files matched your search

+1 -2
View File
@@ -360,9 +360,8 @@ unsigned char * dologname (unsigned char *buf, unsigned char *name, const unsign
memset(&fakecli, 0, sizeof(fakecli)); memset(&fakecli, 0, sizeof(fakecli));
dobuf2(&fakecli, buf, NULL, NULL, ts, (char *)name); dobuf2(&fakecli, buf, NULL, NULL, ts, (char *)name);
return buf;
} }
switch(lt){ else switch(lt){
case NONE: case NONE:
sprintf((char *)buf, "%s", name); sprintf((char *)buf, "%s", name);
break; break;
+8 -1
View File
@@ -922,6 +922,7 @@ int inithashtable(struct hashtable *ht, unsigned nhashsize){
unsigned i; unsigned i;
if(nhashsize<4) return 1; if(nhashsize<4) return 1;
pthread_mutex_lock(&hash_mutex);
if(ht->hashtable){ if(ht->hashtable){
myfree(ht->hashtable); myfree(ht->hashtable);
ht->hashtable = NULL; ht->hashtable = NULL;
@@ -932,11 +933,13 @@ int inithashtable(struct hashtable *ht, unsigned nhashsize){
} }
ht->hashsize = 0; ht->hashsize = 0;
if(!(ht->hashtable = myalloc((nhashsize>>2) * sizeof(struct hashentry *)))){ if(!(ht->hashtable = myalloc((nhashsize>>2) * sizeof(struct hashentry *)))){
pthread_mutex_unlock(&hash_mutex);
return 2; return 2;
} }
if(!(ht->hashvalues = myalloc(nhashsize * sizeof(struct hashentry)))){ if(!(ht->hashvalues = myalloc(nhashsize * sizeof(struct hashentry)))){
myfree(ht->hashtable); myfree(ht->hashtable);
ht->hashtable = NULL; ht->hashtable = NULL;
pthread_mutex_unlock(&hash_mutex);
return 3; return 3;
} }
ht->hashsize = nhashsize; ht->hashsize = nhashsize;
@@ -946,6 +949,7 @@ int inithashtable(struct hashtable *ht, unsigned nhashsize){
(ht->hashvalues + i)->next = ht->hashvalues + i + 1; (ht->hashvalues + i)->next = ht->hashvalues + i + 1;
} }
ht->hashempty = ht->hashvalues; ht->hashempty = ht->hashvalues;
pthread_mutex_unlock(&hash_mutex);
return 0; return 0;
} }
@@ -957,8 +961,11 @@ void hashadd(struct hashtable *ht, const unsigned char* name, unsigned long valu
struct hashentry * he; struct hashentry * he;
unsigned index; unsigned index;
if(!value||!name||!ht->hashtable||!ht->hashempty) return;
pthread_mutex_lock(&hash_mutex); pthread_mutex_lock(&hash_mutex);
if(!value||!name||!ht->hashtable||!ht->hashempty){
pthread_mutex_unlock(&hash_mutex);
return;
}
he = ht->hashempty; he = ht->hashempty;
ht->hashempty = ht->hashempty->next; ht->hashempty = ht->hashempty->next;
nametohash(name, he->hash); nametohash(name, he->hash);
+7 -5
View File
@@ -49,7 +49,7 @@ static pthread_mutex_t file_mutex;
unsigned long preview = 0; unsigned long preview = 0;
char path[256]; char path[300];
static int counter = 0; static int counter = 0;
static int timeo = 0; static int timeo = 0;
@@ -876,13 +876,15 @@ __declspec(dllexport)
fp_symbols[1].next = pl->symbols.next; fp_symbols[1].next = pl->symbols.next;
pl->symbols.next = fp_symbols; pl->symbols.next = fp_symbols;
} }
if(path) free(path);
dirp = (argc > 1)? argv[1] : getenv("TEMP"); dirp = (argc > 1)? argv[1] : getenv("TEMP");
if(strlen(dirp) > 200 || strchr(dirp, '%')) return (13001); if(strlen(dirp) > 200 || strchr(dirp, '%')) {
fprintf(stderr, "FilePlugin: invalid directory path: %s\n", dirp);
return (13001);
}
#ifdef _WIN32 #ifdef _WIN32
sprintf(path, "%s\\%%d.tmp", dirp); sprintf(path, "%.256s\\%%07d.tmp", dirp);
#else #else
sprintf(path, "%s/%%d.tmp", dirp); sprintf(path, "%.256s/%%07d.tmp", dirp);
#endif #endif
if(argc > 2) preview = atoi(argv[2]); if(argc > 2) preview = atoi(argv[2]);
if(!preview) preview = 32768; if(!preview) preview = 32768;
+5 -4
View File
@@ -119,7 +119,7 @@ char * proxy_stringtable[] = {
"<body><h2>503 Service Unavailable</h2><h3>Your request violates configured policy</h3></body></html>\r\n", "<body><h2>503 Service Unavailable</h2><h3>Your request violates configured policy</h3></body></html>\r\n",
/* 16*/ "HTTP/1.0 401 Authentication Required\r\n" /* 16*/ "HTTP/1.0 401 Authentication Required\r\n"
"Proxy-Authenticate: basic realm=\"FTP Server\"\r\n" "WWW-Authenticate: basic realm=\"FTP Server\"\r\n"
"Proxy-Connection: close\r\n" "Proxy-Connection: close\r\n"
"Content-type: text/html; charset=us-ascii\r\n" "Content-type: text/html; charset=us-ascii\r\n"
"\r\n" "\r\n"
@@ -132,8 +132,8 @@ char * proxy_stringtable[] = {
NULL NULL
}; };
#define BUFSIZE 4096 #define LINESIZE 4096
#define LINESIZE 2048 #define BUFSIZE (LINESIZE*2)
static void logurl(struct clientparam * param, char * buf, char * req, int ftp){ static void logurl(struct clientparam * param, char * buf, char * req, int ftp){
char *sb; char *sb;
@@ -300,6 +300,7 @@ for(;;){
if ((sb=(unsigned char *)(unsigned char *)strchr((char *)buf, ' ')) == NULL) {RETURN(512);} if ((sb=(unsigned char *)(unsigned char *)strchr((char *)buf, ' ')) == NULL) {RETURN(512);}
ss = ++sb; ss = ++sb;
param->transparent = 0;
if(!isconnect) { if(!isconnect) {
if (!strncasecmp((char *)sb, "http://", 7)) { if (!strncasecmp((char *)sb, "http://", 7)) {
sb += 7; sb += 7;
@@ -464,7 +465,7 @@ for(;;){
} }
if(se)*se = '\r'; if(se)*se = '\r';
} }
if(ftp && i > 19 && (!strncasecmp((char *)(buf+inbuf), "authorization", 19))){ if(ftp && i > 13 && (!strncasecmp((char *)(buf+inbuf), "authorization", 13))){
sb = (unsigned char *)strchr((char *)(buf+inbuf), ':'); sb = (unsigned char *)strchr((char *)(buf+inbuf), ':');
if(!sb)continue; if(!sb)continue;
++sb; ++sb;
+9 -5
View File
@@ -460,22 +460,26 @@ int MODULEMAINFUNC (int argc, char** argv){
#else #else
h = (HANDLE)CreateThread((LPSECURITY_ATTRIBUTES )NULL, (unsigned)32768, (BEGINTHREADFUNC)srv.pf, (void *) newparam, 0, &thread); h = (HANDLE)CreateThread((LPSECURITY_ATTRIBUTES )NULL, (unsigned)32768, (BEGINTHREADFUNC)srv.pf, (void *) newparam, 0, &thread);
#endif #endif
newparam->threadid = (unsigned)thread; srv.childcount++;
if (h) { if (h) {
srv.childcount++; newparam->threadid = (unsigned)thread;
CloseHandle(h); CloseHandle(h);
} }
else { else {
myfree(newparam); sprintf((char *)buf, "_beginthreadex(): %s", _strerror(NULL));
if(!srv.silent)(*srv.logfunc)(&defparam, buf);
freeparam(newparam);
} }
#else #else
if((error = pthread_create(&thread, &pa, (PTHREADFUNC)srv.pf, (void *)newparam))){
error = pthread_create(&thread, &pa, (PTHREADFUNC)srv.pf, (void *)newparam);
srv.childcount++;
if(error){
sprintf((char *)buf, "pthread_create(): %s", strerror(error)); sprintf((char *)buf, "pthread_create(): %s", strerror(error));
if(!srv.silent)(*srv.logfunc)(&defparam, buf); if(!srv.silent)(*srv.logfunc)(&defparam, buf);
freeparam(newparam); freeparam(newparam);
} }
else { else {
srv.childcount++;
newparam->threadid = (unsigned)thread; newparam->threadid = (unsigned)thread;
} }
#endif #endif
+2 -2
View File
@@ -1,2 +1,2 @@
#define VERSION "3proxy-0.7.1.1" #define VERSION "3proxy-0.7.1.4"
#define BUILDDATE "140702135419" #define BUILDDATE "160123190051"
+2 -2
View File
@@ -480,9 +480,9 @@ void * adminchild(struct clientparam* param) {
"<td>MB%s</td>" "<td>MB%s</td>"
"<td>%.3f MB</td>" "<td>%.3f MB</td>"
"<td>%s</td>", "<td>%s</td>",
(1024.0 * (float)cp->traflimgb) + (float)cp->traflim/1048576.0, (4 * 1024.0 * (float)cp->traflimgb) + (float)cp->traflim/(1024.*1024.),
rotations[cp->type], rotations[cp->type],
(1024.0 * (float)cp->trafgb) + (float)cp->traf/1048576.0, (4 * 1024.0 * (float)cp->trafgb) + (float)cp->traf/(1024.*1024.),
cp->cleared?ctime(&cp->cleared):"never" cp->cleared?ctime(&cp->cleared):"never"
); );
inbuf += sprintf(buf + inbuf, inbuf += sprintf(buf + inbuf,