#49735 ids_sasl_userdb_checkpass frees sdn assigned to pblock
Closed: wontfix 5 years ago Opened 5 years ago by abbra.

ids_sasl_userdb_checkpass() defines sdn value for LDAP_AUTH_SIMPLE and sets it in pblock as SLAPI_TARGET_SDN value. Later in the same code branch sdn is unconditionally freed. This means the value in pblock will be used after free by any other code asking for SLAPI_TARGET_SDN. slapi_pblock_set() does not take a copy of sdn but directly assigns it.

        /* Equivalent to SLAPI_BIND_TARGET_SDN
         * Used by ldbm bind to know who to bind to.
         */
        slapi_pblock_set(pb, SLAPI_TARGET_SDN, (void *)sdn);
        slapi_pblock_set(pb, SLAPI_BIND_CREDENTIALS, &cred);
        /* To make the ldbm-bind code work, we pretend to be a simple auth right now. */
        slapi_pblock_set(pb, SLAPI_BIND_METHOD, &method);
        /* Feed it to pw_verify_be_dn */
        bind_result = pw_verify_be_dn(pb, &referral);
        /* Now check the result. */
        if (bind_result == SLAPI_BIND_REFERRAL) {
            /* If we have a referral do we ignore it for sasl? */
            slapi_entry_free(referral);
        }
        /* Free everything */
        slapi_sdn_free(&sdn);
        slapi_pblock_destroy(pb);

IMHO it is normal to free the sdn after the password verification. The scope of the pblock is local and no other code will use the pblock/sdn.

Metadata Update from @tbordaz:
- Custom field component adjusted to None
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None
- Custom field type adjusted to None
- Custom field version adjusted to None

5 years ago

Ah, I see what you mean -- this pblock is only used for pw_verify_be_dn() run and never reported up. Yes, then it can be closed.

Metadata Update from @tbordaz:
- Issue close_status updated to: invalid
- Issue status updated to: Closed (was: Open)

5 years ago

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

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/2794

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.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: invalid)

3 years ago

Login to comment on this ticket.

Metadata