summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h4
-rw-r--r--src/db/sysdb_ops.c7
-rw-r--r--src/db/sysdb_subdomains.c15
-rw-r--r--src/providers/ldap/ldap_id.c6
-rw-r--r--src/providers/ldap/ldap_id_cleanup.c2
-rw-r--r--src/providers/proxy/proxy_id.c4
-rw-r--r--src/tests/sysdb-tests.c13
7 files changed, 20 insertions, 31 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 8ccf637a..ca82c78e 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -384,9 +384,6 @@ errno_t sysdb_master_domain_get_info(TALLOC_CTX *mem_ctx,
errno_t sysdb_master_domain_add_info(struct sysdb_ctx *sysdb,
struct sysdb_subdom *domain_info);
-errno_t sysdb_delete_domgroup(struct sss_domain_info *domain,
- const char *name, gid_t gid);
-
errno_t sysdb_get_ranges(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb,
size_t *range_count,
struct range_info ***range_list);
@@ -769,6 +766,7 @@ int sysdb_search_groups(TALLOC_CTX *mem_ctx,
struct ldb_message ***msgs);
int sysdb_delete_group(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name, gid_t gid);
int sysdb_search_netgroups(TALLOC_CTX *mem_ctx,
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 37e6b682..a32f4183 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1831,7 +1831,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
/* This may be a group rename. If there is a group with the
* same GID, remove it and try to add the basic group again
*/
- ret = sysdb_delete_group(sysdb, NULL, gid);
+ ret = sysdb_delete_group(sysdb, domain, NULL, gid);
if (ret == ENOENT) {
/* Not found by GID, return the original EEXIST,
* this may be a conflict in MPG domain or something
@@ -2562,6 +2562,7 @@ fail:
/* =Delete-Group-by-Name-OR-gid=========================================== */
int sysdb_delete_group(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name, gid_t gid)
{
TALLOC_CTX *tmp_ctx;
@@ -2574,10 +2575,10 @@ int sysdb_delete_group(struct sysdb_ctx *sysdb,
}
if (name) {
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb, sysdb->domain,
+ ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
name, NULL, &msg);
} else {
- ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, sysdb->domain,
+ ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, domain,
gid, NULL, &msg);
}
if (ret) {
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 10de8502..1f85b572 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -569,18 +569,3 @@ errno_t sysdb_get_subdomain_context(TALLOC_CTX *mem_ctx,
return EOK;
}
-
-#define CHECK_DOMAIN_INFO(dom_info) do { \
- if (dom_info == NULL || dom_info->sysdb == NULL) { \
- DEBUG(SSSDBG_OP_FAILURE, ("Invalid domain info.\n")); \
- return EINVAL; \
- } \
-} while(0)
-
-errno_t sysdb_delete_domgroup(struct sss_domain_info *domain,
- const char *name, gid_t gid)
-{
- CHECK_DOMAIN_INFO(domain);
-
- return sysdb_delete_group(domain->sysdb, name, gid);
-}
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index 95455d01..e66114b3 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -551,7 +551,8 @@ static void groups_get_done(struct tevent_req *subreq)
tevent_req_error(req, ret);
return;
case BE_FILTER_NAME:
- ret = sysdb_delete_group(state->sysdb, state->name, 0);
+ ret = sysdb_delete_group(state->sysdb,
+ state->domain, state->name, 0);
if (ret != EOK && ret != ENOENT) {
tevent_req_error(req, ret);
return;
@@ -565,7 +566,8 @@ static void groups_get_done(struct tevent_req *subreq)
return;
}
- ret = sysdb_delete_group(state->sysdb, NULL, gid);
+ ret = sysdb_delete_group(state->sysdb,
+ state->domain, NULL, gid);
if (ret != EOK && ret != ENOENT) {
tevent_req_error(req, ret);
return;
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index 103cca97..b220069a 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -479,7 +479,7 @@ static int cleanup_groups(TALLOC_CTX *memctx,
}
DEBUG(8, ("About to delete group %s\n", name));
- ret = sysdb_delete_group(sysdb, name, 0);
+ ret = sysdb_delete_group(sysdb, domain, name, 0);
if (ret) {
DEBUG(2, ("Group delete returned %d (%s)\n",
ret, strerror(ret)));
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 4ce00b4f..a97dd63e 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -872,7 +872,7 @@ static int get_gr_name(TALLOC_CTX *mem_ctx,
("Group %s does not exist (or is invalid) on remote server,"
" deleting!\n", name));
- ret = sysdb_delete_group(sysdb, NULL, gid);
+ ret = sysdb_delete_group(sysdb, dom, NULL, gid);
if (ret == ENOENT) {
ret = EOK;
}
@@ -944,7 +944,7 @@ static int get_gr_gid(TALLOC_CTX *mem_ctx,
("Group %d does not exist (or is invalid) on remote server,"
" deleting!\n", gid));
- ret = sysdb_delete_group(sysdb, NULL, gid);
+ ret = sysdb_delete_group(sysdb, dom, NULL, gid);
if (ret == ENOENT) {
ret = EOK;
}
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 105d72f8..e11977bd 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -240,7 +240,8 @@ static int test_remove_nonexistent_group(struct test_data *data)
{
int ret;
- ret = sysdb_delete_group(data->ctx->sysdb, NULL, data->uid);
+ ret = sysdb_delete_group(data->ctx->sysdb,
+ data->ctx->domain, NULL, data->uid);
return ret;
}
@@ -298,7 +299,8 @@ static int test_remove_group_by_gid(struct test_data *data)
{
int ret;
- ret = sysdb_delete_group(data->ctx->sysdb, NULL, data->gid);
+ ret = sysdb_delete_group(data->ctx->sysdb,
+ data->ctx->domain, NULL, data->gid);
if (ret == ENOENT) {
ret = EOK;
}
@@ -2799,7 +2801,7 @@ START_TEST (test_sysdb_memberof_remove_child_group_and_check_ghost)
2, data->msg->elements[0].num_values);
/* Remove the parent */
- ret = sysdb_delete_group(data->ctx->sysdb, NULL, delgid);
+ ret = sysdb_delete_group(data->ctx->sysdb, data->ctx->domain, NULL, delgid);
fail_if(ret != EOK, "Cannot delete group %llu [%d]: %s\n",
(unsigned long long) data->gid, ret, strerror(ret));
@@ -3811,7 +3813,8 @@ START_TEST(test_odd_characters)
/* Delete Group */
- ret = sysdb_delete_group(test_ctx->sysdb, odd_groupname, 20000);
+ ret = sysdb_delete_group(test_ctx->sysdb, test_ctx->domain,
+ odd_groupname, 20000);
fail_unless(ret == EOK, "sysdb_delete_group error [%d][%s]",
ret, strerror(ret));
@@ -4507,7 +4510,7 @@ START_TEST(test_sysdb_subdomain_group_ops)
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
"Unexpedted DN returned");
- ret = sysdb_delete_domgroup(subdomain, "subdomgroup", 12345);
+ ret = sysdb_delete_group(subdomain->sysdb, subdomain, "subdomgroup", 12345);
fail_unless(ret == EOK, "sysdb_delete_domgroup failed with [%d][%s].",
ret, strerror(ret));