https://bugs.openldap.org/show_bug.cgi?id=10060

          Issue ID: 10060
           Summary: libldap: ldap_result return value differs depending on
                    if a search response is already in the response list
                    or not
           Product: OpenLDAP
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: needs_review
          Severity: normal
          Priority: ---
         Component: libraries
          Assignee: b...@openldap.org
          Reporter: da...@hardeman.nu
  Target Milestone: ---

ldap_result(3) is defined here:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L102

On this line, ldap_result will call wait4msg:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L120

wait4msg is defined here:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L238

If a response for a given msgid is already stored in the response list, and
all=1, the whole message chain will be returned by the call from wait4msg to
chkResponseList here:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L297

And rc will be set on the next line to the head of the message chain.

If a response for a given msgid is *not* already stored in the response list,
wait4msg will eventually call try_read1msg here:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L369

If try_read1msg manages to receive the final search result message for a given
msgid, it will be noted here:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L1102

The whole chain will be returned here:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L1141

And the return code will be the tag of the *last* message in the chain, as
opposed to the *first* message in the chain:
https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/result.c#L1153

Which will result in different return codes for chains of multiple messages
(i.e. search results with all=1).

-- 
You are receiving this mail because:
You are on the CC list for the issue.

Reply via email to