[PATCH] Explain a bit of how loadparm works

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Oct 16 03:03:32 MDT 2013


On Wed, Oct 16, 2013 at 10:50:22AM +0200, Volker Lendecke wrote:
> > Oops, apparently not right:
> > 
> > in lpcfg_gensec_settings(), a
> > settings->lp_ctx = talloc_reference(settings, lp_ctx);
> > is done...
> > 
> > We should really get rid of this!
> 
> And this is *EXACTLY* the reason why talloc_reference is so
> evil and needs to be die, die, die! You fell into the trap
> looking at the allocator, and somewhere completely distant
> your nice talloc hierarchy is destroyed.
> 
> Andrew, please remove the talloc_reference from the loadparm
> code as your next priority. Otherwise we will have to work
> on unmerging that again.

Andrew, just to give you some direction: I know that there's
good reasons for doing talloc_reference in the gensec area.
I also did use talloc_reference once, and this code still is
around: See tdb_wrap_open(). There I made sure that no
caller of this will be affected. So to avoid leaking the
talloc_reference consequences to all callers, you should
encapsulate the state that you have to share behind an API
and do the talloc_reference in a way that no caller will be
affected by it.

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list