diff --git a/lib/srv/desktop/tdp/proto.go b/lib/srv/desktop/tdp/proto.go index fcef7c18772b4..9cb0b8a31e9e6 100644 --- a/lib/srv/desktop/tdp/proto.go +++ b/lib/srv/desktop/tdp/proto.go @@ -673,6 +673,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) @@ -681,8 +683,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 b92ee31af13d3..b7f446b3b42da 100644 --- a/web/packages/teleport/src/lib/tdp/client.ts +++ b/web/packages/teleport/src/lib/tdp/client.ts @@ -493,7 +493,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 d81f11d8d7ead..c78b4ea25f8bf 100644 --- a/web/packages/teleport/src/lib/tdp/codec.ts +++ b/web/packages/teleport/src/lib/tdp/codec.ts @@ -103,8 +103,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; }; @@ -572,7 +574,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;