Make SSH_FXP_STATUS "message" field optional.

Cisco SSH 2.0 server doesn't fill out the "message" field,
even though it returns valid status codes. This makes
File.Read method error out without actually reading the
file due to unmarshalStatus returning a "packet too short"
error.
This commit is contained in:
Andrew Kupasrimonkol 2016-06-23 15:35:20 -07:00 committed by John Eikenberry
parent b4b1d297a4
commit 59640f4fcc
2 changed files with 4 additions and 5 deletions

View File

@ -1094,10 +1094,7 @@ func unmarshalStatus(id uint32, data []byte) error {
return &unexpectedIDErr{id, sid}
}
code, data := unmarshalUint32(data)
msg, data, err := unmarshalStringSafe(data)
if err != nil {
return err
}
msg, data, _ := unmarshalStringSafe(data)
lang, _, _ := unmarshalStringSafe(data)
return &StatusError{
Code: code,

View File

@ -116,7 +116,9 @@ func TestUnmarshalStatus(t *testing.T) {
desc: "missing error message and language tag",
reqID: 1,
status: idCode,
want: errShortPacket,
want: &StatusError{
Code: ssh_FX_FAILURE,
},
},
{
desc: "missing language tag",