AUTH-2159: Moves shutdownC close into error handling

AUTH-2161: Lowers size of preamble length
AUTH-2160: Fixes url parsing logic
This commit is contained in:
Michael Borkenstein
2019-10-16 10:53:46 -05:00
parent 95704b11fb
commit 8b6e3bc1d1
3 changed files with 15 additions and 9 deletions

View File

@@ -180,8 +180,12 @@ func sendSSHPreamble(stream net.Conn, destination, token string) error {
return err
}
if uint16(len(payload)) > ^uint16(0) {
return errors.New("ssh preamble payload too large")
}
sizeBytes := make([]byte, sshserver.SSHPreambleLength)
binary.BigEndian.PutUint32(sizeBytes, uint32(len(payload)))
binary.BigEndian.PutUint16(sizeBytes, uint16(len(payload)))
if _, err := stream.Write(sizeBytes); err != nil {
return err
}