Skip to content

Commit

Permalink
Update to work with latest uuid lib changes
Browse files Browse the repository at this point in the history
  • Loading branch information
b1naryth1ef committed Jan 24, 2018
1 parent 0c78828 commit 7bab364
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ type SSHSession struct {
log *zap.Logger
}

func NewSSHSession(state *SSHDState, conn *ssh.ServerConn) *SSHSession {
id := uuid.NewV4()
func NewSSHSession(state *SSHDState, conn *ssh.ServerConn) (*SSHSession, error) {
id, err := uuid.NewV4()
if err != nil {
return nil, err
}

strID, _ := id.MarshalText()

Expand All @@ -71,7 +74,7 @@ func NewSSHSession(state *SSHDState, conn *ssh.ServerConn) *SSHSession {
Account: state.accounts[conn.User()],
Conn: conn,
log: state.log,
}
}, nil
}

func (s *SSHSession) handleChannels(chans <-chan ssh.NewChannel) {
Expand Down
7 changes: 6 additions & 1 deletion lib/sshd.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ func (s *SSHDState) handleNewConnection(tcpConn net.Conn, sshConfig *ssh.ServerC
}

// Open the SSH session for the connection, and track it in our sessions mapping
session := NewSSHSession(s, sshConn)
session, err := NewSSHSession(s, sshConn)
if err != nil {
s.log.Warn("Failed to create an SSH sessoin", zap.Error(err))
return
}

s.sessions[session.UUID] = session

s.log.Info(
Expand Down

0 comments on commit 7bab364

Please sign in to comment.