Hi,
the attached patches are my proposal to fix https://fedorahosted.org/sssd/ticket/2829
I haven't tested them past make check yet, because I'm not sure I like them myself :) but at the same time I can't see a better way to keep track of the servers and let callers set state of servers.
The most ugly thing so far IMO is the fo_internal_owner member. I would prefer to instead have a fo_server_wrap structure that would be used for the server_list, but I didn't want to do a large change before we agree the refcount is a good idea at all.
The other ugly side-effect is that we need to be sure that nobody calls talloc_free on the fo_server structure. Instead, only the parent context can be freed (that's also what the first patch is about).