ldb_dn_copy(): should we take a talloc_reference?

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Feb 8 05:37:29 UTC 2018


On Thu, Feb 08, 2018 at 04:26:22PM +1300, Andrew Bartlett via samba-technical wrote:
> * On one hand, I would say that the answer is to make the struct ldb_dn
> take a talloc_reference() to the ldb and assign the element in
> ldb_dn_copy().  (We would then also need to take the reference in
> ldb_dn_new()).  On the other, I can hear the howls of protest already. 

Just very recently I've been in source4/nbt_server.c and libcli/nbt/.
This is old code doing significant amounts of talloc_reference. This
gave me significant amounts of grief. I do not claim I even remotely
understand what you're talking about, but "talloc_reference" is really
a trigger word for me, re-confirmed by very recent experience.

Just. Don't. Do. It.

Please find other ways to deal with your problem without
talloc_reference.

Quote from

https://doc.rust-lang.org/stable/book/first-edition/concurrency.html

> Shared mutable state is the root of all evil.

talloc_reference is a powerful amplifier of shared mutable state.

Volker

-- 
Besuchen Sie die verinice.XP 2018 in Berlin,
Anwenderkonferenz für Informationssicherheit
vom 21.-23.03.2018 im Sofitel Kurfürstendamm
Info & Anmeldung hier: http://veriniceXP.org

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