[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ITS#3985 test039 hangs on Windows



Given that ldap_result() returns only responses from a
single operation (or a single unsolicited response), I
figure that 'results' in LDAP_MORE_RESULTS_TO_RETURN must
have referred to responses, that is searchResultEntry,
SearchResultReference, SearchResultDone.

That is, it would seem reasonable that if the chain of
solicited responses didn't include a final response message
than ldap_parse_result() could return LDAP_MORE_RESULTS_TO_RETURN
to indicate that the final response message is not included
in the chain.

But I note that Mark Smith once described this error
code:
          Returned by ldap_parse_result() when additional result
          messages are present in the chain of messages represented
          by the "res" parameter.

Which begs the question, when can chain contain multiple
result messages.  Now, I would have thought he might have
meant "response messages for a single request", but
note in the draft:
   The LDAPMessage structure is an opaque data type that is
   used to return entry, reference, result, and error information.
   An LDAPMessage structure can represent the beginning of a list,
   or chain of messages that consists of a series of entries,
   references, and result messages as returned by LDAP operations
   such as search.  LDAP API functions such as ldap_parse_result()
   that operate on message chains that can contain more than one
   result message always operate on the first result message in
   the chain.

Now that might lead me to reverse my "I concur" but then
the draft says:
   The ldap_result() function only returns messages for a single request, 
so for all LDAP operations other than search only one result message is 
expected; that is, the only time the "result chain" can contain more 
than one message is if results from a search operation are returned.

So, why do we need LDAP_MORE_RESULTS_TO_RETURN?

Either the chain is complete (there is a final result message to
parse) or its not.  And in the latter case, LDAP_NO_RESULTS_RETURNED
can be returned.

I hate this API!

Kurt

At 02:47 PM 10/7/2005, Howard Chu wrote:
>Kurt D. Zeilenga wrote:
>>>And in ldap_parse_result in libldap/error.c, as I've already pointed out, we queue responses with their originating requests. Any LDAP Request can only have one Result message, regardless of how many intermediate messages may be included. So it appears that all accomodation for this LDAP_MORE_RESULTS_TO_RETURN error code is just excess baggage.
>>>    
>>
>>The only thing I can think it exists for handling of
>>message chains containing responses in reply to
>>multiple requests.
>>
>>  
>Hmmm. But libldap never constructs chains in such a fashion; responses are only chained to their originating request. And there are no APIs for an external caller to link two separate chains together.
>
>Also, in the C API draft section 14 "Handling Errors and Parsing Results" it says "If a chain of messages that contains more than one result message is passed to these routines the always operate on the first result in the chain." And more importantly "If a value other than LDAP_SUCCESS is returned, the values of all the result parameters are undefined." So if you somehow got hold of an aberrant chain with more than one result in it, our ldap_parse_result() would parse the first result (as expected) and then discover the subsequent result, then return LDAP_MORE_RESULTS_TO_RETURN which would totally invalidate all the parsing it did on the first result.
>
>Obviously trying to make sense out of things based on an old broken API spec may not be very fruitful. But one way or another it should make more sense than it currently does.
>
>-- 
> -- Howard Chu
> Chief Architect, Symas Corp.  http://www.symas.com
> Director, Highland Sun        http://highlandsun.com/hyc
> OpenLDAP Core Team            http://www.openldap.org/project/