#1113 Logically dead code in sdap_nested_group_lookup_group
Closed: Fixed None Opened 8 years ago by sgallagh.

I suspect that the comparison here is wrong, or you are missing an assignment somewhere.

2572static errno_t sdap_nested_group_lookup_group(struct tevent_req *req)
2573{
2574    errno_t ret;
2575    const char **sdap_attrs;
2576    char *filter;
CID 12385: Logically dead code (DEADCODE)After this line, the value of "search_bases_filter" is equal to 0.
Assigning: "search_bases_filter" = "NULL".
2577    char *search_bases_filter = NULL;
2578    struct tevent_req *subreq;
2579    struct sdap_nested_group_ctx *state =
2580            tevent_req_data(req, struct sdap_nested_group_ctx);
2581
2582    /*
2583     * If dn is not in group search base, skip it.
2584     */
2585    if (!sss_ldap_dn_in_search_bases(state, state->member_dn,
2586                                     state->opts->group_search_bases,
2587                                     &filter)) {
2588        if (state->derefctx) {
2589            if (state->derefctx->expired_groups_index <
2590                state->derefctx->expired_groups_num) {
2591                state->derefctx->expired_groups_index++;
2592            } else {
2593                state->derefctx->missing_dns_index++;
2594            }
2595            ret = sdap_nested_group_process_noderef(req);
2596        } else {
2597            state->member_index++;
2598            talloc_zfree(state->member_dn);
2599            ret = sdap_nested_group_process_step(req);
2600        }
2601
2602        if (ret == EOK) {
2603            /* EOK means it's complete */
2604            tevent_req_done(req);
2605            tevent_req_post(req, state->ev);
2606        } else if (ret != EAGAIN) {
2607            return ret;
2608        }
2609
2610        return EOK;
2611    }
2612
2613    ret = build_attrs_from_map(state, state->opts->group_map,
2614                               SDAP_OPTS_GROUP, &sdap_attrs);
2615    if (ret != EOK) {
2616        return ret;
2617    }
2618
On this path, the condition "search_bases_filter != NULL" cannot be true.
2619    if (search_bases_filter != NULL) {
Execution cannot reach this statement "filter = talloc_asprintf(sd...".
2620        filter = talloc_asprintf(sdap_attrs, "(&%s(objectclass=%s)(%s=*))",
2621                                 search_bases_filter,
2622                                 state->opts->group_map[SDAP_OC_GROUP].name,
2623                                 state->opts->group_map[SDAP_AT_GROUP_NAME].name);
2624    } else {
2625        filter = talloc_asprintf(sdap_attrs, "(&(objectclass=%s)(%s=*))",
2626                                 state->opts->group_map[SDAP_OC_GROUP].name,
2627                                 state->opts->group_map[SDAP_AT_GROUP_NAME].name);
2628    }
2629    if (!filter) {
2630        talloc_free(sdap_attrs);
2631        return ENOMEM;
2632    }

Fields changed

owner: pbrezina@redhat.com => pbrezina
status: new => assigned

Fields changed

patch: 0 => 1

Fixed by: 340f610

blockedby: =>
blocking: =>
resolution: => fixed
status: assigned => closed

Fields changed

rhbz: => 0

Metadata Update from @sgallagh:
- Issue assigned to pbrezina
- Issue set to the milestone: SSSD 1.7.0

3 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2155

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata