From f9712481e9a999a42c58ba840a82d749e06af1f1 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 7 Jan 2013 19:44:29 -0500 Subject: Add domain arguments to sysdb_add_inetgroup fns. --- src/db/sysdb.h | 2 ++ src/db/sysdb_ops.c | 8 +++++--- src/providers/ipa/ipa_netgroups.c | 2 +- src/providers/ldap/sdap_async_netgroups.c | 2 +- src/providers/proxy/proxy_netgroup.c | 6 ++++-- src/tests/sysdb-tests.c | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/db/sysdb.h b/src/db/sysdb.h index dccd0450e..392746c8d 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -643,9 +643,11 @@ int sysdb_add_incomplete_group(struct sysdb_ctx *sysdb, /* Add netgroup (only basic attrs and w/o checks) */ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, const char *description); int sysdb_add_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, const char *description, struct sysdb_attrs *attrs, diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 33c6ac045..0b6951a64 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -1482,6 +1482,7 @@ fail: /* =Add-Basic-Netgroup-NO-CHECKS============================================= */ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, const char *description) { struct ldb_message *msg; @@ -1493,7 +1494,7 @@ int sysdb_add_basic_netgroup(struct sysdb_ctx *sysdb, } /* netgroup dn */ - msg->dn = sysdb_netgroup_dn(sysdb, msg, sysdb->domain, name); + msg->dn = sysdb_netgroup_dn(sysdb, msg, domain, name); if (!msg->dn) { ERROR_OUT(ret, ENOMEM, done); } @@ -1531,6 +1532,7 @@ done: /* =Add-Netgroup-Function==================================================== */ int sysdb_add_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, const char *description, struct sysdb_attrs *attrs, @@ -1554,7 +1556,7 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb, } /* try to add the netgroup */ - ret = sysdb_add_basic_netgroup(sysdb, name, description); + ret = sysdb_add_basic_netgroup(sysdb, domain, name, description); if (ret && ret != EEXIST) goto done; if (!attrs) { @@ -1577,7 +1579,7 @@ int sysdb_add_netgroup(struct sysdb_ctx *sysdb, (now + cache_timeout) : 0)); if (ret) goto done; - ret = sysdb_set_netgroup_attr(sysdb, sysdb->domain, name, attrs, SYSDB_MOD_REP); + ret = sysdb_set_netgroup_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP); if (missing) { ret = sysdb_remove_attrs(sysdb, name, diff --git a/src/providers/ipa/ipa_netgroups.c b/src/providers/ipa/ipa_netgroups.c index 360c14d25..f9e43b87f 100644 --- a/src/providers/ipa/ipa_netgroups.c +++ b/src/providers/ipa/ipa_netgroups.c @@ -171,7 +171,7 @@ static errno_t ipa_save_netgroup(TALLOC_CTX *mem_ctx, DEBUG(6, ("Storing info for netgroup %s\n", name)); - ret = sysdb_add_netgroup(ctx, name, NULL, netgroup_attrs, NULL, + ret = sysdb_add_netgroup(ctx, dom, name, NULL, netgroup_attrs, NULL, dom->netgroup_timeout, 0); if (ret) goto fail; diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c index 57a9b9434..2b382c1cf 100644 --- a/src/providers/ldap/sdap_async_netgroups.c +++ b/src/providers/ldap/sdap_async_netgroups.c @@ -138,7 +138,7 @@ static errno_t sdap_save_netgroup(TALLOC_CTX *memctx, goto fail; } - ret = sysdb_add_netgroup(ctx, name, NULL, netgroup_attrs, missing, + ret = sysdb_add_netgroup(ctx, dom, name, NULL, netgroup_attrs, missing, dom->netgroup_timeout, now); if (ret) goto fail; diff --git a/src/providers/proxy/proxy_netgroup.c b/src/providers/proxy/proxy_netgroup.c index afc57ecbe..5dc8efe70 100644 --- a/src/providers/proxy/proxy_netgroup.c +++ b/src/providers/proxy/proxy_netgroup.c @@ -67,6 +67,7 @@ static errno_t make_netgroup_attr(struct __netgrent netgrent, } static errno_t save_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, bool lowercase, @@ -90,7 +91,8 @@ static errno_t save_netgroup(struct sysdb_ctx *sysdb, } } - ret = sysdb_add_netgroup(sysdb, name, NULL, attrs, NULL, cache_timeout, 0); + ret = sysdb_add_netgroup(sysdb, domain, name, NULL, + attrs, NULL, cache_timeout, 0); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, ("sysdb_add_netgroup failed.\n")); return ret; @@ -197,7 +199,7 @@ errno_t get_netgroup(struct proxy_id_ctx *ctx, goto done; } - ret = save_netgroup(sysdb, name, attrs, + ret = save_netgroup(sysdb, dom, name, attrs, !dom->case_sensitive, dom->netgroup_timeout); if (ret != EOK) { diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index e9c771a69..91298e146 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -473,7 +473,7 @@ static int test_add_basic_netgroup(struct test_data *data) description = talloc_asprintf(data, "Test Netgroup %d", data->uid); - ret = sysdb_add_basic_netgroup(data->ctx->sysdb, + ret = sysdb_add_basic_netgroup(data->ctx->sysdb, data->ctx->domain, data->netgrname, description); return ret; } @@ -3799,7 +3799,7 @@ START_TEST(test_odd_characters) /* ===== Netgroups ===== */ /* Add */ - ret = sysdb_add_netgroup(test_ctx->sysdb, + ret = sysdb_add_netgroup(test_ctx->sysdb, test_ctx->domain, odd_netgroupname, "No description", NULL, NULL, 30, 0); fail_unless(ret == EOK, "sysdb_add_netgroup error [%d][%s]", -- cgit