diff options
-rw-r--r-- | src/db/sysdb.h | 5 | ||||
-rw-r--r-- | src/db/sysdb_idmap.c | 19 | ||||
-rw-r--r-- | src/providers/ldap/sdap_idmap.c | 3 |
3 files changed, 13 insertions, 14 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 6fc71e1c1..df0e1d37e 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -845,16 +845,15 @@ errno_t sysdb_get_direct_parents(TALLOC_CTX *mem_ctx, #define SYSDB_TMPL_IDMAP_BASE SYSDB_IDMAP_CONTAINER",cn=%s,"SYSDB_BASE #define SYSDB_TMPL_IDMAP SYSDB_IDMAP_SID_ATTR"=%s,"SYSDB_TMPL_IDMAP_BASE -struct ldb_dn *sysdb_idmap_dn(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - const char *object_sid); - errno_t sysdb_idmap_store_mapping(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *dom_name, const char *dom_sid, id_t slice_num); errno_t sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, struct ldb_result **_result); #endif /* __SYS_DB_H__ */ diff --git a/src/db/sysdb_idmap.c b/src/db/sysdb_idmap.c index eca3d1bd6..612a42aae 100644 --- a/src/db/sysdb_idmap.c +++ b/src/db/sysdb_idmap.c @@ -24,9 +24,9 @@ #include "db/sysdb.h" #include "db/sysdb_private.h" -struct ldb_dn * +static struct ldb_dn * sysdb_idmap_dn(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, - const char *object_sid) + struct sss_domain_info *domain, const char *object_sid) { errno_t ret; char *clean_sid; @@ -37,11 +37,10 @@ sysdb_idmap_dn(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, return NULL; } - DEBUG(SSSDBG_TRACE_ALL, - (SYSDB_TMPL_IDMAP"\n", clean_sid, sysdb->domain->name)); + DEBUG(SSSDBG_TRACE_ALL, (SYSDB_TMPL_IDMAP"\n", clean_sid, domain->name)); dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_IDMAP, - clean_sid, sysdb->domain->name); + clean_sid, domain->name); talloc_free(clean_sid); return dn; @@ -49,6 +48,7 @@ sysdb_idmap_dn(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, errno_t sysdb_idmap_store_mapping(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *dom_name, const char *dom_sid, id_t slice_num) @@ -68,7 +68,7 @@ sysdb_idmap_store_mapping(struct sysdb_ctx *sysdb, tmp_ctx = talloc_new(NULL); if (!tmp_ctx) return ENOMEM; - dn = sysdb_idmap_dn(tmp_ctx, sysdb, dom_sid); + dn = sysdb_idmap_dn(tmp_ctx, sysdb, domain, dom_sid); if (!dn) { ret = ENOMEM; goto done; @@ -277,6 +277,7 @@ done: errno_t sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, struct ldb_result **_result) { errno_t ret; @@ -289,12 +290,10 @@ sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (!tmp_ctx) return ENOMEM; - DEBUG(SSSDBG_TRACE_ALL, - (SYSDB_TMPL_IDMAP_BASE"\n", sysdb->domain->name)); + DEBUG(SSSDBG_TRACE_ALL, (SYSDB_TMPL_IDMAP_BASE"\n", domain->name)); base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, - SYSDB_TMPL_IDMAP_BASE, - sysdb->domain->name); + SYSDB_TMPL_IDMAP_BASE, domain->name); if (!base_dn) { ret = ENOMEM; goto done; diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c index e51fcc6b4..b3109b8ab 100644 --- a/src/providers/ldap/sdap_idmap.c +++ b/src/providers/ldap/sdap_idmap.c @@ -80,7 +80,7 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx, } /* Read in any existing mappings from the cache */ - ret = sysdb_idmap_get_mappings(tmp_ctx, sysdb, &res); + ret = sysdb_idmap_get_mappings(tmp_ctx, sysdb, id_ctx->be->domain, &res); if (ret != EOK && ret != ENOENT) { DEBUG(SSSDBG_FATAL_FAILURE, ("Could not read ID mappings from the cache: [%s]\n", @@ -314,6 +314,7 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx, /* Add this domain to the SYSDB cache so it will survive reboot */ ret = sysdb_idmap_store_mapping(idmap_ctx->id_ctx->be->sysdb, + idmap_ctx->id_ctx->be->domain, dom_name, dom_sid, new_slice->slice_num); done: |