[Freeipa-devel] [PATCH][SSSD] Implement GetUserAttributes in the InfoPipe

Simo Sorce ssorce at redhat.com
Mon Mar 2 14:45:05 UTC 2009


On Mon, 2009-03-02 at 09:16 -0500, Stephen Gallagher wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Simo Sorce wrote:
> > On Mon, 2009-03-02 at 08:56 -0500, Stephen Gallagher wrote:
> >> You can't use strdup, because btreemap takes a void *. This is
> >> necessary
> >> so it can hold arbitrary data (see its use in
> >> create_getattr_result_map).
> > 
> > If thekeys are void we can turn them into a char *, are we ever going to
> > use keys that are not strings?
> 
> Probably not, but I wanted to leave it expandable in case we discovered
> such a case.
> 
> > 
> >> Also, I wasn't using talloc_reference, it's talloc_steal. Yes, I know
> >> that's not ideal either. I'm open to suggestions.
> > 
> > talloc_steal() is much worse in this case.
> > 
> 
> Can you explain to me what, exactly, is dangerous about
> talloc_reference? It seems to me that calling
> talloc_reference(btreemap_node, btreemap_value) would solve this handily.

The poroblem is the change in ownership when you free the original
owner. It makes it very simple to loose track of who owns what, causing
potential unintended consequences. The semantics are still not very
clear imo, and they may change upstream at some point, so I prefer to
simply not use it for now.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the Freeipa-devel mailing list