mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
librpc/ndr: Unimplement DRSUAPI_COMPRESSION_TYPE_XPRESS and rename
DRSUAPI_COMPRESSION_TYPE_XPRESS is not MS-XCA nor is it implemented by lzexpress_compress(), so disconnect from that algorithm. This avoids someone fixing lzxpress_compress() to work for DRSUAPI and breaking claims support. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
1dedffab8b
commit
937bf4b836
@ -790,28 +790,28 @@ interface drsuapi
|
|||||||
uint32 decompressed_length;
|
uint32 decompressed_length;
|
||||||
uint32 compressed_length;
|
uint32 compressed_length;
|
||||||
[subcontext(4),subcontext_size(compressed_length),
|
[subcontext(4),subcontext_size(compressed_length),
|
||||||
compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
|
compression(NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2,compressed_length,decompressed_length)]
|
||||||
drsuapi_DsGetNCChangesCtr1TS *ts;
|
drsuapi_DsGetNCChangesCtr1TS *ts;
|
||||||
} drsuapi_DsGetNCChangesXPRESSCtr1;
|
} drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1;
|
||||||
|
|
||||||
typedef [nopush] struct {
|
typedef [nopush] struct {
|
||||||
uint32 decompressed_length;
|
uint32 decompressed_length;
|
||||||
uint32 compressed_length;
|
uint32 compressed_length;
|
||||||
[subcontext(4),subcontext_size(compressed_length),
|
[subcontext(4),subcontext_size(compressed_length),
|
||||||
compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
|
compression(NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2,compressed_length,decompressed_length)]
|
||||||
drsuapi_DsGetNCChangesCtr6TS *ts;
|
drsuapi_DsGetNCChangesCtr6TS *ts;
|
||||||
} drsuapi_DsGetNCChangesXPRESSCtr6;
|
} drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6;
|
||||||
|
|
||||||
typedef [enum16bit] enum {
|
typedef [enum16bit] enum {
|
||||||
DRSUAPI_COMPRESSION_TYPE_MSZIP = 2,
|
DRSUAPI_COMPRESSION_TYPE_MSZIP = 2,
|
||||||
DRSUAPI_COMPRESSION_TYPE_XPRESS = 3
|
DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2 = 3 /* CompressOrDecompressWin2k3 DRS_COMP_ALG_WIN2K3 */
|
||||||
} drsuapi_DsGetNCChangesCompressionType;
|
} drsuapi_DsGetNCChangesCompressionType;
|
||||||
|
|
||||||
typedef [nodiscriminant,flag(NDR_PAHEX)] union {
|
typedef [nodiscriminant,flag(NDR_PAHEX)] union {
|
||||||
[case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
|
[case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
|
||||||
[case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr6 mszip6;
|
[case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr6 mszip6;
|
||||||
[case(1|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr1 xpress1;
|
[case(1|(DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2<<16))] drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1 xpress1;
|
||||||
[case(6|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr6 xpress6;
|
[case(6|(DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2<<16))] drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6 xpress6;
|
||||||
} drsuapi_DsGetNCChangesCompressedCtr;
|
} drsuapi_DsGetNCChangesCompressedCtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -292,7 +292,8 @@ enum ndr_err_code {
|
|||||||
enum ndr_compression_alg {
|
enum ndr_compression_alg {
|
||||||
NDR_COMPRESSION_MSZIP_CAB = 1,
|
NDR_COMPRESSION_MSZIP_CAB = 1,
|
||||||
NDR_COMPRESSION_MSZIP = 2,
|
NDR_COMPRESSION_MSZIP = 2,
|
||||||
NDR_COMPRESSION_XPRESS = 3
|
NDR_COMPRESSION_XPRESS = 3,
|
||||||
|
NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2 = 4, /* Unimplemented */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -291,7 +291,7 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr,
|
|||||||
return NDR_ERR_SUCCESS;
|
return NDR_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r)
|
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1 *r)
|
||||||
{
|
{
|
||||||
if (ndr_flags & NDR_SCALARS) {
|
if (ndr_flags & NDR_SCALARS) {
|
||||||
uint32_t decompressed_length = 0;
|
uint32_t decompressed_length = 0;
|
||||||
@ -302,10 +302,10 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr
|
|||||||
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
||||||
{
|
{
|
||||||
struct ndr_push *_ndr_ts_compressed;
|
struct ndr_push *_ndr_ts_compressed;
|
||||||
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
||||||
decompressed_length = _ndr_ts_compressed->offset;
|
decompressed_length = _ndr_ts_compressed->offset;
|
||||||
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
}
|
}
|
||||||
compressed_length = _ndr_ts->offset;
|
compressed_length = _ndr_ts->offset;
|
||||||
talloc_free(_ndr_ts);
|
talloc_free(_ndr_ts);
|
||||||
@ -323,9 +323,9 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr
|
|||||||
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
||||||
{
|
{
|
||||||
struct ndr_push *_ndr_ts_compressed;
|
struct ndr_push *_ndr_ts_compressed;
|
||||||
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
||||||
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
}
|
}
|
||||||
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
|
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr
|
|||||||
return NDR_ERR_SUCCESS;
|
return NDR_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r)
|
enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6 *r)
|
||||||
{
|
{
|
||||||
if (ndr_flags & NDR_SCALARS) {
|
if (ndr_flags & NDR_SCALARS) {
|
||||||
uint32_t decompressed_length = 0;
|
uint32_t decompressed_length = 0;
|
||||||
@ -345,10 +345,10 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr
|
|||||||
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
||||||
{
|
{
|
||||||
struct ndr_push *_ndr_ts_compressed;
|
struct ndr_push *_ndr_ts_compressed;
|
||||||
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
||||||
decompressed_length = _ndr_ts_compressed->offset;
|
decompressed_length = _ndr_ts_compressed->offset;
|
||||||
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
}
|
}
|
||||||
compressed_length = _ndr_ts->offset;
|
compressed_length = _ndr_ts->offset;
|
||||||
talloc_free(_ndr_ts);
|
talloc_free(_ndr_ts);
|
||||||
@ -366,9 +366,9 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr
|
|||||||
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
|
||||||
{
|
{
|
||||||
struct ndr_push *_ndr_ts_compressed;
|
struct ndr_push *_ndr_ts_compressed;
|
||||||
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
|
||||||
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, -1));
|
NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2, -1));
|
||||||
}
|
}
|
||||||
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
|
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ dump OK
|
|||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
def test_ndrdump_fuzzed_ndr_compression(self):
|
def test_ndrdump_fuzzed_ndr_compression(self):
|
||||||
expected = 'pull returned Buffer Size Error'
|
expected = 'ndr_pull_compression_start: ndr_pull_error\(Compression Error\): Bad compression algorithm 4 \(PULL\)'
|
||||||
command = (
|
command = (
|
||||||
"ndrdump --debug-stdout drsuapi 3 out --base64-input "
|
"ndrdump --debug-stdout drsuapi 3 out --base64-input "
|
||||||
"--input BwAAAAcAAAAGAAAAAwAgICAgICAJAAAAICAgIAkAAAAgIAAA//////8=")
|
"--input BwAAAAcAAAAGAAAAAwAgICAgICAJAAAAICAgIAkAAAAgIAAA//////8=")
|
||||||
@ -535,7 +535,7 @@ dump OK
|
|||||||
self.fail(e)
|
self.fail(e)
|
||||||
# check_output will return bytes
|
# check_output will return bytes
|
||||||
# convert expected to bytes for python 3
|
# convert expected to bytes for python 3
|
||||||
self.assertRegex(actual.decode('utf8'), expected + '$')
|
self.assertRegex(actual.decode('utf8'), expected)
|
||||||
|
|
||||||
def test_ndrdump_short_dnsProperty(self):
|
def test_ndrdump_short_dnsProperty(self):
|
||||||
expected = b'''pull returned Success
|
expected = b'''pull returned Success
|
||||||
|
@ -522,7 +522,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
|
|||||||
ctr6 = &ctr.ctr7.ctr.mszip6.ts->ctr6;
|
ctr6 = &ctr.ctr7.ctr.mszip6.ts->ctr6;
|
||||||
} else if (level_out == 7
|
} else if (level_out == 7
|
||||||
&& ctr.ctr7.level == 6
|
&& ctr.ctr7.level == 6
|
||||||
&& ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
|
&& ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2
|
||||||
&& ctr.ctr7.ctr.xpress6.ts) {
|
&& ctr.ctr7.ctr.xpress6.ts) {
|
||||||
out_level = 6;
|
out_level = 6;
|
||||||
ctr6 = &ctr.ctr7.ctr.xpress6.ts->ctr6;
|
ctr6 = &ctr.ctr7.ctr.xpress6.ts->ctr6;
|
||||||
|
@ -642,7 +642,7 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
|
|||||||
ctr6 = &ctr.ctr7.ctr.mszip6.ts->ctr6;
|
ctr6 = &ctr.ctr7.ctr.mszip6.ts->ctr6;
|
||||||
} else if (level_out == 7
|
} else if (level_out == 7
|
||||||
&& ctr.ctr7.level == 6
|
&& ctr.ctr7.level == 6
|
||||||
&& ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
|
&& ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2
|
||||||
&& ctr.ctr7.ctr.xpress6.ts) {
|
&& ctr.ctr7.ctr.xpress6.ts) {
|
||||||
out_level = 6;
|
out_level = 6;
|
||||||
ctr6 = &ctr.ctr7.ctr.xpress6.ts->ctr6;
|
ctr6 = &ctr.ctr7.ctr.xpress6.ts->ctr6;
|
||||||
|
@ -724,7 +724,7 @@ static void dreplsrv_op_pull_source_get_changes_done(struct tevent_req *subreq)
|
|||||||
ctr6 = &r->out.ctr->ctr7.ctr.mszip6.ts->ctr6;
|
ctr6 = &r->out.ctr->ctr7.ctr.mszip6.ts->ctr6;
|
||||||
} else if (*r->out.level_out == 7 &&
|
} else if (*r->out.level_out == 7 &&
|
||||||
r->out.ctr->ctr7.level == 6 &&
|
r->out.ctr->ctr7.level == 6 &&
|
||||||
r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS &&
|
r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2 &&
|
||||||
r->out.ctr->ctr7.ctr.xpress6.ts) {
|
r->out.ctr->ctr7.ctr.xpress6.ts) {
|
||||||
ctr_level = 6;
|
ctr_level = 6;
|
||||||
ctr6 = &r->out.ctr->ctr7.ctr.xpress6.ts->ctr6;
|
ctr6 = &r->out.ctr->ctr7.ctr.xpress6.ts->ctr6;
|
||||||
|
@ -2725,7 +2725,7 @@ static WERROR becomeDC_drsuapi_pull_partition_recv(struct libnet_BecomeDC_state
|
|||||||
ctr6 = &r->out.ctr->ctr7.ctr.mszip6.ts->ctr6;
|
ctr6 = &r->out.ctr->ctr7.ctr.mszip6.ts->ctr6;
|
||||||
} else if (*r->out.level_out == 7 &&
|
} else if (*r->out.level_out == 7 &&
|
||||||
r->out.ctr->ctr7.level == 6 &&
|
r->out.ctr->ctr7.level == 6 &&
|
||||||
r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS &&
|
r->out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2 &&
|
||||||
r->out.ctr->ctr7.ctr.xpress6.ts) {
|
r->out.ctr->ctr7.ctr.xpress6.ts) {
|
||||||
ctr_level = 6;
|
ctr_level = 6;
|
||||||
ctr6 = &r->out.ctr->ctr7.ctr.xpress6.ts->ctr6;
|
ctr6 = &r->out.ctr->ctr7.ctr.xpress6.ts->ctr6;
|
||||||
|
@ -859,7 +859,7 @@ static bool test_GetNCChanges(struct torture_context *tctx,
|
|||||||
ctr6 = &r.out.ctr->ctr7.ctr.mszip6.ts->ctr6;
|
ctr6 = &r.out.ctr->ctr7.ctr.mszip6.ts->ctr6;
|
||||||
} else if (ret == true && *r.out.level_out == 7
|
} else if (ret == true && *r.out.level_out == 7
|
||||||
&& r.out.ctr->ctr7.level == 6
|
&& r.out.ctr->ctr7.level == 6
|
||||||
&& r.out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
|
&& r.out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_WIN2K3_LZ77_DIRECT2
|
||||||
&& r.out.ctr->ctr7.ctr.xpress6.ts) {
|
&& r.out.ctr->ctr7.ctr.xpress6.ts) {
|
||||||
out_level = 6;
|
out_level = 6;
|
||||||
ctr6 = &r.out.ctr->ctr7.ctr.xpress6.ts->ctr6;
|
ctr6 = &r.out.ctr->ctr7.ctr.xpress6.ts->ctr6;
|
||||||
|
Loading…
Reference in New Issue
Block a user