From 59cc68e8dd0a3af3fb0ca7c9e23124ce6004ef2c Mon Sep 17 00:00:00 2001 From: z3APA3A <3APA3A@3proxy.ru> Date: Mon, 31 Aug 2015 22:01:31 +0300 Subject: [PATCH] Move FTP login prompt in proxy to common section --- src/proxy.c | 15 ++++++++------- src/version.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/proxy.c b/src/proxy.c index ddb58e9..96fa1f2 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -133,6 +133,7 @@ char * proxy_stringtable[] = { #define BUFSIZE 8192 #define LINESIZE 4096 +#define FTPBUFSIZE 1536 static void logurl(struct clientparam * param, char * buf, char * req, int ftp){ char *sb; @@ -228,6 +229,8 @@ void * proxychild(struct clientparam* param) { int authenticate; struct pollfd fds[2]; SOCKET ftps; + char ftpbuf[FTPBUFSIZE]; + int inftpbuf = 0; #ifndef WITHMAIN FILTER_ACTION action; #endif @@ -539,23 +542,17 @@ for(;;){ #endif if((res = (*param->srv->authfunc)(param))) {RETURN(res);} -#define FTPBUFSIZE 1536 if(ftp && param->redirtype != R_HTTP){ SOCKET s; int mode = 0; int i=0; - char ftpbuf[FTPBUFSIZE]; - int inftpbuf = 0; + inftpbuf = 0; if(!ckeepalive){ inftpbuf = FTPBUFSIZE - 20; res = ftplogin(param, ftpbuf, &inftpbuf); if(res){ - if (res == 700 || res == 701){ - socksend(param->clisock, (unsigned char *)proxy_stringtable[16], (int)strlen(proxy_stringtable[16]), conf.timeouts[STRING_S]); - socksend(param->clisock, (unsigned char *)ftpbuf, inftpbuf, conf.timeouts[STRING_S]); - } RETURN(res); } } @@ -1052,6 +1049,10 @@ CLEANRET: if(param->res == 10) { socksend(param->clisock, (unsigned char *)proxy_stringtable[2], (int)strlen(proxy_stringtable[2]), conf.timeouts[STRING_S]); } + else if (res == 700 || res == 701){ + socksend(param->clisock, (unsigned char *)proxy_stringtable[16], (int)strlen(proxy_stringtable[16]), conf.timeouts[STRING_S]); + socksend(param->clisock, (unsigned char *)ftpbuf, inftpbuf, conf.timeouts[STRING_S]); + } else if(param->res == 100 || (param->res >10 && param->res < 20) || (param->res >701 && param->res <= 705)) { socksend(param->clisock, (unsigned char *)proxy_stringtable[1], (int)strlen(proxy_stringtable[1]), conf.timeouts[STRING_S]); } diff --git a/src/version.h b/src/version.h index e5d17f3..bcc70cd 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ #define VERSION "3proxy-0.8b-devel" -#define BUILDDATE "150608002425" +#define BUILDDATE "150831214516"