[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: back-bdb search result code / protocol resultcode
At 11:42 AM 6/21/2004, Jong-Hyuk wrote:
>Related to the sizelimit settings for the internal search, bdb_do_search() seems to have inconsistencies in the implementation return code and in the protocol result code.
In general, I think rs->sr_err should always be a valid LDAP
result code and function return code should be either a
LDAP result code, an LDAP API code, or a slapd internal
code (e.g., SLAP_DISCONNECT). While returning rs-sr_err
as the return code is often appropriate, there are numerous
cases where the return code will be different from the
rs->sr_err.
Another thing that concerns me is rs->sr_err mucking.
For instance, constructs likes:
if (rs->sr_err == SLAPD_DISCONNECT) {
rs->sr_err = LDAP_PROTOCOL_ERROR;
send_ldap_discon( ..., rs );
rs->sr_err = SLAPD_DISCONNECT;
}
return rs->sr_err;
should be avoided. Something like:
if (rc == SLAPD_DISCONNECT) {
rs->sr_err = LDAP_PROTOCOL_ERROR;
send_ldap_discon( ..., rs );
}
return rc;
would be better.
Also, we should avoid returning literals such as -1.
We should use a macro instead. Because, -1 has other
meaning in some contexts (LDAP_SERVER_DOWN, for instance).
Your patch seems to consistent with these guidelines.
>I made a quick patch to make bdb_do_search() use separate rc and rs->sr_err. rs->sr_err will contain the protocol resultcode so that frontend functions can examine the protocol result code as well as the return code of the backend search function. Let me know if inappropriate return codes are being used in the patch (or still in the search function).
>- Jong-Hyuk