3.2.5.1.1.2 Decompressing the Message

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

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

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

    • If the size of the message received from the server 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 CompressionAlgorithm in 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 client MUST decompress the data starting at the offset of CompressionAlgorithm field as specified in section 3.1.5.3. Otherwise, the client MUST decompress the data specified at the Offset using the algorithm in CompressionAlgorithm field.

    • The client MUST disconnect the connection as specified in section 3.2.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 header of the decompressed message is not equal to 0x424D53FE.

Otherwise, the client MUST disconnect the connection as specified in section 3.2.7.1.