diff --git a/lib/srv/desktop/tdp/proto.go b/lib/srv/desktop/tdp/proto.go index 9a7f6d94bb7e6..ede0d6d979e51 100644 --- a/lib/srv/desktop/tdp/proto.go +++ b/lib/srv/desktop/tdp/proto.go @@ -667,6 +667,8 @@ type SharedDirectoryAnnounce struct { func (s SharedDirectoryAnnounce) Encode() ([]byte, error) { buf := new(bytes.Buffer) buf.WriteByte(byte(TypeSharedDirectoryAnnounce)) + // TODO(isaiah): The discard here allows fuzz tests to succeed, it should eventually be done away with. + writeUint32(buf, 0) // discard writeUint32(buf, s.DirectoryID) if err := encodeString(buf, s.Name); err != nil { return nil, trace.Wrap(err) @@ -675,8 +677,16 @@ func (s SharedDirectoryAnnounce) Encode() ([]byte, error) { } func decodeSharedDirectoryAnnounce(in io.Reader) (SharedDirectoryAnnounce, error) { + // TODO(isaiah): The discard here is a copy-paste error, but we need to keep it + // for now in order that the proxy stay compatible with previous versions of the wds. + var discard uint32 + err := binary.Read(in, binary.BigEndian, &discard) + if err != nil { + return SharedDirectoryAnnounce{}, trace.Wrap(err) + } + var directoryID uint32 - err := binary.Read(in, binary.BigEndian, &directoryID) + err = binary.Read(in, binary.BigEndian, &directoryID) if err != nil { return SharedDirectoryAnnounce{}, trace.Wrap(err) } diff --git a/web/packages/teleport/src/lib/tdp/client.ts b/web/packages/teleport/src/lib/tdp/client.ts index f736f6ec66595..fd59ba4b5337b 100644 --- a/web/packages/teleport/src/lib/tdp/client.ts +++ b/web/packages/teleport/src/lib/tdp/client.ts @@ -513,7 +513,7 @@ export default class Client extends EventEmitterWebAuthnSender { name = this.sdManager.getName(); this.send( this.codec.encodeSharedDirectoryAnnounce({ - completionId: 0, // This is always the first request. + discard: 0, // This is always the first request. // Hardcode directoryId for now since we only support sharing 1 directory. // We're using 2 because the smartcard device is hardcoded to 1 in the backend. directoryId: 2, diff --git a/web/packages/teleport/src/lib/tdp/codec.ts b/web/packages/teleport/src/lib/tdp/codec.ts index cd3137ea7fff9..bc55d7b9ca1fe 100644 --- a/web/packages/teleport/src/lib/tdp/codec.ts +++ b/web/packages/teleport/src/lib/tdp/codec.ts @@ -132,8 +132,10 @@ export type MfaJson = { }; // | message type (11) | completion_id uint32 | directory_id uint32 | name_length uint32 | name []byte | +// TODO(isaiah): The discard here is a copy-paste error, but we need to keep it +// for now in order that the proxy stay compatible with previous versions of the wds. export type SharedDirectoryAnnounce = { - completionId: number; + discard: number; directoryId: number; name: string; }; @@ -601,7 +603,9 @@ export default class Codec { let offset = 0; view.setUint8(offset++, MessageType.SHARED_DIRECTORY_ANNOUNCE); - view.setUint32(offset, sharedDirAnnounce.completionId); + // TODO(isaiah): The discard here is a copy-paste error, but we need to keep it + // for now in order that the proxy stay compatible with previous versions of the wds. + view.setUint32(offset, sharedDirAnnounce.discard); offset += uint32Length; view.setUint32(offset, sharedDirAnnounce.directoryId); offset += uint32Length;