From 5b5cb000d63c3edad40ebb420776df2a18950fcb Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Wed, 10 Sep 2014 11:55:24 +0200
Subject: [PATCH 129/130] Ignore referrals in deref and ASQ, too
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reviewed-by: Michal Židek <mzidek@redhat.com>
---
src/providers/ldap/sdap_async.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
index 7db01d979ee81a3707126a4c3eb1f36006e8b392..b06d94bfd9d1a60f587de5c807389c74f908af5e 100644
--- a/src/providers/ldap/sdap_async.c
+++ b/src/providers/ldap/sdap_async.c
@@ -1622,6 +1622,7 @@ static errno_t sdap_x_deref_parse_entry(struct sdap_handle *sh,
struct sdap_x_deref_search_state {
struct sdap_handle *sh;
struct sdap_op *op;
+ struct sdap_options *opts;
struct sdap_attr_map_info *maps;
LDAPControl **ctrls;
@@ -1647,6 +1648,7 @@ sdap_x_deref_search_send(TALLOC_CTX *memctx, struct tevent_context *ev,
state->sh = sh;
state->maps = maps;
state->op = NULL;
+ state->opts = opts;
state->num_maps = num_maps;
state->ctrls = talloc_zero_array(state, LDAPControl *, 2);
if (state->ctrls == NULL) {
@@ -1797,11 +1799,18 @@ static void sdap_x_deref_search_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
+ struct sdap_x_deref_search_state *state = tevent_req_data(req,
+ struct sdap_x_deref_search_state);
int ret;
ret = sdap_get_generic_ext_recv(subreq);
talloc_zfree(subreq);
- if (ret) {
+ if (ret == ERR_REFERRAL) {
+ if (dp_opt_get_bool(state->opts->basic, SDAP_REFERRALS)) {
+ tevent_req_error(req, ret);
+ return;
+ }
+ } else if (ret) {
DEBUG(4, ("sdap_get_generic_ext_recv failed [%d]: %s\n",
ret, sss_strerror(ret)));
tevent_req_error(req, ret);
@@ -2056,11 +2065,18 @@ static void sdap_asq_search_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(subreq,
struct tevent_req);
+ struct sdap_asq_search_state *state =
+ tevent_req_data(req, struct sdap_asq_search_state);
int ret;
ret = sdap_get_generic_ext_recv(subreq);
talloc_zfree(subreq);
- if (ret) {
+ if (ret == ERR_REFERRAL) {
+ if (dp_opt_get_bool(state->opts->basic, SDAP_REFERRALS)) {
+ tevent_req_error(req, ret);
+ return;
+ }
+ } else if (ret) {
DEBUG(4, ("sdap_get_generic_ext_recv failed [%d]: %s\n",
ret, sss_strerror(ret)));
tevent_req_error(req, ret);
--
1.9.3