summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-07 15:24:40 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:49:20 +0100
commitb23539e420b9962ad3bfd8f305b9d5acf47e7efb (patch)
tree666dad57e8cc8c166eddd4b4ba5b865322fae309 /src
parenta5a4e5b4836fdd693bab6e1c7f9d633d1440447d (diff)
downloadsssd-b23539e420b9962ad3bfd8f305b9d5acf47e7efb.tar.gz
sssd-b23539e420b9962ad3bfd8f305b9d5acf47e7efb.tar.xz
sssd-b23539e420b9962ad3bfd8f305b9d5acf47e7efb.zip
Add domain to sysdb_search_group_by_name()
Also remove unused sysdb_search_domgroup_by_name()
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h6
-rw-r--r--src/db/sysdb_ops.c9
-rw-r--r--src/db/sysdb_subdomains.c12
-rw-r--r--src/providers/ldap/sdap_async_initgroups.c18
-rw-r--r--src/providers/ldap/sdap_async_initgroups_ad.c4
-rw-r--r--src/providers/ldap/sdap_async_private.h1
-rw-r--r--src/tests/sysdb-tests.c7
-rw-r--r--src/tools/sss_groupshow.c6
8 files changed, 29 insertions, 34 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 333c94aed..9f9dd9737 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -400,11 +400,6 @@ errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
const char *name, uid_t uid);
-errno_t sysdb_search_domgroup_by_name(TALLOC_CTX *mem_ctx,
- struct sss_domain_info *domain,
- const char *name,
- const char **attrs,
- struct ldb_message **msg);
errno_t sysdb_search_domgroup_by_gid(TALLOC_CTX *mem_ctx,
struct sss_domain_info *domain,
gid_t gid,
@@ -557,6 +552,7 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx,
/* Search Group (by gid or name) */
int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **msg);
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 2e361ec89..3f216d359 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -337,6 +337,7 @@ done:
int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
const char *name,
const char **attrs,
struct ldb_message **msg)
@@ -353,7 +354,7 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- basedn = sysdb_group_dn(sysdb, tmp_ctx, sysdb->domain, name);
+ basedn = sysdb_group_dn(sysdb, tmp_ctx, domain, name);
if (!basedn) {
ret = ENOMEM;
goto done;
@@ -1120,7 +1121,7 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
* Don't worry about users, if we try to add a user with the same
* name the operation will fail */
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb,
+ ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
name, NULL, &msg);
if (ret != ENOENT) {
if (ret == EOK) ret = EEXIST;
@@ -1785,7 +1786,7 @@ int sysdb_store_group(struct sysdb_ctx *sysdb,
return ENOMEM;
}
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb,
+ ret = sysdb_search_group_by_name(tmp_ctx, sysdb, sysdb->domain,
name, src_attrs, &msg);
if (ret && ret != ENOENT) {
goto done;
@@ -2545,7 +2546,7 @@ int sysdb_delete_group(struct sysdb_ctx *sysdb,
}
if (name) {
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb,
+ ret = sysdb_search_group_by_name(tmp_ctx, sysdb, sysdb->domain,
name, NULL, &msg);
} else {
ret = sysdb_search_group_by_gid(tmp_ctx, sysdb,
diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c
index 5943c1d1a..f98dbd29a 100644
--- a/src/db/sysdb_subdomains.c
+++ b/src/db/sysdb_subdomains.c
@@ -603,18 +603,6 @@ errno_t sysdb_delete_domuser(struct sss_domain_info *domain,
return sysdb_delete_user(domain->sysdb, name, uid);
}
-errno_t sysdb_search_domgroup_by_name(TALLOC_CTX *mem_ctx,
- struct sss_domain_info *domain,
- const char *name,
- const char **attrs,
- struct ldb_message **msg)
-{
- CHECK_DOMAIN_INFO(domain);
-
- return sysdb_search_group_by_name(mem_ctx, domain->sysdb,
- name, attrs, msg);
-}
-
errno_t sysdb_search_domgroup_by_gid(TALLOC_CTX *mem_ctx,
struct sss_domain_info *domain,
gid_t gid,
diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c
index ad794b8d3..7ccbe47be 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -29,6 +29,7 @@
/* ==Save-fake-group-list=====================================*/
static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sdap_options *opts,
char **groupnames,
struct sysdb_attrs **ldap_groups,
@@ -63,7 +64,8 @@ static errno_t sdap_add_incomplete_groups(struct sysdb_ctx *sysdb,
mi = 0;
for (i=0; groupnames[i]; i++) {
- ret = sysdb_search_group_by_name(tmp_ctx, sysdb, groupnames[i], NULL, &msg);
+ ret = sysdb_search_group_by_name(tmp_ctx, sysdb, domain,
+ groupnames[i], NULL, &msg);
if (ret == EOK) {
continue;
} else if (ret == ENOENT) {
@@ -203,6 +205,7 @@ done:
}
int sdap_initgr_common_store(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sdap_options *opts,
const char *name,
enum sysdb_member_type type,
@@ -257,7 +260,7 @@ int sdap_initgr_common_store(struct sysdb_ctx *sysdb,
* member of but that are not cached in sysdb
*/
if (add_groups && add_groups[0]) {
- ret = sdap_add_incomplete_groups(sysdb, opts,
+ ret = sdap_add_incomplete_groups(sysdb, domain, opts,
add_groups, ldap_groups,
ldap_groups_count);
if (ret != EOK) {
@@ -514,7 +517,9 @@ static void sdap_initgr_rfc2307_process(struct tevent_req *subreq)
/* There are no nested groups here so we can just update the
* memberships */
- ret = sdap_initgr_common_store(state->sysdb, state->opts,
+ ret = sdap_initgr_common_store(state->sysdb,
+ state->domain,
+ state->opts,
state->name,
SYSDB_MEMBER_USER,
sysdb_grouplist,
@@ -538,6 +543,7 @@ static int sdap_initgr_rfc2307_recv(struct tevent_req *req)
/* ==Common code for pure RFC2307bis and IPA/AD========================= */
static errno_t
sdap_nested_groups_store(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sdap_options *opts,
struct sysdb_attrs **groups,
unsigned long count)
@@ -569,7 +575,7 @@ sdap_nested_groups_store(struct sysdb_ctx *sysdb,
}
in_transaction = true;
- ret = sdap_add_incomplete_groups(sysdb, opts, groupnamelist,
+ ret = sdap_add_incomplete_groups(sysdb, domain, opts, groupnamelist,
groups, count);
if (ret != EOK) {
DEBUG(6, ("Could not add incomplete groups [%d]: %s\n",
@@ -1014,7 +1020,7 @@ fail:
static errno_t
sdap_initgr_store_groups(struct sdap_initgr_nested_state *state)
{
- return sdap_nested_groups_store(state->sysdb,
+ return sdap_nested_groups_store(state->sysdb, state->dom,
state->opts, state->groups,
state->groups_cur);
}
@@ -1766,7 +1772,7 @@ save_rfc2307bis_groups(struct sdap_initgr_rfc2307bis_state *state)
}
talloc_zfree(values);
- ret = sdap_nested_groups_store(state->sysdb, state->opts,
+ ret = sdap_nested_groups_store(state->sysdb, state->dom, state->opts,
groups, count);
if (ret != EOK) {
DEBUG(3, ("Could not save groups [%d]: %s\n",
diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c
index 9b1acd6a8..ff0e71331 100644
--- a/src/providers/ldap/sdap_async_initgroups_ad.c
+++ b/src/providers/ldap/sdap_async_initgroups_ad.c
@@ -269,7 +269,9 @@ sdap_get_ad_match_rule_initgroups_step(struct tevent_req *subreq)
* nested group searches, so we can just update the
* memberships now.
*/
- ret = sdap_initgr_common_store(state->sysdb, state->opts,
+ ret = sdap_initgr_common_store(state->sysdb,
+ state->domain,
+ state->opts,
state->name,
SYSDB_MEMBER_USER,
sysdb_grouplist,
diff --git a/src/providers/ldap/sdap_async_private.h b/src/providers/ldap/sdap_async_private.h
index 871cce4e4..156255b97 100644
--- a/src/providers/ldap/sdap_async_private.h
+++ b/src/providers/ldap/sdap_async_private.h
@@ -107,6 +107,7 @@ int sdap_save_users(TALLOC_CTX *memctx,
char **_usn_value);
int sdap_initgr_common_store(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct sdap_options *opts,
const char *name,
enum sysdb_member_type type,
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 5337b4a6f..d97f4799f 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -3693,7 +3693,8 @@ START_TEST(test_odd_characters)
/* Retrieve */
ret = sysdb_search_group_by_name(test_ctx, test_ctx->sysdb,
- odd_groupname, NULL, &msg);
+ test_ctx->domain,
+ odd_groupname, NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_group_by_name error [%d][%s]",
ret, strerror(ret));
talloc_zfree(msg);
@@ -4444,8 +4445,8 @@ START_TEST(test_sysdb_subdomain_group_ops)
"name=subdomgroup,cn=groups,cn=test.sub,cn=sysdb");
fail_unless(check_dn != NULL);
- ret = sysdb_search_domgroup_by_name(test_ctx, subdomain, "subdomgroup", NULL,
- &msg);
+ ret = sysdb_search_group_by_name(test_ctx, subdomain->sysdb, subdomain,
+ "subdomgroup", NULL, &msg);
fail_unless(ret == EOK, "sysdb_search_domgroup_by_name failed with [%d][%s].",
ret, strerror(ret));
fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0,
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
index f79df9351..93e0acbae 100644
--- a/src/tools/sss_groupshow.c
+++ b/src/tools/sss_groupshow.c
@@ -333,7 +333,7 @@ int group_show(TALLOC_CTX *mem_ctx,
int i;
/* First, search for the root group */
- ret = sysdb_search_group_by_name(mem_ctx, sysdb, name, attrs, &msg);
+ ret = sysdb_search_group_by_name(mem_ctx, sysdb, domain, name, attrs, &msg);
if (ret) {
DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret));
goto done;
@@ -505,8 +505,8 @@ int group_show_recurse(TALLOC_CTX *mem_ctx,
continue;
}
- ret = sysdb_search_group_by_name(mem_ctx, sysdb, group_members[i],
- attrs, &msg);
+ ret = sysdb_search_group_by_name(mem_ctx, sysdb, domain,
+ group_members[i], attrs, &msg);
if (ret) {
DEBUG(2, ("Search failed: %s (%d)\n", strerror(ret), ret));
return EIO;