From 5e60c73cb91d1659755fb5ea829837db68d46163 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 14 Jun 2013 13:09:00 +0200 Subject: Add support for new ipaRangeType attribute Recent versions of FreeIPA support a range type attribute to allow different type of ranges for sub/trusted-domains. If the attribute is available it will be used, if not the right value is determined with the help of the other idrange attributes. Fixes https://fedorahosted.org/sssd/ticket/1961 --- src/db/sysdb_ranges.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/db/sysdb_ranges.c') diff --git a/src/db/sysdb_ranges.c b/src/db/sysdb_ranges.c index cc72033e..5b444eac 100644 --- a/src/db/sysdb_ranges.c +++ b/src/db/sysdb_ranges.c @@ -53,6 +53,7 @@ errno_t sysdb_get_ranges(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, SYSDB_BASE_RID, SYSDB_SECONDARY_BASE_RID, SYSDB_DOMAIN_ID, + SYSDB_ID_RANGE_TYPE, NULL}; struct range_info **list; struct ldb_dn *basedn; @@ -140,6 +141,17 @@ errno_t sysdb_get_ranges(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, DEBUG(SSSDBG_MINOR_FAILURE, ("find_attr_as_uint32_t failed.\n")); goto done; } + + tmp_str = ldb_msg_find_attr_as_string(res->msgs[c], SYSDB_ID_RANGE_TYPE, + NULL); + if (tmp_str != NULL) { + list[c]->range_type = talloc_strdup(list, tmp_str); + if (list[c]->range_type == NULL) { + ret = ENOMEM; + goto done; + } + } + } list[res->count] = NULL; @@ -228,6 +240,10 @@ errno_t sysdb_range_create(struct sysdb_ctx *sysdb, struct range_info *range) (unsigned long)time(NULL)); if (ret) goto done; + ret = add_string(msg, LDB_FLAG_MOD_ADD, SYSDB_ID_RANGE_TYPE, + range->range_type); + if (ret) goto done; + ret = ldb_add(sysdb->ldb, msg); if (ret) goto done; -- cgit