diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-06 01:17:13 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 10:49:20 +0100 |
commit | 7c974e792beef952ceb19a01775c6d0ee71a1253 (patch) | |
tree | 8e6ccb5fcd7b99233ec0572d9b6dd90373a5ecc4 | |
parent | 52c72ae8587d8d47393a891ccd4ef06bd4bef856 (diff) | |
download | sssd-7c974e792beef952ceb19a01775c6d0ee71a1253.tar.gz sssd-7c974e792beef952ceb19a01775c6d0ee71a1253.tar.bz2 sssd-7c974e792beef952ceb19a01775c6d0ee71a1253.zip |
Make sysdb_netgroup_dn() require a domain explictly.
-rw-r--r-- | src/db/sysdb.c | 4 | ||||
-rw-r--r-- | src/db/sysdb.h | 2 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 8 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 6 |
4 files changed, 11 insertions, 9 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c index f7ca6401..edfcef02 100644 --- a/src/db/sysdb.c +++ b/src/db/sysdb.c @@ -191,7 +191,7 @@ struct ldb_dn *sysdb_group_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, } struct ldb_dn *sysdb_netgroup_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; @@ -203,7 +203,7 @@ struct ldb_dn *sysdb_netgroup_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, } dn = ldb_dn_new_fmt(mem_ctx, sysdb->ldb, SYSDB_TMPL_NETGROUP, - 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 2f77aa1e..fd00fa35 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -327,7 +327,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, 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 sss_domain_info *dom, const char *name); struct ldb_dn *sysdb_netgroup_base_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx); errno_t sysdb_group_dn_name(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *dn_str, char **name); diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 1f8c8315..2364f17b 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -453,7 +453,7 @@ int sysdb_search_netgroup_by_name(TALLOC_CTX *mem_ctx, return ENOMEM; } - basedn = sysdb_netgroup_dn(sysdb, tmp_ctx, name); + basedn = sysdb_netgroup_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!basedn) { ret = ENOMEM; goto done; @@ -625,7 +625,7 @@ int sysdb_set_netgroup_attr(struct sysdb_ctx *sysdb, return ENOMEM; } - dn = sysdb_netgroup_dn(sysdb, tmp_ctx, name); + dn = sysdb_netgroup_dn(sysdb, tmp_ctx, sysdb->domain, name); if (!dn) { ret = ENOMEM; goto done; @@ -1481,7 +1481,7 @@ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb, } /* netgroup dn */ - msg->dn = sysdb_netgroup_dn(sysdb, msg, name); + msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -3053,7 +3053,7 @@ errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb, break; case SYSDB_MEMBER_NETGROUP: - msg->dn = sysdb_netgroup_dn(sysdb, msg, name); + msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain, name); break; case SYSDB_MEMBER_SERVICE: diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 1b31d697..834b4117 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -481,7 +481,8 @@ static int test_remove_netgroup_entry(struct test_data *data) struct ldb_dn *netgroup_dn; int ret; - netgroup_dn = sysdb_netgroup_dn(data->ctx->sysdb, data, data->netgrname); + netgroup_dn = sysdb_netgroup_dn(data->ctx->sysdb, data, + data->ctx->domain, data->netgrname); if (!netgroup_dn) return ENOMEM; ret = sysdb_delete_entry(data->ctx->sysdb, netgroup_dn, true); @@ -3528,7 +3529,8 @@ START_TEST (test_sysdb_search_netgroup_by_name) netgrname, NULL, &msg); fail_if(ret != EOK, "Could not find netgroup with name %s", netgrname); - netgroup_dn = sysdb_netgroup_dn(test_ctx->sysdb, test_ctx, netgrname); + netgroup_dn = sysdb_netgroup_dn(test_ctx->sysdb, test_ctx, + test_ctx->domain, netgrname); fail_if(netgroup_dn == NULL); fail_if(ldb_dn_compare(msg->dn, netgroup_dn) != 0, "Found wrong netgroup!\n"); talloc_free(test_ctx); |