Subject: [fwtk-users] ftp-pasv patch/fix

From: Richard van den Berg <[email-masked]>
Date: Fri, 05 Jul 2002 14:07:51 +0200

Just in the odd change that anyone cares.. I just created a patch to the
ftp-pasv.tgz set of patches. I modified the default behaviour of ftp-gw
so that PORT and PASV commands of the client are sent in the same mode
to the server. (A PASV command of the client will trigger a PASV to the
server, while a PORT of the client triggers a PORT to the server.)
This just seemed more transparant to me.

The "pasv: true" statement in the config file still means "always send
PASV to the server", and in addition "pasv: false" means "always send
PORT to the server" (the behaviour of the unpatched ftp-gw).

In addition, I fixed a small bug in connect_pasv() which made "pasv:
true" unusable on my system.

Enjoy,

-- 
Richard van den Berg, CISSP

Trust Factory B.V.      | http://www.trust-factory.com/
Bazarstraat 44a         | Phone: +31 70 3620684
NL-2518AK The Hague     | Fax  : +31 70 3603009
The Netherlands         |

*** ./ftp-gw.c.org	Fri Jul  5 11:22:26 2002
--- ./ftp-gw.c	Fri Jul  5 13:22:24 2002
***************
*** 151,157 ****
  	"response",	OP_AOK,				cmd_response,
  	"resp",		OP_AOK,				cmd_response,
  	"rein",		OP_CONN,			0,
! 	"pasv",		OP_CONN,			cmd_pasv,
  	"type",		OP_CONN,			0,
  	"stru",		OP_CONN,			0,
  	"mode",		OP_CONN,			0,
--- 151,157 ----
  	"response",	OP_AOK,				cmd_response,
  	"resp",		OP_AOK,				cmd_response,
  	"rein",		OP_CONN,			0,
! 	"pasv",		OP_CONN,			cmd_pasv_pasv,
  	"type",		OP_CONN,			0,
  	"stru",		OP_CONN,			0,
  	"mode",		OP_CONN,			0,
***************
*** 261,267 ****
  
  	if((cf = cfg_get("pasv",confp)) != (Cfg *)0) {
  		if (cf->argc < 1 || cf->argc > 2) {
! 			syslog(LLEV, "fwtkcfgerr: usage: pasv true [-portonly], line %d", cf->ln);
  			exit(1);
  		}
  		if (strcasecmp(cf->argv[0], "true") == 0) {
--- 261,267 ----
  
  	if((cf = cfg_get("pasv",confp)) != (Cfg *)0) {
  		if (cf->argc < 1 || cf->argc > 2) {
! 			syslog(LLEV, "fwtkcfgerr: usage: pasv true|false [-portonly], line %d", cf->ln);
  			exit(1);
  		}
  		if (strcasecmp(cf->argv[0], "true") == 0) {
***************
*** 270,275 ****
--- 270,281 ----
  				if(!strcasecmp("pasv",op->name)) op->op = cmd_pasv_pasv;
  			}
  		}
+ 		if (strcasecmp(cf->argv[0], "false") == 0) {
+ 			for(op = ops; op->name != (char *)0; op++) {
+ 				if(!strcasecmp("port",op->name)) op->op = cmd_port;
+ 				if(!strcasecmp("pasv",op->name)) op->op = cmd_pasv;
+ 			}
+ 		}
  		if (cf->argc == 2 && strcasecmp(cf->argv[1], "-portonly") == 0) {
  			port_only = 1;
  		}
***************
*** 2216,2219 ****
--- 2222,2227 ----
  
  	if(connect(outgoing,(struct sockaddr *)&srvport,sizeof(srvport)) < 0)
  		return(-1);
+ 
+ 	return(0);
  }

---
You are currently subscribed to fwtk-users as: [email-masked]
To unsubscribe send a blank email to [email-masked]