From cf1a8af5556b1d8eab68802918c881ae1a0b89eb Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Fri, 6 Sep 2013 11:08:56 +0200 Subject: util: add get_domains_head() This function will return head of the domain list. Resolves: https://fedorahosted.org/sssd/ticket/2066 --- src/util/domain_info_utils.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/util/domain_info_utils.c') diff --git a/src/util/domain_info_utils.c b/src/util/domain_info_utils.c index 7b1eb1a3..7ac4d9d0 100644 --- a/src/util/domain_info_utils.c +++ b/src/util/domain_info_utils.c @@ -27,6 +27,19 @@ /* the directory domain - realm mappings are written to */ #define KRB5_MAPPING_DIR PUBCONF_PATH"/krb5.include.d" +struct sss_domain_info *get_domains_head(struct sss_domain_info *domain) +{ + struct sss_domain_info *dom = NULL; + + /* get to the top level domain */ + for (dom = domain; dom->parent != NULL; dom = dom->parent); + + /* proceed to the list head */ + for (; dom->prev != NULL; dom = dom->prev); + + return dom; +} + struct sss_domain_info *get_next_domain(struct sss_domain_info *domain, bool descend) { -- cgit