Delay FEAT command until after Login - fixes #200
Some servers require the user to be logged in to run FEAT ftp://serverftp:2121: Connecting to FTP server FTP Rx: "220 DrFTPD+ 2.0 (+STABLE+) $Revision: 1949 $ http://drftpd.org" FTP Tx: "AUTH TLS" FTP Rx: "234 AUTH TLS successful" FTP Tx: "FEAT" FTP Rx: "530 Not logged in."
This commit is contained in:
parent
39e3779af0
commit
9f5200151c
19
ftp.go
19
ftp.go
@ -135,16 +135,6 @@ func Dial(addr string, options ...DialOption) (*ServerConn, error) {
|
|||||||
c.conn = textproto.NewConn(do.wrapConn(tconn))
|
c.conn = textproto.NewConn(do.wrapConn(tconn))
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.feat()
|
|
||||||
if err != nil {
|
|
||||||
c.Quit()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, mlstSupported := c.features["MLST"]; mlstSupported {
|
|
||||||
c.mlstSupported = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,6 +272,15 @@ func (c *ServerConn) Login(user, password string) error {
|
|||||||
return errors.New(message)
|
return errors.New(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Probe features
|
||||||
|
err = c.feat()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, mlstSupported := c.features["MLST"]; mlstSupported {
|
||||||
|
c.mlstSupported = true
|
||||||
|
}
|
||||||
|
|
||||||
// Switch to binary mode
|
// Switch to binary mode
|
||||||
if _, _, err = c.cmd(StatusCommandOK, "TYPE I"); err != nil {
|
if _, _, err = c.cmd(StatusCommandOK, "TYPE I"); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user