diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-07 23:47:44 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 10:53:02 +0100 |
commit | 84c986f9bb2767d8930b6f5d92d34b09b8fabe60 (patch) | |
tree | 7552ac57f6701e1bae11fa977e7eb4bf45b91177 /src | |
parent | a58ccee5afc802c7560624929614616aeefa9bd0 (diff) | |
download | sssd-84c986f9bb2767d8930b6f5d92d34b09b8fabe60.tar.gz sssd-84c986f9bb2767d8930b6f5d92d34b09b8fabe60.tar.xz sssd-84c986f9bb2767d8930b6f5d92d34b09b8fabe60.zip |
Add domain arg to sysdb_search/delete_netgroup()
Diffstat (limited to 'src')
-rw-r--r-- | src/db/sysdb.h | 2 | ||||
-rw-r--r-- | src/db/sysdb_ops.c | 6 | ||||
-rw-r--r-- | src/providers/ipa/ipa_id.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/ldap_id_netgroup.c | 2 | ||||
-rw-r--r-- | src/providers/proxy/proxy_netgroup.c | 12 | ||||
-rw-r--r-- | src/tests/sysdb-tests.c | 3 | ||||
-rw-r--r-- | src/tools/sss_cache.c | 3 |
7 files changed, 18 insertions, 12 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h index ca82c78ee..de5953c2e 100644 --- a/src/db/sysdb.h +++ b/src/db/sysdb.h @@ -771,12 +771,14 @@ int sysdb_delete_group(struct sysdb_ctx *sysdb, int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, struct ldb_message ***msgs); int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name); errno_t sysdb_attrs_to_list(TALLOC_CTX *mem_ctx, diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index a32f41833..06e930e13 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -2622,6 +2622,7 @@ fail: int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -2638,7 +2639,7 @@ int sysdb_search_netgroups(TALLOC_CTX *mem_ctx, } basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, - SYSDB_TMPL_NETGROUP_BASE, sysdb->domain->name); + SYSDB_TMPL_NETGROUP_BASE, domain->name); if (!basedn) { DEBUG(2, ("Failed to build base dn\n")); ret = ENOMEM; @@ -2677,6 +2678,7 @@ fail: /* =Delete-Netgroup-by-Name============================================== */ int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name) { TALLOC_CTX *tmp_ctx; @@ -2690,7 +2692,7 @@ int sysdb_delete_netgroup(struct sysdb_ctx *sysdb, return ENOMEM; } - ret = sysdb_search_netgroup_by_name(tmp_ctx, sysdb, sysdb->domain, + ret = sysdb_search_netgroup_by_name(tmp_ctx, sysdb, domain, name, NULL, &msg); if (ret != EOK && ret != ENOENT) { DEBUG(6, ("sysdb_search_netgroup_by_name failed: %d (%s)\n", diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c index afe0a636d..a44874e05 100644 --- a/src/providers/ipa/ipa_id.c +++ b/src/providers/ipa/ipa_id.c @@ -292,7 +292,7 @@ static void ipa_id_get_netgroup_done(struct tevent_req *subreq) } if (ret == ENOENT) { - ret = sysdb_delete_netgroup(state->sysdb, state->name); + ret = sysdb_delete_netgroup(state->sysdb, state->domain, state->name); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; diff --git a/src/providers/ldap/ldap_id_netgroup.c b/src/providers/ldap/ldap_id_netgroup.c index 58a9a3462..4e2ae4c87 100644 --- a/src/providers/ldap/ldap_id_netgroup.c +++ b/src/providers/ldap/ldap_id_netgroup.c @@ -204,7 +204,7 @@ static void ldap_netgroup_get_done(struct tevent_req *subreq) } if (ret == ENOENT) { - ret = sysdb_delete_netgroup(state->sysdb, state->name); + ret = sysdb_delete_netgroup(state->sysdb, state->domain, state->name); if (ret != EOK && ret != ENOENT) { tevent_req_error(req, ret); return; diff --git a/src/providers/proxy/proxy_netgroup.c b/src/providers/proxy/proxy_netgroup.c index 5dc8efe70..04a0b18d7 100644 --- a/src/providers/proxy/proxy_netgroup.c +++ b/src/providers/proxy/proxy_netgroup.c @@ -101,8 +101,8 @@ static errno_t save_netgroup(struct sysdb_ctx *sysdb, return EOK; } -static errno_t handle_error(enum nss_status status, - struct sysdb_ctx *sysdb, const char *name) +static errno_t handle_error(enum nss_status status, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name) { errno_t ret; @@ -114,7 +114,7 @@ static errno_t handle_error(enum nss_status status, case NSS_STATUS_NOTFOUND: DEBUG(SSSDBG_MINOR_FAILURE, ("The netgroup was not found\n")); - ret = sysdb_delete_netgroup(sysdb, name); + ret = sysdb_delete_netgroup(sysdb, domain, name); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot delete netgroup: %d\n", ret)); ret = EIO; @@ -153,7 +153,7 @@ errno_t get_netgroup(struct proxy_id_ctx *ctx, if (status != NSS_STATUS_SUCCESS) { DEBUG(SSSDBG_OP_FAILURE, ("setnetgrent failed for netgroup [%s].\n", name)); - ret = handle_error(status, sysdb, name); + ret = handle_error(status, sysdb, dom, name); goto done; } @@ -176,7 +176,7 @@ errno_t get_netgroup(struct proxy_id_ctx *ctx, if (status != NSS_STATUS_SUCCESS && status != NSS_STATUS_RETURN && status != NSS_STATUS_NOTFOUND) { - ret = handle_error(status, sysdb, name); + ret = handle_error(status, sysdb, dom, name); DEBUG(SSSDBG_OP_FAILURE, ("getnetgrent_r failed for netgroup [%s]: [%d][%s].\n", name, ret, strerror(ret))); @@ -195,7 +195,7 @@ errno_t get_netgroup(struct proxy_id_ctx *ctx, status = ctx->ops.endnetgrent(&result); if (status != NSS_STATUS_SUCCESS) { DEBUG(SSSDBG_OP_FAILURE, ("endnetgrent failed.\n")); - ret = handle_error(status, sysdb, name); + ret = handle_error(status, sysdb, dom, name); goto done; } diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index e11977bdd..ab0cdb968 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -500,7 +500,8 @@ static int test_remove_netgroup_by_name(struct test_data *data) { int ret; - ret = sysdb_delete_netgroup(data->ctx->sysdb, data->netgrname); + ret = sysdb_delete_netgroup(data->ctx->sysdb, + data->ctx->domain, data->netgrname); return ret; } diff --git a/src/tools/sss_cache.c b/src/tools/sss_cache.c index c974a28b7..c54697145 100644 --- a/src/tools/sss_cache.c +++ b/src/tools/sss_cache.c @@ -302,7 +302,8 @@ static bool invalidate_entries(TALLOC_CTX *ctx, break; case TYPE_NETGROUP: type_string = "netgroup"; - ret = sysdb_search_netgroups(ctx, sysdb, filter, attrs, &msg_count, &msgs); + ret = sysdb_search_netgroups(ctx, sysdb, dinfo, + filter, attrs, &msg_count, &msgs); break; case TYPE_SERVICE: type_string = "service"; |