diff options
-rw-r--r-- | src/db/sysdb.c | 4 | ||||
-rw-r--r-- | src/db/sysdb.h | 2 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 12 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 6 | ||||
-rw-r--r-- | src/tools/sss_groupshow.c | 2 | ||||
-rw-r--r-- | src/tools/sss_sync_ops.c | 12 |
6 files changed, 20 insertions, 18 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index b7951d32..f7ca6401 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -172,7 +172,7 @@ struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, } struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - const char *name) + struct sss_domain_info *dom, const char *name) { errno_t ret; char *clean_name; @@ -184,7 +184,7 @@ struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, } dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_GROUP, - clean_name, sysdb->domain->name); + clean_name, dom->name); talloc_free(clean_name); return dn; diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 5130b06a..2f77aa1e 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -325,7 +325,7 @@ errno_t sysdb_get_rdn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, struct ldb_dn *sysdb_user_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, struct sss_domain_info *dom, const char *name); struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, - const char *name); + struct sss_domain_info *dom, const char *name); struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *name); struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx); diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 108f3b84..1f8c8315 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -351,7 +351,7 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_group_dn(sysdb, tmp_ctx, name); + basedn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!basedn) { ret = ENOMEM; goto done; @@ -592,7 +592,7 @@ int sysdb_set_group_attr(struct sysdb_ctx *sysdb, goto done; } - dn = sysdb_group_dn(sysdb, tmp_ctx, name); + dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!dn) { ret = ENOMEM; goto done; @@ -1223,7 +1223,7 @@ int sysdb_add_basic_group(struct sysdb_ctx *sysdb, } /* group dn */ - msg->dn = sysdb_group_dn(sysdb, msg, name); + msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1876,7 +1876,7 @@ sysdb_group_membership_mod(struct sysdb_ctx *sysdb, if (type == SYSDB_MEMBER_USER) { member_dn = sysdb_user_dn(sysdb, tmp_ctx, sysdb->domain, member); } else if (type == SYSDB_MEMBER_GROUP) { - member_dn = sysdb_group_dn(sysdb, tmp_ctx, member); + member_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain, member); } else { ret = EINVAL; goto done; @@ -1887,7 +1887,7 @@ sysdb_group_membership_mod(struct sysdb_ctx *sysdb, goto done; } - group_dn = sysdb_group_dn(sysdb, tmp_ctx, group); + group_dn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain, group); if (!group_dn) { ret = ENOMEM; goto done; @@ -3049,7 +3049,7 @@ errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb, break; case SYSDB_MEMBER_GROUP: - msg->dn = sysdb_group_dn(sysdb, msg, name); + msg->dn = sysdb_group_dn(sysdb, msg, sysdb->domain, name); break; case SYSDB_MEMBER_NETGROUP: diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index f624ba4d..1b31d697 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -282,7 +282,8 @@ static int test_remove_group(struct test_data *data) struct ldb_dn *group_dn; int ret; - group_dn = sysdb_group_dn(data->ctx->sysdb, data, data->groupname); + group_dn = sysdb_group_dn(data->ctx->sysdb, data, + data->ctx->domain, data->groupname); if (!group_dn) return ENOMEM; ret = sysdb_delete_entry(data->ctx->sysdb, group_dn, true); @@ -3463,7 +3464,8 @@ START_TEST (test_sysdb_group_dn_name) } groupname = talloc_asprintf(test_ctx, "testgroup%d", _i); - group_dn = sysdb_group_dn(test_ctx->sysdb, test_ctx, groupname); + group_dn = sysdb_group_dn(test_ctx->sysdb, test_ctx, + test_ctx->domain, groupname); if (!group_dn || !groupname) { fail("Out of memory"); return; diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c index 7ba1db13..42076fe8 100644 --- a/src/tools/sss_groupshow.c +++ b/src/tools/sss_groupshow.c @@ -423,7 +423,7 @@ static int group_show_trim_memberof(TALLOC_CTX *mem_ctx, int ret; int i; - dn = sysdb_group_dn(sysdb, mem_ctx, name); + dn = sysdb_group_dn(sysdb, mem_ctx, domain, name); if (!dn) { return ENOMEM; } diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c index 0e3d326a..37fd8c61 100644 --- a/src/tools/sss_sync_ops.c +++ b/src/tools/sss_sync_ops.c @@ -53,6 +53,7 @@ struct sync_op_res { * Generic modify groups member */ static int mod_groups_member(struct sysdb_ctx *sysdb, + struct sss_domain_info *dom, char **grouplist, struct ldb_dn *member_dn, int optype) @@ -70,8 +71,7 @@ static int mod_groups_member(struct sysdb_ctx *sysdb, /* FIXME: add transaction around loop */ for (i = 0; grouplist[i]; i++) { - parent_dn = sysdb_group_dn(sysdb, tmpctx, - grouplist[i]); + parent_dn = sysdb_group_dn(sysdb, tmpctx, dom, grouplist[i]); if (!parent_dn) { ret = ENOMEM; goto done; @@ -91,10 +91,10 @@ done: } #define add_to_groups(sysdb, data, member_dn) \ - mod_groups_member(sysdb, data->addgroups, member_dn, \ + mod_groups_member(sysdb, data->domain, data->addgroups, member_dn, \ LDB_FLAG_MOD_ADD) #define remove_from_groups(sysdb, data, member_dn) \ - mod_groups_member(sysdb, data->rmgroups, member_dn, \ + mod_groups_member(sysdb, data->domain, data->rmgroups, member_dn, \ LDB_FLAG_MOD_DELETE) /* @@ -256,7 +256,7 @@ int groupmod(TALLOC_CTX *mem_ctx, int ret; if (data->addgroups || data->rmgroups) { - member_dn = sysdb_group_dn(sysdb, mem_ctx, data->name); + member_dn = sysdb_group_dn(sysdb, mem_ctx, data->domain, data->name); if (!member_dn) { return ENOMEM; } @@ -547,7 +547,7 @@ int groupdel(TALLOC_CTX *mem_ctx, struct ldb_dn *group_dn; int ret; - group_dn = sysdb_group_dn(sysdb, mem_ctx, data->name); + group_dn = sysdb_group_dn(sysdb, mem_ctx, data->domain, data->name); if (group_dn == NULL) { DEBUG(1, ("Could not construct a group DN\n")); return ENOMEM; |