Просмотр исходного кода

Move FTP login prompt in proxy to common section

z3APA3A 10 лет назад
Родитель
Сommit
59cc68e8dd
2 измененных файлов с 9 добавлено и 8 удалено
  1. 8 7
      src/proxy.c
  2. 1 1
      src/version.h

+ 8 - 7
src/proxy.c

@@ -133,6 +133,7 @@ char * proxy_stringtable[] = {
 
 
 #define BUFSIZE 8192
 #define BUFSIZE 8192
 #define LINESIZE 4096
 #define LINESIZE 4096
+#define FTPBUFSIZE 1536
 
 
 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;
@@ -228,6 +229,8 @@ void * proxychild(struct clientparam* param) {
  int authenticate;
  int authenticate;
  struct pollfd fds[2];
  struct pollfd fds[2];
  SOCKET ftps;
  SOCKET ftps;
+ char ftpbuf[FTPBUFSIZE];
+ int inftpbuf = 0;
 #ifndef WITHMAIN
 #ifndef WITHMAIN
  FILTER_ACTION action;
  FILTER_ACTION action;
 #endif
 #endif
@@ -539,23 +542,17 @@ for(;;){
 #endif
 #endif
 
 
  if((res = (*param->srv->authfunc)(param))) {RETURN(res);}
  if((res = (*param->srv->authfunc)(param))) {RETURN(res);}
-#define FTPBUFSIZE 1536
 
 
  if(ftp && param->redirtype != R_HTTP){
  if(ftp && param->redirtype != R_HTTP){
 	SOCKET s;
 	SOCKET s;
 	int mode = 0;
 	int mode = 0;
 	int i=0;
 	int i=0;
-	char ftpbuf[FTPBUFSIZE];
-	int inftpbuf = 0;
 
 
+	inftpbuf = 0;
 	if(!ckeepalive){
 	if(!ckeepalive){
 		inftpbuf = FTPBUFSIZE - 20;
 		inftpbuf = FTPBUFSIZE - 20;
 		res = ftplogin(param, ftpbuf, &inftpbuf);
 		res = ftplogin(param, ftpbuf, &inftpbuf);
 		if(res){
 		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);
 			RETURN(res);
 		}
 		}
 	}
 	}
@@ -1052,6 +1049,10 @@ CLEANRET:
 	if(param->res == 10) {
 	if(param->res == 10) {
 		socksend(param->clisock, (unsigned char *)proxy_stringtable[2], (int)strlen(proxy_stringtable[2]), conf.timeouts[STRING_S]);
 		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)) {
 	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]);
 		socksend(param->clisock, (unsigned char *)proxy_stringtable[1], (int)strlen(proxy_stringtable[1]), conf.timeouts[STRING_S]);
 	}
 	}

+ 1 - 1
src/version.h

@@ -1,2 +1,2 @@
 #define VERSION "3proxy-0.8b-devel"
 #define VERSION "3proxy-0.8b-devel"
-#define BUILDDATE "150608002425"
+#define BUILDDATE "150831214516"