summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-09-06 11:08:56 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-26 21:11:51 +0200
commitcf1a8af5556b1d8eab68802918c881ae1a0b89eb (patch)
tree9a540d1b35c421b282d7deb86b8898e2cd3cb01a
parent6a848dd05e43b3f8ae964d1417dbc4036ddec53b (diff)
downloadsssd-cf1a8af5556b1d8eab68802918c881ae1a0b89eb.tar.gz
sssd-cf1a8af5556b1d8eab68802918c881ae1a0b89eb.tar.bz2
sssd-cf1a8af5556b1d8eab68802918c881ae1a0b89eb.zip
util: add get_domains_head()
This function will return head of the domain list. Resolves: https://fedorahosted.org/sssd/ticket/2066
-rw-r--r--src/util/domain_info_utils.c13
-rw-r--r--src/util/util.h2
2 files changed, 15 insertions, 0 deletions
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)
{
diff --git a/src/util/util.h b/src/util/util.h
index 20d230c1..6cd59d96 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -543,6 +543,8 @@ struct sized_string {
void to_sized_string(struct sized_string *out, const char *in);
/* from domain_info.c */
+struct sss_domain_info *get_domains_head(struct sss_domain_info *domain);
+
struct sss_domain_info *get_next_domain(struct sss_domain_info *domain,
bool descend);
struct sss_domain_info *find_subdomain_by_name(struct sss_domain_info *domain,