hierarchical memory in PIDL generated code

Stefan (metze) Metzmacher metze at samba.org
Wed Aug 17 07:45:13 GMT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi tridge, jelmer,

yesterday I hit a problem, with the memory handling in the PIDL generated code,
with my ntacl-lsm code and today I hit the same problem, with brad's libnet_join
code.

the problem it that we allocate every memory chunk under the toplevel
struct ndr_<pull|push> *ndr pointer.

and as structures like dom_sid contain buffer inside of them
(or more complex stuff like security_descriptor or security_token)

a talloc_steal(my_mem_cty, r->out.domain_sid) can't work, as
r->out.domain_sid->sub_auth is not a child of r->out.domain_sid

and if the ndr context is free'd you got a segv when you try to derefrence domain_sid->sub_auth.

any ideas, how to solve that?

maybe we could add a TALLOC_CTX *mem_ctx to each pidl generated pull function,
and use this, instead of always use the ndr context

Comments?

- --
metze

Stefan Metzmacher <metze at samba.org> www.samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDAurHm70gjA5TCD8RArv+AJ0aCrzwM/fCv1Xey/ReVvWBuRunNgCdFdcQ
qO+6nNTTY4n/rvy0DQTlxBY=
=J/j5
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list