diff options
author | Sumit Bose <sbose@redhat.com> | 2013-06-14 13:09:00 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-06-28 20:20:59 +0200 |
commit | 5e60c73cb91d1659755fb5ea829837db68d46163 (patch) | |
tree | 4a8408f379e5f39e55c822e774f88b743d6c6bdd /src/db | |
parent | 8ff0aba893d8da1a8163ccaf9ad2c5b6bccd121f (diff) | |
download | sssd-5e60c73cb91d1659755fb5ea829837db68d46163.tar.gz sssd-5e60c73cb91d1659755fb5ea829837db68d46163.tar.bz2 sssd-5e60c73cb91d1659755fb5ea829837db68d46163.zip |
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
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb.h | 2 | ||||
-rw-r--r-- | src/db/sysdb_ranges.c | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 489188b7..0b99dee0 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -130,6 +130,7 @@ #define SYSDB_BASE_RID "baseRID" #define SYSDB_SECONDARY_BASE_RID "secondaryBaseRID" #define SYSDB_DOMAIN_ID "domainID" +#define SYSDB_ID_RANGE_TYPE "idRangeType" #define SYSDB_NEXTID_FILTER "("SYSDB_NEXTID"=*)" @@ -245,6 +246,7 @@ struct range_info { uint32_t base_rid; uint32_t secondary_base_rid; char *trusted_dom_sid; + char *range_type; }; 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; |