pickling / unpickling self-relative (was: Re: Quick question on IDL)

Luke Kenneth Casson Leighton lkcl at samba-tng.org
Tue Oct 16 14:01:04 GMT 2001


On Tue, Oct 16, 2001 at 01:56:39PM -0400, Tatsukawa, Seiichi wrote:
> > just took a look at it, compiled up the encoding example,
> > i notice that it sends the idl UUID at the beginning,
> > plus the idl version number etc.
> > 
> > here is an example that i wish to encode / decode.
> > 
> > note that it doesn't have an idl UUID at the front:
> > i can live with that, by faking up the UUID at the
> > front of the buffer, and doing anything else necessary.
> 
> idl_es_pvt_header_t is defined in sys_idl/idlddefs.h .
 
excellent!  thanks.  gives the length if nothing else.

> > the nasty bit about this example is the pointers.
> > note at offsets 0014 and 001c indicating self-relative
> > offsets to 0x20 and 0x29.
> 
> I think that I already answered this when you are looking at pickling
> Security Descriptors. The self-relative Security Descriptor is NOT
> NDR-encoded stream. 

having written a hand-marshalling/unmarshalling api,
prs_secdes.c, i am fairly confident that the self-relative
SD can be said to be "ms" NDR-encoded, as long as you
do these  "self-relative pointers"

the decision as to whether to treat a security descriptor
LPVOID* as self-relative or non-self-relative is taken
by checking the second set of 2 bytes: bit
SEC_DESC_SELF_RELATIVE (0x800).

if clear, i am hoping to unmarshall, if set, just
leave as-is.


> It can't be expressed by the IDL file. So, some
> structures probably need to be hand-un/marshalled.

i sincerely hope that it can, and want to 'ave a go at it.


> 
> P.S.
> Well, the layout of auth_verifier could be NDR-encoded by using the nested
> structures. (See "Algorithm for Deferral of Referents" in NDR spec., part of
> OpenGroup's "DCE 1.1: Remote Procedure Call " Spec.) However, if I remember
> correctly, OSF DCE IDL's NDR-encoder uses the sequentially incremented
> referent identifier (starting from 1). Since the referent identifier is an
> unsigned long integer (non-zero, uniquely defined within output NDR stream),
> you can replace it with the byte offset within the output stream.


rpc_ss_register_node() is the "key" point that generates a link
between referent identifiers and the on-wire structure.

what i am hoping to do is do as you suggest on a _second_ pass,
using rpc_ss_register_node() to record the necessary information:
the address of the byte offset in the output stream for every
referent identifier, and replace with byte offset, also recorded
in the node table.

luke




More information about the samba-technical mailing list