From a58ccee5afc802c7560624929614616aeefa9bd0 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 7 Jan 2013 23:39:50 -0500 Subject: Add domain argument to sysdb_delete_group() Also remove sysdb_delete_domgroup() --- src/db/sysdb.h | 4 +--- src/db/sysdb_ops.c | 7 ++++--- src/db/sysdb_subdomains.c | 15 --------------- 3 files changed, 5 insertions(+), 21 deletions(-) (limited to 'src/db') 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); -} -- cgit