From 1a27fd88a909d6142a0439901fb0eaa9203770ad Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 7 May 2014 01:42:22 +0400 Subject: [PATCH] FTP proxy debugging output removed, bind to same IP with control connection for active FTP FTP proxy debugging output removed, bind to same IP with control connection for active FTP --- src/ftppr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ftppr.c b/src/ftppr.c index 0d47b4e..4dff6b7 100644 --- a/src/ftppr.c +++ b/src/ftppr.c @@ -42,8 +42,6 @@ void * ftpprchild(struct clientparam* param) { if (req) myfree (req); req = NULL; -(*param->srv->logfunc)(param, buf); - if (!strncasecmp((char *)buf, "OPEN ", 5)){ if(parsehostname((char *)buf+5, param, 21)){RETURN(803);} if(param->remsock != INVALID_SOCKET) { @@ -123,10 +121,10 @@ void * ftpprchild(struct clientparam* param) { } if ((clidatasock=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);} sasize = sizeof(struct sockaddr_in); + if(so._getsockname(param->ctrlsock, (struct sockaddr *)¶m->sinc, &sasize)){RETURN(824);} + param->sinc.sin_port = 0; + if(so._bind(clidatasock, (struct sockaddr *)¶m->sinc, sasize)){RETURN(822);} if (pasv) { - if(so._getsockname(param->ctrlsock, (struct sockaddr *)¶m->sinc, &sasize)){RETURN(824);} - param->sinc.sin_port = 0; - if(so._bind(clidatasock, (struct sockaddr *)¶m->sinc, sasize)){RETURN(822);} if(so._listen(clidatasock, 1)) {RETURN(823);} if(so._getsockname(clidatasock, (struct sockaddr *)¶m->sinc, &sasize)){RETURN(824);} sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n", @@ -137,7 +135,6 @@ void * ftpprchild(struct clientparam* param) { (unsigned)(((unsigned char *)(¶m->sinc.sin_port))[0]), (unsigned)(((unsigned char *)(¶m->sinc.sin_port))[1]) ); -param->srv->logfunc(param,buf); } else { unsigned long b1, b2, b3, b4;