1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

claims.idl: Be more lenient in our expectations for the compression of claims

384 bytes is not a strict threshold below which claims are never to be
compressed. Windows has been known to compress claims a mere 368 bytes
in size.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-08-25 11:04:32 +12:00 committed by Andrew Bartlett
parent 571ff5f314
commit ba1750082a
3 changed files with 7 additions and 4 deletions

View File

@ -27,7 +27,8 @@ interface claims
#define wchar_t uint16
#define CLAIM_ID [string, charset(UTF16)] wchar_t *
const int CLAIM_MINIMUM_BYTES_TO_COMPRESS = 384;
const int CLAIM_LOWER_COMPRESSION_THRESHOLD = 368;
const int CLAIM_UPPER_COMPRESSION_THRESHOLD = 384;
typedef enum {
CLAIM_TYPE_INT64 = 1,

View File

@ -26,7 +26,7 @@ enum ndr_compression_alg ndr_claims_compression_alg(enum CLAIMS_COMPRESSION_FORM
enum CLAIMS_COMPRESSION_FORMAT ndr_claims_actual_wire_compression_alg(enum CLAIMS_COMPRESSION_FORMAT specified_compression,
size_t uncompressed_claims_size) {
if (uncompressed_claims_size < CLAIM_MINIMUM_BYTES_TO_COMPRESS) {
if (uncompressed_claims_size < CLAIM_UPPER_COMPRESSION_THRESHOLD) {
return CLAIMS_COMPRESSION_FORMAT_NONE;
}

View File

@ -4585,13 +4585,15 @@ class RawKerberosTest(TestCase):
uncompressed_size = client_claims.uncompressed_claims_set_size
compression_format = client_claims.compression_format
if uncompressed_size < claims.CLAIM_MINIMUM_BYTES_TO_COMPRESS:
if uncompressed_size < (
claims.CLAIM_LOWER_COMPRESSION_THRESHOLD):
self.assertEqual(claims.CLAIMS_COMPRESSION_FORMAT_NONE,
compression_format,
f'{claims_type} unexpectedly '
f'compressed ({uncompressed_size} '
f'bytes uncompressed)')
else:
elif uncompressed_size >= (
claims.CLAIM_UPPER_COMPRESSION_THRESHOLD):
self.assertEqual(
claims.CLAIMS_COMPRESSION_FORMAT_XPRESS_HUFF,
compression_format,