3.3.5.2.1.2 Decompressing the Message

This section is applicable only for the SMB 3.1.1 dialect.<257>

If IsCompressionSupported is TRUE and Connection.CompressionIds is not empty, the server MUST perform the following:

  • The server MUST disconnect the connection as specified in section 3.3.7.1 if any of the following conditions are satisfied:

    • If the size of the message received from the client is less than the size of SMB2 COMPRESSION_TRANSFORM_HEADER, specified in section 2.2.42.

    • If Flags field in SMB2 COMPRESSION_TRANSFORM_HEADER is equal to SMB2_COMPRESSION_FLAG_NONE and Connection.CompressionIds does not contain the CompressionAlgorithm field in the SMB2_COMPRESSION_TRANSFORM_HEADER_UNCHAINED.

    • If Flags field in SMB2 COMPRESSION_TRANSFORM_HEADER is equal to SMB2_COMPRESSION_FLAG_CHAINED and CompressionAlgorithm in any of the SMB2_COMPRESSION_CHAINED_PAYLOAD_HEADER structures in the chain is neither NONE nor one of the identifiers in Connection.CompressionIds.

    • If OriginalCompressedSegmentSize in the SMB2 COMPRESSION_TRANSFORM_HEADER is greater than the sum of (256, the size of SMB2 COMPRESSION_TRANSFORM_HEADER, largest of (Connection.MaxReadSize, Connection.MaxWriteSize, and Connection.MaxTransactSize)).

  • If Connection.SupportsChainedCompression is TRUE and SMB2_COMPRESSION_FLAG_CHAINED is set in the SMB2 COMPRESSION_TRANSFORM_HEADER, the server MUST decompress the data starting at the offset of CompressionAlgorithm field as specified in section 3.1.5.3. Otherwise, the server MUST decompress the data specified at Offset using the algorithm in CompressionAlgorithm field.

  • The server MUST disconnect the connection as specified in section 3.3.7.1 if any of the following conditions are satisfied:

    • If decompression fails.

    • If the size of the decompressed data is not equal to OriginalCompressedSegmentSize.

    • If the ProtocolId in the decompressed message is not equal to 0x424D53FE.

Otherwise the server MUST disconnect the connection as specified in section 3.3.7.1.