FTPD: make sure that the passive ip, if provided, is valid

The server will refuse to start if the provided passive ip is not a
valid IPv4 address.

Fixes #376
This commit is contained in:
Nicola Murino
2021-04-16 15:08:10 +02:00
parent 683ba6cd5b
commit 124c471a2b
5 changed files with 46 additions and 1 deletions

View File

@@ -83,6 +83,9 @@ func (s *Server) cleanTLSConnVerification(id uint32) {
// GetSettings returns FTP server settings
func (s *Server) GetSettings() (*ftpserver.Settings, error) {
if err := s.binding.checkPassiveIP(); err != nil {
return nil, err
}
var portRange *ftpserver.PortRange
if s.config.PassivePortRange.Start > 0 && s.config.PassivePortRange.End > s.config.PassivePortRange.Start {
portRange = &ftpserver.PortRange{