[Zope] specify passive ports for ftp
Brad Clements
bkc@murkworks.com
Fri, 8 Feb 2002 15:19:55 -0500
On 7 Feb 2002 at 23:37, ra@burningman.com wrote:
> Actually, I'd be interested in even hearing ways to solve this problem that
> DO involve modifying the source code... I dug into the FTPServer.py code a
> while back to try to tackle this very problem and didn't see where the
> ports were being specified. Unfortunately, other matters became a bit more
> pressing. I'd be willing to hack up a way to set the passive ftp ports if
> someone would orient me a bit...
I changed the code in one of my servers to specify the pasv port range.. Now I can't
remember which instance I changed, or where it was in the code.
It wasn't hard, if that's any help.
You need to change ZServer/medusa/ftp_server.py
class passive_acceptor (asyncore.dispatcher):
ready = None
def __init__ (self, control_channel):
# connect_fun (conn, addr)
asyncore.dispatcher.__init__ (self)
self.control_channel = control_channel
self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
# bind to an address on the interface that the
# control connection is coming from.
self.bind ((
self.control_channel.getsockname()[0],
0
))
self.addr = self.getsockname()
self.listen (1)
As I recall, I put a range loop to try the self.bind over a range of non-privilaged ports. I
use a range in case a port is in use.
Brad Clements, bkc@murkworks.com (315)268-1000
http://www.murkworks.com (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com AOL-IM: BKClements