fix: using close channel when attempting to close session
All checks were successful
Docker Build and Push / build-and-push (push) Successful in 3m35s

This commit is contained in:
2025-07-21 16:36:05 +07:00
parent 0ada07400d
commit 4a25627ab5
3 changed files with 46 additions and 58 deletions

View File

@ -8,7 +8,7 @@ import (
)
func (s *Server) handleConnection(conn net.Conn) {
sshConn, chans, reqs, err := ssh.NewServerConn(conn, s.Config)
sshConn, chans, forwardingReqs, err := ssh.NewServerConn(conn, s.Config)
if err != nil {
log.Printf("failed to establish SSH connection: %v", err)
conn.Close()
@ -17,5 +17,9 @@ func (s *Server) handleConnection(conn net.Conn) {
log.Println("SSH connection established:", sshConn.User())
session.New(sshConn, chans, reqs)
newSession := session.New(sshConn, forwardingReqs)
for ch := range chans {
newSession.ChannelChan <- ch
}
return
}