aftpd bug?

KURODA Hisao <[email protected]> 01 Nov 2004 15:33:47 +0900
Newsgroups gmane.lisp.open-source.franz
Message-ID <[email protected]>
Bug in aftpd?

Phenomenon:
 In passive mode, aftpd send same port number to client.
 In a situation described below, you can't get files from aftpd.
 1. login aftpd using ftp client and passive mode on.
 2. get any file and quick logout.
 3. re-login aftpd again quickly and get any file.
 4. result in failuer.

 From aftpd log in /var/log/ftp.
 Mon Nov 01 14:43:52 2004 [11216]: Error: creating a passive socket NIL resulted in error (code 48): Address already in use.

The cause of bug:
 After client makes connection to server in function stand-alone(),
aftpd calls function spawn-client, so that every sub-process has same
random seed.
 As you know, in passive mode aftpd send port number generated by
function random() to client, and the port number is always same.

Solution:
 In function cmd-pasv(), give (make-random-state t) as function
random()'s random-state argument to generate new random seed every
time it is called.