diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-07 16:47:59 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 10:49:20 +0100 |
commit | 5d72a91a37273c8c874640906fd2f7a70e606812 (patch) | |
tree | 5f8c23d7add8be23cbb23c05cfac04194254db16 /src | |
parent | b23539e420b9962ad3bfd8f305b9d5acf47e7efb (diff) | |
download | sssd-5d72a91a37273c8c874640906fd2f7a70e606812.tar.gz sssd-5d72a91a37273c8c874640906fd2f7a70e606812.tar.xz sssd-5d72a91a37273c8c874640906fd2f7a70e606812.zip |
Add domain to sysdb_search_group_by_gid()
Also remove unused sysdb_search_domgroup_by_gid()
Diffstat (limited to 'src')
-rw-r--r-- | src/db/sysdb.h | 6 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 7 | ||||
-rw-r--r-- | src/db/sysdb_subdomains.c | 11 | ||||
-rw-r--r-- | src/db/sysdb_sudo.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async_initgroups_ad.c | 2 | ||||
-rw-r--r-- | src/providers/simple/simple_access.c | 2 | ||||
-rw-r--r-- | src/responder/pac/pacsrv_cmd.c | 2 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 25 |
8 files changed, 33 insertions, 24 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index 9f9dd9737..eab3ce073 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_gid(TALLOC_CTX *mem_ctx, - struct sss_domain_info *domain, - gid_t gid, - const char **attrs, - struct ldb_message **msg); errno_t sysdb_store_domgroup(struct sss_domain_info *domain, const char *name, gid_t gid, @@ -559,6 +554,7 @@ int sysdb_search_group_by_name(TALLOC_CTX *mem_ctx, int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, gid_t gid, const char **attrs, struct ldb_message **msg); diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 3f216d359..654aa2cfe 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -381,6 +381,7 @@ done: int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, gid_t gid, const char **attrs, struct ldb_message **msg) @@ -399,7 +400,7 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx, } basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, - SYSDB_TMPL_GROUP_BASE, sysdb->domain->name); + SYSDB_TMPL_GROUP_BASE, domain->name); if (!basedn) { ret = ENOMEM; goto done; @@ -1308,7 +1309,7 @@ int sysdb_add_group(struct sysdb_ctx *sysdb, /* check no other groups with the same gid exist */ if (gid != 0) { - ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, + ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, domain, gid, NULL, &msg); if (ret != ENOENT) { if (ret == EOK) ret = EEXIST; @@ -2549,7 +2550,7 @@ int sysdb_delete_group(struct sysdb_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, + ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, sysdb->domain, gid, NULL, &msg); } if (ret) { diff --git a/src/db/sysdb_subdomains.c b/src/db/sysdb_subdomains.c index f98dbd29a..ef6b0ad34 100644 --- a/src/db/sysdb_subdomains.c +++ b/src/db/sysdb_subdomains.c @@ -603,17 +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_gid(TALLOC_CTX *mem_ctx, - struct sss_domain_info *domain, - gid_t gid, - const char **attrs, - struct ldb_message **msg) -{ - CHECK_DOMAIN_INFO(domain); - - return sysdb_search_group_by_gid(mem_ctx, domain->sysdb, gid, attrs, msg); -} - errno_t sysdb_store_domgroup(struct sss_domain_info *domain, const char *name, gid_t gid, diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c index 43c17bd68..2e0738ebe 100644 --- a/src/db/sysdb_sudo.c +++ b/src/db/sysdb_sudo.c @@ -378,7 +378,7 @@ sysdb_get_sudo_user_info(TALLOC_CTX *mem_ctx, const char *username, /* resolve primary group */ gid = ldb_msg_find_attr_as_uint64(msg, SYSDB_GIDNUM, 0); if (gid != 0) { - ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, gid, + ret = sysdb_search_group_by_gid(tmp_ctx, sysdb, sysdb->domain, gid, group_attrs, &group_msg); if (ret == EOK) { primary_group = ldb_msg_find_attr_as_string(group_msg, SYSDB_NAME, diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c index ff0e71331..e0ac7ccd0 100644 --- a/src/providers/ldap/sdap_async_initgroups_ad.c +++ b/src/providers/ldap/sdap_async_initgroups_ad.c @@ -476,7 +476,7 @@ sdap_get_ad_tokengroups_initgroups_lookup_done(struct tevent_req *subreq) gid)); /* Check whether this GID already exists in the sysdb */ - ret = sysdb_search_group_by_gid(tmp_ctx, state->sysdb, + ret = sysdb_search_group_by_gid(tmp_ctx, state->sysdb, state->domain, gid, attrs, &msg); if (ret == EOK) { group_name = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL); diff --git a/src/providers/simple/simple_access.c b/src/providers/simple/simple_access.c index 05388af49..f7f9192e3 100644 --- a/src/providers/simple/simple_access.c +++ b/src/providers/simple/simple_access.c @@ -155,7 +155,7 @@ errno_t simple_access_check(struct simple_ctx *ctx, const char *username, } talloc_zfree(msg); - ret = sysdb_search_group_by_gid(tmp_ctx, ctx->sysdb, + ret = sysdb_search_group_by_gid(tmp_ctx, ctx->sysdb, ctx->domain, gid, group_attrs, &msg); if (ret != EOK) { DEBUG(1, ("Could not look up primary group [%lu]: [%d][%s]\n", diff --git a/src/responder/pac/pacsrv_cmd.c b/src/responder/pac/pacsrv_cmd.c index 3c053a7c3..670421cfb 100644 --- a/src/responder/pac/pacsrv_cmd.c +++ b/src/responder/pac/pacsrv_cmd.c @@ -700,7 +700,7 @@ pac_store_membership(struct pac_req_ctx *pr_ctx, return ENOMEM; } - ret = sysdb_search_group_by_gid(tmp_ctx, grp_dom->sysdb, + ret = sysdb_search_group_by_gid(tmp_ctx, grp_dom->sysdb, grp_dom, gid, group_attrs, &group); if (ret != EOK) { DEBUG(SSSDBG_TRACE_INTERNAL, ("sysdb_search_group_by_gid for gid [%d]" \ diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index d97f4799f..56d9f4242 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -2089,6 +2089,7 @@ START_TEST (test_sysdb_memberof_mod_add) /* Before the add, the groups should not contain the ghost attribute */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2119,6 +2120,7 @@ START_TEST (test_sysdb_memberof_mod_add) */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2186,6 +2188,7 @@ START_TEST (test_sysdb_memberof_mod_replace) */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2211,6 +2214,7 @@ START_TEST (test_sysdb_memberof_mod_replace) */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2284,6 +2288,7 @@ START_TEST (test_sysdb_memberof_mod_replace_keep) */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2338,6 +2343,7 @@ START_TEST (test_sysdb_memberof_mod_replace_keep) */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2497,6 +2503,7 @@ START_TEST (test_sysdb_memberof_check_memberuid_without_group_5) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, _i + MBO_GROUP_BASE, data->attrlist, &data->msg); if (_i == 5) { @@ -2548,6 +2555,7 @@ START_TEST (test_sysdb_memberof_check_memberuid) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, _i + MBO_GROUP_BASE, data->attrlist, &data->msg); @@ -2590,6 +2598,7 @@ START_TEST (test_sysdb_memberof_check_memberuid_loop) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, _i + MBO_GROUP_BASE, data->attrlist, &data->msg); @@ -2632,6 +2641,7 @@ START_TEST (test_sysdb_memberof_check_memberuid_loop_without_group_5) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, _i + MBO_GROUP_BASE, data->attrlist, &data->msg); @@ -2683,6 +2693,7 @@ START_TEST (test_sysdb_memberof_check_nested_ghosts) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid); @@ -2721,6 +2732,7 @@ START_TEST (test_sysdb_memberof_check_nested_double_ghosts) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid); @@ -2762,6 +2774,7 @@ START_TEST (test_sysdb_memberof_remove_child_group_and_check_ghost) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid); @@ -2783,6 +2796,7 @@ START_TEST (test_sysdb_memberof_remove_child_group_and_check_ghost) /* Check the parent again. The inherited ghost user should be gone. */ ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", (unsigned long long) data->gid); @@ -2842,6 +2856,7 @@ START_TEST (test_sysdb_memberof_mod_del) */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2865,6 +2880,7 @@ START_TEST (test_sysdb_memberof_mod_del) /* After the delete, we shouldn't be able to find the ghost attribute */ for (itergid = data->gid ; itergid < MBO_GROUP_BASE + NUM_GHOSTS; itergid++) { ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, itergid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -2914,6 +2930,7 @@ START_TEST (test_sysdb_memberof_check_ghost) data->attrlist[1] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); @@ -3005,6 +3022,7 @@ START_TEST (test_sysdb_memberof_check_convert) data->attrlist[2] = NULL; ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); @@ -3088,6 +3106,7 @@ START_TEST (test_sysdb_memberof_ghost_replace) /* Before the replace, the group has the testghost%_i as a member */ ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -3109,6 +3128,7 @@ START_TEST (test_sysdb_memberof_ghost_replace) /* After the replace, the group has the testghost%_i as a member */ ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -3170,6 +3190,7 @@ START_TEST (test_sysdb_memberof_ghost_replace_noop) /* Before the replace, the group has the testghost%_i as a member */ ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -3191,6 +3212,7 @@ START_TEST (test_sysdb_memberof_ghost_replace_noop) /* After the replace, the group has the testghost%_i as a member */ ret = sysdb_search_group_by_gid(data, test_ctx->sysdb, + test_ctx->domain, data->gid, data->attrlist, &data->msg); fail_if(ret != EOK, "Cannot retrieve group %llu\n", @@ -4452,7 +4474,8 @@ START_TEST(test_sysdb_subdomain_group_ops) fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0, "Unexpedted DN returned"); - ret = sysdb_search_domgroup_by_gid(test_ctx, subdomain, 12345, NULL, &msg); + ret = sysdb_search_group_by_gid(test_ctx, subdomain->sysdb, subdomain, + 12345, NULL, &msg); fail_unless(ret == EOK, "sysdb_search_domgroup_by_gid failed with [%d][%s].", ret, strerror(ret)); fail_unless(ldb_dn_compare(msg->dn, check_dn) == 0, |