summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-07 20:10:42 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:01 +0100
commit99c0cfdc5f065ba38f1ee91701d1d27f9e4fdb96 (patch)
tree414ff429c11fbbc36b042286628f112f49871f69 /src
parent6ac396bebb4cd3124711d26dce54263f6f9c7c45 (diff)
downloadsssd-99c0cfdc5f065ba38f1ee91701d1d27f9e4fdb96.tar.gz
sssd-99c0cfdc5f065ba38f1ee91701d1d27f9e4fdb96.tar.xz
sssd-99c0cfdc5f065ba38f1ee91701d1d27f9e4fdb96.zip
Add domain argument to sysdb_store_group()
Also remove sysdb_store_domgroup()
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h7
-rw-r--r--src/db/sysdb_ops.c9
-rw-r--r--src/db/sysdb_subdomains.c13
-rw-r--r--src/providers/ipa/ipa_s2n_exop.c5
-rw-r--r--src/providers/ldap/sdap_async_groups.c8
-rw-r--r--src/providers/proxy/proxy_id.c2
-rw-r--r--src/tests/sysdb-tests.c21
7 files changed, 26 insertions, 39 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 4e11fbe56..a3184beef 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -389,12 +389,6 @@ errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
const char *name, uid_t uid);
-errno_t sysdb_store_domgroup(struct sss_domain_info *domain,
- const char *name,
- gid_t gid,
- struct sysdb_attrs *attrs,
- uint64_t cache_timeout,
- time_t now);
errno_t sysdb_delete_domgroup(struct sss_domain_info *domain,
const char *name, gid_t gid);
@@ -665,6 +659,7 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
time_t now);
int sysdb_store_group(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
gid_t gid,
struct sysdb_attrs *attrs,
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 61a0e77d9..6d0d5acf5 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1779,6 +1779,7 @@ fail:
/* this function does not check that all user members are actually present */
int sysdb_store_group(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
gid_t gid,
struct sysdb_attrs *attrs,
@@ -1797,7 +1798,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb, sysdb->domain,
+ ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
name, src_attrs, &msg);
if (ret && ret != ENOENT) {
goto done;
@@ -1824,7 +1825,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
if (new_group) {
/* group doesn't exist, turn into adding a group */
- ret = sysdb_add_group(sysdb, sysdb->domain, name, gid,
+ ret = sysdb_add_group(sysdb, domain, name, gid,
attrs, cache_timeout, now);
if (ret == EEXIST) {
/* This may be a group rename. If there is a group with the
@@ -1842,7 +1843,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
DEBUG(SSSDBG_MINOR_FAILURE,
("A group with the same GID [%llu] was removed from the "
"cache\n", (unsigned long long) gid));
- ret = sysdb_add_group(sysdb, sysdb->domain, name, gid,
+ ret = sysdb_add_group(sysdb, domain, name, gid,
attrs, cache_timeout, now);
}
goto done;
@@ -1862,7 +1863,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
(now + cache_timeout) : 0));
if (ret) goto done;
- ret = sysdb_set_group_attr(sysdb, sysdb->domain, name, attrs, SYSDB_MOD_REP);
+ ret = sysdb_set_group_attr(sysdb, domain, name, attrs, SYSDB_MOD_REP);
done:
if (ret) {
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 4a81b1dfb..6ec3e4f4c 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -585,19 +585,6 @@ errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
return sysdb_delete_user(domain->sysdb, name, uid);
}
-errno_t sysdb_store_domgroup(struct sss_domain_info *domain,
- const char *name,
- gid_t gid,
- struct sysdb_attrs *attrs,
- uint64_t cache_timeout,
- time_t now)
-{
- CHECK_DOMAIN_INFO(domain);
-
- return sysdb_store_group(domain->sysdb, name, gid, attrs, cache_timeout,
- now);
-}
-
errno_t sysdb_delete_domgroup(struct sss_domain_info *domain,
const char *name, gid_t gid)
{
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 347a06064..0b4842ccc 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -699,9 +699,8 @@ static void ipa_s2n_get_user_done(struct tevent_req *subreq)
goto done;
}
- ret = sysdb_store_domgroup(state->dom, name,
- attrs->a.group.gr_gid, NULL, timeout,
- now);
+ ret = sysdb_store_group(state->dom->sysdb, state->dom, name,
+ attrs->a.group.gr_gid, NULL, timeout, now);
break;
default:
DEBUG(SSSDBG_OP_FAILURE, ("Unexpected response type [%d].\n",
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index cdb608198..4fdacae66 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -260,6 +260,7 @@ done:
static errno_t
sdap_store_group_with_gid(struct sysdb_ctx *ctx,
+ struct sss_domain_info *domain,
const char *name,
gid_t gid,
struct sysdb_attrs *group_attrs,
@@ -279,7 +280,8 @@ sdap_store_group_with_gid(struct sysdb_ctx *ctx,
}
}
- ret = sysdb_store_group(ctx, name, gid, group_attrs, cache_timeout, now);
+ ret = sysdb_store_group(ctx, domain, name, gid,
+ group_attrs, cache_timeout, now);
if (ret) {
DEBUG(2, ("Could not store group %s\n", name));
return ret;
@@ -597,7 +599,7 @@ static int sdap_save_group(TALLOC_CTX *memctx,
DEBUG(6, ("Storing info for group %s\n", name));
- ret = sdap_store_group_with_gid(ctx,
+ ret = sdap_store_group_with_gid(ctx, dom,
name, gid, group_attrs,
dom->group_timeout,
posix_group, now);
@@ -692,7 +694,7 @@ static int sdap_save_grpmem(TALLOC_CTX *memctx,
DEBUG(6, ("Storing members for group %s\n", name));
- ret = sysdb_store_group(ctx, name, 0, group_attrs,
+ ret = sysdb_store_group(ctx, dom, name, 0, group_attrs,
dom->group_timeout, now);
if (ret) goto fail;
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 76fbad45a..256377830 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -611,7 +611,7 @@ static int save_group(struct sysdb_ctx *sysdb, struct sss_domain_info *dom,
}
}
- ret = sysdb_store_group(sysdb,
+ ret = sysdb_store_group(sysdb, dom,
real_name,
grp->gr_gid,
attrs,
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index e1944809d..cf6a14785 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -274,8 +274,8 @@ static int test_store_group(struct test_data *data)
{
int ret;
- ret = sysdb_store_group(data->ctx->sysdb, data->groupname,
- data->gid, data->attrs, -1, 0);
+ ret = sysdb_store_group(data->ctx->sysdb, data->ctx->domain,
+ data->groupname, data->gid, data->attrs, -1, 0);
return ret;
}
@@ -425,8 +425,8 @@ static int test_memberof_store_group(struct test_data *data)
}
}
- ret = sysdb_store_group(data->ctx->sysdb, data->groupname,
- data->gid, attrs, -1, 0);
+ ret = sysdb_store_group(data->ctx->sysdb, data->ctx->domain,
+ data->groupname, data->gid, attrs, -1, 0);
return ret;
}
@@ -462,8 +462,8 @@ static int test_memberof_store_group_with_ghosts(struct test_data *data)
}
}
- ret = sysdb_store_group(data->ctx->sysdb, data->groupname,
- data->gid, attrs, -1, 0);
+ ret = sysdb_store_group(data->ctx->sysdb, data->ctx->domain,
+ data->groupname, data->gid, attrs, -1, 0);
return ret;
}
@@ -3305,7 +3305,8 @@ START_TEST(test_group_rename)
fail_unless(ret == EOK, "Could not set up the test");
/* Store and verify the first group */
- ret = sysdb_store_group(test_ctx->sysdb, fromname, grgid, NULL, 0, 0);
+ ret = sysdb_store_group(test_ctx->sysdb, test_ctx->domain,
+ fromname, grgid, NULL, 0, 0);
fail_unless(ret == EOK, "Could not add first group");
ret = sysdb_getgrnam(test_ctx, test_ctx->sysdb,
@@ -3330,7 +3331,8 @@ START_TEST(test_group_rename)
toname, grgid, NULL, 0, 0);
fail_unless(ret == EEXIST, "Group renamed with a low level call?");
- ret = sysdb_store_group(test_ctx->sysdb, toname, grgid, NULL, 0, 0);
+ ret = sysdb_store_group(test_ctx->sysdb, test_ctx->domain,
+ toname, grgid, NULL, 0, 0);
fail_unless(ret == EOK, "Could not add first group");
ret = sysdb_getgrnam(test_ctx, test_ctx->sysdb,
@@ -4470,7 +4472,8 @@ START_TEST(test_sysdb_subdomain_group_ops)
NULL, NULL);
fail_unless(subdomain != NULL, "new_subdomain failed.");
- ret = sysdb_store_domgroup(subdomain, "subdomgroup", 12345, NULL, -1, 0);
+ ret = sysdb_store_group(subdomain->sysdb, subdomain,
+ "subdomgroup", 12345, NULL, -1, 0);
fail_unless(ret == EOK, "sysdb_store_domgroup failed.");
check_dn = ldb_dn_new(test_ctx, test_ctx->sysdb->ldb,