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

Stephen Gallagher sgallagh at redhat.com
Mon Mar 2 16:43:49 UTC 2009


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

Simo Sorce wrote:
> 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.
> 

Well, in this particular case, my whole argument is that we want to make
sure that the btreemap is always valid, even if the original owner has
gone away. I think if we just added a few verbose comments to the
btreemap.h to state that the map acquires ownership of anything passed
into it, it might be acceptable.

Otherwise, we have to be worried about the original context disappearing.

I understand the wariness to lose track of ownership, but I think this
would be a very carefully controlled usage.

- --
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkmsDMUACgkQeiVVYja6o6NhvwCgpSGgIq5CREaOZxfte0TCH0yK
IRAAoIZq/REO6StT9S1PBtH8b1/djZbC
=1ZyC
-----END PGP SIGNATURE-----




More information about the Freeipa-devel mailing list