Article delegate-en/102 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A101@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: Proxy FTP
22 Sep 1998 15:27:06 GMT ysato@etl.go.jp (Yutaka Sato 佐藤豊)


Hi Piero,

In message <_A101@delegate-en.ML_>
on 09/22/98(21:48:23)
you "Piero Berritta" <plqaabdyi-jfjnzgnpvonr.ml@ml.delegate.org> wrote:
 |the problem I issued in my previous mail is present only in Windows NT
 |system, but not in Linux systems (and in generally in Unix systems, I
 |think).
 |Moreover, it generates only when sslway is active beteewn the client and the
 |proxy server, and not when there is a clear connection.

Thank you for your helpful information.  I think I understand
the problem.

In message <_A98@delegate-en.ML_>
on 09/19/98(01:38:49)
you "Piero Berritta" <plqaabdyi-jfjnzgnpvonr.ml@ml.delegate.org> wrote:
 |>09/18 18:09:00.65 [199] 3+0: ## viaCFI [INIT]: fileno(ts)=18 ToSX=19
 |>09/18 18:09:00.66 [199] 3+0: --- I'm clientWithXDC
 |>09/18 18:09:29.19 [199] 3+0/2: PORT [192,168,111,50,6,112] >> 200 PORT
 |command successful [translated to PASV by DeleGate].^M
 |>09/18 18:09:29.21 [199] 3+0/3: FTP-CACHE: LIST [] = [][]:0
 |>09/18 18:09:29.21 [199] 3+0/3: ---- XDC data_relay CLIENT (RECV).
 |>09/18 18:09:29.23 [199] 3+0/3: mkclnt_sock: connection refused
 |127.0.0.1:1423->calabrone.fst.it/192.168.111.50:1648
  ^^^^^^^^^
Basically, the problem will be solved by replacing
    makeDataConn(port,fileno(fc));
with
    makeDataConn(port,ClientSock);
because the second parameter is passed to be used as the source
port address of data connection to be created, but it is the
filedescriptor of PIPE when external-filter is inserted ...

I enclosed a patch which will solve three problems:
 - data connection problem of client-side external filter on Win32
 - SIGSEGV caused on cache write on Linux
 - relaying one-time password for FTP server on WinNT

Cheers,
Yutaka
--
Yutaka Sato <ysato@etl.go.jp> http://www.etl.go.jp/~ysato/   @ @ 
Computer Science Division, Electrotechnical Laboratory      ( - )
1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan            _<   >_


*** ../dist/delegate5.6.8/src/ftp.c	Thu Sep 17 17:28:34 1998
--- ftp.c	Tue Sep 22 23:56:02 1998
***************
*** 1445,1451 ****
  	fflush(tc);
  	return xc;
  }
! static XDCrelayClnt(STOR,ts,fs,tc,fc, cachefp,resp,rsize)
  	FILE *ts,*fs,*tc,*fc;
  	FILE *cachefp;
  	char *resp;
--- 1445,1452 ----
  	fflush(tc);
  	return xc;
  }
! static XDCrelayClnt(Conn,STOR,ts,fs,tc,fc, cachefp,resp,rsize)
! 	Connection *Conn;
  	FILE *ts,*fs,*tc,*fc;
  	FILE *cachefp;
  	char *resp;
***************
*** 1464,1470 ****
  	}
  
  	Verbose("XDC %s",resp);
! 	dsock = makeDataConn(port,fileno(fc));
  
  	if( STOR ){
  		dfp = fdopen(dsock,"r");
--- 1465,1471 ----
  	}
  
  	Verbose("XDC %s",resp);
! 	dsock = makeDataConn(port,ClientSock);
  
  	if( STOR ){
  		dfp = fdopen(dsock,"r");
***************
*** 1581,1587 ****
  			cachefp,resp,rsize);
  		close(dsock);
  	}else{
! 		csock = makeDataConn(port,fileno(fc));
  		if( STOR )
  			xc = FTP_data_relay(Conn,csock,dsock,cachefp,STOR);
  		else	xc = FTP_data_relay(Conn,dsock,csock,cachefp,STOR);
--- 1582,1588 ----
  			cachefp,resp,rsize);
  		close(dsock);
  	}else{
! 		csock = makeDataConn(port,ClientSock);
  		if( STOR )
  			xc = FTP_data_relay(Conn,csock,dsock,cachefp,STOR);
  		else	xc = FTP_data_relay(Conn,dsock,csock,cachefp,STOR);
***************
*** 1778,1784 ****
  	fputs(statresp,cachefp);
  	fflush(cachefp);
  	cache_done(1,cachefp,cpath,xcpath);
- 	fclose(cachefp);
  }
  
  static relay_data(FS,Conn,ts,fs,tc,fc,com,arg,err,resp,rsize)
--- 1779,1784 ----
***************
*** 1826,1832 ****
  	resp[0] = 0;
  
  	if( clientWithXDC && psvsock < 0 ){
! 		xc = XDCrelayClnt(STOR,ts,fs,tc,fc,
  			cachefp,resp,rsize);
  	}else
  	if( PASVforPORT && 0 <= psvsock && modeXDC ){
--- 1826,1832 ----
  	resp[0] = 0;
  
  	if( clientWithXDC && psvsock < 0 ){
! 		xc = XDCrelayClnt(Conn,STOR,ts,fs,tc,fc,
  			cachefp,resp,rsize);
  	}else
  	if( PASVforPORT && 0 <= psvsock && modeXDC ){
***************
*** 1850,1856 ****
  	}else
  	if( 0 <= psvsock ){
  		if( PASVforPORT ){
! 			psock = makeDataConn(dport,fileno(fc));
  			Verbose("PASVforPORT: [%d][%d]\n",psvsock,psock);
  			PASVforPORT = 0;
  		}else{
--- 1850,1856 ----
  	}else
  	if( 0 <= psvsock ){
  		if( PASVforPORT ){
! 			psock = makeDataConn(dport,ClientSock);
  			Verbose("PASVforPORT: [%d][%d]\n",psvsock,psock);
  			PASVforPORT = 0;
  		}else{
***************
*** 1886,1892 ****
  		OK = atoi(resp) == 226 && file_size(fileno(cachefp)) == xc;
  		cache_done(OK,cachefp,cachepath,xcachepath);
  		sv1log("FTP-CACHE: written=%d %d bytes [%s]\n",OK,xc,cachepath);
- 		fclose(cachefp);
  	}
  	if( FS->fs_cstat == NULL )
  		FS->fs_cstat = "W";
--- 1886,1891 ----
***************
*** 2270,2275 ****
--- 2269,2275 ----
  		strcpy(FS->fs_TYPE,PFC->fc_type);
  	}
  
+ if(PFC->fc_pass[0])
  	setLoginPWD(FS,ts,fs);
  	return 0;
  ERROR:
***************
*** 2489,2495 ****
  	}
  	if( PFC ){
  		char *RESP;
! 		char retrresp[2048];
  
  		FS->fs_imProxy = 1;
  		if( proxyLogin(Conn,FS,PFC,xuser,resp,sizeof(resp),ts,fs) < 0 ){
--- 2489,2495 ----
  	}
  	if( PFC ){
  		char *RESP;
! 		char *retrresp = NULL;
  
  		FS->fs_imProxy = 1;
  		if( proxyLogin(Conn,FS,PFC,xuser,resp,sizeof(resp),ts,fs) < 0 ){
***************
*** 2502,2507 ****
--- 2502,2509 ----
  			}
  			goto PROXY_ERROR;
  		}
+ 		if( PFC->fc_pass[0] )
+ 			login_done = 1;
  
  		if( PFS && 0 <= PFS->fs_pclsock ){
  			FS->fs_pclsock = PFS->fs_pclsock;
***************
*** 2532,2538 ****
  			if( RETRCOMS(PFC->fc_swcom) )
  				goto PROXY_ERROR;
  			*/
! 			strcpy(retrresp,RESP);
  		}else
  		if( PFC->fc_path[0] ){
  			_put_get(MODE(FS),ts,fs,RESP,sizeof(resp),
--- 2534,2540 ----
  			if( RETRCOMS(PFC->fc_swcom) )
  				goto PROXY_ERROR;
  			*/
! 			retrresp = strdup(RESP);
  		}else
  		if( PFC->fc_path[0] ){
  			_put_get(MODE(FS),ts,fs,RESP,sizeof(resp),
***************
*** 2582,2587 ****
--- 2584,2591 ----
  				resp,sizeof(resp)) < 0 )
  					goto PROXY_ERROR;
  		}
+ 		if( retrresp )
+ 			free(retrresp);
  	}else{
  		Verbose("D_FTPHOPS (%d) %s\n",D_FTPHOPS,FS->fs_myhost);
  		fprintf(tc,"%s[PIPELINE] (%d) %s\r\n",
***************
*** 2672,2678 ****
  		if( strcaseeq(com,"CWD") && controlCWD(FS,tc,arg) )
  			continue;
  
! 		if( strcaseeq(com,"CWD") || strcaseeq(com,"PWD") )
  			if( FS->fs_logindir[0] == 0 )
  				if( reqQn == 0 )
  					setLoginPWD(FS,ts,fs);
--- 2676,2682 ----
  		if( strcaseeq(com,"CWD") && controlCWD(FS,tc,arg) )
  			continue;
  
! 		if( strcaseeq(com,"CWD") || strcaseeq(com,"PWD") || login_done )
  			if( FS->fs_logindir[0] == 0 )
  				if( reqQn == 0 )
  					setLoginPWD(FS,ts,fs);

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V