add post connect hook

Fixes #144
This commit is contained in:
Nicola Murino
2020-07-30 22:33:49 +02:00
parent 59a21158a6
commit 22338ed478
10 changed files with 297 additions and 41 deletions

View File

@@ -92,6 +92,9 @@ func (s *Server) GetSettings() (*ftpserver.Settings, error) {
// ClientConnected is called to send the very first welcome message
func (s *Server) ClientConnected(cc ftpserver.ClientContext) (string, error) {
if err := common.Config.ExecutePostConnectHook(cc.RemoteAddr(), common.ProtocolFTP); err != nil {
return common.ErrConnectionDenied.Error(), err
}
connID := fmt.Sprintf("%v", cc.ID())
user := dataprovider.User{}
connection := &Connection{