Hi,
as described in
https://fedorahosted.org/sssd/ticket/2285, we need to
download the list of trusted domains from the forest root, because only
the forest root knows the full list of domains. The leafs only store
itself and the forest root.
Initially, I wanted to use the Global Catalog, but it turned out not all
attributes we care about are present in the GC, such as the flatName. So
the attached patch connects directly to the LDAP port of the forest root
in case the SSSD is not enrolled with a forest root already.
There is one bit of code duplication that both callers
of ad_subdom_ad_ctx_new set the newly created ad_id_ctx as a pvt
pointer of the sdap domain on success. Initially I moved that logic
to ad_subdom_ad_ctx_new but later I realized that the sdom handling in
ad_subdom_ad_ctx_new is strange (we just read the sdom from the newly
created ad_id_ctx, not from the 'parent' and never use it afterwards..) and
I'd like to fix this properly with a follow up patch.
Thanks for review.