mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
r1269: Add a 'base' field to the ndr_ofs_list structure which is the base to
which the offset applies to. In an array of structures containing relative members, the offset applies to the start of the array element being marshalled. Previously, there was no way to access the relevant structure start as by the time we have hit buffers, the head of the offset list will be the last structure being marshalled. Interestingly enough, this makes relstrs go away. I think we thought they were a special case in samba 3 but it turns out they are just regular relative elements in the idl. This makes spoolss a lot simpler than I thought it would be. I've run the samr and lsa tests and this doesn't seem to break anything. It looks like security descriptors are the only structures that contain relative members. Oh yeah, this will probably require a 'make clean && make' otherwise you will get bizzare errors.
This commit is contained in:
parent
de5984c956
commit
d379dcdfd5
@ -27,6 +27,7 @@
|
||||
start of an encapsulating structure */
|
||||
struct ndr_ofs_list {
|
||||
uint32_t offset;
|
||||
uint32_t base;
|
||||
struct ndr_ofs_list *next;
|
||||
};
|
||||
|
||||
|
@ -608,6 +608,7 @@ NTSTATUS ndr_pull_struct_start(struct ndr_pull *ndr)
|
||||
NDR_ALLOC(ndr, ofs);
|
||||
ofs->offset = ndr->offset;
|
||||
ofs->next = ndr->ofs_list;
|
||||
ofs->base = 0;
|
||||
ndr->ofs_list = ofs;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -629,6 +630,7 @@ NTSTATUS ndr_push_struct_start(struct ndr_push *ndr)
|
||||
NDR_PUSH_ALLOC(ndr, ofs);
|
||||
ofs->offset = ndr->offset;
|
||||
ofs->next = ndr->ofs_list;
|
||||
ofs->base = 0;
|
||||
ndr->ofs_list = ofs;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -688,6 +690,7 @@ NTSTATUS ndr_push_relative(struct ndr_push *ndr, int ndr_flags, const void *p,
|
||||
NDR_PUSH_ALLOC(ndr, ofs);
|
||||
NDR_CHECK(ndr_push_align(ndr, 4));
|
||||
ofs->offset = ndr->offset;
|
||||
ofs->base = ndr->ofs_list->offset;
|
||||
NDR_CHECK(ndr_push_uint32(ndr, 0xFFFFFFFF));
|
||||
ofs->next = NULL;
|
||||
if (ndr->relative_list_end) {
|
||||
@ -713,7 +716,7 @@ NTSTATUS ndr_push_relative(struct ndr_push *ndr, int ndr_flags, const void *p,
|
||||
NDR_CHECK(ndr_push_align(ndr, 4));
|
||||
ndr_push_save(ndr, &save);
|
||||
ndr->offset = ofs->offset;
|
||||
NDR_CHECK(ndr_push_uint32(ndr, save.offset - ndr->ofs_list->offset));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, save.offset - ofs->base));
|
||||
ndr_push_restore(ndr, &save);
|
||||
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user