talloc -- Eureka*
sam at liddicott.com
Tue Jul 28 10:44:52 MDT 2009
*I've got it
LIKELY(&it != NULL)
(Waits /very/ briefly for laughter and groans to die down).
The original problem I was trying to solve was that of saving country
bumpkins from having their talloc_reference's freed from behind their back.
It never occurred to me that there were city slickers who depend on that
sort of thing; but Samba4 seems full of it.
And yet we still have innocent simple country folk like me and Volker
who want to take a talloc_reference and keep it.
The answer is to have two kinds of talloc_reference call (for the time
Let the old talloc_reference remain, it returns references that will be
freed as per the dreadful current behaviour OR which cause tridges new
error if there is more than one of THIS TYPE of parent when talloc_free
Let there be a new talloc_safe_reference which marks the reference to
prevent talloc_free from considering it, and which is NOT counted with
tridges new test.
Those will be the symbol names in the talloc.so
Let us use #define so we can call talloc_new_reference as
talloc_reference() and call the old talloc_reference as
talloc_sinful_reference() or something.
Let us search and replace all uses of talloc_reference to become
Then we start the process of moving talloc_sinful_reference calls to
talloc_reference just as quickly as we feel like it.
Country bumpkins (like me) who aren't into painful surprises can use the
new talloc_reference (macro) quite safely as it maps to
The old Samba4 code can carry on it's merry way using
talloc_sinful_reference whose symbol is talloc_reference (for
Metze-friendly .so compatibilty).
As a final note, maybe some mem_ctx can set a flag indicating that
references that are made to that parent should be the non-sinful (or
I think that this way we can preserve the old samba4 semantics while
making safety and security available now for those who need it.
More information about the samba-technical