mirage / awa-ssh

Purely functional SSH library in ocaml.
ISC License
104 stars 12 forks source link

Client, accept stderr passed via channel extended data #43

Closed art-w closed 2 years ago

art-w commented 2 years ago

When executing shell commands, the ssh server can send stderr via the extended data channel:

https://github.com/mirage/awa-ssh/blob/d85a95c90a6ef7816c8bc093742fb841ea176680/docs/rfc4254.txt#L412-L432

But currently, the awa client fails with an "unexpected state and message" since it doesn't expect any Msg_channel_extended_data. Note that this PR only handles the SSH_EXTENDED_DATA_STDERR=1 case as I'm not aware of other extensions, but perhaps it should return a generic `Channel_extended_data (id, data_type_code, data) and leave the user to interpret the meaning of data_type_code?

hannesm commented 2 years ago

Looks fine to me, thanks. The "generic" version (and allowing the client to send such data) can be implemented at a later point, if it is needed. I can as well only find usage of type 1 (standard error), the rest seems to be reserved for private use.